Parcourir la source

优化标准成本计算后批量存储到标准成本详情表中(单行查询表中)

wangqiong il y a 1 an
Parent
révision
ddc7772381
21 fichiers modifiés avec 726 ajouts et 563 suppressions
  1. 159
    0
      qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostStandardDetailController.java
  2. 0
    70
      qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/CostStandardDetailController.java
  3. 13
    0
      qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/entity/AppSceneCostResultValue.java
  4. 159
    0
      qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/entity/AppSceneCostStandardDetail.java
  5. 0
    273
      qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/entity/CostStandardDetail.java
  6. 69
    0
      qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/enums/HourOrRateTypeEnum.java
  7. 61
    0
      qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/enums/TotalCostEnum.java
  8. 15
    0
      qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/AppSceneCostStandardDetailMapper.java
  9. 0
    2
      qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/CostStandardDetailMapper.java
  10. 5
    0
      qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/xml/AppSceneCostStandardDetailMapper.xml
  11. 161
    39
      qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/plugin/StandardCostService.java
  12. 0
    41
      qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/CostStandardDetailService.java
  13. 14
    0
      qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostStandardDetailService.java
  14. 19
    0
      qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostStandardDetailServiceImpl.java
  15. 0
    2
      qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/BomTreeServiceImpl.java
  16. 0
    84
      qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/CostStandardDetailServiceImpl.java
  17. 0
    2
      qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/util/BomTreeBuilder.java
  18. 0
    1
      qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/util/EasyExcelUtil.java
  19. 0
    19
      qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/vo/CostStandardDetailSearch.java
  20. 0
    30
      qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/vo/CostStandardDetailVO.java
  21. 51
    0
      qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/vo/TotalResultValue.java

+ 159
- 0
qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostStandardDetailController.java Voir le fichier

@@ -0,0 +1,159 @@
1
+package com.zzsmart.qomo.kn.cost.manage.controller;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
+import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostStandardDetail;
7
+import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostStandardDetailService;
8
+import io.swagger.annotations.Api;
9
+import io.swagger.annotations.ApiOperation;
10
+import lombok.extern.slf4j.Slf4j;
11
+import org.apache.shiro.authz.annotation.RequiresPermissions;
12
+import org.jeecg.common.api.vo.Result;
13
+import org.jeecg.common.system.base.controller.JeecgController;
14
+import org.jeecg.common.system.query.QueryGenerator;
15
+import org.springframework.beans.factory.annotation.Autowired;
16
+import org.springframework.web.bind.annotation.GetMapping;
17
+import org.springframework.web.bind.annotation.RequestMapping;
18
+import org.springframework.web.bind.annotation.RequestParam;
19
+import org.springframework.web.bind.annotation.RestController;
20
+import org.springframework.web.servlet.ModelAndView;
21
+
22
+import javax.servlet.http.HttpServletRequest;
23
+
24
+/**
25
+ * @Description: app_scene_cost_standard_detail
26
+ * @Author: jeecg-boot
27
+ * @Date: 2024-07-31
28
+ * @Version: V1.0
29
+ */
30
+@Api(tags = "cost-标准成本单行查询")
31
+@RestController
32
+@RequestMapping("//costStandardDetail")
33
+@Slf4j
34
+public class AppSceneCostStandardDetailController extends JeecgController<AppSceneCostStandardDetail, IAppSceneCostStandardDetailService> {
35
+    @Autowired
36
+    private IAppSceneCostStandardDetailService appSceneCostStandardDetailService;
37
+
38
+    /**
39
+     * 分页列表查询
40
+     *
41
+     * @param appSceneCostStandardDetail
42
+     * @param pageNo
43
+     * @param pageSize
44
+     * @param req
45
+     * @return
46
+     */
47
+    //@AutoLog(value = "app_scene_cost_standard_detail-分页列表查询")
48
+    @ApiOperation(value = "app_scene_cost_standard_detail-分页列表查询", notes = "app_scene_cost_standard_detail-分页列表查询")
49
+    @GetMapping(value = "/list")
50
+    public Result<IPage<AppSceneCostStandardDetail>> queryPageList(AppSceneCostStandardDetail appSceneCostStandardDetail, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
51
+        QueryWrapper<AppSceneCostStandardDetail> queryWrapper = QueryGenerator.initQueryWrapper(appSceneCostStandardDetail, req.getParameterMap());
52
+        Page<AppSceneCostStandardDetail> page = new Page<AppSceneCostStandardDetail>(pageNo, pageSize);
53
+        IPage<AppSceneCostStandardDetail> pageList = appSceneCostStandardDetailService.page(page, queryWrapper);
54
+        return Result.OK(pageList);
55
+    }
56
+//
57
+//    /**
58
+//     * 添加
59
+//     *
60
+//     * @param appSceneCostStandardDetail
61
+//     * @return
62
+//     */
63
+//    @AutoLog(value = "app_scene_cost_standard_detail-添加")
64
+//    @ApiOperation(value = "app_scene_cost_standard_detail-添加", notes = "app_scene_cost_standard_detail-添加")
65
+//    @RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_standard_detail:add")
66
+//    @PostMapping(value = "/add")
67
+//    public Result<String> add(@RequestBody AppSceneCostStandardDetail appSceneCostStandardDetail) {
68
+//        appSceneCostStandardDetailService.save(appSceneCostStandardDetail);
69
+//        return Result.OK("添加成功!");
70
+//    }
71
+
72
+//    /**
73
+//     * 编辑
74
+//     *
75
+//     * @param appSceneCostStandardDetail
76
+//     * @return
77
+//     */
78
+//    @AutoLog(value = "app_scene_cost_standard_detail-编辑")
79
+//    @ApiOperation(value = "app_scene_cost_standard_detail-编辑", notes = "app_scene_cost_standard_detail-编辑")
80
+//    @RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_standard_detail:edit")
81
+//    @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
82
+//    public Result<String> edit(@RequestBody AppSceneCostStandardDetail appSceneCostStandardDetail) {
83
+//        appSceneCostStandardDetailService.updateById(appSceneCostStandardDetail);
84
+//        return Result.OK("编辑成功!");
85
+//    }
86
+//
87
+//    /**
88
+//     * 通过id删除
89
+//     *
90
+//     * @param id
91
+//     * @return
92
+//     */
93
+//    @AutoLog(value = "app_scene_cost_standard_detail-通过id删除")
94
+//    @ApiOperation(value = "app_scene_cost_standard_detail-通过id删除", notes = "app_scene_cost_standard_detail-通过id删除")
95
+//    @RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_standard_detail:delete")
96
+//    @DeleteMapping(value = "/delete")
97
+//    public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
98
+//        appSceneCostStandardDetailService.removeById(id);
99
+//        return Result.OK("删除成功!");
100
+//    }
101
+//
102
+//    /**
103
+//     * 批量删除
104
+//     *
105
+//     * @param ids
106
+//     * @return
107
+//     */
108
+//    @AutoLog(value = "app_scene_cost_standard_detail-批量删除")
109
+//    @ApiOperation(value = "app_scene_cost_standard_detail-批量删除", notes = "app_scene_cost_standard_detail-批量删除")
110
+//    @RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_standard_detail:deleteBatch")
111
+//    @DeleteMapping(value = "/deleteBatch")
112
+//    public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
113
+//        this.appSceneCostStandardDetailService.removeByIds(Arrays.asList(ids.split(",")));
114
+//        return Result.OK("批量删除成功!");
115
+//    }
116
+
117
+//    /**
118
+//     * 通过id查询
119
+//     *
120
+//     * @param id
121
+//     * @return
122
+//     */
123
+//    //@AutoLog(value = "app_scene_cost_standard_detail-通过id查询")
124
+//    @ApiOperation(value = "app_scene_cost_standard_detail-通过id查询", notes = "app_scene_cost_standard_detail-通过id查询")
125
+//    @GetMapping(value = "/queryById")
126
+//    public Result<AppSceneCostStandardDetail> queryById(@RequestParam(name = "id", required = true) String id) {
127
+//        AppSceneCostStandardDetail appSceneCostStandardDetail = appSceneCostStandardDetailService.getById(id);
128
+//        if (appSceneCostStandardDetail == null) {
129
+//            return Result.error("未找到对应数据");
130
+//        }
131
+//        return Result.OK(appSceneCostStandardDetail);
132
+//    }
133
+
134
+    /**
135
+     * 导出excel
136
+     *
137
+     * @param request
138
+     * @param appSceneCostStandardDetail
139
+     */
140
+    @RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_standard_detail:exportXls")
141
+    @RequestMapping(value = "/exportXls")
142
+    public ModelAndView exportXls(HttpServletRequest request, AppSceneCostStandardDetail appSceneCostStandardDetail) {
143
+        return super.exportXls(request, appSceneCostStandardDetail, AppSceneCostStandardDetail.class, "app_scene_cost_standard_detail");
144
+    }
145
+
146
+//    /**
147
+//     * 通过excel导入数据
148
+//     *
149
+//     * @param request
150
+//     * @param response
151
+//     * @return
152
+//     */
153
+//    @RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_standard_detail:importExcel")
154
+//    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
155
+//    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
156
+//        return super.importExcel(request, response, AppSceneCostStandardDetail.class);
157
+//    }
158
+
159
+}

+ 0
- 70
qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/CostStandardDetailController.java Voir le fichier

