瀏覽代碼

优化标准成本计算功能

wangqiong 1 年之前
父節點
當前提交
2872719a68

+ 26
- 0
qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/FlowDefinitionController.java 查看文件

@@ -0,0 +1,26 @@
1
+package com.zzsmart.qomo.kn.cost.manage.controller;
2
+
3
+import com.zzsmart.qomo.controller.DataFlowDefinitionController;
4
+import org.slf4j.Logger;
5
+import org.slf4j.LoggerFactory;
6
+import org.springframework.web.bind.annotation.RequestMapping;
7
+import org.springframework.web.bind.annotation.RestController;
8
+
9
+@RestController
10
+@RequestMapping
11
+public class FlowDefinitionController {
12
+
13
+    private static final Logger log = LoggerFactory.getLogger(DataFlowDefinitionController.class);
14
+//    @Autowired
15
+//    FlowDefinitionService definitionService;
16
+
17
+//    @GetMapping({"/list"})
18
+//    public Result<IPage<FlowDefinition>> queryPageList(FlowDefinition flowDefinition, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
19
+//        QueryWrapper<FlowDefinition> queryWrapper = QueryGenerator.initQueryWrapper(flowDefinition, req.getParameterMap());
20
+//        Page<FlowDefinition> page = new Page((long) pageNo, (long) pageSize);
21
+//        LambdaQueryWrapper<FlowDefinition> wrapper = queryWrapper.lambda();
22
+//        wrapper.orderByDesc(FlowDefinition::getCreateTime);
23
+//        IPage<FlowDefinition> pageList = definitionService.queryPageList(page, wrapper);
24
+//        return Result.OK(pageList);
25
+//    }
26
+}

+ 4
- 1
qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/enums/FeeTypeEnum.java 查看文件

@@ -8,7 +8,10 @@ package com.zzsmart.qomo.kn.cost.manage.enums;
8 8
  * @Created wangqiong
9 9
  */
