优化标准成本计算后批量存储到标准成本详情表中(单行查询表中)
This commit is contained in:
+159
@@ -0,0 +1,159 @@
|
||||
package com.zzsmart.qomo.kn.cost.manage.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostStandardDetail;
|
||||
import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostStandardDetailService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* @Description: app_scene_cost_standard_detail
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-07-31
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags = "cost-标准成本单行查询")
|
||||
@RestController
|
||||
@RequestMapping("//costStandardDetail")
|
||||
@Slf4j
|
||||
public class AppSceneCostStandardDetailController extends JeecgController<AppSceneCostStandardDetail, IAppSceneCostStandardDetailService> {
|
||||
@Autowired
|
||||
private IAppSceneCostStandardDetailService appSceneCostStandardDetailService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param appSceneCostStandardDetail
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "app_scene_cost_standard_detail-分页列表查询")
|
||||
@ApiOperation(value = "app_scene_cost_standard_detail-分页列表查询", notes = "app_scene_cost_standard_detail-分页列表查询")
|
||||
@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) {
|
||||
QueryWrapper<AppSceneCostStandardDetail> queryWrapper = QueryGenerator.initQueryWrapper(appSceneCostStandardDetail, req.getParameterMap());
|
||||
Page<AppSceneCostStandardDetail> page = new Page<AppSceneCostStandardDetail>(pageNo, pageSize);
|
||||
IPage<AppSceneCostStandardDetail> pageList = appSceneCostStandardDetailService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
//
|
||||
// /**
|
||||
// * 添加
|
||||
// *
|
||||
// * @param appSceneCostStandardDetail
|
||||
// * @return
|
||||
// */
|
||||
// @AutoLog(value = "app_scene_cost_standard_detail-添加")
|
||||
// @ApiOperation(value = "app_scene_cost_standard_detail-添加", notes = "app_scene_cost_standard_detail-添加")
|
||||
// @RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_standard_detail:add")
|
||||
// @PostMapping(value = "/add")
|
||||
// public Result<String> add(@RequestBody AppSceneCostStandardDetail appSceneCostStandardDetail) {
|
||||
// appSceneCostStandardDetailService.save(appSceneCostStandardDetail);
|
||||
// return Result.OK("添加成功!");
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * 编辑
|
||||
// *
|
||||
// * @param appSceneCostStandardDetail
|
||||
// * @return
|
||||
// */
|
||||
// @AutoLog(value = "app_scene_cost_standard_detail-编辑")
|
||||
// @ApiOperation(value = "app_scene_cost_standard_detail-编辑", notes = "app_scene_cost_standard_detail-编辑")
|
||||
// @RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_standard_detail:edit")
|
||||
// @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
// public Result<String> edit(@RequestBody AppSceneCostStandardDetail appSceneCostStandardDetail) {
|
||||
// appSceneCostStandardDetailService.updateById(appSceneCostStandardDetail);
|
||||
// return Result.OK("编辑成功!");
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 通过id删除
|
||||
// *
|
||||
// * @param id
|
||||
// * @return
|
||||
// */
|
||||
// @AutoLog(value = "app_scene_cost_standard_detail-通过id删除")
|
||||
// @ApiOperation(value = "app_scene_cost_standard_detail-通过id删除", notes = "app_scene_cost_standard_detail-通过id删除")
|
||||
// @RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_standard_detail:delete")
|
||||
// @DeleteMapping(value = "/delete")
|
||||
// public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
// appSceneCostStandardDetailService.removeById(id);
|
||||
// return Result.OK("删除成功!");
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 批量删除
|
||||
// *
|
||||
// * @param ids
|
||||
// * @return
|
||||
// */
|
||||
// @AutoLog(value = "app_scene_cost_standard_detail-批量删除")
|
||||
// @ApiOperation(value = "app_scene_cost_standard_detail-批量删除", notes = "app_scene_cost_standard_detail-批量删除")
|
||||
// @RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_standard_detail:deleteBatch")
|
||||
// @DeleteMapping(value = "/deleteBatch")
|
||||
// public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
// this.appSceneCostStandardDetailService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
// return Result.OK("批量删除成功!");
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * 通过id查询
|
||||
// *
|
||||
// * @param id
|
||||
// * @return
|
||||
// */
|
||||
// //@AutoLog(value = "app_scene_cost_standard_detail-通过id查询")
|
||||
// @ApiOperation(value = "app_scene_cost_standard_detail-通过id查询", notes = "app_scene_cost_standard_detail-通过id查询")
|
||||
// @GetMapping(value = "/queryById")
|
||||
// public Result<AppSceneCostStandardDetail> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
// AppSceneCostStandardDetail appSceneCostStandardDetail = appSceneCostStandardDetailService.getById(id);
|
||||
// if (appSceneCostStandardDetail == null) {
|
||||
// return Result.error("未找到对应数据");
|
||||
// }
|
||||
// return Result.OK(appSceneCostStandardDetail);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param appSceneCostStandardDetail
|
||||
*/
|
||||
@RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_standard_detail:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, AppSceneCostStandardDetail appSceneCostStandardDetail) {
|
||||
return super.exportXls(request, appSceneCostStandardDetail, AppSceneCostStandardDetail.class, "app_scene_cost_standard_detail");
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 通过excel导入数据
|
||||
// *
|
||||
// * @param request
|
||||
// * @param response
|
||||
// * @return
|
||||
// */
|
||||
// @RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_standard_detail:importExcel")
|
||||
// @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
// public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
// return super.importExcel(request, response, AppSceneCostStandardDetail.class);
|
||||
// }
|
||||
|
||||
}
|
||||
-70
@@ -1,70 +0,0 @@
|
||||
package com.zzsmart.qomo.kn.cost.manage.controller;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zzsmart.qomo.kn.cost.manage.entity.CostStandardDetail;
|
||||
import com.zzsmart.qomo.kn.cost.manage.service.CostStandardDetailService;
|
||||
import com.zzsmart.qomo.kn.cost.manage.vo.CostStandardDetailSearch;
|
||||
import com.zzsmart.qomo.kn.cost.manage.vo.CostStandardDetailVO;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 标准成本明细表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author app_scene_cost_purchase_price
|
||||
* @since 2024-06-19
|
||||
*/
|
||||
@Api(tags = "cost-标准成本单行查询")
|
||||
@RestController
|
||||
@RequestMapping("//costStandardDetail")
|
||||
@Slf4j
|
||||
public class CostStandardDetailController extends JeecgController<CostStandardDetail, CostStandardDetailService> {
|
||||
@Autowired
|
||||
private CostStandardDetailService costStandardDetailService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param costStandard
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "标准成本单行列表查询")
|
||||
@ApiOperation(value = "标准成本单行列表查询", notes = "标准成本单行列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<CostStandardDetailVO>> queryPageList(CostStandardDetailVO costStandard, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
|
||||
|
||||
Page<CostStandardDetailVO> page = new Page<CostStandardDetailVO>(pageNo, pageSize);
|
||||
IPage<CostStandardDetailVO> pageList = costStandardDetailService.pageList(page, costStandard);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param costStandardDetailSearch
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls", method = RequestMethod.GET)
|
||||
@ApiOperation(value = "单行查询导出", notes = "单行查询导出")
|
||||
public Result exportXls(HttpServletRequest request, HttpServletResponse response, CostStandardDetailSearch costStandardDetailSearch) throws IOException {
|
||||
JSONObject result = costStandardDetailService.exportExcel(request, response, costStandardDetailSearch);
|
||||
return Result.OK(result);
|
||||
}
|
||||
}
|
||||
+13
@@ -14,6 +14,7 @@ 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;
|
||||
|
||||
/**
|
||||
@@ -121,4 +122,16 @@ public class AppSceneCostResultValue implements Serializable {
|
||||
@Excel(name = "成本明细", width = 15)
|
||||
@ApiModelProperty(value = "成本明细")
|
||||
private String costDetail;
|
||||
/**
|
||||
* 单价或费率
|
||||
*/
|
||||
@Excel(name = "单价或费率", width = 15)
|
||||
@ApiModelProperty(value = "单价或费率")
|
||||
private BigDecimal priceOrRate;
|
||||
/**
|
||||
* 工时
|
||||
*/
|
||||
@Excel(name = "工时", width = 15)
|
||||
@ApiModelProperty(value = "工时")
|
||||
private BigDecimal hour;
|
||||
}
|
||||
|
||||
+159
@@ -0,0 +1,159 @@
|
||||
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.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_standard_detail
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-07-31
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@TableName("app_scene_cost_standard_detail")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "app_scene_cost_standard_detail对象", description = "app_scene_cost_standard_detail")
|
||||
public class AppSceneCostStandardDetail 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 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;
|
||||
}
|
||||
-273
@@ -1,273 +0,0 @@
|
||||
package com.zzsmart.qomo.kn.cost.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 标准成本明细表
|
||||
* </p>
|
||||
*
|
||||
* @author
|
||||
* @since 2024-06-20
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@TableName("app_scene_cost_standard_detail")
|
||||
@EqualsAndHashCode
|
||||
public class CostStandardDetail implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 物料号,关联kn_new_sap_mara表matnr字段
|
||||
*/
|
||||
@TableField("material_number")
|
||||
@ApiModelProperty(value = "物料号,关联kn_new_sap_mara表matnr字段")
|
||||
@Excel(name = "物料号")
|
||||
private String materialNumber;
|
||||
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
@TableField("material_name")
|
||||
@ApiModelProperty(value = "物料名称")
|
||||
@Excel(name = "物料名称")
|
||||
private String materialName;
|
||||
|
||||
/**
|
||||
* 父类物料号
|
||||
*/
|
||||
@TableField("parent_material_number")
|
||||
@ApiModelProperty(value = "父类物料号")
|
||||
@Excel(name = "父类物料号")
|
||||
private String parentMaterialNumber;
|
||||
|
||||
/**
|
||||
* 版本号id
|
||||
*/
|
||||
@TableField("version_number_id")
|
||||
@ApiModelProperty(value = "版本号id")
|
||||
private String versionNumberId;
|
||||
|
||||
/**
|
||||
* 层级
|
||||
*/
|
||||
@TableField("level")
|
||||
@ApiModelProperty(value = "层级")
|
||||
@Excel(name = "层级")
|
||||
private Integer level;
|
||||
|
||||
/**
|
||||
* 图号
|
||||
*/
|
||||
@TableField("figure_number")
|
||||
@ApiModelProperty(value = "图号")
|
||||
@Excel(name = "图号")
|
||||
private String figureNumber;
|
||||
|
||||
/**
|
||||
* 用量
|
||||
*/
|
||||
@TableField("dosage")
|
||||
@ApiModelProperty(value = "用量")
|
||||
@Excel(name = "用量")
|
||||
private Double dosage;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
@TableField("unit")
|
||||
@ApiModelProperty(value = "单位")
|
||||
@Excel(name = "单位")
|
||||
private String unit;
|
||||
|
||||
/**
|
||||
* 规格
|
||||
*/
|
||||
@TableField("specification")
|
||||
@ApiModelProperty(value = "规格")
|
||||
@Excel(name = "规格")
|
||||
private String specification;
|
||||
|
||||
/**
|
||||
* bom材料费
|
||||
*/
|
||||
@TableField("bom_cost")
|
||||
@ApiModelProperty(value = "bom材料费")
|
||||
@Excel(name = "bom材料费")
|
||||
private BigDecimal bomCost;
|
||||
|
||||
/**
|
||||
* 包装费
|
||||
*/
|
||||
@TableField("packing_cost")
|
||||
@ApiModelProperty(value = "包装费")
|
||||
@Excel(name = "包装费")
|
||||
private BigDecimal packingCost;
|
||||
|
||||
/**
|
||||
* 本阶辅料费
|
||||
*/
|
||||
@TableField("auxiliary_cost")
|
||||
@ApiModelProperty(value = "本阶辅料费")
|
||||
@Excel(name = "本阶辅料费")
|
||||
private BigDecimal auxiliaryCost;
|
||||
|
||||
/**
|
||||
* 本阶人工费
|
||||
*/
|
||||
@TableField("labor_cost")
|
||||
@ApiModelProperty(value = "本阶人工费")
|
||||
@Excel(name = "本阶人工费")
|
||||
private BigDecimal laborCost;
|
||||
|
||||
/**
|
||||
* 机器折旧费
|
||||
*/
|
||||
@TableField("euip_depreciation_cost")
|
||||
@ApiModelProperty(value = "机器折旧费")
|
||||
@Excel(name = "机器折旧费")
|
||||
private BigDecimal euipDepreciationCost;
|
||||
|
||||
/**
|
||||
* 机物料消耗费
|
||||
*/
|
||||
@TableField("equip_consume_cost")
|
||||
@ApiModelProperty(value = "机物料消耗费")
|
||||
@Excel(name = "机物料消耗费")
|
||||
private BigDecimal equipConsumeCost;
|
||||
|
||||
/**
|
||||
* 水电费
|
||||
*/
|
||||
@TableField("hydroelectricity_cost")
|
||||
@ApiModelProperty(value = "水电费")
|
||||
@Excel(name = "水电费")
|
||||
private BigDecimal hydroelectricityCost;
|
||||
|
||||
/**
|
||||
* 其他制造费
|
||||
*/
|
||||
@TableField("other_cost")
|
||||
@ApiModelProperty(value = "其他制造费")
|
||||
@Excel(name = "其他制造费")
|
||||
private BigDecimal otherCost;
|
||||
|
||||
/**
|
||||
* 物流费
|
||||
*/
|
||||
@TableField("trail_cost")
|
||||
@ApiModelProperty(value = "物流费")
|
||||
@Excel(name = "物流费")
|
||||
private BigDecimal trailCost;
|
||||
|
||||
/**
|
||||
* 制造成本
|
||||
*/
|
||||
@TableField("manufacture_cost")
|
||||
@ApiModelProperty(value = "制造成本")
|
||||
@Excel(name = "制造成本")
|
||||
private BigDecimal manufactureCost;
|
||||
|
||||
/**
|
||||
* 累计人工费
|
||||
*/
|
||||
@TableField("total_labor_cost")
|
||||
@ApiModelProperty(value = "累计人工费")
|
||||
@Excel(name = "累计人工费")
|
||||
private BigDecimal totalLaborCost;
|
||||
|
||||
/**
|
||||
* 累计机器消耗费
|
||||
*/
|
||||
@TableField("total_equip_consume_cost")
|
||||
@ApiModelProperty(value = "累计机器消耗费")
|
||||
@Excel(name = "累计机器消耗费")
|
||||
private BigDecimal totalEquipConsumeCost;
|
||||
|
||||
/**
|
||||
* 累计机器折旧费
|
||||
*/
|
||||
@TableField("total_euip_depreciation_cost")
|
||||
@ApiModelProperty(value = "累计机器折旧费")
|
||||
@Excel(name = "累计机器折旧费")
|
||||
private BigDecimal totalEuipDepreciationCost;
|
||||
|
||||
/**
|
||||
* 累计水电费
|
||||
*/
|
||||
@TableField("total_hydroelectricity_cost")
|
||||
@ApiModelProperty(value = "累计水电费")
|
||||
@Excel(name = "累计水电费")
|
||||
private BigDecimal totalHydroelectricityCost;
|
||||
|
||||
/**
|
||||
* 累计其它费用
|
||||
*/
|
||||
@TableField("total_other_cost")
|
||||
@ApiModelProperty(value = "累计其它费用")
|
||||
@Excel(name = "累计其它费用")
|
||||
private BigDecimal totalOtherCost;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField("create_by")
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建日期
|
||||
*/
|
||||
@TableField("create_time")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
@TableField("update_by")
|
||||
@ApiModelProperty(value = "修改人")
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 修改日期
|
||||
*/
|
||||
@TableField("update_time")
|
||||
@ApiModelProperty(value = "修改日期")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@TableField("remark")
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 序号
|
||||
*/
|
||||
@TableField("sort")
|
||||
@ApiModelProperty(value = "序号")
|
||||
@Excel(name = "序号")
|
||||
private Integer sort;
|
||||
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
package com.zzsmart.qomo.kn.cost.manage.enums;
|
||||
|
||||
/**
|
||||
* @Classname StandardStageEnum
|
||||
* @Description 阶段枚举
|
||||
* @Version 1.0.0
|
||||
* @Date 2024/6/18 9:51
|
||||
* @Created wangqiong
|
||||
*/
|
||||
public enum HourOrRateTypeEnum {
|
||||
|
||||
LaborHour("LaborHour", "人员工时"),
|
||||
LaborHourRate("LaborHourRate", "人员小时费率"),
|
||||
MaterialUnitPrice("MaterialUnitPrice", "物料采购单价"),
|
||||
EquipmentHour("EquipmentHour", "设备工时"),
|
||||
EquipmentHourRate("EquipmentHourRate", "设备小时费率"),
|
||||
SupplyMaterialHour("SupplyMaterialHour", "辅料工时"),
|
||||
SupplyMaterialHourRate("SupplyMaterialHourRate", "辅料小时费率"),
|
||||
DriverHour("DriverHour", "燃动工时"),
|
||||
DriverHourRate("DriverHourRate", "燃动小时费率"),
|
||||
OtherHour("OtherHour", "其他工时"),
|
||||
OtherHourRate("OtherHourRate", "其他小时费率");
|
||||
|
||||
private final String code;
|
||||
private final String name;
|
||||
|
||||
HourOrRateTypeEnum(String code, String name) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code获取text
|
||||
*
|
||||
* @param codeNo
|
||||
* @return
|
||||
*/
|
||||
public static String getTextByCode(String codeNo) {
|
||||
for (HourOrRateTypeEnum value : HourOrRateTypeEnum.values()) {
|
||||
if (value.getCode().equals(codeNo)) {
|
||||
return value.name();
|
||||
}
|
||||
}
|
||||
return codeNo.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据text获取code
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static String getCodeByName(String name) {
|
||||
for (HourOrRateTypeEnum value : HourOrRateTypeEnum.values()) {
|
||||
if (value.name().equals(name)) {
|
||||
return value.name();
|
||||
}
|
||||
}
|
||||
return name;
|
||||
}
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package com.zzsmart.qomo.kn.cost.manage.enums;
|
||||
|
||||
/**
|
||||
* @Classname StandardStageEnum
|
||||
* @Description 阶段枚举
|
||||
* @Version 1.0.0
|
||||
* @Date 2024/6/18 9:51
|
||||
* @Created wangqiong
|
||||
*/
|
||||
public enum TotalCostEnum {
|
||||
|
||||
|
||||
TotalLaborCost("TotalLaborCost", "总人工成本"), TotalMaterialCost("TotalMaterialCost", "总物料成本"), TotalEquipmentFee("TotalEquipmentFee", "总设备费"), TotalSupplyMaterialFee("TotalSupplyMaterialFee", "总辅料费"), TotalDriverFee("TotalDriverFee", "总水电费"), TotalOtherFee("TotalOtherFee", "总其他费用"), TotalLogisticsFee("TotalLogisticsFee", "总物流费"), TotalStandardCost("TotalStandardCost", "总标准成本");
|
||||
|
||||
|
||||
private final String code;
|
||||
private final String name;
|
||||
|
||||
TotalCostEnum(String code, String name) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code获取text
|
||||
*
|
||||
* @param codeNo
|
||||
* @return
|
||||
*/
|
||||
public static String getTextByCode(String codeNo) {
|
||||
for (TotalCostEnum value : TotalCostEnum.values()) {
|
||||
if (value.getCode().equals(codeNo)) {
|
||||
return value.name();
|
||||
}
|
||||
}
|
||||
return codeNo.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据text获取code
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static String getCodeByName(String name) {
|
||||
for (TotalCostEnum value : TotalCostEnum.values()) {
|
||||
if (value.name().equals(name)) {
|
||||
return value.name();
|
||||
}
|
||||
}
|
||||
return name;
|
||||
}
|
||||
}
|
||||
+15
@@ -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.AppSceneCostStandardDetail;
|
||||
|
||||
/**
|
||||
* @Description: app_scene_cost_standard_detail
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-07-31
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface AppSceneCostStandardDetailMapper extends BaseMapper<AppSceneCostStandardDetail> {
|
||||
|
||||
}
|
||||
-2
@@ -4,9 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zzsmart.qomo.kn.cost.manage.entity.CostStandardDetail;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zzsmart.qomo.kn.cost.manage.vo.CostStandardDetailVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
<?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.modules.demo.com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostStandardDetailMapper">
|
||||
|
||||
</mapper>
|
||||
+161
-39
@@ -4,9 +4,12 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.zzsmart.qomo.kn.cost.manage.entity.*;
|
||||
import com.zzsmart.qomo.kn.cost.manage.enums.FeeTypeEnum;
|
||||
import com.zzsmart.qomo.kn.cost.manage.enums.HourOrRateTypeEnum;
|
||||
import com.zzsmart.qomo.kn.cost.manage.enums.TotalCostEnum;
|
||||
import com.zzsmart.qomo.kn.cost.manage.mapper.CostMaterialBomMapper;
|
||||
import com.zzsmart.qomo.kn.cost.manage.service.*;
|
||||
import com.zzsmart.qomo.kn.cost.manage.vo.FlowTaskInfoVO;
|
||||
import com.zzsmart.qomo.kn.cost.manage.vo.TotalResultValue;
|
||||
import com.zzsmart.qomo.plugin.task.api.TaskExecutionContext;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -50,10 +53,20 @@ public class StandardCostService {
|
||||
*/
|
||||
@Autowired
|
||||
IAppSceneCostResultValueService iAppSceneCostResultValueService;
|
||||
/**
|
||||
* 标准成本服务
|
||||
*/
|
||||
public static StandardCostService standardCostService;
|
||||
/**
|
||||
* 成本计算服务
|
||||
*/
|
||||
@Autowired
|
||||
IAppSceneCostCountService appSceneCostCountService;
|
||||
|
||||
/**
|
||||
* 标准成本明细服务(单行查询服务)
|
||||
*/
|
||||
@Autowired
|
||||
private IAppSceneCostStandardDetailService iAppSceneCostStandardDetailService;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
@@ -65,6 +78,7 @@ public class StandardCostService {
|
||||
standardCostService.iHourRateService = this.iHourRateService;
|
||||
standardCostService.costMaterialProcessHoursService = this.costMaterialProcessHoursService;
|
||||
standardCostService.iAppSceneCostResultValueService = this.iAppSceneCostResultValueService;
|
||||
standardCostService.iAppSceneCostStandardDetailService = this.iAppSceneCostStandardDetailService;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,6 +107,7 @@ public class StandardCostService {
|
||||
//1.查询出所有满足物料编号的物料(BOM物料)
|
||||
String sql = flowTaskInfoVO.getSqlString();
|
||||
log.info("传递过来的SQL语句:" + sql);
|
||||
//TODO 查询最顶部的BOM物料编号下所有的物料并进行层级排序
|
||||
List<CostMaterialBom> list = standardCostService.costMaterialBomService.queryAllBomInfoBytopMaterialCode(topMaterialCode);
|
||||
log.info("Full EmptyTask list: {}", list);
|
||||
//2.把查询的结果存放在临时表里(表命名规则:前缀_流程id_组件code)
|
||||
@@ -220,7 +235,7 @@ public class StandardCostService {
|
||||
//单价乘以数量
|
||||
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 + "").build();
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -271,17 +286,18 @@ public class StandardCostService {
|
||||
String marterialNo = appSceneCostResultValue.getMarterialNo();
|
||||
if (marterialNo != null) {
|
||||
BigDecimal totalCost = new BigDecimal("0.0");
|
||||
BigDecimal laborHours = new BigDecimal("0.0");
|
||||
List<CostMaterialProcessHours> costMaterialProcessHours = processHoursMap.get(marterialNo);
|
||||
if (costMaterialProcessHours != null && costMaterialProcessHours.size() > 0) {
|
||||
for (int j = 0; j < costMaterialProcessHours.size(); j++) {
|
||||
CostMaterialProcessHours processHours = costMaterialProcessHours.get(j);
|
||||
BigDecimal laborHours = processHours.getLaborHours();
|
||||
laborHours = laborHours.add(processHours.getLaborHours());
|
||||
//计算总人工成本
|
||||
totalCost = totalCost.add(laborHours.multiply(hourRate));
|
||||
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).build();
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -339,17 +355,18 @@ public class StandardCostService {
|
||||
String marterialNo = appSceneCostResultValue.getMarterialNo();
|
||||
if (marterialNo != null) {
|
||||
BigDecimal totalCost = new BigDecimal("0.0");
|
||||
BigDecimal laborHours = new BigDecimal("0.0");
|
||||
List<CostMaterialProcessHours> costMaterialProcessHours = processHoursMap.get(marterialNo);
|
||||
if (costMaterialProcessHours != null && costMaterialProcessHours.size() > 0) {
|
||||
for (int j = 0; j < costMaterialProcessHours.size(); j++) {
|
||||
CostMaterialProcessHours processHours = costMaterialProcessHours.get(j);
|
||||
BigDecimal laborHours = processHours.getDeviceHours();
|
||||
laborHours = laborHours.add(processHours.getDeviceHours());
|
||||
//计算机器成本
|
||||
totalCost = totalCost.add(laborHours.multiply(hourRate));
|
||||
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).build();
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -360,18 +377,19 @@ public class StandardCostService {
|
||||
String marterialNo = appSceneCostResultValue.getMarterialNo();
|
||||
if (marterialNo != null) {
|
||||
BigDecimal totalCost = new BigDecimal("0.0");
|
||||
BigDecimal laborHours = new BigDecimal("0.0");
|
||||
List<CostMaterialProcessHours> costMaterialProcessHours = processHoursMap.get(marterialNo);
|
||||
if (costMaterialProcessHours != null && costMaterialProcessHours.size() > 0) {
|
||||
for (int j = 0; j < costMaterialProcessHours.size(); j++) {
|
||||
CostMaterialProcessHours processHours = costMaterialProcessHours.get(j);
|
||||
//TODO 辅料工时来源
|
||||
BigDecimal laborHours = processHours.getLaborHours();
|
||||
laborHours = laborHours.add(processHours.getDeviceHours());
|
||||
//机物料消耗
|
||||
totalCost = totalCost.add(laborHours.multiply(hourRate));
|
||||
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).build();
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -382,18 +400,19 @@ public class StandardCostService {
|
||||
String marterialNo = appSceneCostResultValue.getMarterialNo();
|
||||
if (marterialNo != null) {
|
||||
BigDecimal totalCost = new BigDecimal("0.0");
|
||||
BigDecimal laborHours = new BigDecimal("0.0");
|
||||
List<CostMaterialProcessHours> costMaterialProcessHours = processHoursMap.get(marterialNo);
|
||||
if (costMaterialProcessHours != null && costMaterialProcessHours.size() > 0) {
|
||||
for (int j = 0; j < costMaterialProcessHours.size(); j++) {
|
||||
CostMaterialProcessHours processHours = costMaterialProcessHours.get(j);
|
||||
//TODO 燃动力工时来源
|
||||
BigDecimal laborHours = processHours.getLaborHours();
|
||||
//机物料消耗
|
||||
totalCost = totalCost.add(laborHours.multiply(hourRate));
|
||||
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).build();
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -404,18 +423,19 @@ public class StandardCostService {
|
||||
String marterialNo = appSceneCostResultValue.getMarterialNo();
|
||||
if (marterialNo != null) {
|
||||
BigDecimal totalCost = new BigDecimal("0.0");
|
||||
BigDecimal laborHours = new BigDecimal("0.0");
|
||||
List<CostMaterialProcessHours> costMaterialProcessHours = processHoursMap.get(marterialNo);
|
||||
if (costMaterialProcessHours != null && costMaterialProcessHours.size() > 0) {
|
||||
for (int j = 0; j < costMaterialProcessHours.size(); j++) {
|
||||
CostMaterialProcessHours processHours = costMaterialProcessHours.get(j);
|
||||
//TODO 其他工时来源
|
||||
BigDecimal laborHours = processHours.getLaborHours();
|
||||
//机物料消耗
|
||||
totalCost = totalCost.add(laborHours.multiply(hourRate));
|
||||
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).build();
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -465,6 +485,7 @@ public class StandardCostService {
|
||||
//2.计算出所有的单个物料的本阶的标准成本(标准成本=物料成本+人工成本+制造费用)
|
||||
//按照物料编号进行分组
|
||||
Map<String, List<AppSceneCostResultValue>> materialNoMap = list.stream().collect(Collectors.groupingBy(AppSceneCostResultValue::getMarterialNo));
|
||||
//遍历根物料下所有的物料进行该物料本阶成本和费用类别的统计
|
||||
for (String key : materialNoMap.keySet()) {
|
||||
List<AppSceneCostResultValue> appSceneCostResultValues = materialNoMap.get(key);
|
||||
//按照费用类别进行分组
|
||||
@@ -485,6 +506,23 @@ public class StandardCostService {
|
||||
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++) {
|
||||
@@ -497,36 +535,73 @@ public class StandardCostService {
|
||||
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 costTypeDetail = new JSONObject();
|
||||
costTypeDetail.put(FeeTypeEnum.MaterialCost.getCode(), materialCost.toString());
|
||||
costTypeDetail.put(FeeTypeEnum.LaborCost.getCode(), laborCost.toString());
|
||||
costTypeDetail.put(FeeTypeEnum.EquipmentFee.getCode(), equipmentCost.toString());
|
||||
costTypeDetail.put(FeeTypeEnum.SupplyMaterialFee.getCode(), supplyMaterialCost.toString());
|
||||
costTypeDetail.put(FeeTypeEnum.DriverFee.getCode(), driveCost.toString());
|
||||
costTypeDetail.put(FeeTypeEnum.LogisticsFee.getCode(), logisticsCost.toString());
|
||||
costTypeDetail.put(FeeTypeEnum.OtherFee.getCode(), otherCost.toString());
|
||||
AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(key).parentMarterialNo(currentMaterialCost.getParentMarterialNo()).taskType(taskType).taskCode(taskCode).flowInstanceId(flowInstanceId).countValue(currentCost.toString()).costDetail(JSON.toJSONString(costTypeDetail)).costType(costType).build();
|
||||
//本阶不同费用类别成本统计
|
||||
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.计算出所有的单个物料的累计标准成本
|
||||
@@ -545,6 +620,8 @@ public class StandardCostService {
|
||||
* @param flowInstanceId
|
||||
*/
|
||||
private static void totalCountCost(List<AppSceneCostResultValue> standardCostList, String topMaterialCode, String taskType, String taskCode, String flowInstanceId) {
|
||||
|
||||
List<AppSceneCostStandardDetail> costStandardDetails = new ArrayList<>();
|
||||
//父类对应的子节点(除了最上层节点)
|
||||
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++) {
|
||||
@@ -552,11 +629,45 @@ public class StandardCostService {
|
||||
AppSceneCostResultValue oldAppSceneCostResultValue = standardCostList.get(i);
|
||||
BigDecimal totalCost = new BigDecimal(oldAppSceneCostResultValue.getCountValue());
|
||||
//循环计算出当前节点的累计成本
|
||||
totalCost = loopCount(oldAppSceneCostResultValue, parentMaterialNoMap, topMaterialCode, taskType, taskCode, flowInstanceId, totalCost);
|
||||
oldAppSceneCostResultValue.setTotalValue(totalCost.toString());
|
||||
String costDetail = oldAppSceneCostResultValue.getCostDetail();
|
||||
//查询当前节点各个类型的成本
|
||||
BigDecimal totalLabourCost = new BigDecimal(0);
|
||||
BigDecimal totalEquipmentCost = new BigDecimal(0);
|
||||
BigDecimal totalSupplyMaterialCost = new BigDecimal(0);
|
||||
BigDecimal totalDriveCost = new BigDecimal(0);
|
||||
BigDecimal totalLogisticsCost = new BigDecimal(0);
|
||||
BigDecimal totalOtherCost = new BigDecimal(0);
|
||||
JSONObject costDetailJson = JSON.parseObject(costDetail);
|
||||
if (costDetailJson != null) {
|
||||
totalLabourCost = costDetailJson.getBigDecimal(FeeTypeEnum.LaborCost.getCode());
|
||||
totalEquipmentCost = costDetailJson.getBigDecimal(FeeTypeEnum.EquipmentFee.getCode());
|
||||
totalSupplyMaterialCost = costDetailJson.getBigDecimal(FeeTypeEnum.SupplyMaterialFee.getCode());
|
||||
totalDriveCost = costDetailJson.getBigDecimal(FeeTypeEnum.DriverFee.getCode());
|
||||
totalLogisticsCost = costDetailJson.getBigDecimal(FeeTypeEnum.LogisticsFee.getCode());
|
||||
totalOtherCost = costDetailJson.getBigDecimal(FeeTypeEnum.OtherFee.getCode());
|
||||
}
|
||||
TotalResultValue hourOrRateResultValue = loopCount(oldAppSceneCostResultValue, parentMaterialNoMap, totalLabourCost, totalEquipmentCost, totalSupplyMaterialCost, totalDriveCost, totalLogisticsCost, totalOtherCost, totalCost);
|
||||
costDetailJson.put(TotalCostEnum.TotalLaborCost.getCode(), hourOrRateResultValue.getTotalLabourCost());
|
||||
costDetailJson.put(TotalCostEnum.TotalEquipmentFee.getCode(), hourOrRateResultValue.getTotalEquipmentCost());
|
||||
costDetailJson.put(TotalCostEnum.TotalSupplyMaterialFee.getCode(), hourOrRateResultValue.getTotalSupplyMaterialCost());
|
||||
costDetailJson.put(TotalCostEnum.TotalDriverFee.getCode(), hourOrRateResultValue.getTotalDriveCost());
|
||||
costDetailJson.put(TotalCostEnum.TotalLogisticsFee.getCode(), hourOrRateResultValue.getTotalLogisticsCost());
|
||||
costDetailJson.put(TotalCostEnum.TotalOtherFee.getCode(), hourOrRateResultValue.getTotalOtherCost());
|
||||
costDetailJson.put(TotalCostEnum.TotalStandardCost.getCode(), hourOrRateResultValue.getTotalCost());
|
||||
oldAppSceneCostResultValue.setCostDetail(costDetailJson.toJSONString());
|
||||
oldAppSceneCostResultValue.setTotalValue(hourOrRateResultValue.getTotalCost().toString());
|
||||
standardCostService.iAppSceneCostResultValueService.updateById(oldAppSceneCostResultValue);
|
||||
//TODO 更新结果集到标准成本单行查询中去
|
||||
//构造单行成本查询记录
|
||||
AppSceneCostStandardDetail costStandardDetail = AppSceneCostStandardDetail.builder().materialNumber(oldAppSceneCostResultValue.getMarterialNo()).materialName(oldAppSceneCostResultValue.getMarterialNo()).parentMaterialNumber(oldAppSceneCostResultValue.getParentMarterialNo())
|
||||
// .versionNumber()
|
||||
// .level()
|
||||
// .sort()
|
||||
// .figureNumber()
|
||||
.dosage(oldAppSceneCostResultValue.getNum() != null ? new Double(oldAppSceneCostResultValue.getNum()) : 0).unit(oldAppSceneCostResultValue.getUnit()).materialCost(costDetailJson.getBigDecimal(FeeTypeEnum.MaterialCost.getCode())).laborCost(costDetailJson.getBigDecimal(FeeTypeEnum.LaborCost.getCode())).equipmentCost(costDetailJson.getBigDecimal(FeeTypeEnum.EquipmentFee.getCode())).supplyMaterialCost(costDetailJson.getBigDecimal(FeeTypeEnum.SupplyMaterialFee.getCode())).driveCost(costDetailJson.getBigDecimal(FeeTypeEnum.DriverFee.getCode())).logisticsCost(costDetailJson.getBigDecimal(FeeTypeEnum.LogisticsFee.getCode())).otherCost(costDetailJson.getBigDecimal(FeeTypeEnum.OtherFee.getCode())).currentStandardCost(new BigDecimal(oldAppSceneCostResultValue.getCountValue())).totalMaterialCost(costDetailJson.getBigDecimal(TotalCostEnum.TotalMaterialCost.getCode())).totalLaborCost(costDetailJson.getBigDecimal(TotalCostEnum.TotalLaborCost.getCode())).totalEquipmentCost(costDetailJson.getBigDecimal(TotalCostEnum.TotalEquipmentFee.getCode())).totalSupplyMaterialCost(costDetailJson.getBigDecimal(TotalCostEnum.TotalSupplyMaterialFee.getCode())).totalDriveCost(costDetailJson.getBigDecimal(TotalCostEnum.TotalDriverFee.getCode())).totalLogisticsCost(costDetailJson.getBigDecimal(TotalCostEnum.TotalLogisticsFee.getCode())).totalOtherCost(costDetailJson.getBigDecimal(TotalCostEnum.TotalOtherFee.getCode())).totalStandardCost(costDetailJson.getBigDecimal(TotalCostEnum.TotalStandardCost.getCode())).build();
|
||||
costStandardDetails.add(costStandardDetail);
|
||||
}
|
||||
//更新结果集到标准成本单行查询中去
|
||||
standardCostService.iAppSceneCostStandardDetailService.saveBatch(costStandardDetails);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -565,12 +676,8 @@ public class StandardCostService {
|
||||
*
|
||||
* @param appSceneCostResultValue
|
||||
* @param parentMaterialNoMap
|
||||
* @param topMaterialCode
|
||||
* @param taskType
|
||||
* @param taskCode
|
||||
* @param flowInstanceId
|
||||
*/
|
||||
private static BigDecimal loopCount(AppSceneCostResultValue appSceneCostResultValue, Map<String, List<AppSceneCostResultValue>> parentMaterialNoMap, String topMaterialCode, String taskType, String taskCode, String flowInstanceId, BigDecimal totalCost) {
|
||||
private static TotalResultValue loopCount(AppSceneCostResultValue appSceneCostResultValue, Map<String, List<AppSceneCostResultValue>> parentMaterialNoMap, BigDecimal totalLabourCost, BigDecimal totalEquipmentCost, BigDecimal totalSupplyMaterialCost, BigDecimal totalDriveCost, BigDecimal totalLogisticsCost, BigDecimal totalOtherCost, BigDecimal totalCost) {
|
||||
String marterialNo = appSceneCostResultValue.getMarterialNo();
|
||||
if (parentMaterialNoMap.containsKey(marterialNo)) {
|
||||
//获取当前节点的子节点并遍历
|
||||
@@ -578,16 +685,31 @@ public class StandardCostService {
|
||||
for (int j = 0; j < appSceneCostResultValues.size(); j++) {
|
||||
AppSceneCostResultValue appSceneCostResultValue1 = appSceneCostResultValues.get(j);
|
||||
String countValue = appSceneCostResultValue1.getCountValue();
|
||||
//标准成本累计
|
||||
if (countValue != null) {
|
||||
totalCost = totalCost.add(new BigDecimal(countValue));
|
||||
}
|
||||
//各个费用类别成本累计
|
||||
if (appSceneCostResultValue1.getCostDetail() != null) {
|
||||
JSONObject costDetailJson = JSON.parseObject(appSceneCostResultValue1.getCostDetail());
|
||||
if (costDetailJson != null) {
|
||||
totalLabourCost = totalLabourCost.add(costDetailJson.getBigDecimal(FeeTypeEnum.LaborCost.getCode()));
|
||||
totalEquipmentCost = totalEquipmentCost.add(costDetailJson.getBigDecimal(FeeTypeEnum.EquipmentFee.getCode()));
|
||||
totalSupplyMaterialCost = totalSupplyMaterialCost.add(costDetailJson.getBigDecimal(FeeTypeEnum.SupplyMaterialFee.getCode()));
|
||||
totalDriveCost = totalDriveCost.add(costDetailJson.getBigDecimal(FeeTypeEnum.DriverFee.getCode()));
|
||||
totalLogisticsCost = totalLogisticsCost.add(costDetailJson.getBigDecimal(FeeTypeEnum.LogisticsFee.getCode()));
|
||||
totalOtherCost = totalOtherCost.add(costDetailJson.getBigDecimal(FeeTypeEnum.OtherFee.getCode()));
|
||||
}
|
||||
}
|
||||
//判断当前子节点是否还有子节点
|
||||
if (parentMaterialNoMap.containsKey(appSceneCostResultValue1.getMarterialNo())) {
|
||||
//如果还有子节点则继续递归
|
||||
loopCount(appSceneCostResultValue1, parentMaterialNoMap, topMaterialCode, taskType, taskCode, flowInstanceId, totalCost);
|
||||
loopCount(appSceneCostResultValue1, parentMaterialNoMap, totalLabourCost, totalEquipmentCost, totalSupplyMaterialCost, totalDriveCost, totalLogisticsCost, totalOtherCost, totalCost);
|
||||
}
|
||||
}
|
||||
}
|
||||
return totalCost;
|
||||
TotalResultValue hourOrRateResultValue = TotalResultValue.builder().totalLabourCost(totalLabourCost).totalEquipmentCost(totalEquipmentCost).totalSupplyMaterialCost(totalSupplyMaterialCost).totalDriveCost(totalDriveCost).totalLogisticsCost(totalLogisticsCost).totalOtherCost(totalOtherCost).totalCost(totalCost).build();
|
||||
appSceneCostResultValue.setTotalValue(totalCost.toString());
|
||||
return hourOrRateResultValue;
|
||||
}
|
||||
}
|
||||
|
||||
-41
@@ -1,41 +0,0 @@
|
||||
package com.zzsmart.qomo.kn.cost.manage.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zzsmart.qomo.kn.cost.manage.entity.CostStandardDetail;
|
||||
import com.zzsmart.qomo.kn.cost.manage.vo.CostStandardDetailSearch;
|
||||
import com.zzsmart.qomo.kn.cost.manage.vo.CostStandardDetailVO;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 标准成本明细表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author app_scene_cost_purchase_price
|
||||
* @since 2024-06-19
|
||||
*/
|
||||
public interface CostStandardDetailService extends IService<CostStandardDetail> {
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
IPage<CostStandardDetailVO> pageList(Page<CostStandardDetailVO> page, CostStandardDetailVO costStandard);
|
||||
|
||||
/**
|
||||
* 导出列表信息为Excel文件
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @param costStandardDetailSearch
|
||||
* @return
|
||||
*/
|
||||
JSONObject exportExcel(HttpServletRequest request, HttpServletResponse response, CostStandardDetailSearch costStandardDetailSearch);
|
||||
}
|
||||
+14
@@ -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.AppSceneCostStandardDetail;
|
||||
|
||||
/**
|
||||
* @Description: app_scene_cost_standard_detail
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-07-31
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IAppSceneCostStandardDetailService extends IService<AppSceneCostStandardDetail> {
|
||||
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.zzsmart.qomo.kn.cost.manage.service.impl;
|
||||
|
||||
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostStandardDetail;
|
||||
import com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostStandardDetailMapper;
|
||||
import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostStandardDetailService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: app_scene_cost_standard_detail
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-07-31
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class AppSceneCostStandardDetailServiceImpl extends ServiceImpl<AppSceneCostStandardDetailMapper, AppSceneCostStandardDetail> implements IAppSceneCostStandardDetailService {
|
||||
|
||||
}
|
||||
-2
@@ -2,12 +2,10 @@ 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.CostStandardDetail;
|
||||
import com.zzsmart.qomo.kn.cost.manage.mapper.CostStandardDetailMapper;
|
||||
import com.zzsmart.qomo.kn.cost.manage.service.BomTreeService;
|
||||
import com.zzsmart.qomo.kn.cost.manage.util.BomTreeBuilder;
|
||||
import com.zzsmart.qomo.kn.cost.manage.vo.BomTreeInfoVO;
|
||||
import com.zzsmart.qomo.kn.cost.manage.vo.CostStandardDetailVO;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
-84
@@ -1,84 +0,0 @@
|
||||
package com.zzsmart.qomo.kn.cost.manage.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zzsmart.qomo.kn.cost.manage.entity.CostStandardDetail;
|
||||
import com.zzsmart.qomo.kn.cost.manage.mapper.CostStandardDetailMapper;
|
||||
import com.zzsmart.qomo.kn.cost.manage.service.CostStandardDetailService;
|
||||
import com.zzsmart.qomo.kn.cost.manage.vo.CostStandardDetailSearch;
|
||||
import com.zzsmart.qomo.kn.cost.manage.vo.CostStandardDetailVO;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.zzsmart.qomo.kn.cost.manage.util.EasyExcelUtil.getIncludeFields;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 标准成本明细表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author app_scene_cost_purchase_price
|
||||
* @since 2024-06-19
|
||||
*/
|
||||
@Service
|
||||
public class CostStandardDetailServiceImpl extends ServiceImpl<CostStandardDetailMapper, CostStandardDetail> implements CostStandardDetailService {
|
||||
|
||||
@Autowired
|
||||
CostStandardDetailMapper costStandardDetailMapper;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page
|
||||
* @param costStandard
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public IPage<CostStandardDetailVO> pageList(Page<CostStandardDetailVO> page, CostStandardDetailVO costStandard) {
|
||||
// 查询条件组装
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
|
||||
if (costStandard != null) {
|
||||
|
||||
if (StrUtil.isNotEmpty(costStandard.getMaterialNumber())) {
|
||||
// 物料号
|
||||
queryWrapper.like("c1.material_number", costStandard.getMaterialNumber());
|
||||
}
|
||||
if (StrUtil.isNotEmpty(costStandard.getVersionNumber())) {
|
||||
// 版本号
|
||||
queryWrapper.like("c2.version_number", costStandard.getVersionNumber());
|
||||
}
|
||||
|
||||
}
|
||||
return (IPage<CostStandardDetailVO>) costStandardDetailMapper.pageList(page, queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject exportExcel(HttpServletRequest request, HttpServletResponse response, CostStandardDetailSearch costStandardDetailSearch) {
|
||||
QueryWrapper<CostStandardDetail> queryWrapper = QueryGenerator.initQueryWrapper(costStandardDetailSearch, request.getParameterMap());
|
||||
if (costStandardDetailSearch != null && costStandardDetailSearch.getSelections() != null && costStandardDetailSearch.getSelections().size() > 0) {
|
||||
queryWrapper.in("id", costStandardDetailSearch.getSelections());
|
||||
}
|
||||
List exportList = list(queryWrapper);
|
||||
// EasyExcelUtil.export(response, "D:/WorkDoc/PHM/单机部署/单行查询.xls", null, exportList,CostStandardDetail.class);
|
||||
// 根据用户传入字段 假设我们要忽略 date
|
||||
Set<String> includeFields = getIncludeFields(CostStandardDetail.class);
|
||||
EasyExcel.write("D:/WorkDoc/PHM/单机部署/单行查询.xls", CostStandardDetail.class).includeColumnFieldNames(includeFields).sheet("模板").doWrite(exportList);
|
||||
// return super.exportXls(request, costStandardDetail, CostStandardDetail.class, "单行查询");
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("filePath", "D:/WorkDoc/PHM/单机部署/单行查询.xls");
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
-2
@@ -1,8 +1,6 @@
|
||||
package com.zzsmart.qomo.kn.cost.manage.util;
|
||||
|
||||
import com.zzsmart.qomo.kn.cost.manage.entity.CostStandardDetail;
|
||||
import com.zzsmart.qomo.kn.cost.manage.vo.BomTreeInfoVO;
|
||||
import com.zzsmart.qomo.kn.cost.manage.vo.CostStandardDetailVO;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
|
||||
-1
@@ -5,7 +5,6 @@ import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
|
||||
import com.alibaba.excel.write.metadata.style.WriteFont;
|
||||
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
|
||||
import com.zzsmart.qomo.kn.cost.manage.entity.CostStandardDetail;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
package com.zzsmart.qomo.kn.cost.manage.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "bom结构树", description = "bom结构树")
|
||||
public class CostStandardDetailSearch extends CostStandardDetailVO {
|
||||
/**
|
||||
* 选择行的id
|
||||
*/
|
||||
private List<String> selections;
|
||||
}
|
||||
-30
@@ -1,30 +0,0 @@
|
||||
package com.zzsmart.qomo.kn.cost.manage.vo;
|
||||
|
||||
import com.zzsmart.qomo.kn.cost.manage.entity.CostStandardDetail;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 标准成本明细表
|
||||
* </p>
|
||||
*
|
||||
* @author app_scene_cost_purchase_price
|
||||
* @since 2024-06-19
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class CostStandardDetailVO extends CostStandardDetail implements Serializable {
|
||||
/**
|
||||
* 版本号
|
||||
*/
|
||||
@ApiModelProperty(value = "版本号")
|
||||
private String versionNumber;
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package com.zzsmart.qomo.kn.cost.manage.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
/**
|
||||
* @ClassName: HourOrRateResultValue
|
||||
* @Description: 人工费率成本结果值
|
||||
* @Author: zzsmart
|
||||
* @Date: 2020/5/26 14:06
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class TotalResultValue {
|
||||
/**
|
||||
* 总人工成本
|
||||
*/
|
||||
private BigDecimal totalLabourCost;
|
||||
/**
|
||||
* 总设备成本
|
||||
*/
|
||||
private BigDecimal totalEquipmentCost;
|
||||
/**
|
||||
* 总采购成本
|
||||
*/
|
||||
|
||||
private BigDecimal totalSupplyMaterialCost;
|
||||
/**
|
||||
* 总运输成本
|
||||
*/
|
||||
private BigDecimal totalDriveCost;
|
||||
/**
|
||||
* 总物流成本
|
||||
*/
|
||||
private BigDecimal totalLogisticsCost;
|
||||
/**
|
||||
* 总其他成本
|
||||
*/
|
||||
private BigDecimal totalOtherCost;
|
||||
/**
|
||||
* 总成本
|
||||
*/
|
||||
private BigDecimal totalCost;
|
||||
}
|
||||
Reference in New Issue
Block a user