Forráskód Böngészése

新增零件时,随即增加托盘字典

oyq28 5 hónapja
szülő
commit
dd7aed7afa

+ 34 - 4
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionReadyCenter/service/impl/BBomServiceImpl.java

@@ -3,6 +3,10 @@ package com.github.zuihou.business.productionReadyCenter.service.impl;
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.zuihou.authority.dao.common.DictionaryItemMapper;
+import com.github.zuihou.authority.dao.common.DictionaryMapper;
+import com.github.zuihou.authority.entity.common.Dictionary;
+import com.github.zuihou.authority.entity.common.DictionaryItem;
 import com.github.zuihou.base.R;
 import com.github.zuihou.business.operationManagementCenter.entity.Order;
 import com.github.zuihou.business.operationManagementCenter.entity.Plan;
@@ -29,10 +33,8 @@ 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.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.time.LocalDateTime;
+import java.util.*;
 
 import static com.github.zuihou.utils.BizAssert.isFalse;
 
@@ -54,6 +56,10 @@ public class BBomServiceImpl extends SuperServiceImpl<BBomMapper, BBom> implemen
     private CustService custService;
     @Autowired
     private CustMapper custMapper;
+    @Autowired
+    private DictionaryItemMapper dictionaryItem;
+    @Autowired
+    private DictionaryMapper dictionary;
 
     @Override
     public IPage<BBom> pageList(IPage page, String version,LbqWrapper<BBom> wrapper) {
@@ -248,6 +254,30 @@ public class BBomServiceImpl extends SuperServiceImpl<BBomMapper, BBom> implemen
             bBom.setAuditStatus(map.get("audit_status").toString());
             updateById(bBom);
         }
+
+        if("2".equals(map.get("audit_status").toString())){
+            List<BBom> dicBomList = baseMapper.selectList(Wraps.<BBom>lbQ().in(BBom::getId,ids));
+
+            //增加 托盘绑定零件 数据字典
+            Dictionary businessProductType = dictionary.selectOne(Wraps.<Dictionary>lbQ().eq(Dictionary::getType, "BUSINESS_PRODUCT_TYPE"));
+            Long dictionaryId = businessProductType.getId();
+            dicBomList.stream().forEach(vo->{
+                DictionaryItem dictionaryItem1=new DictionaryItem();
+                dictionaryItem1.setDictionaryId(dictionaryId);
+                dictionaryItem1.setDictionaryType("BUSINESS_PRODUCT_TYPE");
+                dictionaryItem1.setCode(vo.getPartsNo());
+                dictionaryItem1.setName(vo.getName());
+                dictionaryItem1.setStatus(true);
+                dictionaryItem1.setDescribe(vo.getName());
+                dictionaryItem1.setSortValue(1);
+                dictionaryItem1.setCreateUser(Long.parseLong("3"));
+                dictionaryItem1.setCreateTime(LocalDateTime.now());
+                dictionaryItem.insert(dictionaryItem1);
+            });
+        }
+
+
+
         return R.success();
     }