10 10
 public enum FeeTypeEnum {
11
-    EquipmentFee("EquipmentFee", "机器折旧费"), SupplyMaterialFee("SupplyMaterialFee", "辅料费"), DriverFee("DriverFee", "水电费"), OtherFee("OtherFee", "其他费用"), LogisticsFee("LogisticsFee", "物流费");
11
+
12
+    LaborCost("LaborCost", "人工成本"),
13
+    MaterialCost("MaterialCost", "物料成本"),
14
+    EquipmentFee("EquipmentFee", "设备费"), SupplyMaterialFee("SupplyMaterialFee", "辅料费"), DriverFee("DriverFee", "水电费"), OtherFee("OtherFee", "其他费用"), LogisticsFee("LogisticsFee", "物流费");
12 15
 
13 16
     private final String code;
14 17
     private final String text;

+ 3
- 0
qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/CostMaterialBomMapper.java 查看文件

@@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Mapper;
7 7
 import org.apache.ibatis.annotations.Param;
8 8
 import org.apache.ibatis.annotations.Select;
9 9
 
10
+import java.sql.Blob;
10 11
 import java.util.List;
11 12
 
12 13
 /**
@@ -31,4 +32,6 @@ public interface CostMaterialBomMapper extends BaseMapper<CostMaterialBom> {
31 32
 
32 33
     @Select("${selectSql}")
33 34
     JSONObject customSelectOne(@Param("selectSql") String selectSql);
35
+    @Select("${SelectBlobModel}")
36
+    String customSelectBlobModelJson(@Param("SelectBlobModel") String SelectBlobModel);
34 37
 }

+ 71
- 34
qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/plugin/StandardCostService.java 查看文件

@@ -2,17 +2,13 @@ package com.zzsmart.qomo.kn.cost.manage.plugin;
2 2
 
3 3
 import com.alibaba.fastjson.JSON;
4 4
 import com.alibaba.fastjson.JSONObject;
5
-import com.zzsmart.qomo.dao.entity.FlowDefinition;
6 5
 import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostResultValue;
7 6
 import com.zzsmart.qomo.kn.cost.manage.entity.CostMaterialBom;
8 7
 import com.zzsmart.qomo.kn.cost.manage.entity.CostMaterialProcessHours;
9 8
 import com.zzsmart.qomo.kn.cost.manage.entity.HourRate;
10 9
 import com.zzsmart.qomo.kn.cost.manage.enums.FeeTypeEnum;
11 10
 import com.zzsmart.qomo.kn.cost.manage.mapper.CostMaterialBomMapper;
12
-import com.zzsmart.qomo.kn.cost.manage.service.CostMaterialProcessHoursService;
13
-import com.zzsmart.qomo.kn.cost.manage.service.CostPurchasePriceService;
14
-import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostResultValueService;
15
-import com.zzsmart.qomo.kn.cost.manage.service.IHourRateService;
11
+import com.zzsmart.qomo.kn.cost.manage.service.*;
16 12
 import com.zzsmart.qomo.kn.cost.manage.vo.FlowTaskInfoVO;
17 13
 import com.zzsmart.qomo.plugin.task.api.TaskExecutionContext;
18 14
 import lombok.extern.slf4j.Slf4j;
@@ -34,6 +30,8 @@ public class StandardCostService {
34 30
      */
35 31
     @Autowired
36 32
     CostMaterialBomMapper costMaterialBomMapper;
33
+    @Autowired
34
+    CostMaterialBomService costMaterialBomService;
37 35
 
38 36
     /**
39 37
      * 小时费率
@@ -61,6 +59,7 @@ public class StandardCostService {
61 59
     public void init() {
62 60
         standardCostService = this;
63 61
         standardCostService.costMaterialBomMapper = this.costMaterialBomMapper;
62
+        standardCostService.costMaterialBomService = this.costMaterialBomService;
64 63
         standardCostService.costPurchasePriceService = this.costPurchasePriceService;
65 64
         standardCostService.iHourRateService = this.iHourRateService;
66 65
         standardCostService.costMaterialProcessHoursService = this.costMaterialProcessHoursService;
@@ -85,12 +84,13 @@ public class StandardCostService {
85 84
             String flowInstanceId = flowTaskInfoVO.getFlowInstanceId();
86 85
             //1.查询出所有满足物料编号的物料(BOM物料)
87 86
             String sql = flowTaskInfoVO.getSqlString();
88
-            List<CostMaterialBom> list = standardCostService.costMaterialBomMapper.customSelect(sql);
87
+            log.info("传递过来的SQL语句:" + sql);
88
+            List<CostMaterialBom> list = standardCostService.costMaterialBomService.queryAllBomInfoBytopMaterialCode(topMaterialCode);
89 89
             log.info("Full EmptyTask list: {}", list);
90 90
             //2.把查询的结果存放在临时表里(表命名规则:前缀_流程id_组件code)
91 91
             for (int i = 0; list != null && i < list.size(); i++) {
92 92
                 CostMaterialBom material = list.get(i);
93
-                AppSceneCostResultValue appSceneCostResultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(material.getMaterialCode()).parentMarterialNo(material.getParentMaterialCode()).taskType(taskType).taskCode(taskCode).flowInstanceId(flowInstanceId).build();
93
+                AppSceneCostResultValue appSceneCostResultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(material.getMaterialCode()).parentMarterialNo(material.getParentMaterialCode()).taskType(taskType).taskCode(taskCode).flowInstanceId(flowInstanceId).num(material.getNumber()).build();
94 94
                 standardCostService.iAppSceneCostResultValueService.save(appSceneCostResultValue);
95 95
             }
96 96
         } catch (Exception e) {
@@ -113,16 +113,44 @@ public class StandardCostService {
113 113
                 String s1 = split[i];
114 114
                 if (s1.contains("taskType")) {
115 115
                     String[] split1 = s1.split("=");
116
-                    flowTaskInfoVO.setTaskType(split1[1]);
116
+                    if (split1[1].contains("\"")) {
117
+                        split1[1] = split1[1].replaceAll("^\"|\"$", ""); // 去除首尾引号
118
+                        flowTaskInfoVO.setTaskType(split1[1]);
119
+                    } else {
120
+                        flowTaskInfoVO.setTaskType(split1[1]);
121
+                    }
117 122
                 } else if (s1.contains("taskCode")) {
118 123
                     String[] split1 = s1.split(":");
119
-                    flowTaskInfoVO.setTaskCode(split1[1]);
124
+                    if (split1[1].contains("\"")) {
125
+                        split1[1] = split1[1].replaceAll("^\"|\"$", ""); // 去除首尾引号
126
+                        flowTaskInfoVO.setTaskCode(split1[1]);
127
+                    } else {
128
+                        flowTaskInfoVO.setTaskCode(split1[1]);
129
+                    }
120 130
                 } else if (s1.contains("flowInstanceId")) {
121 131
                     String[] split1 = s1.split("=");
122
-                    flowTaskInfoVO.setFlowInstanceId(split1[1]);
132
+                    if (split1[1].contains("\"")) {
133
+                        split1[1] = split1[1].replaceAll("^\"|\"$", ""); // 去除首尾引号
134
+                        flowTaskInfoVO.setFlowInstanceId(split1[1]);
135
+                    } else {
136
+                        flowTaskInfoVO.setFlowInstanceId(split1[1]);
137
+                    }
123 138
                 } else if (s1.contains("sqlString")) {
124 139
                     String[] split1 = s1.split(":");
125
-                    flowTaskInfoVO.setSqlString(split1[1]);
140
+                    if (split1[1].contains("\"")) {
141
+                        split1[1] = split1[1].replaceAll("^\"|\"$", ""); // 去除首尾引号
142
+                        flowTaskInfoVO.setSqlString(split1[1]);
143
+                    } else {
144
+                        flowTaskInfoVO.setSqlString(split1[1]);
145
+                    }
146
+                } else if (s.contains("feeType") && s1.contains("feeType")) {
147
+                    String[] split1 = s1.split(":");
148
+                    if (split1[1].contains("\"")) {
149
+                        split1[1] = split1[1].replaceAll("^\"|\"$", ""); // 去除首尾引号
150
+                        flowTaskInfoVO.setFeeType(split1[1]);
151
+                    } else {
152
+                        flowTaskInfoVO.setFeeType(split1[1]);
153
+                    }
126 154
                 }
127 155
             }
128 156
         }
@@ -135,14 +163,11 @@ public class StandardCostService {
135 163
      * @param flowTaskInfoVO
136 164
      */
137 165
     private static FlowTaskInfoVO queryFlowDefinitionByFlowInstanceId(FlowTaskInfoVO flowTaskInfoVO) {
138
-        String sql = "SELECT A.id,A.`code`,A.`name`,A.version,A.release_state,A.model_json from qomo_flow_definition as A LEFT JOIN   qomo_flow_instance AS B ON A.`code`=B.flow_definition_code  WHERE B.id=" + flowTaskInfoVO.getFlowInstanceId() + " limit 1";
139
-        JSONObject jsonObject = standardCostService.costMaterialBomMapper.customSelectOne(sql);
140
-        FlowDefinition flowDefinition = JSON.toJavaObject(jsonObject, FlowDefinition.class);
141
-        if (flowDefinition != null) {
142
-            log.info("flowDefinition: {}", flowDefinition);
143
-            String modelJson = flowDefinition.getModelJson();
144
-            JSONObject jsonObject1 = JSON.parseObject(modelJson);
145
-            if (jsonObject1 != null) {
166
+        String sql = "SELECT A.model_json from qomo_flow_definition as A LEFT JOIN   qomo_flow_instance AS B ON A.`code`=B.flow_definition_code  WHERE B.id=" + flowTaskInfoVO.getFlowInstanceId() + " limit 1";
167
+        String blob = standardCostService.costMaterialBomMapper.customSelectBlobModelJson(sql);
168
+        if (blob != null) {
169
+            if (blob != null && blob.contains("topMaterialCode")) {
170
+                JSONObject jsonObject1 = JSON.parseObject(blob);
146 171
                 String topMaterialCode = jsonObject1.getString("topMaterialCode");
147 172
                 flowTaskInfoVO.setTopMaterialCode(topMaterialCode);
148 173
             }
@@ -165,6 +190,8 @@ public class StandardCostService {
165 190
             String taskCode = flowTaskInfoVO.getTaskCode();
166 191
             //获取流程id
167 192
             String flowInstanceId = flowTaskInfoVO.getFlowInstanceId();
193
+            //成本类型
194
+            String feeType = FeeTypeEnum.MaterialCost.getCode();
168 195
             //1.查询出物料编号对应的下所有的BOM信息
169 196
             List<AppSceneCostResultValue> list = standardCostService.iAppSceneCostResultValueService.getResultValueByTopMaterialNo(topMaterialCode, "MaterialInput", flowInstanceId);
170 197
             //2.计算出所有的单个物料的物料成本
@@ -179,7 +206,7 @@ public class StandardCostService {
179 206
                 AppSceneCostResultValue appSceneCostResultValue = list.get(i);
180 207
                 String marterialNo = appSceneCostResultValue.getMarterialNo();
181 208
                 Integer num = appSceneCostResultValue.getNum();
182
-                if (marterialNo != null) {
209
+                if (marterialNo != null && num != null) {
183 210
                     BigDecimal price = purchasePriceMap.get(marterialNo);
184 211
                     BigDecimal number = new BigDecimal(num.toString());
185 212
                     //单价乘以数量
@@ -209,7 +236,12 @@ public class StandardCostService {
209 236
             String taskCode = flowTaskInfoVO.getTaskCode();
210 237
             //获取流程id
211 238
             String flowInstanceId = flowTaskInfoVO.getFlowInstanceId();
212
-            String sql = flowTaskInfoVO.getSqlString();
239
+            //成本类型
240
+            String feeType = FeeTypeEnum.LaborCost.getCode();
241
+            String sql1 = flowTaskInfoVO.getSqlString();
242
+            log.info("sql1:" + sql1);
243
+            String sql = sql1.replaceAll("^\"|\"$", ""); // 去除首尾引号
244
+            log.info("sql:" + sql);
213 245
             JSONObject jsonObject = standardCostService.costMaterialBomMapper.customSelectOne(sql);
214 246
             BigDecimal hourRate = new BigDecimal("0");
215 247
             if (jsonObject != null) {
@@ -241,7 +273,7 @@ public class StandardCostService {
241 273
                         }
242 274
                     }
243 275
                     //2.2计算出人工成本并存储到成本结果数据表中
244
-                    AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(marterialNo).parentMarterialNo(appSceneCostResultValue.getParentMarterialNo()).taskType(taskType).taskCode(taskCode).flowInstanceId(flowInstanceId).countValue(totalCost + "").build();
276
+                    AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(marterialNo).parentMarterialNo(appSceneCostResultValue.getParentMarterialNo()).taskType(taskType).taskCode(taskCode).flowInstanceId(flowInstanceId).countValue(totalCost + "").costType(feeType).build();
245 277
                     standardCostService.iAppSceneCostResultValueService.save(resultValue);
246 278
                 }
247 279
             }
@@ -273,7 +305,10 @@ public class StandardCostService {
273 305
             /**
274 306
              * 小时费率
275 307
              */
276
-            String sql = flowTaskInfoVO.getSqlString();
308
+            String sql1 = flowTaskInfoVO.getSqlString();
309
+            log.info("sql1:" + sql1);
310
+            String sql = sql1.replaceAll("^\"|\"$", ""); // 去除首尾引号
311
+            log.info("sql:" + sql);
277 312
             JSONObject jsonObject = standardCostService.costMaterialBomMapper.customSelectOne(sql);
278 313
             BigDecimal hourRate = new BigDecimal("0");
279 314
             if (jsonObject != null) {
@@ -306,7 +341,7 @@ public class StandardCostService {
306 341
                             }
307 342
                         }
308 343
                         //2.2计算机器成本并存储到成本结果数据表中
309
-                        AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(marterialNo).parentMarterialNo(appSceneCostResultValue.getParentMarterialNo()).taskType(taskType).taskCode(taskCode).flowInstanceId(flowInstanceId).countValue(totalCost + "").build();
344
+                        AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(marterialNo).parentMarterialNo(appSceneCostResultValue.getParentMarterialNo()).taskType(taskType).taskCode(taskCode).flowInstanceId(flowInstanceId).countValue(totalCost + "").costType(feeType).build();
310 345
                         standardCostService.iAppSceneCostResultValueService.save(resultValue);
311 346
                     }
312 347
                 }
@@ -328,7 +363,7 @@ public class StandardCostService {
328 363
                             }
329 364
                         }
330 365
                         //2.2计算机物料消耗存储到成本结果数据表中
331
-                        AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(marterialNo).parentMarterialNo(appSceneCostResultValue.getParentMarterialNo()).taskType(taskType).taskCode(taskCode).flowInstanceId(flowInstanceId).countValue(totalCost + "").build();
366
+                        AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(marterialNo).parentMarterialNo(appSceneCostResultValue.getParentMarterialNo()).taskType(taskType).taskCode(taskCode).flowInstanceId(flowInstanceId).countValue(totalCost + "").costType(feeType).build();
332 367
                         standardCostService.iAppSceneCostResultValueService.save(resultValue);
333 368
                     }
334 369
                 }
@@ -350,7 +385,7 @@ public class StandardCostService {
350 385
                             }
351 386
                         }
352 387
                         //2.2计算机物料消耗存储到成本结果数据表中
353
-                        AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(marterialNo).parentMarterialNo(appSceneCostResultValue.getParentMarterialNo()).taskType(taskType).taskCode(taskCode).flowInstanceId(flowInstanceId).countValue(totalCost + "").build();
388
+                        AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(marterialNo).parentMarterialNo(appSceneCostResultValue.getParentMarterialNo()).taskType(taskType).taskCode(taskCode).flowInstanceId(flowInstanceId).countValue(totalCost + "").costType(feeType).build();
354 389
                         standardCostService.iAppSceneCostResultValueService.save(resultValue);
355 390
                     }
356 391
                 }
@@ -372,7 +407,7 @@ public class StandardCostService {
372 407
                             }
373 408
                         }
