diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/service/impl/AcsToWmsServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/service/impl/AcsToWmsServiceImpl.java index 3a91556..9e80de5 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/service/impl/AcsToWmsServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/service/impl/AcsToWmsServiceImpl.java @@ -236,7 +236,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { String taskId = param.getString("taskId"); BaseResponse result = BaseResponse.build(requestNo); try { - SchBaseTask schBaseTask=taskService.getById(taskId); + SchBaseTask schBaseTask = taskService.getById(taskId); if(ObjectUtil.isEmpty(schBaseTask)){ throw new BadRequestException("任务不存在!taskId:"+taskId); } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/mes/controller/MesController.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/mes/controller/MesController.java index 2b878bf..8982946 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/mes/controller/MesController.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/mes/controller/MesController.java @@ -7,6 +7,8 @@ import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; @@ -15,6 +17,7 @@ import org.nl.wms.mes.domain.*; import org.nl.wms.pdm.service.IPdmBdWorkorderService; import org.nl.wms.pdm.service.dao.PdmBdWorkorder; import org.nl.wms.pdm.service.dao.PdmBdWorkorderDetail; +import org.nl.wms.sch.material.service.IMaterialService; import org.nl.wms.sch.material.service.dao.Material; import org.nl.wms.sch.material.service.dao.mapper.MaterialMapper; import org.nl.wms.sch.task_manage.enums.GroupBindMaterialStatusEnum; @@ -46,6 +49,9 @@ public class MesController { @Autowired private MaterialMapper materialMapper; + @Autowired + private IMaterialService materialService; + @Autowired private IPdmBdWorkorderService pdmBdWorkorderService; @@ -74,13 +80,32 @@ public class MesController { head.setSRC_SYSTEM("AGV"); qpmes060Response.setHEAD(head); try { - Material material = new Material(); for(QPMES060RequestBody QPMES060RequestBody:notice.toJavaObject(QPMES060Request.class).getBODY()) { + Material material = new Material(); + //实体类 material.copyFrom(QPMES060RequestBody); - material.setGroup_bind_material_status(GroupBindMaterialStatusEnum.BOUND.getValue()); - material.setReturn_status("0"); - material.setCreate_time(DateUtil.now()); - materialMapper.insert(material); + String lotSN = material.getLotSN(); + if(ObjectUtil.isNotEmpty(lotSN)){ + Material entity = materialService.getOne(new LambdaQueryWrapper() + .eq(Material::getLotSN, lotSN)); + if (ObjectUtil.isEmpty(entity)){ + //新增 + material.setGroup_bind_material_status(GroupBindMaterialStatusEnum.BOUND.getValue()); + material.setReturn_status("0"); + material.setCreate_time(DateUtil.now()); + materialMapper.insert(material); + }else{ + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); + updateWrapper.eq(Material::getLotSN,lotSN); + //更新 + material.setGroup_bind_material_status(entity.getGroup_bind_material_status()); + material.setReturn_status(entity.getReturn_status()); + material.setCreate_time(DateUtil.now()); + materialService.update(material,updateWrapper); + } + }else{ + log.error("原材料入库晶棒号为空,{}", material.toString()); + } } qpmes060ResponseBody.setMESSAGE("原材料入库成功"); qpmes060ResponseBody.setSTATUS("S"); @@ -214,7 +239,24 @@ public class MesController { try { Workorder workorder = new Workorder(); workorder.copyFrom(temp); - workorderService.create(workorder); + String lotSN = workorder.getLotSN(); + if(ObjectUtil.isNotEmpty(lotSN)){ + Workorder entity = workorderService.getOne(new LambdaQueryWrapper() + .eq(Workorder::getLotSN, lotSN)); + if (ObjectUtil.isEmpty(entity)){ + //新增 + workorderService.create(workorder); + }else{ + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); + updateWrapper.eq(Workorder::getLotSN,lotSN); + //更新 + workorder.setMode(entity.getMode()); + workorder.setStatus(entity.getStatus()); + workorderService.update(workorder,updateWrapper); + } + }else{ + log.error("工单晶棒号为空,{}", workorder.toString()); + } } catch (Exception e) { log.error("工单已存在导致新增失败,{}{}", e, e.getMessage()); } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/report/service/dao/mapper/ReportMapper.xml b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/report/service/dao/mapper/ReportMapper.xml index 379591e..3eaa9b4 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/report/service/dao/mapper/ReportMapper.xml +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/report/service/dao/mapper/ReportMapper.xml @@ -40,40 +40,70 @@