@@ -1,70 +0,0 @@
1
-package com.zzsmart.qomo.kn.cost.manage.controller;
2
-
3
-
4
-import com.alibaba.fastjson.JSONObject;
5
-import com.baomidou.mybatisplus.core.metadata.IPage;
6
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
7
-import com.zzsmart.qomo.kn.cost.manage.entity.CostStandardDetail;
8
-import com.zzsmart.qomo.kn.cost.manage.service.CostStandardDetailService;
9
-import com.zzsmart.qomo.kn.cost.manage.vo.CostStandardDetailSearch;
10
-import com.zzsmart.qomo.kn.cost.manage.vo.CostStandardDetailVO;
11
-import io.swagger.annotations.Api;
12
-import io.swagger.annotations.ApiOperation;
13
-import lombok.extern.slf4j.Slf4j;
14
-import org.jeecg.common.api.vo.Result;
15
-import org.jeecg.common.system.base.controller.JeecgController;
16
-import org.springframework.beans.factory.annotation.Autowired;
17
-import org.springframework.web.bind.annotation.*;
18
-
19
-import javax.servlet.http.HttpServletRequest;
20
-import javax.servlet.http.HttpServletResponse;
21
-import java.io.IOException;
22
-
23
-/**
24
- * <p>
25
- * 标准成本明细表 前端控制器
26
- * </p>
27
- *
28
- * @author app_scene_cost_purchase_price
29
- * @since 2024-06-19
30
- */
31
-@Api(tags = "cost-标准成本单行查询")
32
-@RestController
33
-@RequestMapping("//costStandardDetail")
34
-@Slf4j
35
-public class CostStandardDetailController extends JeecgController<CostStandardDetail, CostStandardDetailService> {
36
-    @Autowired
37
-    private CostStandardDetailService costStandardDetailService;
38
-
39
-    /**
40
-     * 分页列表查询
41
-     *
42
-     * @param costStandard
43
-     * @param pageNo
44
-     * @param pageSize
45
-     * @param req
46
-     * @return
47
-     */
48
-    //@AutoLog(value = "标准成本单行列表查询")
49
-    @ApiOperation(value = "标准成本单行列表查询", notes = "标准成本单行列表查询")
50
-    @GetMapping(value = "/list")
51
-    public Result<IPage<CostStandardDetailVO>> queryPageList(CostStandardDetailVO costStandard, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
52
-
53
-        Page<CostStandardDetailVO> page = new Page<CostStandardDetailVO>(pageNo, pageSize);
54
-        IPage<CostStandardDetailVO> pageList = costStandardDetailService.pageList(page, costStandard);
55
-        return Result.OK(pageList);
56
-    }
57
-
58
-    /**
59
-     * 导出excel
60
-     *
61
-     * @param request
62
-     * @param costStandardDetailSearch
63
-     */
64
-    @RequestMapping(value = "/exportXls", method = RequestMethod.GET)
65
-    @ApiOperation(value = "单行查询导出", notes = "单行查询导出")
66
-    public Result exportXls(HttpServletRequest request, HttpServletResponse response, CostStandardDetailSearch costStandardDetailSearch) throws IOException {
67
-        JSONObject result = costStandardDetailService.exportExcel(request, response, costStandardDetailSearch);
68
-        return Result.OK(result);
69
-    }
70
-}

+ 13
- 0
qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/entity/AppSceneCostResultValue.java Voir le fichier

@@ -14,6 +14,7 @@ import org.jeecgframework.poi.excel.annotation.Excel;
14 14
 import org.springframework.format.annotation.DateTimeFormat;
15 15
 
16 16
 import java.io.Serializable;
17
+import java.math.BigDecimal;
17 18
 import java.util.Date;
18 19
 
19 20
 /**
@@ -121,4 +122,16 @@ public class AppSceneCostResultValue implements Serializable {
121 122
     @Excel(name = "成本明细", width = 15)
122 123
     @ApiModelProperty(value = "成本明细")
123 124
     private String costDetail;
125
+    /**
126
+     * 单价或费率
127
+     */
128
+    @Excel(name = "单价或费率", width = 15)
129
+    @ApiModelProperty(value = "单价或费率")
130
+    private BigDecimal priceOrRate;
131
+    /**
132
+     * 工时
133
+     */
134
+    @Excel(name = "工时", width = 15)
135
+    @ApiModelProperty(value = "工时")
136
+    private BigDecimal hour;
124 137
 }

+ 159
- 0
qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/entity/AppSceneCostStandardDetail.java Voir le fichier

@@ -0,0 +1,159 @@
1
+package com.zzsmart.qomo.kn.cost.manage.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import com.baomidou.mybatisplus.annotation.TableName;
6
+import com.fasterxml.jackson.annotation.JsonFormat;
7
+import io.swagger.annotations.ApiModel;
8
+import io.swagger.annotations.ApiModelProperty;
9
+import lombok.Builder;
10
+import lombok.Data;
11
+import lombok.EqualsAndHashCode;
12
+import lombok.experimental.Accessors;
13
+import org.jeecgframework.poi.excel.annotation.Excel;
14
+import org.springframework.format.annotation.DateTimeFormat;
15
+
16
+import java.io.Serializable;
17
+import java.math.BigDecimal;
18
+import java.util.Date;
19
+
20
+/**
21
+ * @Description: app_scene_cost_standard_detail
22
+ * @Author: jeecg-boot
23
+ * @Date: 2024-07-31
24
+ * @Version: V1.0
25
+ */
26
+@Data
27
+@Builder
28
+@TableName("app_scene_cost_standard_detail")
29
+@Accessors(chain = true)
30
+@EqualsAndHashCode(callSuper = false)
31
+@ApiModel(value = "app_scene_cost_standard_detail对象", description = "app_scene_cost_standard_detail")
32
+public class AppSceneCostStandardDetail implements Serializable {
33
+    private static final long serialVersionUID = 1L;
34
+
35
+    /**id*/
36
+    @TableId(type = IdType.ASSIGN_ID)
37
+    @ApiModelProperty(value = "id")
38
+    private String id;
39
+    /**图号*/
40
+    @Excel(name = "图号", width = 15)
41
+    @ApiModelProperty(value = "图号")
42
+    private String figureNumber;
43
+    /**物料号,关联kn_new_sap_mara表matnr字段*/
44
+    @Excel(name = "物料号,关联kn_new_sap_mara表matnr字段", width = 15)
45
+    @ApiModelProperty(value = "物料号,关联kn_new_sap_mara表matnr字段")
46
+    private String materialNumber;
47
+    /**物料名称*/
48
+    @Excel(name = "物料名称", width = 15)
49
+    @ApiModelProperty(value = "物料名称")
50
+    private String materialName;
51
+    /**父类物料号*/
52
+    @Excel(name = "父类物料号", width = 15)
53
+    @ApiModelProperty(value = "父类物料号")
54
+    private String parentMaterialNumber;
55
+    /**版本号*/
56
+    @Excel(name = "版本号", width = 15)
57
+    @ApiModelProperty(value = "版本号")
58
+    private String versionNumber;
59
+    /**层级*/
60
+    @Excel(name = "层级", width = 15)
61
+    @ApiModelProperty(value = "层级")
62
+    private Integer level;
63
+    /**序号*/
64
+    @Excel(name = "序号", width = 15)
65
+    @ApiModelProperty(value = "序号")
66
+    private Integer sort;
67
+    /**用量*/
68
+    @Excel(name = "用量", width = 15)
69
+    @ApiModelProperty(value = "用量")
70
+    private Double dosage;
71
+    /**单位*/
72
+    @Excel(name = "单位", width = 15)
73
+    @ApiModelProperty(value = "单位")
74
+    private String unit;
75
+    /**本阶材料费*/
76
+    @Excel(name = "本阶材料费", width = 15)
77
+    @ApiModelProperty(value = "本阶材料费")
78
+    private BigDecimal materialCost;
79
+    /**本阶人工费*/
80
+    @Excel(name = "本阶人工费", width = 15)
81
+    @ApiModelProperty(value = "本阶人工费")
82
+    private BigDecimal laborCost;
83
+    /**本阶辅料费*/
84
+    @Excel(name = "本阶辅料费", width = 15)
85
+    @ApiModelProperty(value = "本阶辅料费")
86
+    private BigDecimal supplyMaterialCost;
87
+    /**本阶机器折旧费*/
88
+    @Excel(name = "本阶机器折旧费", width = 15)
89
+    @ApiModelProperty(value = "本阶机器折旧费")
90
+    private BigDecimal equipmentCost;
91
+    /**本阶水电费(燃动费)*/
92
+    @Excel(name = "本阶水电费(燃动费)", width = 15)
93
+    @ApiModelProperty(value = "本阶水电费(燃动费)")
94
+    private BigDecimal driveCost;
95
+    /**本阶其他制造费*/
96
+    @Excel(name = "本阶其他制造费", width = 15)
97
+    @ApiModelProperty(value = "本阶其他制造费")
98
+    private BigDecimal otherCost;
99
+    /**本阶物流费*/
100
+    @Excel(name = "本阶物流费", width = 15)
101
+    @ApiModelProperty(value = "本阶物流费")
102
+    private BigDecimal logisticsCost;
103
+    /**累计人工费*/
104
+    @Excel(name = "累计人工费", width = 15)
105
+    @ApiModelProperty(value = "累计人工费")
106
+    private BigDecimal totalMaterialCost;
107
+    /**累计机器消耗费*/
108
+    @Excel(name = "累计机器消耗费", width = 15)
109
+    @ApiModelProperty(value = "累计机器消耗费")
110
+    private BigDecimal totalLaborCost;
111
+    /**累计机器折旧费*/
112
+    @Excel(name = "累计机器折旧费", width = 15)
113
+    @ApiModelProperty(value = "累计机器折旧费")
114
+    private BigDecimal totalSupplyMaterialCost;
115
+    /**累计水电费*/
116
+    @Excel(name = "累计水电费", width = 15)
117
+    @ApiModelProperty(value = "累计水电费")
118
+    private BigDecimal totalEquipmentCost;
119
+    /**累计其它费用*/
120
+    @Excel(name = "累计其它费用", width = 15)
121
+    @ApiModelProperty(value = "累计其它费用")
122
+    private BigDecimal totalDriveCost;
123
+    /**累计其他费用*/
124
+    @Excel(name = "累计其他费用", width = 15)
125
+    @ApiModelProperty(value = "累计其他费用")
126
+    private BigDecimal totalOtherCost;
127
+    /**累计物流费用*/
128
+    @Excel(name = "累计物流费用", width = 15)
129
+    @ApiModelProperty(value = "累计物流费用")
130
+    private BigDecimal totalLogisticsCost;
131
+    /**本阶标准成本*/
132
+    @Excel(name = "本阶标准成本", width = 15)
133
+    @ApiModelProperty(value = "本阶标准成本")
134
+    private BigDecimal currentStandardCost;
135
+    /**累计标准成本*/
136
+    @Excel(name = "累计标准成本", width = 15)
137
+    @ApiModelProperty(value = "累计标准成本")
138
+    private BigDecimal totalStandardCost;
139
+    /**创建人*/
140
+    @ApiModelProperty(value = "创建人")
141
+    private String createBy;
142
+    /**创建日期*/
143
+    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
144
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
145
+    @ApiModelProperty(value = "创建日期")
146
+    private Date createTime;
147
+    /**修改人*/
148
+    @ApiModelProperty(value = "修改人")
149
+    private String updateBy;
150
+    /**修改日期*/
151
+    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
152
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
153
+    @ApiModelProperty(value = "修改日期")
154
+    private Date updateTime;
155
+    /**备注*/
156
+    @Excel(name = "备注", width = 15)
157
+    @ApiModelProperty(value = "备注")
158
+    private String remark;
159
+}