374 409
                         //2.2计算机物料消耗存储到成本结果数据表中
375
-                        AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(marterialNo).parentMarterialNo(appSceneCostResultValue.getParentMarterialNo()).taskType(taskType).taskCode(taskCode).flowInstanceId(flowInstanceId).countValue(totalCost + "").build();
410
+                        AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(marterialNo).parentMarterialNo(appSceneCostResultValue.getParentMarterialNo()).taskType(taskType).taskCode(taskCode).flowInstanceId(flowInstanceId).countValue(totalCost + "").costType(feeType).build();
376 411
                         standardCostService.iAppSceneCostResultValueService.save(resultValue);
377 412
                     }
378 413
                 }
@@ -392,7 +427,7 @@ public class StandardCostService {
392 427
                             totalCost = totalCost.add(new BigDecimal(countValue));
393 428
                         }
394 429
                     }
395
-                    AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(key).parentMarterialNo(appSceneCostResultValues.get(0).getParentMarterialNo()).taskType(taskType).taskCode(taskCode).flowInstanceId(flowInstanceId).countValue(totalCost.multiply(new BigDecimal("0.1016")).toString()).build();
430
+                    AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(key).parentMarterialNo(appSceneCostResultValues.get(0).getParentMarterialNo()).taskType(taskType).taskCode(taskCode).flowInstanceId(flowInstanceId).countValue(totalCost.multiply(new BigDecimal("0.1016")).toString()).costType(feeType).build();
396 431
                     standardCostService.iAppSceneCostResultValueService.save(resultValue);
