Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
58985badb2 | ||
|
|
b169b641de | ||
|
|
3d3c289f46 | ||
|
|
3f00c556ed | ||
|
|
f8f5ee3ec3 | ||
|
|
2b8a7364ce |
@@ -226,19 +226,19 @@ spring:
|
|||||||
# database: 5
|
# database: 5
|
||||||
# host: 121.40.189.20
|
# host: 121.40.189.20
|
||||||
# port: 6389
|
# port: 6389
|
||||||
redis:
|
|
||||||
database: 9
|
|
||||||
host: 192.168.50.9
|
|
||||||
port: 7379
|
|
||||||
password: 'zzboard'
|
|
||||||
main:
|
|
||||||
allow-circular-references: true
|
|
||||||
# redis:
|
# redis:
|
||||||
# database: 10
|
# database: 9
|
||||||
# host: localhost
|
# host: 192.168.50.9
|
||||||
# port: 6379
|
# port: 7379
|
||||||
|
# password: 'zzboard'
|
||||||
# main:
|
# main:
|
||||||
# allow-circular-references: true
|
# allow-circular-references: true
|
||||||
|
redis:
|
||||||
|
database: 10
|
||||||
|
host: localhost
|
||||||
|
port: 6379
|
||||||
|
main:
|
||||||
|
allow-circular-references: true
|
||||||
|
|
||||||
#rabbitmq 配置
|
#rabbitmq 配置
|
||||||
rabbitmq:
|
rabbitmq:
|
||||||
@@ -268,7 +268,7 @@ mybatis-plus:
|
|||||||
table-underline: true
|
table-underline: true
|
||||||
configuration:
|
configuration:
|
||||||
# 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
|
# 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
|
||||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
#log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||||
# log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl
|
# log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl
|
||||||
# 返回类型为Map,显示null对应的字段
|
# 返回类型为Map,显示null对应的字段
|
||||||
call-setters-on-nulls: true
|
call-setters-on-nulls: true
|
||||||
|
|||||||
+1
@@ -55,6 +55,7 @@ public class AppSceneCostCountController extends JeecgController<AppSceneCostCou
|
|||||||
@GetMapping(value = "/list")
|
@GetMapping(value = "/list")
|
||||||
public Result<IPage<AppSceneCostCountVO>> queryPageList(AppSceneCostCount appSceneCostCount, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
|
public Result<IPage<AppSceneCostCountVO>> queryPageList(AppSceneCostCount appSceneCostCount, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
|
||||||
QueryWrapper<AppSceneCostCount> queryWrapper = QueryGenerator.initQueryWrapper(appSceneCostCount, req.getParameterMap());
|
QueryWrapper<AppSceneCostCount> queryWrapper = QueryGenerator.initQueryWrapper(appSceneCostCount, req.getParameterMap());
|
||||||
|
queryWrapper.orderByDesc("create_time");
|
||||||
Page<AppSceneCostCount> page = new Page<AppSceneCostCount>(pageNo, pageSize);
|
Page<AppSceneCostCount> page = new Page<AppSceneCostCount>(pageNo, pageSize);
|
||||||
IPage<AppSceneCostCount> pageList = appSceneCostCountService.page(page, queryWrapper);
|
IPage<AppSceneCostCount> pageList = appSceneCostCountService.page(page, queryWrapper);
|
||||||
IPage<AppSceneCostCountVO> pageList1 = new Page<>();
|
IPage<AppSceneCostCountVO> pageList1 = new Page<>();
|
||||||
|
|||||||
+40
-38
@@ -51,47 +51,49 @@ public class AppSceneCostStandardResultController 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<AppSceneCostStandardResultVO>> queryPageList(AppSceneCostStandardResult appSceneCostStandardResult, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
|
public Result<IPage<AppSceneCostStandardResult>> queryPageList(AppSceneCostStandardResult appSceneCostStandardResult, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
|
||||||
|
if(appSceneCostStandardResult.getVersionNumber()==null){
|
||||||
|
appSceneCostStandardResult.setVersionNumber(" ");
|
||||||
|
}
|
||||||
QueryWrapper<AppSceneCostStandardResult> queryWrapper = QueryGenerator.initQueryWrapper(appSceneCostStandardResult, req.getParameterMap());
|
QueryWrapper<AppSceneCostStandardResult> queryWrapper = QueryGenerator.initQueryWrapper(appSceneCostStandardResult, req.getParameterMap());
|
||||||
|
queryWrapper.orderByAsc("layer");
|
||||||
Page<AppSceneCostStandardResult> page = new Page<AppSceneCostStandardResult>(pageNo, pageSize);
|
Page<AppSceneCostStandardResult> page = new Page<AppSceneCostStandardResult>(pageNo, pageSize);
|
||||||
IPage<AppSceneCostStandardResult> pageList = appSceneCostStandardResultService.page(page, queryWrapper);
|
IPage<AppSceneCostStandardResult> pageList = appSceneCostStandardResultService.page(page, queryWrapper);
|
||||||
IPage<AppSceneCostStandardResultVO> newpageList = new Page<>();
|
// IPage<AppSceneCostStandardResultVO> newpageList = new Page<>();
|
||||||
BeanUtils.copyProperties(pageList, newpageList);
|
// BeanUtils.copyProperties(pageList, newpageList);
|
||||||
List<AppSceneCostStandardResult> list = pageList.getRecords();
|
// List<AppSceneCostStandardResult> list = pageList.getRecords();
|
||||||
List<AppSceneCostStandardResultVO> newList = new ArrayList<>();
|
// List<AppSceneCostStandardResultVO> newList = new ArrayList<>();
|
||||||
for (int i = 0; i < list.size(); i++) {
|
// for (int i = 0; i < list.size(); i++) {
|
||||||
AppSceneCostStandardResult result = list.get(i);
|
// AppSceneCostStandardResult result = list.get(i);
|
||||||
AppSceneCostStandardResultVO costStandardDetail = AppSceneCostStandardResultVO.builder()
|
// AppSceneCostStandardResultVO costStandardDetail = AppSceneCostStandardResultVO.builder()
|
||||||
.materialNumber(result.getMaterialNumber())
|
// .materialNumber(result.getMaterialNumber())
|
||||||
// .materialName(oldAppSceneCostResultValue.getMarterialNo())
|
//// .materialName(oldAppSceneCostResultValue.getMarterialNo())
|
||||||
.parentMaterialNumber(result.getParentMatnr())
|
// .parentMaterialNumber(result.getParentMatnr())
|
||||||
.versionNumber(result.getVersionNumber())
|
// .versionNumber(result.getVersionNumber())
|
||||||
// .level()
|
//// .level()
|
||||||
// .sort()
|
//// .sort()
|
||||||
// .figureNumber()
|
//// .figureNumber()
|
||||||
// .dosage(oldAppSceneCostResultValue.getNum() != null ? new Double(oldAppSceneCostResultValue.getNum()) : 0)
|
//// .dosage(oldAppSceneCostResultValue.getNum() != null ? new Double(oldAppSceneCostResultValue.getNum()) : 0)
|
||||||
// .unit(oldAppSceneCostResultValue.getUnit())
|
//// .unit(oldAppSceneCostResultValue.getUnit())
|
||||||
.materialCost(result.getMaterialCostStage())
|
// .materialCost(result.getMaterialCostStage())
|
||||||
.laborCost(result.getLaborCostStage())
|
// .laborCost(result.getLaborCostStage())
|
||||||
.equipmentCost(result.getEquipCostStage())
|
// .equipmentCost(result.getEquipCostStage())
|
||||||
.supplyMaterialCost(result.getAuxiliaryCostStage())
|
// .supplyMaterialCost(result.getAuxiliaryCostStage())
|
||||||
.driveCost(result.getBurningCostStage())
|
// .driveCost(result.getBurningCostStage())
|
||||||
.logisticsCost(result.getStageLogisticsCost())
|
// .otherCost(result.getOtherCostStage())
|
||||||
.otherCost(result.getOtherCostStage())
|
// .currentStandardCost(result.getTotalStandardCost())
|
||||||
.currentStandardCost(result.getTotalStandardCostInter())
|
// .totalMaterialCost(result.getMaterialCostAccumulated())
|
||||||
.totalMaterialCost(result.getMaterialCostAccumulated())
|
// .totalLaborCost(result.getLaborCostAccumulated())
|
||||||
.totalLaborCost(result.getLaborCostAccumulated())
|
// .totalEquipmentCost(result.getEquipCostAccumulated())
|
||||||
.totalEquipmentCost(result.getEquipCostAccumulated())
|
// .totalSupplyMaterialCost(result.getAuxiliaryCostAccumulated())
|
||||||
.totalSupplyMaterialCost(result.getAuxiliaryCostAccumulated())
|
// .totalDriveCost(result.getBurningCostAccumulated())
|
||||||
.totalDriveCost(result.getBurningCostAccumulated())
|
// .totalOtherCost(result.getOtherCostAccumulated())
|
||||||
.totalLogisticsCost(result.getTotalLogisticsCost())
|
// .totalStandardCost(result.getTotalStandardCost())
|
||||||
.totalOtherCost(result.getOtherCostAccumulated())
|
// .createTime(result.getCreatedTime()).build();
|
||||||
.totalStandardCost(result.getTotalStandardCost())
|
// newList.add(costStandardDetail);
|
||||||
.createTime(result.getCreatedTime()).build();
|
// }
|
||||||
newList.add(costStandardDetail);
|
// newpageList.setRecords(newList);
|
||||||
}
|
return Result.OK(pageList);
|
||||||
newpageList.setRecords(newList);
|
|
||||||
return Result.OK(newpageList);
|
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// /**
|
// /**
|
||||||
|
|||||||
+111
@@ -0,0 +1,111 @@
|
|||||||
|
package com.zzsmart.qomo.kn.cost.manage.entity;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
|
import lombok.Data;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
|
import org.jeecg.common.aspect.annotation.Dict;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: app_scene_cost_material
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2024-09-17
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("app_scene_cost_material")
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@ApiModel(value="app_scene_cost_material对象", description="app_scene_cost_material")
|
||||||
|
public class AppSceneCostMaterial implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**工厂*/
|
||||||
|
@Excel(name = "工厂", width = 15)
|
||||||
|
@ApiModelProperty(value = "工厂")
|
||||||
|
private String factory;
|
||||||
|
/**物料号*/
|
||||||
|
@Excel(name = "物料号", width = 15)
|
||||||
|
@ApiModelProperty(value = "物料号")
|
||||||
|
private String materialNumber;
|
||||||
|
/**materialType*/
|
||||||
|
@Excel(name = "materialType", width = 15)
|
||||||
|
@ApiModelProperty(value = "materialType")
|
||||||
|
private String materialType;
|
||||||
|
/**productCategory*/
|
||||||
|
@Excel(name = "productCategory", width = 15)
|
||||||
|
@ApiModelProperty(value = "productCategory")
|
||||||
|
private String productCategory;
|
||||||
|
/**物料名称*/
|
||||||
|
@Excel(name = "物料名称", width = 15)
|
||||||
|
@ApiModelProperty(value = "物料名称")
|
||||||
|
private String productName;
|
||||||
|
/**norms*/
|
||||||
|
@Excel(name = "norms", width = 15)
|
||||||
|
@ApiModelProperty(value = "norms")
|
||||||
|
private String norms;
|
||||||
|
/**生产类型*/
|
||||||
|
@Excel(name = "生产类型", width = 15)
|
||||||
|
@ApiModelProperty(value = "生产类型")
|
||||||
|
private String manufacturingType;
|
||||||
|
/**inventoryUnit*/
|
||||||
|
@Excel(name = "inventoryUnit", width = 15)
|
||||||
|
@ApiModelProperty(value = "inventoryUnit")
|
||||||
|
private String inventoryUnit;
|
||||||
|
/**purchasingUnit*/
|
||||||
|
@Excel(name = "purchasingUnit", width = 15)
|
||||||
|
@ApiModelProperty(value = "purchasingUnit")
|
||||||
|
private String purchasingUnit;
|
||||||
|
/**老物料组*/
|
||||||
|
@Excel(name = "老物料组", width = 15)
|
||||||
|
@ApiModelProperty(value = "老物料组")
|
||||||
|
private String oldMaterialGroup;
|
||||||
|
/**standardCost*/
|
||||||
|
@Excel(name = "standardCost", width = 15)
|
||||||
|
@ApiModelProperty(value = "standardCost")
|
||||||
|
private String standardCost;
|
||||||
|
/**abcLevel*/
|
||||||
|
@Excel(name = "abcLevel", width = 15)
|
||||||
|
@ApiModelProperty(value = "abcLevel")
|
||||||
|
private String abcLevel;
|
||||||
|
/**effectiveState*/
|
||||||
|
@Excel(name = "effectiveState", width = 15)
|
||||||
|
@ApiModelProperty(value = "effectiveState")
|
||||||
|
private String effectiveState;
|
||||||
|
/**profitCenter*/
|
||||||
|
@Excel(name = "profitCenter", width = 15)
|
||||||
|
@ApiModelProperty(value = "profitCenter")
|
||||||
|
private String profitCenter;
|
||||||
|
/**iswbs*/
|
||||||
|
@Excel(name = "iswbs", width = 15)
|
||||||
|
@ApiModelProperty(value = "iswbs")
|
||||||
|
private String iswbs;
|
||||||
|
/**图号*/
|
||||||
|
@Excel(name = "图号", width = 15)
|
||||||
|
@ApiModelProperty(value = "图号")
|
||||||
|
private String graphNumber;
|
||||||
|
/**mtbez*/
|
||||||
|
@Excel(name = "mtbez", width = 15)
|
||||||
|
@ApiModelProperty(value = "mtbez")
|
||||||
|
private String mtbez;
|
||||||
|
/**wgbez*/
|
||||||
|
@Excel(name = "wgbez", width = 15)
|
||||||
|
@ApiModelProperty(value = "wgbez")
|
||||||
|
private String wgbez;
|
||||||
|
/**sobsl*/
|
||||||
|
@Excel(name = "sobsl", width = 15)
|
||||||
|
@ApiModelProperty(value = "sobsl")
|
||||||
|
private String sobsl;
|
||||||
|
}
|
||||||
+70
@@ -134,4 +134,74 @@ public class AppSceneCostResultValue implements Serializable {
|
|||||||
@Excel(name = "工时", width = 15)
|
@Excel(name = "工时", width = 15)
|
||||||
@ApiModelProperty(value = "工时")
|
@ApiModelProperty(value = "工时")
|
||||||
private BigDecimal hour;
|
private BigDecimal hour;
|
||||||
|
/**
|
||||||
|
* 工时
|
||||||
|
*/
|
||||||
|
@Excel(name = "BOM深度", width = 15)
|
||||||
|
@ApiModelProperty(value = "BOM深度")
|
||||||
|
private int depth;
|
||||||
|
/**
|
||||||
|
* 工时
|
||||||
|
*/
|
||||||
|
@Excel(name = "父物料数量", width = 15)
|
||||||
|
@ApiModelProperty(value = "父物料数量")
|
||||||
|
private BigDecimal pnum;
|
||||||
|
/**
|
||||||
|
* 工时
|
||||||
|
*/
|
||||||
|
@Excel(name = "基于最上层物料的用量", width = 15)
|
||||||
|
@ApiModelProperty(value = "基于最上层物料的用量")
|
||||||
|
private BigDecimal topnum;
|
||||||
|
/**
|
||||||
|
* 工时
|
||||||
|
*/
|
||||||
|
@Excel(name = "价格类型", width = 15)
|
||||||
|
@ApiModelProperty(value = "价格类型")
|
||||||
|
private String priceType;
|
||||||
|
/**
|
||||||
|
* 工时
|
||||||
|
*/
|
||||||
|
@Excel(name = "制造类型", width = 15)
|
||||||
|
@ApiModelProperty(value = "制造类型")
|
||||||
|
private String manuType;
|
||||||
|
/**
|
||||||
|
* 工时
|
||||||
|
*/
|
||||||
|
@Excel(name = "材料", width = 15)
|
||||||
|
@ApiModelProperty(value = "材料")
|
||||||
|
private BigDecimal material;
|
||||||
|
/**
|
||||||
|
* 工时
|
||||||
|
*/
|
||||||
|
@Excel(name = "人工", width = 15)
|
||||||
|
@ApiModelProperty(value = "人工")
|
||||||
|
private BigDecimal labor;
|
||||||
|
/**
|
||||||
|
* 工时
|
||||||
|
*/
|
||||||
|
@Excel(name = "设备", width = 15)
|
||||||
|
@ApiModelProperty(value = "设备")
|
||||||
|
private BigDecimal equip;
|
||||||
|
/**
|
||||||
|
* 工时
|
||||||
|
*/
|
||||||
|
@Excel(name = "燃动", width = 15)
|
||||||
|
@ApiModelProperty(value = "燃动")
|
||||||
|
private BigDecimal fuel;
|
||||||
|
/**
|
||||||
|
* 工时
|
||||||
|
*/
|
||||||
|
@Excel(name = "辅料", width = 15)
|
||||||
|
@ApiModelProperty(value = "辅料")
|
||||||
|
private BigDecimal auxi;
|
||||||
|
/**
|
||||||
|
* 工时
|
||||||
|
*/
|
||||||
|
@Excel(name = "其他", width = 15)
|
||||||
|
@ApiModelProperty(value = "其他")
|
||||||
|
private BigDecimal other;
|
||||||
|
|
||||||
|
@Excel(name = "层级", width = 15)
|
||||||
|
@ApiModelProperty(value = "层级")
|
||||||
|
private String layer;
|
||||||
}
|
}
|
||||||
|
|||||||
+162
-336
@@ -10,6 +10,7 @@ import lombok.Builder;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
@@ -18,348 +19,173 @@ import java.math.BigDecimal;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: app_scene_cost_standard_result
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2024-09-17
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Builder
|
@Builder
|
||||||
@TableName("app_scene_cost_standard_result")
|
@TableName("app_scene_cost_standard_result")
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@ApiModel(value = "标准成本单行", description = "标准成本单行")
|
@ApiModel(value="app_scene_cost_standard_result对象", description="app_scene_cost_standard_result")
|
||||||
public class AppSceneCostStandardResult implements Serializable {
|
public class AppSceneCostStandardResult implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**主键*/
|
||||||
/**
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
* 主键
|
@ApiModelProperty(value = "主键")
|
||||||
*/
|
private java.lang.Integer id;
|
||||||
@TableId(type = IdType.AUTO)
|
/**工厂*/
|
||||||
@ApiModelProperty(value = "id")
|
@Excel(name = "工厂", width = 15)
|
||||||
private Integer id;
|
@ApiModelProperty(value = "工厂")
|
||||||
|
private java.lang.String factory;
|
||||||
/**
|
/**物料号*/
|
||||||
* 工厂
|
@Excel(name = "物料号", width = 15)
|
||||||
*/
|
@ApiModelProperty(value = "物料号")
|
||||||
@Column(name = "factory")
|
private java.lang.String materialNumber;
|
||||||
private String factory;
|
/**父物料号*/
|
||||||
|
@Excel(name = "父物料号", width = 15)
|
||||||
/**
|
@ApiModelProperty(value = "父物料号")
|
||||||
* 物料号
|
private java.lang.String parentMatnr;
|
||||||
*/
|
/**阶段*/
|
||||||
@Column(name = "material_number")
|
@Excel(name = "阶段", width = 15)
|
||||||
private String materialNumber;
|
@ApiModelProperty(value = "阶段")
|
||||||
|
private java.lang.String stage;
|
||||||
/**
|
/**版本号*/
|
||||||
* 父物料号
|
@Excel(name = "版本号", width = 15)
|
||||||
*/
|
@ApiModelProperty(value = "版本号")
|
||||||
@Column(name = "parent_matnr")
|
private java.lang.String versionNumber;
|
||||||
private String parentMatnr;
|
/**层级*/
|
||||||
|
@Excel(name = "层级", width = 15)
|
||||||
/**
|
@ApiModelProperty(value = "层级")
|
||||||
* 阶段
|
private java.lang.String layer;
|
||||||
*/
|
/**价格类型*/
|
||||||
@Column(name = "stage")
|
@Excel(name = "价格类型", width = 15)
|
||||||
private String stage;
|
@ApiModelProperty(value = "价格类型")
|
||||||
|
private java.lang.String pricetype;
|
||||||
/**
|
/**会计期间*/
|
||||||
* 版本号
|
@Excel(name = "会计期间", width = 15)
|
||||||
*/
|
@ApiModelProperty(value = "会计期间")
|
||||||
@Column(name = "version_number")
|
private java.lang.String ymonth;
|
||||||
private String versionNumber;
|
/**总标准成本*/
|
||||||
|
@Excel(name = "总标准成本", width = 15)
|
||||||
/**
|
@ApiModelProperty(value = "总标准成本")
|
||||||
* 层级
|
private java.math.BigDecimal totalStandardCost;
|
||||||
*/
|
/**本阶材料成本*/
|
||||||
@Column(name = "layer")
|
@Excel(name = "本阶材料成本", width = 15)
|
||||||
private String layer;
|
@ApiModelProperty(value = "本阶材料成本")
|
||||||
|
private java.math.BigDecimal materialCostStage;
|
||||||
/**
|
/**本阶人工成本*/
|
||||||
* 价格类型
|
@Excel(name = "本阶人工成本", width = 15)
|
||||||
*/
|
@ApiModelProperty(value = "本阶人工成本")
|
||||||
@Column(name = "pricetype")
|
private java.math.BigDecimal laborCostStage;
|
||||||
private String pricetype;
|
/**本阶设备成本*/
|
||||||
|
@Excel(name = "本阶设备成本", width = 15)
|
||||||
/**
|
@ApiModelProperty(value = "本阶设备成本")
|
||||||
* 会计期间
|
private java.math.BigDecimal equipCostStage;
|
||||||
*/
|
/**本阶燃动成本*/
|
||||||
@Column(name = "ymonth")
|
@Excel(name = "本阶燃动成本", width = 15)
|
||||||
private String ymonth;
|
@ApiModelProperty(value = "本阶燃动成本")
|
||||||
|
private java.math.BigDecimal burningCostStage;
|
||||||
/**
|
/**本阶辅料成本*/
|
||||||
* 本阶标准成本
|
@Excel(name = "本阶辅料成本", width = 15)
|
||||||
*/
|
@ApiModelProperty(value = "本阶辅料成本")
|
||||||
@Column(name = "total_standard_cost_inter")
|
private java.math.BigDecimal auxiliaryCostStage;
|
||||||
private BigDecimal totalStandardCostInter;
|
/**本阶其他成本*/
|
||||||
|
@Excel(name = "本阶其他成本", width = 15)
|
||||||
/**
|
@ApiModelProperty(value = "本阶其他成本")
|
||||||
* 累计标准成本
|
private java.math.BigDecimal otherCostStage;
|
||||||
*/
|
/**累计材料成本*/
|
||||||
@Column(name = "total_standard_cost")
|
@Excel(name = "累计材料成本", width = 15)
|
||||||
private BigDecimal totalStandardCost;
|
@ApiModelProperty(value = "累计材料成本")
|
||||||
|
private java.math.BigDecimal materialCostAccumulated;
|
||||||
/**
|
/**累计人工成本*/
|
||||||
* material_cost_stage_inter
|
@Excel(name = "累计人工成本", width = 15)
|
||||||
*/
|
@ApiModelProperty(value = "累计人工成本")
|
||||||
@Column(name = "material_cost_stage_inter")
|
private java.math.BigDecimal laborCostAccumulated;
|
||||||
private BigDecimal materialCostStageInter;
|
/**累计设备成本*/
|
||||||
|
@Excel(name = "累计设备成本", width = 15)
|
||||||
/**
|
@ApiModelProperty(value = "累计设备成本")
|
||||||
* 本阶物料成本
|
private java.math.BigDecimal equipCostAccumulated;
|
||||||
*/
|
/**累计燃动成本*/
|
||||||
@Column(name = "material_cost_stage")
|
@Excel(name = "累计燃动成本", width = 15)
|
||||||
private BigDecimal materialCostStage;
|
@ApiModelProperty(value = "累计燃动成本")
|
||||||
|
private java.math.BigDecimal burningCostAccumulated;
|
||||||
/**
|
/**累计辅料成本*/
|
||||||
* 本阶人工成本
|
@Excel(name = "累计辅料成本", width = 15)
|
||||||
*/
|
@ApiModelProperty(value = "累计辅料成本")
|
||||||
@Column(name = "labor_cost_stage")
|
private java.math.BigDecimal auxiliaryCostAccumulated;
|
||||||
private BigDecimal laborCostStage;
|
/**累计其他成本*/
|
||||||
|
@Excel(name = "累计其他成本", width = 15)
|
||||||
/**
|
@ApiModelProperty(value = "累计其他成本")
|
||||||
* 本阶设备费
|
private java.math.BigDecimal otherCostAccumulated;
|
||||||
*/
|
/**总材料成本*/
|
||||||
@Column(name = "equip_cost_stage")
|
@Excel(name = "总材料成本", width = 15)
|
||||||
private BigDecimal equipCostStage;
|
@ApiModelProperty(value = "总材料成本")
|
||||||
|
private java.math.BigDecimal materialCostTotal;
|
||||||
/**
|
/**总人工成本*/
|
||||||
* 本阶燃动费
|
@Excel(name = "总人工成本", width = 15)
|
||||||
*/
|
@ApiModelProperty(value = "总人工成本")
|
||||||
@Column(name = "burning_cost_stage")
|
private java.math.BigDecimal laborCostTotal;
|
||||||
private BigDecimal burningCostStage;
|
/**总设备成本*/
|
||||||
|
@Excel(name = "总设备成本", width = 15)
|
||||||
/**
|
@ApiModelProperty(value = "总设备成本")
|
||||||
* 本阶辅料费
|
private java.math.BigDecimal equipCostTotal;
|
||||||
*/
|
/**总燃动成本*/
|
||||||
@Column(name = "auxiliary_cost_stage")
|
@Excel(name = "总燃动成本", width = 15)
|
||||||
private BigDecimal auxiliaryCostStage;
|
@ApiModelProperty(value = "总燃动成本")
|
||||||
|
private java.math.BigDecimal burningCostTotal;
|
||||||
/**
|
/**总辅料成本*/
|
||||||
* 本阶其他费
|
@Excel(name = "总辅料成本", width = 15)
|
||||||
*/
|
@ApiModelProperty(value = "总辅料成本")
|
||||||
@Column(name = "other_cost_stage")
|
private java.math.BigDecimal auxiliaryCostTotal;
|
||||||
private BigDecimal otherCostStage;
|
/**总其他成本*/
|
||||||
|
@Excel(name = "总其他成本", width = 15)
|
||||||
/**
|
@ApiModelProperty(value = "总其他成本")
|
||||||
* 本阶物流费
|
private java.math.BigDecimal otherCostTotal;
|
||||||
*/
|
/**低阶码*/
|
||||||
@Column(name = "stage_logistics_cost")
|
@Excel(name = "低阶码", width = 15)
|
||||||
private BigDecimal stageLogisticsCost;
|
@ApiModelProperty(value = "低阶码")
|
||||||
|
private java.lang.String lowOrderCode;
|
||||||
/**
|
/**相对用量*/
|
||||||
* material_cost_accumulated_inter
|
@Excel(name = "相对用量", width = 15)
|
||||||
*/
|
@ApiModelProperty(value = "相对用量")
|
||||||
@Column(name = "material_cost_accumulated_inter")
|
private java.math.BigDecimal relativeDosage;
|
||||||
private BigDecimal materialCostAccumulatedInter;
|
/**相对材料成本*/
|
||||||
|
@Excel(name = "相对材料成本", width = 15)
|
||||||
/**
|
@ApiModelProperty(value = "相对材料成本")
|
||||||
* 累计物料
|
private java.math.BigDecimal materialCostRelative;
|
||||||
*/
|
/**相对人工成本*/
|
||||||
@Column(name = "material_cost_accumulated")
|
@Excel(name = "相对人工成本", width = 15)
|
||||||
private BigDecimal materialCostAccumulated;
|
@ApiModelProperty(value = "相对人工成本")
|
||||||
|
private java.math.BigDecimal laborCostRelative;
|
||||||
/**
|
/**相对制费成本*/
|
||||||
* 累计人工成本
|
@Excel(name = "相对制费成本", width = 15)
|
||||||
*/
|
@ApiModelProperty(value = "相对制费成本")
|
||||||
@Column(name = "labor_cost_accumulated")
|
private java.math.BigDecimal manufactureCostRelative;
|
||||||
private BigDecimal laborCostAccumulated;
|
/**相对总成本*/
|
||||||
|
@Excel(name = "相对总成本", width = 15)
|
||||||
/**
|
@ApiModelProperty(value = "相对总成本")
|
||||||
* 累计设备费
|
private java.math.BigDecimal totalCostRelative;
|
||||||
*/
|
/**创建时间*/
|
||||||
@Column(name = "equip_cost_accumulated")
|
@Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||||
private BigDecimal equipCostAccumulated;
|
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||||
/**
|
@ApiModelProperty(value = "创建时间")
|
||||||
* 累计燃动费
|
private java.util.Date createdTime;
|
||||||
*/
|
/**物料描述*/
|
||||||
@Column(name = "burning_cost_accumulated")
|
@Excel(name = "物料描述", width = 15)
|
||||||
private BigDecimal burningCostAccumulated;
|
@ApiModelProperty(value = "物料描述")
|
||||||
|
private java.lang.String maktx;
|
||||||
/**
|
/**数量*/
|
||||||
* 累计辅料费
|
@Excel(name = "数量", width = 15)
|
||||||
*/
|
@ApiModelProperty(value = "数量")
|
||||||
@Column(name = "auxiliary_cost_accumulated")
|
private java.math.BigDecimal menge;
|
||||||
private BigDecimal auxiliaryCostAccumulated;
|
/**数量*/
|
||||||
|
@Excel(name = "制造类型", width = 15)
|
||||||
/**
|
@ApiModelProperty(value = "制造类型")
|
||||||
* 累计其他费
|
private java.lang.String manuType;
|
||||||
*/
|
|
||||||
@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;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-4
@@ -3,6 +3,7 @@ package com.zzsmart.qomo.kn.cost.manage.mapper;
|
|||||||
import com.alibaba.fastjson.JSONObject;
|
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.AppSceneCostBomRelevancy;
|
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostBomRelevancy;
|
||||||
|
import com.zzsmart.qomo.kn.cost.manage.vo.BomTreeVo;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.apache.ibatis.annotations.Select;
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
@@ -16,16 +17,16 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface AppSceneCostBomRelevancyMapper extends BaseMapper<AppSceneCostBomRelevancy> {
|
public interface AppSceneCostBomRelevancyMapper extends BaseMapper<AppSceneCostBomRelevancy> {
|
||||||
@Select("WITH RECURSIVE BOM_Tree AS (\n" +
|
@Select("WITH RECURSIVE BOM_Tree AS (\n" +
|
||||||
" SELECT matnr, idnrk, meins, 0 AS depth\n" +
|
" SELECT matnr, idnrk, menge/bmeng as menge,1.000000 as pmenge,1.000000 as topmenge, 1 AS depth\n" +
|
||||||
" FROM app_scene_cost_bom_relevancy\n" +
|
" FROM app_scene_cost_bom_relevancy\n" +
|
||||||
" WHERE matnr = #{parentId}\n" +
|
" WHERE matnr = #{parentId}\n" +
|
||||||
" UNION ALL\n" +
|
" UNION ALL\n" +
|
||||||
" SELECT b.matnr, b.idnrk, b.meins, BOM_Tree.depth + 1\n" +
|
" SELECT b.matnr, b.idnrk, b.menge/b.bmeng as menge, BOM_Tree.menge as pmenge,BOM_Tree.menge*(b.menge/b.bmeng) AS topmenge,BOM_Tree.depth + 1\n" +
|
||||||
" FROM app_scene_cost_bom_relevancy b\n" +
|
" FROM app_scene_cost_bom_relevancy b\n" +
|
||||||
" JOIN BOM_Tree ON b.matnr = BOM_Tree.idnrk\n" +
|
" JOIN BOM_Tree ON b.matnr = BOM_Tree.idnrk\n" +
|
||||||
")\n" +
|
")\n" +
|
||||||
"SELECT matnr, idnrk, meins, depth FROM BOM_Tree")
|
"SELECT matnr, idnrk, menge,pmenge,topmenge, depth FROM BOM_Tree")
|
||||||
List<AppSceneCostBomRelevancy> findChildrenByParentId(String parentId);
|
List<BomTreeVo> findChildrenByParentId(String parentId);
|
||||||
|
|
||||||
|
|
||||||
@Select("${selectSql}")
|
@Select("${selectSql}")
|
||||||
|
|||||||
+18
@@ -0,0 +1,18 @@
|
|||||||
|
package com.zzsmart.qomo.kn.cost.manage.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostMaterial;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
//import com.zzsmart.qomo.modules.demo..entity.AppSceneCostMaterial;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: app_scene_cost_material
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2024-09-17
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
public interface AppSceneCostMaterialMapper extends BaseMapper<AppSceneCostMaterial> {
|
||||||
|
|
||||||
|
}
|
||||||
+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..mapper.AppSceneCostMaterialMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
+427
-163
@@ -8,9 +8,12 @@ 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.AppSceneCostBomRelevancyMapper;
|
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.BomTreeVo;
|
||||||
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;
|
||||||
import com.zzsmart.qomo.plugin.task.api.TaskExecutionContext;
|
import com.zzsmart.qomo.plugin.task.api.TaskExecutionContext;
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
|
import liquibase.pro.packaged.B;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -18,10 +21,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@@ -71,6 +71,9 @@ public class StandardCostService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IAppSceneCostStandardResultService iAppSceneCostStandardResultService;
|
private IAppSceneCostStandardResultService iAppSceneCostStandardResultService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IAppSceneCostMaterialService iAppSceneCostMaterialService;
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
standardCostService = this;
|
standardCostService = this;
|
||||||
@@ -82,6 +85,7 @@ public class StandardCostService {
|
|||||||
standardCostService.costMaterialProcessHoursService = this.costMaterialProcessHoursService;
|
standardCostService.costMaterialProcessHoursService = this.costMaterialProcessHoursService;
|
||||||
standardCostService.iAppSceneCostResultValueService = this.iAppSceneCostResultValueService;
|
standardCostService.iAppSceneCostResultValueService = this.iAppSceneCostResultValueService;
|
||||||
standardCostService.iAppSceneCostStandardResultService = this.iAppSceneCostStandardResultService;
|
standardCostService.iAppSceneCostStandardResultService = this.iAppSceneCostStandardResultService;
|
||||||
|
standardCostService.iAppSceneCostMaterialService = this.iAppSceneCostMaterialService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -127,16 +131,90 @@ public class StandardCostService {
|
|||||||
* @param flowInstanceId 流程实例id
|
* @param flowInstanceId 流程实例id
|
||||||
*/
|
*/
|
||||||
public static void getAllMaterialBomInfoByTopMaterialCode(String topMaterialCode, String taskType, String taskCode, Integer flowInstanceId) {
|
public static void getAllMaterialBomInfoByTopMaterialCode(String topMaterialCode, String taskType, String taskCode, Integer flowInstanceId) {
|
||||||
List<AppSceneCostBomRelevancy> list = standardCostService.costMaterialBomService.queryAllBomInfoByTopMaterialCode(topMaterialCode);
|
log.info("getAllMaterialBomInfoByTopMaterialCode");
|
||||||
|
List<BomTreeVo> list = standardCostService.costMaterialBomService.queryAllBomInfoByTopMaterialCode(topMaterialCode);
|
||||||
|
List<String> MarterialNoList = new ArrayList<>();
|
||||||
|
if (list != null && list.size() > 0) {
|
||||||
|
MarterialNoList = list.stream().filter(s -> s.getIdnrk() != null).map(BomTreeVo::getIdnrk).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
Map<String, String> manuTypeMap = standardCostService.iAppSceneCostMaterialService.getManuTypeByMaterialNo(MarterialNoList);
|
||||||
|
|
||||||
|
int maxdepth = 0;
|
||||||
|
List<AppSceneCostResultValue> appSceneCostResultValues=new ArrayList<>();
|
||||||
log.info("Full ParamTask list: {}", list);
|
log.info("Full ParamTask list: {}", list);
|
||||||
//TODO material.getMeins()领用量??为什么是ST字母
|
//TODO material.getMeins()领用量??为什么是ST字母
|
||||||
for (int i = 0; list != null && i < list.size(); i++) {
|
for (int i = 0; list != null && i < list.size(); i++) {
|
||||||
AppSceneCostBomRelevancy material = list.get(i);
|
BomTreeVo material = list.get(i);
|
||||||
//TODO 物料领用数据
|
String manutype = "";
|
||||||
BigDecimal num1 = BigDecimal.ONE;
|
if(manuTypeMap.containsKey(material.getIdnrk())){
|
||||||
AppSceneCostResultValue appSceneCostResultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(material.getIdnrk()).parentMarterialNo(material.getMatnr()).taskType(taskType).taskCode(taskCode).flowInstanceId(flowInstanceId).num(num1).build();
|
manutype = manuTypeMap.get(material.getIdnrk());
|
||||||
standardCostService.iAppSceneCostResultValueService.save(appSceneCostResultValue);
|
|
||||||
}
|
}
|
||||||
|
//TODO 物料领用数据
|
||||||
|
BigDecimal num1 = material.getMenge();
|
||||||
|
AppSceneCostResultValue appSceneCostResultValue = AppSceneCostResultValue.builder()
|
||||||
|
.belongTopMaterialNo(topMaterialCode)
|
||||||
|
.marterialNo(material.getIdnrk())
|
||||||
|
.parentMarterialNo(material.getMatnr())
|
||||||
|
.taskType(taskType)
|
||||||
|
.taskCode(taskCode)
|
||||||
|
.flowInstanceId(flowInstanceId)
|
||||||
|
.num(material.getMenge())
|
||||||
|
.pnum(material.getPmenge())
|
||||||
|
.topnum(material.getTopmenge())
|
||||||
|
.depth(material.depth)
|
||||||
|
.manuType(manutype)
|
||||||
|
.build();
|
||||||
|
appSceneCostResultValues.add(appSceneCostResultValue);
|
||||||
|
if(material.depth>maxdepth){
|
||||||
|
maxdepth=material.depth;
|
||||||
|
}
|
||||||
|
//standardCostService.iAppSceneCostResultValueService.save(appSceneCostResultValue);
|
||||||
|
}
|
||||||
|
Map<String,Integer> mapIndex = new HashMap<>();
|
||||||
|
for (int i=1;i<=maxdepth;++i){
|
||||||
|
//int index=1;
|
||||||
|
for (AppSceneCostResultValue appSceneCostResultValue:appSceneCostResultValues){
|
||||||
|
if(appSceneCostResultValue.getDepth()==i){
|
||||||
|
String parentlayer = "";
|
||||||
|
if(i==1){
|
||||||
|
parentlayer="0";
|
||||||
|
}else{
|
||||||
|
for (AppSceneCostResultValue appSceneCostResultValue1:appSceneCostResultValues){
|
||||||
|
if(appSceneCostResultValue1.getMarterialNo().equals(appSceneCostResultValue.getParentMarterialNo())&&(appSceneCostResultValue1.getDepth()+1==appSceneCostResultValue.getDepth())){
|
||||||
|
parentlayer=appSceneCostResultValue1.getLayer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int index = 1;
|
||||||
|
if(mapIndex.containsKey(parentlayer)){
|
||||||
|
index = mapIndex.get(parentlayer);
|
||||||
|
}else{
|
||||||
|
mapIndex.put(parentlayer,index);
|
||||||
|
}
|
||||||
|
String layer = parentlayer+"-"+String.valueOf(index);
|
||||||
|
index++;
|
||||||
|
mapIndex.put(parentlayer,index);
|
||||||
|
appSceneCostResultValue.setLayer(layer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
standardCostService.iAppSceneCostResultValueService.saveBatch(appSceneCostResultValues);
|
||||||
|
|
||||||
|
AppSceneCostResultValue appSceneCostResultValue = AppSceneCostResultValue.builder()
|
||||||
|
.belongTopMaterialNo(topMaterialCode)
|
||||||
|
.marterialNo(topMaterialCode)
|
||||||
|
.parentMarterialNo(topMaterialCode)
|
||||||
|
.taskType(taskType)
|
||||||
|
.taskCode(taskCode)
|
||||||
|
.flowInstanceId(flowInstanceId)
|
||||||
|
.num(new BigDecimal(1))
|
||||||
|
.pnum(new BigDecimal(1))
|
||||||
|
.topnum(new BigDecimal(1))
|
||||||
|
.depth(0)
|
||||||
|
.layer("0")
|
||||||
|
.manuType("E")
|
||||||
|
.build();
|
||||||
|
standardCostService.iAppSceneCostResultValueService.save(appSceneCostResultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -148,6 +226,7 @@ public class StandardCostService {
|
|||||||
* @param flowInstanceId 流程实例id
|
* @param flowInstanceId 流程实例id
|
||||||
*/
|
*/
|
||||||
public static void countMaterialCostByTopMaterialCode(String topMaterialCode, String taskType, String taskCode, Integer flowInstanceId, String feeType) {
|
public static void countMaterialCostByTopMaterialCode(String topMaterialCode, String taskType, String taskCode, Integer flowInstanceId, String feeType) {
|
||||||
|
log.info("countMaterialCostByTopMaterialCode");
|
||||||
//1.查询出物料编号对应的下所有的BOM信息
|
//1.查询出物料编号对应的下所有的BOM信息
|
||||||
List<AppSceneCostResultValue> list = standardCostService.iAppSceneCostResultValueService.getResultValueByTopMaterialNo(topMaterialCode, "MaterialInput", String.valueOf(flowInstanceId));
|
List<AppSceneCostResultValue> list = standardCostService.iAppSceneCostResultValueService.getResultValueByTopMaterialNo(topMaterialCode, "MaterialInput", String.valueOf(flowInstanceId));
|
||||||
//2.计算出所有的单个物料的物料成本
|
//2.计算出所有的单个物料的物料成本
|
||||||
@@ -163,15 +242,40 @@ public class StandardCostService {
|
|||||||
String marterialNo = appSceneCostResultValue.getMarterialNo();
|
String marterialNo = appSceneCostResultValue.getMarterialNo();
|
||||||
BigDecimal num = appSceneCostResultValue.getNum();
|
BigDecimal num = appSceneCostResultValue.getNum();
|
||||||
if (marterialNo != null && num != null && (new BigDecimal(num.toString()).compareTo(BigDecimal.ZERO)) != 0) {
|
if (marterialNo != null && num != null && (new BigDecimal(num.toString()).compareTo(BigDecimal.ZERO)) != 0) {
|
||||||
BigDecimal price = purchasePriceMap.get(marterialNo);
|
BigDecimal price = new BigDecimal(0);
|
||||||
if (price == null) {
|
String price_type = "";
|
||||||
price = BigDecimal.ZERO;
|
if(appSceneCostResultValue.getManuType()!=null&&appSceneCostResultValue.getManuType().equals("F")){
|
||||||
|
price = purchasePriceMap.get(marterialNo);
|
||||||
|
price_type = "purchase_record";
|
||||||
}
|
}
|
||||||
|
//purchasePriceMap.get(marterialNo);
|
||||||
|
//if (price == null) {
|
||||||
|
// price = BigDecimal.ZERO;
|
||||||
|
//} else {
|
||||||
|
// price_type = "purchase_record";
|
||||||
|
//}
|
||||||
BigDecimal number = new BigDecimal(num.toString());
|
BigDecimal number = new BigDecimal(num.toString());
|
||||||
//单价乘以数量
|
//单价乘以数量
|
||||||
BigDecimal totalCost = price.multiply(number);
|
BigDecimal totalCost = price.multiply(number);
|
||||||
//2.2计算出人工成本并存储到成本结果数据表中
|
//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();
|
AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder()
|
||||||
|
.belongTopMaterialNo(topMaterialCode)
|
||||||
|
.marterialNo(marterialNo)
|
||||||
|
.parentMarterialNo(appSceneCostResultValue.getParentMarterialNo())
|
||||||
|
.taskType(taskType)
|
||||||
|
.costType(feeType)
|
||||||
|
.taskCode(taskCode)
|
||||||
|
.priceType(price_type)
|
||||||
|
.flowInstanceId(flowInstanceId)
|
||||||
|
.countValue(totalCost + "")
|
||||||
|
.material(price)
|
||||||
|
.num(num)
|
||||||
|
.pnum(appSceneCostResultValue.getPnum())
|
||||||
|
.topnum(appSceneCostResultValue.getTopnum())
|
||||||
|
.manuType(appSceneCostResultValue.getManuType())
|
||||||
|
.depth(appSceneCostResultValue.getDepth())
|
||||||
|
.layer(appSceneCostResultValue.getLayer())
|
||||||
|
.build();
|
||||||
standardCostService.iAppSceneCostResultValueService.save(resultValue);
|
standardCostService.iAppSceneCostResultValueService.save(resultValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -186,12 +290,13 @@ public class StandardCostService {
|
|||||||
* @param flowInstanceId 流程实例id
|
* @param flowInstanceId 流程实例id
|
||||||
*/
|
*/
|
||||||
public static void countLaborCostByTopMaterialCode(String topMaterialCode, String taskType, String taskCode, Integer flowInstanceId, String feeType, AppSceneCostHourRate appSceneCostHourRate) {
|
public static void countLaborCostByTopMaterialCode(String topMaterialCode, String taskType, String taskCode, Integer flowInstanceId, String feeType, AppSceneCostHourRate appSceneCostHourRate) {
|
||||||
|
log.info("countLaborCostByTopMaterialCode");
|
||||||
//1.查询出人员工时费率
|
//1.查询出人员工时费率
|
||||||
AppSceneCostHourRate hourRateInfo = standardCostService.iHourRateService.getOneHourRateInfo(appSceneCostHourRate);
|
//AppSceneCostHourRate hourRateInfo = standardCostService.iHourRateService.getOneHourRateInfo();
|
||||||
BigDecimal hourRate = new BigDecimal("0");
|
BigDecimal hourRate = new BigDecimal("0");
|
||||||
if (hourRateInfo != null) {
|
//if (hourRateInfo != null) {
|
||||||
hourRate = hourRateInfo.getLaborHourRate();
|
// hourRate = hourRateInfo.getLaborHourRate();
|
||||||
}
|
//}
|
||||||
//1.查询出物料编号对应的下所有的BOM信息
|
//1.查询出物料编号对应的下所有的BOM信息
|
||||||
List<AppSceneCostResultValue> list = standardCostService.iAppSceneCostResultValueService.getResultValueByTopMaterialNo(topMaterialCode, "MaterialInput", String.valueOf(flowInstanceId));
|
List<AppSceneCostResultValue> list = standardCostService.iAppSceneCostResultValueService.getResultValueByTopMaterialNo(topMaterialCode, "MaterialInput", String.valueOf(flowInstanceId));
|
||||||
//2.计算出所有的单个物料的人工成本
|
//2.计算出所有的单个物料的人工成本
|
||||||
@@ -218,12 +323,89 @@ public class StandardCostService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//2.2计算出人工成本并存储到成本结果数据表中
|
//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();
|
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)
|
||||||
|
.num(appSceneCostResultValue.getNum())
|
||||||
|
.pnum(appSceneCostResultValue.getPnum())
|
||||||
|
.topnum(appSceneCostResultValue.getTopnum())
|
||||||
|
.manuType(appSceneCostResultValue.getManuType())
|
||||||
|
.build();
|
||||||
standardCostService.iAppSceneCostResultValueService.save(resultValue);
|
standardCostService.iAppSceneCostResultValueService.save(resultValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void countManufacturingCost(String topMaterialCode, String taskType, String taskCode, Integer flowInstanceId) {
|
||||||
|
log.info("countManufacturingCost");
|
||||||
|
//1.查询出人员工时费率
|
||||||
|
Map<String,AppSceneCostHourRate> mapHourRate = standardCostService.iHourRateService.getOneHourRateInfo();
|
||||||
|
BigDecimal hourRate = new BigDecimal("0");
|
||||||
|
//if (hourRateInfo != null) {
|
||||||
|
// hourRate = hourRateInfo.getLaborHourRate();
|
||||||
|
//}
|
||||||
|
//1.查询出物料编号对应的下所有的BOM信息
|
||||||
|
List<AppSceneCostResultValue> list = standardCostService.iAppSceneCostResultValueService.getResultValueByTopMaterialNo(topMaterialCode, "MaterialCost", 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);
|
||||||
|
for (AppSceneCostResultValue appSceneCostResultValue:list){
|
||||||
|
double labor = 0;
|
||||||
|
double equip = 0;
|
||||||
|
double fuel = 0;
|
||||||
|
double auxi = 0;
|
||||||
|
double other = 0;
|
||||||
|
if(processHoursMap.containsKey(appSceneCostResultValue.getMarterialNo())){
|
||||||
|
List<AppSceneCostProductProcessMaintenance> appSceneCostProductProcessMaintenances = processHoursMap.get(appSceneCostResultValue.getMarterialNo());
|
||||||
|
for (AppSceneCostProductProcessMaintenance pm:appSceneCostProductProcessMaintenances){
|
||||||
|
String costcenter = pm.getCostCenterCode();
|
||||||
|
if(mapHourRate.containsKey(costcenter)){
|
||||||
|
AppSceneCostHourRate hourrate = mapHourRate.get(costcenter);
|
||||||
|
labor+=hourrate.getLaborHourRate().doubleValue()*pm.getLaborHour().doubleValue();
|
||||||
|
equip+=hourrate.getEquipHourRate().doubleValue()*pm.getMachineHour().doubleValue();
|
||||||
|
fuel+=hourrate.getFuelHourRate().doubleValue()*pm.getBurningHour().doubleValue();
|
||||||
|
auxi+=hourrate.getAuxiliaryHourRate().doubleValue()*pm.getAuxiliaryHour().doubleValue();
|
||||||
|
other+=hourrate.getOtherHourRate().doubleValue()*pm.getOtherHour().doubleValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder()
|
||||||
|
.belongTopMaterialNo(topMaterialCode)
|
||||||
|
.marterialNo(appSceneCostResultValue.getMarterialNo())
|
||||||
|
.parentMarterialNo(appSceneCostResultValue.getParentMarterialNo())
|
||||||
|
.taskType(taskType)
|
||||||
|
.taskCode(taskCode)
|
||||||
|
.flowInstanceId(Integer.valueOf(flowInstanceId))
|
||||||
|
.countValue("")
|
||||||
|
.material(appSceneCostResultValue.getMaterial())
|
||||||
|
.priceType(appSceneCostResultValue.getPriceType())
|
||||||
|
.labor(new BigDecimal(labor))
|
||||||
|
.equip(new BigDecimal(equip))
|
||||||
|
.fuel(new BigDecimal(fuel))
|
||||||
|
.auxi(new BigDecimal(auxi))
|
||||||
|
.other(new BigDecimal(other))
|
||||||
|
.num(appSceneCostResultValue.getNum())
|
||||||
|
.pnum(appSceneCostResultValue.getPnum())
|
||||||
|
.topnum(appSceneCostResultValue.getTopnum())
|
||||||
|
.manuType(appSceneCostResultValue.getManuType())
|
||||||
|
.depth(appSceneCostResultValue.getDepth())
|
||||||
|
.layer(appSceneCostResultValue.getLayer())
|
||||||
|
.build();
|
||||||
|
standardCostService.iAppSceneCostResultValueService.save(resultValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 【4.制造费用】
|
* 【4.制造费用】
|
||||||
*
|
*
|
||||||
@@ -233,12 +415,13 @@ public class StandardCostService {
|
|||||||
* @param flowInstanceId 流程实例id
|
* @param flowInstanceId 流程实例id
|
||||||
*/
|
*/
|
||||||
public static void countManufacturingCostByTopMaterialCode(String topMaterialCode, String taskType, String taskCode, Integer flowInstanceId, String feeType, AppSceneCostHourRate appSceneCostHourRate) {
|
public static void countManufacturingCostByTopMaterialCode(String topMaterialCode, String taskType, String taskCode, Integer flowInstanceId, String feeType, AppSceneCostHourRate appSceneCostHourRate) {
|
||||||
|
log.info("countManufacturingCostByTopMaterialCode");
|
||||||
//1.查询出人员工时费率
|
//1.查询出人员工时费率
|
||||||
AppSceneCostHourRate hourRateInfo = standardCostService.iHourRateService.getOneHourRateInfo(appSceneCostHourRate);
|
//AppSceneCostHourRate hourRateInfo = standardCostService.iHourRateService.getOneHourRateInfo(appSceneCostHourRate);
|
||||||
BigDecimal hourRate = new BigDecimal("0");
|
BigDecimal hourRate = new BigDecimal("0");
|
||||||
if (hourRateInfo != null) {
|
//if (hourRateInfo != null) {
|
||||||
hourRate = hourRateInfo.getLaborHourRate();
|
// hourRate = hourRateInfo.getLaborHourRate();
|
||||||
}
|
//}
|
||||||
//1.查询出物料编号对应的下所有的BOM信息
|
//1.查询出物料编号对应的下所有的BOM信息
|
||||||
List<AppSceneCostResultValue> list = standardCostService.iAppSceneCostResultValueService.getResultValueByTopMaterialNo(topMaterialCode, "MaterialInput", String.valueOf(flowInstanceId));
|
List<AppSceneCostResultValue> list = standardCostService.iAppSceneCostResultValueService.getResultValueByTopMaterialNo(topMaterialCode, "MaterialInput", String.valueOf(flowInstanceId));
|
||||||
//2.根据费用类型进行不同的费用计算
|
//2.根据费用类型进行不同的费用计算
|
||||||
@@ -266,7 +449,22 @@ public class StandardCostService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//2.2计算机器成本并存储到成本结果数据表中
|
//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();
|
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)
|
||||||
|
.num(appSceneCostResultValue.getNum())
|
||||||
|
.pnum(appSceneCostResultValue.getPnum())
|
||||||
|
.topnum(appSceneCostResultValue.getTopnum())
|
||||||
|
.manuType(appSceneCostResultValue.getManuType())
|
||||||
|
.build();
|
||||||
standardCostService.iAppSceneCostResultValueService.save(resultValue);
|
standardCostService.iAppSceneCostResultValueService.save(resultValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -289,7 +487,22 @@ public class StandardCostService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//2.2计算机物料消耗存储到成本结果数据表中
|
//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();
|
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)
|
||||||
|
.num(appSceneCostResultValue.getNum())
|
||||||
|
.pnum(appSceneCostResultValue.getPnum())
|
||||||
|
.topnum(appSceneCostResultValue.getTopnum())
|
||||||
|
.manuType(appSceneCostResultValue.getManuType())
|
||||||
|
.build();
|
||||||
standardCostService.iAppSceneCostResultValueService.save(resultValue);
|
standardCostService.iAppSceneCostResultValueService.save(resultValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -312,7 +525,22 @@ public class StandardCostService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//2.2计算机物料消耗存储到成本结果数据表中
|
//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();
|
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)
|
||||||
|
.num(appSceneCostResultValue.getNum())
|
||||||
|
.pnum(appSceneCostResultValue.getPnum())
|
||||||
|
.topnum(appSceneCostResultValue.getTopnum())
|
||||||
|
.manuType(appSceneCostResultValue.getManuType())
|
||||||
|
.build();
|
||||||
standardCostService.iAppSceneCostResultValueService.save(resultValue);
|
standardCostService.iAppSceneCostResultValueService.save(resultValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -335,30 +563,55 @@ public class StandardCostService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//2.2计算机物料消耗存储到成本结果数据表中
|
//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();
|
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)
|
||||||
|
.num(appSceneCostResultValue.getNum())
|
||||||
|
.pnum(appSceneCostResultValue.getPnum())
|
||||||
|
.topnum(appSceneCostResultValue.getTopnum())
|
||||||
|
.manuType(appSceneCostResultValue.getManuType())
|
||||||
|
.build();
|
||||||
standardCostService.iAppSceneCostResultValueService.save(resultValue);
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// 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);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -370,138 +623,134 @@ public class StandardCostService {
|
|||||||
* @param flowInstanceId 流程实例id
|
* @param flowInstanceId 流程实例id
|
||||||
* @param costType 流程实例id
|
* @param costType 流程实例id
|
||||||
*/
|
*/
|
||||||
public static void countStandardCostByTopMaterialCode(String topMaterialCode, String taskType, String taskCode, Integer flowInstanceId, String costType, String versionNumber) {
|
public static void countStandardCostByTopMaterialCode(String topMaterialCode, String taskType, String taskCode, Integer flowInstanceId, String costType, String stage,String versionNumber) {
|
||||||
|
log.info("countStandardCostByTopMaterialCode");
|
||||||
//1.查询出根物料编号对应的下所有的BOM信息结果值
|
//1.查询出根物料编号对应的下所有的BOM信息结果值
|
||||||
List<AppSceneCostResultValue> list = standardCostService.iAppSceneCostResultValueService.getAllResultValueByTopMaterialNo(topMaterialCode, String.valueOf(flowInstanceId));
|
//List<AppSceneCostResultValue> list = standardCostService.iAppSceneCostResultValueService.getAllResultValueByTopMaterialNo(topMaterialCode, String.valueOf(flowInstanceId));
|
||||||
|
List<AppSceneCostResultValue> list = standardCostService.iAppSceneCostResultValueService.getResultValueByTopMaterialNo(topMaterialCode, "ManufacturingCost", String.valueOf(flowInstanceId));
|
||||||
|
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, String> maktxMap = standardCostService.iAppSceneCostMaterialService.getMaktxByMaterialNo(MarterialNoList);
|
||||||
//2.计算出所有的单个物料的本阶的标准成本(标准成本=物料成本+人工成本+制造费用)
|
//2.计算出所有的单个物料的本阶的标准成本(标准成本=物料成本+人工成本+制造费用)
|
||||||
//按照物料编号进行分组
|
//按照物料编号进行分组
|
||||||
Map<String, List<AppSceneCostResultValue>> materialNoMap = list.stream().collect(Collectors.groupingBy(AppSceneCostResultValue::getMarterialNo));
|
Map<Integer, List<AppSceneCostResultValue>> materialNoMap = list.stream().collect(Collectors.groupingBy(AppSceneCostResultValue::getDepth));
|
||||||
|
|
||||||
|
Set<Integer> soredDepth = new HashSet<>();
|
||||||
|
for (Integer depth : materialNoMap.keySet()) {
|
||||||
|
soredDepth.add(depth);
|
||||||
|
}
|
||||||
|
ArrayList<Integer> deplist = new ArrayList<>(soredDepth);
|
||||||
|
Collections.reverse(deplist);
|
||||||
|
|
||||||
|
List<AppSceneCostStandardResult> appSceneCostStandardResults=new ArrayList<>();
|
||||||
|
|
||||||
//遍历根物料下所有的物料进行该物料本阶成本和费用类别的统计
|
//遍历根物料下所有的物料进行该物料本阶成本和费用类别的统计
|
||||||
for (String key : materialNoMap.keySet()) {
|
for (Integer depth : deplist) {
|
||||||
List<AppSceneCostResultValue> appSceneCostResultValues = materialNoMap.get(key);
|
List<AppSceneCostResultValue> appSceneCostResultValues = materialNoMap.get(depth);
|
||||||
//按照费用类别进行分组
|
for (AppSceneCostResultValue ascr:appSceneCostResultValues){
|
||||||
Map<String, List<AppSceneCostResultValue>> costTypeMap = appSceneCostResultValues.stream().filter(s -> s.getCostType() != null).collect(Collectors.groupingBy(AppSceneCostResultValue::getCostType));
|
//BigDecimal currentCost = new BigDecimal("0.0");
|
||||||
//【本阶标准成本】
|
|
||||||
BigDecimal currentCost = new BigDecimal("0.0");
|
|
||||||
//1.本阶物料成本
|
//1.本阶物料成本
|
||||||
BigDecimal materialCost = new BigDecimal("0.0");
|
double materialCost = 0;
|
||||||
//2.本阶人工成本
|
//2.本阶人工成本
|
||||||
BigDecimal laborCost = new BigDecimal("0.0");
|
double laborCost = 0;
|
||||||
//3.本阶制造费(设备费)
|
//3.本阶制造费(设备费)
|
||||||
BigDecimal equipmentCost = new BigDecimal("0.0");
|
double equipmentCost = 0;
|
||||||
//4.本阶制造费(辅料费用)
|
//4.本阶制造费(辅料费用)
|
||||||
BigDecimal supplyMaterialCost = new BigDecimal("0.0");
|
double fuelcost = 0;
|
||||||
//5.本阶制造费(水电费、燃动费)
|
//5.本阶制造费(水电费、燃动费)
|
||||||
BigDecimal driveCost = new BigDecimal("0.0");
|
double auxicost = 0;
|
||||||
//6.本阶制造费(其他制造费用)
|
//6.本阶制造费(其他制造费用)
|
||||||
BigDecimal otherCost = new BigDecimal("0.0");
|
double otherCost = 0;
|
||||||
//7.本阶制造费(物流费)
|
//7.本阶物料成本
|
||||||
BigDecimal logisticsCost = new BigDecimal("0.0");
|
double materialCost_acc = 0;
|
||||||
//物料单价
|
//8.本阶人工成本
|
||||||
BigDecimal materialUnitPrice = new BigDecimal("0.0");
|
double laborCost_acc = 0;
|
||||||
//人员工时、小时费率
|
//9.本阶制造费(设备费)
|
||||||
BigDecimal laborHour = new BigDecimal("0.0");
|
double equipmentCost_acc = 0;
|
||||||
BigDecimal laborHourRate = new BigDecimal("0.0");
|
//10.本阶制造费(辅料费用)
|
||||||
//设备工时、小时费率
|
double fuelcost_acc = 0;
|
||||||
BigDecimal equipmentHour = new BigDecimal("0.0");
|
//11.本阶制造费(水电费、燃动费)
|
||||||
BigDecimal equipmentHourRate = new BigDecimal("0.0");
|
double auxicost_acc = 0;
|
||||||
//辅料工时、小时费率
|
//12.本阶制造费(其他制造费用)
|
||||||
BigDecimal supplyMaterialHour = new BigDecimal("0.0");
|
double otherCost_acc = 0;
|
||||||
BigDecimal supplyMaterialHourRate = new BigDecimal("0.0");
|
|
||||||
//燃动工时、小时费率
|
if(ascr.getManuType().equals("F")){
|
||||||
BigDecimal driveHour = new BigDecimal("0.0");
|
materialCost = ascr.getMaterial().doubleValue()*ascr.getNum().doubleValue();
|
||||||
BigDecimal driveHourRate = new BigDecimal("0.0");
|
}else if(ascr.getManuType().equals("E")){
|
||||||
//其他工时、小时费率
|
double labor = ascr.getLabor().doubleValue();
|
||||||
BigDecimal otherHour = new BigDecimal("0.0");
|
double equip = ascr.getEquip().doubleValue();
|
||||||
BigDecimal otherHourRate = new BigDecimal("0.0");
|
double fuel = ascr.getFuel().doubleValue();
|
||||||
AppSceneCostResultValue currentMaterialCost = null;
|
double auxi = ascr.getAuxi().doubleValue();
|
||||||
//遍历所有费用类别计算本阶标准成本
|
double other = ascr.getOther().doubleValue();
|
||||||
for (int j = 0; j < appSceneCostResultValues.size(); j++) {
|
laborCost = labor*ascr.getNum().doubleValue();
|
||||||
if (j == 0) {
|
equipmentCost =equip*ascr.getNum().doubleValue();
|
||||||
//初始化当前物料成本信息
|
fuelcost = fuel*ascr.getNum().doubleValue();
|
||||||
currentMaterialCost = appSceneCostResultValues.get(0);
|
auxicost = auxi*ascr.getNum().doubleValue();
|
||||||
}
|
otherCost = other*ascr.getNum().doubleValue();
|
||||||
AppSceneCostResultValue appSceneCostResultValue = appSceneCostResultValues.get(j);
|
|
||||||
String countValue = appSceneCostResultValue.getCountValue();
|
for (AppSceneCostStandardResult child:appSceneCostStandardResults){
|
||||||
if (countValue != null) {
|
if((Integer.parseInt(child.getLowOrderCode())==depth+1)&&child.getParentMatnr().equals(ascr.getMarterialNo())){
|
||||||
currentCost = currentCost.add(new BigDecimal(countValue));
|
if(child.getManuType().equals("F")){
|
||||||
}
|
materialCost_acc+=child.getMaterialCostStage().doubleValue()*ascr.getNum().doubleValue();
|
||||||
}
|
}else if(child.getManuType().equals("E")){
|
||||||
//计算本阶各个费用类别费用以及记录本阶物料的工时和小时费率
|
materialCost_acc+=child.getMaterialCostStage().doubleValue()*ascr.getNum().doubleValue()+child.getMaterialCostAccumulated().doubleValue()*ascr.getNum().doubleValue();
|
||||||
for (String feeType : costTypeMap.keySet()) {
|
laborCost_acc+=(child.getLaborCostStage().doubleValue()+child.getLaborCostAccumulated().doubleValue())*ascr.getNum().doubleValue();
|
||||||
List<AppSceneCostResultValue> appSceneCostResultValues1 = costTypeMap.get(feeType);
|
equipmentCost_acc+=(child.getEquipCostStage().doubleValue()+child.getEquipCostAccumulated().doubleValue())*ascr.getNum().doubleValue();
|
||||||
for (int m = 0; m < appSceneCostResultValues1.size(); m++) {
|
fuelcost_acc+=(child.getBurningCostStage().doubleValue()+child.getBurningCostAccumulated().doubleValue())*ascr.getNum().doubleValue();
|
||||||
if (FeeTypeEnum.MaterialCost.getCode().equals(feeType)) {
|
auxicost_acc+=(child.getAuxiliaryCostStage().doubleValue()+child.getAuxiliaryCostAccumulated().doubleValue())*ascr.getNum().doubleValue();
|
||||||
//物料成本
|
otherCost_acc+=(child.getOtherCostStage().doubleValue()+child.getOtherCostAccumulated().doubleValue())*ascr.getNum().doubleValue();
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
String maktx = "";
|
||||||
|
if(maktxMap.containsKey(ascr.getMarterialNo())){
|
||||||
|
maktx=maktxMap.get(ascr.getMarterialNo());
|
||||||
|
}
|
||||||
|
AppSceneCostStandardResult appSceneCostStandardResult=AppSceneCostStandardResult.builder()
|
||||||
|
.materialNumber(ascr.getMarterialNo())
|
||||||
|
.parentMatnr(ascr.getParentMarterialNo())
|
||||||
|
.pricetype(ascr.getPriceType())
|
||||||
|
.materialCostStage(new BigDecimal(materialCost))
|
||||||
|
.laborCostStage(new BigDecimal(laborCost))
|
||||||
|
.equipCostStage(new BigDecimal(equipmentCost))
|
||||||
|
.burningCostStage(new BigDecimal(fuelcost))
|
||||||
|
.auxiliaryCostStage(new BigDecimal(auxicost))
|
||||||
|
.otherCostStage(new BigDecimal(otherCost))
|
||||||
|
.materialCostAccumulated(new BigDecimal(materialCost_acc))
|
||||||
|
.laborCostAccumulated(new BigDecimal(laborCost_acc))
|
||||||
|
.equipCostAccumulated(new BigDecimal(equipmentCost_acc))
|
||||||
|
.burningCostAccumulated(new BigDecimal(fuelcost_acc))
|
||||||
|
.auxiliaryCostAccumulated(new BigDecimal(auxicost_acc))
|
||||||
|
.otherCostAccumulated(new BigDecimal(otherCost_acc))
|
||||||
|
.materialCostTotal(new BigDecimal(materialCost+materialCost_acc))
|
||||||
|
.laborCostTotal(new BigDecimal(laborCost+laborCost_acc))
|
||||||
|
.equipCostTotal(new BigDecimal(equipmentCost+equipmentCost_acc))
|
||||||
|
.burningCostTotal(new BigDecimal(fuelcost+fuelcost_acc))
|
||||||
|
.auxiliaryCostTotal(new BigDecimal(auxicost+auxicost_acc))
|
||||||
|
.otherCostTotal(new BigDecimal(otherCost+otherCost_acc))
|
||||||
|
.totalStandardCost(new BigDecimal(materialCost+laborCost+equipmentCost+fuelcost+auxicost+otherCost+materialCost_acc+laborCost_acc+equipmentCost_acc+fuelcost_acc+auxicost_acc+otherCost_acc))
|
||||||
|
.lowOrderCode(String.valueOf(depth))
|
||||||
|
.relativeDosage(ascr.getNum())
|
||||||
|
.createdTime(new Date())
|
||||||
|
.menge(ascr.getNum())
|
||||||
|
.manuType(ascr.getManuType())
|
||||||
|
.versionNumber(versionNumber)
|
||||||
|
.stage(stage)
|
||||||
|
.layer(ascr.getLayer())
|
||||||
|
.factory("7100")
|
||||||
|
.maktx(maktx)
|
||||||
|
.build();
|
||||||
|
appSceneCostStandardResults.add(appSceneCostStandardResult);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
standardCostService.iAppSceneCostStandardResultService.saveBatch(appSceneCostStandardResults);
|
||||||
//3.计算出所有的单个物料的累计标准成本
|
//3.计算出所有的单个物料的累计标准成本
|
||||||
List<AppSceneCostResultValue> standardCostList = standardCostService.iAppSceneCostResultValueService.getResultValueByTopMaterialNo(topMaterialCode, taskType, String.valueOf(flowInstanceId));
|
//List<AppSceneCostResultValue> standardCostList = standardCostService.iAppSceneCostResultValueService.getResultValueByTopMaterialNo(topMaterialCode, taskType, String.valueOf(flowInstanceId));
|
||||||
//【累计成本】的计算
|
//【累计成本】的计算
|
||||||
totalCountCost(standardCostList, topMaterialCode, taskType, taskCode, String.valueOf(flowInstanceId), versionNumber);
|
//totalCountCost(standardCostList, topMaterialCode, taskType, taskCode, String.valueOf(flowInstanceId), versionNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -734,7 +983,22 @@ public class StandardCostService {
|
|||||||
// .sort()
|
// .sort()
|
||||||
// .figureNumber()
|
// .figureNumber()
|
||||||
// .dosage(oldAppSceneCostResultValue.getNum() != null ? oldAppSceneCostResultValue.getNum().doubleValue() : 0).unit(oldAppSceneCostResultValue.getUnit())
|
// .dosage(oldAppSceneCostResultValue.getNum() != null ? oldAppSceneCostResultValue.getNum().doubleValue() : 0).unit(oldAppSceneCostResultValue.getUnit())
|
||||||
.materialCostStageInter(costDetailJson.getBigDecimal(FeeTypeEnum.MaterialCost.getCode())).laborCostStage(costDetailJson.getBigDecimal(FeeTypeEnum.LaborCost.getCode())).equipCostStage(costDetailJson.getBigDecimal(FeeTypeEnum.EquipmentFee.getCode())).auxiliaryCostStage(costDetailJson.getBigDecimal(FeeTypeEnum.SupplyMaterialFee.getCode())).burningCostStage(costDetailJson.getBigDecimal(FeeTypeEnum.DriverFee.getCode())).stageLogisticsCost(costDetailJson.getBigDecimal(FeeTypeEnum.LogisticsFee.getCode())).otherCostStage(costDetailJson.getBigDecimal(FeeTypeEnum.OtherFee.getCode())).totalStandardCostInter(new BigDecimal(oldAppSceneCostResultValue.getCountValue())).materialCostAccumulated(costDetailJson.getBigDecimal(TotalCostEnum.TotalMaterialCost.getCode())).laborCostAccumulated(costDetailJson.getBigDecimal(TotalCostEnum.TotalLaborCost.getCode())).equipCostAccumulated(costDetailJson.getBigDecimal(TotalCostEnum.TotalEquipmentFee.getCode())).auxiliaryCostAccumulated(costDetailJson.getBigDecimal(TotalCostEnum.TotalSupplyMaterialFee.getCode())).burningCostAccumulated(costDetailJson.getBigDecimal(TotalCostEnum.TotalDriverFee.getCode())).totalLogisticsCost(costDetailJson.getBigDecimal(TotalCostEnum.TotalLogisticsFee.getCode())).otherCostAccumulated(costDetailJson.getBigDecimal(TotalCostEnum.TotalOtherFee.getCode())).totalStandardCost(costDetailJson.getBigDecimal(TotalCostEnum.TotalStandardCost.getCode())).createdTime(new Date()).build();
|
.materialCostTotal(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()))
|
||||||
|
.otherCostStage(costDetailJson.getBigDecimal(FeeTypeEnum.OtherFee.getCode()))
|
||||||
|
.totalStandardCost(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()))
|
||||||
|
.otherCostAccumulated(costDetailJson.getBigDecimal(TotalCostEnum.TotalOtherFee.getCode()))
|
||||||
|
.totalStandardCost(costDetailJson.getBigDecimal(TotalCostEnum.TotalStandardCost.getCode()))
|
||||||
|
.lowOrderCode(String.valueOf(oldAppSceneCostResultValue.getDepth()))
|
||||||
|
.createdTime(new Date()).build();
|
||||||
costStandardResults.add(costStandardResultValue);
|
costStandardResults.add(costStandardResultValue);
|
||||||
}
|
}
|
||||||
//更新结果集到标准成本单行查询中去
|
//更新结果集到标准成本单行查询中去
|
||||||
|
|||||||
+2
-1
@@ -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.AppSceneCostBomRelevancy;
|
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostBomRelevancy;
|
||||||
|
import com.zzsmart.qomo.kn.cost.manage.vo.BomTreeVo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -24,6 +25,6 @@ public interface IAppSceneCostBomRelevancyService extends IService<AppSceneCostB
|
|||||||
* @param topMaterialCode
|
* @param topMaterialCode
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<AppSceneCostBomRelevancy> queryAllBomInfoByTopMaterialCode(String topMaterialCode);
|
List<BomTreeVo> queryAllBomInfoByTopMaterialCode(String topMaterialCode);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -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.AppSceneCostHourRate;
|
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostHourRate;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: app_scene_cost_hour_rate
|
* @Description: app_scene_cost_hour_rate
|
||||||
* @Author: jeecg-boot
|
* @Author: jeecg-boot
|
||||||
@@ -15,5 +17,5 @@ public interface IAppSceneCostHourRateService extends IService<AppSceneCostHourR
|
|||||||
* @param appSceneCostHourRate
|
* @param appSceneCostHourRate
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
AppSceneCostHourRate getOneHourRateInfo(AppSceneCostHourRate appSceneCostHourRate);
|
Map<String,AppSceneCostHourRate> getOneHourRateInfo();
|
||||||
}
|
}
|
||||||
|
|||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
package com.zzsmart.qomo.kn.cost.manage.service;
|
||||||
|
|
||||||
|
//import com.zzsmart.qomo.modules.demo..entity.AppSceneCostMaterial;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostMaterial;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: app_scene_cost_material
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2024-09-17
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
public interface IAppSceneCostMaterialService extends IService<AppSceneCostMaterial> {
|
||||||
|
|
||||||
|
public Map<String, String> getManuTypeByMaterialNo(List<String> materialNos) ;
|
||||||
|
|
||||||
|
public Map<String, String> getMaktxByMaterialNo(List<String> materialNos) ;
|
||||||
|
}
|
||||||
+3
-2
@@ -5,6 +5,7 @@ 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 com.zzsmart.qomo.kn.cost.manage.vo.BomTreeVo;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -51,8 +52,8 @@ public class AppSceneCostBomRelevancyServiceImpl extends ServiceImpl<AppSceneCos
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<AppSceneCostBomRelevancy> queryAllBomInfoByTopMaterialCode(String topMaterialCode) {
|
public List<BomTreeVo> queryAllBomInfoByTopMaterialCode(String topMaterialCode) {
|
||||||
List<AppSceneCostBomRelevancy> childrens = costMaterialBomMapper.findChildrenByParentId(topMaterialCode);
|
List<BomTreeVo> childrens = costMaterialBomMapper.findChildrenByParentId(topMaterialCode);
|
||||||
//TODO 循环遍历查出所有的物料下的物料(包含最上层的物料)
|
//TODO 循环遍历查出所有的物料下的物料(包含最上层的物料)
|
||||||
//TODO 所有的物料并进行层级排序
|
//TODO 所有的物料并进行层级排序
|
||||||
return childrens;
|
return childrens;
|
||||||
|
|||||||
+20
-14
@@ -127,8 +127,9 @@ public class AppSceneCostCountServiceImpl extends ServiceImpl<AppSceneCostCountM
|
|||||||
@Override
|
@Override
|
||||||
public void addCostCountTask(AppSceneCostCountVO appSceneCostCount) {
|
public void addCostCountTask(AppSceneCostCountVO appSceneCostCount) {
|
||||||
//1.新增版本号记录成功后
|
//1.新增版本号记录成功后
|
||||||
appSceneCostCount.setCostVersion("Version"+String.valueOf(new Random().nextInt(100000)));
|
//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();
|
||||||
|
costStandardVersion.setCreatedtime(new Date());
|
||||||
boolean save = costStandardVersionService.save(costStandardVersion);
|
boolean save = costStandardVersionService.save(costStandardVersion);
|
||||||
//2.新增标准成本计算任务,并立即执行标准成本计算
|
//2.新增标准成本计算任务,并立即执行标准成本计算
|
||||||
if (save) {
|
if (save) {
|
||||||
@@ -146,7 +147,7 @@ public class AppSceneCostCountServiceImpl extends ServiceImpl<AppSceneCostCountM
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// 方案二:直接执行标准成本计算
|
// 方案二:直接执行标准成本计算
|
||||||
countStandardCost(appSceneCostCount, (new Random().nextInt(1000)) + (new Random().nextInt(100)));
|
countStandardCost(appSceneCostCount1, (new Random().nextInt(1000)) + (new Random().nextInt(100)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,29 +156,34 @@ public class AppSceneCostCountServiceImpl extends ServiceImpl<AppSceneCostCountM
|
|||||||
*
|
*
|
||||||
* @param appSceneCostCount1
|
* @param appSceneCostCount1
|
||||||
*/
|
*/
|
||||||
private void countStandardCost(AppSceneCostCountVO appSceneCostCount1, Integer flowInstanceId) {
|
private void countStandardCost(AppSceneCostCount appSceneCostCount1, Integer flowInstanceId) {
|
||||||
//0.获取物料下所有的子物料
|
//0.获取物料下所有的子物料
|
||||||
StandardCostService.getAllMaterialBomInfoByTopMaterialCode(appSceneCostCount1.getMaterialNo(), "MaterialInput", "MaterialInput001", flowInstanceId);
|
StandardCostService.getAllMaterialBomInfoByTopMaterialCode(appSceneCostCount1.getMaterialNo(), "MaterialInput", "MaterialInput001", flowInstanceId);
|
||||||
//1.物料成本计算
|
//1.物料成本计算
|
||||||
StandardCostService.countMaterialCostByTopMaterialCode(appSceneCostCount1.getMaterialNo(), "MaterialCost", "MaterialCost002", flowInstanceId, FeeTypeEnum.MaterialCost.getCode());
|
StandardCostService.countMaterialCostByTopMaterialCode(appSceneCostCount1.getMaterialNo(), "MaterialCost", "MaterialCost002", flowInstanceId, FeeTypeEnum.MaterialCost.getCode());
|
||||||
//2.人工成本计算
|
//2.人工成本计算
|
||||||
AppSceneCostHourRate hourRate = new AppSceneCostHourRate();
|
//AppSceneCostHourRate hourRate = new AppSceneCostHourRate();
|
||||||
hourRate.setYear(appSceneCostCount1.getYear());
|
//hourRate.setYear(appSceneCostCount1.getYear());
|
||||||
hourRate.setCostCenterCode(appSceneCostCount1.getCostCenter());
|
//hourRate.setCostCenterCode(appSceneCostCount1.getCostCenter());
|
||||||
hourRate.setFactory(appSceneCostCount1.getFactory()==null?"8100":appSceneCostCount1.getFactory());
|
//hourRate.setFactory(appSceneCostCount1.getFactory()==null?"7100":appSceneCostCount1.getFactory());
|
||||||
StandardCostService.countLaborCostByTopMaterialCode(appSceneCostCount1.getMaterialNo(), "LaborCost", "LaborCost003", flowInstanceId, FeeTypeEnum.LaborCost.getCode(), hourRate);
|
//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.制造计算(各种费用)MaterialCost("MaterialCost", "物料成本"), EquipmentFee("EquipmentFee", "设备费"), SupplyMaterialFee("SupplyMaterialFee", "辅料费"), DriverFee("DriverFee", "水电费"), OtherFee("OtherFee", "其他费用"), LogisticsFee("LogisticsFee", "物流费")
|
||||||
//3.1设备费计算
|
//3.1设备费计算
|
||||||
StandardCostService.countManufacturingCostByTopMaterialCode(appSceneCostCount1.getMaterialNo(), "ManufacturingCost", "ManufacturingCost004", flowInstanceId, FeeTypeEnum.EquipmentFee.getCode(), hourRate);
|
//.countManufacturingCostByTopMaterialCode(appSceneCostCount1.getMaterialNo(), "ManufacturingCost", "ManufacturingCost004", flowInstanceId, FeeTypeEnum.EquipmentFee.getCode(), hourRate);
|
||||||
//3.2辅料费计算
|
//3.2辅料费计算
|
||||||
StandardCostService.countManufacturingCostByTopMaterialCode(appSceneCostCount1.getMaterialNo(), "ManufacturingCost", "ManufacturingCost005", flowInstanceId, FeeTypeEnum.SupplyMaterialFee.getCode(), hourRate);
|
//StandardCostService.countManufacturingCostByTopMaterialCode(appSceneCostCount1.getMaterialNo(), "ManufacturingCost", "ManufacturingCost005", flowInstanceId, FeeTypeEnum.SupplyMaterialFee.getCode(), hourRate);
|
||||||
//3.3水电费
|
//3.3水电费
|
||||||
StandardCostService.countManufacturingCostByTopMaterialCode(appSceneCostCount1.getMaterialNo(), "ManufacturingCost", "ManufacturingCost006", flowInstanceId, FeeTypeEnum.DriverFee.getCode(), hourRate);
|
//StandardCostService.countManufacturingCostByTopMaterialCode(appSceneCostCount1.getMaterialNo(), "ManufacturingCost", "ManufacturingCost006", flowInstanceId, FeeTypeEnum.DriverFee.getCode(), hourRate);
|
||||||
//3.4其他费用
|
//3.4其他费用
|
||||||
StandardCostService.countManufacturingCostByTopMaterialCode(appSceneCostCount1.getMaterialNo(), "ManufacturingCost", "ManufacturingCost007", flowInstanceId, FeeTypeEnum.OtherFee.getCode(), hourRate);
|
//StandardCostService.countManufacturingCostByTopMaterialCode(appSceneCostCount1.getMaterialNo(), "ManufacturingCost", "ManufacturingCost007", flowInstanceId, FeeTypeEnum.OtherFee.getCode(), hourRate);
|
||||||
|
StandardCostService.countManufacturingCost(appSceneCostCount1.getMaterialNo(), "ManufacturingCost", "ManufacturingCost007", flowInstanceId);
|
||||||
//3.5物流费
|
//3.5物流费
|
||||||
StandardCostService.countManufacturingCostByTopMaterialCode(appSceneCostCount1.getMaterialNo(), "ManufacturingCost", "ManufacturingCost008", flowInstanceId, FeeTypeEnum.LogisticsFee.getCode(), hourRate);
|
//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());
|
StandardCostService.countStandardCostByTopMaterialCode(appSceneCostCount1.getMaterialNo(), "StandardCost", "StandardCost009", flowInstanceId, FeeTypeEnum.StandardCost.getCode(),appSceneCostCount1.getStage(),appSceneCostCount1.getCostVersion());
|
||||||
|
|
||||||
|
appSceneCostCount1.setStatus(2);
|
||||||
|
saveOrUpdate(appSceneCostCount1);
|
||||||
|
//upda(AppSceneCostCount.builder().id(appSceneCostCount1.getId()).status(2).build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-14
@@ -8,6 +8,11 @@ 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.jeecg.common.system.query.QueryGenerator;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.ttzero.excel.manager.docProps.App;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: app_scene_cost_hour_rate
|
* @Description: app_scene_cost_hour_rate
|
||||||
@@ -25,21 +30,15 @@ public class AppSceneCostHourRateServiceImpl extends ServiceImpl<AppSceneCostHou
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public AppSceneCostHourRate getOneHourRateInfo(AppSceneCostHourRate appSceneCostHourRate) {
|
public Map<String,AppSceneCostHourRate> getOneHourRateInfo() {
|
||||||
QueryWrapper<AppSceneCostHourRate> queryWrapper = new QueryWrapper<>();
|
//QueryWrapper<AppSceneCostHourRate> queryWrapper = new QueryWrapper<>();
|
||||||
if(appSceneCostHourRate!=null){
|
List<AppSceneCostHourRate> appSceneCostHourRateList= this.query().list();
|
||||||
if(appSceneCostHourRate.getYear()!=null){
|
Map<String, AppSceneCostHourRate> map=new HashMap<>();
|
||||||
queryWrapper.eq("year",appSceneCostHourRate.getYear());
|
for (AppSceneCostHourRate appSceneCostHourRate:appSceneCostHourRateList){
|
||||||
|
if(!map.containsKey(appSceneCostHourRate.getCostCenterCode())){
|
||||||
|
map.put(appSceneCostHourRate.getCostCenterCode(),appSceneCostHourRate);
|
||||||
}
|
}
|
||||||
if(appSceneCostHourRate.getCostCenterCode()!=null){
|
|
||||||
queryWrapper.eq("cost_center_code",appSceneCostHourRate.getCostCenterCode());
|
|
||||||
}
|
}
|
||||||
if(appSceneCostHourRate.getFactory()!=null){
|
return map;
|
||||||
queryWrapper.eq("factory",appSceneCostHourRate.getFactory());
|
|
||||||
}
|
|
||||||
queryWrapper.last("limit 1");
|
|
||||||
return this.getOne(queryWrapper);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+62
@@ -0,0 +1,62 @@
|
|||||||
|
package com.zzsmart.qomo.kn.cost.manage.service.impl;
|
||||||
|
|
||||||
|
//import com.zzsmart.qomo.modules.demo..entity.AppSceneCostMaterial;
|
||||||
|
//import com.zzsmart.qomo.modules.demo..mapper.AppSceneCostMaterialMapper;
|
||||||
|
//import com.zzsmart.qomo.modules.demo..service.IAppSceneCostMaterialService;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostMaterial;
|
||||||
|
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostPurchaseRecord;
|
||||||
|
import com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostMaterialMapper;
|
||||||
|
import com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostPurchaseRecordMapper;
|
||||||
|
import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostMaterialService;
|
||||||
|
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_material
|
||||||
|
* @Author: jeecg-boot
|
||||||
|
* @Date: 2024-09-17
|
||||||
|
* @Version: V1.0
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class AppSceneCostMaterialServiceImpl extends ServiceImpl<AppSceneCostMaterialMapper, AppSceneCostMaterial> implements IAppSceneCostMaterialService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
AppSceneCostMaterialMapper appSceneCostMaterialMapper;
|
||||||
|
@Override
|
||||||
|
public Map<String, String> getManuTypeByMaterialNo(List<String> materialNos) {
|
||||||
|
Map<String, String> map = new HashMap<>();
|
||||||
|
QueryWrapper<AppSceneCostMaterial> queryWrapper = new QueryWrapper();
|
||||||
|
if (materialNos != null && materialNos.size() > 0) {
|
||||||
|
queryWrapper.in("material_number", materialNos);
|
||||||
|
List<AppSceneCostMaterial> costPurchasePrices = appSceneCostMaterialMapper.selectList(queryWrapper);
|
||||||
|
for (int i = 0; i < costPurchasePrices.size(); i++) {
|
||||||
|
AppSceneCostMaterial costPurchasePrice = costPurchasePrices.get(i);
|
||||||
|
map.put(costPurchasePrice.getMaterialNumber(), costPurchasePrice.getManufacturingType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, String> getMaktxByMaterialNo(List<String> materialNos) {
|
||||||
|
Map<String, String> map = new HashMap<>();
|
||||||
|
QueryWrapper<AppSceneCostMaterial> queryWrapper = new QueryWrapper();
|
||||||
|
if (materialNos != null && materialNos.size() > 0) {
|
||||||
|
queryWrapper.in("material_number", materialNos);
|
||||||
|
List<AppSceneCostMaterial> costPurchasePrices = appSceneCostMaterialMapper.selectList(queryWrapper);
|
||||||
|
for (int i = 0; i < costPurchasePrices.size(); i++) {
|
||||||
|
AppSceneCostMaterial costPurchasePrice = costPurchasePrices.get(i);
|
||||||
|
map.put(costPurchasePrice.getMaterialNumber(), costPurchasePrice.getProductName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
}
|
||||||
+29
-21
@@ -3,7 +3,9 @@ package com.zzsmart.qomo.kn.cost.manage.service.impl;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
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.entity.AppSceneCostStandardResult;
|
||||||
import com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostStandardDetailMapper;
|
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.BomTreeService;
|
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.util.BomTreeBuilder;
|
||||||
import com.zzsmart.qomo.kn.cost.manage.vo.BomTreeInfoVO;
|
import com.zzsmart.qomo.kn.cost.manage.vo.BomTreeInfoVO;
|
||||||
@@ -21,6 +23,9 @@ public class BomTreeServiceImpl implements BomTreeService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
AppSceneCostStandardDetailMapper costStandardDetailMapper;
|
AppSceneCostStandardDetailMapper costStandardDetailMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
AppSceneCostStandardResultMapper appSceneCostStandardResultMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据物料号查询物料树
|
* 根据物料号查询物料树
|
||||||
*
|
*
|
||||||
@@ -29,7 +34,7 @@ public class BomTreeServiceImpl implements BomTreeService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<BomTreeInfoVO> getBomTreeByMaterialNumber(String materialNumber, String version_number) {
|
public List<BomTreeInfoVO> getBomTreeByMaterialNumber(String materialNumber, String version_number) {
|
||||||
QueryWrapper<AppSceneCostStandardDetail> wrapper = new QueryWrapper<>();
|
QueryWrapper<AppSceneCostStandardResult> wrapper = new QueryWrapper<>();
|
||||||
//设置条件
|
//设置条件
|
||||||
if (StrUtil.isNotEmpty(materialNumber)) {
|
if (StrUtil.isNotEmpty(materialNumber)) {
|
||||||
// 物料号
|
// 物料号
|
||||||
@@ -40,49 +45,52 @@ public class BomTreeServiceImpl implements BomTreeService {
|
|||||||
wrapper.like("version_number", version_number);
|
wrapper.like("version_number", version_number);
|
||||||
}
|
}
|
||||||
//查询所有满足条件的父节点
|
//查询所有满足条件的父节点
|
||||||
List<AppSceneCostStandardDetail> parentNodeList = costStandardDetailMapper.selectList(wrapper);
|
List<AppSceneCostStandardResult> parentNodeList = appSceneCostStandardResultMapper.selectList(wrapper);
|
||||||
//所有子类节点
|
//所有子类节点
|
||||||
List<AppSceneCostStandardDetail> childrenNodeList = new ArrayList<>();
|
List<AppSceneCostStandardResult> childrenNodeList = new ArrayList<>();
|
||||||
Map<String, AppSceneCostStandardDetail> parentDataMap = new TreeMap<>();
|
Map<String, AppSceneCostStandardResult> parentDataMap = new TreeMap<>();
|
||||||
if (parentNodeList.size() > 0) {
|
if (parentNodeList.size() > 0) {
|
||||||
//父类结果只有1个
|
//父类结果只有1个
|
||||||
if (parentNodeList.size() == 1) {
|
if (parentNodeList.size() == 1) {
|
||||||
parentDataMap = parentNodeList.stream().collect(Collectors.toMap(AppSceneCostStandardDetail::getMaterialNumber, vo -> vo));
|
parentDataMap = parentNodeList.stream().collect(Collectors.toMap(AppSceneCostStandardResult::getMaterialNumber, vo -> vo));
|
||||||
} else {
|
} else {
|
||||||
//父类结果有多个(找出最上级节点)
|
//父类结果有多个(找出最上级节点)
|
||||||
Map<Integer, List<AppSceneCostStandardDetail>> levelGroupMap = new HashMap<>();
|
Map<String, List<AppSceneCostStandardResult>> levelGroupMap = new HashMap<>();
|
||||||
if (parentNodeList != null && parentNodeList.size() > 0) {
|
if (parentNodeList != null && parentNodeList.size() > 0) {
|
||||||
levelGroupMap = parentNodeList.stream().filter(s->s.getLevel()!=null).collect(Collectors.groupingBy(AppSceneCostStandardDetail::getLevel));
|
levelGroupMap = parentNodeList.stream().filter(s->s.getLowOrderCode()!=null).collect(Collectors.groupingBy(AppSceneCostStandardResult::getLowOrderCode));
|
||||||
TreeMap<Integer, List<AppSceneCostStandardDetail>> levelTreeMap = new TreeMap<>(levelGroupMap);
|
TreeMap<String, List<AppSceneCostStandardResult>> levelTreeMap = new TreeMap<>(levelGroupMap);
|
||||||
parentDataMap = levelTreeMap.firstEntry().getValue().stream().filter(s->s.getMaterialNumber()!=null).collect(Collectors.toMap(AppSceneCostStandardDetail::getMaterialNumber, vo -> vo));
|
parentDataMap = levelTreeMap.firstEntry().getValue().stream().filter(s->s.getMaterialNumber()!=null).collect(Collectors.toMap(AppSceneCostStandardResult::getMaterialNumber, vo -> vo));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//查询所有父节点下的子节点(即第二层叶子节点)
|
//查询所有父节点下的子节点(即第二层叶子节点)
|
||||||
List<AppSceneCostStandardDetail> costStandardDetails = new ArrayList<>();
|
List<AppSceneCostStandardResult> costStandardDetails = new ArrayList<>();
|
||||||
if (parentDataMap.size() > 0) {
|
if (parentDataMap.size() > 0) {
|
||||||
QueryWrapper<AppSceneCostStandardDetail> wrapper1 = new QueryWrapper<>();
|
QueryWrapper<AppSceneCostStandardResult> wrapper1 = new QueryWrapper<>();
|
||||||
|
wrapper1.eq("version_number", version_number);
|
||||||
int num = 0;
|
int num = 0;
|
||||||
for (String materialNumber1 : parentDataMap.keySet()) {
|
for (String materialNumber1 : parentDataMap.keySet()) {
|
||||||
num = num + 1;
|
num = num + 1;
|
||||||
if (num > 1) {
|
if (num > 1) {
|
||||||
wrapper1.or().eq("parent_material_number", materialNumber1);
|
wrapper1.or().eq("parent_matnr", materialNumber1);
|
||||||
} else {
|
} else {
|
||||||
wrapper1.eq("parent_material_number", materialNumber1);
|
wrapper1.eq("parent_matnr", materialNumber1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
costStandardDetails = costStandardDetailMapper.selectList(wrapper1);
|
costStandardDetails = appSceneCostStandardResultMapper.selectList(wrapper1);
|
||||||
}
|
}
|
||||||
//第三层叶子节点
|
//第三层叶子节点
|
||||||
List<AppSceneCostStandardDetail> threeNodes = new ArrayList<>();
|
List<AppSceneCostStandardResult> threeNodes = new ArrayList<>();
|
||||||
if (costStandardDetails != null && costStandardDetails.size() > 0) {
|
if (costStandardDetails != null && costStandardDetails.size() > 0) {
|
||||||
List<String> materialNoList = costStandardDetails.stream().map(AppSceneCostStandardDetail::getMaterialNumber).collect(Collectors.toList());
|
List<String> materialNoList = costStandardDetails.stream().map(AppSceneCostStandardResult::getMaterialNumber).collect(Collectors.toList());
|
||||||
QueryWrapper<AppSceneCostStandardDetail> wrapper2 = new QueryWrapper<>();
|
QueryWrapper<AppSceneCostStandardResult> wrapper2 = new QueryWrapper<>();
|
||||||
wrapper2.in("parent_material_number", materialNoList);
|
wrapper2.in("parent_matnr", materialNoList);
|
||||||
threeNodes = costStandardDetailMapper.selectList(wrapper2);
|
wrapper2.eq("version_number", version_number);
|
||||||
|
wrapper2.eq("low_order_code",2);
|
||||||
|
threeNodes = appSceneCostStandardResultMapper.selectList(wrapper2);
|
||||||
}
|
}
|
||||||
//把第二层叶子节点转化为bomtreeinfoVO对象集合
|
//把第二层叶子节点转化为bomtreeinfoVO对象集合
|
||||||
for (int i = 0; i < costStandardDetails.size(); i++) {
|
for (int i = 0; i < costStandardDetails.size(); i++) {
|
||||||
AppSceneCostStandardDetail costStandardDetail = costStandardDetails.get(i);
|
AppSceneCostStandardResult costStandardDetail = costStandardDetails.get(i);
|
||||||
// AppSceneCostStandardDetail vo = new AppSceneCostStandardDetail();
|
// AppSceneCostStandardDetail vo = new AppSceneCostStandardDetail();
|
||||||
// BeanUtils.copyProperties(costStandardDetail, vo);
|
// BeanUtils.copyProperties(costStandardDetail, vo);
|
||||||
// childrenNodeList.add(vo);
|
// childrenNodeList.add(vo);
|
||||||
@@ -90,7 +98,7 @@ public class BomTreeServiceImpl implements BomTreeService {
|
|||||||
}
|
}
|
||||||
//把第三层叶子节点转化为bomtreeinfoVO对象集合
|
//把第三层叶子节点转化为bomtreeinfoVO对象集合
|
||||||
for (int i = 0; i < threeNodes.size(); i++) {
|
for (int i = 0; i < threeNodes.size(); i++) {
|
||||||
AppSceneCostStandardDetail costStandardDetail = threeNodes.get(i);
|
AppSceneCostStandardResult costStandardDetail = threeNodes.get(i);
|
||||||
// CostStandardDetailVO vo = new CostStandardDetailVO();
|
// CostStandardDetailVO vo = new CostStandardDetailVO();
|
||||||
// BeanUtils.copyProperties(costStandardDetail, vo);
|
// BeanUtils.copyProperties(costStandardDetail, vo);
|
||||||
// childrenNodeList.add(vo);
|
// childrenNodeList.add(vo);
|
||||||
|
|||||||
+51
-11
@@ -1,6 +1,7 @@
|
|||||||
package com.zzsmart.qomo.kn.cost.manage.util;
|
package com.zzsmart.qomo.kn.cost.manage.util;
|
||||||
|
|
||||||
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.entity.AppSceneCostStandardResult;
|
||||||
import com.zzsmart.qomo.kn.cost.manage.vo.BomTreeInfoVO;
|
import com.zzsmart.qomo.kn.cost.manage.vo.BomTreeInfoVO;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -10,16 +11,16 @@ import java.util.Map;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class BomTreeBuilder {
|
public class BomTreeBuilder {
|
||||||
public static List<BomTreeInfoVO> buildBomTree(List<AppSceneCostStandardDetail> sourceData, Map<String, AppSceneCostStandardDetail> parentDataMap) {
|
public static List<BomTreeInfoVO> buildBomTree(List<AppSceneCostStandardResult> sourceData, Map<String, AppSceneCostStandardResult> parentDataMap) {
|
||||||
List<BomTreeInfoVO> result = new ArrayList<>();
|
List<BomTreeInfoVO> result = new ArrayList<>();
|
||||||
if ((sourceData == null || (sourceData != null && sourceData.size() < 1)) && (parentDataMap == null || (parentDataMap != null && parentDataMap.size() < 1))) {
|
if ((sourceData == null || (sourceData != null && sourceData.size() < 1)) && (parentDataMap == null || (parentDataMap != null && parentDataMap.size() < 1))) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
//1.把BOM信息分成按照物料号分组
|
//1.把BOM信息分成按照物料号分组
|
||||||
Map<String, AppSceneCostStandardDetail> materialMap = sourceData.stream().filter(s->s.getMaterialNumber()!=null)
|
Map<String, AppSceneCostStandardResult> materialMap = sourceData.stream().filter(s->s.getMaterialNumber()!=null)
|
||||||
.collect(Collectors.toMap(
|
.collect(Collectors.toMap(
|
||||||
// Key extractor
|
// Key extractor
|
||||||
AppSceneCostStandardDetail::getMaterialNumber,
|
AppSceneCostStandardResult::getMaterialNumber,
|
||||||
// Value mapper
|
// Value mapper
|
||||||
detail -> detail,
|
detail -> detail,
|
||||||
// Merger function to handle duplicates
|
// Merger function to handle duplicates
|
||||||
@@ -29,10 +30,10 @@ public class BomTreeBuilder {
|
|||||||
// Map<String, AppSceneCostStandardDetail> materialMap = sourceData.stream().filter(s -> s.getMaterialNumber() != null).collect(Collectors.toMap(AppSceneCostStandardDetail::getMaterialNumber, vo -> vo));
|
// Map<String, AppSceneCostStandardDetail> materialMap = sourceData.stream().filter(s -> s.getMaterialNumber() != null).collect(Collectors.toMap(AppSceneCostStandardDetail::getMaterialNumber, vo -> vo));
|
||||||
//查找最顶端的父类节点
|
//查找最顶端的父类节点
|
||||||
if (parentDataMap == null || (parentDataMap != null && parentDataMap.size() < 1)) {
|
if (parentDataMap == null || (parentDataMap != null && parentDataMap.size() < 1)) {
|
||||||
parentDataMap = sourceData.stream().filter(s -> s.getParentMaterialNumber() == null).collect(Collectors.toMap(AppSceneCostStandardDetail::getMaterialNumber, vo -> vo));
|
parentDataMap = sourceData.stream().filter(s -> s.getLayer().equals("0")).collect(Collectors.toMap(AppSceneCostStandardResult::getMaterialNumber, vo -> vo));
|
||||||
}
|
}
|
||||||
//查找有父节点的子节点
|
//查找有父节点的子节点
|
||||||
Map<String, List<AppSceneCostStandardDetail>> childDataMap = sourceData.stream().filter(s -> s.getParentMaterialNumber() != null).collect(Collectors.groupingBy(AppSceneCostStandardDetail::getParentMaterialNumber));
|
Map<String, List<AppSceneCostStandardResult>> childDataMap = sourceData.stream().filter(s -> s.getParentMatnr() != null).collect(Collectors.groupingBy(AppSceneCostStandardResult::getParentMatnr));
|
||||||
//查找有父节点的子节点
|
//查找有父节点的子节点
|
||||||
// //1.把BOM信息分成按照层级分组
|
// //1.把BOM信息分成按照层级分组
|
||||||
// Map<Integer, List<AppSceneCostStandardDetail>> levelMap = sourceData.stream().filter(s -> s.getLevel() != null).collect(Collectors.groupingBy(CostStandardDetail::getLevel));
|
// Map<Integer, List<AppSceneCostStandardDetail>> levelMap = sourceData.stream().filter(s -> s.getLevel() != null).collect(Collectors.groupingBy(CostStandardDetail::getLevel));
|
||||||
@@ -45,7 +46,7 @@ public class BomTreeBuilder {
|
|||||||
// TreeMap<Integer, List<AppSceneCostStandardDetail>> levelTreeMap = new TreeMap<>(levelMap);
|
// TreeMap<Integer, List<AppSceneCostStandardDetail>> levelTreeMap = new TreeMap<>(levelMap);
|
||||||
//3.构建BOM树
|
//3.构建BOM树
|
||||||
if (parentDataMap.size() > 0) {
|
if (parentDataMap.size() > 0) {
|
||||||
for (AppSceneCostStandardDetail parent : parentDataMap.values()) {
|
for (AppSceneCostStandardResult parent : parentDataMap.values()) {
|
||||||
BomTreeInfoVO parentBomTreeInfoVO = costStandardDetailChangeToBomTreeInfoVO(parent);
|
BomTreeInfoVO parentBomTreeInfoVO = costStandardDetailChangeToBomTreeInfoVO(parent);
|
||||||
parentBomTreeInfoVO = loopFindChildrenBuild(parentBomTreeInfoVO, materialMap, childDataMap, result);
|
parentBomTreeInfoVO = loopFindChildrenBuild(parentBomTreeInfoVO, materialMap, childDataMap, result);
|
||||||
if (parentBomTreeInfoVO != null) {
|
if (parentBomTreeInfoVO != null) {
|
||||||
@@ -59,23 +60,31 @@ public class BomTreeBuilder {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static BomTreeInfoVO loopFindChildrenBuild(BomTreeInfoVO parentBomTreeInfoVO, Map<String, AppSceneCostStandardDetail> materialMap, Map<String, List<AppSceneCostStandardDetail>> childDataMap, List<BomTreeInfoVO> result) {
|
private static BomTreeInfoVO loopFindChildrenBuild(BomTreeInfoVO parentBomTreeInfoVO, Map<String, AppSceneCostStandardResult> materialMap, Map<String, List<AppSceneCostStandardResult>> childDataMap, List<BomTreeInfoVO> result) {
|
||||||
if (parentBomTreeInfoVO != null) {
|
if (parentBomTreeInfoVO != null) {
|
||||||
//4.根据物料号查找子节点
|
//4.根据物料号查找子节点
|
||||||
List<AppSceneCostStandardDetail> childs = childDataMap.get(parentBomTreeInfoVO.getMaterialNumber());
|
List<AppSceneCostStandardResult> childs = childDataMap.get(parentBomTreeInfoVO.getMaterialNumber());
|
||||||
if (childs != null && childs.size() > 0) {
|
if (childs != null && childs.size() > 0) {
|
||||||
parentBomTreeInfoVO.setHasChildren(true);
|
parentBomTreeInfoVO.setHasChildren(true);
|
||||||
} else {
|
} else {
|
||||||
parentBomTreeInfoVO.setHasChildren(false);
|
parentBomTreeInfoVO.setHasChildren(false);
|
||||||
|
return parentBomTreeInfoVO;
|
||||||
}
|
}
|
||||||
//构造父节点下的bomtree结构数据
|
//构造父节点下的bomtree结构数据
|
||||||
List<BomTreeInfoVO> children = new ArrayList<>();
|
List<BomTreeInfoVO> children = new ArrayList<>();
|
||||||
for (int j = 0; childs != null && childs.size() > 0 && j < childs.size(); j++) {
|
for (int j = 0; childs != null && childs.size() > 0 && j < childs.size(); j++) {
|
||||||
AppSceneCostStandardDetail child = childs.get(j);
|
AppSceneCostStandardResult child = childs.get(j);
|
||||||
|
if(child.getParentMatnr().equals(child.getMaterialNumber())){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
BomTreeInfoVO childBomTreeInfoVO = costStandardDetailChangeToBomTreeInfoVO(child);
|
BomTreeInfoVO childBomTreeInfoVO = costStandardDetailChangeToBomTreeInfoVO(child);
|
||||||
childBomTreeInfoVO = loopFindChildrenBuild(childBomTreeInfoVO, materialMap, childDataMap, result);
|
childBomTreeInfoVO = loopFindChildrenBuild(childBomTreeInfoVO, materialMap, childDataMap, result);
|
||||||
children.add(childBomTreeInfoVO);
|
children.add(childBomTreeInfoVO);
|
||||||
}
|
}
|
||||||
|
if(parentBomTreeInfoVO.getLevel()==0){
|
||||||
|
int x=0;
|
||||||
|
x++;
|
||||||
|
}
|
||||||
//对象的子节点进行排序(升序)
|
//对象的子节点进行排序(升序)
|
||||||
children = children.stream().sorted(Comparator.comparing(BomTreeInfoVO::getSort, Comparator.nullsLast(Comparator.naturalOrder()))).collect(Collectors.toList());
|
children = children.stream().sorted(Comparator.comparing(BomTreeInfoVO::getSort, Comparator.nullsLast(Comparator.naturalOrder()))).collect(Collectors.toList());
|
||||||
parentBomTreeInfoVO.setChildren(children);
|
parentBomTreeInfoVO.setChildren(children);
|
||||||
@@ -89,8 +98,39 @@ public class BomTreeBuilder {
|
|||||||
* @param parent
|
* @param parent
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
static BomTreeInfoVO costStandardDetailChangeToBomTreeInfoVO(AppSceneCostStandardDetail parent) {
|
static BomTreeInfoVO costStandardDetailChangeToBomTreeInfoVO(AppSceneCostStandardResult parent) {
|
||||||
BomTreeInfoVO bomTreeInfoVO = BomTreeInfoVO.builder().materialNumber(parent.getMaterialNumber()).materialName(parent.getMaterialName()).level(parent.getLevel()).parentMaterialNumber(parent.getParentMaterialNumber()).quantity(parent.getDosage()).unit(parent.getUnit()).auxiliaryCost(parent.getSupplyMaterialCost()).equipCost(parent.getEquipmentCost()).otherCost(parent.getOtherCost()).laborCost(parent.getLaborCost()).accumulatedEquipCost(parent.getTotalEquipmentCost()).accumulatedOtherCost(parent.getTotalOtherCost()).accumulatedLaborCost(parent.getTotalLaborCost()).accumulatedMaterialCost(parent.getTotalMaterialCost()).accumulatedFuelCost(parent.getTotalDriveCost()).sort(parent.getSort()).build();
|
if(parent.getMenge()==null){
|
||||||
|
int x=0;
|
||||||
|
x++;
|
||||||
|
}
|
||||||
|
String layer = parent.getLayer();
|
||||||
|
int index = layer.lastIndexOf("-");
|
||||||
|
if(index!=-1){
|
||||||
|
layer = layer.substring(index+1,layer.length());
|
||||||
|
}
|
||||||
|
//layer = layer.substring(index+1,layer.length());
|
||||||
|
BomTreeInfoVO bomTreeInfoVO = BomTreeInfoVO.builder()
|
||||||
|
.materialNumber(parent.getMaterialNumber())
|
||||||
|
.materialName(parent.getMaktx())
|
||||||
|
.level(Integer.parseInt(parent.getLowOrderCode()))
|
||||||
|
.parentMaterialNumber(parent.getParentMatnr())
|
||||||
|
.quantity(parent.getMenge().doubleValue())
|
||||||
|
.materialCost(parent.getMaterialCostStage())
|
||||||
|
.auxiliaryCost(parent.getAuxiliaryCostStage())
|
||||||
|
.equipCost(parent.getEquipCostStage())
|
||||||
|
.otherCost(parent.getOtherCostStage())
|
||||||
|
.laborCost(parent.getLaborCostStage())
|
||||||
|
.fuelCost(parent.getBurningCostStage())
|
||||||
|
.accumulatedEquipCost(parent.getEquipCostAccumulated())
|
||||||
|
.accumulatedOtherCost(parent.getOtherCostAccumulated())
|
||||||
|
.accumulatedLaborCost(parent.getLaborCostAccumulated())
|
||||||
|
.accumulatedMaterialCost(parent.getMaterialCostAccumulated())
|
||||||
|
.accumulatedFuelCost(parent.getBurningCostAccumulated())
|
||||||
|
.accumulatedAuxiliaryCost(parent.getAuxiliaryCostAccumulated())
|
||||||
|
.standardCost(parent.getTotalStandardCost())
|
||||||
|
.layer(parent.getLayer())
|
||||||
|
.sort(Integer.parseInt(layer))
|
||||||
|
.build();
|
||||||
return bomTreeInfoVO;
|
return bomTreeInfoVO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
@@ -6,6 +6,8 @@ import lombok.Builder;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Builder
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@@ -63,4 +65,8 @@ public class AppSceneCostCountVO {
|
|||||||
* 工厂
|
* 工厂
|
||||||
*/
|
*/
|
||||||
public String factory;
|
public String factory;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
public Date createTime;
|
||||||
}
|
}
|
||||||
|
|||||||
+5
@@ -142,4 +142,9 @@ public class BomTreeInfoVO {
|
|||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "是否有叶子节点")
|
@ApiModelProperty(value = "是否有叶子节点")
|
||||||
private boolean hasChildren;
|
private boolean hasChildren;
|
||||||
|
/**
|
||||||
|
* 是否有叶子节点
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "层级")
|
||||||
|
private String layer;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.zzsmart.qomo.kn.cost.manage.vo;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class BomTreeVo {
|
||||||
|
public String matnr;
|
||||||
|
/**
|
||||||
|
* 成本中心
|
||||||
|
*/
|
||||||
|
public String idnrk;
|
||||||
|
/**
|
||||||
|
* 领用数量
|
||||||
|
*/
|
||||||
|
public BigDecimal menge;
|
||||||
|
/**
|
||||||
|
* 父物料领用数量
|
||||||
|
*/
|
||||||
|
public BigDecimal pmenge;
|
||||||
|
/**
|
||||||
|
* 父物料领用数量
|
||||||
|
*/
|
||||||
|
public BigDecimal topmenge;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
public int depth;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user