|
@ -7,6 +7,8 @@ import cn.hutool.core.util.ObjectUtil; |
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
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.Api; |
|
|
import io.swagger.annotations.ApiOperation; |
|
|
import io.swagger.annotations.ApiOperation; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
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.IPdmBdWorkorderService; |
|
|
import org.nl.wms.pdm.service.dao.PdmBdWorkorder; |
|
|
import org.nl.wms.pdm.service.dao.PdmBdWorkorder; |
|
|
import org.nl.wms.pdm.service.dao.PdmBdWorkorderDetail; |
|
|
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.Material; |
|
|
import org.nl.wms.sch.material.service.dao.mapper.MaterialMapper; |
|
|
import org.nl.wms.sch.material.service.dao.mapper.MaterialMapper; |
|
|
import org.nl.wms.sch.task_manage.enums.GroupBindMaterialStatusEnum; |
|
|
import org.nl.wms.sch.task_manage.enums.GroupBindMaterialStatusEnum; |
|
@ -46,6 +49,9 @@ public class MesController { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private MaterialMapper materialMapper; |
|
|
private MaterialMapper materialMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private IMaterialService materialService; |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
private IPdmBdWorkorderService pdmBdWorkorderService; |
|
|
private IPdmBdWorkorderService pdmBdWorkorderService; |
|
|
|
|
|
|
|
@ -74,13 +80,32 @@ public class MesController { |
|
|
head.setSRC_SYSTEM("AGV"); |
|
|
head.setSRC_SYSTEM("AGV"); |
|
|
qpmes060Response.setHEAD(head); |
|
|
qpmes060Response.setHEAD(head); |
|
|
try { |
|
|
try { |
|
|
Material material = new Material(); |
|
|
|
|
|
for(QPMES060RequestBody QPMES060RequestBody:notice.toJavaObject(QPMES060Request.class).getBODY()) { |
|
|
for(QPMES060RequestBody QPMES060RequestBody:notice.toJavaObject(QPMES060Request.class).getBODY()) { |
|
|
|
|
|
Material material = new Material(); |
|
|
|
|
|
//实体类
|
|
|
material.copyFrom(QPMES060RequestBody); |
|
|
material.copyFrom(QPMES060RequestBody); |
|
|
|
|
|
String lotSN = material.getLotSN(); |
|
|
|
|
|
if(ObjectUtil.isNotEmpty(lotSN)){ |
|
|
|
|
|
Material entity = materialService.getOne(new LambdaQueryWrapper<Material>() |
|
|
|
|
|
.eq(Material::getLotSN, lotSN)); |
|
|
|
|
|
if (ObjectUtil.isEmpty(entity)){ |
|
|
|
|
|
//新增
|
|
|
material.setGroup_bind_material_status(GroupBindMaterialStatusEnum.BOUND.getValue()); |
|
|
material.setGroup_bind_material_status(GroupBindMaterialStatusEnum.BOUND.getValue()); |
|
|
material.setReturn_status("0"); |
|
|
material.setReturn_status("0"); |
|
|
material.setCreate_time(DateUtil.now()); |
|
|
material.setCreate_time(DateUtil.now()); |
|
|
materialMapper.insert(material); |
|
|
materialMapper.insert(material); |
|
|
|
|
|
}else{ |
|
|
|
|
|
LambdaUpdateWrapper<Material> 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.setMESSAGE("原材料入库成功"); |
|
|
qpmes060ResponseBody.setSTATUS("S"); |
|
|
qpmes060ResponseBody.setSTATUS("S"); |
|
@ -214,7 +239,24 @@ public class MesController { |
|
|
try { |
|
|
try { |
|
|
Workorder workorder = new Workorder(); |
|
|
Workorder workorder = new Workorder(); |
|
|
workorder.copyFrom(temp); |
|
|
workorder.copyFrom(temp); |
|
|
|
|
|
String lotSN = workorder.getLotSN(); |
|
|
|
|
|
if(ObjectUtil.isNotEmpty(lotSN)){ |
|
|
|
|
|
Workorder entity = workorderService.getOne(new LambdaQueryWrapper<Workorder>() |
|
|
|
|
|
.eq(Workorder::getLotSN, lotSN)); |
|
|
|
|
|
if (ObjectUtil.isEmpty(entity)){ |
|
|
|
|
|
//新增
|
|
|
workorderService.create(workorder); |
|
|
workorderService.create(workorder); |
|
|
|
|
|
}else{ |
|
|
|
|
|
LambdaUpdateWrapper<Workorder> 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) { |
|
|
} catch (Exception e) { |
|
|
log.error("工单已存在导致新增失败,{}{}", e, e.getMessage()); |
|
|
log.error("工单已存在导致新增失败,{}{}", e, e.getMessage()); |
|
|
} |
|
|
} |
|
|