+ 0
- 273
qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/entity/CostStandardDetail.java Voir le fichier

@@ -1,273 +0,0 @@
1
-package com.zzsmart.qomo.kn.cost.manage.entity;
2
-
3
-import com.baomidou.mybatisplus.annotation.IdType;
4
-import com.baomidou.mybatisplus.annotation.TableField;
5
-import com.baomidou.mybatisplus.annotation.TableId;
6
-import com.baomidou.mybatisplus.annotation.TableName;
7
-import io.swagger.annotations.ApiModelProperty;
8
-import lombok.Data;
9
-import lombok.EqualsAndHashCode;
10
-import lombok.experimental.Accessors;
11
-import org.jeecgframework.poi.excel.annotation.Excel;
12
-
13
-import java.io.Serializable;
14
-import java.math.BigDecimal;
15
-import java.time.LocalDateTime;
16
-
17
-/**
18
- * <p>
19
- * 标准成本明细表
20
- * </p>
21
- *
22
- * @author
23
- * @since 2024-06-20
24
- */
25
-@Data
26
-@Accessors(chain = true)
27
-@TableName("app_scene_cost_standard_detail")
28
-@EqualsAndHashCode
29
-public class CostStandardDetail implements Serializable {
30
-
31
-    private static final long serialVersionUID = 1L;
32
-
33
-    /**
34
-     * id
35
-     */
36
-    @TableId(value = "id", type = IdType.AUTO)
37
-    private String id;
38
-
39
-    /**
40
-     * 物料号,关联kn_new_sap_mara表matnr字段
41
-     */
42
-    @TableField("material_number")
43
-    @ApiModelProperty(value = "物料号,关联kn_new_sap_mara表matnr字段")
44
-    @Excel(name = "物料号")
45
-    private String materialNumber;
46
-
47
-    /**
48
-     * 物料名称
49
-     */
50
-    @TableField("material_name")
51
-    @ApiModelProperty(value = "物料名称")
52
-    @Excel(name = "物料名称")
53
-    private String materialName;
54
-
55
-    /**
56
-     * 父类物料号
57
-     */
58
-    @TableField("parent_material_number")
59
-    @ApiModelProperty(value = "父类物料号")
60
-    @Excel(name = "父类物料号")
61
-    private String parentMaterialNumber;
62
-
63
-    /**
64
-     * 版本号id
65
-     */
66
-    @TableField("version_number_id")
67
-    @ApiModelProperty(value = "版本号id")
68
-    private String versionNumberId;
69
-
70
-    /**
71
-     * 层级
72
-     */
73
-    @TableField("level")
74
-    @ApiModelProperty(value = "层级")
75
-    @Excel(name = "层级")
76
-    private Integer level;
77
-
78
-    /**
79
-     * 图号
80
-     */
81
-    @TableField("figure_number")
82
-    @ApiModelProperty(value = "图号")
83
-    @Excel(name = "图号")
84
-    private String figureNumber;
85
-
86
-    /**
87
-     * 用量
88
-     */
89
-    @TableField("dosage")
90
-    @ApiModelProperty(value = "用量")
91
-    @Excel(name = "用量")
92
-    private Double dosage;
93
-
94
-    /**
95
-     * 单位
96
-     */
97
-    @TableField("unit")
98
-    @ApiModelProperty(value = "单位")
99
-    @Excel(name = "单位")
100
-    private String unit;
101
-
102
-    /**
103
-     * 规格
104
-     */
105
-    @TableField("specification")
106
-    @ApiModelProperty(value = "规格")
107
-    @Excel(name = "规格")
108
-    private String specification;
109
-
110
-    /**
111
-     * bom材料费
112
-     */
113
-    @TableField("bom_cost")
114
-    @ApiModelProperty(value = "bom材料费")
115
-    @Excel(name = "bom材料费")
116
-    private BigDecimal bomCost;
117
-
118
-    /**
119
-     * 包装费
120
-     */
121
-    @TableField("packing_cost")
122
-    @ApiModelProperty(value = "包装费")
123
-    @Excel(name = "包装费")
124
-    private BigDecimal packingCost;
125
-
126
-    /**
127
-     * 本阶辅料费
128
-     */
129
-    @TableField("auxiliary_cost")
130
-    @ApiModelProperty(value = "本阶辅料费")
131
-    @Excel(name = "本阶辅料费")
132
-    private BigDecimal auxiliaryCost;
133
-
134
-    /**
135
-     * 本阶人工费
136
-     */
137
-    @TableField("labor_cost")
138
-    @ApiModelProperty(value = "本阶人工费")
139
-    @Excel(name = "本阶人工费")
140
-    private BigDecimal laborCost;
141
-
142
-    /**
143
-     * 机器折旧费
144
-     */
145
-    @TableField("euip_depreciation_cost")
146
-    @ApiModelProperty(value = "机器折旧费")
147
-    @Excel(name = "机器折旧费")
148
-    private BigDecimal euipDepreciationCost;
149
-
150
-    /**
151
-     * 机物料消耗费
152
-     */
153
-    @TableField("equip_consume_cost")
154
-    @ApiModelProperty(value = "机物料消耗费")
155
-    @Excel(name = "机物料消耗费")
156
-    private BigDecimal equipConsumeCost;
157
-
158
-    /**
159
-     * 水电费
160
-     */
161
-    @TableField("hydroelectricity_cost")
162
-    @ApiModelProperty(value = "水电费")
163
-    @Excel(name = "水电费")
164
-    private BigDecimal hydroelectricityCost;
165
-
166
-    /**
167
-     * 其他制造费
168
-     */
169
-    @TableField("other_cost")
170
-    @ApiModelProperty(value = "其他制造费")
171
-    @Excel(name = "其他制造费")
172
-    private BigDecimal otherCost;
173
-
174
-    /**
175
-     * 物流费
176
-     */
177
-    @TableField("trail_cost")
178
-    @ApiModelProperty(value = "物流费")
179
-    @Excel(name = "物流费")
180
-    private BigDecimal trailCost;
181
-
182
-    /**
183
-     * 制造成本
184
-     */
185
-    @TableField("manufacture_cost")
186
-    @ApiModelProperty(value = "制造成本")
187
-    @Excel(name = "制造成本")
188
-    private BigDecimal manufactureCost;
189
-
190
-    /**
191
-     * 累计人工费
192
-     */
193
-    @TableField("total_labor_cost")
194
-    @ApiModelProperty(value = "累计人工费")
195
-    @Excel(name = "累计人工费")
196
-    private BigDecimal totalLaborCost;
197
-
198
-    /**
199
-     * 累计机器消耗费
200
-     */
201
-    @TableField("total_equip_consume_cost")
202
-    @ApiModelProperty(value = "累计机器消耗费")
203
-    @Excel(name = "累计机器消耗费")
204
-    private BigDecimal totalEquipConsumeCost;
205
-
206
-    /**
207
-     * 累计机器折旧费
208
-     */
209
-    @TableField("total_euip_depreciation_cost")
210
-    @ApiModelProperty(value = "累计机器折旧费")
211
-    @Excel(name = "累计机器折旧费")
212
-    private BigDecimal totalEuipDepreciationCost;
213
-
214
-    /**
215
-     * 累计水电费
216
-     */
217
-    @TableField("total_hydroelectricity_cost")
218
-    @ApiModelProperty(value = "累计水电费")
219
-    @Excel(name = "累计水电费")
220
-    private BigDecimal totalHydroelectricityCost;
221
-
222
-    /**
223
-     * 累计其它费用
224
-     */
225
-    @TableField("total_other_cost")
226
-    @ApiModelProperty(value = "累计其它费用")
227
-    @Excel(name = "累计其它费用")
228
-    private BigDecimal totalOtherCost;
229
-
230
-    /**
231
-     * 创建人
232
-     */
233
-    @TableField("create_by")
234
-    @ApiModelProperty(value = "创建人")
235
-    private String createBy;
236
-
237
-    /**
238
-     * 创建日期
239
-     */
240
-    @TableField("create_time")
241
-    @ApiModelProperty(value = "创建日期")
242
-    private LocalDateTime createTime;
243
-
244
-    /**
245
-     * 修改人
246
-     */
247
-    @TableField("update_by")
248
-    @ApiModelProperty(value = "修改人")
249
-    private String updateBy;
250
-
251
-    /**
252
-     * 修改日期
253
-     */
254
-    @TableField("update_time")
255
-    @ApiModelProperty(value = "修改日期")
256
-    private LocalDateTime updateTime;
257
-
258
-    /**
259
-     * 备注
260
-     */
261
-    @TableField("remark")
262
-    @ApiModelProperty(value = "备注")
263
-    private String remark;
264
-
265
-    /**
266
-     * 序号
267
-     */
268
-    @TableField("sort")
269
-    @ApiModelProperty(value = "序号")
270
-    @Excel(name = "序号")
271
-    private Integer sort;
272
-
273
-}

+ 69
- 0
qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/enums/HourOrRateTypeEnum.java Voir le fichier

@@ -0,0 +1,69 @@
1
+package com.zzsmart.qomo.kn.cost.manage.enums;
2
+
3
+/**
4
+ * @Classname StandardStageEnum
5
+ * @Description 阶段枚举
6
+ * @Version 1.0.0
7
+ * @Date 2024/6/18 9:51
8
+ * @Created wangqiong
9
+ */
10
+public enum HourOrRateTypeEnum {
11
+
12
+    LaborHour("LaborHour", "人员工时"),
13
+    LaborHourRate("LaborHourRate", "人员小时费率"),
14
+    MaterialUnitPrice("MaterialUnitPrice", "物料采购单价"),
15
+    EquipmentHour("EquipmentHour", "设备工时"),
16
+    EquipmentHourRate("EquipmentHourRate", "设备小时费率"),
17
+    SupplyMaterialHour("SupplyMaterialHour", "辅料工时"),
18
+    SupplyMaterialHourRate("SupplyMaterialHourRate", "辅料小时费率"),
19
+    DriverHour("DriverHour", "燃动工时"),
20
+    DriverHourRate("DriverHourRate", "燃动小时费率"),
21
+    OtherHour("OtherHour", "其他工时"),
22
+    OtherHourRate("OtherHourRate", "其他小时费率");
23
+
24
+    private final String code;
25
+    private final String name;
26
+
27
+    HourOrRateTypeEnum(String code, String name) {
28
+        this.code = code;
29
+        this.name = name;
30
+    }
31
+
32
+    public String getCode() {
33
+        return code;
34
+    }
35
+
36
+    public String getName() {
37
+        return name;
38
+    }
39
+
40
+    /**
41
+     * 根据code获取text
42
+     *
43
+     * @param codeNo
44
+     * @return
45
+     */
46
+    public static String getTextByCode(String codeNo) {
47
+        for (HourOrRateTypeEnum value : HourOrRateTypeEnum.values()) {
48
+            if (value.getCode().equals(codeNo)) {
49
+                return value.name();
50
+            }
51
+        }
52
+        return codeNo.toString();
53
+    }
54
+
55
+    /**
56
+     * 根据text获取code
57
+     *
58
+     * @param name
59
+     * @return
60
+     */
61
+    public static String getCodeByName(String name) {
62
+        for (HourOrRateTypeEnum value : HourOrRateTypeEnum.values()) {
63
+            if (value.name().equals(name)) {
64
+                return value.name();
65
+            }
66
+        }
67
+        return name;
68
+    }
69
+}

