ソースを参照

修改启用到启用中...

5 年 前
コミット
ba0e749b7b

+ 11 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/MouldServiceImpl.java

@@ -12,6 +12,7 @@ import com.hssx.cloudmodel.entity.vo.MouldVO;
 import com.hssx.cloudmodel.entity.vo.ProjectVO;
 import com.hssx.cloudmodel.entity.vo.UserVO;
 import com.hssx.cloudmodel.mapper.*;
+import com.hssx.cloudmodel.service.InjectionMoldingService;
 import com.hssx.cloudmodel.service.MouldService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.hssx.cloudmodel.util.*;
@@ -60,6 +61,8 @@ public class MouldServiceImpl extends ServiceImpl<MouldMapper, Mould> implements
     NewsNoticeUserMapper newsNoticeUserMapper;
     @Resource
     MouldFileMapper mouldFileMapper;
+    @Resource
+    InjectionMoldingMapper injectionMoldingMapper;
 
     @Override
     public HttpRespMsg addAndUpdateMould(Mould mould, User user, Integer dynamicId,InjectionMolding injectionMolding) {
@@ -75,6 +78,9 @@ public class MouldServiceImpl extends ServiceImpl<MouldMapper, Mould> implements
                     mould.setArea(company.getCompanyAddress());
                 }
                 mouldMapper.updateById(mould);
+                InjectionMolding molding = injectionMoldingMapper.selectOne(new QueryWrapper<InjectionMolding>().eq("mould_id", mould.getId()));
+                injectionMolding.setInjectionId(molding.getInjectionId());
+                injectionMoldingMapper.updateById(injectionMolding);
                 msg.data = mould;
             } else {
                 msg.setError("当前模具编号已存在,请重新输入其他模具编号");
@@ -119,6 +125,9 @@ public class MouldServiceImpl extends ServiceImpl<MouldMapper, Mould> implements
                 mould.setBelongProjectGrade(0 + "");
                 mould.setHistoryRunTimes(model.getRunTimes());
                 mouldMapper.insert(mould);
+                InjectionMolding molding = injectionMoldingMapper.selectOne(new QueryWrapper<InjectionMolding>().eq("mould_id", model.getId()));
+                molding.setMouldId(mould.getId());
+                injectionMoldingMapper.updateById(injectionMolding);
                 msg.data = mould;
                 //将之前的模具与项目和设备解绑
                 mouldMapper.updateModelProjectIdAndEquipmentIdToNullById(model);
@@ -137,6 +146,8 @@ public class MouldServiceImpl extends ServiceImpl<MouldMapper, Mould> implements
                     mould.setCreatorId(user.getId());
                     mould.setCompanyId(user.getCompanyId());
                     mouldMapper.insert(mould);
+                    injectionMolding.setMouldId(mould.getId());
+                    injectionMoldingMapper.insert(injectionMolding);
                     msg.data = mould;
                 }
             }