|
@@ -196,15 +196,17 @@ public class EmsProdplanYearController extends BaseRESTfulController {
|
|
|
break;
|
|
|
case "JJF" :
|
|
|
sumWeight = model.getWeight().intValue();
|
|
|
- if(model.getLine().equals("AT2011")) {
|
|
|
+ if(model.getLine().equals("AT3009")) {
|
|
|
productid = "粗苯";
|
|
|
+ workProcid = "AT2011";
|
|
|
}
|
|
|
if (model.getLine().equals("AT3024")){
|
|
|
productid="焦油";
|
|
|
- model.setLine("AT2011");
|
|
|
+ workProcid = "AT2011";//model.setLine("AT2011");
|
|
|
}
|
|
|
if(model.getLine().equals("AT3010")){
|
|
|
productid="硫铵";
|
|
|
+ workProcid = "AT3010";
|
|
|
}
|
|
|
unit="008";
|
|
|
//workProcid = "AT1007";
|
|
@@ -346,66 +348,69 @@ public class EmsProdplanYearController extends BaseRESTfulController {
|
|
|
}
|
|
|
// 因为一行数据由多条数据组成,所以这里为了确保数据准确性,应该再根据编号查询一次新的数据
|
|
|
EmsProdplanYear emsProdplanYear = emsProdplanYearService.getById(model.getNo());
|
|
|
-// Calendar c = Calendar.getInstance();
|
|
|
-// int dayMax = 0;
|
|
|
-// try {
|
|
|
-// dayMax = emsProdplanYearService.getDaysOfMonth(emsProdplanYear.getYearmonth());
|
|
|
-// } catch (ParseException e) {
|
|
|
-// e.printStackTrace();
|
|
|
-// }
|
|
|
-// Integer sumWeight = 0;
|
|
|
-// EmsProdplanMonth maxSqno = emsProdplanMonthService.getMaxSqno();
|
|
|
-// String unit = "008";
|
|
|
-// String productid = "";
|
|
|
-// String workProcid = "";
|
|
|
-// switch (model.getParentid()) {
|
|
|
-// case "LG":
|
|
|
-// sumWeight = model.getWeight().intValue();
|
|
|
-// productid="钢坯";
|
|
|
-// unit="008";
|
|
|
-// workProcid = "AT2004";
|
|
|
-// break;
|
|
|
-// case "LT":
|
|
|
-// sumWeight = model.getWeight().intValue();
|
|
|
-// productid="生铁";
|
|
|
-// unit="008";
|
|
|
-// break;
|
|
|
-// case "SJ":
|
|
|
-// sumWeight = model.getWeight().intValue();
|
|
|
-// productid="烧结矿";
|
|
|
-// unit="008";
|
|
|
-// break;
|
|
|
-// case "ZG" :
|
|
|
-// sumWeight = model.getWeight().intValue();
|
|
|
-// productid="线材";
|
|
|
-// if(model.getLine().equals("AT2007")) {
|
|
|
-// productid="H型钢";
|
|
|
-// }
|
|
|
-// unit="008";
|
|
|
-// break;
|
|
|
-// case "FDC" :
|
|
|
-// sumWeight = model.getWeight().intValue();
|
|
|
-// productid="发电量";
|
|
|
-// unit="006";
|
|
|
-// break;
|
|
|
-// case "JCS" :
|
|
|
-// sumWeight = model.getWeight().intValue();
|
|
|
-// productid="白灰";
|
|
|
-// unit="008";
|
|
|
-// break;
|
|
|
-// case "JCW" :
|
|
|
-// sumWeight = model.getWeight().intValue();
|
|
|
-// productid="矿渣粉";
|
|
|
-// unit="008";
|
|
|
-// workProcid = model.getProductid();
|
|
|
-// break;
|
|
|
-// case "JJZ" :
|
|
|
-// sumWeight = model.getWeight1().intValue() + model.getWeight2().intValue();
|
|
|
-// productid="焦炭";
|
|
|
-// unit="008";
|
|
|
-// workProcid = "AT1007";
|
|
|
-// break;
|
|
|
-// case "JJF" :
|
|
|
+ Calendar c = Calendar.getInstance();
|
|
|
+ int dayMax = 0;
|
|
|
+ try {
|
|
|
+ dayMax = emsProdplanYearService.getDaysOfMonth(emsProdplanYear.getYearmonth());
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ Integer sumWeight = 0;
|
|
|
+ EmsProdplanMonth maxSqno = emsProdplanMonthService.getMaxSqno();
|
|
|
+ String unit = "008";
|
|
|
+ String productid = "";
|
|
|
+ String workProcid = "";
|
|
|
+ switch (model.getParentid()) {
|
|
|
+ case "LG":
|
|
|
+ sumWeight = model.getWeight().intValue();
|
|
|
+ productid="方坯";
|
|
|
+ if (model.getLine().equals("AT2007-1")){
|
|
|
+ productid="异型坯";
|
|
|
+ }
|
|
|
+ unit="008";
|
|
|
+ workProcid = "AT2004";
|
|
|
+ break;
|
|
|
+ case "LT":
|
|
|
+ sumWeight = model.getWeight().intValue();
|
|
|
+ productid="生铁";
|
|
|
+ unit="008";
|
|
|
+ break;
|
|
|
+ case "SJ":
|
|
|
+ sumWeight = model.getWeight().intValue();
|
|
|
+ productid="烧结矿";
|
|
|
+ unit="008";
|
|
|
+ break;
|
|
|
+ case "ZG" :
|
|
|
+ sumWeight = model.getWeight().intValue();
|
|
|
+ productid="线材";
|
|
|
+ if(model.getLine().equals("AT2007")) {
|
|
|
+ productid="H型钢";
|
|
|
+ }
|
|
|
+ unit="008";
|
|
|
+ break;
|
|
|
+ case "FDC" :
|
|
|
+ sumWeight = model.getWeight().intValue();
|
|
|
+ productid="发电量";
|
|
|
+ unit="006";
|
|
|
+ break;
|
|
|
+ case "JCS" :
|
|
|
+ sumWeight = model.getWeight().intValue();
|
|
|
+ productid="白灰";
|
|
|
+ unit="008";
|
|
|
+ break;
|
|
|
+ case "JCW" :
|
|
|
+ sumWeight = model.getWeight().intValue();
|
|
|
+ productid="矿渣粉";
|
|
|
+ unit="008";
|
|
|
+ workProcid = model.getProductid();
|
|
|
+ break;
|
|
|
+ case "JJZ" :
|
|
|
+ sumWeight = model.getWeight1().intValue() + model.getWeight2().intValue();
|
|
|
+ productid="焦炭";
|
|
|
+ unit="008";
|
|
|
+ workProcid = "AT1007";
|
|
|
+ break;
|
|
|
+ case "JJF" :
|
|
|
// sumWeight = model.getWeight().intValue();
|
|
|
// productid="焦油";
|
|
|
// if(model.getLine().equals("AT3009")){
|
|
@@ -417,50 +422,68 @@ public class EmsProdplanYearController extends BaseRESTfulController {
|
|
|
// unit="008";
|
|
|
// //workProcid = "AT1007";
|
|
|
// break;
|
|
|
-// default: break;
|
|
|
-// }
|
|
|
-// int[] avgWeight = emsProdplanYearService.avgWeight(sumWeight,dayMax);
|
|
|
-// for (int k = 0;k < dayMax;k++) {
|
|
|
-// EmsProdplanMonth monModel = new EmsProdplanMonth();
|
|
|
-// c.setTime(model.getYearmonth());
|
|
|
-// c.add(Calendar.DATE, k);
|
|
|
-// monModel.setMay(c.getTime());
|
|
|
-// monModel.setUnit(unit);
|
|
|
-// monModel.setProductid(productid);
|
|
|
-// monModel.setWeightMonth(model.getWeight());
|
|
|
-// if (workProcid.equals("")) {
|
|
|
-// monModel.setWorkprocid(model.getLine());
|
|
|
-// } else {
|
|
|
-// monModel.setWorkprocid(workProcid);
|
|
|
-// monModel.setWeightMonth(BigDecimal.valueOf(sumWeight));
|
|
|
-// }
|
|
|
-// monModel.setWeightDay(BigDecimal.valueOf(avgWeight[k]));
|
|
|
-// monModel.setKxf_weight(BigDecimal.valueOf(avgWeight[k]));
|
|
|
-// monModel.setYxf_weight(BigDecimal.valueOf(0));
|
|
|
-// monModel.setJxdays("0");
|
|
|
-// monModel.setMemo("根据年计划,系统自动生成。");
|
|
|
-// monModel.setCreateman("系统");
|
|
|
-// monModel.setCreatetime(new Date());
|
|
|
-// monModel.setSqno(maxSqno.getSqno()+k);
|
|
|
-// Map monMap = new HashMap();
|
|
|
-// monMap.put("may",new SimpleDateFormat("yyyy-MM-dd").format(monModel.getMay()));
|
|
|
-// monMap.put("workprocid","'"+monModel.getWorkprocid()+"'");
|
|
|
-// monMap.put("productid",monModel.getProductid());
|
|
|
-// monMap.put("startTime",new SimpleDateFormat("yyyy-MM-dd").format(monModel.getMay()));
|
|
|
-// monMap.put("endTime",new SimpleDateFormat("yyyy-MM-dd").format(monModel.getMay()));
|
|
|
-// List<EmsProdplanMonth> monList = emsProdplanMonthMapper.selectByParameters(monMap);
|
|
|
-// if(monList.size()<=0){
|
|
|
-// EmsProdplanMonth emsProdplanMonth = emsProdplanMonthService.add(monModel);
|
|
|
-// } else {
|
|
|
-// if(model.getParentid().equals("LG") || model.getParentid().equals("JJZ")) {
|
|
|
-// monModel.setKxf_weight(monList.get(0).getKxf_weight().add(monModel.getKxf_weight()));
|
|
|
-// monModel.setWeightMonth(monList.get(0).getWeightMonth().add(monModel.getWeightMonth()));
|
|
|
-// monModel.setWeightDay(monList.get(0).getWeightDay().add(monModel.getWeightDay()));
|
|
|
-// monModel.setId(monList.get(0).getId());
|
|
|
-// emsProdplanMonthService.modify(monModel);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
+ sumWeight = model.getWeight().intValue();
|
|
|
+ if(model.getLine().equals("AT3009")) {
|
|
|
+ productid = "粗苯";
|
|
|
+ workProcid = "AT2011";
|
|
|
+ }
|
|
|
+ if (model.getLine().equals("AT3024")){
|
|
|
+ productid="焦油";
|
|
|
+ workProcid = "AT2011";
|
|
|
+ }
|
|
|
+ if(model.getLine().equals("AT3010")){
|
|
|
+ productid="硫铵";
|
|
|
+ workProcid = "AT3010";
|
|
|
+ }
|
|
|
+ unit="008";
|
|
|
+ break;
|
|
|
+ default: break;
|
|
|
+ }
|
|
|
+ int[] avgWeight = emsProdplanYearService.avgWeight(sumWeight,dayMax);
|
|
|
+ for (int k = 0;k < dayMax;k++) {
|
|
|
+ EmsProdplanMonth monModel = new EmsProdplanMonth();
|
|
|
+ c.setTime(model.getYearmonth());
|
|
|
+ c.add(Calendar.DATE, k);
|
|
|
+ monModel.setMay(c.getTime());
|
|
|
+ monModel.setUnit(unit);
|
|
|
+ monModel.setProductid(productid);
|
|
|
+ monModel.setWeightMonth(model.getWeight());
|
|
|
+ if (workProcid.equals("")) {
|
|
|
+ monModel.setWorkprocid(model.getLine());
|
|
|
+ } else {
|
|
|
+ monModel.setWorkprocid(workProcid);
|
|
|
+ monModel.setWeightMonth(BigDecimal.valueOf(sumWeight));
|
|
|
+ }
|
|
|
+ monModel.setWeightDay(BigDecimal.valueOf(avgWeight[k]));
|
|
|
+ monModel.setKxf_weight(BigDecimal.valueOf(avgWeight[k]));
|
|
|
+ monModel.setYxf_weight(BigDecimal.valueOf(0));
|
|
|
+ monModel.setJxdays("0");
|
|
|
+ monModel.setMemo("根据年计划,系统自动生成。");
|
|
|
+ monModel.setCreateman("系统");
|
|
|
+ monModel.setCreatetime(new Date());
|
|
|
+ monModel.setSqno(maxSqno.getSqno()+k);
|
|
|
+ Map monMap = new HashMap();
|
|
|
+ monMap.put("may",new SimpleDateFormat("yyyy-MM-dd").format(monModel.getMay()));
|
|
|
+ monMap.put("workprocid","'"+monModel.getWorkprocid()+"'");
|
|
|
+ monMap.put("productid",monModel.getProductid());
|
|
|
+ monMap.put("startTime",new SimpleDateFormat("yyyy-MM-dd").format(monModel.getMay()));
|
|
|
+ monMap.put("endTime",new SimpleDateFormat("yyyy-MM-dd").format(monModel.getMay()));
|
|
|
+ List<EmsProdplanMonth> monList = emsProdplanMonthMapper.selectByParameters(monMap);
|
|
|
+ if(monList.size()<=0){
|
|
|
+ EmsProdplanMonth emsProdplanMonth = emsProdplanMonthService.add(monModel);
|
|
|
+ } else {
|
|
|
+ if((model.getParentid().equals("LG")&&monModel.getProductid().equals("方坯")) || model.getParentid().equals("JJZ")) {
|
|
|
+ //monModel.setKxf_weight(monList.get(0).getKxf_weight().add(monModel.getKxf_weight()));
|
|
|
+ monModel.setWeightMonth(monList.get(0).getWeightMonth().add(monModel.getWeightMonth()));
|
|
|
+ monModel.setWeightDay(monList.get(0).getWeightDay().add(monModel.getWeightDay()));
|
|
|
+ monModel.setId(monList.get(0).getId());
|
|
|
+ emsProdplanMonthService.modify(monModel);
|
|
|
+ } else {
|
|
|
+ monModel.setId(monList.get(0).getId());
|
|
|
+ emsProdplanMonthService.modify(monModel);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
emsProdplanYear.setWeight(model.getWeight());
|
|
|
emsProdplanYear.setWeight1(model.getWeight1());
|
|
|
emsProdplanYear.setWeight2(model.getWeight2());
|