|
|
@ -8,30 +8,23 @@ 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; |
|
|
|
import org.nl.common.logging.annotation.Log; |
|
|
|
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; |
|
|
|
import org.nl.wms.sch.task_manage.task.tasks.mapper.PointMapper; |
|
|
|
import org.nl.wms.sch.workorder.service.IWorkorderService; |
|
|
|
import org.nl.wms.sch.workorder.service.dao.Workorder; |
|
|
|
import org.nl.wms.sch.material.service.dao.MesInMaterial; |
|
|
|
import org.nl.wms.sch.material.service.dao.MesMoveMaterial; |
|
|
|
import org.nl.wms.sch.material.service.dao.MesOutMaterial; |
|
|
|
import org.nl.wms.sch.material.service.dao.mapper.MesMoveMaterialMapper; |
|
|
|
import org.nl.wms.sch.material.service.dao.mapper.MesInMaterialMapper; |
|
|
|
import org.nl.wms.sch.material.service.dao.mapper.MesOutMaterialMapper; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.context.annotation.Lazy; |
|
|
|
import org.springframework.web.bind.annotation.PostMapping; |
|
|
|
import org.springframework.web.bind.annotation.RequestBody; |
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
@ -44,235 +37,212 @@ import java.util.List; |
|
|
|
public class MesController { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private PointMapper pointMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private MaterialMapper materialMapper; |
|
|
|
private MesMoveMaterialMapper mesMoveMaterialMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private IMaterialService materialService; |
|
|
|
private MesOutMaterialMapper mesOutMaterialMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private IPdmBdWorkorderService pdmBdWorkorderService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private IWorkorderService workorderService; |
|
|
|
private MesInMaterialMapper mesInMaterialMapper; |
|
|
|
|
|
|
|
/** |
|
|
|
* MES调用LMS:原材料入原材料库信息 |
|
|
|
* 调用时机:货物到达,在MES上录入信息,然后推送到LMS |
|
|
|
* MES调用LMS:推送托盘物料组盘信息 |
|
|
|
* 调用时机:WMS 中对已组盘的托盘物料入立库,信息推送给 LMS |
|
|
|
* @param notice |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@PostMapping("/QPMES060") |
|
|
|
@Log(value = "QPMES060") |
|
|
|
@ApiOperation("QPMES060") |
|
|
|
@PostMapping("/qpmes060") |
|
|
|
@Log(value = "qpmes060") |
|
|
|
@ApiOperation("qpmes060") |
|
|
|
@SaIgnore |
|
|
|
public QPMES060Response QPMES060(@RequestBody JSONObject notice) { |
|
|
|
public QPMESResponse qpmes060(@RequestBody JSONObject notice) { |
|
|
|
log.info("QPMES060服务被调用,输入参数:" + notice.toString()); |
|
|
|
QPMES060Response qpmes060Response = new QPMES060Response(); |
|
|
|
QPMES060ResponseBody qpmes060ResponseBody = new QPMES060ResponseBody(); |
|
|
|
List<QPMES060ResponseBody> qpmes060ResponseBodyArrayList=new ArrayList<>(); |
|
|
|
QPMESResponse qpmes060Response = new QPMESResponse(); |
|
|
|
QPMESResponseBody qpmes060ResponseBody = new QPMESResponseBody(); |
|
|
|
List<QPMESResponseBody> qpmes060ResponseBodyArrayList=new ArrayList<>(); |
|
|
|
Head head=new Head(); |
|
|
|
head.setDEST_SYSTEM("WMS"); |
|
|
|
head.setINTF_ID("QPMES060"); |
|
|
|
head.setSRC_MSGID(IdUtil.simpleUUID()); |
|
|
|
head.setSRC_SYSTEM("AGV"); |
|
|
|
qpmes060Response.setHEAD(head); |
|
|
|
head.setDest_system("wms"); |
|
|
|
head.setIntf_id("qpmes060"); |
|
|
|
head.setSrc_msgid(IdUtil.simpleUUID()); |
|
|
|
head.setSrc_system("lms"); |
|
|
|
qpmes060Response.setHead(head); |
|
|
|
try { |
|
|
|
for(QPMES060RequestBody QPMES060RequestBody:notice.toJavaObject(QPMES060Request.class).getBODY()) { |
|
|
|
Material material = new Material(); |
|
|
|
for(QPMES060RequestBody QPMES060RequestBody:notice.toJavaObject(QPMES060Request.class).getBody()) { |
|
|
|
MesInMaterial material = new MesInMaterial(); |
|
|
|
//实体类
|
|
|
|
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.setReturn_status("0"); |
|
|
|
material.setCreate_time(DateUtil.now()); |
|
|
|
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); |
|
|
|
} |
|
|
|
String pallet_sn = material.getPallet_sn(); |
|
|
|
String product_name = material.getProduct_name(); |
|
|
|
String batch = material.getBatch(); |
|
|
|
LambdaQueryWrapper<MesInMaterial> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
queryWrapper.eq(ObjectUtil.isNotEmpty(pallet_sn),MesInMaterial::getPallet_sn, pallet_sn); |
|
|
|
queryWrapper.eq(ObjectUtil.isNotEmpty(product_name),MesInMaterial::getProduct_name, product_name); |
|
|
|
queryWrapper.eq(ObjectUtil.isNotEmpty(batch),MesInMaterial::getBatch, batch); |
|
|
|
MesInMaterial entity = mesInMaterialMapper.selectOne(queryWrapper); |
|
|
|
if (ObjectUtil.isEmpty(entity)){ |
|
|
|
//新增
|
|
|
|
material.setReturn_status("0"); |
|
|
|
material.setCreate_time(DateUtil.now()); |
|
|
|
mesInMaterialMapper.insert(material); |
|
|
|
}else{ |
|
|
|
log.error("原材料入库晶棒号为空,{}", material.toString()); |
|
|
|
LambdaUpdateWrapper<MesInMaterial> updateWrapper = new LambdaUpdateWrapper<>(); |
|
|
|
updateWrapper.eq(ObjectUtil.isNotEmpty(pallet_sn),MesInMaterial::getPallet_sn, pallet_sn); |
|
|
|
updateWrapper.eq(ObjectUtil.isNotEmpty(product_name),MesInMaterial::getProduct_name, product_name); |
|
|
|
updateWrapper.eq(ObjectUtil.isNotEmpty(batch),MesInMaterial::getBatch, batch); |
|
|
|
//更新
|
|
|
|
material.setReturn_status(entity.getReturn_status()); |
|
|
|
material.setCreate_time(entity.getCreate_time()); |
|
|
|
material.setUpdate_time(DateUtil.now()); |
|
|
|
mesInMaterialMapper.update(material,updateWrapper); |
|
|
|
} |
|
|
|
} |
|
|
|
qpmes060ResponseBody.setMESSAGE("原材料入库成功"); |
|
|
|
qpmes060ResponseBody.setSTATUS("S"); |
|
|
|
qpmes060ResponseBody.setMessage("接受托盘物料组盘信息成功"); |
|
|
|
qpmes060ResponseBody.setStatus("S"); |
|
|
|
qpmes060ResponseBodyArrayList.add(qpmes060ResponseBody); |
|
|
|
qpmes060Response.setBODY(qpmes060ResponseBodyArrayList); |
|
|
|
qpmes060Response.setBody(qpmes060ResponseBodyArrayList); |
|
|
|
log.info("QPMES060服务被调用,返回参数:" + JSON.toJSONString(qpmes060Response)); |
|
|
|
return qpmes060Response; |
|
|
|
}catch (Exception e){ |
|
|
|
qpmes060ResponseBody.setMESSAGE("原材料入库失败"+e.getMessage()); |
|
|
|
qpmes060ResponseBody.setSTATUS("E"); |
|
|
|
qpmes060ResponseBody.setMessage("接受托盘物料组盘信息失败:"+e.getMessage()); |
|
|
|
qpmes060ResponseBody.setStatus("E"); |
|
|
|
qpmes060ResponseBodyArrayList.add(qpmes060ResponseBody); |
|
|
|
qpmes060Response.setBODY(qpmes060ResponseBodyArrayList); |
|
|
|
qpmes060Response.setBody(qpmes060ResponseBodyArrayList); |
|
|
|
log.error("QPMES060服务异常:"+ JSON.toJSONString(qpmes060Response)); |
|
|
|
return qpmes060Response; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 盐城二期粘棒工单: |
|
|
|
* 调用时机:随时 |
|
|
|
* MES调用LMS:下发出库任务信息 |
|
|
|
* 调用时机:WMS 维护出库物料信息,并指定出库对接区域下发 LMS 出库 |
|
|
|
* @param notice |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@PostMapping("/QPMES098") |
|
|
|
@Log(value = "QPMES098") |
|
|
|
@ApiOperation("QPMES098") |
|
|
|
@PostMapping("/qpmes064") |
|
|
|
@Log(value = "qpmes064") |
|
|
|
@ApiOperation("qpmes064") |
|
|
|
@SaIgnore |
|
|
|
public QPMES098Response QPMES098(@RequestBody JSONObject notice) { |
|
|
|
public QPMESResponse qpmes064(@RequestBody JSONObject notice) { |
|
|
|
log.info("QPMES098服务被调用,输入参数:" + notice.toString()); |
|
|
|
QPMES098Request qpmes098Request=notice.toJavaObject(QPMES098Request.class); |
|
|
|
QPMES098Response qpmes098Response=new QPMES098Response(); |
|
|
|
QPMES098ResponseBody qpmes098ResponseBody = new QPMES098ResponseBody(); |
|
|
|
List<QPMES098ResponseBody> qpmes098ResponseBodyArrayList=new ArrayList<>(); |
|
|
|
PdmBdWorkorder entity = new PdmBdWorkorder(); |
|
|
|
if("1".equals(qpmes098Request.getBODY().get(0).getZSTAT())) { |
|
|
|
//先删除原来的工单信息,再新增,不然会出现重复的情况
|
|
|
|
pdmBdWorkorderService.updateState(qpmes098Request.getBODY().get(0).getAUFNR(),"2"); |
|
|
|
entity.setExt_data(JSONObject.toJSONString(qpmes098Request)); |
|
|
|
entity.setWorkorder_code(qpmes098Request.getBODY().get(0).getAUFNR()); |
|
|
|
entity.setPlan_qty(new BigDecimal((qpmes098Request.getBODY().get(0).getGAMNG()))); |
|
|
|
entity.setMaterial_id(qpmes098Request.getBODY().get(0).getPLNBEZ()); |
|
|
|
entity.setWorkorder_status(qpmes098Request.getBODY().get(0).getZSTAT()); |
|
|
|
entity.setMaterial_code(qpmes098Request.getBODY().get(0).getPLNBEZ()); |
|
|
|
entity.setMaterial_name(qpmes098Request.getBODY().get(0).getMAKTX()); |
|
|
|
//客户名称
|
|
|
|
entity.setExt_id(qpmes098Request.getBODY().get(0).getZKUNNR()); |
|
|
|
entity.setCreate_id("0"); |
|
|
|
entity.setCreate_name("MES"); |
|
|
|
entity.setCreate_time(DateUtil.now()); |
|
|
|
pdmBdWorkorderService.create(entity); |
|
|
|
for(QPMES098RequestBodyItem2 qpmes098RequestBodyItem2:qpmes098Request.getBODY().get(0).getITEM2()){ |
|
|
|
PdmBdWorkorderDetail pdmBdWorkorderDetail=new PdmBdWorkorderDetail(); |
|
|
|
pdmBdWorkorderDetail.setReal_qty(BigDecimal.valueOf(0)); |
|
|
|
pdmBdWorkorderDetail.setWorkorder_code(entity.getWorkorder_code()); |
|
|
|
pdmBdWorkorderDetail.copyFrom(qpmes098RequestBodyItem2); |
|
|
|
pdmBdWorkorderService.createDetail(pdmBdWorkorderDetail); |
|
|
|
} |
|
|
|
qpmes098ResponseBody.setMESSAGE("工单下发成功"); |
|
|
|
qpmes098ResponseBody.setSTATUS("S"); |
|
|
|
qpmes098ResponseBody.setFKEY_VALUE01(qpmes098Request.getBODY().get(0).getAUFNR()); |
|
|
|
}else{ |
|
|
|
entity=pdmBdWorkorderService.getOne(new LambdaQueryWrapper<PdmBdWorkorder>() |
|
|
|
.eq(PdmBdWorkorder::getWorkorder_code, qpmes098Request.getBODY().get(0).getAUFNR())); |
|
|
|
if (ObjectUtil.isEmpty(entity)){ |
|
|
|
qpmes098ResponseBody.setSTATUS("E"); |
|
|
|
qpmes098ResponseBody.setMESSAGE("生产订单号不存在,无法关闭或删除"); |
|
|
|
qpmes098ResponseBody.setFKEY_VALUE01(qpmes098Request.getBODY().get(0).getAUFNR()); |
|
|
|
log.info("QPMES098服务被调用,返回参数:" + qpmes098Response); |
|
|
|
return qpmes098Response; |
|
|
|
QPMESResponse qpmes064Response = new QPMESResponse(); |
|
|
|
QPMESResponseBody qpmes064ResponseBody = new QPMESResponseBody(); |
|
|
|
List<QPMESResponseBody> qpmes064ResponseBodyArrayList=new ArrayList<>(); |
|
|
|
Head head=new Head(); |
|
|
|
head.setDest_system("wms"); |
|
|
|
head.setIntf_id("qpmes064"); |
|
|
|
head.setSrc_msgid(IdUtil.simpleUUID()); |
|
|
|
head.setSrc_system("lms"); |
|
|
|
qpmes064Response.setHead(head); |
|
|
|
try { |
|
|
|
for(QPMES064RequestBody QPMES064RequestBody:notice.toJavaObject(QPMES064Request.class).getBody()) { |
|
|
|
MesOutMaterial material = new MesOutMaterial(); |
|
|
|
//实体类
|
|
|
|
material.copyFrom(QPMES064RequestBody); |
|
|
|
String product_name = material.getProduct_name(); |
|
|
|
String batch = material.getBatch(); |
|
|
|
String sect_code = material.getSect_code(); |
|
|
|
LambdaQueryWrapper<MesOutMaterial> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
queryWrapper.eq(ObjectUtil.isNotEmpty(product_name),MesOutMaterial::getProduct_name, product_name); |
|
|
|
queryWrapper.eq(ObjectUtil.isNotEmpty(batch),MesOutMaterial::getBatch, batch); |
|
|
|
queryWrapper.eq(ObjectUtil.isNotEmpty(sect_code),MesOutMaterial::getSect_code, sect_code); |
|
|
|
MesOutMaterial entity = mesOutMaterialMapper.selectOne(queryWrapper); |
|
|
|
if (ObjectUtil.isEmpty(entity)){ |
|
|
|
//新增
|
|
|
|
material.setReturn_status("0"); |
|
|
|
material.setCreate_time(DateUtil.now()); |
|
|
|
mesOutMaterialMapper.insert(material); |
|
|
|
}else{ |
|
|
|
LambdaUpdateWrapper<MesOutMaterial> updateWrapper = new LambdaUpdateWrapper<>(); |
|
|
|
updateWrapper.eq(ObjectUtil.isNotEmpty(sect_code),MesOutMaterial::getSect_code, sect_code); |
|
|
|
updateWrapper.eq(ObjectUtil.isNotEmpty(product_name),MesOutMaterial::getProduct_name, product_name); |
|
|
|
updateWrapper.eq(ObjectUtil.isNotEmpty(batch),MesOutMaterial::getBatch, batch); |
|
|
|
//更新
|
|
|
|
material.setReturn_status(entity.getReturn_status()); |
|
|
|
material.setCreate_time(entity.getCreate_time()); |
|
|
|
material.setUpdate_time(DateUtil.now()); |
|
|
|
mesOutMaterialMapper.update(material,updateWrapper); |
|
|
|
} |
|
|
|
} |
|
|
|
entity.setWorkorder_status(qpmes098Request.getBODY().get(0).getZSTAT()); |
|
|
|
pdmBdWorkorderService.update(entity); |
|
|
|
qpmes064ResponseBody.setMessage("接受出库任务信息成功"); |
|
|
|
qpmes064ResponseBody.setStatus("S"); |
|
|
|
qpmes064ResponseBodyArrayList.add(qpmes064ResponseBody); |
|
|
|
qpmes064Response.setBody(qpmes064ResponseBodyArrayList); |
|
|
|
log.info("QPMES064服务被调用,返回参数:" + JSON.toJSONString(qpmes064Response)); |
|
|
|
return qpmes064Response; |
|
|
|
}catch (Exception e){ |
|
|
|
qpmes064ResponseBody.setMessage("接受出库任务信息失败:"+e.getMessage()); |
|
|
|
qpmes064ResponseBody.setStatus("E"); |
|
|
|
qpmes064ResponseBodyArrayList.add(qpmes064ResponseBody); |
|
|
|
qpmes064Response.setBody(qpmes064ResponseBodyArrayList); |
|
|
|
log.error("QPMES064服务异常:"+ JSON.toJSONString(qpmes064Response)); |
|
|
|
return qpmes064Response; |
|
|
|
} |
|
|
|
Head head=new Head(); |
|
|
|
head.setDEST_SYSTEM("WMS"); |
|
|
|
head.setINTF_ID("QPMES098"); |
|
|
|
head.setSRC_MSGID(IdUtil.simpleUUID()); |
|
|
|
head.setSRC_SYSTEM("AGV"); |
|
|
|
qpmes098Response.setHEAD(head); |
|
|
|
qpmes098ResponseBodyArrayList.add(qpmes098ResponseBody); |
|
|
|
qpmes098Response.setBODY(qpmes098ResponseBodyArrayList); |
|
|
|
log.info("QPMES098服务被调用,返回参数:" + qpmes098Response); |
|
|
|
return qpmes098Response; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* WMS同步AGV晶棒库存 |
|
|
|
* 调用时机:随时 |
|
|
|
* 范围:原材料库(与回温库) |
|
|
|
* MES调用LMS:下发移库任务信息 |
|
|
|
* 调用时机:WMS 上维护第二天需要用到的物料,指定东、西阁楼或主存区下层为移入备货区域 |
|
|
|
* @param notice |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@PostMapping("/QPMES118") |
|
|
|
@Log(value = "QPMES118") |
|
|
|
@ApiOperation("QPMES118") |
|
|
|
@PostMapping("/qpmes068") |
|
|
|
@Log(value = "qpmes068") |
|
|
|
@ApiOperation("qpmes068") |
|
|
|
@SaIgnore |
|
|
|
public QPMES118Response QPMES118(@RequestBody JSONObject notice) { |
|
|
|
log.info("QPMES118服务被调用,输入参数:" + notice.toString()); |
|
|
|
QPMES118Response qpmes118Response =new QPMES118Response(); |
|
|
|
List<QPMES118ResponseBody> body=pointMapper.queryByMes(); |
|
|
|
qpmes118Response.setBODY(body); |
|
|
|
public QPMESResponse qpmes068(@RequestBody JSONObject notice) { |
|
|
|
log.info("qpmes068服务被调用,输入参数:" + notice.toString()); |
|
|
|
QPMESResponse qpmes068Response = new QPMESResponse(); |
|
|
|
QPMESResponseBody qpmes068ResponseBody = new QPMESResponseBody(); |
|
|
|
List<QPMESResponseBody> qpmes068ResponseBodyArrayList=new ArrayList<>(); |
|
|
|
Head head=new Head(); |
|
|
|
head.setDEST_SYSTEM("WMS"); |
|
|
|
head.setINTF_ID("QPMES118"); |
|
|
|
head.setSRC_MSGID(IdUtil.simpleUUID()); |
|
|
|
head.setSRC_SYSTEM("AGV"); |
|
|
|
qpmes118Response.setHEAD(head); |
|
|
|
log.info("QPMES118服务被调用{}",qpmes118Response.toString()); |
|
|
|
return qpmes118Response; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 以托盘维度进行从晶棒库到回温的出库 |
|
|
|
* MES告诉LMS需要出库的托盘信息 |
|
|
|
* 调用时机:随时 |
|
|
|
* @param notice |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@PostMapping("/QPMES155") |
|
|
|
@Log(value = "QPMES155") |
|
|
|
@ApiOperation("QPMES155") |
|
|
|
@SaIgnore |
|
|
|
public QPMES155Response QPMES155(@RequestBody JSONObject notice) { |
|
|
|
log.info("QPMES155服务被调用,输入参数:" + notice.toString()); |
|
|
|
QPMES155Response qpmes155Response =new QPMES155Response(); |
|
|
|
QPMES155Request qpmes155Request=notice.toJavaObject(QPMES155Request.class); |
|
|
|
log.info(qpmes155Request.toString()); |
|
|
|
|
|
|
|
if(ObjectUtil.isNotEmpty(qpmes155Request)) { |
|
|
|
for (QPMES155RequestBody temp : qpmes155Request.getBODY()) { |
|
|
|
try { |
|
|
|
Workorder workorder = new Workorder(); |
|
|
|
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); |
|
|
|
}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) { |
|
|
|
log.error("工单已存在导致新增失败,{}{}", e, e.getMessage()); |
|
|
|
head.setDest_system("wms"); |
|
|
|
head.setIntf_id("qpmes068"); |
|
|
|
head.setSrc_msgid(IdUtil.simpleUUID()); |
|
|
|
head.setSrc_system("lms"); |
|
|
|
qpmes068Response.setHead(head); |
|
|
|
try { |
|
|
|
for(QPMES068RequestBody QPMES068RequestBody:notice.toJavaObject(QPMES068Request.class).getBody()) { |
|
|
|
MesMoveMaterial material = new MesMoveMaterial(); |
|
|
|
//实体类
|
|
|
|
material.copyFrom(QPMES068RequestBody); |
|
|
|
String product_name = material.getProduct_name(); |
|
|
|
String batch = material.getBatch(); |
|
|
|
String sect_code = material.getSect_code(); |
|
|
|
LambdaQueryWrapper<MesMoveMaterial> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
queryWrapper.eq(ObjectUtil.isNotEmpty(product_name),MesMoveMaterial::getProduct_name, product_name); |
|
|
|
queryWrapper.eq(ObjectUtil.isNotEmpty(batch),MesMoveMaterial::getBatch, batch); |
|
|
|
queryWrapper.eq(ObjectUtil.isNotEmpty(sect_code),MesMoveMaterial::getSect_code, sect_code); |
|
|
|
MesMoveMaterial entity = mesMoveMaterialMapper.selectOne(queryWrapper); |
|
|
|
if (ObjectUtil.isEmpty(entity)){ |
|
|
|
//新增
|
|
|
|
material.setReturn_status("0"); |
|
|
|
material.setCreate_time(DateUtil.now()); |
|
|
|
mesMoveMaterialMapper.insert(material); |
|
|
|
}else{ |
|
|
|
LambdaUpdateWrapper<MesMoveMaterial> updateWrapper = new LambdaUpdateWrapper<>(); |
|
|
|
updateWrapper.eq(ObjectUtil.isNotEmpty(sect_code),MesMoveMaterial::getSect_code, sect_code); |
|
|
|
updateWrapper.eq(ObjectUtil.isNotEmpty(product_name),MesMoveMaterial::getProduct_name, product_name); |
|
|
|
updateWrapper.eq(ObjectUtil.isNotEmpty(batch),MesMoveMaterial::getBatch, batch); |
|
|
|
//更新
|
|
|
|
material.setReturn_status(entity.getReturn_status()); |
|
|
|
material.setCreate_time(entity.getCreate_time()); |
|
|
|
material.setUpdate_time(DateUtil.now()); |
|
|
|
mesMoveMaterialMapper.update(material,updateWrapper); |
|
|
|
} |
|
|
|
} |
|
|
|
qpmes068ResponseBody.setMessage("接受移库任务信息成功"); |
|
|
|
qpmes068ResponseBody.setStatus("S"); |
|
|
|
qpmes068ResponseBodyArrayList.add(qpmes068ResponseBody); |
|
|
|
qpmes068Response.setBody(qpmes068ResponseBodyArrayList); |
|
|
|
log.info("QPMES068服务被调用,返回参数:" + JSON.toJSONString(qpmes068Response)); |
|
|
|
return qpmes068Response; |
|
|
|
}catch (Exception e){ |
|
|
|
qpmes068ResponseBody.setMessage("接受移库任务信息失败:"+e.getMessage()); |
|
|
|
qpmes068ResponseBody.setStatus("E"); |
|
|
|
qpmes068ResponseBodyArrayList.add(qpmes068ResponseBody); |
|
|
|
qpmes068Response.setBody(qpmes068ResponseBodyArrayList); |
|
|
|
log.error("QPMES068服务异常:"+ JSON.toJSONString(qpmes068Response)); |
|
|
|
return qpmes068Response; |
|
|
|
} |
|
|
|
Head head=new Head(); |
|
|
|
head.setDEST_SYSTEM("WMS"); |
|
|
|
head.setINTF_ID("QPMES155"); |
|
|
|
head.setSRC_MSGID(IdUtil.simpleUUID()); |
|
|
|
head.setSRC_SYSTEM("AGV"); |
|
|
|
QPMES155Data qpmes155Data=new QPMES155Data(); |
|
|
|
qpmes155Data.setHEAD(head); |
|
|
|
qpmes155Response.setData(qpmes155Data); |
|
|
|
qpmes155Response.setMsg("数据接收成功"); |
|
|
|
qpmes155Response.setCode("0"); |
|
|
|
log.info("QPMES155服务被调用{}",qpmes155Response.toString()); |
|
|
|
return qpmes155Response; |
|
|
|
} |
|
|
|
} |
|
|
|