|
|
@@ -1,5 +1,6 @@
|
|
|
package com.dk.mdm.service.pdm;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.dk.common.exception.BaseBusinessException;
|
|
|
import com.dk.common.infrastructure.annotaiton.Pagination;
|
|
|
@@ -14,11 +15,15 @@ import com.dk.common.service.BaseService;
|
|
|
import com.dk.mdm.infrastructure.convert.pdm.ProductConvert;
|
|
|
import com.dk.mdm.infrastructure.strategy.production.ProductionContext;
|
|
|
import com.dk.mdm.infrastructure.util.AuthUtils;
|
|
|
+import com.dk.mdm.mapper.common.CommonMapper;
|
|
|
+import com.dk.mdm.mapper.mst.ErpNodeMapper;
|
|
|
import com.dk.mdm.mapper.mst.ModelProductMapper;
|
|
|
import com.dk.mdm.mapper.mst.ProductGradeMapper;
|
|
|
import com.dk.mdm.mapper.pdm.*;
|
|
|
import com.dk.mdm.model.pojo.pdm.*;
|
|
|
+import com.dk.mdm.model.query.mst.ErpNodeQuery;
|
|
|
import com.dk.mdm.model.query.pdm.ProductQuery;
|
|
|
+import com.dk.mdm.model.response.mst.ErpNodeResponse;
|
|
|
import com.dk.mdm.model.response.mst.ProductGradeResponse;
|
|
|
import com.dk.mdm.model.response.pdm.ProductResponse;
|
|
|
import com.dk.mdm.model.vo.pdm.ProductVO;
|
|
|
@@ -27,9 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.List;
|
|
|
-import java.util.UUID;
|
|
|
+import java.util.*;
|
|
|
|
|
|
@Service
|
|
|
public class ProductService extends BaseService<Product> {
|
|
|
@@ -78,6 +81,12 @@ public class ProductService extends BaseService<Product> {
|
|
|
@Autowired
|
|
|
private ProductionContext productionContext;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private CommonMapper commonMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ErpNodeMapper erpNodeMapper;
|
|
|
+
|
|
|
/**
|
|
|
* @desc : 重写主键
|
|
|
* @author : 常皓宁
|
|
|
@@ -131,6 +140,24 @@ public class ProductService extends BaseService<Product> {
|
|
|
// 当前工序
|
|
|
ProcessNode processNode = null;
|
|
|
|
|
|
+ Integer ftyId = authUtils.getUser().getFtyId();
|
|
|
+ //erp节点
|
|
|
+ Integer erpNodeId = null;
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("code", Constant.StringConstant.SYS_PDM_005.getName());
|
|
|
+ map.put("ftyId", ftyId);
|
|
|
+ String value = commonMapper.getSettingValue(map);
|
|
|
+ if (value!=null) {
|
|
|
+ JSONArray jsonArray = JSONArray.parseArray(value);
|
|
|
+ if (jsonArray.contains("3")) {
|
|
|
+ List<ErpNodeResponse> erpNodes = erpNodeMapper.selectByCond(new ErpNodeQuery().setFtyId(ftyId).setFlgValid(true).setNodeType("产阶类型-成型"));
|
|
|
+ if (erpNodes!=null && erpNodes.size()>0) {
|
|
|
+ erpNodeId = erpNodes.get(0).getNodeId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
for (Product it : productList) {
|
|
|
if (it.getUniqueId() != null) {
|
|
|
productMapper.updateById(productMapper.selectById(it.getUniqueId()).setRemarks(it.getRemarks()));
|
|
|
@@ -188,7 +215,7 @@ public class ProductService extends BaseService<Product> {
|
|
|
productionMapper.getLevelById(productionId),
|
|
|
it.getFtyId(),
|
|
|
moldingItem, processNode, productGrade,
|
|
|
- it.getModelId()
|
|
|
+ it.getModelId(), erpNodeId
|
|
|
);
|
|
|
productionMapper.insert(production);
|
|
|
|