397 432
                 }
398 433
             }
@@ -437,7 +472,7 @@ public class StandardCostService {
437 472
         }
438 473
         //3.计算出所有的单个物料的累计标准成本
439 474
         List<AppSceneCostResultValue> standardCostList = standardCostService.iAppSceneCostResultValueService.getResultValueByTopMaterialNo(topMaterialCode, taskType, flowInstanceId);
440
-        //循环算出各个物料的累计成本
475
+      //TODO 优化累计成本的计算
441 476
         totalCountCost(standardCostList, topMaterialCode, taskType, taskCode, flowInstanceId);
442 477
     }
443 478
 
@@ -453,15 +488,17 @@ public class StandardCostService {
453 488
     private static void totalCountCost(List<AppSceneCostResultValue> standardCostList, String topMaterialCode, String taskType, String taskCode, String flowInstanceId) {
454 489
         Map<String, List<AppSceneCostResultValue>> parentMaterialNoMap = standardCostList.stream().filter(appSceneCostResultValue -> appSceneCostResultValue.getParentMarterialNo() != null).collect(Collectors.groupingBy(AppSceneCostResultValue::getParentMarterialNo));
455 490
         for (int i = 0; i < standardCostList.size(); i++) {
456
-            AppSceneCostResultValue appSceneCostResultValue = standardCostList.get(i);
457
-            BigDecimal totalCost = new BigDecimal("0.0");
458
-            totalCost = loopCount(appSceneCostResultValue, parentMaterialNoMap, topMaterialCode, taskType, taskCode, flowInstanceId, totalCost);
459
-            appSceneCostResultValue.setTotalValue(totalCost.toString());
460
-            standardCostService.iAppSceneCostResultValueService.save(appSceneCostResultValue);
491
+            AppSceneCostResultValue oldAppSceneCostResultValue = standardCostList.get(i);
492
+            BigDecimal totalCost = new BigDecimal(oldAppSceneCostResultValue.getCountValue());
493
+            totalCost = loopCount(oldAppSceneCostResultValue, parentMaterialNoMap, topMaterialCode, taskType, taskCode, flowInstanceId, totalCost);
494
+            oldAppSceneCostResultValue.setTotalValue(totalCost.toString());
495
+            standardCostService.iAppSceneCostResultValueService.updateById(oldAppSceneCostResultValue);
496
+            //TODO 更新结果集到标准成本单行查询中去
461 497
         }
462 498
     }
463 499
 
464 500
     /**
501
+     * //循环算出各个物料的累计成本
465 502
      * 递归计算出累计成本
466 503
      *
467 504
      * @param appSceneCostResultValue

+ 7
- 0
qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/CostMaterialBomService.java 查看文件

@@ -20,4 +20,11 @@ public interface CostMaterialBomService extends IService<CostMaterialBom> {
20 20
      * @return
21 21
      */
22 22
     List<CostMaterialBom> queryListResult(String materialNumber);
23
+
24
+    /**
25
+     * 查询最顶层物料编号下所有的物料
26
+     * @param topMaterialCode
27
+     * @return
28
+     */
29
+    List<CostMaterialBom> queryAllBomInfoBytopMaterialCode(String topMaterialCode);
23 30
 }

