|
@@ -360,7 +360,7 @@ public class ProduceReportServiceImpl extends BaseServiceImpl<ProduceReportMappe
|
|
|
generateCk(date, "0100120", sclList);// 硫酰氯(合成)
|
|
|
generateCk(date, "0100160", sclList);//液碱32%
|
|
|
generateCk(date, "0100086", sclList);//盐酸
|
|
|
- generateCk(date, "0100075", sclList);//氢氧化钠(工业级片碱),这个是手工录入,不计算
|
|
|
+ generateCk(date, "0100075", sclList);//氢氧化钠(工业级片碱),这个是从库存出库获取
|
|
|
|
|
|
// 物料:库存数据
|
|
|
generateStockXCL(date, "0600032");//GS-902
|
|
@@ -514,48 +514,48 @@ public class ProduceReportServiceImpl extends BaseServiceImpl<ProduceReportMappe
|
|
|
ProduceReport dayScl = sclList.stream().filter(dept -> dept.getNo().endsWith("_0300027")).collect(Collectors.toList()).get(0);
|
|
|
String prefixHy = "hy_";
|
|
|
produceData = produceDataService.selectByNo(prefixHy + no);
|
|
|
- report = BeanConverterUtil.copyObjectProperties(produceData, ProduceReport.class);
|
|
|
- report.setDate(date);
|
|
|
- report.setDataId(produceData.getId());
|
|
|
+ ProduceReport dayHy = BeanConverterUtil.copyObjectProperties(produceData, ProduceReport.class);
|
|
|
+ dayHy.setDate(date);
|
|
|
+ dayHy.setDataId(produceData.getId());
|
|
|
|
|
|
if (dayScl == null || dayScl.getValue().compareTo("1") == 0) {
|
|
|
- dayScl.setValue("1");
|
|
|
+ dayHy.setValue("1");
|
|
|
} else {
|
|
|
if (new BigDecimal(dayScl.getValue()).compareTo(new BigDecimal("0")) == 0) {
|
|
|
- report.setValue(produceRecord.getNum().setScale(0, RoundingMode.HALF_UP).toString());
|
|
|
+ dayHy.setValue(produceRecord.getNum().setScale(0, RoundingMode.HALF_UP).toString());
|
|
|
} else {
|
|
|
BigDecimal hyDayValue = new BigDecimal(produceRecord.getNum().toString()).divide(new BigDecimal(dayScl.getValue()).multiply(new BigDecimal(1)), BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(1000)).setScale(0, BigDecimal.ROUND_HALF_UP);
|
|
|
- report.setValue(hyDayValue.toString());
|
|
|
+ dayHy.setValue(hyDayValue.toString());
|
|
|
}
|
|
|
}
|
|
|
- report.setYear(date.getYear());
|
|
|
- report.setMonth(date.getMonthValue());
|
|
|
- report.setDay(date.getDayOfMonth());
|
|
|
- report.setCreatedTime(LocalDateTime.now());
|
|
|
- this.saveModel(report);
|
|
|
+ dayHy.setYear(date.getYear());
|
|
|
+ dayHy.setMonth(date.getMonthValue());
|
|
|
+ dayHy.setDay(date.getDayOfMonth());
|
|
|
+ dayHy.setCreatedTime(LocalDateTime.now());
|
|
|
+ this.saveModel(dayHy);
|
|
|
|
|
|
// 当月单耗
|
|
|
ProduceReport monthScl = sclList.stream().filter(dept -> dept.getNo().endsWith("_0300027_month")).collect(Collectors.toList()).get(0);
|
|
|
produceData = produceDataService.selectByNo(prefixHy + no + "_month");
|
|
|
- report = BeanConverterUtil.copyObjectProperties(produceData, ProduceReport.class);
|
|
|
- report.setDate(date);
|
|
|
- report.setDataId(produceData.getId());
|
|
|
+ ProduceReport monthHy = BeanConverterUtil.copyObjectProperties(produceData, ProduceReport.class);
|
|
|
+ monthHy.setDate(date);
|
|
|
+ monthHy.setDataId(produceData.getId());
|
|
|
|
|
|
if (monthScl == null) {
|
|
|
monthScl.setValue("1");
|
|
|
} else {
|
|
|
if (new BigDecimal(monthScl.getValue()).compareTo(new BigDecimal("0")) == 0) {
|
|
|
- report.setValue(new BigDecimal(monthVO.getTotalValue()).setScale(0, RoundingMode.HALF_UP).toString());
|
|
|
+ monthHy.setValue(new BigDecimal(monthVO.getTotalValue()).setScale(0, RoundingMode.HALF_UP).toString());
|
|
|
} else {
|
|
|
BigDecimal hyDayValue = new BigDecimal(monthVO.getTotalValue()).divide(new BigDecimal(monthScl.getValue()).multiply(new BigDecimal(1)), BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(1000)).setScale(0, BigDecimal.ROUND_HALF_UP);
|
|
|
- report.setValue(hyDayValue.toString());
|
|
|
+ monthHy.setValue(hyDayValue.toString());
|
|
|
}
|
|
|
}
|
|
|
- report.setYear(date.getYear());
|
|
|
- report.setMonth(date.getMonthValue());
|
|
|
- report.setDay(date.getDayOfMonth());
|
|
|
- report.setCreatedTime(LocalDateTime.now());
|
|
|
- this.saveModel(report);
|
|
|
+ monthHy.setYear(date.getYear());
|
|
|
+ monthHy.setMonth(date.getMonthValue());
|
|
|
+ monthHy.setDay(date.getDayOfMonth());
|
|
|
+ monthHy.setCreatedTime(LocalDateTime.now());
|
|
|
+ this.saveModel(monthHy);
|
|
|
|
|
|
|
|
|
// 库存0:hy_电_stock、可用天数0:hy_电_avg
|
|
@@ -1502,10 +1502,12 @@ public class ProduceReportServiceImpl extends BaseServiceImpl<ProduceReportMappe
|
|
|
ProduceReport monthHy = BeanConverterUtil.copyObjectProperties(hyMonth, ProduceReport.class);
|
|
|
monthHy.setDate(date);
|
|
|
monthHy.setDataId(hyMonth.getId());
|
|
|
- if (new BigDecimal("0").compareTo(monthVO.getTotalValue()) == 0 || new BigDecimal(monthScl.getValue()).compareTo(new BigDecimal(0)) <= 0) {
|
|
|
+ log.info("monthVO.getTotalValue():" + monthReport.getValue() + ", monthScl.getValue():" + monthScl.getValue());
|
|
|
+ if (new BigDecimal("0").compareTo(new BigDecimal(monthReport.getValue())) == 0 || new BigDecimal(monthScl.getValue()).compareTo(new BigDecimal(0)) <= 0) {
|
|
|
monthHy.setValue("0");
|
|
|
} else {
|
|
|
- BigDecimal hyMonthValue = (monthVO.getTotalValue().divide(new BigDecimal(monthScl.getValue()).multiply(new BigDecimal(1)), RoundingMode.HALF_UP)).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ BigDecimal hyMonthValue = (new BigDecimal(monthReport.getValue()).divide(new BigDecimal(monthScl.getValue()).multiply(new BigDecimal(1)), RoundingMode.HALF_UP)).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ log.info("hyMonthValue: " + hyMonthValue);
|
|
|
monthHy.setValue(hyMonthValue.toString());
|
|
|
}
|
|
|
monthHy.setYear(date.getYear());
|