diff --git a/qomo-kn-cost-manage-start/src/main/resources/application-dev.yml b/qomo-kn-cost-manage-start/src/main/resources/application-dev.yml
index 18a44f0..26d00f7 100644
--- a/qomo-kn-cost-manage-start/src/main/resources/application-dev.yml
+++ b/qomo-kn-cost-manage-start/src/main/resources/application-dev.yml
@@ -15,7 +15,7 @@ v2:
defaultFormat: .png
server:
- port: 8098
+ port: 8099
tomcat:
max-swallow-size: -1
error:
@@ -211,9 +211,9 @@ spring:
# password: knphm2021
# driver-class-name: com.mysql.cj.jdbc.Driver
master:
- url: jdbc:mysql://158.158.4.51:13306/kn_otd_app?useUnicode=true&allowMultiQueries=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&serverTimezone=Asia/Shanghai&useSSL=false
- username: knotd
- password: otd@2024
+ url: jdbc:mysql://158.158.4.51:3386/kn_energy_cost?useUnicode=true&allowMultiQueries=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&serverTimezone=Asia/Shanghai&useSSL=false
+ username: root
+ password: knEnergyCost0826#
driver-class-name: com.mysql.cj.jdbc.Driver
# 多数据源配置
#multi-datasource1:
@@ -222,16 +222,23 @@ spring:
#password: root
#driver-class-name: com.mysql.cj.jdbc.Driver
#redis 配置
- redis:
+# redis:
# database: 5
# host: 121.40.189.20
# port: 6389
+ redis:
database: 9
host: 192.168.50.9
port: 7379
password: 'zzboard'
main:
allow-circular-references: true
+# redis:
+# database: 10
+# host: localhost
+# port: 6379
+# main:
+# allow-circular-references: true
#rabbitmq 配置
rabbitmq:
@@ -265,6 +272,8 @@ mybatis-plus:
# log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl
# 返回类型为Map,显示null对应的字段
call-setters-on-nulls: true
+ security:
+ enabled: false
#jeecg专用配置
minidao:
base-package: org.jeecg.modules.jmreport.*,org.jeecg.modules.drag.*
@@ -287,8 +296,8 @@ jeecg:
#webapp文件路径
webapp: /opt/webapp
shiro:
-# excludeUrls: /api/internalService/**,/test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**,/api/getUserInfo,/sys/sysDepart/**,/taskSocket/**,/flowSocket/**,/dataCheck/**
- excludeUrls: /**/**,/**/**/**
+ excludeUrls: /api/internalService/**,/test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**,/api/getUserInfo,/sys/sysDepart/**,/taskSocket/**,/flowSocket/**,/dataCheck/**
+# excludeUrls: /**/**,/**/**/**
#阿里云oss存储和大鱼短信秘钥配置
oss:
diff --git a/qomo-kn-cost-manage/pom.xml b/qomo-kn-cost-manage/pom.xml
index 7fa2ad8..827b04f 100644
--- a/qomo-kn-cost-manage/pom.xml
+++ b/qomo-kn-cost-manage/pom.xml
@@ -13,6 +13,7 @@
org.qomo.boot
qomo-system-biz
+ 2.0.1-SNAPSHOT
com.google.auto.service
@@ -22,6 +23,21 @@
com.zzsmart.qomo
qomo-data-integration
+
+
+ com.zzsmart.hdp.hive
+ hive-jdbc
+
+
+
+
+ com.zzsmart.hdp.hive
+ hive-jdbc
+ 2.6.5.0-292
+
+
+ com.zzsmart.qomo
+ qomo-data-selfReport
\ No newline at end of file
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostBomRelevancyController.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostBomRelevancyController.java
new file mode 100644
index 0000000..0e806cb
--- /dev/null
+++ b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostBomRelevancyController.java
@@ -0,0 +1,159 @@
+package com.zzsmart.qomo.kn.cost.manage.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostBomRelevancy;
+import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostBomRelevancyService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.base.controller.JeecgController;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Arrays;
+
+/**
+ * @Description: app_scene_cost_bom_relevancy
+ * @Author: jeecg-boot
+ * @Date: 2024-09-08
+ * @Version: V1.0
+ */
+@Api(tags = "app_scene_cost_bom_relevancy")
+@RestController
+@RequestMapping("//appSceneCostBomRelevancy")
+@Slf4j
+public class AppSceneCostBomRelevancyController extends JeecgController {
+ @Autowired
+ private IAppSceneCostBomRelevancyService appSceneCostBomRelevancyService;
+
+ /**
+ * 分页列表查询
+ *
+ * @param appSceneCostBomRelevancy
+ * @param pageNo
+ * @param pageSize
+ * @param req
+ * @return
+ */
+ //@AutoLog(value = "app_scene_cost_bom_relevancy-分页列表查询")
+ @ApiOperation(value = "app_scene_cost_bom_relevancy-分页列表查询", notes = "app_scene_cost_bom_relevancy-分页列表查询")
+ @GetMapping(value = "/list")
+ public Result> queryPageList(AppSceneCostBomRelevancy appSceneCostBomRelevancy, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
+ QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(appSceneCostBomRelevancy, req.getParameterMap());
+ Page page = new Page(pageNo, pageSize);
+ IPage pageList = appSceneCostBomRelevancyService.page(page, queryWrapper);
+ return Result.OK(pageList);
+ }
+
+ /**
+ * 添加
+ *
+ * @param appSceneCostBomRelevancy
+ * @return
+ */
+ @AutoLog(value = "app_scene_cost_bom_relevancy-添加")
+ @ApiOperation(value = "app_scene_cost_bom_relevancy-添加", notes = "app_scene_cost_bom_relevancy-添加")
+ @RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_bom_relevancy:add")
+ @PostMapping(value = "/add")
+ public Result add(@RequestBody AppSceneCostBomRelevancy appSceneCostBomRelevancy) {
+ appSceneCostBomRelevancyService.save(appSceneCostBomRelevancy);
+ return Result.OK("添加成功!");
+ }
+
+ /**
+ * 编辑
+ *
+ * @param appSceneCostBomRelevancy
+ * @return
+ */
+ @AutoLog(value = "app_scene_cost_bom_relevancy-编辑")
+ @ApiOperation(value = "app_scene_cost_bom_relevancy-编辑", notes = "app_scene_cost_bom_relevancy-编辑")
+ @RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_bom_relevancy:edit")
+ @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
+ public Result edit(@RequestBody AppSceneCostBomRelevancy appSceneCostBomRelevancy) {
+ appSceneCostBomRelevancyService.updateById(appSceneCostBomRelevancy);
+ return Result.OK("编辑成功!");
+ }
+
+ /**
+ * 通过id删除
+ *
+ * @param id
+ * @return
+ */
+ @AutoLog(value = "app_scene_cost_bom_relevancy-通过id删除")
+ @ApiOperation(value = "app_scene_cost_bom_relevancy-通过id删除", notes = "app_scene_cost_bom_relevancy-通过id删除")
+ @RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_bom_relevancy:delete")
+ @DeleteMapping(value = "/delete")
+ public Result delete(@RequestParam(name = "id", required = true) String id) {
+ appSceneCostBomRelevancyService.removeById(id);
+ return Result.OK("删除成功!");
+ }
+
+ /**
+ * 批量删除
+ *
+ * @param ids
+ * @return
+ */
+ @AutoLog(value = "app_scene_cost_bom_relevancy-批量删除")
+ @ApiOperation(value = "app_scene_cost_bom_relevancy-批量删除", notes = "app_scene_cost_bom_relevancy-批量删除")
+ @RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_bom_relevancy:deleteBatch")
+ @DeleteMapping(value = "/deleteBatch")
+ public Result deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+ this.appSceneCostBomRelevancyService.removeByIds(Arrays.asList(ids.split(",")));
+ return Result.OK("批量删除成功!");
+ }
+
+ /**
+ * 通过id查询
+ *
+ * @param id
+ * @return
+ */
+ //@AutoLog(value = "app_scene_cost_bom_relevancy-通过id查询")
+ @ApiOperation(value = "app_scene_cost_bom_relevancy-通过id查询", notes = "app_scene_cost_bom_relevancy-通过id查询")
+ @GetMapping(value = "/queryById")
+ public Result queryById(@RequestParam(name = "id", required = true) String id) {
+ AppSceneCostBomRelevancy appSceneCostBomRelevancy = appSceneCostBomRelevancyService.getById(id);
+ if (appSceneCostBomRelevancy == null) {
+ return Result.error("未找到对应数据");
+ }
+ return Result.OK(appSceneCostBomRelevancy);
+ }
+
+ /**
+ * 导出excel
+ *
+ * @param request
+ * @param appSceneCostBomRelevancy
+ */
+ @RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_bom_relevancy:exportXls")
+ @RequestMapping(value = "/exportXls")
+ public ModelAndView exportXls(HttpServletRequest request, AppSceneCostBomRelevancy appSceneCostBomRelevancy) {
+ return super.exportXls(request, appSceneCostBomRelevancy, AppSceneCostBomRelevancy.class, "app_scene_cost_bom_relevancy");
+ }
+
+ /**
+ * 通过excel导入数据
+ *
+ * @param request
+ * @param response
+ * @return
+ */
+ @RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_bom_relevancy:importExcel")
+ @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+ public Result> importExcel(HttpServletRequest request, HttpServletResponse response) {
+ return super.importExcel(request, response, AppSceneCostBomRelevancy.class);
+ }
+
+}
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostCountController.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostCountController.java
index 6c021b0..86b6ec5 100644
--- a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostCountController.java
+++ b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostCountController.java
@@ -81,7 +81,7 @@ public class AppSceneCostCountController extends JeecgController addCostCountTask(@RequestBody AppSceneCostCount appSceneCostCount) {
+ public Result addCostCountTask(@RequestBody AppSceneCostCountVO appSceneCostCount) {
appSceneCostCountService.addCostCountTask(appSceneCostCount);
return Result.OK("添加成功!");
}
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostMaterialBomController.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostMaterialBomController.java
deleted file mode 100644
index 6cc8480..0000000
--- a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostMaterialBomController.java
+++ /dev/null
@@ -1,190 +0,0 @@
-package com.zzsmart.qomo.kn.cost.manage.controller;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostMaterialBom;
-import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostMaterialBomService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.extern.slf4j.Slf4j;
-import org.jeecg.common.api.vo.Result;
-import org.jeecg.common.system.base.controller.JeecgController;
-import org.jeecg.common.system.query.QueryGenerator;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.List;
-
-/**
- * @Description: app_scene_cost_material_bom
- * @Author: jeecg-boot
- * @Date: 2024-08-02
- * @Version: V1.0
- */
-@RequestMapping("//cost-material-bom")
-@Api(tags="cost-标准成本-bom信息")
-@RestController
-@Slf4j
-public class AppSceneCostMaterialBomController extends JeecgController {
- @Autowired
- private IAppSceneCostMaterialBomService costMaterialBomService;
- /**
- * 分页列表查询
- *
- * @param costMaterialBom
- * @param pageNo
- * @param pageSize
- * @param req
- * @return
- */
- //@AutoLog(value = "app_scene_cost_standard_version-分页列表查询")
- @ApiOperation(value="物料bom分页列表查询", notes="物料bom分页列表查询")
- @GetMapping(value = "/pageList")
- public Result> queryPageList(AppSceneCostMaterialBom costMaterialBom,
- @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
- @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
- HttpServletRequest req) {
- QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(costMaterialBom, req.getParameterMap());
- Page page = new Page(pageNo, pageSize);
- IPage pageList = costMaterialBomService.page(page, queryWrapper);
- return Result.OK(pageList);
- }
- /**
- * 列表查询
- *
- * @return
- */
- @ApiOperation(value="物料bom列表查询", notes="物料bom列表查询")
- @GetMapping(value = "/list")
- public Result> queryList(@RequestParam(name = "materialNumber",required = false) String materialNumber) {
- List list = costMaterialBomService.queryListResult(materialNumber);
- return Result.OK(list);
- }
-
-// /**
-// * 分页列表查询
-// *
-// * @param appSceneCostMaterialBom
-// * @param pageNo
-// * @param pageSize
-// * @param req
-// * @return
-// */
-// //@AutoLog(value = "app_scene_cost_material_bom-分页列表查询")
-// @ApiOperation(value = "app_scene_cost_material_bom-分页列表查询", notes = "app_scene_cost_material_bom-分页列表查询")
-// @GetMapping(value = "/list")
-// public Result> queryPageList(AppSceneCostMaterialBom appSceneCostMaterialBom,
-// @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
-// @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
-// HttpServletRequest req) {
-// QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(appSceneCostMaterialBom, req.getParameterMap());
-// Page page = new Page(pageNo, pageSize);
-// IPage pageList = appSceneCostMaterialBomService.page(page, queryWrapper);
-// return Result.OK(pageList);
-// }
-//
-// /**
-// * 添加
-// *
-// * @param appSceneCostMaterialBom
-// * @return
-// */
-// @AutoLog(value = "app_scene_cost_material_bom-添加")
-// @ApiOperation(value = "app_scene_cost_material_bom-添加", notes = "app_scene_cost_material_bom-添加")
-// //@RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_material_bom:add")
-// @PostMapping(value = "/add")
-// public Result add(@RequestBody AppSceneCostMaterialBom appSceneCostMaterialBom) {
-// appSceneCostMaterialBomService.save(appSceneCostMaterialBom);
-// return Result.OK("添加成功!");
-// }
-//
-// /**
-// * 编辑
-// *
-// * @param appSceneCostMaterialBom
-// * @return
-// */
-// @AutoLog(value = "app_scene_cost_material_bom-编辑")
-// @ApiOperation(value = "app_scene_cost_material_bom-编辑", notes = "app_scene_cost_material_bom-编辑")
-// //@RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_material_bom:edit")
-// @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
-// public Result edit(@RequestBody AppSceneCostMaterialBom appSceneCostMaterialBom) {
-// appSceneCostMaterialBomService.updateById(appSceneCostMaterialBom);
-// return Result.OK("编辑成功!");
-// }
-//
-// /**
-// * 通过id删除
-// *
-// * @param id
-// * @return
-// */
-// @AutoLog(value = "app_scene_cost_material_bom-通过id删除")
-// @ApiOperation(value = "app_scene_cost_material_bom-通过id删除", notes = "app_scene_cost_material_bom-通过id删除")
-// //@RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_material_bom:delete")
-// @DeleteMapping(value = "/delete")
-// public Result delete(@RequestParam(name = "id", required = true) String id) {
-// appSceneCostMaterialBomService.removeById(id);
-// return Result.OK("删除成功!");
-// }
-//
-// /**
-// * 批量删除
-// *
-// * @param ids
-// * @return
-// */
-// @AutoLog(value = "app_scene_cost_material_bom-批量删除")
-// @ApiOperation(value = "app_scene_cost_material_bom-批量删除", notes = "app_scene_cost_material_bom-批量删除")
-// //@RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_material_bom:deleteBatch")
-// @DeleteMapping(value = "/deleteBatch")
-// public Result deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-// this.appSceneCostMaterialBomService.removeByIds(Arrays.asList(ids.split(",")));
-// return Result.OK("批量删除成功!");
-// }
-//
-// /**
-// * 通过id查询
-// *
-// * @param id
-// * @return
-// */
-// //@AutoLog(value = "app_scene_cost_material_bom-通过id查询")
-// @ApiOperation(value = "app_scene_cost_material_bom-通过id查询", notes = "app_scene_cost_material_bom-通过id查询")
-// @GetMapping(value = "/queryById")
-// public Result queryById(@RequestParam(name = "id", required = true) String id) {
-// AppSceneCostMaterialBom appSceneCostMaterialBom = appSceneCostMaterialBomService.getById(id);
-// if (appSceneCostMaterialBom == null) {
-// return Result.error("未找到对应数据");
-// }
-// return Result.OK(appSceneCostMaterialBom);
-// }
-//
-// /**
-// * 导出excel
-// *
-// * @param request
-// * @param appSceneCostMaterialBom
-// */
-// //@RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_material_bom:exportXls")
-// @RequestMapping(value = "/exportXls")
-// public ModelAndView exportXls(HttpServletRequest request, AppSceneCostMaterialBom appSceneCostMaterialBom) {
-// return super.exportXls(request, appSceneCostMaterialBom, AppSceneCostMaterialBom.class, "app_scene_cost_material_bom");
-// }
-//
-// /**
-// * 通过excel导入数据
-// *
-// * @param request
-// * @param response
-// * @return
-// */
-// //@RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_material_bom:importExcel")
-// @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-// public Result> importExcel(HttpServletRequest request, HttpServletResponse response) {
-// return super.importExcel(request, response, AppSceneCostMaterialBom.class);
-// }
-
-}
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostMaterialProcessHoursController.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostMaterialProcessHoursController.java
deleted file mode 100644
index ea838e4..0000000
--- a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostMaterialProcessHoursController.java
+++ /dev/null
@@ -1,159 +0,0 @@
-package com.zzsmart.qomo.kn.cost.manage.controller;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostMaterialProcessHours;
-import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostMaterialProcessHoursService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
-import org.jeecg.common.api.vo.Result;
-import org.jeecg.common.aspect.annotation.AutoLog;
-import org.jeecg.common.system.base.controller.JeecgController;
-import org.jeecg.common.system.query.QueryGenerator;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.servlet.ModelAndView;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.util.Arrays;
-
-/**
- * @Description: app_scene_cost_material_process_hours
- * @Author: jeecg-boot
- * @Date: 2024-08-02
- * @Version: V1.0
- */
-@Api(tags = "cost-工序工时")
-@RestController
-@RequestMapping("//processHours")
-@Slf4j
-public class AppSceneCostMaterialProcessHoursController extends JeecgController {
- @Autowired
- private IAppSceneCostMaterialProcessHoursService appSceneCostMaterialProcessHoursService;
-
- /**
- * 分页列表查询
- *
- * @param appSceneCostMaterialProcessHours
- * @param pageNo
- * @param pageSize
- * @param req
- * @return
- */
- //@AutoLog(value = "app_scene_cost_material_process_hours-分页列表查询")
- @ApiOperation(value = "app_scene_cost_material_process_hours-分页列表查询", notes = "app_scene_cost_material_process_hours-分页列表查询")
- @GetMapping(value = "/list")
- public Result> queryPageList(AppSceneCostMaterialProcessHours appSceneCostMaterialProcessHours, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
- QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(appSceneCostMaterialProcessHours, req.getParameterMap());
- Page page = new Page(pageNo, pageSize);
- IPage pageList = appSceneCostMaterialProcessHoursService.page(page, queryWrapper);
- return Result.OK(pageList);
- }
-
- /**
- * 添加
- *
- * @param appSceneCostMaterialProcessHours
- * @return
- */
- @AutoLog(value = "app_scene_cost_material_process_hours-添加")
- @ApiOperation(value = "app_scene_cost_material_process_hours-添加", notes = "app_scene_cost_material_process_hours-添加")
- //@RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_material_process_hours:add")
- @PostMapping(value = "/add")
- public Result add(@RequestBody AppSceneCostMaterialProcessHours appSceneCostMaterialProcessHours) {
- appSceneCostMaterialProcessHoursService.save(appSceneCostMaterialProcessHours);
- return Result.OK("添加成功!");
- }
-
- /**
- * 编辑
- *
- * @param appSceneCostMaterialProcessHours
- * @return
- */
- @AutoLog(value = "app_scene_cost_material_process_hours-编辑")
- @ApiOperation(value = "app_scene_cost_material_process_hours-编辑", notes = "app_scene_cost_material_process_hours-编辑")
- //@RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_material_process_hours:edit")
- @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
- public Result edit(@RequestBody AppSceneCostMaterialProcessHours appSceneCostMaterialProcessHours) {
- appSceneCostMaterialProcessHoursService.updateById(appSceneCostMaterialProcessHours);
- return Result.OK("编辑成功!");
- }
-
- /**
- * 通过id删除
- *
- * @param id
- * @return
- */
- @AutoLog(value = "app_scene_cost_material_process_hours-通过id删除")
- @ApiOperation(value = "app_scene_cost_material_process_hours-通过id删除", notes = "app_scene_cost_material_process_hours-通过id删除")
- //@RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_material_process_hours:delete")
- @DeleteMapping(value = "/delete")
- public Result delete(@RequestParam(name = "id", required = true) String id) {
- appSceneCostMaterialProcessHoursService.removeById(id);
- return Result.OK("删除成功!");
- }
-
-// /**
-// * 批量删除
-// *
-// * @param ids
-// * @return
-// */
-// @AutoLog(value = "app_scene_cost_material_process_hours-批量删除")
-// @ApiOperation(value = "app_scene_cost_material_process_hours-批量删除", notes = "app_scene_cost_material_process_hours-批量删除")
-// //@RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_material_process_hours:deleteBatch")
-// @DeleteMapping(value = "/deleteBatch")
-// public Result deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-// this.appSceneCostMaterialProcessHoursService.removeByIds(Arrays.asList(ids.split(",")));
-// return Result.OK("批量删除成功!");
-// }
-
- /**
- * 通过id查询
- *
- * @param id
- * @return
- */
- //@AutoLog(value = "app_scene_cost_material_process_hours-通过id查询")
- @ApiOperation(value = "app_scene_cost_material_process_hours-通过id查询", notes = "app_scene_cost_material_process_hours-通过id查询")
- @GetMapping(value = "/queryById")
- public Result queryById(@RequestParam(name = "id", required = true) String id) {
- AppSceneCostMaterialProcessHours appSceneCostMaterialProcessHours = appSceneCostMaterialProcessHoursService.getById(id);
- if (appSceneCostMaterialProcessHours == null) {
- return Result.error("未找到对应数据");
- }
- return Result.OK(appSceneCostMaterialProcessHours);
- }
-
-// /**
-// * 导出excel
-// *
-// * @param request
-// * @param appSceneCostMaterialProcessHours
-// */
-// //@RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_material_process_hours:exportXls")
-// @RequestMapping(value = "/exportXls")
-// public ModelAndView exportXls(HttpServletRequest request, AppSceneCostMaterialProcessHours appSceneCostMaterialProcessHours) {
-// return super.exportXls(request, appSceneCostMaterialProcessHours, AppSceneCostMaterialProcessHours.class, "app_scene_cost_material_process_hours");
-// }
-
-// /**
-// * 通过excel导入数据
-// *
-// * @param request
-// * @param response
-// * @return
-// */
-// //@RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_material_process_hours:importExcel")
-// @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-// public Result> importExcel(HttpServletRequest request, HttpServletResponse response) {
-// return super.importExcel(request, response, AppSceneCostMaterialProcessHours.class);
-// }
-
-}
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostModelController.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostModelController.java
index fc5d5e4..1018688 100644
--- a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostModelController.java
+++ b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostModelController.java
@@ -5,12 +5,17 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zzsmart.qomo.dao.entity.FlowDefinition;
+import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostCount;
+import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostModel;
+import com.zzsmart.qomo.kn.cost.manage.enums.CostModelStatusEnum;
+import com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostCountMapper;
+import com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostModelMapper;
import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostModelService;
+import com.zzsmart.qomo.kn.cost.manage.vo.CostModelDefinitionVO;
import com.zzsmart.qomo.service.IDataFlowDefinitionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.query.QueryGenerator;
@@ -20,6 +25,7 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;
+import java.util.Random;
/**
* @Description: app_scene_cost_model
@@ -36,7 +42,10 @@ public class AppSceneCostModelController {
private IAppSceneCostModelService appSceneCostModelService;
@Autowired
private IDataFlowDefinitionService flowDefinitionService;
-
+ @Autowired
+ private AppSceneCostCountMapper appSceneCostCountMapper;
+ @Autowired
+ private AppSceneCostModelMapper costModelMapper;
/**
* 标准成本模型分页列表查询
*
@@ -71,17 +80,41 @@ public class AppSceneCostModelController {
/**
* 添加标准成本模型
*
- * @param flowDefinition
+ * @param modelDefinitionVO
* @return
*/
@AutoLog(value = "app_scene_cost_model-添加")
@ApiOperation(value = "app_scene_cost_model-添加", notes = "app_scene_cost_model-添加")
@PostMapping(value = "/add")
- public Result add(@RequestBody FlowDefinition flowDefinition) {
- flowDefinition.setCreateTime(new Date());
- flowDefinition.setUpdateTime(new Date());
- FlowDefinition definition = flowDefinitionService.add(flowDefinition);
- return Result.OK(definition);
+ public Result add(@RequestBody CostModelDefinitionVO modelDefinitionVO) {
+ try {
+ FlowDefinition flowDefinition = new FlowDefinition();
+ //TODO 新增平台层模型定义记录
+ String flowCode = "FLOW_" + System.currentTimeMillis() + new Random(10000).nextInt();
+ flowDefinition.setUpdateTime(new Date());
+ flowDefinition.setCreateTime(new Date());
+ flowDefinition.setCode(flowCode);
+ flowDefinition.setProjectId(modelDefinitionVO.getProjectId());
+ flowDefinition.setUserId("1744546658109349889");
+ flowDefinition.setUserName("系统管理员");
+ flowDefinition.setTenantId(-1);
+ flowDefinition.setEnvironmentId(1);
+ flowDefinition.setName(modelDefinitionVO.getModelName());
+ FlowDefinition definition = flowDefinitionService.add(flowDefinition);
+ AppSceneCostModel forecastModel = new AppSceneCostModel();
+ forecastModel.setModelType(modelDefinitionVO.getModelType());
+ forecastModel.setModelName(modelDefinitionVO.getModelName());
+ forecastModel.setStatus(CostModelStatusEnum.Draft.getCode());
+ //2.新模型记录
+ forecastModel.setFlowDefinitionId(definition.getId());
+ forecastModel.setUpdateTime(new Date());
+ forecastModel.setCreateTime(new Date());
+ costModelMapper.insert(forecastModel);
+
+ } catch (Exception e) {
+ return Result.error("新增失败");
+ }
+ return Result.OK("新增成功");
}
/**
@@ -108,6 +141,19 @@ public class AppSceneCostModelController {
@ApiOperation(value = "app_scene_cost_model-通过id删除", notes = "app_scene_cost_model-通过id删除")
@DeleteMapping(value = "/delete")
public Result delete(@RequestParam(name = "id", required = true) Integer id) {
+ //检查模型是否被引用或挂载
+ if (id != null) {
+ FlowDefinition flowDefinition = flowDefinitionService.getById(id);
+ if (flowDefinition != null) {
+ Integer id1 = flowDefinition.getId();
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("flow_definition_id", id1);
+ Long aLong = appSceneCostCountMapper.selectCount(queryWrapper);
+ if (aLong > 0) {
+ return Result.error("该模型正在被引用,无法删除!");
+ }
+ }
+ }
flowDefinitionService.delete(id);
return Result.OK("删除成功!");
}
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostProductProcessMaintenanceController.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostProductProcessMaintenanceController.java
new file mode 100644
index 0000000..8d64974
--- /dev/null
+++ b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostProductProcessMaintenanceController.java
@@ -0,0 +1,159 @@
+package com.zzsmart.qomo.kn.cost.manage.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostProductProcessMaintenance;
+import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostProductProcessMaintenanceService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.base.controller.JeecgController;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Arrays;
+
+/**
+ * @Description: app_scene_cost_product_process_maintenance
+ * @Author: jeecg-boot
+ * @Date: 2024-09-08
+ * @Version: V1.0
+ */
+//@Api(tags = "app_scene_cost_product_process_maintenance")
+@RestController
+@RequestMapping("//appSceneCostProductProcessMaintenance")
+@Slf4j
+public class AppSceneCostProductProcessMaintenanceController extends JeecgController {
+ @Autowired
+ private IAppSceneCostProductProcessMaintenanceService appSceneCostProductProcessMaintenanceService;
+
+ /**
+ * 分页列表查询
+ *
+ * @param appSceneCostProductProcessMaintenance
+ * @param pageNo
+ * @param pageSize
+ * @param req
+ * @return
+ */
+ //@AutoLog(value = "app_scene_cost_product_process_maintenance-分页列表查询")
+ @ApiOperation(value = "app_scene_cost_product_process_maintenance-分页列表查询", notes = "app_scene_cost_product_process_maintenance-分页列表查询")
+ @GetMapping(value = "/list")
+ public Result> queryPageList(AppSceneCostProductProcessMaintenance appSceneCostProductProcessMaintenance, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
+ QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(appSceneCostProductProcessMaintenance, req.getParameterMap());
+ Page page = new Page(pageNo, pageSize);
+ IPage pageList = appSceneCostProductProcessMaintenanceService.page(page, queryWrapper);
+ return Result.OK(pageList);
+ }
+
+ /**
+ * 添加
+ *
+ * @param appSceneCostProductProcessMaintenance
+ * @return
+ */
+ @AutoLog(value = "app_scene_cost_product_process_maintenance-添加")
+ @ApiOperation(value = "app_scene_cost_product_process_maintenance-添加", notes = "app_scene_cost_product_process_maintenance-添加")
+ @RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_product_process_maintenance:add")
+ @PostMapping(value = "/add")
+ public Result add(@RequestBody AppSceneCostProductProcessMaintenance appSceneCostProductProcessMaintenance) {
+ appSceneCostProductProcessMaintenanceService.save(appSceneCostProductProcessMaintenance);
+ return Result.OK("添加成功!");
+ }
+
+ /**
+ * 编辑
+ *
+ * @param appSceneCostProductProcessMaintenance
+ * @return
+ */
+ @AutoLog(value = "app_scene_cost_product_process_maintenance-编辑")
+ @ApiOperation(value = "app_scene_cost_product_process_maintenance-编辑", notes = "app_scene_cost_product_process_maintenance-编辑")
+ @RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_product_process_maintenance:edit")
+ @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
+ public Result edit(@RequestBody AppSceneCostProductProcessMaintenance appSceneCostProductProcessMaintenance) {
+ appSceneCostProductProcessMaintenanceService.updateById(appSceneCostProductProcessMaintenance);
+ return Result.OK("编辑成功!");
+ }
+
+ /**
+ * 通过id删除
+ *
+ * @param id
+ * @return
+ */
+ @AutoLog(value = "app_scene_cost_product_process_maintenance-通过id删除")
+ @ApiOperation(value = "app_scene_cost_product_process_maintenance-通过id删除", notes = "app_scene_cost_product_process_maintenance-通过id删除")
+ @RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_product_process_maintenance:delete")
+ @DeleteMapping(value = "/delete")
+ public Result delete(@RequestParam(name = "id", required = true) String id) {
+ appSceneCostProductProcessMaintenanceService.removeById(id);
+ return Result.OK("删除成功!");
+ }
+
+ /**
+ * 批量删除
+ *
+ * @param ids
+ * @return
+ */
+ @AutoLog(value = "app_scene_cost_product_process_maintenance-批量删除")
+ @ApiOperation(value = "app_scene_cost_product_process_maintenance-批量删除", notes = "app_scene_cost_product_process_maintenance-批量删除")
+ @RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_product_process_maintenance:deleteBatch")
+ @DeleteMapping(value = "/deleteBatch")
+ public Result deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+ this.appSceneCostProductProcessMaintenanceService.removeByIds(Arrays.asList(ids.split(",")));
+ return Result.OK("批量删除成功!");
+ }
+
+ /**
+ * 通过id查询
+ *
+ * @param id
+ * @return
+ */
+ //@AutoLog(value = "app_scene_cost_product_process_maintenance-通过id查询")
+ @ApiOperation(value = "app_scene_cost_product_process_maintenance-通过id查询", notes = "app_scene_cost_product_process_maintenance-通过id查询")
+ @GetMapping(value = "/queryById")
+ public Result queryById(@RequestParam(name = "id", required = true) String id) {
+ AppSceneCostProductProcessMaintenance appSceneCostProductProcessMaintenance = appSceneCostProductProcessMaintenanceService.getById(id);
+ if (appSceneCostProductProcessMaintenance == null) {
+ return Result.error("未找到对应数据");
+ }
+ return Result.OK(appSceneCostProductProcessMaintenance);
+ }
+
+ /**
+ * 导出excel
+ *
+ * @param request
+ * @param appSceneCostProductProcessMaintenance
+ */
+ @RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_product_process_maintenance:exportXls")
+ @RequestMapping(value = "/exportXls")
+ public ModelAndView exportXls(HttpServletRequest request, AppSceneCostProductProcessMaintenance appSceneCostProductProcessMaintenance) {
+ return super.exportXls(request, appSceneCostProductProcessMaintenance, AppSceneCostProductProcessMaintenance.class, "app_scene_cost_product_process_maintenance");
+ }
+
+ /**
+ * 通过excel导入数据
+ *
+ * @param request
+ * @param response
+ * @return
+ */
+ @RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_product_process_maintenance:importExcel")
+ @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+ public Result> importExcel(HttpServletRequest request, HttpServletResponse response) {
+ return super.importExcel(request, response, AppSceneCostProductProcessMaintenance.class);
+ }
+
+}
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostPurchasePriceController.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostPurchasePriceController.java
deleted file mode 100644
index 1bfe828..0000000
--- a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostPurchasePriceController.java
+++ /dev/null
@@ -1,159 +0,0 @@
-package com.zzsmart.qomo.kn.cost.manage.controller;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostPurchasePrice;
-import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostPurchasePriceService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
-import org.jeecg.common.api.vo.Result;
-import org.jeecg.common.aspect.annotation.AutoLog;
-import org.jeecg.common.system.base.controller.JeecgController;
-import org.jeecg.common.system.query.QueryGenerator;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.servlet.ModelAndView;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.util.Arrays;
-
-/**
- * @Description: app_scene_cost_purchase_price
- * @Author: jeecg-boot
- * @Date: 2024-08-02
- * @Version: V1.0
- */
-@Api(tags = "cost-采购价")
-@RestController
-@RequestMapping("//purchasePrice")
-@Slf4j
-public class AppSceneCostPurchasePriceController extends JeecgController {
- @Autowired
- private IAppSceneCostPurchasePriceService appSceneCostPurchasePriceService;
-
- /**
- * 分页列表查询
- *
- * @param appSceneCostPurchasePrice
- * @param pageNo
- * @param pageSize
- * @param req
- * @return
- */
- //@AutoLog(value = "app_scene_cost_purchase_price-分页列表查询")
- @ApiOperation(value = "app_scene_cost_purchase_price-分页列表查询", notes = "app_scene_cost_purchase_price-分页列表查询")
- @GetMapping(value = "/list")
- public Result> queryPageList(AppSceneCostPurchasePrice appSceneCostPurchasePrice, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
- QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(appSceneCostPurchasePrice, req.getParameterMap());
- Page page = new Page(pageNo, pageSize);
- IPage pageList = appSceneCostPurchasePriceService.page(page, queryWrapper);
- return Result.OK(pageList);
- }
-
- /**
- * 添加
- *
- * @param appSceneCostPurchasePrice
- * @return
- */
- @AutoLog(value = "app_scene_cost_purchase_price-添加")
- @ApiOperation(value = "app_scene_cost_purchase_price-添加", notes = "app_scene_cost_purchase_price-添加")
- //@RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_purchase_price:add")
- @PostMapping(value = "/add")
- public Result add(@RequestBody AppSceneCostPurchasePrice appSceneCostPurchasePrice) {
- appSceneCostPurchasePriceService.save(appSceneCostPurchasePrice);
- return Result.OK("添加成功!");
- }
-
- /**
- * 编辑
- *
- * @param appSceneCostPurchasePrice
- * @return
- */
- @AutoLog(value = "app_scene_cost_purchase_price-编辑")
- @ApiOperation(value = "app_scene_cost_purchase_price-编辑", notes = "app_scene_cost_purchase_price-编辑")
- //@RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_purchase_price:edit")
- @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
- public Result edit(@RequestBody AppSceneCostPurchasePrice appSceneCostPurchasePrice) {
- appSceneCostPurchasePriceService.updateById(appSceneCostPurchasePrice);
- return Result.OK("编辑成功!");
- }
-
- /**
- * 通过id删除
- *
- * @param id
- * @return
- */
- @AutoLog(value = "app_scene_cost_purchase_price-通过id删除")
- @ApiOperation(value = "app_scene_cost_purchase_price-通过id删除", notes = "app_scene_cost_purchase_price-通过id删除")
- //@RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_purchase_price:delete")
- @DeleteMapping(value = "/delete")
- public Result delete(@RequestParam(name = "id", required = true) String id) {
- appSceneCostPurchasePriceService.removeById(id);
- return Result.OK("删除成功!");
- }
-
- /**
- * 批量删除
- *
- * @param ids
- * @return
- */
- @AutoLog(value = "app_scene_cost_purchase_price-批量删除")
- @ApiOperation(value = "app_scene_cost_purchase_price-批量删除", notes = "app_scene_cost_purchase_price-批量删除")
- //@RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_purchase_price:deleteBatch")
- @DeleteMapping(value = "/deleteBatch")
- public Result deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
- this.appSceneCostPurchasePriceService.removeByIds(Arrays.asList(ids.split(",")));
- return Result.OK("批量删除成功!");
- }
-
- /**
- * 通过id查询
- *
- * @param id
- * @return
- */
- //@AutoLog(value = "app_scene_cost_purchase_price-通过id查询")
- @ApiOperation(value = "app_scene_cost_purchase_price-通过id查询", notes = "app_scene_cost_purchase_price-通过id查询")
- @GetMapping(value = "/queryById")
- public Result queryById(@RequestParam(name = "id", required = true) String id) {
- AppSceneCostPurchasePrice appSceneCostPurchasePrice = appSceneCostPurchasePriceService.getById(id);
- if (appSceneCostPurchasePrice == null) {
- return Result.error("未找到对应数据");
- }
- return Result.OK(appSceneCostPurchasePrice);
- }
-
- /**
- * 导出excel
- *
- * @param request
- * @param appSceneCostPurchasePrice
- */
- //@RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_purchase_price:exportXls")
- @RequestMapping(value = "/exportXls")
- public ModelAndView exportXls(HttpServletRequest request, AppSceneCostPurchasePrice appSceneCostPurchasePrice) {
- return super.exportXls(request, appSceneCostPurchasePrice, AppSceneCostPurchasePrice.class, "app_scene_cost_purchase_price");
- }
-
- /**
- * 通过excel导入数据
- *
- * @param request
- * @param response
- * @return
- */
- //@RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_purchase_price:importExcel")
- @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
- public Result> importExcel(HttpServletRequest request, HttpServletResponse response) {
- return super.importExcel(request, response, AppSceneCostPurchasePrice.class);
- }
-
-}
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostPurchaseRecordController.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostPurchaseRecordController.java
new file mode 100644
index 0000000..03d8c1c
--- /dev/null
+++ b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostPurchaseRecordController.java
@@ -0,0 +1,159 @@
+package com.zzsmart.qomo.kn.cost.manage.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostPurchaseRecord;
+import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostPurchaseRecordService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.base.controller.JeecgController;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Arrays;
+
+/**
+ * @Description: app_scene_cost_purchase_record
+ * @Author: jeecg-boot
+ * @Date: 2024-09-08
+ * @Version: V1.0
+ */
+//@Api(tags = "app_scene_cost_purchase_record")
+@RestController
+@RequestMapping("//appSceneCostPurchaseRecord")
+@Slf4j
+public class AppSceneCostPurchaseRecordController extends JeecgController {
+ @Autowired
+ private IAppSceneCostPurchaseRecordService appSceneCostPurchaseRecordService;
+
+ /**
+ * 分页列表查询
+ *
+ * @param appSceneCostPurchaseRecord
+ * @param pageNo
+ * @param pageSize
+ * @param req
+ * @return
+ */
+ //@AutoLog(value = "app_scene_cost_purchase_record-分页列表查询")
+ @ApiOperation(value = "app_scene_cost_purchase_record-分页列表查询", notes = "app_scene_cost_purchase_record-分页列表查询")
+ @GetMapping(value = "/list")
+ public Result> queryPageList(AppSceneCostPurchaseRecord appSceneCostPurchaseRecord, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
+ QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(appSceneCostPurchaseRecord, req.getParameterMap());
+ Page page = new Page(pageNo, pageSize);
+ IPage pageList = appSceneCostPurchaseRecordService.page(page, queryWrapper);
+ return Result.OK(pageList);
+ }
+
+ /**
+ * 添加
+ *
+ * @param appSceneCostPurchaseRecord
+ * @return
+ */
+ @AutoLog(value = "app_scene_cost_purchase_record-添加")
+ @ApiOperation(value = "app_scene_cost_purchase_record-添加", notes = "app_scene_cost_purchase_record-添加")
+ @RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_purchase_record:add")
+ @PostMapping(value = "/add")
+ public Result add(@RequestBody AppSceneCostPurchaseRecord appSceneCostPurchaseRecord) {
+ appSceneCostPurchaseRecordService.save(appSceneCostPurchaseRecord);
+ return Result.OK("添加成功!");
+ }
+
+ /**
+ * 编辑
+ *
+ * @param appSceneCostPurchaseRecord
+ * @return
+ */
+ @AutoLog(value = "app_scene_cost_purchase_record-编辑")
+ @ApiOperation(value = "app_scene_cost_purchase_record-编辑", notes = "app_scene_cost_purchase_record-编辑")
+ @RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_purchase_record:edit")
+ @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
+ public Result edit(@RequestBody AppSceneCostPurchaseRecord appSceneCostPurchaseRecord) {
+ appSceneCostPurchaseRecordService.updateById(appSceneCostPurchaseRecord);
+ return Result.OK("编辑成功!");
+ }
+
+ /**
+ * 通过id删除
+ *
+ * @param id
+ * @return
+ */
+ @AutoLog(value = "app_scene_cost_purchase_record-通过id删除")
+ @ApiOperation(value = "app_scene_cost_purchase_record-通过id删除", notes = "app_scene_cost_purchase_record-通过id删除")
+ @RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_purchase_record:delete")
+ @DeleteMapping(value = "/delete")
+ public Result delete(@RequestParam(name = "id", required = true) String id) {
+ appSceneCostPurchaseRecordService.removeById(id);
+ return Result.OK("删除成功!");
+ }
+
+ /**
+ * 批量删除
+ *
+ * @param ids
+ * @return
+ */
+ @AutoLog(value = "app_scene_cost_purchase_record-批量删除")
+ @ApiOperation(value = "app_scene_cost_purchase_record-批量删除", notes = "app_scene_cost_purchase_record-批量删除")
+ @RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_purchase_record:deleteBatch")
+ @DeleteMapping(value = "/deleteBatch")
+ public Result deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+ this.appSceneCostPurchaseRecordService.removeByIds(Arrays.asList(ids.split(",")));
+ return Result.OK("批量删除成功!");
+ }
+
+ /**
+ * 通过id查询
+ *
+ * @param id
+ * @return
+ */
+ //@AutoLog(value = "app_scene_cost_purchase_record-通过id查询")
+ @ApiOperation(value = "app_scene_cost_purchase_record-通过id查询", notes = "app_scene_cost_purchase_record-通过id查询")
+ @GetMapping(value = "/queryById")
+ public Result queryById(@RequestParam(name = "id", required = true) String id) {
+ AppSceneCostPurchaseRecord appSceneCostPurchaseRecord = appSceneCostPurchaseRecordService.getById(id);
+ if (appSceneCostPurchaseRecord == null) {
+ return Result.error("未找到对应数据");
+ }
+ return Result.OK(appSceneCostPurchaseRecord);
+ }
+
+ /**
+ * 导出excel
+ *
+ * @param request
+ * @param appSceneCostPurchaseRecord
+ */
+ @RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_purchase_record:exportXls")
+ @RequestMapping(value = "/exportXls")
+ public ModelAndView exportXls(HttpServletRequest request, AppSceneCostPurchaseRecord appSceneCostPurchaseRecord) {
+ return super.exportXls(request, appSceneCostPurchaseRecord, AppSceneCostPurchaseRecord.class, "app_scene_cost_purchase_record");
+ }
+
+ /**
+ * 通过excel导入数据
+ *
+ * @param request
+ * @param response
+ * @return
+ */
+ @RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_purchase_record:importExcel")
+ @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+ public Result> importExcel(HttpServletRequest request, HttpServletResponse response) {
+ return super.importExcel(request, response, AppSceneCostPurchaseRecord.class);
+ }
+
+}
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostStandardDetailController.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostStandardResultController.java
similarity index 62%
rename from qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostStandardDetailController.java
rename to qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostStandardResultController.java
index b8baada..f8b5a2c 100644
--- a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostStandardDetailController.java
+++ b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostStandardResultController.java
@@ -4,14 +4,16 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostStandardDetail;
-import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostStandardDetailService;
+import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostStandardResult;
+import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostStandardResultService;
+import com.zzsmart.qomo.kn.cost.manage.vo.AppSceneCostStandardResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
+import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -20,6 +22,8 @@ import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
+import java.util.List;
/**
* @Description: app_scene_cost_standard_detail
@@ -31,14 +35,14 @@ import javax.servlet.http.HttpServletRequest;
@RestController
@RequestMapping("//costStandardDetail")
@Slf4j
-public class AppSceneCostStandardDetailController extends JeecgController {
+public class AppSceneCostStandardResultController extends JeecgController {
@Autowired
- private IAppSceneCostStandardDetailService appSceneCostStandardDetailService;
+ private IAppSceneCostStandardResultService appSceneCostStandardResultService;
/**
* 分页列表查询
*
- * @param appSceneCostStandardDetail
+ * @param appSceneCostStandardResult
* @param pageNo
* @param pageSize
* @param req
@@ -47,11 +51,47 @@ public class AppSceneCostStandardDetailController extends JeecgController> queryPageList(AppSceneCostStandardDetail appSceneCostStandardDetail, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
- QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(appSceneCostStandardDetail, req.getParameterMap());
- Page page = new Page(pageNo, pageSize);
- IPage pageList = appSceneCostStandardDetailService.page(page, queryWrapper);
- return Result.OK(pageList);
+ public Result> queryPageList(AppSceneCostStandardResult appSceneCostStandardResult, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
+ QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(appSceneCostStandardResult, req.getParameterMap());
+ Page page = new Page(pageNo, pageSize);
+ IPage pageList = appSceneCostStandardResultService.page(page, queryWrapper);
+ IPage newpageList = new Page<>();
+ BeanUtils.copyProperties(pageList, newpageList);
+ List list = pageList.getRecords();
+ List newList = new ArrayList<>();
+ for (int i = 0; i < list.size(); i++) {
+ AppSceneCostStandardResult result = list.get(i);
+ AppSceneCostStandardResultVO costStandardDetail = AppSceneCostStandardResultVO.builder()
+ .materialNumber(result.getMaterialNumber())
+// .materialName(oldAppSceneCostResultValue.getMarterialNo())
+ .parentMaterialNumber(result.getParentMatnr())
+ .versionNumber(result.getVersionNumber())
+// .level()
+// .sort()
+// .figureNumber()
+// .dosage(oldAppSceneCostResultValue.getNum() != null ? new Double(oldAppSceneCostResultValue.getNum()) : 0)
+// .unit(oldAppSceneCostResultValue.getUnit())
+ .materialCost(result.getMaterialCostStage())
+ .laborCost(result.getLaborCostStage())
+ .equipmentCost(result.getEquipCostStage())
+ .supplyMaterialCost(result.getAuxiliaryCostStage())
+ .driveCost(result.getBurningCostStage())
+ .logisticsCost(result.getStageLogisticsCost())
+ .otherCost(result.getOtherCostStage())
+ .currentStandardCost(result.getTotalStandardCostInter())
+ .totalMaterialCost(result.getMaterialCostAccumulated())
+ .totalLaborCost(result.getLaborCostAccumulated())
+ .totalEquipmentCost(result.getEquipCostAccumulated())
+ .totalSupplyMaterialCost(result.getAuxiliaryCostAccumulated())
+ .totalDriveCost(result.getBurningCostAccumulated())
+ .totalLogisticsCost(result.getTotalLogisticsCost())
+ .totalOtherCost(result.getOtherCostAccumulated())
+ .totalStandardCost(result.getTotalStandardCost())
+ .createTime(result.getCreatedTime()).build();
+ newList.add(costStandardDetail);
+ }
+ newpageList.setRecords(newList);
+ return Result.OK(newpageList);
}
//
// /**
@@ -138,10 +178,10 @@ public class AppSceneCostStandardDetailController extends JeecgController {
+ @Select("WITH RECURSIVE BOM_Tree AS (\n" +
+ " SELECT matnr, idnrk, meins, 0 AS depth\n" +
+ " FROM app_scene_cost_bom_relevancy\n" +
+ " WHERE matnr = #{parentId}\n" +
+ " UNION ALL\n" +
+ " SELECT b.matnr, b.idnrk, b.meins, BOM_Tree.depth + 1\n" +
+ " FROM app_scene_cost_bom_relevancy b\n" +
+ " JOIN BOM_Tree ON b.matnr = BOM_Tree.idnrk\n" +
+ ")\n" +
+ "SELECT matnr, idnrk, meins, depth FROM BOM_Tree")
+ List findChildrenByParentId(String parentId);
+
+
+ @Select("${selectSql}")
+ JSONObject customSelectOne(@Param("selectSql") String selectSql);
+
+ @Select("${SelectBlobModel}")
+ String customSelectBlobModelJson(@Param("SelectBlobModel") String SelectBlobModel);
+
+
+}
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/AppSceneCostHourRateMapper.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/AppSceneCostHourRateMapper.java
index 97b285d..469d9a0 100644
--- a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/AppSceneCostHourRateMapper.java
+++ b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/AppSceneCostHourRateMapper.java
@@ -1,7 +1,10 @@
package com.zzsmart.qomo.kn.cost.manage.mapper;
+import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostHourRate;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
/**
* @Description: app_scene_cost_hour_rate
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/AppSceneCostMaterialBomMapper.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/AppSceneCostMaterialBomMapper.java
deleted file mode 100644
index 2de786a..0000000
--- a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/AppSceneCostMaterialBomMapper.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.zzsmart.qomo.kn.cost.manage.mapper;
-
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostMaterialBom;
-import org.apache.ibatis.annotations.Param;
-import org.apache.ibatis.annotations.Select;
-
-import java.util.List;
-
-/**
- * @Description: app_scene_cost_material_bom
- * @Author: jeecg-boot
- * @Date: 2024-08-02
- * @Version: V1.0
- */
-public interface AppSceneCostMaterialBomMapper extends BaseMapper {
- /**
- * 根据动态SQL语句查询物料BOM表
- *
- * @param selectCommand
- * @return
- */
- @Select("${selectCommand}")
- List customSelect(@Param("selectCommand") String selectCommand);
-
-
- @Select("${selectSql}")
- JSONObject customSelectOne(@Param("selectSql") String selectSql);
-
- @Select("${SelectBlobModel}")
- String customSelectBlobModelJson(@Param("SelectBlobModel") String SelectBlobModel);
-
-}
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/AppSceneCostMaterialProcessHoursMapper.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/AppSceneCostMaterialProcessHoursMapper.java
deleted file mode 100644
index cc08037..0000000
--- a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/AppSceneCostMaterialProcessHoursMapper.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.zzsmart.qomo.kn.cost.manage.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostMaterialProcessHours;
-
-/**
- * @Description: app_scene_cost_material_process_hours
- * @Author: jeecg-boot
- * @Date: 2024-08-02
- * @Version: V1.0
- */
-public interface AppSceneCostMaterialProcessHoursMapper extends BaseMapper {
-
-}
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/AppSceneCostProductProcessMaintenanceMapper.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/AppSceneCostProductProcessMaintenanceMapper.java
new file mode 100644
index 0000000..7c75270
--- /dev/null
+++ b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/AppSceneCostProductProcessMaintenanceMapper.java
@@ -0,0 +1,17 @@
+package com.zzsmart.qomo.kn.cost.manage.mapper;
+
+import java.util.List;
+
+import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostProductProcessMaintenance;
+import org.apache.ibatis.annotations.Param;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * @Description: app_scene_cost_product_process_maintenance
+ * @Author: jeecg-boot
+ * @Date: 2024-09-08
+ * @Version: V1.0
+ */
+public interface AppSceneCostProductProcessMaintenanceMapper extends BaseMapper {
+
+}
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/AppSceneCostPurchasePriceMapper.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/AppSceneCostPurchaseRecordMapper.java
similarity index 55%
rename from qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/AppSceneCostPurchasePriceMapper.java
rename to qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/AppSceneCostPurchaseRecordMapper.java
index 6914312..d78e4ea 100644
--- a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/AppSceneCostPurchasePriceMapper.java
+++ b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/AppSceneCostPurchaseRecordMapper.java
@@ -1,14 +1,15 @@
package com.zzsmart.qomo.kn.cost.manage.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostPurchasePrice;
+import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostPurchaseRecord;
+
/**
- * @Description: app_scene_cost_purchase_price
+ * @Description: app_scene_cost_purchase_record
* @Author: jeecg-boot
- * @Date: 2024-08-02
+ * @Date: 2024-09-08
* @Version: V1.0
*/
-public interface AppSceneCostPurchasePriceMapper extends BaseMapper {
+public interface AppSceneCostPurchaseRecordMapper extends BaseMapper {
}
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/AppSceneCostStandardResultMapper.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/AppSceneCostStandardResultMapper.java
new file mode 100644
index 0000000..ddfeca6
--- /dev/null
+++ b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/AppSceneCostStandardResultMapper.java
@@ -0,0 +1,15 @@
+package com.zzsmart.qomo.kn.cost.manage.mapper;
+
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostStandardResult;
+
+/**
+ * @Description: app_scene_cost_standard_detail
+ * @Author: jeecg-boot
+ * @Date: 2024-07-31
+ * @Version: V1.0
+ */
+public interface AppSceneCostStandardResultMapper extends BaseMapper {
+
+}
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/AppSceneCostStandardVersionMapper.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/AppSceneCostStandardVersionMapper.java
index e25bd53..6489601 100644
--- a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/AppSceneCostStandardVersionMapper.java
+++ b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/AppSceneCostStandardVersionMapper.java
@@ -1,15 +1,13 @@
package com.zzsmart.qomo.kn.cost.manage.mapper;
-import java.util.List;
-import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostStandardVersion;
-import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostStandardVersion;
/**
* @Description: app_scene_cost_standard_version
* @Author: jeecg-boot
- * @Date: 2024-08-02
+ * @Date: 2024-09-08
* @Version: V1.0
*/
public interface AppSceneCostStandardVersionMapper extends BaseMapper {
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/xml/AppSceneCostMaterialBomMapper.xml b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/xml/AppSceneCostBomRelevancyMapper.xml
similarity index 89%
rename from qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/xml/AppSceneCostMaterialBomMapper.xml
rename to qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/xml/AppSceneCostBomRelevancyMapper.xml
index 23d4a07..5d21763 100644
--- a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/xml/AppSceneCostMaterialBomMapper.xml
+++ b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/xml/AppSceneCostBomRelevancyMapper.xml
@@ -1,5 +1,5 @@
-
+
\ No newline at end of file
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/xml/AppSceneCostProductProcessMaintenanceMapper.xml b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/xml/AppSceneCostProductProcessMaintenanceMapper.xml
new file mode 100644
index 0000000..997c398
--- /dev/null
+++ b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/xml/AppSceneCostProductProcessMaintenanceMapper.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/xml/AppSceneCostPurchasePriceMapper.xml b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/xml/AppSceneCostPurchaseRecordMapper.xml
similarity index 88%
rename from qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/xml/AppSceneCostPurchasePriceMapper.xml
rename to qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/xml/AppSceneCostPurchaseRecordMapper.xml
index 6571f46..52fce70 100644
--- a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/xml/AppSceneCostPurchasePriceMapper.xml
+++ b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/xml/AppSceneCostPurchaseRecordMapper.xml
@@ -1,5 +1,5 @@
-
+
\ No newline at end of file
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/xml/AppSceneCostMaterialProcessHoursMapper.xml b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/xml/AppSceneCostStandardResultMapper.xml
similarity index 86%
rename from qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/xml/AppSceneCostMaterialProcessHoursMapper.xml
rename to qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/xml/AppSceneCostStandardResultMapper.xml
index f86ee8c..5d66ca3 100644
--- a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/xml/AppSceneCostMaterialProcessHoursMapper.xml
+++ b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/xml/AppSceneCostStandardResultMapper.xml
@@ -1,5 +1,5 @@
-
+
\ No newline at end of file
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/plugin/StandardCostService.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/plugin/StandardCostService.java
index 33673e8..eeb35e2 100644
--- a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/plugin/StandardCostService.java
+++ b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/plugin/StandardCostService.java
@@ -6,7 +6,7 @@ import com.zzsmart.qomo.kn.cost.manage.entity.*;
import com.zzsmart.qomo.kn.cost.manage.enums.FeeTypeEnum;
import com.zzsmart.qomo.kn.cost.manage.enums.HourOrRateTypeEnum;
import com.zzsmart.qomo.kn.cost.manage.enums.TotalCostEnum;
-import com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostMaterialBomMapper;
+import com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostBomRelevancyMapper;
import com.zzsmart.qomo.kn.cost.manage.service.*;
import com.zzsmart.qomo.kn.cost.manage.vo.FlowTaskInfoVO;
import com.zzsmart.qomo.kn.cost.manage.vo.TotalResultValue;
@@ -32,9 +32,9 @@ public class StandardCostService {
* 物料BOM信息
*/
@Autowired
- AppSceneCostMaterialBomMapper costMaterialBomMapper;
+ AppSceneCostBomRelevancyMapper appSceneCostBomRelevancyMapper;
@Autowired
- IAppSceneCostMaterialBomService costMaterialBomService;
+ IAppSceneCostBomRelevancyService costMaterialBomService;
/**
* 小时费率
@@ -45,12 +45,12 @@ public class StandardCostService {
* 采购单价
*/
@Autowired
- IAppSceneCostPurchasePriceService costPurchasePriceService;
+ IAppSceneCostPurchaseRecordService costPurchaseRecordService;
/**
* 工序
*/
@Autowired
- IAppSceneCostMaterialProcessHoursService costMaterialProcessHoursService;
+ IAppSceneCostProductProcessMaintenanceService costMaterialProcessHoursService;
/**
* 标准成本计算结果
*/
@@ -69,19 +69,19 @@ public class StandardCostService {
* 标准成本明细服务(单行查询服务)
*/
@Autowired
- private IAppSceneCostStandardDetailService iAppSceneCostStandardDetailService;
+ private IAppSceneCostStandardResultService iAppSceneCostStandardResultService;
@PostConstruct
public void init() {
standardCostService = this;
- standardCostService.costMaterialBomMapper = this.costMaterialBomMapper;
+ standardCostService.appSceneCostBomRelevancyMapper = this.appSceneCostBomRelevancyMapper;
standardCostService.appSceneCostCountService = this.appSceneCostCountService;
standardCostService.costMaterialBomService = this.costMaterialBomService;
- standardCostService.costPurchasePriceService = this.costPurchasePriceService;
+ standardCostService.costPurchaseRecordService = this.costPurchaseRecordService;
standardCostService.iHourRateService = this.iHourRateService;
standardCostService.costMaterialProcessHoursService = this.costMaterialProcessHoursService;
standardCostService.iAppSceneCostResultValueService = this.iAppSceneCostResultValueService;
- standardCostService.iAppSceneCostStandardDetailService = this.iAppSceneCostStandardDetailService;
+ standardCostService.iAppSceneCostStandardResultService = this.iAppSceneCostStandardResultService;
}
/**
@@ -110,20 +110,400 @@ public class StandardCostService {
//1.查询出所有满足物料编号的物料(BOM物料)
String sql = flowTaskInfoVO.getSqlString();
log.info("传递过来的SQL语句:" + sql);
- //TODO 查询最顶部的BOM物料编号下所有的物料并进行层级排序
- List list = standardCostService.costMaterialBomService.queryAllBomInfoBytopMaterialCode(topMaterialCode);
- log.info("Full EmptyTask list: {}", list);
- //2.把查询的结果存放在临时表里(表命名规则:前缀_流程id_组件code)
- for (int i = 0; list != null && i < list.size(); i++) {
- AppSceneCostMaterialBom material = list.get(i);
- AppSceneCostResultValue appSceneCostResultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(material.getMaterialCode()).parentMarterialNo(material.getParentMaterialCode()).taskType(taskType).taskCode(taskCode).flowInstanceId(flowInstanceId).num(material.getNumber()).build();
- standardCostService.iAppSceneCostResultValueService.save(appSceneCostResultValue);
- }
+ //获取顶部物料下所有的物料信息并存储到新的表中
+ getAllMaterialBomInfoByTopMaterialCode(topMaterialCode, taskType, taskCode, flowInstanceId != null ? Integer.valueOf(flowInstanceId) : null);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
+ /**
+ * 【1.成本参数查询】查询最顶部的BOM物料编号下所有的物料并进行层级排序
+ * * 获取顶部物料下所有的物料信息并存储到新的表中
+ *
+ * @param topMaterialCode 顶部物料编号
+ * @param taskType 任务类型
+ * @param taskCode 任务编号
+ * @param flowInstanceId 流程实例id
+ */
+ public static void getAllMaterialBomInfoByTopMaterialCode(String topMaterialCode, String taskType, String taskCode, Integer flowInstanceId) {
+ List list = standardCostService.costMaterialBomService.queryAllBomInfoByTopMaterialCode(topMaterialCode);
+ log.info("Full ParamTask list: {}", list);
+ //TODO material.getMeins()领用量??为什么是ST字母
+ for (int i = 0; list != null && i < list.size(); i++) {
+ AppSceneCostBomRelevancy material = list.get(i);
+ //TODO 物料领用数据
+ BigDecimal num1 = BigDecimal.ONE;
+ AppSceneCostResultValue appSceneCostResultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(material.getIdnrk()).parentMarterialNo(material.getMatnr()).taskType(taskType).taskCode(taskCode).flowInstanceId(flowInstanceId).num(num1).build();
+ standardCostService.iAppSceneCostResultValueService.save(appSceneCostResultValue);
+ }
+ }
+
+ /**
+ * 【2.物料成本计算】计算物料成本
+ *
+ * @param topMaterialCode 顶部物料编号
+ * @param taskType 任务类型
+ * @param taskCode 任务编号
+ * @param flowInstanceId 流程实例id
+ */
+ public static void countMaterialCostByTopMaterialCode(String topMaterialCode, String taskType, String taskCode, Integer flowInstanceId, String feeType) {
+ //1.查询出物料编号对应的下所有的BOM信息
+ List list = standardCostService.iAppSceneCostResultValueService.getResultValueByTopMaterialNo(topMaterialCode, "MaterialInput", String.valueOf(flowInstanceId));
+ //2.计算出所有的单个物料的物料成本
+ //2.1查询出物料的单价和采购数量
+ List MarterialNoList = new ArrayList<>();
+ if (list != null && list.size() > 0) {
+ MarterialNoList = list.stream().filter(s -> s.getMarterialNo() != null).map(AppSceneCostResultValue::getMarterialNo).collect(Collectors.toList());
+ }
+ //查询物料的采购价
+ Map purchasePriceMap = standardCostService.costPurchaseRecordService.getMinCostPurchasePriceByMaterialNo(MarterialNoList);
+ for (int i = 0; i < list.size(); i++) {
+ AppSceneCostResultValue appSceneCostResultValue = list.get(i);
+ String marterialNo = appSceneCostResultValue.getMarterialNo();
+ BigDecimal num = appSceneCostResultValue.getNum();
+ if (marterialNo != null && num != null && (new BigDecimal(num.toString()).compareTo(BigDecimal.ZERO)) != 0) {
+ BigDecimal price = purchasePriceMap.get(marterialNo);
+ if (price == null) {
+ price = BigDecimal.ZERO;
+ }
+ BigDecimal number = new BigDecimal(num.toString());
+ //单价乘以数量
+ BigDecimal totalCost = price.multiply(number);
+ //2.2计算出人工成本并存储到成本结果数据表中
+ AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(marterialNo).parentMarterialNo(appSceneCostResultValue.getParentMarterialNo()).taskType(taskType).costType(feeType).taskCode(taskCode).flowInstanceId(flowInstanceId).countValue(totalCost + "").priceOrRate(price).num(num).build();
+ standardCostService.iAppSceneCostResultValueService.save(resultValue);
+ }
+ }
+ }
+
+ /**
+ * 【3.人工成本计算】
+ *
+ * @param topMaterialCode 顶部物料编号
+ * @param taskType 任务类型
+ * @param taskCode 任务编号
+ * @param flowInstanceId 流程实例id
+ */
+ public static void countLaborCostByTopMaterialCode(String topMaterialCode, String taskType, String taskCode, Integer flowInstanceId, String feeType, AppSceneCostHourRate appSceneCostHourRate) {
+ //1.查询出人员工时费率
+ AppSceneCostHourRate hourRateInfo = standardCostService.iHourRateService.getOneHourRateInfo(appSceneCostHourRate);
+ BigDecimal hourRate = new BigDecimal("0");
+ if (hourRateInfo != null) {
+ hourRate = hourRateInfo.getLaborHourRate();
+ }
+ //1.查询出物料编号对应的下所有的BOM信息
+ List list = standardCostService.iAppSceneCostResultValueService.getResultValueByTopMaterialNo(topMaterialCode, "MaterialInput", String.valueOf(flowInstanceId));
+ //2.计算出所有的单个物料的人工成本
+ //2.1查询出物料的人员工时和人工小时费率(涉及:小时费率表和工序表)
+ List MarterialNoList = new ArrayList<>();
+ if (list != null && list.size() > 0) {
+ MarterialNoList = list.stream().filter(s -> s.getMarterialNo() != null).map(AppSceneCostResultValue::getMarterialNo).collect(Collectors.toList());
+ }
+ //查询工序工时
+ Map> processHoursMap = standardCostService.costMaterialProcessHoursService.getProcessHoursByMaterialNo(MarterialNoList);
+ for (int i = 0; i < list.size(); i++) {
+ AppSceneCostResultValue appSceneCostResultValue = list.get(i);
+ String marterialNo = appSceneCostResultValue.getMarterialNo();
+ if (marterialNo != null) {
+ BigDecimal totalCost = new BigDecimal("0.0");
+ BigDecimal laborHours = new BigDecimal("0.0");
+ List costMaterialProcessHours = processHoursMap.get(marterialNo);
+ if (costMaterialProcessHours != null && costMaterialProcessHours.size() > 0) {
+ for (int j = 0; j < costMaterialProcessHours.size(); j++) {
+ AppSceneCostProductProcessMaintenance processHours = costMaterialProcessHours.get(j);
+ laborHours = laborHours.add(processHours.getLaborHour());
+ //计算总人工成本
+ totalCost = totalCost.add(processHours.getLaborHour().multiply(hourRate));
+ }
+ }
+ //2.2计算出人工成本并存储到成本结果数据表中
+ AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(marterialNo).parentMarterialNo(appSceneCostResultValue.getParentMarterialNo()).taskType(taskType).taskCode(taskCode).flowInstanceId(Integer.valueOf(flowInstanceId)).countValue(totalCost + "").costType(feeType).priceOrRate(hourRate).hour(laborHours).build();
+ standardCostService.iAppSceneCostResultValueService.save(resultValue);
+ }
+ }
+ }
+
+ /**
+ * 【4.制造费用】
+ *
+ * @param topMaterialCode 顶部物料编号
+ * @param taskType 任务类型
+ * @param taskCode 任务编号
+ * @param flowInstanceId 流程实例id
+ */
+ public static void countManufacturingCostByTopMaterialCode(String topMaterialCode, String taskType, String taskCode, Integer flowInstanceId, String feeType, AppSceneCostHourRate appSceneCostHourRate) {
+ //1.查询出人员工时费率
+ AppSceneCostHourRate hourRateInfo = standardCostService.iHourRateService.getOneHourRateInfo(appSceneCostHourRate);
+ BigDecimal hourRate = new BigDecimal("0");
+ if (hourRateInfo != null) {
+ hourRate = hourRateInfo.getLaborHourRate();
+ }
+ //1.查询出物料编号对应的下所有的BOM信息
+ List list = standardCostService.iAppSceneCostResultValueService.getResultValueByTopMaterialNo(topMaterialCode, "MaterialInput", String.valueOf(flowInstanceId));
+ //2.根据费用类型进行不同的费用计算
+ //查询工序工时
+ List MarterialNoList = new ArrayList<>();
+ if (list != null && list.size() > 0) {
+ MarterialNoList = list.stream().filter(s -> s.getMarterialNo() != null).map(AppSceneCostResultValue::getMarterialNo).collect(Collectors.toList());
+ }
+ Map> processHoursMap = standardCostService.costMaterialProcessHoursService.getProcessHoursByMaterialNo(MarterialNoList);
+ //2.1机器折旧费(机器工时*费率)
+ if (FeeTypeEnum.EquipmentFee.getCode().equals(feeType)) {
+ for (int i = 0; i < list.size(); i++) {
+ AppSceneCostResultValue appSceneCostResultValue = list.get(i);
+ String marterialNo = appSceneCostResultValue.getMarterialNo();
+ if (marterialNo != null) {
+ BigDecimal totalCost = new BigDecimal("0.0");
+ BigDecimal laborHours = new BigDecimal("0.0");
+ List costMaterialProcessHours = processHoursMap.get(marterialNo);
+ if (costMaterialProcessHours != null && costMaterialProcessHours.size() > 0) {
+ for (int j = 0; j < costMaterialProcessHours.size(); j++) {
+ AppSceneCostProductProcessMaintenance processHours = costMaterialProcessHours.get(j);
+ laborHours = laborHours.add(processHours.getMachineHour());
+ //计算机器成本
+ totalCost = totalCost.add(processHours.getMachineHour().multiply(hourRate));
+ }
+ }
+ //2.2计算机器成本并存储到成本结果数据表中
+ AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(marterialNo).parentMarterialNo(appSceneCostResultValue.getParentMarterialNo()).taskType(taskType).taskCode(taskCode).flowInstanceId(Integer.valueOf(flowInstanceId)).countValue(totalCost + "").costType(feeType).priceOrRate(hourRate).hour(laborHours).build();
+ standardCostService.iAppSceneCostResultValueService.save(resultValue);
+ }
+ }
+ } else if (FeeTypeEnum.SupplyMaterialFee.getCode().equals(feeType)) {
+ //机物料消耗(辅料工时*费率)
+ for (int i = 0; i < list.size(); i++) {
+ AppSceneCostResultValue appSceneCostResultValue = list.get(i);
+ String marterialNo = appSceneCostResultValue.getMarterialNo();
+ if (marterialNo != null) {
+ BigDecimal totalCost = new BigDecimal("0.0");
+ BigDecimal laborHours = new BigDecimal("0.0");
+ List costMaterialProcessHours = processHoursMap.get(marterialNo);
+ if (costMaterialProcessHours != null && costMaterialProcessHours.size() > 0) {
+ for (int j = 0; j < costMaterialProcessHours.size(); j++) {
+ AppSceneCostProductProcessMaintenance processHours = costMaterialProcessHours.get(j);
+ //辅料工时
+ laborHours = laborHours.add(processHours.getAuxiliaryHour());
+ //机物料消耗
+ totalCost = totalCost.add(processHours.getAuxiliaryHour().multiply(hourRate));
+ }
+ }
+ //2.2计算机物料消耗存储到成本结果数据表中
+ AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(marterialNo).parentMarterialNo(appSceneCostResultValue.getParentMarterialNo()).taskType(taskType).taskCode(taskCode).flowInstanceId(Integer.valueOf(flowInstanceId)).countValue(totalCost + "").costType(feeType).priceOrRate(hourRate).hour(laborHours).build();
+ standardCostService.iAppSceneCostResultValueService.save(resultValue);
+ }
+ }
+ } else if (FeeTypeEnum.DriverFee.getCode().equals(feeType)) {
+ //2.3水电费(燃动力工时*费率)
+ for (int i = 0; i < list.size(); i++) {
+ AppSceneCostResultValue appSceneCostResultValue = list.get(i);
+ String marterialNo = appSceneCostResultValue.getMarterialNo();
+ if (marterialNo != null) {
+ BigDecimal totalCost = new BigDecimal("0.0");
+ BigDecimal laborHours = new BigDecimal("0.0");
+ List costMaterialProcessHours = processHoursMap.get(marterialNo);
+ if (costMaterialProcessHours != null && costMaterialProcessHours.size() > 0) {
+ for (int j = 0; j < costMaterialProcessHours.size(); j++) {
+ AppSceneCostProductProcessMaintenance processHours = costMaterialProcessHours.get(j);
+ //燃动力工时来源
+ laborHours = laborHours.add(processHours.getBurningHour());
+ //水电费(燃动力工时*费率)成本
+ totalCost = totalCost.add(processHours.getBurningHour().multiply(hourRate));
+ }
+ }
+ //2.2计算机物料消耗存储到成本结果数据表中
+ AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(marterialNo).parentMarterialNo(appSceneCostResultValue.getParentMarterialNo()).taskType(taskType).taskCode(taskCode).flowInstanceId(Integer.valueOf(flowInstanceId)).countValue(totalCost + "").costType(feeType).priceOrRate(hourRate).hour(laborHours).build();
+ standardCostService.iAppSceneCostResultValueService.save(resultValue);
+ }
+ }
+ } else if (FeeTypeEnum.OtherFee.getCode().equals(feeType)) {
+ //2.4其他制费(其他工时*费率)
+ for (int i = 0; i < list.size(); i++) {
+ AppSceneCostResultValue appSceneCostResultValue = list.get(i);
+ String marterialNo = appSceneCostResultValue.getMarterialNo();
+ if (marterialNo != null) {
+ BigDecimal totalCost = new BigDecimal("0.0");
+ BigDecimal laborHours = new BigDecimal("0.0");
+ List costMaterialProcessHours = processHoursMap.get(marterialNo);
+ if (costMaterialProcessHours != null && costMaterialProcessHours.size() > 0) {
+ for (int j = 0; j < costMaterialProcessHours.size(); j++) {
+ AppSceneCostProductProcessMaintenance processHours = costMaterialProcessHours.get(j);
+ //其他工时来源
+ laborHours = laborHours.add(processHours.getOtherHour());
+ //其他制费成本
+ totalCost = totalCost.add(processHours.getOtherHour().multiply(hourRate));
+ }
+ }
+ //2.2计算机物料消耗存储到成本结果数据表中
+ AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(marterialNo).parentMarterialNo(appSceneCostResultValue.getParentMarterialNo()).taskType(taskType).taskCode(taskCode).flowInstanceId(Integer.valueOf(flowInstanceId)).countValue(totalCost + "").costType(feeType).priceOrRate(hourRate).hour(laborHours).build();
+ standardCostService.iAppSceneCostResultValueService.save(resultValue);
+ }
+ }
+ } else if (FeeTypeEnum.LogisticsFee.getCode().equals(feeType)) {
+ //查出所有的机器折旧费、机物料消耗、水电费、其他制费
+ list = standardCostService.iAppSceneCostResultValueService.getResultValueByTopMaterialNo(topMaterialCode, "ManufacturingCost", String.valueOf(flowInstanceId));
+ //2.5物流费((机器折旧+机物料消耗+水电费+其他制费)*10.16%)
+ //按照物料编号进行分组
+ Map> materialNoMap = list.stream().collect(Collectors.groupingBy(AppSceneCostResultValue::getMarterialNo));
+ for (String key : materialNoMap.keySet()) {
+ List appSceneCostResultValues = materialNoMap.get(key);
+ BigDecimal totalCost = new BigDecimal("0.0");
+ for (int j = 0; j < appSceneCostResultValues.size(); j++) {
+ AppSceneCostResultValue appSceneCostResultValue = appSceneCostResultValues.get(j);
+ String countValue = appSceneCostResultValue.getCountValue();
+ if (countValue != null) {
+ totalCost = totalCost.add(new BigDecimal(countValue));
+ }
+ }
+ AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(key).parentMarterialNo(appSceneCostResultValues.get(0).getParentMarterialNo()).taskType(taskType).taskCode(taskCode).flowInstanceId(Integer.valueOf(flowInstanceId)).countValue(totalCost.multiply(new BigDecimal("0.1016")).toString()).costType(feeType).build();
+ standardCostService.iAppSceneCostResultValueService.save(resultValue);
+ }
+ }
+ }
+
+ /**
+ * 【5.制造费用】
+ *
+ * @param topMaterialCode 顶部物料编号
+ * @param taskType 任务类型
+ * @param taskCode 任务编号
+ * @param flowInstanceId 流程实例id
+ * @param costType 流程实例id
+ */
+ public static void countStandardCostByTopMaterialCode(String topMaterialCode, String taskType, String taskCode, Integer flowInstanceId, String costType, String versionNumber) {
+ //1.查询出根物料编号对应的下所有的BOM信息结果值
+ List list = standardCostService.iAppSceneCostResultValueService.getAllResultValueByTopMaterialNo(topMaterialCode, String.valueOf(flowInstanceId));
+ //2.计算出所有的单个物料的本阶的标准成本(标准成本=物料成本+人工成本+制造费用)
+ //按照物料编号进行分组
+ Map> materialNoMap = list.stream().collect(Collectors.groupingBy(AppSceneCostResultValue::getMarterialNo));
+ //遍历根物料下所有的物料进行该物料本阶成本和费用类别的统计
+ for (String key : materialNoMap.keySet()) {
+ List appSceneCostResultValues = materialNoMap.get(key);
+ //按照费用类别进行分组
+ Map> costTypeMap = appSceneCostResultValues.stream().filter(s -> s.getCostType() != null).collect(Collectors.groupingBy(AppSceneCostResultValue::getCostType));
+ //【本阶标准成本】
+ BigDecimal currentCost = new BigDecimal("0.0");
+ //1.本阶物料成本
+ BigDecimal materialCost = new BigDecimal("0.0");
+ //2.本阶人工成本
+ BigDecimal laborCost = new BigDecimal("0.0");
+ //3.本阶制造费(设备费)
+ BigDecimal equipmentCost = new BigDecimal("0.0");
+ //4.本阶制造费(辅料费用)
+ BigDecimal supplyMaterialCost = new BigDecimal("0.0");
+ //5.本阶制造费(水电费、燃动费)
+ BigDecimal driveCost = new BigDecimal("0.0");
+ //6.本阶制造费(其他制造费用)
+ BigDecimal otherCost = new BigDecimal("0.0");
+ //7.本阶制造费(物流费)
+ BigDecimal logisticsCost = new BigDecimal("0.0");
+ //物料单价
+ BigDecimal materialUnitPrice = new BigDecimal("0.0");
+ //人员工时、小时费率
+ BigDecimal laborHour = new BigDecimal("0.0");
+ BigDecimal laborHourRate = new BigDecimal("0.0");
+ //设备工时、小时费率
+ BigDecimal equipmentHour = new BigDecimal("0.0");
+ BigDecimal equipmentHourRate = new BigDecimal("0.0");
+ //辅料工时、小时费率
+ BigDecimal supplyMaterialHour = new BigDecimal("0.0");
+ BigDecimal supplyMaterialHourRate = new BigDecimal("0.0");
+ //燃动工时、小时费率
+ BigDecimal driveHour = new BigDecimal("0.0");
+ BigDecimal driveHourRate = new BigDecimal("0.0");
+ //其他工时、小时费率
+ BigDecimal otherHour = new BigDecimal("0.0");
+ BigDecimal otherHourRate = new BigDecimal("0.0");
+ AppSceneCostResultValue currentMaterialCost = null;
+ //遍历所有费用类别计算本阶标准成本
+ for (int j = 0; j < appSceneCostResultValues.size(); j++) {
+ if (j == 0) {
+ //初始化当前物料成本信息
+ currentMaterialCost = appSceneCostResultValues.get(0);
+ }
+ AppSceneCostResultValue appSceneCostResultValue = appSceneCostResultValues.get(j);
+ String countValue = appSceneCostResultValue.getCountValue();
+ if (countValue != null) {
+ currentCost = currentCost.add(new BigDecimal(countValue));
+ }
+ }
+ //计算本阶各个费用类别费用以及记录本阶物料的工时和小时费率
+ for (String feeType : costTypeMap.keySet()) {
+ List appSceneCostResultValues1 = costTypeMap.get(feeType);
+ for (int m = 0; m < appSceneCostResultValues1.size(); m++) {
+ if (FeeTypeEnum.MaterialCost.getCode().equals(feeType)) {
+ //物料成本
+ materialCost = materialCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
+ //物料单价
+ materialUnitPrice = appSceneCostResultValues1.get(m).getPriceOrRate();
+ //TODO 数量
+ currentMaterialCost.setNum(appSceneCostResultValues1.get(m).getNum());
+ } else if (FeeTypeEnum.LaborCost.getCode().equals(feeType)) {
+ //人工成本
+ laborCost = laborCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
+ //人工工时、小时费率
+ laborHour = laborHour.add(appSceneCostResultValues1.get(m).getHour());
+ laborHourRate = laborHourRate.add(appSceneCostResultValues1.get(m).getPriceOrRate());
+ } else if (FeeTypeEnum.EquipmentFee.getCode().equals(feeType)) {
+ //设备费用
+ equipmentCost = equipmentCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
+ //设备工时、小时费率
+ equipmentHour = equipmentHour.add(appSceneCostResultValues1.get(m).getHour());
+ equipmentHourRate = equipmentHourRate.add(appSceneCostResultValues1.get(m).getPriceOrRate());
+ } else if (FeeTypeEnum.SupplyMaterialFee.getCode().equals(feeType)) {
+ //辅料费用
+ supplyMaterialCost = supplyMaterialCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
+ //辅料工时、小时费率
+ supplyMaterialHour = supplyMaterialHour.add(appSceneCostResultValues1.get(m).getHour());
+ supplyMaterialHourRate = supplyMaterialHourRate.add(appSceneCostResultValues1.get(m).getPriceOrRate());
+ } else if (FeeTypeEnum.DriverFee.getCode().equals(feeType)) {
+ //燃动费用
+ driveCost = driveCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
+ //燃动工时、小时费率
+ driveHour = driveHour.add(appSceneCostResultValues1.get(m).getHour());
+ driveHourRate = driveHourRate.add(appSceneCostResultValues1.get(m).getPriceOrRate());
+ } else if (FeeTypeEnum.LogisticsFee.getCode().equals(feeType)) {
+ //物流费用
+ logisticsCost = logisticsCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
+ } else if (FeeTypeEnum.OtherFee.getCode().equals(feeType)) {
+ //其他费用
+ otherCost = otherCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
+ //其他工时、小时费率
+ otherHour = otherHour.add(appSceneCostResultValues1.get(m).getHour());
+ otherHourRate = otherHourRate.add(appSceneCostResultValues1.get(m).getPriceOrRate());
+ }
+ }
+ }
+ //本阶不同费用类别成本统计
+ JSONObject currentLevelCostTypeDetail = new JSONObject();
+ currentLevelCostTypeDetail.put(FeeTypeEnum.MaterialCost.getCode(), materialCost);
+ currentLevelCostTypeDetail.put(FeeTypeEnum.LaborCost.getCode(), laborCost);
+ currentLevelCostTypeDetail.put(FeeTypeEnum.EquipmentFee.getCode(), equipmentCost);
+ currentLevelCostTypeDetail.put(FeeTypeEnum.SupplyMaterialFee.getCode(), supplyMaterialCost);
+ currentLevelCostTypeDetail.put(FeeTypeEnum.DriverFee.getCode(), driveCost);
+ currentLevelCostTypeDetail.put(FeeTypeEnum.LogisticsFee.getCode(), logisticsCost);
+ currentLevelCostTypeDetail.put(FeeTypeEnum.OtherFee.getCode(), otherCost);
+ //统计本阶不同费用类别工时、小时费率
+ currentLevelCostTypeDetail.put(HourOrRateTypeEnum.MaterialUnitPrice.getCode(), materialUnitPrice);
+ currentLevelCostTypeDetail.put(HourOrRateTypeEnum.LaborHour.getCode(), laborHour);
+ currentLevelCostTypeDetail.put(HourOrRateTypeEnum.LaborHourRate.getCode(), laborHourRate);
+ currentLevelCostTypeDetail.put(HourOrRateTypeEnum.EquipmentHour.getCode(), equipmentHour);
+ currentLevelCostTypeDetail.put(HourOrRateTypeEnum.EquipmentHourRate.getCode(), equipmentHourRate);
+ currentLevelCostTypeDetail.put(HourOrRateTypeEnum.SupplyMaterialHour.getCode(), supplyMaterialHour);
+ currentLevelCostTypeDetail.put(HourOrRateTypeEnum.SupplyMaterialHourRate.getCode(), supplyMaterialHourRate);
+ currentLevelCostTypeDetail.put(HourOrRateTypeEnum.DriverHour.getCode(), driveHour);
+ currentLevelCostTypeDetail.put(HourOrRateTypeEnum.DriverHourRate.getCode(), driveHourRate);
+ currentLevelCostTypeDetail.put(HourOrRateTypeEnum.OtherHour.getCode(), otherHour);
+ currentLevelCostTypeDetail.put(HourOrRateTypeEnum.OtherHourRate.getCode(), otherHourRate);
+ AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(key).parentMarterialNo(currentMaterialCost.getParentMarterialNo()).taskType(taskType).taskCode(taskCode).flowInstanceId(Integer.valueOf(flowInstanceId)).countValue(currentCost.toString()).costDetail(JSON.toJSONString(currentLevelCostTypeDetail)).costType(costType).num(currentMaterialCost.getNum()).build();
+ standardCostService.iAppSceneCostResultValueService.save(resultValue);
+ }
+ //3.计算出所有的单个物料的累计标准成本
+ List standardCostList = standardCostService.iAppSceneCostResultValueService.getResultValueByTopMaterialNo(topMaterialCode, taskType, String.valueOf(flowInstanceId));
+ //【累计成本】的计算
+ totalCountCost(standardCostList, topMaterialCode, taskType, taskCode, String.valueOf(flowInstanceId), versionNumber);
+ }
+
/**
* 获取任务流程相关信息
*
@@ -190,7 +570,7 @@ public class StandardCostService {
*/
private static FlowTaskInfoVO queryFlowDefinitionByFlowInstanceId(FlowTaskInfoVO flowTaskInfoVO) {
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";
- String blob = standardCostService.costMaterialBomMapper.customSelectBlobModelJson(sql);
+ String blob = standardCostService.appSceneCostBomRelevancyMapper.customSelectBlobModelJson(sql);
if (blob != null) {
if (blob != null && blob.contains("topMaterialCode")) {
JSONObject jsonObject1 = JSON.parseObject(blob);
@@ -218,30 +598,7 @@ public class StandardCostService {
String flowInstanceId = flowTaskInfoVO.getFlowInstanceId();
//成本类型
String feeType = FeeTypeEnum.MaterialCost.getCode();
- //1.查询出物料编号对应的下所有的BOM信息
- List list = standardCostService.iAppSceneCostResultValueService.getResultValueByTopMaterialNo(topMaterialCode, "MaterialInput", flowInstanceId);
- //2.计算出所有的单个物料的物料成本
- //2.1查询出物料的单价和采购数量
- List MarterialNoList = new ArrayList<>();
- if (list != null && list.size() > 0) {
- MarterialNoList = list.stream().filter(s -> s.getMarterialNo() != null).map(AppSceneCostResultValue::getMarterialNo).collect(Collectors.toList());
- }
- //查询物料的采购价
- Map purchasePriceMap = standardCostService.costPurchasePriceService.getMinCostPurchasePriceByMaterialNo(MarterialNoList);
- for (int i = 0; i < list.size(); i++) {
- AppSceneCostResultValue appSceneCostResultValue = list.get(i);
- String marterialNo = appSceneCostResultValue.getMarterialNo();
- Integer num = appSceneCostResultValue.getNum();
- if (marterialNo != null && num != null) {
- BigDecimal price = purchasePriceMap.get(marterialNo);
- BigDecimal number = new BigDecimal(num.toString());
- //单价乘以数量
- BigDecimal totalCost = price.multiply(number);
- //2.2计算出人工成本并存储到成本结果数据表中
- AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(marterialNo).parentMarterialNo(appSceneCostResultValue.getParentMarterialNo()).taskType(taskType).costType(feeType).taskCode(taskCode).flowInstanceId(flowInstanceId).countValue(totalCost + "").priceOrRate(price).build();
- standardCostService.iAppSceneCostResultValueService.save(resultValue);
- }
- }
+
} catch (Exception e) {
throw new RuntimeException(e);
}
@@ -268,42 +625,7 @@ public class StandardCostService {
log.info("sql1:" + sql1);
String sql = sql1.replaceAll("^\"|\"$", ""); // 去除首尾引号
log.info("sql:" + sql);
- JSONObject jsonObject = standardCostService.costMaterialBomMapper.customSelectOne(sql);
- BigDecimal hourRate = new BigDecimal("0");
- if (jsonObject != null) {
- AppSceneCostHourRate rate = JSON.toJavaObject(jsonObject, AppSceneCostHourRate.class);
- hourRate = rate.getLaborHourRate();
- }
- //1.查询出物料编号对应的下所有的BOM信息
- List list = standardCostService.iAppSceneCostResultValueService.getResultValueByTopMaterialNo(topMaterialCode, "MaterialInput", flowInstanceId);
- //2.计算出所有的单个物料的人工成本
- //2.1查询出物料的人员工时和人工小时费率(涉及:小时费率表和工序表)
- List MarterialNoList = new ArrayList<>();
- if (list != null && list.size() > 0) {
- MarterialNoList = list.stream().filter(s -> s.getMarterialNo() != null).map(AppSceneCostResultValue::getMarterialNo).collect(Collectors.toList());
- }
- //查询工序工时
- Map> processHoursMap = standardCostService.costMaterialProcessHoursService.getProcessHoursByMaterialNo(MarterialNoList);
- for (int i = 0; i < list.size(); i++) {
- AppSceneCostResultValue appSceneCostResultValue = list.get(i);
- String marterialNo = appSceneCostResultValue.getMarterialNo();
- if (marterialNo != null) {
- BigDecimal totalCost = new BigDecimal("0.0");
- BigDecimal laborHours = new BigDecimal("0.0");
- List costMaterialProcessHours = processHoursMap.get(marterialNo);
- if (costMaterialProcessHours != null && costMaterialProcessHours.size() > 0) {
- for (int j = 0; j < costMaterialProcessHours.size(); j++) {
- AppSceneCostMaterialProcessHours processHours = costMaterialProcessHours.get(j);
- laborHours = laborHours.add(processHours.getLaborHours());
- //计算总人工成本
- totalCost = totalCost.add(processHours.getLaborHours().multiply(hourRate));
- }
- }
- //2.2计算出人工成本并存储到成本结果数据表中
- 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();
- standardCostService.iAppSceneCostResultValueService.save(resultValue);
- }
- }
+
} catch (Exception e) {
throw new RuntimeException(e);
}
@@ -336,132 +658,7 @@ public class StandardCostService {
log.info("sql1:" + sql1);
String sql = sql1.replaceAll("^\"|\"$", ""); // 去除首尾引号
log.info("sql:" + sql);
- JSONObject jsonObject = standardCostService.costMaterialBomMapper.customSelectOne(sql);
- BigDecimal hourRate = new BigDecimal("0");
- if (jsonObject != null) {
- AppSceneCostHourRate rate = JSON.toJavaObject(jsonObject, AppSceneCostHourRate.class);
- hourRate = rate.getLaborHourRate();
- }
- //1.查询出物料编号对应的下所有的BOM信息
- List list = standardCostService.iAppSceneCostResultValueService.getResultValueByTopMaterialNo(topMaterialCode, "MaterialInput", flowInstanceId);
- //2.根据费用类型进行不同的费用计算
- //查询工序工时
- List MarterialNoList = new ArrayList<>();
- if (list != null && list.size() > 0) {
- MarterialNoList = list.stream().filter(s -> s.getMarterialNo() != null).map(AppSceneCostResultValue::getMarterialNo).collect(Collectors.toList());
- }
- Map> processHoursMap = standardCostService.costMaterialProcessHoursService.getProcessHoursByMaterialNo(MarterialNoList);
- //2.1机器折旧费(机器工时*费率)
- if (FeeTypeEnum.EquipmentFee.getCode().equals(feeType)) {
- for (int i = 0; i < list.size(); i++) {
- AppSceneCostResultValue appSceneCostResultValue = list.get(i);
- String marterialNo = appSceneCostResultValue.getMarterialNo();
- if (marterialNo != null) {
- BigDecimal totalCost = new BigDecimal("0.0");
- BigDecimal laborHours = new BigDecimal("0.0");
- List costMaterialProcessHours = processHoursMap.get(marterialNo);
- if (costMaterialProcessHours != null && costMaterialProcessHours.size() > 0) {
- for (int j = 0; j < costMaterialProcessHours.size(); j++) {
- AppSceneCostMaterialProcessHours processHours = costMaterialProcessHours.get(j);
- laborHours = laborHours.add(processHours.getDeviceHours());
- //计算机器成本
- totalCost = totalCost.add(processHours.getDeviceHours().multiply(hourRate));
- }
- }
- //2.2计算机器成本并存储到成本结果数据表中
- 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();
- standardCostService.iAppSceneCostResultValueService.save(resultValue);
- }
- }
- } else if (FeeTypeEnum.SupplyMaterialFee.getCode().equals(feeType)) {
- //机物料消耗(辅料工时*费率)
- for (int i = 0; i < list.size(); i++) {
- AppSceneCostResultValue appSceneCostResultValue = list.get(i);
- String marterialNo = appSceneCostResultValue.getMarterialNo();
- if (marterialNo != null) {
- BigDecimal totalCost = new BigDecimal("0.0");
- BigDecimal laborHours = new BigDecimal("0.0");
- List costMaterialProcessHours = processHoursMap.get(marterialNo);
- if (costMaterialProcessHours != null && costMaterialProcessHours.size() > 0) {
- for (int j = 0; j < costMaterialProcessHours.size(); j++) {
- AppSceneCostMaterialProcessHours processHours = costMaterialProcessHours.get(j);
- //TODO 辅料工时来源
- laborHours = laborHours.add(processHours.getDeviceHours());
- //机物料消耗
- totalCost = totalCost.add(processHours.getDeviceHours().multiply(hourRate));
- }
- }
- //2.2计算机物料消耗存储到成本结果数据表中
- 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();
- standardCostService.iAppSceneCostResultValueService.save(resultValue);
- }
- }
- } else if (FeeTypeEnum.DriverFee.getCode().equals(feeType)) {
- //2.3水电费(燃动力工时*费率)
- for (int i = 0; i < list.size(); i++) {
- AppSceneCostResultValue appSceneCostResultValue = list.get(i);
- String marterialNo = appSceneCostResultValue.getMarterialNo();
- if (marterialNo != null) {
- BigDecimal totalCost = new BigDecimal("0.0");
- BigDecimal laborHours = new BigDecimal("0.0");
- List costMaterialProcessHours = processHoursMap.get(marterialNo);
- if (costMaterialProcessHours != null && costMaterialProcessHours.size() > 0) {
- for (int j = 0; j < costMaterialProcessHours.size(); j++) {
- AppSceneCostMaterialProcessHours processHours = costMaterialProcessHours.get(j);
- //TODO 燃动力工时来源
- laborHours = laborHours.add(processHours.getDeviceHours());
- //水电费(燃动力工时*费率)成本
- totalCost = totalCost.add(processHours.getDeviceHours().multiply(hourRate));
- }
- }
- //2.2计算机物料消耗存储到成本结果数据表中
- 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();
- standardCostService.iAppSceneCostResultValueService.save(resultValue);
- }
- }
- } else if (FeeTypeEnum.OtherFee.getCode().equals(feeType)) {
- //2.4其他制费(其他工时*费率)
- for (int i = 0; i < list.size(); i++) {
- AppSceneCostResultValue appSceneCostResultValue = list.get(i);
- String marterialNo = appSceneCostResultValue.getMarterialNo();
- if (marterialNo != null) {
- BigDecimal totalCost = new BigDecimal("0.0");
- BigDecimal laborHours = new BigDecimal("0.0");
- List costMaterialProcessHours = processHoursMap.get(marterialNo);
- if (costMaterialProcessHours != null && costMaterialProcessHours.size() > 0) {
- for (int j = 0; j < costMaterialProcessHours.size(); j++) {
- AppSceneCostMaterialProcessHours processHours = costMaterialProcessHours.get(j);
- //TODO 其他工时来源
- laborHours = laborHours.add(processHours.getDeviceHours());
- //其他制费成本
- totalCost = totalCost.add(processHours.getDeviceHours().multiply(hourRate));
- }
- }
- //2.2计算机物料消耗存储到成本结果数据表中
- 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();
- standardCostService.iAppSceneCostResultValueService.save(resultValue);
- }
- }
- } else if (FeeTypeEnum.LogisticsFee.getCode().equals(feeType)) {
- //查出所有的机器折旧费、机物料消耗、水电费、其他制费
- list = standardCostService.iAppSceneCostResultValueService.getResultValueByTopMaterialNo(topMaterialCode, "ManufacturingCost", flowInstanceId);
- //2.5物流费((机器折旧+机物料消耗+水电费+其他制费)*10.16%)
- //按照物料编号进行分组
- Map> materialNoMap = list.stream().collect(Collectors.groupingBy(AppSceneCostResultValue::getMarterialNo));
- for (String key : materialNoMap.keySet()) {
- List appSceneCostResultValues = materialNoMap.get(key);
- BigDecimal totalCost = new BigDecimal("0.0");
- for (int j = 0; j < appSceneCostResultValues.size(); j++) {
- AppSceneCostResultValue appSceneCostResultValue = appSceneCostResultValues.get(j);
- String countValue = appSceneCostResultValue.getCountValue();
- if (countValue != null) {
- totalCost = totalCost.add(new BigDecimal(countValue));
- }
- }
- 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();
- standardCostService.iAppSceneCostResultValueService.save(resultValue);
- }
- }
+
} catch (Exception e) {
throw new RuntimeException(e);
}
@@ -484,134 +681,6 @@ public class StandardCostService {
//获取流程id
String flowInstanceId = flowTaskInfoVO.getFlowInstanceId();
String costType = FeeTypeEnum.StandardCost.getCode();
- //1.查询出根物料编号对应的下所有的BOM信息结果值
- List list = standardCostService.iAppSceneCostResultValueService.getAllResultValueByTopMaterialNo(topMaterialCode, flowInstanceId);
- //2.计算出所有的单个物料的本阶的标准成本(标准成本=物料成本+人工成本+制造费用)
- //按照物料编号进行分组
- Map> materialNoMap = list.stream().collect(Collectors.groupingBy(AppSceneCostResultValue::getMarterialNo));
- //遍历根物料下所有的物料进行该物料本阶成本和费用类别的统计
- for (String key : materialNoMap.keySet()) {
- List appSceneCostResultValues = materialNoMap.get(key);
- //按照费用类别进行分组
- Map> costTypeMap = appSceneCostResultValues.stream().filter(s -> s.getCostType() != null).collect(Collectors.groupingBy(AppSceneCostResultValue::getCostType));
- //【本阶标准成本】
- BigDecimal currentCost = new BigDecimal("0.0");
- //1.本阶物料成本
- BigDecimal materialCost = new BigDecimal("0.0");
- //2.本阶人工成本
- BigDecimal laborCost = new BigDecimal("0.0");
- //3.本阶制造费(设备费)
- BigDecimal equipmentCost = new BigDecimal("0.0");
- //4.本阶制造费(辅料费用)
- BigDecimal supplyMaterialCost = new BigDecimal("0.0");
- //5.本阶制造费(水电费、燃动费)
- BigDecimal driveCost = new BigDecimal("0.0");
- //6.本阶制造费(其他制造费用)
- BigDecimal otherCost = new BigDecimal("0.0");
- //7.本阶制造费(物流费)
- BigDecimal logisticsCost = new BigDecimal("0.0");
- //物料单价
- BigDecimal materialUnitPrice = new BigDecimal("0.0");
- //人员工时、小时费率
- BigDecimal laborHour = new BigDecimal("0.0");
- BigDecimal laborHourRate = new BigDecimal("0.0");
- //设备工时、小时费率
- BigDecimal equipmentHour = new BigDecimal("0.0");
- BigDecimal equipmentHourRate = new BigDecimal("0.0");
- //辅料工时、小时费率
- BigDecimal supplyMaterialHour = new BigDecimal("0.0");
- BigDecimal supplyMaterialHourRate = new BigDecimal("0.0");
- //燃动工时、小时费率
- BigDecimal driveHour = new BigDecimal("0.0");
- BigDecimal driveHourRate = new BigDecimal("0.0");
- //其他工时、小时费率
- BigDecimal otherHour = new BigDecimal("0.0");
- BigDecimal otherHourRate = new BigDecimal("0.0");
- AppSceneCostResultValue currentMaterialCost = null;
- //遍历所有费用类别计算本阶标准成本
- for (int j = 0; j < appSceneCostResultValues.size(); j++) {
- if (j == 0) {
- currentMaterialCost = appSceneCostResultValues.get(0);
- }
- AppSceneCostResultValue appSceneCostResultValue = appSceneCostResultValues.get(j);
- String countValue = appSceneCostResultValue.getCountValue();
- if (countValue != null) {
- currentCost = currentCost.add(new BigDecimal(countValue));
- }
- }
- //计算本阶各个费用类别费用以及记录本阶物料的工时和小时费率
- for (String feeType : costTypeMap.keySet()) {
- List appSceneCostResultValues1 = costTypeMap.get(feeType);
- for (int m = 0; m < appSceneCostResultValues1.size(); m++) {
- if (FeeTypeEnum.MaterialCost.getCode().equals(feeType)) {
- //物料成本
- materialCost = materialCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
- //物料单价
- materialUnitPrice = appSceneCostResultValues1.get(m).getPriceOrRate();
- } else if (FeeTypeEnum.LaborCost.getCode().equals(feeType)) {
- //人工成本
- laborCost = laborCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
- //人工工时、小时费率
- laborHour = laborHour.add(appSceneCostResultValues1.get(m).getHour());
- laborHourRate = laborHourRate.add(appSceneCostResultValues1.get(m).getPriceOrRate());
- } else if (FeeTypeEnum.EquipmentFee.getCode().equals(feeType)) {
- //设备费用
- equipmentCost = equipmentCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
- //设备工时、小时费率
- equipmentHour = equipmentHour.add(appSceneCostResultValues1.get(m).getHour());
- equipmentHourRate = equipmentHourRate.add(appSceneCostResultValues1.get(m).getPriceOrRate());
- } else if (FeeTypeEnum.SupplyMaterialFee.getCode().equals(feeType)) {
- //辅料费用
- supplyMaterialCost = supplyMaterialCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
- //辅料工时、小时费率
- supplyMaterialHour = supplyMaterialHour.add(appSceneCostResultValues1.get(m).getHour());
- supplyMaterialHourRate = supplyMaterialHourRate.add(appSceneCostResultValues1.get(m).getPriceOrRate());
- } else if (FeeTypeEnum.DriverFee.getCode().equals(feeType)) {
- //燃动费用
- driveCost = driveCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
- //燃动工时、小时费率
- driveHour = driveHour.add(appSceneCostResultValues1.get(m).getHour());
- driveHourRate = driveHourRate.add(appSceneCostResultValues1.get(m).getPriceOrRate());
- } else if (FeeTypeEnum.LogisticsFee.getCode().equals(feeType)) {
- //物流费用
- logisticsCost = logisticsCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
- } else if (FeeTypeEnum.OtherFee.getCode().equals(feeType)) {
- //其他费用
- otherCost = otherCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
- //其他工时、小时费率
- otherHour = otherHour.add(appSceneCostResultValues1.get(m).getHour());
- otherHourRate = otherHourRate.add(appSceneCostResultValues1.get(m).getPriceOrRate());
- }
- }
- }
- //本阶不同费用类别成本统计
- JSONObject currentLevelCostTypeDetail = new JSONObject();
- currentLevelCostTypeDetail.put(FeeTypeEnum.MaterialCost.getCode(), materialCost);
- currentLevelCostTypeDetail.put(FeeTypeEnum.LaborCost.getCode(), laborCost);
- currentLevelCostTypeDetail.put(FeeTypeEnum.EquipmentFee.getCode(), equipmentCost);
- currentLevelCostTypeDetail.put(FeeTypeEnum.SupplyMaterialFee.getCode(), supplyMaterialCost);
- currentLevelCostTypeDetail.put(FeeTypeEnum.DriverFee.getCode(), driveCost);
- currentLevelCostTypeDetail.put(FeeTypeEnum.LogisticsFee.getCode(), logisticsCost);
- currentLevelCostTypeDetail.put(FeeTypeEnum.OtherFee.getCode(), otherCost);
- //统计本阶不同费用类别工时、小时费率
- currentLevelCostTypeDetail.put(HourOrRateTypeEnum.MaterialUnitPrice.getCode(), materialUnitPrice);
- currentLevelCostTypeDetail.put(HourOrRateTypeEnum.LaborHour.getCode(), laborHour);
- currentLevelCostTypeDetail.put(HourOrRateTypeEnum.LaborHourRate.getCode(), laborHourRate);
- currentLevelCostTypeDetail.put(HourOrRateTypeEnum.EquipmentHour.getCode(), equipmentHour);
- currentLevelCostTypeDetail.put(HourOrRateTypeEnum.EquipmentHourRate.getCode(), equipmentHourRate);
- currentLevelCostTypeDetail.put(HourOrRateTypeEnum.SupplyMaterialHour.getCode(), supplyMaterialHour);
- currentLevelCostTypeDetail.put(HourOrRateTypeEnum.SupplyMaterialHourRate.getCode(), supplyMaterialHourRate);
- currentLevelCostTypeDetail.put(HourOrRateTypeEnum.DriverHour.getCode(), driveHour);
- currentLevelCostTypeDetail.put(HourOrRateTypeEnum.DriverHourRate.getCode(), driveHourRate);
- currentLevelCostTypeDetail.put(HourOrRateTypeEnum.OtherHour.getCode(), otherHour);
- currentLevelCostTypeDetail.put(HourOrRateTypeEnum.OtherHourRate.getCode(), otherHourRate);
- 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();
- standardCostService.iAppSceneCostResultValueService.save(resultValue);
- }
- //3.计算出所有的单个物料的累计标准成本
- List standardCostList = standardCostService.iAppSceneCostResultValueService.getResultValueByTopMaterialNo(topMaterialCode, taskType, flowInstanceId);
- //【累计成本】的计算
- totalCountCost(standardCostList, topMaterialCode, taskType, taskCode, flowInstanceId);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("计算成本失败");
@@ -627,9 +696,9 @@ public class StandardCostService {
* @param taskCode
* @param flowInstanceId
*/
- private static void totalCountCost(List standardCostList, String topMaterialCode, String taskType, String taskCode, String flowInstanceId) {
+ private static void totalCountCost(List standardCostList, String topMaterialCode, String taskType, String taskCode, String flowInstanceId, String versionNumber) {
try {
- List costStandardDetails = new ArrayList<>();
+ List costStandardResults = new ArrayList<>();
//父类对应的子节点(除了最上层节点)
Map> parentMaterialNoMap = standardCostList.stream().filter(appSceneCostResultValue -> appSceneCostResultValue.getParentMarterialNo() != null).collect(Collectors.groupingBy(AppSceneCostResultValue::getParentMarterialNo));
for (int i = 0; i < standardCostList.size(); i++) {
@@ -660,16 +729,16 @@ public class StandardCostService {
oldAppSceneCostResultValue.setTotalValue(hourOrRateResultValue.getTotalCost().toString());
standardCostService.iAppSceneCostResultValueService.updateById(oldAppSceneCostResultValue);
//构造单行成本查询记录
- AppSceneCostStandardDetail costStandardDetail = AppSceneCostStandardDetail.builder().materialNumber(oldAppSceneCostResultValue.getMarterialNo()).materialName(oldAppSceneCostResultValue.getMarterialNo()).parentMaterialNumber(oldAppSceneCostResultValue.getParentMarterialNo())
-// .versionNumber()
+ AppSceneCostStandardResult costStandardResultValue = AppSceneCostStandardResult.builder().materialNumber(oldAppSceneCostResultValue.getMarterialNo()).parentMatnr(oldAppSceneCostResultValue.getParentMarterialNo()).versionNumber(versionNumber)
// .level()
// .sort()
// .figureNumber()
- .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())).createTime(new Date()).build();
- costStandardDetails.add(costStandardDetail);
+// .dosage(oldAppSceneCostResultValue.getNum() != null ? oldAppSceneCostResultValue.getNum().doubleValue() : 0).unit(oldAppSceneCostResultValue.getUnit())
+ .materialCostStageInter(costDetailJson.getBigDecimal(FeeTypeEnum.MaterialCost.getCode())).laborCostStage(costDetailJson.getBigDecimal(FeeTypeEnum.LaborCost.getCode())).equipCostStage(costDetailJson.getBigDecimal(FeeTypeEnum.EquipmentFee.getCode())).auxiliaryCostStage(costDetailJson.getBigDecimal(FeeTypeEnum.SupplyMaterialFee.getCode())).burningCostStage(costDetailJson.getBigDecimal(FeeTypeEnum.DriverFee.getCode())).stageLogisticsCost(costDetailJson.getBigDecimal(FeeTypeEnum.LogisticsFee.getCode())).otherCostStage(costDetailJson.getBigDecimal(FeeTypeEnum.OtherFee.getCode())).totalStandardCostInter(new BigDecimal(oldAppSceneCostResultValue.getCountValue())).materialCostAccumulated(costDetailJson.getBigDecimal(TotalCostEnum.TotalMaterialCost.getCode())).laborCostAccumulated(costDetailJson.getBigDecimal(TotalCostEnum.TotalLaborCost.getCode())).equipCostAccumulated(costDetailJson.getBigDecimal(TotalCostEnum.TotalEquipmentFee.getCode())).auxiliaryCostAccumulated(costDetailJson.getBigDecimal(TotalCostEnum.TotalSupplyMaterialFee.getCode())).burningCostAccumulated(costDetailJson.getBigDecimal(TotalCostEnum.TotalDriverFee.getCode())).totalLogisticsCost(costDetailJson.getBigDecimal(TotalCostEnum.TotalLogisticsFee.getCode())).otherCostAccumulated(costDetailJson.getBigDecimal(TotalCostEnum.TotalOtherFee.getCode())).totalStandardCost(costDetailJson.getBigDecimal(TotalCostEnum.TotalStandardCost.getCode())).createdTime(new Date()).build();
+ costStandardResults.add(costStandardResultValue);
}
//更新结果集到标准成本单行查询中去
- standardCostService.iAppSceneCostStandardDetailService.saveBatch(costStandardDetails);
+ standardCostService.iAppSceneCostStandardResultService.saveBatch(costStandardResults);
} catch (Exception e) {
e.printStackTrace();
}
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostBomRelevancyService.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostBomRelevancyService.java
new file mode 100644
index 0000000..dc95f4b
--- /dev/null
+++ b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostBomRelevancyService.java
@@ -0,0 +1,29 @@
+package com.zzsmart.qomo.kn.cost.manage.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostBomRelevancy;
+
+import java.util.List;
+
+/**
+ * @Description: app_scene_cost_bom_relevancy
+ * @Author: jeecg-boot
+ * @Date: 2024-09-08
+ * @Version: V1.0
+ */
+public interface IAppSceneCostBomRelevancyService extends IService {
+ /**
+ * 分页查询
+ * @param
+ * @return
+ */
+ List queryListResult(String materialNumber);
+
+ /**
+ * 查询最顶层物料编号下所有的物料
+ * @param topMaterialCode
+ * @return
+ */
+ List queryAllBomInfoByTopMaterialCode(String topMaterialCode);
+
+}
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostCountService.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostCountService.java
index c986fef..3796688 100644
--- a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostCountService.java
+++ b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostCountService.java
@@ -2,6 +2,7 @@ package com.zzsmart.qomo.kn.cost.manage.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostCount;
+import com.zzsmart.qomo.kn.cost.manage.vo.AppSceneCostCountVO;
import com.zzsmart.qomo.kn.cost.manage.vo.MissingComponentVO;
import java.util.List;
@@ -31,5 +32,5 @@ public interface IAppSceneCostCountService extends IService {
* 添加标准成本计算任务
* @param appSceneCostCount
*/
- void addCostCountTask(AppSceneCostCount appSceneCostCount);
+ void addCostCountTask(AppSceneCostCountVO appSceneCostCount);
}
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostHourRateService.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostHourRateService.java
index 830ba71..8525fb7 100644
--- a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostHourRateService.java
+++ b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostHourRateService.java
@@ -10,5 +10,10 @@ import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostHourRate;
* @Version: V1.0
*/
public interface IAppSceneCostHourRateService extends IService {
-
+ /**
+ * 查询满足条件的一条小时费率信息
+ * @param appSceneCostHourRate
+ * @return
+ */
+ AppSceneCostHourRate getOneHourRateInfo(AppSceneCostHourRate appSceneCostHourRate);
}
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostMaterialBomService.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostMaterialBomService.java
deleted file mode 100644
index 9036f61..0000000
--- a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostMaterialBomService.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.zzsmart.qomo.kn.cost.manage.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostMaterialBom;
-
-import java.util.List;
-
-/**
- * @Description: app_scene_cost_material_bom
- * @Author: jeecg-boot
- * @Date: 2024-08-02
- * @Version: V1.0
- */
-public interface IAppSceneCostMaterialBomService extends IService {
- /**
- * 分页查询
- * @param
- * @return
- */
- List queryListResult(String materialNumber);
-
- /**
- * 查询最顶层物料编号下所有的物料
- * @param topMaterialCode
- * @return
- */
- List queryAllBomInfoBytopMaterialCode(String topMaterialCode);
-}
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostMaterialProcessHoursService.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostMaterialProcessHoursService.java
deleted file mode 100644
index 5487ab5..0000000
--- a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostMaterialProcessHoursService.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.zzsmart.qomo.kn.cost.manage.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostMaterialProcessHours;
-import com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostMaterialProcessHoursMapper;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * @Description: app_scene_cost_material_process_hours
- * @Author: jeecg-boot
- * @Date: 2024-08-02
- * @Version: V1.0
- */
-public interface IAppSceneCostMaterialProcessHoursService extends IService {
- /**
- * 查询满足物料编号的工时工序
- */
- Map> getProcessHoursByMaterialNo(List materialNos);
-
-}
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostProductProcessMaintenanceService.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostProductProcessMaintenanceService.java
new file mode 100644
index 0000000..0a1b04f
--- /dev/null
+++ b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostProductProcessMaintenanceService.java
@@ -0,0 +1,21 @@
+package com.zzsmart.qomo.kn.cost.manage.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostProductProcessMaintenance;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description: app_scene_cost_product_process_maintenance
+ * @Author: jeecg-boot
+ * @Date: 2024-09-08
+ * @Version: V1.0
+ */
+public interface IAppSceneCostProductProcessMaintenanceService extends IService {
+ /**
+ * 查询满足物料编号的工时工序
+ */
+ Map> getProcessHoursByMaterialNo(List materialNos);
+
+}
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostPurchasePriceService.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostPurchaseRecordService.java
similarity index 71%
rename from qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostPurchasePriceService.java
rename to qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostPurchaseRecordService.java
index ee33790..f0bd662 100644
--- a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostPurchasePriceService.java
+++ b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostPurchaseRecordService.java
@@ -1,19 +1,19 @@
package com.zzsmart.qomo.kn.cost.manage.service;
import com.baomidou.mybatisplus.extension.service.IService;
-import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostPurchasePrice;
+import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostPurchaseRecord;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
/**
- * @Description: app_scene_cost_purchase_price
+ * @Description: app_scene_cost_purchase_record
* @Author: jeecg-boot
- * @Date: 2024-08-02
+ * @Date: 2024-09-08
* @Version: V1.0
*/
-public interface IAppSceneCostPurchasePriceService extends IService {
+public interface IAppSceneCostPurchaseRecordService extends IService {
/**
* 查询满足物料编号的最低采购价
*/
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostStandardResultService.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostStandardResultService.java
new file mode 100644
index 0000000..9f143cd
--- /dev/null
+++ b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostStandardResultService.java
@@ -0,0 +1,14 @@
+package com.zzsmart.qomo.kn.cost.manage.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostStandardResult;
+
+/**
+ * @Description: app_scene_cost_standard_detail
+ * @Author: jeecg-boot
+ * @Date: 2024-07-31
+ * @Version: V1.0
+ */
+public interface IAppSceneCostStandardResultService extends IService {
+
+}
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostMaterialBomServiceImpl.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostBomRelevancyServiceImpl.java
similarity index 51%
rename from qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostMaterialBomServiceImpl.java
rename to qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostBomRelevancyServiceImpl.java
index cbd4bef..2c9f11d 100644
--- a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostMaterialBomServiceImpl.java
+++ b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostBomRelevancyServiceImpl.java
@@ -2,9 +2,9 @@ package com.zzsmart.qomo.kn.cost.manage.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostMaterialBom;
-import com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostMaterialBomMapper;
-import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostMaterialBomService;
+import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostBomRelevancy;
+import com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostBomRelevancyMapper;
+import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostBomRelevancyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -13,15 +13,19 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
/**
- * @Description: app_scene_cost_material_bom
+ * @Description: app_scene_cost_bom_relevancy
* @Author: jeecg-boot
- * @Date: 2024-08-02
+ * @Date: 2024-09-08
* @Version: V1.0
*/
@Service
-public class AppSceneCostMaterialBomServiceImpl extends ServiceImpl implements IAppSceneCostMaterialBomService {
+public class AppSceneCostBomRelevancyServiceImpl extends ServiceImpl implements IAppSceneCostBomRelevancyService {
+ /**
+ * 物料BOM信息
+ */
@Autowired
- AppSceneCostMaterialBomMapper costMaterialBomMapper;
+ AppSceneCostBomRelevancyMapper costMaterialBomMapper;
+
/**
* 分页查询
@@ -30,7 +34,7 @@ public class AppSceneCostMaterialBomServiceImpl extends ServiceImpl queryListResult(String materialNumber) {
+ public List queryListResult(String materialNumber) {
QueryWrapper queryWrapper = new QueryWrapper();
if (StrUtil.isNotEmpty(materialNumber)) {
// 物料号
@@ -47,14 +51,10 @@ public class AppSceneCostMaterialBomServiceImpl extends ServiceImpl queryAllBomInfoBytopMaterialCode(String topMaterialCode) {
- QueryWrapper queryWrapper = new QueryWrapper();
+ public List queryAllBomInfoByTopMaterialCode(String topMaterialCode) {
+ List childrens = costMaterialBomMapper.findChildrenByParentId(topMaterialCode);
//TODO 循环遍历查出所有的物料下的物料(包含最上层的物料)
-// if (StrUtil.isNotEmpty(topMaterialCode)) {
-// // 物料号
-// queryWrapper.like("material_code", topMaterialCode);
-// }
- List list = costMaterialBomMapper.selectList(queryWrapper);
- return list;
+ //TODO 所有的物料并进行层级排序
+ return childrens;
}
}
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostCountServiceImpl.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostCountServiceImpl.java
index bbe9ab3..2707195 100644
--- a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostCountServiceImpl.java
+++ b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostCountServiceImpl.java
@@ -1,25 +1,33 @@
package com.zzsmart.qomo.kn.cost.manage.service.impl;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.zzsmart.qomo.dao.entity.FlowDefinition;
+import com.zzsmart.qomo.dao.entity.FlowInstance;
+import com.zzsmart.qomo.dao.entity.FlowInstanceParameter;
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostCount;
+import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostHourRate;
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostPartMissingInfo;
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostStandardVersion;
import com.zzsmart.qomo.kn.cost.manage.enums.CostCountStatusEnum;
+import com.zzsmart.qomo.kn.cost.manage.enums.FeeTypeEnum;
import com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostCountMapper;
import com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostPartMissingInfoMapper;
+import com.zzsmart.qomo.kn.cost.manage.plugin.StandardCostService;
import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostCountService;
import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostStandardVersionService;
+import com.zzsmart.qomo.kn.cost.manage.vo.AppSceneCostCountVO;
import com.zzsmart.qomo.kn.cost.manage.vo.MissingComponentVO;
-import com.zzsmart.qomo.service.IDataFlowDefinitionService;
import com.zzsmart.qomo.service.IDataFlowInstanceService;
+import com.zzsmart.qomo.service.IFlowInstanceParameterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
+import java.util.Random;
/**
* @Description: app_scene_cost_count
@@ -34,8 +42,11 @@ public class AppSceneCostCountServiceImpl extends ServiceImpl implements IAppSceneCostHourRateService {
+ /**
+ * 查询满足条件的一条小时费率信息
+ *
+ * @param appSceneCostHourRate
+ * @return
+ */
+ @Override
+ public AppSceneCostHourRate getOneHourRateInfo(AppSceneCostHourRate appSceneCostHourRate) {
+ QueryWrapper queryWrapper = new QueryWrapper<>();
+ if(appSceneCostHourRate!=null){
+ if(appSceneCostHourRate.getYear()!=null){
+ queryWrapper.eq("year",appSceneCostHourRate.getYear());
+ }
+ if(appSceneCostHourRate.getCostCenterCode()!=null){
+ queryWrapper.eq("cost_center_code",appSceneCostHourRate.getCostCenterCode());
+ }
+ if(appSceneCostHourRate.getFactory()!=null){
+ queryWrapper.eq("factory",appSceneCostHourRate.getFactory());
+ }
+ queryWrapper.last("limit 1");
+ return this.getOne(queryWrapper);
+ }
+ return null;
+ }
}
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostMaterialProcessHoursServiceImpl.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostMaterialProcessHoursServiceImpl.java
deleted file mode 100644
index b2ff71b..0000000
--- a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostMaterialProcessHoursServiceImpl.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package com.zzsmart.qomo.kn.cost.manage.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostMaterialProcessHours;
-import com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostMaterialProcessHoursMapper;
-import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostMaterialProcessHoursService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @Description: app_scene_cost_material_process_hours
- * @Author: jeecg-boot
- * @Date: 2024-08-02
- * @Version: V1.0
- */
-@Service
-public class AppSceneCostMaterialProcessHoursServiceImpl extends ServiceImpl implements IAppSceneCostMaterialProcessHoursService {
- @Autowired
- AppSceneCostMaterialProcessHoursMapper costMaterialProcessHoursMapper;
-
- /**
- * 查询满足物料编号的工时工序
- *
- * @param materialNos
- */
- @Override
- public Map> getProcessHoursByMaterialNo(List materialNos) {
- Map> map = new HashMap<>();
- QueryWrapper queryWrapper = new QueryWrapper();
- if (materialNos != null && materialNos.size() > 0) {
- queryWrapper.in("material_code", materialNos);
- List costMaterialProcessHours = costMaterialProcessHoursMapper.selectList(queryWrapper);
- for (int i = 0; i < costMaterialProcessHours.size(); i++) {
- AppSceneCostMaterialProcessHours costMaterialProcessHours1 = costMaterialProcessHours.get(i);
- String materialCode = costMaterialProcessHours1.getMaterialCode();
- if (map.containsKey(materialCode)) {
- List list = map.get(materialCode);
- list.add(costMaterialProcessHours1);
- map.put(materialCode, list);
- } else {
- List list = new ArrayList<>();
- list.add(costMaterialProcessHours1);
- map.put(materialCode, list);
- }
- }
- }
- return map;
- }
-}
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostProductProcessMaintenanceServiceImpl.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostProductProcessMaintenanceServiceImpl.java
new file mode 100644
index 0000000..a6f42ac
--- /dev/null
+++ b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostProductProcessMaintenanceServiceImpl.java
@@ -0,0 +1,57 @@
+package com.zzsmart.qomo.kn.cost.manage.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostProductProcessMaintenance;
+import com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostProductProcessMaintenanceMapper;
+import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostProductProcessMaintenanceService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description: app_scene_cost_product_process_maintenance
+ * @Author: jeecg-boot
+ * @Date: 2024-09-08
+ * @Version: V1.0
+ */
+@Service
+public class AppSceneCostProductProcessMaintenanceServiceImpl extends ServiceImpl implements IAppSceneCostProductProcessMaintenanceService {
+
+ @Autowired
+ AppSceneCostProductProcessMaintenanceMapper costMaterialProcessHoursMapper;
+
+ /**
+ * 查询满足物料编号的工时工序
+ *
+ * @param materialNos
+ */
+ @Override
+ public Map> getProcessHoursByMaterialNo(List materialNos) {
+ Map> map = new HashMap<>();
+ QueryWrapper queryWrapper = new QueryWrapper();
+ if (materialNos != null && materialNos.size() > 0) {
+ queryWrapper.in("main_part_number", materialNos);
+ queryWrapper.orderByAsc("serial_number");
+ List costMaterialProcessHours = costMaterialProcessHoursMapper.selectList(queryWrapper);
+ for (int i = 0; i < costMaterialProcessHours.size(); i++) {
+ AppSceneCostProductProcessMaintenance costMaterialProcessHours1 = costMaterialProcessHours.get(i);
+ String materialCode = costMaterialProcessHours1.getMainPartNumber();
+ if (map.containsKey(materialCode)) {
+ List list = map.get(materialCode);
+ list.add(costMaterialProcessHours1);
+ map.put(materialCode, list);
+ } else {
+ List list = new ArrayList<>();
+ list.add(costMaterialProcessHours1);
+ map.put(materialCode, list);
+ }
+ }
+ }
+ return map;
+ }
+}
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostPurchasePriceServiceImpl.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostPurchaseRecordServiceImpl.java
similarity index 58%
rename from qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostPurchasePriceServiceImpl.java
rename to qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostPurchaseRecordServiceImpl.java
index 230f850..102bf5d 100644
--- a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostPurchasePriceServiceImpl.java
+++ b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostPurchaseRecordServiceImpl.java
@@ -1,29 +1,28 @@
package com.zzsmart.qomo.kn.cost.manage.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostPurchasePrice;
-import com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostPurchasePriceMapper;
-import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostPurchasePriceService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostPurchaseRecord;
+import com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostPurchaseRecordMapper;
+import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostPurchaseRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
- * @Description: app_scene_cost_purchase_price
+ * @Description: app_scene_cost_purchase_record
* @Author: jeecg-boot
- * @Date: 2024-08-02
+ * @Date: 2024-09-08
* @Version: V1.0
*/
@Service
-public class AppSceneCostPurchasePriceServiceImpl extends ServiceImpl implements IAppSceneCostPurchasePriceService {
+public class AppSceneCostPurchaseRecordServiceImpl extends ServiceImpl implements IAppSceneCostPurchaseRecordService {
@Autowired
- AppSceneCostPurchasePriceMapper costPurchasePriceMapper;
+ AppSceneCostPurchaseRecordMapper appSceneCostPurchaseRecordMapper;
/**
* 查询满足物料编号的最低采购价
@@ -33,13 +32,13 @@ public class AppSceneCostPurchasePriceServiceImpl extends ServiceImpl getMinCostPurchasePriceByMaterialNo(List materialNos) {
Map map = new HashMap<>();
- QueryWrapper queryWrapper = new QueryWrapper();
+ QueryWrapper queryWrapper = new QueryWrapper();
if (materialNos != null && materialNos.size() > 0) {
- queryWrapper.in("material_code", materialNos);
- List costPurchasePrices = costPurchasePriceMapper.selectList(queryWrapper);
+ queryWrapper.in("INFNR", materialNos);
+ List costPurchasePrices = appSceneCostPurchaseRecordMapper.selectList(queryWrapper);
for (int i = 0; i < costPurchasePrices.size(); i++) {
- AppSceneCostPurchasePrice costPurchasePrice = costPurchasePrices.get(i);
- map.put(costPurchasePrice.getMaterialCode(), costPurchasePrice.getMinPurchasePrice());
+ AppSceneCostPurchaseRecord costPurchasePrice = costPurchasePrices.get(i);
+ map.put(costPurchasePrice.getInfnr(), costPurchasePrice.getNetpr());
}
}
return map;
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostResultValueServiceImpl.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostResultValueServiceImpl.java
index 8fa6839..ed9693f 100644
--- a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostResultValueServiceImpl.java
+++ b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostResultValueServiceImpl.java
@@ -28,19 +28,19 @@ public class AppSceneCostResultValueServiceImpl extends ServiceImpl getResultValueByTopMaterialNo(String topMaterialCode, String lastTaskType, String flowInstanceId) {
+ public List getResultValueByTopMaterialNo(String topMaterialCode, String taskType, String flowInstanceId) {
List result = new ArrayList<>();
QueryWrapper queryWrapper = new QueryWrapper<>();
- if (topMaterialCode != null && !topMaterialCode.equals("") && lastTaskType != null && !lastTaskType.equals("") && flowInstanceId != null && !flowInstanceId.equals("")) {
+ if (topMaterialCode != null && !topMaterialCode.equals("") && taskType != null && !taskType.equals("") && flowInstanceId != null && !flowInstanceId.equals("")) {
//查询某个流程节点(即执行任务)的结果值
- queryWrapper.eq("belong_top_material_no", topMaterialCode).eq("task_type", lastTaskType).eq("flow_instance_id", flowInstanceId);
+ queryWrapper.eq("belong_top_material_no", topMaterialCode).eq("task_type", taskType).eq("flow_instance_id", flowInstanceId);
result = appSceneCostResultValueMapper.selectList(queryWrapper);
- } else if (topMaterialCode != null && !topMaterialCode.equals("") && flowInstanceId != null && !flowInstanceId.equals("") && lastTaskType == null) {
+ } else if (topMaterialCode != null && !topMaterialCode.equals("") && flowInstanceId != null && !flowInstanceId.equals("") && taskType == null) {
//查询BOM物料所有的树节点信息
queryWrapper.eq("belong_top_material_no", topMaterialCode).eq("flow_instance_id", flowInstanceId).isNull("task_type");
result = appSceneCostResultValueMapper.selectList(queryWrapper);
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostStandardResultServiceImpl.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostStandardResultServiceImpl.java
new file mode 100644
index 0000000..7f27916
--- /dev/null
+++ b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostStandardResultServiceImpl.java
@@ -0,0 +1,21 @@
+package com.zzsmart.qomo.kn.cost.manage.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostStandardDetail;
+import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostStandardResult;
+import com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostStandardDetailMapper;
+import com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostStandardResultMapper;
+import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostStandardDetailService;
+import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostStandardResultService;
+import org.springframework.stereotype.Service;
+
+/**
+ * @Description: app_scene_cost_standard_detail
+ * @Author: jeecg-boot
+ * @Date: 2024-07-31
+ * @Version: V1.0
+ */
+@Service
+public class AppSceneCostStandardResultServiceImpl extends ServiceImpl implements IAppSceneCostStandardResultService {
+
+}
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/vo/AppSceneCostCountVO.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/vo/AppSceneCostCountVO.java
index c9fc892..6546b30 100644
--- a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/vo/AppSceneCostCountVO.java
+++ b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/vo/AppSceneCostCountVO.java
@@ -1,12 +1,66 @@
package com.zzsmart.qomo.kn.cost.manage.vo;
-import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostCount;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
import lombok.Data;
+import lombok.NoArgsConstructor;
@Data
-public class AppSceneCostCountVO extends AppSceneCostCount {
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class AppSceneCostCountVO {
+ /**
+ * 主键
+ */
+ @ApiModelProperty(value = "主键")
+ private Integer id;
+ /**
+ * 物料编号
+ */
+ @ApiModelProperty(value = "物料编号")
+ private String materialNo;
+ /**
+ * 图号
+ */
+ @ApiModelProperty(value = "图号")
+ private String drawingNo;
+ /**
+ * stage
+ */
+ @ApiModelProperty(value = "stage")
+ private String stage;
+ /**
+ * 标准成本计算流程id
+ */
+ @ApiModelProperty(value = "标准成本计算流程id")
+ private Integer flowDefinitionId;
+ /**
+ * year
+ */
+ @ApiModelProperty(value = "year")
+ private String year;
+ /**
+ * 状态
+ */
+ @ApiModelProperty(value = "状态")
+ private Integer status;
+ /**
+ * 模型版本
+ */
+ @ApiModelProperty(value = "标准成本版本")
+ private String costVersion;
/**
* 状态名称
*/
public String statusName;
+ /**
+ * 成本中心
+ */
+ public String costCenter;
+ /**
+ * 工厂
+ */
+ public String factory;
}
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/vo/AppSceneCostStandardResultVO.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/vo/AppSceneCostStandardResultVO.java
new file mode 100644
index 0000000..8d3e5ab
--- /dev/null
+++ b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/vo/AppSceneCostStandardResultVO.java
@@ -0,0 +1,209 @@
+package com.zzsmart.qomo.kn.cost.manage.vo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+public class AppSceneCostStandardResultVO {
+
+ /**
+ * id
+ */
+ @TableId(type = IdType.ASSIGN_ID)
+ @ApiModelProperty(value = "id")
+ private String id;
+ /**
+ * 图号
+ */
+ @Excel(name = "图号", width = 15)
+ @ApiModelProperty(value = "图号")
+ private String figureNumber;
+ /**
+ * 物料号,关联kn_new_sap_mara表matnr字段
+ */
+ @Excel(name = "物料号,关联kn_new_sap_mara表matnr字段", width = 15)
+ @ApiModelProperty(value = "物料号,关联kn_new_sap_mara表matnr字段")
+ private String materialNumber;
+ /**
+ * 物料名称
+ */
+ @Excel(name = "物料名称", width = 15)
+ @ApiModelProperty(value = "物料名称")
+ private String materialName;
+ /**
+ * 父类物料号
+ */
+ @Excel(name = "父类物料号", width = 15)
+ @ApiModelProperty(value = "父类物料号")
+ private String parentMaterialNumber;
+ /**
+ * 版本号
+ */
+ @Excel(name = "版本号", width = 15)
+ @ApiModelProperty(value = "版本号")
+ private String versionNumber;
+ /**
+ * 层级
+ */
+ @Excel(name = "层级", width = 15)
+ @ApiModelProperty(value = "层级")
+ private Integer level;
+ /**
+ * 序号
+ */
+ @Excel(name = "序号", width = 15)
+ @ApiModelProperty(value = "序号")
+ private Integer sort;
+ /**
+ * 用量
+ */
+ @Excel(name = "用量", width = 15)
+ @ApiModelProperty(value = "用量")
+ private Double dosage;
+ /**
+ * 单位
+ */
+ @Excel(name = "单位", width = 15)
+ @ApiModelProperty(value = "单位")
+ private String unit;
+ /**
+ * 本阶材料费
+ */
+ @Excel(name = "本阶材料费", width = 15)
+ @ApiModelProperty(value = "本阶材料费")
+ private BigDecimal materialCost;
+ /**
+ * 本阶人工费
+ */
+ @Excel(name = "本阶人工陈本", width = 15)
+ @ApiModelProperty(value = "本阶人工成本")
+ private BigDecimal laborCost;
+ /**
+ * 本阶辅料费
+ */
+ @Excel(name = "本阶辅料费", width = 15)
+ @ApiModelProperty(value = "本阶辅料费")
+ private BigDecimal supplyMaterialCost;
+ /**
+ * 本阶机器折旧费
+ */
+ @Excel(name = "本阶机器折旧费", width = 15)
+ @ApiModelProperty(value = "本阶机器折旧费")
+ private BigDecimal equipmentCost;
+ /**
+ * 本阶水电费(燃动费)
+ */
+ @Excel(name = "本阶水电费(燃动费)", width = 15)
+ @ApiModelProperty(value = "本阶水电费(燃动费)")
+ private BigDecimal driveCost;
+ /**
+ * 本阶其他制造费
+ */
+ @Excel(name = "本阶其他费用", width = 15)
+ @ApiModelProperty(value = "本阶其他费用")
+ private BigDecimal otherCost;
+ /**
+ * 本阶物流费
+ */
+ @Excel(name = "本阶物流费", width = 15)
+ @ApiModelProperty(value = "本阶物流费")
+ private BigDecimal logisticsCost;
+ /**
+ * 累计物料成本
+ */
+ @Excel(name = "累计物料成本", width = 15)
+ @ApiModelProperty(value = "累计物料成本")
+ private BigDecimal totalMaterialCost;
+ /**
+ * 累计人工成本
+ */
+ @Excel(name = "累计人工成本", width = 15)
+ @ApiModelProperty(value = "累计人工成本")
+ private BigDecimal totalLaborCost;
+ /**
+ * 累计辅料费
+ */
+ @Excel(name = "累计辅料费", width = 15)
+ @ApiModelProperty(value = "累计辅料费")
+ private BigDecimal totalSupplyMaterialCost;
+ /**
+ * 累计机器折旧费
+ */
+ @Excel(name = "累计机器折旧费", width = 15)
+ @ApiModelProperty(value = "累计机器折旧费")
+ private BigDecimal totalEquipmentCost;
+ /**
+ * 累计水电费(燃动费)
+ */
+ @Excel(name = "累计水电费(燃动费)", width = 15)
+ @ApiModelProperty(value = "累计水电费(燃动费)")
+ private BigDecimal totalDriveCost;
+ /**
+ * 累计其他费用
+ */
+ @Excel(name = "累计其他费用", width = 15)
+ @ApiModelProperty(value = "累计其他费用")
+ private BigDecimal totalOtherCost;
+ /**
+ * 累计物流费用
+ */
+ @Excel(name = "累计物流费用", width = 15)
+ @ApiModelProperty(value = "累计物流费用")
+ private BigDecimal totalLogisticsCost;
+ /**
+ * 本阶标准成本
+ */
+ @Excel(name = "本阶标准成本", width = 15)
+ @ApiModelProperty(value = "本阶标准成本")
+ private BigDecimal currentStandardCost;
+ /**
+ * 累计标准成本
+ */
+ @Excel(name = "累计标准成本", width = 15)
+ @ApiModelProperty(value = "累计标准成本")
+ private BigDecimal totalStandardCost;
+ /**
+ * 创建人
+ */
+ @ApiModelProperty(value = "创建人")
+ private String createBy;
+ /**
+ * 创建日期
+ */
+ @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @ApiModelProperty(value = "创建日期")
+ private Date createTime;
+ /**
+ * 修改人
+ */
+ @ApiModelProperty(value = "修改人")
+ private String updateBy;
+ /**
+ * 修改日期
+ */
+ @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @ApiModelProperty(value = "修改日期")
+ private Date updateTime;
+ /**
+ * 备注
+ */
+ @Excel(name = "备注", width = 15)
+ @ApiModelProperty(value = "备注")
+ private String remark;
+}
diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/vo/CostModelDefinitionVO.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/vo/CostModelDefinitionVO.java
new file mode 100644
index 0000000..2ed62fc
--- /dev/null
+++ b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/vo/CostModelDefinitionVO.java
@@ -0,0 +1,44 @@
+package com.zzsmart.qomo.kn.cost.manage.vo;
+
+import com.zzsmart.qomo.common.enums.ReleaseState;
+import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 模型信息封装
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class CostModelDefinitionVO extends AppSceneCostModel {
+ @ApiModelProperty("encoding")
+ private String code;
+ @ApiModelProperty("flow definition name")
+ private String name;
+ @ApiModelProperty("flow definition version")
+ private Integer version;
+ @ApiModelProperty("flow definition release state: 0:offline,1:online")
+ private ReleaseState releaseState;
+ @ApiModelProperty("定时调度表达式")
+ private String scheduleCron;
+ @ApiModelProperty("任务调度模式(1任务队列领取模式(推荐) 2所有集群服务器均可同时运行 3只有主服务器可运行(主服务器失败时其他服务器接管) 4由调度服务器统一调度)")
+ private Integer scheduleMode;
+ @ApiModelProperty("依赖周期(分钟)")
+ private Integer dependencyCycle;
+ @ApiModelProperty("在任务队列模式下可以根据任务重要性来领取任务(10为最高)")
+ private Integer taskImportance;
+ @ApiModelProperty("运行方式(0 禁用 1手动触发 2定时自动调度 3依赖上级流程)")
+ private Integer runMode;
+ @ApiModelProperty("project id")
+ private Integer projectId;
+ @ApiModelProperty("project code")
+ private String projectCode;
+ @ApiModelProperty("环境配置ID")
+ private Integer environmentId;
+ @ApiModelProperty("租户ID")
+ private Integer tenantId;
+}