Merge pull request '1、硅钢条料BOM搭建新增主柱末级片逻辑' (#9) from ldy into main

Reviewed-on: http://yunpi.tpddns.cn:3000/ZT_CODE/chint_wuhan/pulls/9
pull/10/head
李冬阳 1 year ago
commit 3f2c541044

@ -1,24 +1,26 @@
package com.chint.plm.createGGBom; package com.chint.plm.createGGBom;
import java.math.BigDecimal;
public class GGBean { public class GGBean {
private String pk; private String pk;
private String weight; private BigDecimal weight;
public GGBean(String pk, String weight) { public GGBean(String pk, BigDecimal weight) {
super(); super();
this.pk = pk; this.pk = pk;
this.weight = weight; this.weight = weight;
} }
public String getPk() { protected String getPk() {
return pk; return pk;
} }
public void setPk(String pk) { protected void setPk(String pk) {
this.pk = pk; this.pk = pk;
} }
public String getWeight() { protected BigDecimal getWeight() {
return weight; return weight;
} }
public void setWeight(String weight) { protected void setWeight(BigDecimal weight) {
this.weight = weight; this.weight = weight;
} }
@Override @Override

@ -75,16 +75,16 @@ public class GGBomController {
// private TCComponent project; // private TCComponent project;
// private String wbsNo = ""; // private String wbsNo = "";
// private String projectDh = ""; // private String projectDh = "";
public Map<String,List<String>> phMap = new HashMap<String,List<String>>(); protected Map<String,List<String>> phMap = new HashMap<String,List<String>>();
private TCComponentItemType itemType; private TCComponentItemType itemType;
public List<String> pkList = new ArrayList<String>(); protected List<String> pkList = new ArrayList<String>();
public List<String> typeList = new ArrayList<String>(); protected List<String> typeList = new ArrayList<String>();
private String groupID; private String groupID;
private String now; private String now;
private String userID; private String userID;
private TCComponentUser dcproxy; private TCComponentUser dcproxy;
private TCComponentFolder newStuffFolder; private TCComponentFolder newStuffFolder;
public static String INSERT_SQL = "insert into chint_material(\"Code\",\"PUID\",\"PmpcCode\",\"GoodsCode\",\"GoodsName\",\"UnitCode\",\"CompanyCode\",\"BpNo\",\"Spec\",\"TeRe\",\"State\",\"User\",\"Time\",\"Condition\",\"Info\")" protected static String INSERT_SQL = "insert into chint_material(\"Code\",\"PUID\",\"PmpcCode\",\"GoodsCode\",\"GoodsName\",\"UnitCode\",\"CompanyCode\",\"BpNo\",\"Spec\",\"TeRe\",\"State\",\"User\",\"Time\",\"Condition\",\"Info\")"
+ " values(?,?,?,?,?,?,?,?,?,?,?,?,to_date(?,'yyyy-mm-dd HH24:mi:ss'),?,?)"; + " values(?,?,?,?,?,?,?,?,?,?,?,?,to_date(?,'yyyy-mm-dd HH24:mi:ss'),?,?)";
Map<String,SelfMPartBean> idBeanMap = new HashMap<String,SelfMPartBean>(); Map<String,SelfMPartBean> idBeanMap = new HashMap<String,SelfMPartBean>();
public GGBomController(AbstractAIFApplication app) { public GGBomController(AbstractAIFApplication app) {
@ -105,7 +105,7 @@ public class GGBomController {
e.printStackTrace(); e.printStackTrace();
} }
} }
public void readSql() throws TCException { protected void readSql() throws Exception {
String sql1 = "SELECT * FROM \"CHINT_SILLICONSTEELSHEET\" order by NO"; String sql1 = "SELECT * FROM \"CHINT_SILLICONSTEELSHEET\" order by NO";
String[] prefs = session.getPreferenceService().getStringValues("database_tc"); String[] prefs = session.getPreferenceService().getStringValues("database_tc");
@ -150,11 +150,11 @@ public class GGBomController {
SqlUtil.freeAll(); SqlUtil.freeAll();
} }
} }
public Map<String,List<RuleBean>> ruleMap = new HashMap<>(); private Map<String,List<RuleBean>> ruleMap = new HashMap<>();
public boolean getGGRule(String ruleName,StringBuffer msg) { protected boolean getGGRule(String ruleName,StringBuffer msg) {
//获取硅钢条料规则 //获取硅钢条料规则
//SELECT * FROM CHINT_SILLICONSTEELSHEET_RULE where "TYPE" = '三相五柱' //SELECT * FROM CHINT_SILLICONSTEELSHEET_RULE where "TYPE" = '三相五柱'
String sql3 = "SELECT WIDTHMIN,WIDTHMAX,MODEL,QUANTITY,USAGE,ISMAKEUP FROM CHINT_SILLICONSTEELSHEET_RULE where \"TYPE\" = ?"; String sql3 = "SELECT WIDTHMIN,WIDTHMAX,MODEL,QUANTITY,USAGE,ISMAKEUP,REMARK FROM CHINT_SILLICONSTEELSHEET_RULE where \"TYPE\" = ?";
String[] prefs = session.getPreferenceService().getStringValues("database_tc"); String[] prefs = session.getPreferenceService().getStringValues("database_tc");
SqlUtil.getTCDataConnection(prefs); SqlUtil.getTCDataConnection(prefs);
ruleMap.clear(); ruleMap.clear();
@ -169,9 +169,12 @@ public class GGBomController {
int qty = read.getInt(4); int qty = read.getInt(4);
String usage = read.getString(5); String usage = read.getString(5);
String makeup = read.getString(6); String makeup = read.getString(6);
String remark = read.getString(7);
if(remark == null)
remark = "";
String[] split = model.split(";"); String[] split = model.split(";");
for(String ggp:split) { for(String ggp : split) {
RuleBean ruleBean = new RuleBean(minWidth,maxWidth,qty,Double.valueOf(usage),makeup.equals("是")); RuleBean ruleBean = new RuleBean(minWidth, maxWidth, qty, Double.valueOf(usage), makeup.equals("是"), remark);
if(ruleMap.containsKey(ggp)) { if(ruleMap.containsKey(ggp)) {
ruleMap.get(ggp).add(ruleBean); ruleMap.get(ggp).add(ruleBean);
}else { }else {
@ -194,7 +197,7 @@ public class GGBomController {
msg.append("以下为合法数据:").append(types.toString()); msg.append("以下为合法数据:").append(types.toString());
} }
} catch (SQLException e) { } catch (Exception e) {
// Auto-generated catch block // Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
}finally { }finally {
@ -202,14 +205,14 @@ public class GGBomController {
} }
return flagSj; return flagSj;
} }
public List<PRD> prds = new ArrayList<PRD>(); private List<PRD> prds = new ArrayList<PRD>();
public String Sql2 = "select t.PrhName,t.PrdLine,t.PrdNo,t.PrdFeatureCode,t.FeatureName,t.PrdCanInput,t.PrdSign from CcemVW_Prd t where t.prhcode = ? order by t.PrdNo"; private String Sql2 = "select t.PrhName,t.PrdLine,t.PrdNo,t.PrdFeatureCode,t.FeatureName,t.PrdCanInput,t.PrdSign from CcemVW_Prd t where t.prhcode = ? order by t.PrdNo";
public PMPC pmpc; private PMPC pmpc;
public String Sql1 = "select t.PmpcPrhCode, t.PmpcPType,t.PmpcMType from CcemVW_Pmpc t where t.PmpcCode=?"; private String Sql1 = "select t.PmpcPrhCode, t.PmpcPType,t.PmpcMType from CcemVW_Pmpc t where t.PmpcCode=?";
private String s_code = "400101016"; private String s_code = "400101016";
public List<SelfMPartBean> self_lists = new ArrayList<SelfMPartBean>(); protected List<SelfMPartBean> self_lists = new ArrayList<SelfMPartBean>();
public Vector<String> drequests = new Vector<String>(); protected Vector<String> drequests = new Vector<String>();
public void send(String ph,String pk) throws SQLException { protected void send(String ph,String pk) throws SQLException {
String pmpcCode = pmpc == null ? "" : pmpc.getCode(); String pmpcCode = pmpc == null ? "" : pmpc.getCode();
String prhCode = pmpc == null ? "" : pmpc.getPrhCode(); String prhCode = pmpc == null ? "" : pmpc.getPrhCode();
@ -285,7 +288,7 @@ public class GGBomController {
self_lists.add(new SelfMPartBean(code, params, null, "")); self_lists.add(new SelfMPartBean(code, params, null, ""));
} }
public CreateIn createMaterialYH(SelfMPartBean bean,String desc) throws TCException, ServiceException { protected CreateIn createMaterialYH(SelfMPartBean bean,String desc) throws TCException, ServiceException {
// Object[] result = new Object[2]; // Object[] result = new Object[2];
// TCComponentItem item = null; // TCComponentItem item = null;
@ -328,7 +331,7 @@ public class GGBomController {
return cI; return cI;
} }
public List<TCComponentItemRevision> changeOwner(CreateOut[] cOs){ protected List<TCComponentItemRevision> changeOwner(CreateOut[] cOs){
//String pa9 = ownUser.get_person().get_PA9(); //String pa9 = ownUser.get_person().get_PA9();
List<TCComponentItemRevision> revList = new ArrayList<TCComponentItemRevision>(); List<TCComponentItemRevision> revList = new ArrayList<TCComponentItemRevision>();
try{ try{
@ -364,7 +367,7 @@ public class GGBomController {
} }
return revList; return revList;
} }
public void applyChilds2() throws SQLException { protected void applyChilds2() throws Exception {
// Object obj1[] = new Object[] { s_code }; // Object obj1[] = new Object[] { s_code };
@ -395,7 +398,7 @@ public class GGBomController {
return; return;
} }
public void applyChilds1() throws SQLException { protected void applyChilds1() throws Exception {
if (SqlUtil.getConnection() == null) { if (SqlUtil.getConnection() == null) {
MessageBox.post("ERROR", "连接模板数据库时失败,请检查连接!", MessageBox.ERROR); MessageBox.post("ERROR", "连接模板数据库时失败,请检查连接!", MessageBox.ERROR);
@ -426,7 +429,7 @@ public class GGBomController {
return; return;
} }
public String getMergedRegionValue(XSSFSheet sheet, int row, int column) { protected String getMergedRegionValue(XSSFSheet sheet, int row, int column) {
int sheetMergeCount = sheet.getNumMergedRegions(); int sheetMergeCount = sheet.getNumMergedRegions();
for (int i = 0; i < sheetMergeCount; i++) { for (int i = 0; i < sheetMergeCount; i++) {
CellRangeAddress ca = sheet.getMergedRegion(i); CellRangeAddress ca = sheet.getMergedRegion(i);
@ -443,59 +446,75 @@ public class GGBomController {
return null; return null;
} }
private List<GGBean> ggBeanList = new ArrayList<>(); private List<GGBean> ggBeanList = new ArrayList<>();
public Double getRule(String type,int pk,double weight) {
private Double getRule(String type, int pk, double weight, boolean first) {
// Map<String,String> pkMap = new LinkedHashMap<>(); // Map<String,String> pkMap = new LinkedHashMap<>();
if(pk==0 || weight==0) { if(pk == 0 || weight == 0) {
return 0.0; return 0.0;
} }
double resultVal = 0.0; double resultVal = 0.0;
if(ruleMap.containsKey(type)) { if(ruleMap.containsKey(type)) {
List<RuleBean> list = ruleMap.get(type); List<RuleBean> list = ruleMap.get(type);
for(RuleBean bean : list) { boolean find = true;
//偏宽在范围之中 if(first) {
if(bean.inPath(pk)) { //TODO lidy20240426新增逻辑excel中同类型首行优先匹配REMAKRK列=主柱末级片的规则
//需要拼片 拼片逻辑 偏宽/2+-30 for(RuleBean bean : list) {
if(bean.isPpFlag()) { if(bean.getRemark().equals("主柱末级片") && bean.inPath(pk)){
int pk1 = pk/2-30; find = false;
int pk2 = pk/2+30; double d = weight * bean.getQty() / bean.getUsage();
double dpk1 = (double)pk1/(pk1+pk2); BigDecimal b = new BigDecimal(d);
double dpk2 = (double)pk2/(pk1+pk2); //String f1 = b.toString();//.setScale(0, BigDecimal.ROUND_UP).toString();
resultVal = weight*bean.getQty(); ggBeanList.add(new GGBean(String.valueOf(pk), b));
// for(RuleBean beanCf : list) { resultVal = weight * bean.getQty();
{ }
double d = weight*bean.getQty()*dpk1/bean.getUsage(); }
BigDecimal b = new BigDecimal(d); }
String f1 = b.setScale(0, BigDecimal.ROUND_HALF_UP).toString(); if(!first || find) {
ggBeanList.add(new GGBean(String.valueOf(pk1), f1)); for(RuleBean bean : list) {
} if(bean.inPath(pk)) {//偏宽在范围之中
{ //需要拼片 拼片逻辑 偏宽/2+-30
double d = weight*bean.getQty()*dpk2/bean.getUsage(); if(bean.isPpFlag()) {
BigDecimal b = new BigDecimal(d); int pk1 = pk / 2 - 30;
String f1 = b.setScale(0, BigDecimal.ROUND_HALF_UP).toString(); int pk2 = pk / 2 + 30;
ggBeanList.add(new GGBean(String.valueOf(pk2), f1)); double dpk1 = (double)pk1 / (pk1 + pk2);
} double dpk2 = (double)pk2 / (pk1 + pk2);
// } resultVal = weight * bean.getQty();
}else { // for(RuleBean beanCf : list) {
//不需要 {
double d = weight*bean.getQty()/bean.getUsage(); double d = weight * bean.getQty() * dpk1 / bean.getUsage();
BigDecimal b = new BigDecimal(d); BigDecimal b = new BigDecimal(d);
String f1 = b.setScale(0, BigDecimal.ROUND_HALF_UP).toString(); //String f1 = b.toString();//.setScale(0, BigDecimal.ROUND_UP).toString();
ggBeanList.add(new GGBean(String.valueOf(pk), f1)); ggBeanList.add(new GGBean(String.valueOf(pk1), b));
resultVal = weight*bean.getQty(); }
} {
} double d = weight * bean.getQty() * dpk2 / bean.getUsage();
} BigDecimal b = new BigDecimal(d);
//String f1 = b.toString();//.setScale(0, BigDecimal.ROUND_UP).toString();
ggBeanList.add(new GGBean(String.valueOf(pk2), b));
}
// }
}else {
//不需要
double d = weight * bean.getQty() / bean.getUsage();
BigDecimal b = new BigDecimal(d);
//String f1 = b.toString();//.setScale(0, BigDecimal.ROUND_UP).toString();
ggBeanList.add(new GGBean(String.valueOf(pk), b));
resultVal = weight * bean.getQty();
}
}
}
}
}else { }else {
BigDecimal b = new BigDecimal(weight); BigDecimal b = new BigDecimal(weight);
resultVal = b.doubleValue(); resultVal = b.doubleValue();
String f1 = b.setScale(0, BigDecimal.ROUND_HALF_UP).toString(); //String f1 = b.toString();//.setScale(0, BigDecimal.ROUND_UP).toString();
ggBeanList.add(new GGBean(String.valueOf(pk), f1)); ggBeanList.add(new GGBean(String.valueOf(pk), b));
} }
return resultVal; return resultVal;
} }
private BigDecimal totalDecimal;//numTotal private BigDecimal totalDecimal;//numTotal
// private Map<String,String> pkMap = new LinkedHashMap<>(); // private Map<String,String> pkMap = new LinkedHashMap<>();
public void readExcel(File tmpFile) throws Exception { protected void readExcel(File tmpFile) throws Exception {
FileInputStream in = new FileInputStream(tmpFile); FileInputStream in = new FileInputStream(tmpFile);
XSSFWorkbook wb = new XSSFWorkbook(in); XSSFWorkbook wb = new XSSFWorkbook(in);
@ -504,30 +523,31 @@ public class GGBomController {
int cnt = sheetAt.getPhysicalNumberOfRows(); int cnt = sheetAt.getPhysicalNumberOfRows();
BigDecimal b = new BigDecimal("0"); BigDecimal b = new BigDecimal("0");
for(int i=5;i<cnt;i++) { String type0 = "";
for(int i = 5; i < cnt; i++) {
//获取合并单元格的值 //获取合并单元格的值
String cellValue1 = getMergedRegionValue(sheetAt,i,0); String cellValue1 = getMergedRegionValue(sheetAt, i, 0);
String cellValue2 = getCellValue(sheetAt,i,1); String cellValue2 = getCellValue(sheetAt, i, 1);
String cellValue3 = getCellValue(sheetAt,i,2); String cellValue3 = getCellValue(sheetAt, i, 2);
if(cellValue1 !=null &&!cellValue2.equals("")&&!cellValue3.equals("")) { if(cellValue1 != null && !cellValue2.equals("") && !cellValue3.equals("")) {
System.out.println("cellValue1 ==> "+cellValue1); System.out.println("cellValue1 ==> "+cellValue1);
double cellVal = getRule(cellValue1,Integer.valueOf(cellValue2),Double.valueOf(cellValue3)); double cellVal = getRule(cellValue1, Integer.valueOf(cellValue2), Double.valueOf(cellValue3), !type0.equals(cellValue1));
b = b.add(new BigDecimal(cellVal)); b = b.add(new BigDecimal(cellVal));
// pkMap.put(cellValue1, cellValue2); // pkMap.put(cellValue1, cellValue2);
} }
type0 = cellValue1;
} }
totalDecimal = b; totalDecimal = b;
System.out.println(ggBeanList.toString()); System.out.println(ggBeanList.toString());
} }
public void createBomExcel(String ph,TCComponentItemRevision parentRev,MyProgressBarCompent my,GGBomDialog dialog,String ruleName) throws Exception { protected void createBomExcel(String ph,TCComponentItemRevision parentRev,MyProgressBarCompent my,GGBomDialog dialog,String ruleName) throws Exception {
// List<String> nums = new ArrayList<String>(); // List<String> nums = new ArrayList<String>();
// List<TCComponentItemRevision> childs = new ArrayList<TCComponentItemRevision>(); // List<TCComponentItemRevision> childs = new ArrayList<TCComponentItemRevision>();
Map<TCComponentItemRevision,String> childMap = new LinkedHashMap<>(); Map<TCComponentItemRevision, BigDecimal> childMap = new LinkedHashMap<>();
StringBuffer errBuffer = new StringBuffer(""); StringBuffer errBuffer = new StringBuffer("");
int num = 0; int num = 0;
int count = ggBeanList.size(); int count = ggBeanList.size();
Collections.sort(ggBeanList, new Comparator<GGBean>() { Collections.sort(ggBeanList, new Comparator<GGBean>() {
@Override @Override
public int compare(GGBean o1, GGBean o2) { public int compare(GGBean o1, GGBean o2) {
return o1.getPk().compareTo(o2.getPk()); return o1.getPk().compareTo(o2.getPk());
@ -535,44 +555,43 @@ public class GGBomController {
}); });
boolean hasSq = false; boolean hasSq = false;
BigDecimal numTotal = new BigDecimal("0"); BigDecimal numTotal = new BigDecimal("0");
Map<String,TCComponentItemRevision> matnrMap = new HashMap<>(); Map<String, TCComponentItemRevision> matnrMap = new HashMap<>();
for(GGBean ggbean:ggBeanList) { for(GGBean ggbean : ggBeanList) {
num = num+1; num = num + 1;
my.setShowLabel("正在获取第 " + num + "/" + count + " 个硅钢条料"); my.setShowLabel("正在获取第 " + num + "/" + count + " 个硅钢条料");
Map<String, String> fields = new LinkedHashMap<String, String>(); Map<String, String> fields = new LinkedHashMap<String, String>();
fields.put("物料分类码", "400101016"); fields.put("物料分类码", "400101016");
//*牌号*片宽* //*牌号*片宽*
String desc = "*"+ph+"/"+ggbean.getPk(); String desc = "*" + ph + "/" + ggbean.getPk();
System.out.println("desc==>"+desc); System.out.println("desc==>"+desc);
fields.put("描述", desc); fields.put("描述", desc);
numTotal = numTotal.add(new BigDecimal(ggbean.getWeight())); numTotal = numTotal.add(ggbean.getWeight());
if(matnrMap.containsKey(desc)) { if(matnrMap.containsKey(desc)) {
// childs.add(matnrMap.get(desc)); // childs.add(matnrMap.get(desc));
// nums.add(ggbean.getWeight()); // nums.add(ggbean.getWeight());
if(childMap.containsKey(matnrMap.get(desc))) { if(childMap.containsKey(matnrMap.get(desc))) {
String string = childMap.get(matnrMap.get(desc)); BigDecimal b = childMap.get(matnrMap.get(desc));
BigDecimal b = new BigDecimal(string); BigDecimal a = ggbean.getWeight();
BigDecimal a = new BigDecimal(ggbean.getWeight());
BigDecimal add = b.add(a); BigDecimal add = b.add(a);
childMap.put(matnrMap.get(desc), add.toString()); childMap.put(matnrMap.get(desc), add);
}else { }else {
childMap.put(matnrMap.get(desc), ggbean.getWeight()); childMap.put(matnrMap.get(desc), ggbean.getWeight());
} }
continue; continue;
} }
TCComponentContextList materials = KUtil.query(session, "chint_search_siliconsteelsheet", fields); TCComponentContextList materials = KUtil.query(session, "chint_search_siliconsteelsheet", fields);
if(materials.getListCount()==1) { if(materials.getListCount() == 1) {
TCComponent component = (TCComponent) materials.get(0).getComponent(); TCComponent component = (TCComponent) materials.get(0).getComponent();
System.out.println("component==>"+component); System.out.println("component==>" + component);
// childs.add((TCComponentItemRevision)component); // childs.add((TCComponentItemRevision)component);
// nums.add(ggbean.getWeight()); // nums.add(ggbean.getWeight());
TCComponentItemRevision rev =(TCComponentItemRevision)component; TCComponentItemRevision rev = (TCComponentItemRevision)component;
if(childMap.containsKey(rev)) { if(childMap.containsKey(rev)) {
String string = childMap.get(rev); //String string = childMap.get(rev);
BigDecimal b = new BigDecimal(string); BigDecimal b = childMap.get(rev);
BigDecimal a = new BigDecimal(ggbean.getWeight()); BigDecimal a = ggbean.getWeight();
BigDecimal add = b.add(a); BigDecimal add = b.add(a);
childMap.put(rev, add.toString()); childMap.put(rev, add);
}else { }else {
childMap.put(rev, ggbean.getWeight()); childMap.put(rev, ggbean.getWeight());
} }
@ -585,15 +604,15 @@ public class GGBomController {
SqlUtil.getTCDataConnection(prefs); SqlUtil.getTCDataConnection(prefs);
self_lists.clear(); self_lists.clear();
drequests.clear(); drequests.clear();
send(ph,ggbean.getPk()); send(ph, ggbean.getPk());
System.out.println("申请物料"+drequests.toString()); System.out.println("申请物料" + drequests.toString());
List<CreateIn> cIList = new ArrayList<>(); List<CreateIn> cIList = new ArrayList<>();
for (int i = 0; i < self_lists.size(); i++) { for (int i = 0; i < self_lists.size(); i++) {
int t = i+1; int t = i+1;
System.out.println("正在创建第"+t+"个物料!"); System.out.println("正在创建第" + t + "个物料!");
SelfMPartBean bean = self_lists.get(i); SelfMPartBean bean = self_lists.get(i);
CreateIn createMaterialYH = createMaterialYH(bean,ph+"/"+ggbean.getPk()); //groupID bean.getSpec(); m_code CreateIn createMaterialYH = createMaterialYH(bean,ph + "/" + ggbean.getPk()); //groupID bean.getSpec(); m_code
if(createMaterialYH!=null) { if(createMaterialYH != null) {
cIList.add(createMaterialYH); cIList.add(createMaterialYH);
} }
} }
@ -603,11 +622,11 @@ public class GGBomController {
CreateOut[] cOs = resp.output; CreateOut[] cOs = resp.output;
List<TCComponentItemRevision> changeOwner = changeOwner(cOs); List<TCComponentItemRevision> changeOwner = changeOwner(cOs);
if(childMap.containsKey(changeOwner.get(0))) { if(childMap.containsKey(changeOwner.get(0))) {
String string = childMap.get(changeOwner.get(0)); //String string = childMap.get(changeOwner.get(0));
BigDecimal b = new BigDecimal(string); BigDecimal b = childMap.get(changeOwner.get(0));
BigDecimal a = new BigDecimal(ggbean.getWeight()); BigDecimal a = ggbean.getWeight();
BigDecimal add = b.add(a); BigDecimal add = b.add(a);
childMap.put(changeOwner.get(0), add.toString()); childMap.put(changeOwner.get(0), add);
}else { }else {
childMap.put(changeOwner.get(0), ggbean.getWeight()); childMap.put(changeOwner.get(0), ggbean.getWeight());
} }
@ -657,7 +676,7 @@ public class GGBomController {
return; return;
}else { }else {
my.setShowLabel("正在获取搭建硅钢条料BOM"); my.setShowLabel("正在获取搭建硅钢条料BOM");
createBomChild(parentRev,childMap); createBomChild(parentRev, childMap);
my.setVisible(false); my.setVisible(false);
// numTotal; // numTotal;
String[] prefs = session.getPreferenceService().getStringValues("database_tc"); String[] prefs = session.getPreferenceService().getStringValues("database_tc");
@ -669,7 +688,7 @@ public class GGBomController {
if(read2.next()) { if(read2.next()) {
String min = read2.getString(1); String min = read2.getString(1);
String max = read2.getString(2); String max = read2.getString(2);
Double val = totalDecimal.divide(numTotal,BigDecimal.ROUND_CEILING).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); Double val = totalDecimal.divide(numTotal,BigDecimal.ROUND_CEILING).setScale(2, BigDecimal.ROUND_UP).doubleValue();
build.append("当前铁心平均利用率为");//当前铁心平均利用率为0.95允许的利用率为0.9~0.95,符合要求 build.append("当前铁心平均利用率为");//当前铁心平均利用率为0.95允许的利用率为0.9~0.95,符合要求
build.append(val).append(",允许的利用率为").append(min).append("-").append(max); build.append(val).append(",允许的利用率为").append(min).append("-").append(max);
@ -696,7 +715,7 @@ public class GGBomController {
} }
public void sendMsg(String mess, String userID) throws IOException { protected void sendMsg(String mess, String userID) throws IOException {
try { try {
// TXTUtil.writeTXT(logPath, "开始AM消息推送"); // TXTUtil.writeTXT(logPath, "开始AM消息推送");
// TXTUtil.writeTXT(logPath, "用户:" + userID + ";信息:" + mess); // TXTUtil.writeTXT(logPath, "用户:" + userID + ";信息:" + mess);
@ -711,7 +730,7 @@ public class GGBomController {
// TXTUtil.writeTXT(logPath, "AM消息推送结束"); // TXTUtil.writeTXT(logPath, "AM消息推送结束");
} }
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void createBomChild(TCComponentItemRevision parentRev,Map<TCComponentItemRevision,String> childMap ) { protected void createBomChild(TCComponentItemRevision parentRev, Map<TCComponentItemRevision, BigDecimal> childMap ) {
try { try {
ICCTReservationService reservationService = new ICCTReservationService(session.getSoaConnection()); ICCTReservationService reservationService = new ICCTReservationService(session.getSoaConnection());
TCComponent[] strustRevs = parentRev.getReferenceListProperty("structure_revisions"); TCComponent[] strustRevs = parentRev.getReferenceListProperty("structure_revisions");
@ -726,12 +745,13 @@ public class GGBomController {
AttributesInfo attr; AttributesInfo attr;
List<RelativeStructureChildInfo> childInfos = new ArrayList<>(); List<RelativeStructureChildInfo> childInfos = new ArrayList<>();
RelativeStructureChildInfo childInfo; RelativeStructureChildInfo childInfo;
for(TCComponentItemRevision rev:childMap.keySet()) { for(TCComponentItemRevision rev : childMap.keySet()) {
childInfo = new RelativeStructureChildInfo(); childInfo = new RelativeStructureChildInfo();
occInfo = new RelOccInfo(); occInfo = new RelOccInfo();
attr = new AttributesInfo(); attr = new AttributesInfo();
attr.name = "bl_quantity"; attr.name = "bl_quantity";
attr.value = childMap.get(rev); //attr.value = childMap.get(rev);
attr.value = childMap.get(rev).setScale(0, BigDecimal.ROUND_UP).toString();
// AttributesInfo attr1 = new AttributesInfo(); // AttributesInfo attr1 = new AttributesInfo();
// attr1.name = "bl_sequence_no"; // attr1.name = "bl_sequence_no";
@ -782,7 +802,7 @@ public class GGBomController {
} }
} }
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void createBomChild(TCComponentItemRevision parentRev,List<TCComponentItemRevision> childs,List<String> nums) { protected void createBomChild(TCComponentItemRevision parentRev,List<TCComponentItemRevision> childs,List<String> nums) {
ICCTReservationService reservationService = new ICCTReservationService( ICCTReservationService reservationService = new ICCTReservationService(
session.getSoaConnection()); session.getSoaConnection());
try { try {

@ -8,17 +8,19 @@ public class RuleBean {
private int qty; private int qty;
private double usage; private double usage;
private boolean ppFlag = false;//ÊÇ·ñÐèҪƴƬ private boolean ppFlag = false;//ÊÇ·ñÐèҪƴƬ
private String remark;
public RuleBean(int minWidth, int maxWidth, int qty, double usage, boolean ppFlag) { public RuleBean(int minWidth, int maxWidth, int qty, double usage, boolean ppFlag, String remark) {
super(); super();
this.minWidth = minWidth; this.minWidth = minWidth;
this.maxWidth = maxWidth; this.maxWidth = maxWidth;
this.qty = qty; this.qty = qty;
this.usage = usage; this.usage = usage;
this.ppFlag = ppFlag; this.ppFlag = ppFlag;
this.remark = remark;
} }
public boolean inPath(int len) { protected boolean inPath(int len) {
if(len>=minWidth && len<=maxWidth) { if(len>=minWidth && len<=maxWidth) {
return true; return true;
@ -26,44 +28,52 @@ public class RuleBean {
return false; return false;
} }
public int getMinWidth() { protected int getMinWidth() {
return minWidth; return minWidth;
} }
public void setMinWidth(int minWidth) { protected void setMinWidth(int minWidth) {
this.minWidth = minWidth; this.minWidth = minWidth;
} }
public int getMaxWidth() { protected int getMaxWidth() {
return maxWidth; return maxWidth;
} }
public void setMaxWidth(int maxWidth) { protected void setMaxWidth(int maxWidth) {
this.maxWidth = maxWidth; this.maxWidth = maxWidth;
} }
public int getQty() { protected int getQty() {
return qty; return qty;
} }
public void setQty(int qty) { protected void setQty(int qty) {
this.qty = qty; this.qty = qty;
} }
public double getUsage() { protected double getUsage() {
return usage; return usage;
} }
public void setUsage(double usage) { protected void setUsage(double usage) {
this.usage = usage; this.usage = usage;
} }
public boolean isPpFlag() { protected boolean isPpFlag() {
return ppFlag; return ppFlag;
} }
public void setPpFlag(boolean ppFlag) { protected void setPpFlag(boolean ppFlag) {
this.ppFlag = ppFlag; this.ppFlag = ppFlag;
} }
protected String getRemark() {
return remark;
}
protected void setRemark(String remark) {
this.remark = remark;
}
} }

@ -171,8 +171,10 @@ public class ProcessCheckDialog extends AbstractAIFDialog {
bomSet.add(cuid); bomSet.add(cuid);
TCComponentBOMLine line = data.bomLine; TCComponentBOMLine line = data.bomLine;
//只获取其中包含首选项定义的物料名称的物料版本(精确匹配) //只获取其中包含首选项定义的物料名称的物料版本(精确匹配)
if(TCUtil.contains(names, line.getProperty("bl_item_object_name"))) if(!TCUtil.contains(names, line.getProperty("bl_item_object_name"))) {
recycleBOM(bomLineTree, line.getUid());
continue; continue;
}
AIFComponentContext[] meops = rev.whereReferencedByTypeRelation(new String[] { "MEProcessRevision" }, AIFComponentContext[] meops = rev.whereReferencedByTypeRelation(new String[] { "MEProcessRevision" },
new String[] { "IMAN_METarget" }); new String[] { "IMAN_METarget" });
Object[] value = new Object[4]; Object[] value = new Object[4];

Loading…
Cancel
Save