+ 1
- 1
qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostResultValueServiceImpl.java 查看文件

@@ -40,7 +40,7 @@ public class AppSceneCostResultValueServiceImpl extends ServiceImpl<AppSceneCost
40 40
             queryWrapper.eq("belong_top_material_no", topMaterialCode).eq("task_type", lastTaskType).eq("flow_instance_id", flowInstanceId);
41 41
             result = appSceneCostResultValueMapper.selectList(queryWrapper);
42 42
         } else if (topMaterialCode != null && !topMaterialCode.equals("") && flowInstanceId != null && !flowInstanceId.equals("")) {
43
-            queryWrapper.eq("belong_top_material_no", topMaterialCode).eq("task_type", lastTaskType).eq("flow_instance_id", flowInstanceId);
43
+            queryWrapper.eq("belong_top_material_no", topMaterialCode).eq("flow_instance_id", flowInstanceId);
44 44
             result = appSceneCostResultValueMapper.selectList(queryWrapper);
45 45
         }
46 46
         return result;

+ 18
- 0
qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/CostMaterialBomServiceImpl.java 查看文件

@@ -40,4 +40,22 @@ public class CostMaterialBomServiceImpl extends ServiceImpl<CostMaterialBomMappe
40 40
         List list = costMaterialBomMapper.selectList(queryWrapper);
41 41
         return list;
42 42
     }
43
+
44
+    /**
45
+     * 查询最顶层物料编号下所有的物料
46
+     *
47
+     * @param topMaterialCode
48
+     * @return
49
+     */
50
+    @Override
51
+    public List<CostMaterialBom> queryAllBomInfoBytopMaterialCode(String topMaterialCode) {
52
+        QueryWrapper queryWrapper = new QueryWrapper();
53
+        //TODO 循环遍历查出所有的物料下的物料(包含最上层的物料)
54
+//        if (StrUtil.isNotEmpty(topMaterialCode)) {
55
+//            // 物料号
56
+//            queryWrapper.like("material_code", topMaterialCode);
57
+//        }
58
+        List list = costMaterialBomMapper.selectList(queryWrapper);
59
+        return list;
60
+    }
43 61
 }