合并 #14
@@ -282,9 +282,8 @@ jeecg:
|
||||
#webapp文件路径
|
||||
webapp: /opt/webapp
|
||||
shiro:
|
||||
# excludeUrls: /api/**,/api/internalService/**,/test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**,/api/getUserInfo,/sys/sysDepart/**,/taskSocket/**,/flowSocket/**,/dataCheck/**
|
||||
# excludeUrls: /api/internalService/**,/test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**,/api/getUserInfo,/sys/sysDepart/**,/taskSocket/**,/flowSocket/**,/dataCheck/**
|
||||
excludeUrls: /**/**,/**/**/**
|
||||
excludeUrls: /api/internalService/**,/test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**,/api/getUserInfo,/sys/sysDepart/**,/taskSocket/**,/flowSocket/**,/dataCheck/**
|
||||
# excludeUrls: /**/**,/**/**/**
|
||||
|
||||
#阿里云oss存储和大鱼短信秘钥配置
|
||||
oss:
|
||||
|
||||
+7
-8
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostCount;
|
||||
import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostCountService;
|
||||
import com.zzsmart.qomo.kn.cost.manage.vo.MissingComponentVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -20,6 +21,7 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: app_scene_cost_count
|
||||
@@ -47,10 +49,7 @@ public class AppSceneCostCountController extends JeecgController<AppSceneCostCou
|
||||
//@AutoLog(value = "app_scene_cost_count-分页列表查询")
|
||||
@ApiOperation(value = "标准成本计算-分页列表查询", notes = "标准成本计算-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<AppSceneCostCount>> queryPageList(AppSceneCostCount appSceneCostCount,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
public Result<IPage<AppSceneCostCount>> 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());
|
||||
Page<AppSceneCostCount> page = new Page<AppSceneCostCount>(pageNo, pageSize);
|
||||
IPage<AppSceneCostCount> pageList = appSceneCostCountService.page(page, queryWrapper);
|
||||
@@ -129,12 +128,12 @@ public class AppSceneCostCountController extends JeecgController<AppSceneCostCou
|
||||
//@AutoLog(value = "app_scene_cost_count-通过id查询")
|
||||
@ApiOperation(value = "标准成本计算-查看关键缺失部件", notes = "标准成本计算-查看关键缺失部件")
|
||||
@GetMapping(value = "/queryMissingComponentById")
|
||||
public Result<AppSceneCostCount> queryMissingComponentById(@RequestParam(name = "id", required = true) String id) {
|
||||
AppSceneCostCount appSceneCostCount = appSceneCostCountService.queryMissingComponentById(id);
|
||||
if (appSceneCostCount == null) {
|
||||
public Result<List<MissingComponentVO>> queryMissingComponentById(@RequestParam(name = "id", required = true) String id) {
|
||||
List<MissingComponentVO> result = appSceneCostCountService.queryMissingComponentById(id);
|
||||
if (result == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(appSceneCostCount);
|
||||
return Result.OK(result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -63,8 +63,8 @@ public class AppSceneCostCount implements Serializable {
|
||||
@ApiModelProperty(value = "状态")
|
||||
private Integer status;
|
||||
/**模型版本*/
|
||||
@Excel(name = "模型版本", width = 15)
|
||||
@ApiModelProperty(value = "模型版本")
|
||||
@Excel(name = "标准成本版本", width = 15)
|
||||
@ApiModelProperty(value = "标准成本版本")
|
||||
private String costVersion;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
|
||||
+6
@@ -115,4 +115,10 @@ public class AppSceneCostResultValue implements Serializable {
|
||||
@Excel(name = "成本类别", width = 15)
|
||||
@ApiModelProperty(value = "成本类别")
|
||||
private String costType;
|
||||
/**
|
||||
* 成本明细
|
||||
*/
|
||||
@Excel(name = "成本明细", width = 15)
|
||||
@ApiModelProperty(value = "成本明细")
|
||||
private String costDetail;
|
||||
}
|
||||
|
||||
+2
@@ -8,6 +8,7 @@ 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.Builder;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
@@ -25,6 +26,7 @@ import lombok.experimental.Accessors;
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@TableName("app_scene_cost_part_missing_info")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
|
||||
+12
-14
@@ -9,24 +9,22 @@ package com.zzsmart.qomo.kn.cost.manage.enums;
|
||||
*/
|
||||
public enum FeeTypeEnum {
|
||||
|
||||
LaborCost("LaborCost", "人工成本"),
|
||||
MaterialCost("MaterialCost", "物料成本"),
|
||||
EquipmentFee("EquipmentFee", "设备费"), SupplyMaterialFee("SupplyMaterialFee", "辅料费"), DriverFee("DriverFee", "水电费"), OtherFee("OtherFee", "其他费用"), LogisticsFee("LogisticsFee", "物流费");
|
||||
LaborCost("LaborCost", "人工成本"), MaterialCost("MaterialCost", "物料成本"), EquipmentFee("EquipmentFee", "设备费"), SupplyMaterialFee("SupplyMaterialFee", "辅料费"), DriverFee("DriverFee", "水电费"), OtherFee("OtherFee", "其他费用"), LogisticsFee("LogisticsFee", "物流费"), StandardCost("StandardCost", "标准成本");
|
||||
|
||||
private final String code;
|
||||
private final String text;
|
||||
private final String name;
|
||||
|
||||
FeeTypeEnum(String code, String text) {
|
||||
FeeTypeEnum(String code, String name) {
|
||||
this.code = code;
|
||||
this.text = text;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -38,7 +36,7 @@ public enum FeeTypeEnum {
|
||||
public static String getTextByCode(String codeNo) {
|
||||
for (FeeTypeEnum value : FeeTypeEnum.values()) {
|
||||
if (value.getCode().equals(codeNo)) {
|
||||
return value.getText();
|
||||
return value.name();
|
||||
}
|
||||
}
|
||||
return codeNo.toString();
|
||||
@@ -47,15 +45,15 @@ public enum FeeTypeEnum {
|
||||
/**
|
||||
* 根据text获取code
|
||||
*
|
||||
* @param textStr
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static String getCodeByText(String textStr) {
|
||||
public static String getCodeByName(String name) {
|
||||
for (FeeTypeEnum value : FeeTypeEnum.values()) {
|
||||
if (value.getText().equals(textStr)) {
|
||||
return value.getText();
|
||||
if (value.name().equals(name)) {
|
||||
return value.name();
|
||||
}
|
||||
}
|
||||
return textStr;
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
+65
-6
@@ -220,7 +220,7 @@ public class StandardCostService {
|
||||
//单价乘以数量
|
||||
BigDecimal totalCost = price.multiply(number);
|
||||
//2.2计算出人工成本并存储到成本结果数据表中
|
||||
AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(marterialNo).parentMarterialNo(appSceneCostResultValue.getParentMarterialNo()).taskType(taskType).taskCode(taskCode).flowInstanceId(flowInstanceId).countValue(totalCost + "").build();
|
||||
AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(marterialNo).parentMarterialNo(appSceneCostResultValue.getParentMarterialNo()).taskType(taskType).costType(feeType).taskCode(taskCode).flowInstanceId(flowInstanceId).countValue(totalCost + "").build();
|
||||
standardCostService.iAppSceneCostResultValueService.save(resultValue);
|
||||
}
|
||||
}
|
||||
@@ -459,23 +459,74 @@ public class StandardCostService {
|
||||
String taskCode = flowTaskInfoVO.getTaskCode();
|
||||
//获取流程id
|
||||
String flowInstanceId = flowTaskInfoVO.getFlowInstanceId();
|
||||
//1.查询出物料编号对应的下所有的BOM信息
|
||||
List<AppSceneCostResultValue> list = standardCostService.iAppSceneCostResultValueService.getResultValueByTopMaterialNo(topMaterialCode, null, flowInstanceId);
|
||||
String costType = FeeTypeEnum.StandardCost.getCode();
|
||||
//1.查询出根物料编号对应的下所有的BOM信息结果值
|
||||
List<AppSceneCostResultValue> list = standardCostService.iAppSceneCostResultValueService.getAllResultValueByTopMaterialNo(topMaterialCode, flowInstanceId);
|
||||
//2.计算出所有的单个物料的本阶的标准成本(标准成本=物料成本+人工成本+制造费用)
|
||||
//按照物料编号进行分组
|
||||
Map<String, List<AppSceneCostResultValue>> materialNoMap = list.stream().collect(Collectors.groupingBy(AppSceneCostResultValue::getMarterialNo));
|
||||
for (String key : materialNoMap.keySet()) {
|
||||
List<AppSceneCostResultValue> appSceneCostResultValues = materialNoMap.get(key);
|
||||
//本阶成本
|
||||
//按照费用类别进行分组
|
||||
Map<String, List<AppSceneCostResultValue>> costTypeMap = appSceneCostResultValues.stream().filter(s -> s.getCostType() != null).collect(Collectors.groupingBy(AppSceneCostResultValue::getCostType));
|
||||
//本阶标准成本
|
||||
BigDecimal currentCost = new BigDecimal("0.0");
|
||||
//1.本阶物料成本
|
||||
BigDecimal materialCost = new BigDecimal("0.0");
|
||||
//2.本阶人工成本
|
||||
BigDecimal laborCost = new BigDecimal("0.0");
|
||||
//3.本阶制造费(设备费)
|
||||
BigDecimal equipmentCost = new BigDecimal("0.0");
|
||||
//4.本阶制造费(辅料费用)
|
||||
BigDecimal supplyMaterialCost = new BigDecimal("0.0");
|
||||
//5.本阶制造费(水电费、燃动费)
|
||||
BigDecimal driveCost = new BigDecimal("0.0");
|
||||
//6.本阶制造费(其他制造费用)
|
||||
BigDecimal otherCost = new BigDecimal("0.0");
|
||||
//7.本阶制造费(物流费)
|
||||
BigDecimal logisticsCost = new BigDecimal("0.0");
|
||||
AppSceneCostResultValue currentMaterialCost = null;
|
||||
//遍历所有费用类别计算本阶标准成本
|
||||
for (int j = 0; j < appSceneCostResultValues.size(); j++) {
|
||||
if (j == 0) {
|
||||
currentMaterialCost = appSceneCostResultValues.get(0);
|
||||
}
|
||||
AppSceneCostResultValue appSceneCostResultValue = appSceneCostResultValues.get(j);
|
||||
String countValue = appSceneCostResultValue.getCountValue();
|
||||
if (countValue != null) {
|
||||
currentCost = currentCost.add(new BigDecimal(countValue));
|
||||
}
|
||||
}
|
||||
AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(key).parentMarterialNo(appSceneCostResultValues.get(0).getParentMarterialNo()).taskType(taskType).taskCode(taskCode).flowInstanceId(flowInstanceId).countValue(currentCost.toString()).build();
|
||||
//计算本阶各个费用类别费用
|
||||
for (String feeType : costTypeMap.keySet()) {
|
||||
List<AppSceneCostResultValue> appSceneCostResultValues1 = costTypeMap.get(feeType);
|
||||
for (int m = 0; m < appSceneCostResultValues1.size(); m++) {
|
||||
if (FeeTypeEnum.MaterialCost.getCode().equals(feeType)) {
|
||||
materialCost = materialCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
|
||||
} else if (FeeTypeEnum.LaborCost.getCode().equals(feeType)) {
|
||||
laborCost = laborCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
|
||||
} else if (FeeTypeEnum.EquipmentFee.getCode().equals(feeType)) {
|
||||
equipmentCost = equipmentCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
|
||||
} else if (FeeTypeEnum.SupplyMaterialFee.getCode().equals(feeType)) {
|
||||
supplyMaterialCost = supplyMaterialCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
|
||||
} else if (FeeTypeEnum.DriverFee.getCode().equals(feeType)) {
|
||||
driveCost = driveCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
|
||||
} 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()));
|
||||
}
|
||||
}
|
||||
}
|
||||
JSONObject costTypeDetail = new JSONObject();
|
||||
costTypeDetail.put(FeeTypeEnum.MaterialCost.getCode(), materialCost.toString());
|
||||
costTypeDetail.put(FeeTypeEnum.LaborCost.getCode(), laborCost.toString());
|
||||
costTypeDetail.put(FeeTypeEnum.EquipmentFee.getCode(), equipmentCost.toString());
|
||||
costTypeDetail.put(FeeTypeEnum.SupplyMaterialFee.getCode(), supplyMaterialCost.toString());
|
||||
costTypeDetail.put(FeeTypeEnum.DriverFee.getCode(), driveCost.toString());
|
||||
costTypeDetail.put(FeeTypeEnum.LogisticsFee.getCode(), logisticsCost.toString());
|
||||
costTypeDetail.put(FeeTypeEnum.OtherFee.getCode(), otherCost.toString());
|
||||
AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(key).parentMarterialNo(currentMaterialCost.getParentMarterialNo()).taskType(taskType).taskCode(taskCode).flowInstanceId(flowInstanceId).countValue(currentCost.toString()).costDetail(JSON.toJSONString(costTypeDetail)).costType(costType).build();
|
||||
standardCostService.iAppSceneCostResultValueService.save(resultValue);
|
||||
}
|
||||
//3.计算出所有的单个物料的累计标准成本
|
||||
@@ -494,10 +545,13 @@ public class StandardCostService {
|
||||
* @param flowInstanceId
|
||||
*/
|
||||
private static void totalCountCost(List<AppSceneCostResultValue> standardCostList, String topMaterialCode, String taskType, String taskCode, String flowInstanceId) {
|
||||
//父类对应的子节点(除了最上层节点)
|
||||
Map<String, List<AppSceneCostResultValue>> parentMaterialNoMap = standardCostList.stream().filter(appSceneCostResultValue -> appSceneCostResultValue.getParentMarterialNo() != null).collect(Collectors.groupingBy(AppSceneCostResultValue::getParentMarterialNo));
|
||||
for (int i = 0; i < standardCostList.size(); i++) {
|
||||
//当前节点及其对应的本阶成本
|
||||
AppSceneCostResultValue oldAppSceneCostResultValue = standardCostList.get(i);
|
||||
BigDecimal totalCost = new BigDecimal(oldAppSceneCostResultValue.getCountValue());
|
||||
//循环计算出当前节点的累计成本
|
||||
totalCost = loopCount(oldAppSceneCostResultValue, parentMaterialNoMap, topMaterialCode, taskType, taskCode, flowInstanceId, totalCost);
|
||||
oldAppSceneCostResultValue.setTotalValue(totalCost.toString());
|
||||
standardCostService.iAppSceneCostResultValueService.updateById(oldAppSceneCostResultValue);
|
||||
@@ -519,6 +573,7 @@ public class StandardCostService {
|
||||
private static BigDecimal loopCount(AppSceneCostResultValue appSceneCostResultValue, Map<String, List<AppSceneCostResultValue>> parentMaterialNoMap, String topMaterialCode, String taskType, String taskCode, String flowInstanceId, BigDecimal totalCost) {
|
||||
String marterialNo = appSceneCostResultValue.getMarterialNo();
|
||||
if (parentMaterialNoMap.containsKey(marterialNo)) {
|
||||
//获取当前节点的子节点并遍历
|
||||
List<AppSceneCostResultValue> appSceneCostResultValues = parentMaterialNoMap.get(marterialNo);
|
||||
for (int j = 0; j < appSceneCostResultValues.size(); j++) {
|
||||
AppSceneCostResultValue appSceneCostResultValue1 = appSceneCostResultValues.get(j);
|
||||
@@ -526,7 +581,11 @@ public class StandardCostService {
|
||||
if (countValue != null) {
|
||||
totalCost = totalCost.add(new BigDecimal(countValue));
|
||||
}
|
||||
loopCount(appSceneCostResultValue1, parentMaterialNoMap, topMaterialCode, taskType, taskCode, flowInstanceId, totalCost);
|
||||
//判断当前子节点是否还有子节点
|
||||
if (parentMaterialNoMap.containsKey(appSceneCostResultValue1.getMarterialNo())) {
|
||||
//如果还有子节点则继续递归
|
||||
loopCount(appSceneCostResultValue1, parentMaterialNoMap, topMaterialCode, taskType, taskCode, flowInstanceId, totalCost);
|
||||
}
|
||||
}
|
||||
}
|
||||
return totalCost;
|
||||
|
||||
+4
-1
@@ -2,6 +2,9 @@ package com.zzsmart.qomo.kn.cost.manage.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostCount;
|
||||
import com.zzsmart.qomo.kn.cost.manage.vo.MissingComponentVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: app_scene_cost_count
|
||||
@@ -15,7 +18,7 @@ public interface IAppSceneCostCountService extends IService<AppSceneCostCount> {
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
AppSceneCostCount queryMissingComponentById(String id);
|
||||
List<MissingComponentVO> queryMissingComponentById(String id);
|
||||
|
||||
/**
|
||||
* 重新计算
|
||||
|
||||
+12
-2
@@ -8,14 +8,24 @@ import java.util.List;
|
||||
/**
|
||||
* @Description: app_scene_cost_result_value
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-07-22
|
||||
* @Date: 2024-07-22
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IAppSceneCostResultValueService extends IService<AppSceneCostResultValue> {
|
||||
/**
|
||||
* 根据顶级物料编码查询满足条件的结果值
|
||||
*
|
||||
* @param topMaterialCode
|
||||
* @return
|
||||
*/
|
||||
List<AppSceneCostResultValue> getResultValueByTopMaterialNo(String topMaterialCode,String taskType,String flowInstanceId);
|
||||
List<AppSceneCostResultValue> getResultValueByTopMaterialNo(String topMaterialCode, String taskType, String flowInstanceId);
|
||||
|
||||
/**
|
||||
* 查询根物料的某次成本计算流程下的所有结果值
|
||||
*
|
||||
* @param topMaterialCode
|
||||
* @param flowInstanceId
|
||||
* @return
|
||||
*/
|
||||
List<AppSceneCostResultValue> getAllResultValueByTopMaterialNo(String topMaterialCode, String flowInstanceId);
|
||||
}
|
||||
|
||||
+32
-3
@@ -1,16 +1,22 @@
|
||||
package com.zzsmart.qomo.kn.cost.manage.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostCount;
|
||||
import com.zzsmart.qomo.kn.cost.manage.entity.CostPartMissingInfo;
|
||||
import com.zzsmart.qomo.kn.cost.manage.entity.CostStandardVersion;
|
||||
import com.zzsmart.qomo.kn.cost.manage.mapper.AppSceneCostCountMapper;
|
||||
import com.zzsmart.qomo.kn.cost.manage.mapper.CostPartMissingInfoMapper;
|
||||
import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostCountService;
|
||||
import com.zzsmart.qomo.kn.cost.manage.service.ICostStandardVersionService;
|
||||
import com.zzsmart.qomo.kn.cost.manage.vo.MissingComponentVO;
|
||||
import com.zzsmart.qomo.service.IDataFlowInstanceService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: app_scene_cost_count
|
||||
@@ -24,6 +30,8 @@ public class AppSceneCostCountServiceImpl extends ServiceImpl<AppSceneCostCountM
|
||||
private ICostStandardVersionService costStandardVersionService;
|
||||
@Autowired
|
||||
private IDataFlowInstanceService flowInstanceService;
|
||||
@Autowired
|
||||
private CostPartMissingInfoMapper costPartMissingInfoMapper;
|
||||
|
||||
/**
|
||||
* 查看关键缺失部件
|
||||
@@ -32,8 +40,26 @@ public class AppSceneCostCountServiceImpl extends ServiceImpl<AppSceneCostCountM
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AppSceneCostCount queryMissingComponentById(String id) {
|
||||
return null;
|
||||
public List<MissingComponentVO> queryMissingComponentById(String id) {
|
||||
List<MissingComponentVO> list = new ArrayList<>();
|
||||
if (id != null) {
|
||||
QueryWrapper<CostPartMissingInfo> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("costStandardId", id);
|
||||
List<CostPartMissingInfo> costPartMissingInfos = costPartMissingInfoMapper.selectList(queryWrapper);
|
||||
if (costPartMissingInfos != null && costPartMissingInfos.size() > 0) {
|
||||
for (int i = 0; i < costPartMissingInfos.size(); i++) {
|
||||
CostPartMissingInfo costPartMissingInfo = costPartMissingInfos.get(i);
|
||||
if (costPartMissingInfo.getMissingInfo() != null) {
|
||||
String[] split = costPartMissingInfo.getMissingInfo().split(";");
|
||||
for (int j = 0; j < split.length; j++) {
|
||||
MissingComponentVO temp = MissingComponentVO.builder().materialNumber(costPartMissingInfo.getMaterialNumber()).missingInfo(split[j]).versionNumber(costPartMissingInfo.getVersionNumber()).build();
|
||||
list.add(temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,11 +103,14 @@ public class AppSceneCostCountServiceImpl extends ServiceImpl<AppSceneCostCountM
|
||||
boolean save = costStandardVersionService.save(costStandardVersion);
|
||||
//2.新增标准成本计算任务,并立即执行标准成本计算
|
||||
if (save) {
|
||||
AppSceneCostCount appSceneCostCount1 = AppSceneCostCount.builder().materialNo(appSceneCostCount.getMaterialNo()).drawingNo(appSceneCostCount.getDrawingNo()).stage(appSceneCostCount.getStage()).flowDefinitionId(appSceneCostCount.getFlowDefinitionId()).year(appSceneCostCount.getYear()).costVersion(appSceneCostCount.getCostVersion()).status(0).createTime(new Date()).build();
|
||||
AppSceneCostCount appSceneCostCount1 = AppSceneCostCount.builder().materialNo(appSceneCostCount.getMaterialNo()).drawingNo(appSceneCostCount.getDrawingNo()).stage(appSceneCostCount.getStage()).flowDefinitionId(appSceneCostCount.getFlowDefinitionId()).year(appSceneCostCount.getYear()).costVersion(costStandardVersion.getVersionNumber()).status(0).createTime(new Date()).build();
|
||||
boolean flag = save(appSceneCostCount1);
|
||||
if (flag) {
|
||||
//执行标准成本计算
|
||||
executeStandardCost(appSceneCostCount1.getId(), appSceneCostCount1.getFlowDefinitionId());
|
||||
//TODO 新增部件缺失信息记录
|
||||
CostPartMissingInfo costPartMissingInfo = CostPartMissingInfo.builder().costStandardId(appSceneCostCount1.getId().toString()).materialNumber(appSceneCostCount1.getMaterialNo()).versionNumber(appSceneCostCount1.getCostVersion()).missingInfo("电源线;绝缘层涂料").build();
|
||||
costPartMissingInfoMapper.insert(costPartMissingInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+22
-1
@@ -37,9 +37,30 @@ public class AppSceneCostResultValueServiceImpl extends ServiceImpl<AppSceneCost
|
||||
List<AppSceneCostResultValue> result = new ArrayList<>();
|
||||
QueryWrapper<AppSceneCostResultValue> queryWrapper = new QueryWrapper<>();
|
||||
if (topMaterialCode != null && !topMaterialCode.equals("") && lastTaskType != null && !lastTaskType.equals("") && flowInstanceId != null && !flowInstanceId.equals("")) {
|
||||
//查询某个流程节点(即执行任务)的结果值
|
||||
queryWrapper.eq("belong_top_material_no", topMaterialCode).eq("task_type", lastTaskType).eq("flow_instance_id", flowInstanceId);
|
||||
result = appSceneCostResultValueMapper.selectList(queryWrapper);
|
||||
} else if (topMaterialCode != null && !topMaterialCode.equals("") && flowInstanceId != null && !flowInstanceId.equals("")) {
|
||||
} else if (topMaterialCode != null && !topMaterialCode.equals("") && flowInstanceId != null && !flowInstanceId.equals("") && lastTaskType == null) {
|
||||
//查询BOM物料所有的树节点信息
|
||||
queryWrapper.eq("belong_top_material_no", topMaterialCode).eq("flow_instance_id", flowInstanceId).isNull("task_type");
|
||||
result = appSceneCostResultValueMapper.selectList(queryWrapper);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询根物料的某次成本计算流程下的所有结果值
|
||||
*
|
||||
* @param topMaterialCode
|
||||
* @param flowInstanceId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<AppSceneCostResultValue> getAllResultValueByTopMaterialNo(String topMaterialCode, String flowInstanceId) {
|
||||
List<AppSceneCostResultValue> result = new ArrayList<>();
|
||||
QueryWrapper<AppSceneCostResultValue> queryWrapper = new QueryWrapper<>();
|
||||
if (topMaterialCode != null && !topMaterialCode.equals("") && flowInstanceId != null && !flowInstanceId.equals("")) {
|
||||
//查询某个流程节点(即执行任务)的结果值
|
||||
queryWrapper.eq("belong_top_material_no", topMaterialCode).eq("flow_instance_id", flowInstanceId);
|
||||
result = appSceneCostResultValueMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.zzsmart.qomo.kn.cost.manage.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MissingComponentVO {
|
||||
/**
|
||||
* 物料编号
|
||||
*/
|
||||
|
||||
private String materialNumber;
|
||||
|
||||
/**
|
||||
* 版本号
|
||||
*/
|
||||
|
||||
private String versionNumber;
|
||||
/**
|
||||
* 缺失信息
|
||||
*/
|
||||
|
||||
private String missingInfo;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user