From 38186530c6d29ce250db01894871144c871ad7c2 Mon Sep 17 00:00:00 2001 From: bgy <1322446236@qq.com> Date: Tue, 17 Sep 2024 00:02:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A0=87=E5=87=86=E6=88=90?= =?UTF-8?q?=E6=9C=AC=E8=AE=A1=E7=AE=97=E5=8A=9F=E8=83=BD=E3=80=82=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=A0=87=E5=87=86=E6=88=90=E6=9C=AC=E5=8D=95=E8=A1=8C?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application-dev.yml | 4 +- .../AppSceneCostCountController.java | 2 +- .../AppSceneCostMaterialBomController.java | 190 ----- ...eneCostMaterialProcessHoursController.java | 159 ---- .../AppSceneCostPurchasePriceController.java | 159 ---- ...AppSceneCostStandardResultController.java} | 22 +- .../entity/AppSceneCostMaterialBom.java | 261 ------ .../AppSceneCostMaterialProcessHours.java | 129 --- ...AppSceneCostProductProcessMaintenance.java | 4 +- .../entity/AppSceneCostPurchasePrice.java | 173 ---- .../entity/AppSceneCostResultValue.java | 4 +- .../entity/AppSceneCostStandardResult.java | 365 +++++++++ .../AppSceneCostBomRelevancyMapper.java | 29 +- .../mapper/AppSceneCostHourRateMapper.java | 3 + .../mapper/AppSceneCostMaterialBomMapper.java | 34 - ...ppSceneCostMaterialProcessHoursMapper.java | 14 - .../AppSceneCostPurchasePriceMapper.java | 14 - .../AppSceneCostStandardResultMapper.java | 15 + .../xml/AppSceneCostBomRelevancyMapper.xml | 2 +- .../xml/AppSceneCostMaterialBomMapper.xml | 5 - ...AppSceneCostMaterialProcessHoursMapper.xml | 5 - ...l => AppSceneCostStandardResultMapper.xml} | 2 +- .../manage/plugin/StandardCostService.java | 741 ++++++++++-------- .../IAppSceneCostBomRelevancyService.java | 15 + .../service/IAppSceneCostCountService.java | 3 +- .../service/IAppSceneCostHourRateService.java | 7 +- .../IAppSceneCostMaterialBomService.java | 28 - ...pSceneCostMaterialProcessHoursService.java | 22 - ...eCostProductProcessMaintenanceService.java | 9 +- .../IAppSceneCostPurchasePriceService.java | 22 - .../IAppSceneCostPurchaseRecordService.java | 8 + .../IAppSceneCostStandardResultService.java | 14 + .../AppSceneCostBomRelevancyServiceImpl.java | 43 +- .../impl/AppSceneCostCountServiceImpl.java | 36 +- .../impl/AppSceneCostHourRateServiceImpl.java | 27 + .../AppSceneCostMaterialBomServiceImpl.java | 60 -- ...neCostMaterialProcessHoursServiceImpl.java | 55 -- ...tProductProcessMaintenanceServiceImpl.java | 42 +- .../AppSceneCostPurchasePriceServiceImpl.java | 47 -- ...AppSceneCostPurchaseRecordServiceImpl.java | 28 + .../AppSceneCostResultValueServiceImpl.java | 10 +- ...AppSceneCostStandardResultServiceImpl.java | 21 + .../cost/manage/vo/AppSceneCostCountVO.java | 58 +- .../cost/manage/vo/CostModelDefinitionVO.java | 1 - 44 files changed, 1137 insertions(+), 1755 deletions(-) delete mode 100644 qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostMaterialBomController.java delete mode 100644 qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostMaterialProcessHoursController.java delete mode 100644 qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostPurchasePriceController.java rename qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/{AppSceneCostStandardDetailController.java => AppSceneCostStandardResultController.java} (86%) delete mode 100644 qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/entity/AppSceneCostMaterialBom.java delete mode 100644 qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/entity/AppSceneCostMaterialProcessHours.java delete mode 100644 qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/entity/AppSceneCostPurchasePrice.java create mode 100644 qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/entity/AppSceneCostStandardResult.java delete mode 100644 qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/AppSceneCostMaterialBomMapper.java delete mode 100644 qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/AppSceneCostMaterialProcessHoursMapper.java delete mode 100644 qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/AppSceneCostPurchasePriceMapper.java create mode 100644 qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/AppSceneCostStandardResultMapper.java delete mode 100644 qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/xml/AppSceneCostMaterialBomMapper.xml delete mode 100644 qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/xml/AppSceneCostMaterialProcessHoursMapper.xml rename qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/xml/{AppSceneCostPurchasePriceMapper.xml => AppSceneCostStandardResultMapper.xml} (88%) delete mode 100644 qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostMaterialBomService.java delete mode 100644 qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostMaterialProcessHoursService.java delete mode 100644 qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostPurchasePriceService.java create mode 100644 qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostStandardResultService.java delete mode 100644 qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostMaterialBomServiceImpl.java delete mode 100644 qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostMaterialProcessHoursServiceImpl.java delete mode 100644 qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostPurchasePriceServiceImpl.java create mode 100644 qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostStandardResultServiceImpl.java 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 121138b..d5f57ae 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 @@ -296,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/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/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/AppSceneCostStandardDetailController.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostStandardResultController.java similarity index 86% 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..4cb2fa3 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,11 +4,11 @@ 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 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; @@ -31,14 +31,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,10 +47,10 @@ 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); + 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); return Result.OK(pageList); } // @@ -140,8 +140,8 @@ 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/AppSceneCostPurchasePriceMapper.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/AppSceneCostPurchasePriceMapper.java deleted file mode 100644 index 6914312..0000000 --- a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/AppSceneCostPurchasePriceMapper.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.AppSceneCostPurchasePrice; - -/** - * @Description: app_scene_cost_purchase_price - * @Author: jeecg-boot - * @Date: 2024-08-02 - * @Version: V1.0 - */ -public interface AppSceneCostPurchasePriceMapper 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/xml/AppSceneCostBomRelevancyMapper.xml b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/xml/AppSceneCostBomRelevancyMapper.xml index 4d8a366..5d21763 100644 --- a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/xml/AppSceneCostBomRelevancyMapper.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/AppSceneCostMaterialBomMapper.xml b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/xml/AppSceneCostMaterialBomMapper.xml deleted file mode 100644 index 23d4a07..0000000 --- a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/xml/AppSceneCostMaterialBomMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ 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/AppSceneCostMaterialProcessHoursMapper.xml deleted file mode 100644 index f86ee8c..0000000 --- a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/xml/AppSceneCostMaterialProcessHoursMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ 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/AppSceneCostStandardResultMapper.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/AppSceneCostStandardResultMapper.xml index 6571f46..5d66ca3 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/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 6e5e59d..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,12 +110,400 @@ public class StandardCostService { //1.查询出所有满足物料编号的物料(BOM物料) String sql = flowTaskInfoVO.getSqlString(); log.info("传递过来的SQL语句:" + sql); - + //获取顶部物料下所有的物料信息并存储到新的表中 + 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); + } + /** * 获取任务流程相关信息 * @@ -182,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); @@ -210,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); } @@ -260,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); } @@ -328,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); } @@ -476,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("计算成本失败"); @@ -619,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++) { @@ -652,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 index bad9322..dc95f4b 100644 --- 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 @@ -3,6 +3,8 @@ 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 @@ -10,5 +12,18 @@ import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostBomRelevancy; * @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 index 76ce058..0a1b04f 100644 --- 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 @@ -3,12 +3,19 @@ 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 + * @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/IAppSceneCostPurchasePriceService.java deleted file mode 100644 index ee33790..0000000 --- a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostPurchasePriceService.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.AppSceneCostPurchasePrice; - -import java.math.BigDecimal; -import java.util.List; -import java.util.Map; - -/** - * @Description: app_scene_cost_purchase_price - * @Author: jeecg-boot - * @Date: 2024-08-02 - * @Version: V1.0 - */ -public interface IAppSceneCostPurchasePriceService extends IService { - /** - * 查询满足物料编号的最低采购价 - */ - Map getMinCostPurchasePriceByMaterialNo(List materialNos); - -} diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostPurchaseRecordService.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostPurchaseRecordService.java index ce23c84..f0bd662 100644 --- a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostPurchaseRecordService.java +++ b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/IAppSceneCostPurchaseRecordService.java @@ -3,6 +3,10 @@ package com.zzsmart.qomo.kn.cost.manage.service; import com.baomidou.mybatisplus.extension.service.IService; 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_record * @Author: jeecg-boot @@ -10,5 +14,9 @@ import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostPurchaseRecord; * @Version: V1.0 */ public interface IAppSceneCostPurchaseRecordService extends IService { + /** + * 查询满足物料编号的最低采购价 + */ + Map getMinCostPurchasePriceByMaterialNo(List materialNos); } 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/AppSceneCostBomRelevancyServiceImpl.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostBomRelevancyServiceImpl.java index a9b0247..2c9f11d 100644 --- a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostBomRelevancyServiceImpl.java +++ b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostBomRelevancyServiceImpl.java @@ -1,19 +1,60 @@ 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.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; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import java.util.List; + /** * @Description: app_scene_cost_bom_relevancy * @Author: jeecg-boot - * @Date: 2024-09-08 + * @Date: 2024-09-08 * @Version: V1.0 */ @Service public class AppSceneCostBomRelevancyServiceImpl extends ServiceImpl implements IAppSceneCostBomRelevancyService { + /** + * 物料BOM信息 + */ + @Autowired + AppSceneCostBomRelevancyMapper costMaterialBomMapper; + + /** + * 分页查询 + * + * @param materialNumber + * @return + */ + @Override + public List queryListResult(String materialNumber) { + QueryWrapper queryWrapper = new QueryWrapper(); + if (StrUtil.isNotEmpty(materialNumber)) { + // 物料号 + queryWrapper.like("material_code", materialNumber); + } + List list = costMaterialBomMapper.selectList(queryWrapper); + return list; + } + + /** + * 查询最顶层物料编号下所有的物料 + * + * @param topMaterialCode + * @return + */ + @Override + public List queryAllBomInfoByTopMaterialCode(String topMaterialCode) { + List childrens = costMaterialBomMapper.findChildrenByParentId(topMaterialCode); + //TODO 循环遍历查出所有的物料下的物料(包含最上层的物料) + //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 b90efaf..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 @@ -7,14 +7,17 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 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.IDataFlowInstanceService; import com.zzsmart.qomo.service.IFlowInstanceParameterService; @@ -24,6 +27,7 @@ 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 @@ -41,8 +45,7 @@ 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/AppSceneCostMaterialBomServiceImpl.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostMaterialBomServiceImpl.java deleted file mode 100644 index cbd4bef..0000000 --- a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostMaterialBomServiceImpl.java +++ /dev/null @@ -1,60 +0,0 @@ -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 org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; - -import java.util.List; - -/** - * @Description: app_scene_cost_material_bom - * @Author: jeecg-boot - * @Date: 2024-08-02 - * @Version: V1.0 - */ -@Service -public class AppSceneCostMaterialBomServiceImpl extends ServiceImpl implements IAppSceneCostMaterialBomService { - @Autowired - AppSceneCostMaterialBomMapper costMaterialBomMapper; - - /** - * 分页查询 - * - * @param materialNumber - * @return - */ - @Override - public List queryListResult(String materialNumber) { - QueryWrapper queryWrapper = new QueryWrapper(); - if (StrUtil.isNotEmpty(materialNumber)) { - // 物料号 - queryWrapper.like("material_code", materialNumber); - } - List list = costMaterialBomMapper.selectList(queryWrapper); - return list; - } - - /** - * 查询最顶层物料编号下所有的物料 - * - * @param topMaterialCode - * @return - */ - @Override - public List queryAllBomInfoBytopMaterialCode(String topMaterialCode) { - QueryWrapper queryWrapper = new QueryWrapper(); - //TODO 循环遍历查出所有的物料下的物料(包含最上层的物料) -// if (StrUtil.isNotEmpty(topMaterialCode)) { -// // 物料号 -// queryWrapper.like("material_code", topMaterialCode); -// } - List list = costMaterialBomMapper.selectList(queryWrapper); - return list; - } -} 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 index 5ecdd44..a6f42ac 100644 --- 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 @@ -1,19 +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 com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +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 + * @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/AppSceneCostPurchasePriceServiceImpl.java deleted file mode 100644 index 230f850..0000000 --- a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostPurchasePriceServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -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 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 - * @Author: jeecg-boot - * @Date: 2024-08-02 - * @Version: V1.0 - */ -@Service -public class AppSceneCostPurchasePriceServiceImpl extends ServiceImpl implements IAppSceneCostPurchasePriceService { - @Autowired - AppSceneCostPurchasePriceMapper costPurchasePriceMapper; - - /** - * 查询满足物料编号的最低采购价 - * - * @param materialNos - */ - @Override - public Map getMinCostPurchasePriceByMaterialNo(List materialNos) { - Map map = new HashMap<>(); - QueryWrapper queryWrapper = new QueryWrapper(); - if (materialNos != null && materialNos.size() > 0) { - queryWrapper.in("material_code", materialNos); - List costPurchasePrices = costPurchasePriceMapper.selectList(queryWrapper); - for (int i = 0; i < costPurchasePrices.size(); i++) { - AppSceneCostPurchasePrice costPurchasePrice = costPurchasePrices.get(i); - map.put(costPurchasePrice.getMaterialCode(), costPurchasePrice.getMinPurchasePrice()); - } - } - return map; - } -} diff --git a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostPurchaseRecordServiceImpl.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostPurchaseRecordServiceImpl.java index 1a4d138..102bf5d 100644 --- a/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostPurchaseRecordServiceImpl.java +++ b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/service/impl/AppSceneCostPurchaseRecordServiceImpl.java @@ -1,11 +1,18 @@ 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.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 java.math.BigDecimal; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + /** * @Description: app_scene_cost_purchase_record * @Author: jeecg-boot @@ -14,5 +21,26 @@ import org.springframework.stereotype.Service; */ @Service public class AppSceneCostPurchaseRecordServiceImpl extends ServiceImpl implements IAppSceneCostPurchaseRecordService { + @Autowired + AppSceneCostPurchaseRecordMapper appSceneCostPurchaseRecordMapper; + /** + * 查询满足物料编号的最低采购价 + * + * @param materialNos + */ + @Override + public Map getMinCostPurchasePriceByMaterialNo(List materialNos) { + Map map = new HashMap<>(); + QueryWrapper queryWrapper = new QueryWrapper(); + if (materialNos != null && materialNos.size() > 0) { + queryWrapper.in("INFNR", materialNos); + List costPurchasePrices = appSceneCostPurchaseRecordMapper.selectList(queryWrapper); + for (int i = 0; i < costPurchasePrices.size(); i++) { + 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/CostModelDefinitionVO.java b/qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/vo/CostModelDefinitionVO.java index 35bf7b9..2ed62fc 100644 --- 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 @@ -12,7 +12,6 @@ import lombok.NoArgsConstructor; * 模型信息封装 */ @Data -@Builder @AllArgsConstructor @NoArgsConstructor public class CostModelDefinitionVO extends AppSceneCostModel {