+ 61
- 0
qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/enums/TotalCostEnum.java Voir le fichier

@@ -0,0 +1,61 @@
1
+package com.zzsmart.qomo.kn.cost.manage.enums;
2
+
3
+/**
4
+ * @Classname StandardStageEnum
5
+ * @Description 阶段枚举
6
+ * @Version 1.0.0
7
+ * @Date 2024/6/18 9:51
8
+ * @Created wangqiong
9
+ */
10
+public enum TotalCostEnum {
11
+
12
+
13
+    TotalLaborCost("TotalLaborCost", "总人工成本"), TotalMaterialCost("TotalMaterialCost", "总物料成本"), TotalEquipmentFee("TotalEquipmentFee", "总设备费"), TotalSupplyMaterialFee("TotalSupplyMaterialFee", "总辅料费"), TotalDriverFee("TotalDriverFee", "总水电费"), TotalOtherFee("TotalOtherFee", "总其他费用"), TotalLogisticsFee("TotalLogisticsFee", "总物流费"), TotalStandardCost("TotalStandardCost", "总标准成本");
14
+
15
+
16
+    private final String code;
17
+    private final String name;
18
+
19
+    TotalCostEnum(String code, String name) {
20
+        this.code = code;
21
+        this.name = name;
22
+    }
23
+
24
+    public String getCode() {
25
+        return code;
26
+    }
27
+
28
+    public String getName() {
29
+        return name;
30
+    }
31
+
32
+    /**
33
+     * 根据code获取text
34
+     *
35
+     * @param codeNo
36
+     * @return
37
+     */
38
+    public static String getTextByCode(String codeNo) {
39
+        for (TotalCostEnum value : TotalCostEnum.values()) {
40
+            if (value.getCode().equals(codeNo)) {
41
+                return value.name();
42
+            }
43
+        }
44
+        return codeNo.toString();
45
+    }
46
+
47
+    /**
48
+     * 根据text获取code
49
+     *
50
+     * @param name
51
+     * @return
52
+     */
53
+    public static String getCodeByName(String name) {
54
+        for (TotalCostEnum value : TotalCostEnum.values()) {
55
+            if (value.name().equals(name)) {
56
+                return value.name();
57
+            }
58
+        }
59
+        return name;
60
+    }
61
+}

+ 15
- 0
qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/AppSceneCostStandardDetailMapper.java Voir le fichier

@@ -0,0 +1,15 @@
1
+package com.zzsmart.qomo.kn.cost.manage.mapper;
2
+
3
+
4
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
+import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostStandardDetail;
6
+
7
+/**
8
+ * @Description: app_scene_cost_standard_detail
9
+ * @Author: jeecg-boot
10
+ * @Date:   2024-07-31
11
+ * @Version: V1.0
12
+ */
13
+public interface AppSceneCostStandardDetailMapper extends BaseMapper<AppSceneCostStandardDetail> {
14
+
15
+}

+ 0
- 2
qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/CostStandardDetailMapper.java Voir le fichier

@@ -4,9 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
4 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.core.toolkit.Constants;
6 6
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
7
-import com.zzsmart.qomo.kn.cost.manage.entity.CostStandardDetail;
8 7
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
9
-import com.zzsmart.qomo.kn.cost.manage.vo.CostStandardDetailVO;
10 8
 import org.apache.ibatis.annotations.Mapper;
11 9
 import org.apache.ibatis.annotations.Param;
12 10
 

+ 5
- 0
qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/xml/AppSceneCostStandardDetailMapper.xml Voir le fichier

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.zzsmart.qomo.modules.demo.com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostStandardDetailMapper">
4
+
5
+</mapper>

+ 161
- 39
qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/plugin/StandardCostService.java Voir le fichier

@@ -4,9 +4,12 @@ import com.alibaba.fastjson.JSON;
4 4
 import com.alibaba.fastjson.JSONObject;
5 5
 import com.zzsmart.qomo.kn.cost.manage.entity.*;
6 6
 import com.zzsmart.qomo.kn.cost.manage.enums.FeeTypeEnum;
7
+import com.zzsmart.qomo.kn.cost.manage.enums.HourOrRateTypeEnum;
8
+import com.zzsmart.qomo.kn.cost.manage.enums.TotalCostEnum;
7 9
 import com.zzsmart.qomo.kn.cost.manage.mapper.CostMaterialBomMapper;
8 10
 import com.zzsmart.qomo.kn.cost.manage.service.*;
9 11
 import com.zzsmart.qomo.kn.cost.manage.vo.FlowTaskInfoVO;
12
+import com.zzsmart.qomo.kn.cost.manage.vo.TotalResultValue;
10 13
 import com.zzsmart.qomo.plugin.task.api.TaskExecutionContext;
11 14
 import lombok.extern.slf4j.Slf4j;
12 15
 import org.springframework.beans.factory.annotation.Autowired;
