修改标准成本计算功能。修改标准成本单行查询功能 #16

Merged
bgy merged 2 commits from bgy into dev 2024-09-16 16:38:59 +00:00
46 changed files with 1484 additions and 1791 deletions
@@ -297,7 +297,7 @@ jeecg:
webapp: /opt/webapp webapp: /opt/webapp
shiro: shiro:
excludeUrls: /api/internalService/**,/test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**,/api/getUserInfo,/sys/sysDepart/**,/taskSocket/**,/flowSocket/**,/dataCheck/** excludeUrls: /api/internalService/**,/test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**,/api/getUserInfo,/sys/sysDepart/**,/taskSocket/**,/flowSocket/**,/dataCheck/**
# excludeUrls: /**/**,/**/**/** # excludeUrls: /**/**,/**/**/**
#阿里云oss存储和大鱼短信秘钥配置 #阿里云oss存储和大鱼短信秘钥配置
oss: oss:
@@ -81,7 +81,7 @@ public class AppSceneCostCountController extends JeecgController<AppSceneCostCou
@ApiOperation(value = "添加标准成本计算任务", notes = "添加标准成本计算任务") @ApiOperation(value = "添加标准成本计算任务", notes = "添加标准成本计算任务")
// //@RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_count:addCostCountTask") // //@RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_count:addCostCountTask")
@PostMapping(value = "/addCostCountTask") @PostMapping(value = "/addCostCountTask")
public Result<String> addCostCountTask(@RequestBody AppSceneCostCount appSceneCostCount) { public Result<String> addCostCountTask(@RequestBody AppSceneCostCountVO appSceneCostCount) {
appSceneCostCountService.addCostCountTask(appSceneCostCount); appSceneCostCountService.addCostCountTask(appSceneCostCount);
return Result.OK("添加成功!"); return Result.OK("添加成功!");
} }
@@ -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<AppSceneCostMaterialBom, IAppSceneCostMaterialBomService> {
@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<IPage<AppSceneCostMaterialBom>> queryPageList(AppSceneCostMaterialBom costMaterialBom,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<AppSceneCostMaterialBom> queryWrapper = QueryGenerator.initQueryWrapper(costMaterialBom, req.getParameterMap());
Page<AppSceneCostMaterialBom> page = new Page<AppSceneCostMaterialBom>(pageNo, pageSize);
IPage<AppSceneCostMaterialBom> pageList = costMaterialBomService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 列表查询
*
* @return
*/
@ApiOperation(value="物料bom列表查询", notes="物料bom列表查询")
@GetMapping(value = "/list")
public Result<List<AppSceneCostMaterialBom>> queryList(@RequestParam(name = "materialNumber",required = false) String materialNumber) {
List<AppSceneCostMaterialBom> 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<IPage<AppSceneCostMaterialBom>> queryPageList(AppSceneCostMaterialBom appSceneCostMaterialBom,
// @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
// @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
// HttpServletRequest req) {
// QueryWrapper<AppSceneCostMaterialBom> queryWrapper = QueryGenerator.initQueryWrapper(appSceneCostMaterialBom, req.getParameterMap());
// Page<AppSceneCostMaterialBom> page = new Page<AppSceneCostMaterialBom>(pageNo, pageSize);
// IPage<AppSceneCostMaterialBom> 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<String> 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<String> 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<String> 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<String> 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<AppSceneCostMaterialBom> 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);
// }
}
@@ -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<AppSceneCostMaterialProcessHours, IAppSceneCostMaterialProcessHoursService> {
@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<IPage<AppSceneCostMaterialProcessHours>> queryPageList(AppSceneCostMaterialProcessHours appSceneCostMaterialProcessHours, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
QueryWrapper<AppSceneCostMaterialProcessHours> queryWrapper = QueryGenerator.initQueryWrapper(appSceneCostMaterialProcessHours, req.getParameterMap());
Page<AppSceneCostMaterialProcessHours> page = new Page<AppSceneCostMaterialProcessHours>(pageNo, pageSize);
IPage<AppSceneCostMaterialProcessHours> 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<String> 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<String> 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<String> 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<String> 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<AppSceneCostMaterialProcessHours> 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);
// }
}
@@ -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<AppSceneCostPurchasePrice, IAppSceneCostPurchasePriceService> {
@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<IPage<AppSceneCostPurchasePrice>> queryPageList(AppSceneCostPurchasePrice appSceneCostPurchasePrice, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
QueryWrapper<AppSceneCostPurchasePrice> queryWrapper = QueryGenerator.initQueryWrapper(appSceneCostPurchasePrice, req.getParameterMap());
Page<AppSceneCostPurchasePrice> page = new Page<AppSceneCostPurchasePrice>(pageNo, pageSize);
IPage<AppSceneCostPurchasePrice> 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<String> 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<String> 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<String> 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<String> 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<AppSceneCostPurchasePrice> 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);
}
}
@@ -4,14 +4,16 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostStandardDetail; import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostStandardDetail;
import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostStandardDetailService; import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostStandardResult;
import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostStandardResultService;
import com.zzsmart.qomo.kn.cost.manage.vo.AppSceneCostStandardResultVO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.query.QueryGenerator;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@@ -20,6 +22,8 @@ import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
/** /**
* @Description: app_scene_cost_standard_detail * @Description: app_scene_cost_standard_detail
@@ -31,14 +35,14 @@ import javax.servlet.http.HttpServletRequest;
@RestController @RestController
@RequestMapping("//costStandardDetail") @RequestMapping("//costStandardDetail")
@Slf4j @Slf4j
public class AppSceneCostStandardDetailController extends JeecgController<AppSceneCostStandardDetail, IAppSceneCostStandardDetailService> { public class AppSceneCostStandardResultController extends JeecgController<AppSceneCostStandardResult, IAppSceneCostStandardResultService> {
@Autowired @Autowired
private IAppSceneCostStandardDetailService appSceneCostStandardDetailService; private IAppSceneCostStandardResultService appSceneCostStandardResultService;
/** /**
* 分页列表查询 * 分页列表查询
* *
* @param appSceneCostStandardDetail * @param appSceneCostStandardResult
* @param pageNo * @param pageNo
* @param pageSize * @param pageSize
* @param req * @param req
@@ -47,11 +51,47 @@ public class AppSceneCostStandardDetailController extends JeecgController<AppSce
//@AutoLog(value = "app_scene_cost_standard_detail-分页列表查询") //@AutoLog(value = "app_scene_cost_standard_detail-分页列表查询")
@ApiOperation(value = "app_scene_cost_standard_detail-分页列表查询", notes = "app_scene_cost_standard_detail-分页列表查询") @ApiOperation(value = "app_scene_cost_standard_detail-分页列表查询", notes = "app_scene_cost_standard_detail-分页列表查询")
@GetMapping(value = "/list") @GetMapping(value = "/list")
public Result<IPage<AppSceneCostStandardDetail>> queryPageList(AppSceneCostStandardDetail appSceneCostStandardDetail, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) { public Result<IPage<AppSceneCostStandardResultVO>> queryPageList(AppSceneCostStandardResult appSceneCostStandardResult, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
QueryWrapper<AppSceneCostStandardDetail> queryWrapper = QueryGenerator.initQueryWrapper(appSceneCostStandardDetail, req.getParameterMap()); QueryWrapper<AppSceneCostStandardResult> queryWrapper = QueryGenerator.initQueryWrapper(appSceneCostStandardResult, req.getParameterMap());
Page<AppSceneCostStandardDetail> page = new Page<AppSceneCostStandardDetail>(pageNo, pageSize); Page<AppSceneCostStandardResult> page = new Page<AppSceneCostStandardResult>(pageNo, pageSize);
IPage<AppSceneCostStandardDetail> pageList = appSceneCostStandardDetailService.page(page, queryWrapper); IPage<AppSceneCostStandardResult> pageList = appSceneCostStandardResultService.page(page, queryWrapper);
return Result.OK(pageList); IPage<AppSceneCostStandardResultVO> newpageList = new Page<>();
BeanUtils.copyProperties(pageList, newpageList);
List<AppSceneCostStandardResult> list = pageList.getRecords();
List<AppSceneCostStandardResultVO> newList = new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
AppSceneCostStandardResult result = list.get(i);
AppSceneCostStandardResultVO costStandardDetail = AppSceneCostStandardResultVO.builder()
.materialNumber(result.getMaterialNumber())
// .materialName(oldAppSceneCostResultValue.getMarterialNo())
.parentMaterialNumber(result.getParentMatnr())
.versionNumber(result.getVersionNumber())
// .level()
// .sort()
// .figureNumber()
// .dosage(oldAppSceneCostResultValue.getNum() != null ? new Double(oldAppSceneCostResultValue.getNum()) : 0)
// .unit(oldAppSceneCostResultValue.getUnit())
.materialCost(result.getMaterialCostStage())
.laborCost(result.getLaborCostStage())
.equipmentCost(result.getEquipCostStage())
.supplyMaterialCost(result.getAuxiliaryCostStage())
.driveCost(result.getBurningCostStage())
.logisticsCost(result.getStageLogisticsCost())
.otherCost(result.getOtherCostStage())
.currentStandardCost(result.getTotalStandardCostInter())
.totalMaterialCost(result.getMaterialCostAccumulated())
.totalLaborCost(result.getLaborCostAccumulated())
.totalEquipmentCost(result.getEquipCostAccumulated())
.totalSupplyMaterialCost(result.getAuxiliaryCostAccumulated())
.totalDriveCost(result.getBurningCostAccumulated())
.totalLogisticsCost(result.getTotalLogisticsCost())
.totalOtherCost(result.getOtherCostAccumulated())
.totalStandardCost(result.getTotalStandardCost())
.createTime(result.getCreatedTime()).build();
newList.add(costStandardDetail);
}
newpageList.setRecords(newList);
return Result.OK(newpageList);
} }
// //
// /** // /**
@@ -138,10 +178,10 @@ public class AppSceneCostStandardDetailController extends JeecgController<AppSce
* @param appSceneCostStandardDetail * @param appSceneCostStandardDetail
*/ */
// //@RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_standard_detail:exportXls") // //@RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_standard_detail:exportXls")
@RequestMapping(value = "/exportXls") @GetMapping(value = "/exportXls")
@ApiOperation(value = "cost-单行查询导出", notes = "cost-单行查询导出") @ApiOperation(value = "cost-单行查询导出", notes = "cost-单行查询导出")
public ModelAndView exportXls(HttpServletRequest request, AppSceneCostStandardDetail appSceneCostStandardDetail) { public ModelAndView exportXls(HttpServletRequest request, AppSceneCostStandardResult appSceneCostStandardDetail) {
return super.exportXls(request, appSceneCostStandardDetail, AppSceneCostStandardDetail.class, "app_scene_cost_standard_detail"); return super.exportXls(request, appSceneCostStandardDetail, AppSceneCostStandardResult.class, "标准成本单行导出");
} }
// /** // /**
@@ -1,261 +0,0 @@
package com.zzsmart.qomo.kn.cost.manage.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* @Description: app_scene_cost_material_bom
* @Author: jeecg-boot
* @Date: 2024-08-02
* @Version: V1.0
*/
@Data
@TableName("app_scene_cost_material_bom")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "app_scene_cost_material_bom对象", description = "app_scene_cost_material_bom")
public class AppSceneCostMaterialBom implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "id")
private String id;
/**
* 物料编码
*/
@Excel(name = "物料编码", width = 15)
@ApiModelProperty(value = "物料编码")
private String materialCode;
/**
* 物料名称
*/
@Excel(name = "物料名称", width = 15)
@ApiModelProperty(value = "物料名称")
private String materialName;
/**
* 父级物料编码
*/
@Excel(name = "父级物料编码", width = 15)
@ApiModelProperty(value = "父级物料编码")
private String parentMaterialCode;
/**
* 级别
*/
@Excel(name = "级别", width = 15)
@ApiModelProperty(value = "级别")
private String level;
/**
* 排序
*/
@Excel(name = "排序", width = 15)
@ApiModelProperty(value = "排序")
private Integer sort;
/**
* 计量单位
*/
@Excel(name = "计量单位", width = 15)
@ApiModelProperty(value = "计量单位")
private String unit;
/**
* 数量
*/
@Excel(name = "数量", width = 15)
@ApiModelProperty(value = "数量")
private Integer number;
/**
* 人工工时(分钟)
*/
@Excel(name = "人工工时(分钟)", width = 15)
@ApiModelProperty(value = "人工工时(分钟)")
private BigDecimal laborHours;
/**
* 设备工时
*/
@Excel(name = "设备工时", width = 15)
@ApiModelProperty(value = "设备工时")
private BigDecimal deviceHours;
/**
* 借用物料编码
*/
@Excel(name = "借用物料编码", width = 15)
@ApiModelProperty(value = "借用物料编码")
private String borrowMaterialCode;
/**
* 参考物料编码
*/
@Excel(name = "参考物料编码", width = 15)
@ApiModelProperty(value = "参考物料编码")
private String referMaterialCode;
/**
* 采购类型
*/
@Excel(name = "采购类型", width = 15)
@ApiModelProperty(value = "采购类型")
private String purchaseType;
/**
* 特殊采购类型
*/
@Excel(name = "特殊采购类型", width = 15)
@ApiModelProperty(value = "特殊采购类型")
private String specialPurchaseType;
/**
* 说明
*/
@Excel(name = "说明", width = 15)
@ApiModelProperty(value = "说明")
private String explanation;
/**
* 单位数量
*/
@Excel(name = "单位数量", width = 15)
@ApiModelProperty(value = "单位数量")
private BigDecimal quantity;
/**
* 重量(g)
*/
@Excel(name = "重量(g)", width = 15)
@ApiModelProperty(value = "重量(g)")
private String weight;
/**
* 材料/牌号
*/
@Excel(name = "材料/牌号", width = 15)
@ApiModelProperty(value = "材料/牌号")
private String materialAndBrand;
/**
* 表面处理,材料
*/
@Excel(name = "表面处理,材料", width = 15)
@ApiModelProperty(value = "表面处理,材料")
private String surfaceMaterial;
/**
* 厚度(mm)
*/
@Excel(name = "厚度(mm)", width = 15)
@ApiModelProperty(value = "厚度(mm)")
private String surfaceThickness;
/**
* 表面积(mm²)
*/
@Excel(name = "表面积(mm²)", width = 15)
@ApiModelProperty(value = "表面积(mm²)")
private String surfaceArea;
/**
* 长(mm)
*/
@Excel(name = "长(mm)", width = 15)
@ApiModelProperty(value = "长(mm)")
private String length;
/**
* 宽(mm)
*/
@Excel(name = "宽(mm)", width = 15)
@ApiModelProperty(value = "宽(mm)")
private String width;
/**
* 高(mm)
*/
@Excel(name = "高(mm)", width = 15)
@ApiModelProperty(value = "高(mm)")
private String height;
/**
* 图示/图档/文档 文件ID
*/
@Excel(name = "图示/图档/文档 文件ID", width = 15)
@ApiModelProperty(value = "图示/图档/文档 文件ID")
private Integer figureFileId;
/**
* 是否新摸具(0否 1是)
*/
@Excel(name = "是否新摸具(0否 1是)", width = 15)
@ApiModelProperty(value = "是否新摸具(0否 1是)")
private Integer newTooling;
/**
* 成型方式(枚举)
*/
@Excel(name = "成型方式(枚举)", width = 15)
@ApiModelProperty(value = "成型方式(枚举)")
private String shapingMethod;
/**
* 作业内容
*/
@Excel(name = "作业内容", width = 15)
@ApiModelProperty(value = "作业内容")
private String workContent;
/**
* 加工地点
*/
@Excel(name = "加工地点", width = 15)
@ApiModelProperty(value = "加工地点")
private String processLocation;
/**
* 成本中心
*/
@Excel(name = "成本中心", width = 15)
@ApiModelProperty(value = "成本中心")
private String costCenter;
/**
* 单价(未税)
*/
@Excel(name = "单价(未税)", width = 15)
@ApiModelProperty(value = "单价(未税)")
private BigDecimal unitPrice;
/**
* 总价(未税)
*/
@Excel(name = "总价(未税)", width = 15)
@ApiModelProperty(value = "总价(未税)")
private BigDecimal totalPrice;
/**
* 摸具费(未税)
*/
@Excel(name = "摸具费(未税)", width = 15)
@ApiModelProperty(value = "摸具费(未税)")
private BigDecimal mouldPrice;
/**
* 创建人
*/
@ApiModelProperty(value = "创建人")
private String createBy;
/**
* 创建时间
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**
* 修改人
*/
@ApiModelProperty(value = "修改人")
private String updateBy;
/**
* 修改时间
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间")
private Date updateTime;
/**
* 备注(特殊技术信息)
*/
@Excel(name = "备注(特殊技术信息)", width = 15)
@ApiModelProperty(value = "备注(特殊技术信息)")
private String remark;
}
@@ -1,129 +0,0 @@
package com.zzsmart.qomo.kn.cost.manage.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* @Description: app_scene_cost_material_process_hours
* @Author: jeecg-boot
* @Date: 2024-08-02
* @Version: V1.0
*/
@Data
@TableName("app_scene_cost_material_process_hours")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "app_scene_cost_material_process_hours对象", description = "app_scene_cost_material_process_hours")
public class AppSceneCostMaterialProcessHours implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private String id;
/**
* 物料编码
*/
@Excel(name = "物料编码", width = 15)
@ApiModelProperty(value = "物料编码")
private String materialCode;
/**
* 物料名称
*/
@Excel(name = "物料名称", width = 15)
@ApiModelProperty(value = "物料名称")
private String materialName;
/**
* 层级
*/
@Excel(name = "层级", width = 15)
@ApiModelProperty(value = "层级")
private String level;
/**
* 数量
*/
@Excel(name = "数量", width = 15)
@ApiModelProperty(value = "数量")
private BigDecimal quantity;
/**
* 采购类型
*/
@Excel(name = "采购类型", width = 15)
@ApiModelProperty(value = "采购类型")
private String purchaseType;
/**
* 工序
*/
@Excel(name = "工序", width = 15)
@ApiModelProperty(value = "工序")
private String workProcess;
/**
* 描述
*/
@Excel(name = "描述", width = 15)
@ApiModelProperty(value = "描述")
private String described;
/**
* 人工工时
*/
@Excel(name = "人工工时", width = 15)
@ApiModelProperty(value = "人工工时")
private BigDecimal laborHours;
/**
* 设备工时
*/
@Excel(name = "设备工时", width = 15)
@ApiModelProperty(value = "设备工时")
private BigDecimal deviceHours;
/**
* 工作中心
*/
@Excel(name = "工作中心", width = 15)
@ApiModelProperty(value = "工作中心")
private String workCenter;
/**
* 创建人
*/
@ApiModelProperty(value = "创建人")
private String createBy;
/**
* 创建时间
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**
* 修改人
*/
@ApiModelProperty(value = "修改人")
private String updateBy;
/**
* 修改时间
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间")
private Date updateTime;
/**
* 备注
*/
@Excel(name = "备注", width = 15)
@ApiModelProperty(value = "备注")
private String remark;
}
@@ -99,11 +99,11 @@ public class AppSceneCostProductProcessMaintenance implements Serializable {
/**reserve1*/ /**reserve1*/
@Excel(name = "reserve1", width = 15) @Excel(name = "reserve1", width = 15)
@ApiModelProperty(value = "reserve1") @ApiModelProperty(value = "reserve1")
private String reserve1; private String reserveOne;
/**reserve2*/ /**reserve2*/
@Excel(name = "reserve2", width = 15) @Excel(name = "reserve2", width = 15)
@ApiModelProperty(value = "reserve2") @ApiModelProperty(value = "reserve2")
private BigDecimal reserve2; private BigDecimal reserveTwo;
/**jobCode*/ /**jobCode*/
@Excel(name = "jobCode", width = 15) @Excel(name = "jobCode", width = 15)
@ApiModelProperty(value = "jobCode") @ApiModelProperty(value = "jobCode")
@@ -1,173 +0,0 @@
package com.zzsmart.qomo.kn.cost.manage.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* @Description: app_scene_cost_purchase_price
* @Author: jeecg-boot
* @Date: 2024-08-02
* @Version: V1.0
*/
@Data
@TableName("app_scene_cost_purchase_price")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "app_scene_cost_purchase_price对象", description = "app_scene_cost_purchase_price")
public class AppSceneCostPurchasePrice implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键")
private String id;
/**
* 物料编码
*/
@Excel(name = "物料编码", width = 15)
@ApiModelProperty(value = "物料编码")
private String materialCode;
/**
* 物料名称
*/
@Excel(name = "物料名称", width = 15)
@ApiModelProperty(value = "物料名称")
private String materialName;
/**
* 规格型号
*/
@Excel(name = "规格型号", width = 15)
@ApiModelProperty(value = "规格型号")
private String specification;
/**
* 采购类型
*/
@Excel(name = "采购类型", width = 15)
@ApiModelProperty(value = "采购类型")
private String purchaseType;
/**
* 供应商代码
*/
@Excel(name = "供应商代码", width = 15)
@ApiModelProperty(value = "供应商代码")
private String supplierCode;
/**
* 供应商名称
*/
@Excel(name = "供应商名称", width = 15)
@ApiModelProperty(value = "供应商名称")
private String supplierName;
/**
* 采购价时间
*/
@Excel(name = "采购价时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "采购价时间")
private Date purchasePriceTime;
/**
* 采购价合计
*/
@Excel(name = "采购价合计", width = 15)
@ApiModelProperty(value = "采购价合计")
private BigDecimal purchasePriceSum;
/**
* 最低采购单价
*/
@Excel(name = "最低采购单价", width = 15)
@ApiModelProperty(value = "最低采购单价")
private BigDecimal minPurchasePrice;
/**
* 最新采购单价
*/
@Excel(name = "最新采购单价", width = 15)
@ApiModelProperty(value = "最新采购单价")
private BigDecimal lastPurchasePrice;
/**
* 平均采购价
*/
@Excel(name = "平均采购价", width = 15)
@ApiModelProperty(value = "平均采购价")
private BigDecimal purchasePriceAvg;
/**
* 直接材料费
*/
@Excel(name = "直接材料费", width = 15)
@ApiModelProperty(value = "直接材料费")
private BigDecimal directMaterialCost;
/**
* 工艺加工费用
*/
@Excel(name = "工艺加工费用", width = 15)
@ApiModelProperty(value = "工艺加工费用")
private BigDecimal processCost;
/**
* 运输费用
*/
@Excel(name = "运输费用", width = 15)
@ApiModelProperty(value = "运输费用")
private BigDecimal transportCost;
/**
* 模具费用
*/
@Excel(name = "模具费用", width = 15)
@ApiModelProperty(value = "模具费用")
private BigDecimal mouldCost;
/**
* 其他费用
*/
@Excel(name = "其他费用", width = 15)
@ApiModelProperty(value = "其他费用")
private BigDecimal ortherCost;
/**
* 税率
*/
@Excel(name = "税率", width = 15)
@ApiModelProperty(value = "税率")
private BigDecimal taxTate;
/**
* 创建人
*/
@ApiModelProperty(value = "创建人")
private String createBy;
/**
* 创建时间
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**
* 修改人
*/
@ApiModelProperty(value = "修改人")
private String updateBy;
/**
* 修改时间
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间")
private Date updateTime;
/**
* 备注
*/
@Excel(name = "备注", width = 15)
@ApiModelProperty(value = "备注")
private String remark;
}
@@ -61,7 +61,7 @@ public class AppSceneCostResultValue implements Serializable {
*/ */
@Excel(name = "数量", width = 15) @Excel(name = "数量", width = 15)
@ApiModelProperty(value = "数量") @ApiModelProperty(value = "数量")
private Integer num; private BigDecimal num;
/** /**
* 单位 * 单位
*/ */
@@ -85,7 +85,7 @@ public class AppSceneCostResultValue implements Serializable {
*/ */
@Excel(name = "流程id", width = 15) @Excel(name = "流程id", width = 15)
@ApiModelProperty(value = "流程id") @ApiModelProperty(value = "流程id")
private String flowInstanceId; private Integer flowInstanceId;
/** /**
* 本阶成本 * 本阶成本
*/ */
@@ -32,127 +32,189 @@ import java.util.Date;
public class AppSceneCostStandardDetail implements Serializable { public class AppSceneCostStandardDetail implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/**id*/ /**
* id
*/
@TableId(type = IdType.ASSIGN_ID) @TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "id") @ApiModelProperty(value = "id")
private String id; private String id;
/**图号*/ /**
* 图号
*/
@Excel(name = "图号", width = 15) @Excel(name = "图号", width = 15)
@ApiModelProperty(value = "图号") @ApiModelProperty(value = "图号")
private String figureNumber; private String figureNumber;
/**物料号,关联kn_new_sap_mara表matnr字段*/ /**
* 物料号,关联kn_new_sap_mara表matnr字段
*/
@Excel(name = "物料号,关联kn_new_sap_mara表matnr字段", width = 15) @Excel(name = "物料号,关联kn_new_sap_mara表matnr字段", width = 15)
@ApiModelProperty(value = "物料号,关联kn_new_sap_mara表matnr字段") @ApiModelProperty(value = "物料号,关联kn_new_sap_mara表matnr字段")
private String materialNumber; private String materialNumber;
/**物料名称*/ /**
* 物料名称
*/
@Excel(name = "物料名称", width = 15) @Excel(name = "物料名称", width = 15)
@ApiModelProperty(value = "物料名称") @ApiModelProperty(value = "物料名称")
private String materialName; private String materialName;
/**父类物料号*/ /**
* 父类物料号
*/
@Excel(name = "父类物料号", width = 15) @Excel(name = "父类物料号", width = 15)
@ApiModelProperty(value = "父类物料号") @ApiModelProperty(value = "父类物料号")
private String parentMaterialNumber; private String parentMaterialNumber;
/**版本号*/ /**
* 版本号
*/
@Excel(name = "版本号", width = 15) @Excel(name = "版本号", width = 15)
@ApiModelProperty(value = "版本号") @ApiModelProperty(value = "版本号")
private String versionNumber; private String versionNumber;
/**层级*/ /**
* 层级
*/
@Excel(name = "层级", width = 15) @Excel(name = "层级", width = 15)
@ApiModelProperty(value = "层级") @ApiModelProperty(value = "层级")
private Integer level; private Integer level;
/**序号*/ /**
* 序号
*/
@Excel(name = "序号", width = 15) @Excel(name = "序号", width = 15)
@ApiModelProperty(value = "序号") @ApiModelProperty(value = "序号")
private Integer sort; private Integer sort;
/**用量*/ /**
* 用量
*/
@Excel(name = "用量", width = 15) @Excel(name = "用量", width = 15)
@ApiModelProperty(value = "用量") @ApiModelProperty(value = "用量")
private Double dosage; private Double dosage;
/**单位*/ /**
* 单位
*/
@Excel(name = "单位", width = 15) @Excel(name = "单位", width = 15)
@ApiModelProperty(value = "单位") @ApiModelProperty(value = "单位")
private String unit; private String unit;
/**本阶材料费*/ /**
* 本阶材料费
*/
@Excel(name = "本阶材料费", width = 15) @Excel(name = "本阶材料费", width = 15)
@ApiModelProperty(value = "本阶材料费") @ApiModelProperty(value = "本阶材料费")
private BigDecimal materialCost; private BigDecimal materialCost;
/**本阶人工费*/ /**
* 本阶人工费
*/
@Excel(name = "本阶人工陈本", width = 15) @Excel(name = "本阶人工陈本", width = 15)
@ApiModelProperty(value = "本阶人工成本") @ApiModelProperty(value = "本阶人工成本")
private BigDecimal laborCost; private BigDecimal laborCost;
/**本阶辅料费*/ /**
* 本阶辅料费
*/
@Excel(name = "本阶辅料费", width = 15) @Excel(name = "本阶辅料费", width = 15)
@ApiModelProperty(value = "本阶辅料费") @ApiModelProperty(value = "本阶辅料费")
private BigDecimal supplyMaterialCost; private BigDecimal supplyMaterialCost;
/**本阶机器折旧费*/ /**
* 本阶机器折旧费
*/
@Excel(name = "本阶机器折旧费", width = 15) @Excel(name = "本阶机器折旧费", width = 15)
@ApiModelProperty(value = "本阶机器折旧费") @ApiModelProperty(value = "本阶机器折旧费")
private BigDecimal equipmentCost; private BigDecimal equipmentCost;
/**本阶水电费(燃动费)*/ /**
* 本阶水电费(燃动费)
*/
@Excel(name = "本阶水电费(燃动费)", width = 15) @Excel(name = "本阶水电费(燃动费)", width = 15)
@ApiModelProperty(value = "本阶水电费(燃动费)") @ApiModelProperty(value = "本阶水电费(燃动费)")
private BigDecimal driveCost; private BigDecimal driveCost;
/**本阶其他制造费*/ /**
* 本阶其他制造费
*/
@Excel(name = "本阶其他费用", width = 15) @Excel(name = "本阶其他费用", width = 15)
@ApiModelProperty(value = "本阶其他费用") @ApiModelProperty(value = "本阶其他费用")
private BigDecimal otherCost; private BigDecimal otherCost;
/**本阶物流费*/ /**
* 本阶物流费
*/
@Excel(name = "本阶物流费", width = 15) @Excel(name = "本阶物流费", width = 15)
@ApiModelProperty(value = "本阶物流费") @ApiModelProperty(value = "本阶物流费")
private BigDecimal logisticsCost; private BigDecimal logisticsCost;
/**累计物料成本*/ /**
* 累计物料成本
*/
@Excel(name = "累计物料成本", width = 15) @Excel(name = "累计物料成本", width = 15)
@ApiModelProperty(value = "累计物料成本") @ApiModelProperty(value = "累计物料成本")
private BigDecimal totalMaterialCost; private BigDecimal totalMaterialCost;
/**累计人工成本*/ /**
* 累计人工成本
*/
@Excel(name = "累计人工成本", width = 15) @Excel(name = "累计人工成本", width = 15)
@ApiModelProperty(value = "累计人工成本") @ApiModelProperty(value = "累计人工成本")
private BigDecimal totalLaborCost; private BigDecimal totalLaborCost;
/**累计辅料费*/ /**
* 累计辅料费
*/
@Excel(name = "累计辅料费", width = 15) @Excel(name = "累计辅料费", width = 15)
@ApiModelProperty(value = "累计辅料费") @ApiModelProperty(value = "累计辅料费")
private BigDecimal totalSupplyMaterialCost; private BigDecimal totalSupplyMaterialCost;
/**累计机器折旧费*/ /**
* 累计机器折旧费
*/
@Excel(name = "累计机器折旧费", width = 15) @Excel(name = "累计机器折旧费", width = 15)
@ApiModelProperty(value = "累计机器折旧费") @ApiModelProperty(value = "累计机器折旧费")
private BigDecimal totalEquipmentCost; private BigDecimal totalEquipmentCost;
/**累计水电费(燃动费)*/ /**
* 累计水电费(燃动费)
*/
@Excel(name = "累计水电费(燃动费)", width = 15) @Excel(name = "累计水电费(燃动费)", width = 15)
@ApiModelProperty(value = "累计水电费(燃动费)") @ApiModelProperty(value = "累计水电费(燃动费)")
private BigDecimal totalDriveCost; private BigDecimal totalDriveCost;
/**累计其他费用*/ /**
* 累计其他费用
*/
@Excel(name = "累计其他费用", width = 15) @Excel(name = "累计其他费用", width = 15)
@ApiModelProperty(value = "累计其他费用") @ApiModelProperty(value = "累计其他费用")
private BigDecimal totalOtherCost; private BigDecimal totalOtherCost;
/**累计物流费用*/ /**
* 累计物流费用
*/
@Excel(name = "累计物流费用", width = 15) @Excel(name = "累计物流费用", width = 15)
@ApiModelProperty(value = "累计物流费用") @ApiModelProperty(value = "累计物流费用")
private BigDecimal totalLogisticsCost; private BigDecimal totalLogisticsCost;
/**本阶标准成本*/ /**
* 本阶标准成本
*/
@Excel(name = "本阶标准成本", width = 15) @Excel(name = "本阶标准成本", width = 15)
@ApiModelProperty(value = "本阶标准成本") @ApiModelProperty(value = "本阶标准成本")
private BigDecimal currentStandardCost; private BigDecimal currentStandardCost;
/**累计标准成本*/ /**
* 累计标准成本
*/
@Excel(name = "累计标准成本", width = 15) @Excel(name = "累计标准成本", width = 15)
@ApiModelProperty(value = "累计标准成本") @ApiModelProperty(value = "累计标准成本")
private BigDecimal totalStandardCost; private BigDecimal totalStandardCost;
/**创建人*/ /**
* 创建人
*/
@ApiModelProperty(value = "创建人") @ApiModelProperty(value = "创建人")
private String createBy; private String createBy;
/**创建日期*/ /**
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") * 创建日期
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") */
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期") @ApiModelProperty(value = "创建日期")
private Date createTime; private Date createTime;
/**修改人*/ /**
* 修改人
*/
@ApiModelProperty(value = "修改人") @ApiModelProperty(value = "修改人")
private String updateBy; private String updateBy;
/**修改日期*/ /**
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") * 修改日期
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") */
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改日期") @ApiModelProperty(value = "修改日期")
private Date updateTime; private Date updateTime;
/**备注*/ /**
* 备注
*/
@Excel(name = "备注", width = 15) @Excel(name = "备注", width = 15)
@ApiModelProperty(value = "备注") @ApiModelProperty(value = "备注")
private String remark; private String remark;
@@ -0,0 +1,365 @@
package com.zzsmart.qomo.kn.cost.manage.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.Column;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@Data
@Builder
@TableName("app_scene_cost_standard_result")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "标准成本单行", description = "标准成本单行")
public class AppSceneCostStandardResult implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "id")
private Integer id;
/**
* 工厂
*/
@Column(name = "factory")
private String factory;
/**
* 物料号
*/
@Column(name = "material_number")
private String materialNumber;
/**
* 父物料号
*/
@Column(name = "parent_matnr")
private String parentMatnr;
/**
* 阶段
*/
@Column(name = "stage")
private String stage;
/**
* 版本号
*/
@Column(name = "version_number")
private String versionNumber;
/**
* 层级
*/
@Column(name = "layer")
private String layer;
/**
* 价格类型
*/
@Column(name = "pricetype")
private String pricetype;
/**
* 会计期间
*/
@Column(name = "ymonth")
private String ymonth;
/**
* 本阶标准成本
*/
@Column(name = "total_standard_cost_inter")
private BigDecimal totalStandardCostInter;
/**
* 累计标准成本
*/
@Column(name = "total_standard_cost")
private BigDecimal totalStandardCost;
/**
* material_cost_stage_inter
*/
@Column(name = "material_cost_stage_inter")
private BigDecimal materialCostStageInter;
/**
* 本阶物料成本
*/
@Column(name = "material_cost_stage")
private BigDecimal materialCostStage;
/**
* 本阶人工成本
*/
@Column(name = "labor_cost_stage")
private BigDecimal laborCostStage;
/**
* 本阶设备费
*/
@Column(name = "equip_cost_stage")
private BigDecimal equipCostStage;
/**
* 本阶燃动费
*/
@Column(name = "burning_cost_stage")
private BigDecimal burningCostStage;
/**
* 本阶辅料费
*/
@Column(name = "auxiliary_cost_stage")
private BigDecimal auxiliaryCostStage;
/**
* 本阶其他费
*/
@Column(name = "other_cost_stage")
private BigDecimal otherCostStage;
/**
* 本阶物流费
*/
@Column(name = "stage_logistics_cost")
private BigDecimal stageLogisticsCost;
/**
* material_cost_accumulated_inter
*/
@Column(name = "material_cost_accumulated_inter")
private BigDecimal materialCostAccumulatedInter;
/**
* 累计物料
*/
@Column(name = "material_cost_accumulated")
private BigDecimal materialCostAccumulated;
/**
* 累计人工成本
*/
@Column(name = "labor_cost_accumulated")
private BigDecimal laborCostAccumulated;
/**
* 累计设备费
*/
@Column(name = "equip_cost_accumulated")
private BigDecimal equipCostAccumulated;
/**
* 累计燃动费
*/
@Column(name = "burning_cost_accumulated")
private BigDecimal burningCostAccumulated;
/**
* 累计辅料费
*/
@Column(name = "auxiliary_cost_accumulated")
private BigDecimal auxiliaryCostAccumulated;
/**
* 累计其他费
*/
@Column(name = "other_cost_accumulated")
private BigDecimal otherCostAccumulated;
/**
* 累计物流费
*/
@Column(name = "total_logistics_cost")
private BigDecimal totalLogisticsCost;
/**
* material_cost_total_inter
*/
@Column(name = "material_cost_total_inter")
private BigDecimal materialCostTotalInter;
/**
* material_cost_total
*/
@Column(name = "material_cost_total")
private BigDecimal materialCostTotal;
/**
* labor_cost_total
*/
@Column(name = "labor_cost_total")
private BigDecimal laborCostTotal;
/**
* equip_cost_total
*/
@Column(name = "equip_cost_total")
private BigDecimal equipCostTotal;
/**
* burning_cost_total
*/
@Column(name = "burning_cost_total")
private BigDecimal burningCostTotal;
/**
* auxiliary_cost_total
*/
@Column(name = "auxiliary_cost_total")
private BigDecimal auxiliaryCostTotal;
/**
* other_cost_total
*/
@Column(name = "other_cost_total")
private BigDecimal otherCostTotal;
/**
* low_order_code
*/
@Column(name = "low_order_code")
private String lowOrderCode;
/**
* relative_dosage
*/
@Column(name = "relative_dosage")
private BigDecimal relativeDosage;
/**
* material_cost_relative
*/
@Column(name = "material_cost_relative")
private BigDecimal materialCostRelative;
/**
* material_cost_relative_inter
*/
@Column(name = "material_cost_relative_inter")
private BigDecimal materialCostRelativeInter;
/**
* labor_cost_relative
*/
@Column(name = "labor_cost_relative")
private BigDecimal laborCostRelative;
/**
* manufacture_cost_relative
*/
@Column(name = "manufacture_cost_relative")
private BigDecimal manufactureCostRelative;
/**
* total_cost_relative
*/
@Column(name = "total_cost_relative")
private BigDecimal totalCostRelative;
/**
* total_cost_relative_inter
*/
@Column(name = "total_cost_relative_inter")
private BigDecimal totalCostRelativeInter;
/**
* material_cost_stage_material
*/
@Column(name = "material_cost_stage_material")
private BigDecimal materialCostStageMaterial;
/**
* material_cost_stage_edcu
*/
@Column(name = "material_cost_stage_edcu")
private BigDecimal materialCostStageEdcu;
/**
* material_cost_stage_em
*/
@Column(name = "material_cost_stage_em")
private BigDecimal materialCostStageEm;
/**
* material_cost_stage_inter_material
*/
@Column(name = "material_cost_stage_inter_material")
private BigDecimal materialCostStageInterMaterial;
/**
* material_cost_stage_inter_edcu
*/
@Column(name = "material_cost_stage_inter_edcu")
private BigDecimal materialCostStageInterEdcu;
/**
* material_cost_stage_inter_em
*/
@Column(name = "material_cost_stage_inter_em")
private BigDecimal materialCostStageInterEm;
/**
* material_cost_accumulated_material
*/
@Column(name = "material_cost_accumulated_material")
private BigDecimal materialCostAccumulatedMaterial;
/**
* material_cost_accumulated_edcu
*/
@Column(name = "material_cost_accumulated_edcu")
private BigDecimal materialCostAccumulatedEdcu;
/**
* material_cost_accumulated_em
*/
@Column(name = "material_cost_accumulated_em")
private BigDecimal materialCostAccumulatedEm;
/**
* material_cost_accumulated_inter_material
*/
@Column(name = "material_cost_accumulated_inter_material")
private BigDecimal materialCostAccumulatedInterMaterial;
/**
* material_cost_accumulated_inter_edcu
*/
@Column(name = "material_cost_accumulated_inter_edcu")
private BigDecimal materialCostAccumulatedInterEdcu;
/**
* material_cost_accumulated_inter_em
*/
@Column(name = "material_cost_accumulated_inter_em")
private BigDecimal materialCostAccumulatedInterEm;
/**
* 创建时间
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改日期")
private Date createdTime;
}
@@ -1,10 +1,12 @@
package com.zzsmart.qomo.kn.cost.manage.mapper; package com.zzsmart.qomo.kn.cost.manage.mapper;
import java.util.List; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostBomRelevancy; import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostBomRelevancy;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Select;
import java.util.List;
/** /**
* @Description: app_scene_cost_bom_relevancy * @Description: app_scene_cost_bom_relevancy
@@ -13,5 +15,24 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @Version: V1.0 * @Version: V1.0
*/ */
public interface AppSceneCostBomRelevancyMapper extends BaseMapper<AppSceneCostBomRelevancy> { public interface AppSceneCostBomRelevancyMapper extends BaseMapper<AppSceneCostBomRelevancy> {
@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<AppSceneCostBomRelevancy> findChildrenByParentId(String parentId);
@Select("${selectSql}")
JSONObject customSelectOne(@Param("selectSql") String selectSql);
@Select("${SelectBlobModel}")
String customSelectBlobModelJson(@Param("SelectBlobModel") String SelectBlobModel);
} }
@@ -1,7 +1,10 @@
package com.zzsmart.qomo.kn.cost.manage.mapper; package com.zzsmart.qomo.kn.cost.manage.mapper;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostHourRate; 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 * @Description: app_scene_cost_hour_rate
@@ -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<AppSceneCostMaterialBom> {
/**
* 根据动态SQL语句查询物料BOM表
*
* @param selectCommand
* @return
*/
@Select("${selectCommand}")
List<AppSceneCostMaterialBom> customSelect(@Param("selectCommand") String selectCommand);
@Select("${selectSql}")
JSONObject customSelectOne(@Param("selectSql") String selectSql);
@Select("${SelectBlobModel}")
String customSelectBlobModelJson(@Param("SelectBlobModel") String SelectBlobModel);
}
@@ -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<AppSceneCostMaterialProcessHours> {
}
@@ -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<AppSceneCostPurchasePrice> {
}
@@ -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<AppSceneCostStandardResult> {
}
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zzsmart.qomo.modules.demo.com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostBomRelevancyMapper"> <mapper namespace="com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostBomRelevancyMapper">
</mapper> </mapper>
@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostMaterialBomMapper">
</mapper>
@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostMaterialProcessHoursMapper">
</mapper>
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostPurchasePriceMapper"> <mapper namespace="com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostStandardResultMapper">
</mapper> </mapper>
@@ -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.FeeTypeEnum;
import com.zzsmart.qomo.kn.cost.manage.enums.HourOrRateTypeEnum; 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.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.service.*;
import com.zzsmart.qomo.kn.cost.manage.vo.FlowTaskInfoVO; import com.zzsmart.qomo.kn.cost.manage.vo.FlowTaskInfoVO;
import com.zzsmart.qomo.kn.cost.manage.vo.TotalResultValue; import com.zzsmart.qomo.kn.cost.manage.vo.TotalResultValue;
@@ -32,9 +32,9 @@ public class StandardCostService {
* 物料BOM信息 * 物料BOM信息
*/ */
@Autowired @Autowired
AppSceneCostMaterialBomMapper costMaterialBomMapper; AppSceneCostBomRelevancyMapper appSceneCostBomRelevancyMapper;
@Autowired @Autowired
IAppSceneCostMaterialBomService costMaterialBomService; IAppSceneCostBomRelevancyService costMaterialBomService;
/** /**
* 小时费率 * 小时费率
@@ -45,12 +45,12 @@ public class StandardCostService {
* 采购单价 * 采购单价
*/ */
@Autowired @Autowired
IAppSceneCostPurchasePriceService costPurchasePriceService; IAppSceneCostPurchaseRecordService costPurchaseRecordService;
/** /**
* 工序 * 工序
*/ */
@Autowired @Autowired
IAppSceneCostMaterialProcessHoursService costMaterialProcessHoursService; IAppSceneCostProductProcessMaintenanceService costMaterialProcessHoursService;
/** /**
* 标准成本计算结果 * 标准成本计算结果
*/ */
@@ -69,19 +69,19 @@ public class StandardCostService {
* 标准成本明细服务(单行查询服务) * 标准成本明细服务(单行查询服务)
*/ */
@Autowired @Autowired
private IAppSceneCostStandardDetailService iAppSceneCostStandardDetailService; private IAppSceneCostStandardResultService iAppSceneCostStandardResultService;
@PostConstruct @PostConstruct
public void init() { public void init() {
standardCostService = this; standardCostService = this;
standardCostService.costMaterialBomMapper = this.costMaterialBomMapper; standardCostService.appSceneCostBomRelevancyMapper = this.appSceneCostBomRelevancyMapper;
standardCostService.appSceneCostCountService = this.appSceneCostCountService; standardCostService.appSceneCostCountService = this.appSceneCostCountService;
standardCostService.costMaterialBomService = this.costMaterialBomService; standardCostService.costMaterialBomService = this.costMaterialBomService;
standardCostService.costPurchasePriceService = this.costPurchasePriceService; standardCostService.costPurchaseRecordService = this.costPurchaseRecordService;
standardCostService.iHourRateService = this.iHourRateService; standardCostService.iHourRateService = this.iHourRateService;
standardCostService.costMaterialProcessHoursService = this.costMaterialProcessHoursService; standardCostService.costMaterialProcessHoursService = this.costMaterialProcessHoursService;
standardCostService.iAppSceneCostResultValueService = this.iAppSceneCostResultValueService; standardCostService.iAppSceneCostResultValueService = this.iAppSceneCostResultValueService;
standardCostService.iAppSceneCostStandardDetailService = this.iAppSceneCostStandardDetailService; standardCostService.iAppSceneCostStandardResultService = this.iAppSceneCostStandardResultService;
} }
/** /**
@@ -110,12 +110,400 @@ public class StandardCostService {
//1.查询出所有满足物料编号的物料(BOM物料) //1.查询出所有满足物料编号的物料(BOM物料)
String sql = flowTaskInfoVO.getSqlString(); String sql = flowTaskInfoVO.getSqlString();
log.info("传递过来的SQL语句:" + sql); log.info("传递过来的SQL语句:" + sql);
//获取顶部物料下所有的物料信息并存储到新的表中
getAllMaterialBomInfoByTopMaterialCode(topMaterialCode, taskType, taskCode, flowInstanceId != null ? Integer.valueOf(flowInstanceId) : null);
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(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<AppSceneCostBomRelevancy> 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<AppSceneCostResultValue> list = standardCostService.iAppSceneCostResultValueService.getResultValueByTopMaterialNo(topMaterialCode, "MaterialInput", String.valueOf(flowInstanceId));
//2.计算出所有的单个物料的物料成本
//2.1查询出物料的单价和采购数量
List<String> MarterialNoList = new ArrayList<>();
if (list != null && list.size() > 0) {
MarterialNoList = list.stream().filter(s -> s.getMarterialNo() != null).map(AppSceneCostResultValue::getMarterialNo).collect(Collectors.toList());
}
//查询物料的采购价
Map<String, BigDecimal> 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<AppSceneCostResultValue> list = standardCostService.iAppSceneCostResultValueService.getResultValueByTopMaterialNo(topMaterialCode, "MaterialInput", String.valueOf(flowInstanceId));
//2.计算出所有的单个物料的人工成本
//2.1查询出物料的人员工时和人工小时费率(涉及:小时费率表和工序表)
List<String> MarterialNoList = new ArrayList<>();
if (list != null && list.size() > 0) {
MarterialNoList = list.stream().filter(s -> s.getMarterialNo() != null).map(AppSceneCostResultValue::getMarterialNo).collect(Collectors.toList());
}
//查询工序工时
Map<String, List<AppSceneCostProductProcessMaintenance>> 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<AppSceneCostProductProcessMaintenance> 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<AppSceneCostResultValue> list = standardCostService.iAppSceneCostResultValueService.getResultValueByTopMaterialNo(topMaterialCode, "MaterialInput", String.valueOf(flowInstanceId));
//2.根据费用类型进行不同的费用计算
//查询工序工时
List<String> MarterialNoList = new ArrayList<>();
if (list != null && list.size() > 0) {
MarterialNoList = list.stream().filter(s -> s.getMarterialNo() != null).map(AppSceneCostResultValue::getMarterialNo).collect(Collectors.toList());
}
Map<String, List<AppSceneCostProductProcessMaintenance>> 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<AppSceneCostProductProcessMaintenance> 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<AppSceneCostProductProcessMaintenance> 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<AppSceneCostProductProcessMaintenance> 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<AppSceneCostProductProcessMaintenance> 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<String, List<AppSceneCostResultValue>> materialNoMap = list.stream().collect(Collectors.groupingBy(AppSceneCostResultValue::getMarterialNo));
for (String key : materialNoMap.keySet()) {
List<AppSceneCostResultValue> 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<AppSceneCostResultValue> list = standardCostService.iAppSceneCostResultValueService.getAllResultValueByTopMaterialNo(topMaterialCode, String.valueOf(flowInstanceId));
//2.计算出所有的单个物料的本阶的标准成本(标准成本=物料成本+人工成本+制造费用)
//按照物料编号进行分组
Map<String, List<AppSceneCostResultValue>> materialNoMap = list.stream().collect(Collectors.groupingBy(AppSceneCostResultValue::getMarterialNo));
//遍历根物料下所有的物料进行该物料本阶成本和费用类别的统计
for (String key : materialNoMap.keySet()) {
List<AppSceneCostResultValue> appSceneCostResultValues = materialNoMap.get(key);
//按照费用类别进行分组
Map<String, List<AppSceneCostResultValue>> 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<AppSceneCostResultValue> 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<AppSceneCostResultValue> 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) { 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 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) {
if (blob != null && blob.contains("topMaterialCode")) { if (blob != null && blob.contains("topMaterialCode")) {
JSONObject jsonObject1 = JSON.parseObject(blob); JSONObject jsonObject1 = JSON.parseObject(blob);
@@ -210,30 +598,7 @@ public class StandardCostService {
String flowInstanceId = flowTaskInfoVO.getFlowInstanceId(); String flowInstanceId = flowTaskInfoVO.getFlowInstanceId();
//成本类型 //成本类型
String feeType = FeeTypeEnum.MaterialCost.getCode(); String feeType = FeeTypeEnum.MaterialCost.getCode();
//1.查询出物料编号对应的下所有的BOM信息
List<AppSceneCostResultValue> list = standardCostService.iAppSceneCostResultValueService.getResultValueByTopMaterialNo(topMaterialCode, "MaterialInput", flowInstanceId);
//2.计算出所有的单个物料的物料成本
//2.1查询出物料的单价和采购数量
List<String> MarterialNoList = new ArrayList<>();
if (list != null && list.size() > 0) {
MarterialNoList = list.stream().filter(s -> s.getMarterialNo() != null).map(AppSceneCostResultValue::getMarterialNo).collect(Collectors.toList());
}
//查询物料的采购价
Map<String, BigDecimal> 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) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@@ -260,42 +625,7 @@ public class StandardCostService {
log.info("sql1:" + sql1); log.info("sql1:" + sql1);
String sql = sql1.replaceAll("^\"|\"$", ""); // 去除首尾引号 String sql = sql1.replaceAll("^\"|\"$", ""); // 去除首尾引号
log.info("sql:" + sql); 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<AppSceneCostResultValue> list = standardCostService.iAppSceneCostResultValueService.getResultValueByTopMaterialNo(topMaterialCode, "MaterialInput", flowInstanceId);
//2.计算出所有的单个物料的人工成本
//2.1查询出物料的人员工时和人工小时费率(涉及:小时费率表和工序表)
List<String> MarterialNoList = new ArrayList<>();
if (list != null && list.size() > 0) {
MarterialNoList = list.stream().filter(s -> s.getMarterialNo() != null).map(AppSceneCostResultValue::getMarterialNo).collect(Collectors.toList());
}
//查询工序工时
Map<String, List<AppSceneCostMaterialProcessHours>> 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<AppSceneCostMaterialProcessHours> 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) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@@ -328,132 +658,7 @@ public class StandardCostService {
log.info("sql1:" + sql1); log.info("sql1:" + sql1);
String sql = sql1.replaceAll("^\"|\"$", ""); // 去除首尾引号 String sql = sql1.replaceAll("^\"|\"$", ""); // 去除首尾引号
log.info("sql:" + sql); 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<AppSceneCostResultValue> list = standardCostService.iAppSceneCostResultValueService.getResultValueByTopMaterialNo(topMaterialCode, "MaterialInput", flowInstanceId);
//2.根据费用类型进行不同的费用计算
//查询工序工时
List<String> MarterialNoList = new ArrayList<>();
if (list != null && list.size() > 0) {
MarterialNoList = list.stream().filter(s -> s.getMarterialNo() != null).map(AppSceneCostResultValue::getMarterialNo).collect(Collectors.toList());
}
Map<String, List<AppSceneCostMaterialProcessHours>> 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<AppSceneCostMaterialProcessHours> 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<AppSceneCostMaterialProcessHours> 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<AppSceneCostMaterialProcessHours> 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<AppSceneCostMaterialProcessHours> 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<String, List<AppSceneCostResultValue>> materialNoMap = list.stream().collect(Collectors.groupingBy(AppSceneCostResultValue::getMarterialNo));
for (String key : materialNoMap.keySet()) {
List<AppSceneCostResultValue> 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) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@@ -476,134 +681,6 @@ public class StandardCostService {
//获取流程id //获取流程id
String flowInstanceId = flowTaskInfoVO.getFlowInstanceId(); String flowInstanceId = flowTaskInfoVO.getFlowInstanceId();
String costType = FeeTypeEnum.StandardCost.getCode(); String costType = FeeTypeEnum.StandardCost.getCode();
//1.查询出根物料编号对应的下所有的BOM信息结果值
List<AppSceneCostResultValue> list = standardCostService.iAppSceneCostResultValueService.getAllResultValueByTopMaterialNo(topMaterialCode, flowInstanceId);
//2.计算出所有的单个物料的本阶的标准成本(标准成本=物料成本+人工成本+制造费用)
//按照物料编号进行分组
Map<String, List<AppSceneCostResultValue>> materialNoMap = list.stream().collect(Collectors.groupingBy(AppSceneCostResultValue::getMarterialNo));
//遍历根物料下所有的物料进行该物料本阶成本和费用类别的统计
for (String key : materialNoMap.keySet()) {
List<AppSceneCostResultValue> appSceneCostResultValues = materialNoMap.get(key);
//按照费用类别进行分组
Map<String, List<AppSceneCostResultValue>> 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<AppSceneCostResultValue> 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<AppSceneCostResultValue> standardCostList = standardCostService.iAppSceneCostResultValueService.getResultValueByTopMaterialNo(topMaterialCode, taskType, flowInstanceId);
//【累计成本】的计算
totalCountCost(standardCostList, topMaterialCode, taskType, taskCode, flowInstanceId);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException("计算成本失败"); throw new RuntimeException("计算成本失败");
@@ -619,9 +696,9 @@ public class StandardCostService {
* @param taskCode * @param taskCode
* @param flowInstanceId * @param flowInstanceId
*/ */
private static void totalCountCost(List<AppSceneCostResultValue> standardCostList, String topMaterialCode, String taskType, String taskCode, String flowInstanceId) { private static void totalCountCost(List<AppSceneCostResultValue> standardCostList, String topMaterialCode, String taskType, String taskCode, String flowInstanceId, String versionNumber) {
try { try {
List<AppSceneCostStandardDetail> costStandardDetails = new ArrayList<>(); List<AppSceneCostStandardResult> costStandardResults = new ArrayList<>();
//父类对应的子节点(除了最上层节点) //父类对应的子节点(除了最上层节点)
Map<String, List<AppSceneCostResultValue>> parentMaterialNoMap = standardCostList.stream().filter(appSceneCostResultValue -> appSceneCostResultValue.getParentMarterialNo() != null).collect(Collectors.groupingBy(AppSceneCostResultValue::getParentMarterialNo)); Map<String, List<AppSceneCostResultValue>> parentMaterialNoMap = standardCostList.stream().filter(appSceneCostResultValue -> appSceneCostResultValue.getParentMarterialNo() != null).collect(Collectors.groupingBy(AppSceneCostResultValue::getParentMarterialNo));
for (int i = 0; i < standardCostList.size(); i++) { for (int i = 0; i < standardCostList.size(); i++) {
@@ -652,16 +729,16 @@ public class StandardCostService {
oldAppSceneCostResultValue.setTotalValue(hourOrRateResultValue.getTotalCost().toString()); oldAppSceneCostResultValue.setTotalValue(hourOrRateResultValue.getTotalCost().toString());
standardCostService.iAppSceneCostResultValueService.updateById(oldAppSceneCostResultValue); standardCostService.iAppSceneCostResultValueService.updateById(oldAppSceneCostResultValue);
//构造单行成本查询记录 //构造单行成本查询记录
AppSceneCostStandardDetail costStandardDetail = AppSceneCostStandardDetail.builder().materialNumber(oldAppSceneCostResultValue.getMarterialNo()).materialName(oldAppSceneCostResultValue.getMarterialNo()).parentMaterialNumber(oldAppSceneCostResultValue.getParentMarterialNo()) AppSceneCostStandardResult costStandardResultValue = AppSceneCostStandardResult.builder().materialNumber(oldAppSceneCostResultValue.getMarterialNo()).parentMatnr(oldAppSceneCostResultValue.getParentMarterialNo()).versionNumber(versionNumber)
// .versionNumber()
// .level() // .level()
// .sort() // .sort()
// .figureNumber() // .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(); // .dosage(oldAppSceneCostResultValue.getNum() != null ? oldAppSceneCostResultValue.getNum().doubleValue() : 0).unit(oldAppSceneCostResultValue.getUnit())
costStandardDetails.add(costStandardDetail); .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) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@@ -3,6 +3,8 @@ package com.zzsmart.qomo.kn.cost.manage.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostBomRelevancy; import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostBomRelevancy;
import java.util.List;
/** /**
* @Description: app_scene_cost_bom_relevancy * @Description: app_scene_cost_bom_relevancy
* @Author: jeecg-boot * @Author: jeecg-boot
@@ -10,5 +12,18 @@ import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostBomRelevancy;
* @Version: V1.0 * @Version: V1.0
*/ */
public interface IAppSceneCostBomRelevancyService extends IService<AppSceneCostBomRelevancy> { public interface IAppSceneCostBomRelevancyService extends IService<AppSceneCostBomRelevancy> {
/**
* 分页查询
* @param
* @return
*/
List<AppSceneCostBomRelevancy> queryListResult(String materialNumber);
/**
* 查询最顶层物料编号下所有的物料
* @param topMaterialCode
* @return
*/
List<AppSceneCostBomRelevancy> queryAllBomInfoByTopMaterialCode(String topMaterialCode);
} }
@@ -2,6 +2,7 @@ package com.zzsmart.qomo.kn.cost.manage.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostCount; 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 com.zzsmart.qomo.kn.cost.manage.vo.MissingComponentVO;
import java.util.List; import java.util.List;
@@ -31,5 +32,5 @@ public interface IAppSceneCostCountService extends IService<AppSceneCostCount> {
* 添加标准成本计算任务 * 添加标准成本计算任务
* @param appSceneCostCount * @param appSceneCostCount
*/ */
void addCostCountTask(AppSceneCostCount appSceneCostCount); void addCostCountTask(AppSceneCostCountVO appSceneCostCount);
} }
@@ -10,5 +10,10 @@ import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostHourRate;
* @Version: V1.0 * @Version: V1.0
*/ */
public interface IAppSceneCostHourRateService extends IService<AppSceneCostHourRate> { public interface IAppSceneCostHourRateService extends IService<AppSceneCostHourRate> {
/**
* 查询满足条件的一条小时费率信息
* @param appSceneCostHourRate
* @return
*/
AppSceneCostHourRate getOneHourRateInfo(AppSceneCostHourRate appSceneCostHourRate);
} }
@@ -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<AppSceneCostMaterialBom> {
/**
* 分页查询
* @param
* @return
*/
List<AppSceneCostMaterialBom> queryListResult(String materialNumber);
/**
* 查询最顶层物料编号下所有的物料
* @param topMaterialCode
* @return
*/
List<AppSceneCostMaterialBom> queryAllBomInfoBytopMaterialCode(String topMaterialCode);
}
@@ -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<AppSceneCostMaterialProcessHours> {
/**
* 查询满足物料编号的工时工序
*/
Map<String, List<AppSceneCostMaterialProcessHours>> getProcessHoursByMaterialNo(List<String> materialNos);
}
@@ -3,6 +3,9 @@ package com.zzsmart.qomo.kn.cost.manage.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostProductProcessMaintenance; import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostProductProcessMaintenance;
import java.util.List;
import java.util.Map;
/** /**
* @Description: app_scene_cost_product_process_maintenance * @Description: app_scene_cost_product_process_maintenance
* @Author: jeecg-boot * @Author: jeecg-boot
@@ -10,5 +13,9 @@ import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostProductProcessMaintena
* @Version: V1.0 * @Version: V1.0
*/ */
public interface IAppSceneCostProductProcessMaintenanceService extends IService<AppSceneCostProductProcessMaintenance> { public interface IAppSceneCostProductProcessMaintenanceService extends IService<AppSceneCostProductProcessMaintenance> {
/**
* 查询满足物料编号的工时工序
*/
Map<String, List<AppSceneCostProductProcessMaintenance>> getProcessHoursByMaterialNo(List<String> materialNos);
} }
@@ -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<AppSceneCostPurchasePrice> {
/**
* 查询满足物料编号的最低采购价
*/
Map<String, BigDecimal> getMinCostPurchasePriceByMaterialNo(List<String> materialNos);
}
@@ -3,6 +3,10 @@ package com.zzsmart.qomo.kn.cost.manage.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostPurchaseRecord; 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 * @Description: app_scene_cost_purchase_record
* @Author: jeecg-boot * @Author: jeecg-boot
@@ -10,5 +14,9 @@ import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostPurchaseRecord;
* @Version: V1.0 * @Version: V1.0
*/ */
public interface IAppSceneCostPurchaseRecordService extends IService<AppSceneCostPurchaseRecord> { public interface IAppSceneCostPurchaseRecordService extends IService<AppSceneCostPurchaseRecord> {
/**
* 查询满足物料编号的最低采购价
*/
Map<String, BigDecimal> getMinCostPurchasePriceByMaterialNo(List<String> materialNos);
} }
@@ -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<AppSceneCostStandardResult> {
}
@@ -1,12 +1,17 @@
package com.zzsmart.qomo.kn.cost.manage.service.impl; 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.entity.AppSceneCostBomRelevancy;
import com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostBomRelevancyMapper; import com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostBomRelevancyMapper;
import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostBomRelevancyService; import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostBomRelevancyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
/** /**
* @Description: app_scene_cost_bom_relevancy * @Description: app_scene_cost_bom_relevancy
* @Author: jeecg-boot * @Author: jeecg-boot
@@ -15,5 +20,41 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
*/ */
@Service @Service
public class AppSceneCostBomRelevancyServiceImpl extends ServiceImpl<AppSceneCostBomRelevancyMapper, AppSceneCostBomRelevancy> implements IAppSceneCostBomRelevancyService { public class AppSceneCostBomRelevancyServiceImpl extends ServiceImpl<AppSceneCostBomRelevancyMapper, AppSceneCostBomRelevancy> implements IAppSceneCostBomRelevancyService {
/**
* 物料BOM信息
*/
@Autowired
AppSceneCostBomRelevancyMapper costMaterialBomMapper;
/**
* 分页查询
*
* @param materialNumber
* @return
*/
@Override
public List<AppSceneCostBomRelevancy> 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<AppSceneCostBomRelevancy> queryAllBomInfoByTopMaterialCode(String topMaterialCode) {
List<AppSceneCostBomRelevancy> childrens = costMaterialBomMapper.findChildrenByParentId(topMaterialCode);
//TODO 循环遍历查出所有的物料下的物料(包含最上层的物料)
//TODO 所有的物料并进行层级排序
return childrens;
}
} }
@@ -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.FlowInstance;
import com.zzsmart.qomo.dao.entity.FlowInstanceParameter; import com.zzsmart.qomo.dao.entity.FlowInstanceParameter;
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostCount; 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.AppSceneCostPartMissingInfo;
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostStandardVersion; 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.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.AppSceneCostCountMapper;
import com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostPartMissingInfoMapper; 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.plugin.StandardCostService;
import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostCountService; 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.service.IAppSceneCostStandardVersionService;
import com.zzsmart.qomo.kn.cost.manage.vo.AppSceneCostCountVO;
import com.zzsmart.qomo.kn.cost.manage.vo.MissingComponentVO; import com.zzsmart.qomo.kn.cost.manage.vo.MissingComponentVO;
import com.zzsmart.qomo.service.IDataFlowInstanceService; import com.zzsmart.qomo.service.IDataFlowInstanceService;
import com.zzsmart.qomo.service.IFlowInstanceParameterService; import com.zzsmart.qomo.service.IFlowInstanceParameterService;
@@ -24,6 +27,7 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Random;
/** /**
* @Description: app_scene_cost_count * @Description: app_scene_cost_count
@@ -41,8 +45,7 @@ public class AppSceneCostCountServiceImpl extends ServiceImpl<AppSceneCostCountM
private IFlowInstanceParameterService flowInstanceParameterService; private IFlowInstanceParameterService flowInstanceParameterService;
@Autowired @Autowired
private AppSceneCostPartMissingInfoMapper costPartMissingInfoMapper; private AppSceneCostPartMissingInfoMapper costPartMissingInfoMapper;
@Autowired
StandardCostService standardCostService;
/** /**
* 查看关键缺失部件 * 查看关键缺失部件
@@ -122,8 +125,9 @@ public class AppSceneCostCountServiceImpl extends ServiceImpl<AppSceneCostCountM
* @param appSceneCostCount * @param appSceneCostCount
*/ */
@Override @Override
public void addCostCountTask(AppSceneCostCount appSceneCostCount) { public void addCostCountTask(AppSceneCostCountVO appSceneCostCount) {
//1.新增版本号记录成功后 //1.新增版本号记录成功后
appSceneCostCount.setCostVersion("Version"+String.valueOf(new Random().nextInt(100000)));
AppSceneCostStandardVersion costStandardVersion = AppSceneCostStandardVersion.builder().graphicnumber(appSceneCostCount.getDrawingNo()).matnr(appSceneCostCount.getMaterialNo()).stage(appSceneCostCount.getStage()).version(appSceneCostCount.getCostVersion()).versionYear(appSceneCostCount.getYear()).build(); AppSceneCostStandardVersion costStandardVersion = AppSceneCostStandardVersion.builder().graphicnumber(appSceneCostCount.getDrawingNo()).matnr(appSceneCostCount.getMaterialNo()).stage(appSceneCostCount.getStage()).version(appSceneCostCount.getCostVersion()).versionYear(appSceneCostCount.getYear()).build();
boolean save = costStandardVersionService.save(costStandardVersion); boolean save = costStandardVersionService.save(costStandardVersion);
//2.新增标准成本计算任务,并立即执行标准成本计算 //2.新增标准成本计算任务,并立即执行标准成本计算
@@ -142,7 +146,7 @@ public class AppSceneCostCountServiceImpl extends ServiceImpl<AppSceneCostCountM
// } // }
// 方案二:直接执行标准成本计算 // 方案二:直接执行标准成本计算
countStandardCost(appSceneCostCount1); countStandardCost(appSceneCostCount, (new Random().nextInt(1000)) + (new Random().nextInt(100)));
} }
} }
@@ -151,13 +155,29 @@ public class AppSceneCostCountServiceImpl extends ServiceImpl<AppSceneCostCountM
* *
* @param appSceneCostCount1 * @param appSceneCostCount1
*/ */
private void countStandardCost(AppSceneCostCount appSceneCostCount1) { private void countStandardCost(AppSceneCostCountVO appSceneCostCount1, Integer flowInstanceId) {
//0.获取物料下所有的子物料 //0.获取物料下所有的子物料
StandardCostService.getAllMaterialBomInfoByTopMaterialCode(appSceneCostCount1.getMaterialNo(), "MaterialInput", "MaterialInput001", flowInstanceId);
//1.物料成本计算 //1.物料成本计算
StandardCostService.countMaterialCostByTopMaterialCode(appSceneCostCount1.getMaterialNo(), "MaterialCost", "MaterialCost002", flowInstanceId, FeeTypeEnum.MaterialCost.getCode());
//2.人工成本计算 //2.人工成本计算
//3.制造计算(各种费用) AppSceneCostHourRate hourRate = new AppSceneCostHourRate();
hourRate.setYear(appSceneCostCount1.getYear());
hourRate.setCostCenterCode(appSceneCostCount1.getCostCenter());
hourRate.setFactory(appSceneCostCount1.getFactory()==null?"8100":appSceneCostCount1.getFactory());
StandardCostService.countLaborCostByTopMaterialCode(appSceneCostCount1.getMaterialNo(), "LaborCost", "LaborCost003", flowInstanceId, FeeTypeEnum.LaborCost.getCode(), hourRate);
//3.制造计算(各种费用)MaterialCost("MaterialCost", "物料成本"), EquipmentFee("EquipmentFee", "设备费"), SupplyMaterialFee("SupplyMaterialFee", "辅料费"), DriverFee("DriverFee", "水电费"), OtherFee("OtherFee", "其他费用"), LogisticsFee("LogisticsFee", "物流费")
//3.1设备费计算
StandardCostService.countManufacturingCostByTopMaterialCode(appSceneCostCount1.getMaterialNo(), "ManufacturingCost", "ManufacturingCost004", flowInstanceId, FeeTypeEnum.EquipmentFee.getCode(), hourRate);
//3.2辅料费计算
StandardCostService.countManufacturingCostByTopMaterialCode(appSceneCostCount1.getMaterialNo(), "ManufacturingCost", "ManufacturingCost005", flowInstanceId, FeeTypeEnum.SupplyMaterialFee.getCode(), hourRate);
//3.3水电费
StandardCostService.countManufacturingCostByTopMaterialCode(appSceneCostCount1.getMaterialNo(), "ManufacturingCost", "ManufacturingCost006", flowInstanceId, FeeTypeEnum.DriverFee.getCode(), hourRate);
//3.4其他费用
StandardCostService.countManufacturingCostByTopMaterialCode(appSceneCostCount1.getMaterialNo(), "ManufacturingCost", "ManufacturingCost007", flowInstanceId, FeeTypeEnum.OtherFee.getCode(), hourRate);
//3.5物流费
StandardCostService.countManufacturingCostByTopMaterialCode(appSceneCostCount1.getMaterialNo(), "ManufacturingCost", "ManufacturingCost008", flowInstanceId, FeeTypeEnum.LogisticsFee.getCode(), hourRate);
//4.标准成本本计算 //4.标准成本本计算
StandardCostService.countStandardCostByTopMaterialCode(appSceneCostCount1.getMaterialNo(), "StandardCost", "StandardCost009", flowInstanceId, FeeTypeEnum.StandardCost.getCode(),appSceneCostCount1.getCostVersion());
} }
} }
@@ -1,9 +1,12 @@
package com.zzsmart.qomo.kn.cost.manage.service.impl; 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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
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.AppSceneCostHourRate;
import com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostHourRateMapper; import com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostHourRateMapper;
import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostHourRateService; import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostHourRateService;
import org.jeecg.common.system.query.QueryGenerator;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
@@ -15,4 +18,28 @@ import org.springframework.stereotype.Service;
@Service @Service
public class AppSceneCostHourRateServiceImpl extends ServiceImpl<AppSceneCostHourRateMapper, AppSceneCostHourRate> implements IAppSceneCostHourRateService { public class AppSceneCostHourRateServiceImpl extends ServiceImpl<AppSceneCostHourRateMapper, AppSceneCostHourRate> implements IAppSceneCostHourRateService {
/**
* 查询满足条件的一条小时费率信息
*
* @param appSceneCostHourRate
* @return
*/
@Override
public AppSceneCostHourRate getOneHourRateInfo(AppSceneCostHourRate appSceneCostHourRate) {
QueryWrapper<AppSceneCostHourRate> 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;
}
} }
@@ -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<AppSceneCostMaterialBomMapper, AppSceneCostMaterialBom> implements IAppSceneCostMaterialBomService {
@Autowired
AppSceneCostMaterialBomMapper costMaterialBomMapper;
/**
* 分页查询
*
* @param materialNumber
* @return
*/
@Override
public List<AppSceneCostMaterialBom> 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<AppSceneCostMaterialBom> queryAllBomInfoBytopMaterialCode(String topMaterialCode) {
QueryWrapper queryWrapper = new QueryWrapper();
//TODO 循环遍历查出所有的物料下的物料(包含最上层的物料)
// if (StrUtil.isNotEmpty(topMaterialCode)) {
// // 物料号
// queryWrapper.like("material_code", topMaterialCode);
// }
List list = costMaterialBomMapper.selectList(queryWrapper);
return list;
}
}
@@ -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<AppSceneCostMaterialProcessHoursMapper, AppSceneCostMaterialProcessHours> implements IAppSceneCostMaterialProcessHoursService {
@Autowired
AppSceneCostMaterialProcessHoursMapper costMaterialProcessHoursMapper;
/**
* 查询满足物料编号的工时工序
*
* @param materialNos
*/
@Override
public Map<String, List<AppSceneCostMaterialProcessHours>> getProcessHoursByMaterialNo(List<String> materialNos) {
Map<String, List<AppSceneCostMaterialProcessHours>> map = new HashMap<>();
QueryWrapper<AppSceneCostMaterialProcessHours> queryWrapper = new QueryWrapper();
if (materialNos != null && materialNos.size() > 0) {
queryWrapper.in("material_code", materialNos);
List<AppSceneCostMaterialProcessHours> 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<AppSceneCostMaterialProcessHours> list = map.get(materialCode);
list.add(costMaterialProcessHours1);
map.put(materialCode, list);
} else {
List<AppSceneCostMaterialProcessHours> list = new ArrayList<>();
list.add(costMaterialProcessHours1);
map.put(materialCode, list);
}
}
}
return map;
}
}
@@ -1,11 +1,17 @@
package com.zzsmart.qomo.kn.cost.manage.service.impl; 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.entity.AppSceneCostProductProcessMaintenance;
import com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostProductProcessMaintenanceMapper; import com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostProductProcessMaintenanceMapper;
import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostProductProcessMaintenanceService; import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostProductProcessMaintenanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; 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 * @Description: app_scene_cost_product_process_maintenance
@@ -16,4 +22,36 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service @Service
public class AppSceneCostProductProcessMaintenanceServiceImpl extends ServiceImpl<AppSceneCostProductProcessMaintenanceMapper, AppSceneCostProductProcessMaintenance> implements IAppSceneCostProductProcessMaintenanceService { public class AppSceneCostProductProcessMaintenanceServiceImpl extends ServiceImpl<AppSceneCostProductProcessMaintenanceMapper, AppSceneCostProductProcessMaintenance> implements IAppSceneCostProductProcessMaintenanceService {
@Autowired
AppSceneCostProductProcessMaintenanceMapper costMaterialProcessHoursMapper;
/**
* 查询满足物料编号的工时工序
*
* @param materialNos
*/
@Override
public Map<String, List<AppSceneCostProductProcessMaintenance>> getProcessHoursByMaterialNo(List<String> materialNos) {
Map<String, List<AppSceneCostProductProcessMaintenance>> map = new HashMap<>();
QueryWrapper<AppSceneCostProductProcessMaintenance> queryWrapper = new QueryWrapper();
if (materialNos != null && materialNos.size() > 0) {
queryWrapper.in("main_part_number", materialNos);
queryWrapper.orderByAsc("serial_number");
List<AppSceneCostProductProcessMaintenance> 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<AppSceneCostProductProcessMaintenance> list = map.get(materialCode);
list.add(costMaterialProcessHours1);
map.put(materialCode, list);
} else {
List<AppSceneCostProductProcessMaintenance> list = new ArrayList<>();
list.add(costMaterialProcessHours1);
map.put(materialCode, list);
}
}
}
return map;
}
} }
@@ -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<AppSceneCostPurchasePriceMapper, AppSceneCostPurchasePrice> implements IAppSceneCostPurchasePriceService {
@Autowired
AppSceneCostPurchasePriceMapper costPurchasePriceMapper;
/**
* 查询满足物料编号的最低采购价
*
* @param materialNos
*/
@Override
public Map<String, BigDecimal> getMinCostPurchasePriceByMaterialNo(List<String> materialNos) {
Map<String, BigDecimal> map = new HashMap<>();
QueryWrapper<AppSceneCostPurchasePrice> queryWrapper = new QueryWrapper();
if (materialNos != null && materialNos.size() > 0) {
queryWrapper.in("material_code", materialNos);
List<AppSceneCostPurchasePrice> 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;
}
}
@@ -1,11 +1,18 @@
package com.zzsmart.qomo.kn.cost.manage.service.impl; 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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostPurchaseRecord; 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.mapper.AppSceneCostPurchaseRecordMapper;
import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostPurchaseRecordService; import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostPurchaseRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; 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 * @Description: app_scene_cost_purchase_record
* @Author: jeecg-boot * @Author: jeecg-boot
@@ -14,5 +21,26 @@ import org.springframework.stereotype.Service;
*/ */
@Service @Service
public class AppSceneCostPurchaseRecordServiceImpl extends ServiceImpl<AppSceneCostPurchaseRecordMapper, AppSceneCostPurchaseRecord> implements IAppSceneCostPurchaseRecordService { public class AppSceneCostPurchaseRecordServiceImpl extends ServiceImpl<AppSceneCostPurchaseRecordMapper, AppSceneCostPurchaseRecord> implements IAppSceneCostPurchaseRecordService {
@Autowired
AppSceneCostPurchaseRecordMapper appSceneCostPurchaseRecordMapper;
/**
* 查询满足物料编号的最低采购价
*
* @param materialNos
*/
@Override
public Map<String, BigDecimal> getMinCostPurchasePriceByMaterialNo(List<String> materialNos) {
Map<String, BigDecimal> map = new HashMap<>();
QueryWrapper<AppSceneCostPurchaseRecord> queryWrapper = new QueryWrapper();
if (materialNos != null && materialNos.size() > 0) {
queryWrapper.in("INFNR", materialNos);
List<AppSceneCostPurchaseRecord> 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;
}
} }
@@ -28,19 +28,19 @@ public class AppSceneCostResultValueServiceImpl extends ServiceImpl<AppSceneCost
* 根据顶级物料编码查询满足条件的结果值 * 根据顶级物料编码查询满足条件的结果值
* *
* @param topMaterialCode * @param topMaterialCode
* @param lastTaskType * @param taskType
* @param flowInstanceId * @param flowInstanceId
* @return * @return
*/ */
@Override @Override
public List<AppSceneCostResultValue> getResultValueByTopMaterialNo(String topMaterialCode, String lastTaskType, String flowInstanceId) { public List<AppSceneCostResultValue> getResultValueByTopMaterialNo(String topMaterialCode, String taskType, String flowInstanceId) {
List<AppSceneCostResultValue> result = new ArrayList<>(); List<AppSceneCostResultValue> result = new ArrayList<>();
QueryWrapper<AppSceneCostResultValue> queryWrapper = new QueryWrapper<>(); QueryWrapper<AppSceneCostResultValue> 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); 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物料所有的树节点信息 //查询BOM物料所有的树节点信息
queryWrapper.eq("belong_top_material_no", topMaterialCode).eq("flow_instance_id", flowInstanceId).isNull("task_type"); queryWrapper.eq("belong_top_material_no", topMaterialCode).eq("flow_instance_id", flowInstanceId).isNull("task_type");
result = appSceneCostResultValueMapper.selectList(queryWrapper); result = appSceneCostResultValueMapper.selectList(queryWrapper);
@@ -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<AppSceneCostStandardResultMapper, AppSceneCostStandardResult> implements IAppSceneCostStandardResultService {
}
@@ -1,12 +1,66 @@
package com.zzsmart.qomo.kn.cost.manage.vo; 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.Data;
import lombok.NoArgsConstructor;
@Data @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 statusName;
/**
* 成本中心
*/
public String costCenter;
/**
* 工厂
*/
public String factory;
} }
@@ -0,0 +1,209 @@
package com.zzsmart.qomo.kn.cost.manage.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class AppSceneCostStandardResultVO {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "id")
private String id;
/**
* 图号
*/
@Excel(name = "图号", width = 15)
@ApiModelProperty(value = "图号")
private String figureNumber;
/**
* 物料号,关联kn_new_sap_mara表matnr字段
*/
@Excel(name = "物料号,关联kn_new_sap_mara表matnr字段", width = 15)
@ApiModelProperty(value = "物料号,关联kn_new_sap_mara表matnr字段")
private String materialNumber;
/**
* 物料名称
*/
@Excel(name = "物料名称", width = 15)
@ApiModelProperty(value = "物料名称")
private String materialName;
/**
* 父类物料号
*/
@Excel(name = "父类物料号", width = 15)
@ApiModelProperty(value = "父类物料号")
private String parentMaterialNumber;
/**
* 版本号
*/
@Excel(name = "版本号", width = 15)
@ApiModelProperty(value = "版本号")
private String versionNumber;
/**
* 层级
*/
@Excel(name = "层级", width = 15)
@ApiModelProperty(value = "层级")
private Integer level;
/**
* 序号
*/
@Excel(name = "序号", width = 15)
@ApiModelProperty(value = "序号")
private Integer sort;
/**
* 用量
*/
@Excel(name = "用量", width = 15)
@ApiModelProperty(value = "用量")
private Double dosage;
/**
* 单位
*/
@Excel(name = "单位", width = 15)
@ApiModelProperty(value = "单位")
private String unit;
/**
* 本阶材料费
*/
@Excel(name = "本阶材料费", width = 15)
@ApiModelProperty(value = "本阶材料费")
private BigDecimal materialCost;
/**
* 本阶人工费
*/
@Excel(name = "本阶人工陈本", width = 15)
@ApiModelProperty(value = "本阶人工成本")
private BigDecimal laborCost;
/**
* 本阶辅料费
*/
@Excel(name = "本阶辅料费", width = 15)
@ApiModelProperty(value = "本阶辅料费")
private BigDecimal supplyMaterialCost;
/**
* 本阶机器折旧费
*/
@Excel(name = "本阶机器折旧费", width = 15)
@ApiModelProperty(value = "本阶机器折旧费")
private BigDecimal equipmentCost;
/**
* 本阶水电费(燃动费)
*/
@Excel(name = "本阶水电费(燃动费)", width = 15)
@ApiModelProperty(value = "本阶水电费(燃动费)")
private BigDecimal driveCost;
/**
* 本阶其他制造费
*/
@Excel(name = "本阶其他费用", width = 15)
@ApiModelProperty(value = "本阶其他费用")
private BigDecimal otherCost;
/**
* 本阶物流费
*/
@Excel(name = "本阶物流费", width = 15)
@ApiModelProperty(value = "本阶物流费")
private BigDecimal logisticsCost;
/**
* 累计物料成本
*/
@Excel(name = "累计物料成本", width = 15)
@ApiModelProperty(value = "累计物料成本")
private BigDecimal totalMaterialCost;
/**
* 累计人工成本
*/
@Excel(name = "累计人工成本", width = 15)
@ApiModelProperty(value = "累计人工成本")
private BigDecimal totalLaborCost;
/**
* 累计辅料费
*/
@Excel(name = "累计辅料费", width = 15)
@ApiModelProperty(value = "累计辅料费")
private BigDecimal totalSupplyMaterialCost;
/**
* 累计机器折旧费
*/
@Excel(name = "累计机器折旧费", width = 15)
@ApiModelProperty(value = "累计机器折旧费")
private BigDecimal totalEquipmentCost;
/**
* 累计水电费(燃动费)
*/
@Excel(name = "累计水电费(燃动费)", width = 15)
@ApiModelProperty(value = "累计水电费(燃动费)")
private BigDecimal totalDriveCost;
/**
* 累计其他费用
*/
@Excel(name = "累计其他费用", width = 15)
@ApiModelProperty(value = "累计其他费用")
private BigDecimal totalOtherCost;
/**
* 累计物流费用
*/
@Excel(name = "累计物流费用", width = 15)
@ApiModelProperty(value = "累计物流费用")
private BigDecimal totalLogisticsCost;
/**
* 本阶标准成本
*/
@Excel(name = "本阶标准成本", width = 15)
@ApiModelProperty(value = "本阶标准成本")
private BigDecimal currentStandardCost;
/**
* 累计标准成本
*/
@Excel(name = "累计标准成本", width = 15)
@ApiModelProperty(value = "累计标准成本")
private BigDecimal totalStandardCost;
/**
* 创建人
*/
@ApiModelProperty(value = "创建人")
private String createBy;
/**
* 创建日期
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private Date createTime;
/**
* 修改人
*/
@ApiModelProperty(value = "修改人")
private String updateBy;
/**
* 修改日期
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改日期")
private Date updateTime;
/**
* 备注
*/
@Excel(name = "备注", width = 15)
@ApiModelProperty(value = "备注")
private String remark;
}
@@ -12,7 +12,6 @@ import lombok.NoArgsConstructor;
* 模型信息封装 * 模型信息封装
*/ */
@Data @Data
@Builder
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class CostModelDefinitionVO extends AppSceneCostModel { public class CostModelDefinitionVO extends AppSceneCostModel {