Ver código fonte

Merge branch 'master' of http://47.100.37.243:10191/wutt/manHourHousekeeper

Min 1 ano atrás
pai
commit
b3fe225896

+ 24 - 14
fhKeeper/formulahousekeeper/management-workshop/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -4976,20 +4976,30 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                 List<ProdProcedure> hasReportProcedures = targetProdProcedures.stream().filter(ts -> hasReportProdProduceIds.contains(ts.getId())).collect(Collectors.toList());
                 BigDecimal bigDecimalTime=new BigDecimal(0);
                 BigDecimal bigDecimalCost=new BigDecimal(0);
-                for (ProdProcedure hasReportProcedure : hasReportProcedures) {
-                    //找到当前工序所在产品总预算工时
-                    BigDecimal decimalTime = new BigDecimal(hasReportProcedure.getWorkingTime());
-                    BigDecimal divideTime = decimalTime.divide(reduceTime, 3,BigDecimal.ROUND_HALF_UP);
-                    BigDecimal checkTime = new BigDecimal(1);
-                    checkTime=checkTime.multiply(divideTime).setScale(3,BigDecimal.ROUND_HALF_UP);
-                    bigDecimalTime=bigDecimalTime.add(checkTime).setScale(3,BigDecimal.ROUND_HALF_UP);
-                    //找到当前工序所在产品总预算工时
-                    BigDecimal decimalCost = new BigDecimal(String.valueOf(hasReportProcedure.getUnitPrice()));
-                    BigDecimal divideCost = decimalCost.divide(reduceCost, 3,BigDecimal.ROUND_HALF_UP);
-                    BigDecimal checkCost = new BigDecimal(1);
-                    checkCost=checkCost.multiply(divideCost).setScale(3,BigDecimal.ROUND_HALF_UP);
-                    bigDecimalCost=bigDecimalCost.add(checkCost).setScale(3,BigDecimal.ROUND_HALF_UP);
-                }
+//                for (ProdProcedure hasReportProcedure : hasReportProcedures) {
+//                    //找到当前工序所在产品总预算工时
+//                    BigDecimal decimalTime = new BigDecimal(hasReportProcedure.getWorkingTime());
+//                    BigDecimal divideTime = decimalTime.divide(reduceTime, 3,BigDecimal.ROUND_HALF_UP);
+//                    BigDecimal checkTime = new BigDecimal(1);
+//                    checkTime=checkTime.multiply(divideTime).setScale(3,BigDecimal.ROUND_HALF_UP);
+//                    bigDecimalTime=bigDecimalTime.add(checkTime).setScale(3,BigDecimal.ROUND_HALF_UP);
+//                    //找到当前工序所在产品总预算工时
+//                    BigDecimal decimalCost = new BigDecimal(String.valueOf(hasReportProcedure.getUnitPrice()));
+//                    BigDecimal divideCost = decimalCost.divide(reduceCost, 3,BigDecimal.ROUND_HALF_UP);
+//                    BigDecimal checkCost = new BigDecimal(1);
+//                    checkCost=checkCost.multiply(divideCost).setScale(3,BigDecimal.ROUND_HALF_UP);
+//                    bigDecimalCost=bigDecimalCost.add(checkCost).setScale(3,BigDecimal.ROUND_HALF_UP);
+//                }
+                BigDecimal targetTime = hasReportProcedures.stream().map(i -> new BigDecimal(i.getWorkingTime())).reduce(BigDecimal.ZERO, BigDecimal::add);
+                BigDecimal targetCost= hasReportProcedures.stream().map(i -> new BigDecimal(String.valueOf(i.getUnitPrice()))).reduce(BigDecimal.ZERO, BigDecimal::add);
+                BigDecimal divideTime = targetTime.divide(reduceTime, 3,BigDecimal.ROUND_HALF_UP);
+                BigDecimal divideCost = targetCost.divide(reduceCost, 3,BigDecimal.ROUND_HALF_UP);
+                BigDecimal checkTime = new BigDecimal(1);
+                checkTime=checkTime.multiply(divideTime).setScale(3,BigDecimal.ROUND_HALF_UP);
+                BigDecimal checkCost = new BigDecimal(1);
+                checkCost=checkCost.multiply(divideCost).setScale(3,BigDecimal.ROUND_HALF_UP);
+                bigDecimalTime=bigDecimalTime.add(checkTime).setScale(3,BigDecimal.ROUND_HALF_UP);
+                bigDecimalCost=bigDecimalCost.add(checkCost).setScale(3,BigDecimal.ROUND_HALF_UP);
                 convertedTime=convertedTime.add(bigDecimalTime);
                 convertedCost=convertedCost.add(bigDecimalCost);
             }

+ 1 - 1
fhKeeper/formulahousekeeper/timesheet-workshop-h5/src/views/workView/fillReport.vue

@@ -210,7 +210,7 @@ export default {
             this.reportForm = res.data;
             this.oldPlanSteelStampNumberList=this.reportForm.planSteelStampNumberList
             //当日选中的钢印号,默认勾选上
-            this.reportForm.checkedSteelNum = this.reportForm.steelNumArray;
+            this.reportForm.checkedSteelNum = this.reportForm.steelNumArray==null?[]:this.reportForm.steelNumArray;
             if (this.reportForm.check_type == 0) {
               //自检
               this.reportForm.checker_name = this.user.name;