@@ -50,10 +53,20 @@ public class StandardCostService {
50 53
      */
51 54
     @Autowired
52 55
     IAppSceneCostResultValueService iAppSceneCostResultValueService;
56
+    /**
57
+     * 标准成本服务
58
+     */
53 59
     public static StandardCostService standardCostService;
60
+    /**
61
+     * 成本计算服务
62
+     */
54 63
     @Autowired
55 64
     IAppSceneCostCountService appSceneCostCountService;
56
-
65
+    /**
66
+     * 标准成本明细服务(单行查询服务)
67
+     */
68
+    @Autowired
69
+    private IAppSceneCostStandardDetailService iAppSceneCostStandardDetailService;
57 70
 
58 71
     @PostConstruct
59 72
     public void init() {
@@ -65,6 +78,7 @@ public class StandardCostService {
65 78
         standardCostService.iHourRateService = this.iHourRateService;
66 79
         standardCostService.costMaterialProcessHoursService = this.costMaterialProcessHoursService;
67 80
         standardCostService.iAppSceneCostResultValueService = this.iAppSceneCostResultValueService;
81
+        standardCostService.iAppSceneCostStandardDetailService = this.iAppSceneCostStandardDetailService;
68 82
     }
69 83
 
70 84
     /**
@@ -93,6 +107,7 @@ public class StandardCostService {
93 107
             //1.查询出所有满足物料编号的物料(BOM物料)
94 108
             String sql = flowTaskInfoVO.getSqlString();
95 109
             log.info("传递过来的SQL语句:" + sql);
110
+            //TODO 查询最顶部的BOM物料编号下所有的物料并进行层级排序
96 111
             List<CostMaterialBom> list = standardCostService.costMaterialBomService.queryAllBomInfoBytopMaterialCode(topMaterialCode);
97 112
             log.info("Full EmptyTask list: {}", list);
98 113
             //2.把查询的结果存放在临时表里(表命名规则:前缀_流程id_组件code)
@@ -220,7 +235,7 @@ public class StandardCostService {
220 235
                     //单价乘以数量
221 236
                     BigDecimal totalCost = price.multiply(number);
222 237
                     //2.2计算出人工成本并存储到成本结果数据表中
223
-                    AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(marterialNo).parentMarterialNo(appSceneCostResultValue.getParentMarterialNo()).taskType(taskType).costType(feeType).taskCode(taskCode).flowInstanceId(flowInstanceId).countValue(totalCost + "").build();
238
+                    AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(marterialNo).parentMarterialNo(appSceneCostResultValue.getParentMarterialNo()).taskType(taskType).costType(feeType).taskCode(taskCode).flowInstanceId(flowInstanceId).countValue(totalCost + "").priceOrRate(price).build();
224 239
                     standardCostService.iAppSceneCostResultValueService.save(resultValue);
225 240
                 }
226 241
             }
@@ -271,17 +286,18 @@ public class StandardCostService {
271 286
                 String marterialNo = appSceneCostResultValue.getMarterialNo();
272 287
                 if (marterialNo != null) {
273 288
                     BigDecimal totalCost = new BigDecimal("0.0");
289
+                    BigDecimal laborHours = new BigDecimal("0.0");
274 290
                     List<CostMaterialProcessHours> costMaterialProcessHours = processHoursMap.get(marterialNo);
275 291
                     if (costMaterialProcessHours != null && costMaterialProcessHours.size() > 0) {
276 292
                         for (int j = 0; j < costMaterialProcessHours.size(); j++) {
277 293
                             CostMaterialProcessHours processHours = costMaterialProcessHours.get(j);
278
-                            BigDecimal laborHours = processHours.getLaborHours();
294
+                            laborHours = laborHours.add(processHours.getLaborHours());
279 295
                             //计算总人工成本
280
-                            totalCost = totalCost.add(laborHours.multiply(hourRate));
296
+                            totalCost = totalCost.add(processHours.getLaborHours().multiply(hourRate));
281 297
                         }
282 298
                     }
283 299
                     //2.2计算出人工成本并存储到成本结果数据表中
284
-                    AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(marterialNo).parentMarterialNo(appSceneCostResultValue.getParentMarterialNo()).taskType(taskType).taskCode(taskCode).flowInstanceId(flowInstanceId).countValue(totalCost + "").costType(feeType).build();
300
+                    AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(marterialNo).parentMarterialNo(appSceneCostResultValue.getParentMarterialNo()).taskType(taskType).taskCode(taskCode).flowInstanceId(flowInstanceId).countValue(totalCost + "").costType(feeType).priceOrRate(hourRate).hour(laborHours).build();
285 301
                     standardCostService.iAppSceneCostResultValueService.save(resultValue);
286 302
                 }
287 303
             }
@@ -339,17 +355,18 @@ public class StandardCostService {
339 355
                     String marterialNo = appSceneCostResultValue.getMarterialNo();
340 356
                     if (marterialNo != null) {
341 357
                         BigDecimal totalCost = new BigDecimal("0.0");
358
+                        BigDecimal laborHours = new BigDecimal("0.0");
342 359
                         List<CostMaterialProcessHours> costMaterialProcessHours = processHoursMap.get(marterialNo);
343 360
                         if (costMaterialProcessHours != null && costMaterialProcessHours.size() > 0) {
344 361
                             for (int j = 0; j < costMaterialProcessHours.size(); j++) {
345 362
                                 CostMaterialProcessHours processHours = costMaterialProcessHours.get(j);
346
-                                BigDecimal laborHours = processHours.getDeviceHours();
363
+                                laborHours = laborHours.add(processHours.getDeviceHours());
347 364
                                 //计算机器成本
348
-                                totalCost = totalCost.add(laborHours.multiply(hourRate));
365
+                                totalCost = totalCost.add(processHours.getDeviceHours().multiply(hourRate));
349 366
                             }
350 367
                         }
351 368
                         //2.2计算机器成本并存储到成本结果数据表中
352
-                        AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(marterialNo).parentMarterialNo(appSceneCostResultValue.getParentMarterialNo()).taskType(taskType).taskCode(taskCode).flowInstanceId(flowInstanceId).countValue(totalCost + "").costType(feeType).build();
369
+                        AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(marterialNo).parentMarterialNo(appSceneCostResultValue.getParentMarterialNo()).taskType(taskType).taskCode(taskCode).flowInstanceId(flowInstanceId).countValue(totalCost + "").costType(feeType).priceOrRate(hourRate).hour(laborHours).build();
353 370
                         standardCostService.iAppSceneCostResultValueService.save(resultValue);
354 371
                     }
355 372
                 }
@@ -360,18 +377,19 @@ public class StandardCostService {
360 377
                     String marterialNo = appSceneCostResultValue.getMarterialNo();
361 378
                     if (marterialNo != null) {
362 379
                         BigDecimal totalCost = new BigDecimal("0.0");
380
+                        BigDecimal laborHours = new BigDecimal("0.0");
363 381
                         List<CostMaterialProcessHours> costMaterialProcessHours = processHoursMap.get(marterialNo);
364 382
                         if (costMaterialProcessHours != null && costMaterialProcessHours.size() > 0) {
365 383
                             for (int j = 0; j < costMaterialProcessHours.size(); j++) {
366 384
                                 CostMaterialProcessHours processHours = costMaterialProcessHours.get(j);
367 385
                                 //TODO 辅料工时来源
368
-                                BigDecimal laborHours = processHours.getLaborHours();
386
+                                laborHours = laborHours.add(processHours.getDeviceHours());
369 387
                                 //机物料消耗
370
-                                totalCost = totalCost.add(laborHours.multiply(hourRate));
388
+                                totalCost = totalCost.add(processHours.getDeviceHours().multiply(hourRate));
371 389
                             }
372 390
                         }
373 391
                         //2.2计算机物料消耗存储到成本结果数据表中
374
-                        AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(marterialNo).parentMarterialNo(appSceneCostResultValue.getParentMarterialNo()).taskType(taskType).taskCode(taskCode).flowInstanceId(flowInstanceId).countValue(totalCost + "").costType(feeType).build();
392
+                        AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(marterialNo).parentMarterialNo(appSceneCostResultValue.getParentMarterialNo()).taskType(taskType).taskCode(taskCode).flowInstanceId(flowInstanceId).countValue(totalCost + "").costType(feeType).priceOrRate(hourRate).hour(laborHours).build();
375 393
                         standardCostService.iAppSceneCostResultValueService.save(resultValue);
376 394
                     }
377 395
                 }
@@ -382,18 +400,19 @@ public class StandardCostService {
382 400
                     String marterialNo = appSceneCostResultValue.getMarterialNo();
383 401
                     if (marterialNo != null) {
384 402
                         BigDecimal totalCost = new BigDecimal("0.0");
403
+                        BigDecimal laborHours = new BigDecimal("0.0");
385 404
                         List<CostMaterialProcessHours> costMaterialProcessHours = processHoursMap.get(marterialNo);
386 405
                         if (costMaterialProcessHours != null && costMaterialProcessHours.size() > 0) {
387 406
                             for (int j = 0; j < costMaterialProcessHours.size(); j++) {
388 407
                                 CostMaterialProcessHours processHours = costMaterialProcessHours.get(j);
389 408
                                 //TODO 燃动力工时来源
390
-                                BigDecimal laborHours = processHours.getLaborHours();
391
-                                //机物料消耗
392
-                                totalCost = totalCost.add(laborHours.multiply(hourRate));
409
+                                laborHours = laborHours.add(processHours.getDeviceHours());
410
+                                //水电费(燃动力工时*费率)成本
411
+                                totalCost = totalCost.add(processHours.getDeviceHours().multiply(hourRate));
393 412
                             }
394 413
                         }
395 414
                         //2.2计算机物料消耗存储到成本结果数据表中
396
-                        AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(marterialNo).parentMarterialNo(appSceneCostResultValue.getParentMarterialNo()).taskType(taskType).taskCode(taskCode).flowInstanceId(flowInstanceId).countValue(totalCost + "").costType(feeType).build();
415
+                        AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(marterialNo).parentMarterialNo(appSceneCostResultValue.getParentMarterialNo()).taskType(taskType).taskCode(taskCode).flowInstanceId(flowInstanceId).countValue(totalCost + "").costType(feeType).priceOrRate(hourRate).hour(laborHours).build();
397 416
                         standardCostService.iAppSceneCostResultValueService.save(resultValue);
398 417
                     }
399 418
                 }
@@ -404,18 +423,19 @@ public class StandardCostService {
404 423
                     String marterialNo = appSceneCostResultValue.getMarterialNo();
405 424
                     if (marterialNo != null) {
406 425
                         BigDecimal totalCost = new BigDecimal("0.0");
426
+                        BigDecimal laborHours = new BigDecimal("0.0");
407 427
                         List<CostMaterialProcessHours> costMaterialProcessHours = processHoursMap.get(marterialNo);
408 428
                         if (costMaterialProcessHours != null && costMaterialProcessHours.size() > 0) {
409 429
                             for (int j = 0; j < costMaterialProcessHours.size(); j++) {
410 430
                                 CostMaterialProcessHours processHours = costMaterialProcessHours.get(j);
411 431
                                 //TODO 其他工时来源
412
-                                BigDecimal laborHours = processHours.getLaborHours();
413
-                                //机物料消耗
414
-                                totalCost = totalCost.add(laborHours.multiply(hourRate));
432
+                                laborHours = laborHours.add(processHours.getDeviceHours());
433
+                                //其他制费成本
434
+                                totalCost = totalCost.add(processHours.getDeviceHours().multiply(hourRate));
415 435
                             }
416 436
                         }
417 437
                         //2.2计算机物料消耗存储到成本结果数据表中
418
-                        AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(marterialNo).parentMarterialNo(appSceneCostResultValue.getParentMarterialNo()).taskType(taskType).taskCode(taskCode).flowInstanceId(flowInstanceId).countValue(totalCost + "").costType(feeType).build();
438
+                        AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(marterialNo).parentMarterialNo(appSceneCostResultValue.getParentMarterialNo()).taskType(taskType).taskCode(taskCode).flowInstanceId(flowInstanceId).countValue(totalCost + "").costType(feeType).priceOrRate(hourRate).hour(laborHours).build();
419 439
                         standardCostService.iAppSceneCostResultValueService.save(resultValue);
420 440
                     }
421 441
                 }
@@ -465,6 +485,7 @@ public class StandardCostService {
465 485
         //2.计算出所有的单个物料的本阶的标准成本(标准成本=物料成本+人工成本+制造费用)
466 486
         //按照物料编号进行分组
467 487
         Map<String, List<AppSceneCostResultValue>> materialNoMap = list.stream().collect(Collectors.groupingBy(AppSceneCostResultValue::getMarterialNo));
488
+        //遍历根物料下所有的物料进行该物料本阶成本和费用类别的统计
468 489
         for (String key : materialNoMap.keySet()) {
469 490
             List<AppSceneCostResultValue> appSceneCostResultValues = materialNoMap.get(key);
470 491
             //按照费用类别进行分组
@@ -485,6 +506,23 @@ public class StandardCostService {
485 506
             BigDecimal otherCost = new BigDecimal("0.0");
486 507
             //7.本阶制造费(物流费)
487 508
             BigDecimal logisticsCost = new BigDecimal("0.0");
509
+            //物料单价
510
+            BigDecimal materialUnitPrice = new BigDecimal("0.0");
511
+            //人员工时、小时费率
512
+            BigDecimal laborHour = new BigDecimal("0.0");
513
+            BigDecimal laborHourRate = new BigDecimal("0.0");
514
+            //设备工时、小时费率
515
+            BigDecimal equipmentHour = new BigDecimal("0.0");
516
+            BigDecimal equipmentHourRate = new BigDecimal("0.0");
517
+            //辅料工时、小时费率
518
+            BigDecimal supplyMaterialHour = new BigDecimal("0.0");
519
+            BigDecimal supplyMaterialHourRate = new BigDecimal("0.0");
520
+            //燃动工时、小时费率
521
+            BigDecimal driveHour = new BigDecimal("0.0");
522
+            BigDecimal driveHourRate = new BigDecimal("0.0");
523
+            //其他工时、小时费率
524
+            BigDecimal otherHour = new BigDecimal("0.0");
525
+            BigDecimal otherHourRate = new BigDecimal("0.0");
488 526
             AppSceneCostResultValue currentMaterialCost = null;
489 527
             //遍历所有费用类别计算本阶标准成本
490 528
             for (int j = 0; j < appSceneCostResultValues.size(); j++) {
@@ -497,36 +535,73 @@ public class StandardCostService {
497 535
                     currentCost = currentCost.add(new BigDecimal(countValue));
498 536
                 }
499 537
             }
500
-            //计算本阶各个费用类别费用
538
+            //计算本阶各个费用类别费用以及记录本阶物料的工时和小时费率
501 539
             for (String feeType : costTypeMap.keySet()) {
502 540
                 List<AppSceneCostResultValue> appSceneCostResultValues1 = costTypeMap.get(feeType);
503 541
                 for (int m = 0; m < appSceneCostResultValues1.size(); m++) {
504 542
                     if (FeeTypeEnum.MaterialCost.getCode().equals(feeType)) {
543
+                        //物料成本
505 544
                         materialCost = materialCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
545
+                        //物料单价
546
+                        materialUnitPrice = appSceneCostResultValues1.get(m).getPriceOrRate();
506 547
                     } else if (FeeTypeEnum.LaborCost.getCode().equals(feeType)) {
548
+                        //人工成本
507 549
                         laborCost = laborCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
550
+                        //人工工时、小时费率
551
+                        laborHour = laborHour.add(appSceneCostResultValues1.get(m).getHour());
552
+                        laborHourRate = laborHourRate.add(appSceneCostResultValues1.get(m).getPriceOrRate());
508 553
                     } else if (FeeTypeEnum.EquipmentFee.getCode().equals(feeType)) {
554
+                        //设备费用
509 555
                         equipmentCost = equipmentCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
556
+                        //设备工时、小时费率
557
+                        equipmentHour = equipmentHour.add(appSceneCostResultValues1.get(m).getHour());
558
+                        equipmentHourRate = equipmentHourRate.add(appSceneCostResultValues1.get(m).getPriceOrRate());
510 559
                     } else if (FeeTypeEnum.SupplyMaterialFee.getCode().equals(feeType)) {
560
+                        //辅料费用
511 561
                         supplyMaterialCost = supplyMaterialCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
562
+                        //辅料工时、小时费率
563
+                        supplyMaterialHour = supplyMaterialHour.add(appSceneCostResultValues1.get(m).getHour());
564
+                        supplyMaterialHourRate = supplyMaterialHourRate.add(appSceneCostResultValues1.get(m).getPriceOrRate());
512 565
                     } else if (FeeTypeEnum.DriverFee.getCode().equals(feeType)) {
566
+                        //燃动费用
513 567
                         driveCost = driveCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
568
+                        //燃动工时、小时费率
569
+                        driveHour = driveHour.add(appSceneCostResultValues1.get(m).getHour());
570
+                        driveHourRate = driveHourRate.add(appSceneCostResultValues1.get(m).getPriceOrRate());
514 571
                     } else if (FeeTypeEnum.LogisticsFee.getCode().equals(feeType)) {
572
+                        //物流费用
515 573
                         logisticsCost = logisticsCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
516 574
                     } else if (FeeTypeEnum.OtherFee.getCode().equals(feeType)) {
575
+                        //其他费用
517 576
                         otherCost = otherCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
577
+                        //其他工时、小时费率
578
+                        otherHour = otherHour.add(appSceneCostResultValues1.get(m).getHour());
579
+                        otherHourRate = otherHourRate.add(appSceneCostResultValues1.get(m).getPriceOrRate());
518 580
                     }
519 581
                 }
520 582
             }
521
-            JSONObject costTypeDetail = new JSONObject();
522
-            costTypeDetail.put(FeeTypeEnum.MaterialCost.getCode(), materialCost.toString());
523
-            costTypeDetail.put(FeeTypeEnum.LaborCost.getCode(), laborCost.toString());
524
-            costTypeDetail.put(FeeTypeEnum.EquipmentFee.getCode(), equipmentCost.toString());
525
-            costTypeDetail.put(FeeTypeEnum.SupplyMaterialFee.getCode(), supplyMaterialCost.toString());
526
-            costTypeDetail.put(FeeTypeEnum.DriverFee.getCode(), driveCost.toString());
527
-            costTypeDetail.put(FeeTypeEnum.LogisticsFee.getCode(), logisticsCost.toString());
528
-            costTypeDetail.put(FeeTypeEnum.OtherFee.getCode(), otherCost.toString());
529
-            AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(key).parentMarterialNo(currentMaterialCost.getParentMarterialNo()).taskType(taskType).taskCode(taskCode).flowInstanceId(flowInstanceId).countValue(currentCost.toString()).costDetail(JSON.toJSONString(costTypeDetail)).costType(costType).build();
583
+            //本阶不同费用类别成本统计
584
+            JSONObject currentLevelCostTypeDetail = new JSONObject();
585
+            currentLevelCostTypeDetail.put(FeeTypeEnum.MaterialCost.getCode(), materialCost);
586
+            currentLevelCostTypeDetail.put(FeeTypeEnum.LaborCost.getCode(), laborCost);
587
+            currentLevelCostTypeDetail.put(FeeTypeEnum.EquipmentFee.getCode(), equipmentCost);
588
+            currentLevelCostTypeDetail.put(FeeTypeEnum.SupplyMaterialFee.getCode(), supplyMaterialCost);
589
+            currentLevelCostTypeDetail.put(FeeTypeEnum.DriverFee.getCode(), driveCost);
590
+            currentLevelCostTypeDetail.put(FeeTypeEnum.LogisticsFee.getCode(), logisticsCost);
591
+            currentLevelCostTypeDetail.put(FeeTypeEnum.OtherFee.getCode(), otherCost);
592
+            //统计本阶不同费用类别工时、小时费率
593
+            currentLevelCostTypeDetail.put(HourOrRateTypeEnum.MaterialUnitPrice.getCode(), materialUnitPrice);
594
+            currentLevelCostTypeDetail.put(HourOrRateTypeEnum.LaborHour.getCode(), laborHour);
595
+            currentLevelCostTypeDetail.put(HourOrRateTypeEnum.LaborHourRate.getCode(), laborHourRate);
596
+            currentLevelCostTypeDetail.put(HourOrRateTypeEnum.EquipmentHour.getCode(), equipmentHour);
597
+            currentLevelCostTypeDetail.put(HourOrRateTypeEnum.EquipmentHourRate.getCode(), equipmentHourRate);
598
+            currentLevelCostTypeDetail.put(HourOrRateTypeEnum.SupplyMaterialHour.getCode(), supplyMaterialHour);
599
+            currentLevelCostTypeDetail.put(HourOrRateTypeEnum.SupplyMaterialHourRate.getCode(), supplyMaterialHourRate);
600
+            currentLevelCostTypeDetail.put(HourOrRateTypeEnum.DriverHour.getCode(), driveHour);
601
+            currentLevelCostTypeDetail.put(HourOrRateTypeEnum.DriverHourRate.getCode(), driveHourRate);
602
+            currentLevelCostTypeDetail.put(HourOrRateTypeEnum.OtherHour.getCode(), otherHour);
603
+            currentLevelCostTypeDetail.put(HourOrRateTypeEnum.OtherHourRate.getCode(), otherHourRate);
604
+            AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(key).parentMarterialNo(currentMaterialCost.getParentMarterialNo()).taskType(taskType).taskCode(taskCode).flowInstanceId(flowInstanceId).countValue(currentCost.toString()).costDetail(JSON.toJSONString(currentLevelCostTypeDetail)).costType(costType).build();
530 605
             standardCostService.iAppSceneCostResultValueService.save(resultValue);
531 606
         }
532 607
         //3.计算出所有的单个物料的累计标准成本
@@ -545,6 +620,8 @@ public class StandardCostService {
545 620
      * @param flowInstanceId
546 621
      */
547 622
     private static void totalCountCost(List<AppSceneCostResultValue> standardCostList, String topMaterialCode, String taskType, String taskCode, String flowInstanceId) {
623
+
624
+        List<AppSceneCostStandardDetail> costStandardDetails = new ArrayList<>();
548 625
         //父类对应的子节点(除了最上层节点)
549 626
         Map<String, List<AppSceneCostResultValue>> parentMaterialNoMap = standardCostList.stream().filter(appSceneCostResultValue -> appSceneCostResultValue.getParentMarterialNo() != null).collect(Collectors.groupingBy(AppSceneCostResultValue::getParentMarterialNo));
550 627
         for (int i = 0; i < standardCostList.size(); i++) {
@@ -552,11 +629,45 @@ public class StandardCostService {
552 629
             AppSceneCostResultValue oldAppSceneCostResultValue = standardCostList.get(i);
553 630
             BigDecimal totalCost = new BigDecimal(oldAppSceneCostResultValue.getCountValue());
554 631
             //循环计算出当前节点的累计成本
555
-            totalCost = loopCount(oldAppSceneCostResultValue, parentMaterialNoMap, topMaterialCode, taskType, taskCode, flowInstanceId, totalCost);
556
-            oldAppSceneCostResultValue.setTotalValue(totalCost.toString());
632
+            String costDetail = oldAppSceneCostResultValue.getCostDetail();
633
+            //查询当前节点各个类型的成本
634
+            BigDecimal totalLabourCost = new BigDecimal(0);
635
+            BigDecimal totalEquipmentCost = new BigDecimal(0);
636
+            BigDecimal totalSupplyMaterialCost = new BigDecimal(0);
637
+            BigDecimal totalDriveCost = new BigDecimal(0);
638
+            BigDecimal totalLogisticsCost = new BigDecimal(0);
639
+            BigDecimal totalOtherCost = new BigDecimal(0);
640
+            JSONObject costDetailJson = JSON.parseObject(costDetail);
641
+            if (costDetailJson != null) {
642
+                totalLabourCost = costDetailJson.getBigDecimal(FeeTypeEnum.LaborCost.getCode());
643
+                totalEquipmentCost = costDetailJson.getBigDecimal(FeeTypeEnum.EquipmentFee.getCode());
644
+                totalSupplyMaterialCost = costDetailJson.getBigDecimal(FeeTypeEnum.SupplyMaterialFee.getCode());
645
+                totalDriveCost = costDetailJson.getBigDecimal(FeeTypeEnum.DriverFee.getCode());
646
+                totalLogisticsCost = costDetailJson.getBigDecimal(FeeTypeEnum.LogisticsFee.getCode());
647
+                totalOtherCost = costDetailJson.getBigDecimal(FeeTypeEnum.OtherFee.getCode());
648
+            }
649
+            TotalResultValue hourOrRateResultValue = loopCount(oldAppSceneCostResultValue, parentMaterialNoMap, totalLabourCost, totalEquipmentCost, totalSupplyMaterialCost, totalDriveCost, totalLogisticsCost, totalOtherCost, totalCost);
650
+            costDetailJson.put(TotalCostEnum.TotalLaborCost.getCode(), hourOrRateResultValue.getTotalLabourCost());
651
+            costDetailJson.put(TotalCostEnum.TotalEquipmentFee.getCode(), hourOrRateResultValue.getTotalEquipmentCost());
652
+            costDetailJson.put(TotalCostEnum.TotalSupplyMaterialFee.getCode(), hourOrRateResultValue.getTotalSupplyMaterialCost());
653
+            costDetailJson.put(TotalCostEnum.TotalDriverFee.getCode(), hourOrRateResultValue.getTotalDriveCost());
654
+            costDetailJson.put(TotalCostEnum.TotalLogisticsFee.getCode(), hourOrRateResultValue.getTotalLogisticsCost());
655
+            costDetailJson.put(TotalCostEnum.TotalOtherFee.getCode(), hourOrRateResultValue.getTotalOtherCost());
656
+            costDetailJson.put(TotalCostEnum.TotalStandardCost.getCode(), hourOrRateResultValue.getTotalCost());
657
+            oldAppSceneCostResultValue.setCostDetail(costDetailJson.toJSONString());
658
+            oldAppSceneCostResultValue.setTotalValue(hourOrRateResultValue.getTotalCost().toString());
557 659
             standardCostService.iAppSceneCostResultValueService.updateById(oldAppSceneCostResultValue);
558
-            //TODO 更新结果集到标准成本单行查询中去
660
+            //构造单行成本查询记录
661
+            AppSceneCostStandardDetail costStandardDetail = AppSceneCostStandardDetail.builder().materialNumber(oldAppSceneCostResultValue.getMarterialNo()).materialName(oldAppSceneCostResultValue.getMarterialNo()).parentMaterialNumber(oldAppSceneCostResultValue.getParentMarterialNo())
662
+//                    .versionNumber()
663
+//                    .level()
664
+//                    .sort()
665
+//                    .figureNumber()
666
+                    .dosage(oldAppSceneCostResultValue.getNum() != null ? new Double(oldAppSceneCostResultValue.getNum()) : 0).unit(oldAppSceneCostResultValue.getUnit()).materialCost(costDetailJson.getBigDecimal(FeeTypeEnum.MaterialCost.getCode())).laborCost(costDetailJson.getBigDecimal(FeeTypeEnum.LaborCost.getCode())).equipmentCost(costDetailJson.getBigDecimal(FeeTypeEnum.EquipmentFee.getCode())).supplyMaterialCost(costDetailJson.getBigDecimal(FeeTypeEnum.SupplyMaterialFee.getCode())).driveCost(costDetailJson.getBigDecimal(FeeTypeEnum.DriverFee.getCode())).logisticsCost(costDetailJson.getBigDecimal(FeeTypeEnum.LogisticsFee.getCode())).otherCost(costDetailJson.getBigDecimal(FeeTypeEnum.OtherFee.getCode())).currentStandardCost(new BigDecimal(oldAppSceneCostResultValue.getCountValue())).totalMaterialCost(costDetailJson.getBigDecimal(TotalCostEnum.TotalMaterialCost.getCode())).totalLaborCost(costDetailJson.getBigDecimal(TotalCostEnum.TotalLaborCost.getCode())).totalEquipmentCost(costDetailJson.getBigDecimal(TotalCostEnum.TotalEquipmentFee.getCode())).totalSupplyMaterialCost(costDetailJson.getBigDecimal(TotalCostEnum.TotalSupplyMaterialFee.getCode())).totalDriveCost(costDetailJson.getBigDecimal(TotalCostEnum.TotalDriverFee.getCode())).totalLogisticsCost(costDetailJson.getBigDecimal(TotalCostEnum.TotalLogisticsFee.getCode())).totalOtherCost(costDetailJson.getBigDecimal(TotalCostEnum.TotalOtherFee.getCode())).totalStandardCost(costDetailJson.getBigDecimal(TotalCostEnum.TotalStandardCost.getCode())).build();
667
+            costStandardDetails.add(costStandardDetail);
559 668
         }
669
+        //更新结果集到标准成本单行查询中去
670
+        standardCostService.iAppSceneCostStandardDetailService.saveBatch(costStandardDetails);
560 671
     }
561 672
 
562 673
     /**
@@ -565,12 +676,8 @@ public class StandardCostService {
565 676
      *
566 677
      * @param appSceneCostResultValue
567 678
      * @param parentMaterialNoMap
568
-     * @param topMaterialCode
569
-     * @param taskType
570
-     * @param taskCode
571
-     * @param flowInstanceId
572 679
      */
573
-    private static BigDecimal loopCount(AppSceneCostResultValue appSceneCostResultValue, Map<String, List<AppSceneCostResultValue>> parentMaterialNoMap, String topMaterialCode, String taskType, String taskCode, String flowInstanceId, BigDecimal totalCost) {
680
+    private static TotalResultValue loopCount(AppSceneCostResultValue appSceneCostResultValue, Map<String, List<AppSceneCostResultValue>> parentMaterialNoMap, BigDecimal totalLabourCost, BigDecimal totalEquipmentCost, BigDecimal totalSupplyMaterialCost, BigDecimal totalDriveCost, BigDecimal totalLogisticsCost, BigDecimal totalOtherCost, BigDecimal totalCost) {
574 681
         String marterialNo = appSceneCostResultValue.getMarterialNo();
575 682
         if (parentMaterialNoMap.containsKey(marterialNo)) {
576 683
             //获取当前节点的子节点并遍历
@@ -578,16 +685,31 @@ public class StandardCostService {
578 685
             for (int j = 0; j < appSceneCostResultValues.size(); j++) {
579 686
                 AppSceneCostResultValue appSceneCostResultValue1 = appSceneCostResultValues.get(j);
580 687
                 String countValue = appSceneCostResultValue1.getCountValue();
688
+                //标准成本累计
581 689
                 if (countValue != null) {
582 690
                     totalCost = totalCost.add(new BigDecimal(countValue));
583 691
                 }
692
+                //各个费用类别成本累计
693
+                if (appSceneCostResultValue1.getCostDetail() != null) {
694
+                    JSONObject costDetailJson = JSON.parseObject(appSceneCostResultValue1.getCostDetail());
695
+                    if (costDetailJson != null) {
696
+                        totalLabourCost = totalLabourCost.add(costDetailJson.getBigDecimal(FeeTypeEnum.LaborCost.getCode()));
697
+                        totalEquipmentCost = totalEquipmentCost.add(costDetailJson.getBigDecimal(FeeTypeEnum.EquipmentFee.getCode()));
698
+                        totalSupplyMaterialCost = totalSupplyMaterialCost.add(costDetailJson.getBigDecimal(FeeTypeEnum.SupplyMaterialFee.getCode()));
699
+                        totalDriveCost = totalDriveCost.add(costDetailJson.getBigDecimal(FeeTypeEnum.DriverFee.getCode()));
700
+                        totalLogisticsCost = totalLogisticsCost.add(costDetailJson.getBigDecimal(FeeTypeEnum.LogisticsFee.getCode()));
701
+                        totalOtherCost = totalOtherCost.add(costDetailJson.getBigDecimal(FeeTypeEnum.OtherFee.getCode()));
702
+                    }
703
+                }
584 704
                 //判断当前子节点是否还有子节点
585 705
                 if (parentMaterialNoMap.containsKey(appSceneCostResultValue1.getMarterialNo())) {
586 706
                     //如果还有子节点则继续递归
587
-                    loopCount(appSceneCostResultValue1, parentMaterialNoMap, topMaterialCode, taskType, taskCode, flowInstanceId, totalCost);
707
+                    loopCount(appSceneCostResultValue1, parentMaterialNoMap, totalLabourCost, totalEquipmentCost, totalSupplyMaterialCost, totalDriveCost, totalLogisticsCost, totalOtherCost, totalCost);
588 708
                 }
589 709
             }
590 710
         }
591
-        return totalCost;
711
+        TotalResultValue hourOrRateResultValue = TotalResultValue.builder().totalLabourCost(totalLabourCost).totalEquipmentCost(totalEquipmentCost).totalSupplyMaterialCost(totalSupplyMaterialCost).totalDriveCost(totalDriveCost).totalLogisticsCost(totalLogisticsCost).totalOtherCost(totalOtherCost).totalCost(totalCost).build();
712
+        appSceneCostResultValue.setTotalValue(totalCost.toString());
713
+        return hourOrRateResultValue;
592 714
     }
593 715
 }

+ 0
- 41
qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/CostStandardDetailService.java Voir le fichier

@@ -1,41 +0,0 @@
1
-package com.zzsmart.qomo.kn.cost.manage.service;
2
-
3
-import com.alibaba.fastjson.JSONObject;
4
-import com.baomidou.mybatisplus.core.metadata.IPage;
5
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
-import com.baomidou.mybatisplus.extension.service.IService;
7
-import com.zzsmart.qomo.kn.cost.manage.entity.CostStandardDetail;
8
-import com.zzsmart.qomo.kn.cost.manage.vo.CostStandardDetailSearch;
9
-import com.zzsmart.qomo.kn.cost.manage.vo.CostStandardDetailVO;
10
-
11
-import javax.servlet.http.HttpServletRequest;
12
-import javax.servlet.http.HttpServletResponse;
13
-
14
-/**
15
- * <p>
16
- * 标准成本明细表 服务类
17
- * </p>
18
- *
19
- * @author app_scene_cost_purchase_price
20
- * @since 2024-06-19
21
- */
22
-public interface CostStandardDetailService extends IService<CostStandardDetail> {
23
-    /**
24
-     * 分页查询
25
-     *
26
-     * @param page
27
-     * @param
28
-     * @return
29
-     */
30
-    IPage<CostStandardDetailVO> pageList(Page<CostStandardDetailVO> page, CostStandardDetailVO costStandard);
31
-
32
-    /**
33
-     * 导出列表信息为Excel文件
34
-     *
35
-     * @param request
36
-     * @param response
37
-     * @param costStandardDetailSearch
38
-     * @return
39
-     */
40
-    JSONObject exportExcel(HttpServletRequest request, HttpServletResponse response, CostStandardDetailSearch costStandardDetailSearch);
41
-}

+ 14
- 0
qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostStandardDetailService.java Voir le fichier

@@ -0,0 +1,14 @@
1
+package com.zzsmart.qomo.kn.cost.manage.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostStandardDetail;
5
+
6
+/**
7
+ * @Description: app_scene_cost_standard_detail
8
+ * @Author: jeecg-boot
9
+ * @Date:   2024-07-31
10
+ * @Version: V1.0
11
+ */
12
+public interface IAppSceneCostStandardDetailService extends IService<AppSceneCostStandardDetail> {
13
+
14
+}

+ 19
- 0
qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostStandardDetailServiceImpl.java Voir le fichier

@@ -0,0 +1,19 @@
1
+package com.zzsmart.qomo.kn.cost.manage.service.impl;
2
+
3
+import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostStandardDetail;
4
+import com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostStandardDetailMapper;
5
+import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostStandardDetailService;
6
+import org.springframework.stereotype.Service;
7
+
8
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
9
+
10
+/**
11
+ * @Description: app_scene_cost_standard_detail
12
+ * @Author: jeecg-boot
13
+ * @Date:   2024-07-31
14
+ * @Version: V1.0
15
+ */
16
+@Service
17
+public class AppSceneCostStandardDetailServiceImpl extends ServiceImpl<AppSceneCostStandardDetailMapper, AppSceneCostStandardDetail> implements IAppSceneCostStandardDetailService {
18
+
19
+}

+ 0
- 2
qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/BomTreeServiceImpl.java Voir le fichier

@@ -2,12 +2,10 @@ package com.zzsmart.qomo.kn.cost.manage.service.impl;
2 2
 
3 3
 import cn.hutool.core.util.StrUtil;
4 4
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5
-import com.zzsmart.qomo.kn.cost.manage.entity.CostStandardDetail;
6 5
 import com.zzsmart.qomo.kn.cost.manage.mapper.CostStandardDetailMapper;
7 6
 import com.zzsmart.qomo.kn.cost.manage.service.BomTreeService;
8 7
 import com.zzsmart.qomo.kn.cost.manage.util.BomTreeBuilder;
9 8
 import com.zzsmart.qomo.kn.cost.manage.vo.BomTreeInfoVO;
10
-import com.zzsmart.qomo.kn.cost.manage.vo.CostStandardDetailVO;
11 9
 import org.springframework.beans.BeanUtils;
12 10
 import org.springframework.beans.factory.annotation.Autowired;
13 11
 import org.springframework.stereotype.Service;

+ 0
- 84
qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/CostStandardDetailServiceImpl.java Voir le fichier

@@ -1,84 +0,0 @@
1
-package com.zzsmart.qomo.kn.cost.manage.service.impl;
2
-
3
-import cn.hutool.core.util.StrUtil;
4
-import com.alibaba.excel.EasyExcel;
5
-import com.alibaba.fastjson.JSONObject;
6
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
7
-import com.baomidou.mybatisplus.core.metadata.IPage;
8
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
9
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
10
-import com.zzsmart.qomo.kn.cost.manage.entity.CostStandardDetail;
11
-import com.zzsmart.qomo.kn.cost.manage.mapper.CostStandardDetailMapper;
12
-import com.zzsmart.qomo.kn.cost.manage.service.CostStandardDetailService;
13
-import com.zzsmart.qomo.kn.cost.manage.vo.CostStandardDetailSearch;
14
-import com.zzsmart.qomo.kn.cost.manage.vo.CostStandardDetailVO;
15
-import org.jeecg.common.system.query.QueryGenerator;
16
-import org.springframework.beans.factory.annotation.Autowired;
17
-import org.springframework.stereotype.Service;
18
-
19
-import javax.servlet.http.HttpServletRequest;
20
-import javax.servlet.http.HttpServletResponse;
21
-import java.util.List;
22
-import java.util.Set;
23
-
24
-import static com.zzsmart.qomo.kn.cost.manage.util.EasyExcelUtil.getIncludeFields;
25
-
26
-/**
27
- * <p>
28
- * 标准成本明细表 服务实现类
29
- * </p>
30
- *
31
- * @author app_scene_cost_purchase_price
32
- * @since 2024-06-19
33
- */
34
-@Service
35
-public class CostStandardDetailServiceImpl extends ServiceImpl<CostStandardDetailMapper, CostStandardDetail> implements CostStandardDetailService {
36
-
37
-    @Autowired
38
-    CostStandardDetailMapper costStandardDetailMapper;
39
-
40
-    /**
41
-     * 分页查询
42
-     *
43
-     * @param page
44
-     * @param costStandard
45
-     * @return
46
-     */
47
-    @Override
48
-    public IPage<CostStandardDetailVO> pageList(Page<CostStandardDetailVO> page, CostStandardDetailVO costStandard) {
49
-        // 查询条件组装
50
-        QueryWrapper queryWrapper = new QueryWrapper();
51
-
52
-        if (costStandard != null) {
53
-
54
-            if (StrUtil.isNotEmpty(costStandard.getMaterialNumber())) {
55
-                // 物料号
56
-                queryWrapper.like("c1.material_number", costStandard.getMaterialNumber());
57
-            }
58
-            if (StrUtil.isNotEmpty(costStandard.getVersionNumber())) {
59
-                // 版本号
60
-                queryWrapper.like("c2.version_number", costStandard.getVersionNumber());
61
-            }
62
-
63
-        }
64
-        return (IPage<CostStandardDetailVO>) costStandardDetailMapper.pageList(page, queryWrapper);
65
-    }
66
-
67
-    @Override
68
-    public JSONObject exportExcel(HttpServletRequest request, HttpServletResponse response, CostStandardDetailSearch costStandardDetailSearch) {
69
-        QueryWrapper<CostStandardDetail> queryWrapper = QueryGenerator.initQueryWrapper(costStandardDetailSearch, request.getParameterMap());
70
-        if (costStandardDetailSearch != null && costStandardDetailSearch.getSelections() != null && costStandardDetailSearch.getSelections().size() > 0) {
71
-            queryWrapper.in("id", costStandardDetailSearch.getSelections());
72
-        }
73
-        List exportList = list(queryWrapper);
74
-//        EasyExcelUtil.export(response, "D:/WorkDoc/PHM/单机部署/单行查询.xls", null, exportList,CostStandardDetail.class);
75
-        // 根据用户传入字段 假设我们要忽略 date
76
-        Set<String> includeFields = getIncludeFields(CostStandardDetail.class);
77
-        EasyExcel.write("D:/WorkDoc/PHM/单机部署/单行查询.xls", CostStandardDetail.class).includeColumnFieldNames(includeFields).sheet("模板").doWrite(exportList);
78
-        // return super.exportXls(request, costStandardDetail, CostStandardDetail.class, "单行查询");
79
-        JSONObject result = new JSONObject();
80
-        result.put("filePath", "D:/WorkDoc/PHM/单机部署/单行查询.xls");
81
-        return result;
82
-    }
83
-
84
-}

+ 0
- 2
qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/util/BomTreeBuilder.java Voir le fichier

@@ -1,8 +1,6 @@
1 1
 package com.zzsmart.qomo.kn.cost.manage.util;
2 2
 
3
-import com.zzsmart.qomo.kn.cost.manage.entity.CostStandardDetail;
4 3
 import com.zzsmart.qomo.kn.cost.manage.vo.BomTreeInfoVO;
5
-import com.zzsmart.qomo.kn.cost.manage.vo.CostStandardDetailVO;
6 4
 
7 5
 import java.util.ArrayList;
8 6
 import java.util.Comparator;

+ 0
- 1
qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/util/EasyExcelUtil.java Voir le fichier

@@ -5,7 +5,6 @@ import com.alibaba.excel.annotation.ExcelProperty;
5 5
 import com.alibaba.excel.write.metadata.style.WriteCellStyle;
6 6
 import com.alibaba.excel.write.metadata.style.WriteFont;
7 7
 import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
8
-import com.zzsmart.qomo.kn.cost.manage.entity.CostStandardDetail;
9 8
 import org.apache.poi.ss.usermodel.*;
10 9
 
11 10
 import javax.servlet.http.HttpServletResponse;

+ 0
- 19
qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/vo/CostStandardDetailSearch.java Voir le fichier

@@ -1,19 +0,0 @@
1
-package com.zzsmart.qomo.kn.cost.manage.vo;
2
-
3
-import io.swagger.annotations.ApiModel;
4
-import lombok.AllArgsConstructor;
5
-import lombok.Data;
6
-import lombok.NoArgsConstructor;
7
-
8
-import java.util.List;
9
-
10
-@Data
11
-@NoArgsConstructor
12
-@AllArgsConstructor
13
-@ApiModel(value = "bom结构树", description = "bom结构树")
14
-public class CostStandardDetailSearch extends CostStandardDetailVO {
15
-    /**
16
-     * 选择行的id
17
-     */
18
-    private List<String> selections;
19
-}

+ 0
- 30
qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/vo/CostStandardDetailVO.java Voir le fichier

@@ -1,30 +0,0 @@
1
-package com.zzsmart.qomo.kn.cost.manage.vo;
2
-
3
-import com.zzsmart.qomo.kn.cost.manage.entity.CostStandardDetail;
4
-import io.swagger.annotations.ApiModelProperty;
5
-import lombok.AllArgsConstructor;
6
-import lombok.Builder;
7
-import lombok.Data;
8
-import lombok.NoArgsConstructor;
9
-
10
-import java.io.Serializable;
11
-
12
-/**
13
- * <p>
14
- * 标准成本明细表
15
- * </p>
16
- *
17
- * @author app_scene_cost_purchase_price
18
- * @since 2024-06-19
19
- */
20
-@Data
21
-@Builder
22
-@NoArgsConstructor
23
-@AllArgsConstructor
24
-public class CostStandardDetailVO extends CostStandardDetail implements Serializable {
25
-    /**
26
-     * 版本号
27
-     */
28
-    @ApiModelProperty(value = "版本号")
29
-    private String versionNumber;
30
-}

+ 51
- 0
qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/vo/TotalResultValue.java Voir le fichier

@@ -0,0 +1,51 @@
1
+package com.zzsmart.qomo.kn.cost.manage.vo;
2
+
3
+import lombok.AllArgsConstructor;
4
+import lombok.Builder;
5
+import lombok.Data;
6
+import lombok.NoArgsConstructor;
7
+
8
+import java.math.BigDecimal;
9
+
10
+@Data
11
+@Builder
12
+@AllArgsConstructor
13
+@NoArgsConstructor
14
+/**
15
+ * @ClassName: HourOrRateResultValue
16
+ * @Description: 人工费率成本结果值
17
+ * @Author: zzsmart
18
+ * @Date: 2020/5/26 14:06
19
+ * @Version: 1.0
20
+ */
21
+public class TotalResultValue {
22
+    /**
23
+     * 总人工成本
24
+     */
25
+    private BigDecimal totalLabourCost;
26
+    /**
27
+     * 总设备成本
28
+     */
29
+    private BigDecimal totalEquipmentCost;
30
+    /**
31
+     * 总采购成本
32
+     */
33
+
34
+    private BigDecimal totalSupplyMaterialCost;
35
+    /**
36
+     * 总运输成本
37
+     */
38
+    private BigDecimal totalDriveCost;
39
+    /**
40
+     * 总物流成本
41
+     */
42
+    private BigDecimal totalLogisticsCost;
43
+    /**
44
+     * 总其他成本
45
+     */
46
+    private BigDecimal totalOtherCost;
47
+    /**
48
+     * 总成本
49
+     */
50
+    private BigDecimal totalCost;
51
+}