|
@ -10,10 +10,15 @@ import org.nl.common.exception.BadRequestException; |
|
|
import org.nl.config.MapOf; |
|
|
import org.nl.config.MapOf; |
|
|
import org.nl.wms.ext.service.WmsToAcsService; |
|
|
import org.nl.wms.ext.service.WmsToAcsService; |
|
|
import org.nl.wms.ext.service.dto.to.BaseResponse; |
|
|
import org.nl.wms.ext.service.dto.to.BaseResponse; |
|
|
|
|
|
import org.nl.wms.mes.domain.QPMES062Request; |
|
|
|
|
|
import org.nl.wms.mes.domain.QPMES065Request; |
|
|
|
|
|
import org.nl.wms.mes.webservice.WebServiceClient; |
|
|
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.sch.group.service.ISchBaseVehiclematerialgroupService; |
|
|
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService; |
|
|
import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup; |
|
|
import org.nl.wms.sch.group.service.dao.SchBaseVehiclematerialgroup; |
|
|
|
|
|
import org.nl.wms.sch.material.service.dao.Material; |
|
|
|
|
|
import org.nl.wms.sch.material.service.dao.mapper.MaterialMapper; |
|
|
import org.nl.wms.sch.point.service.ISchBasePointService; |
|
|
import org.nl.wms.sch.point.service.ISchBasePointService; |
|
|
import org.nl.wms.sch.point.service.dao.SchBasePoint; |
|
|
import org.nl.wms.sch.point.service.dao.SchBasePoint; |
|
|
import org.nl.wms.sch.task.service.ISchBaseTaskService; |
|
|
import org.nl.wms.sch.task.service.ISchBaseTaskService; |
|
@ -65,7 +70,10 @@ public class YCLCKTask extends AbstractTask { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private PointMapper pointMapper; |
|
|
private PointMapper pointMapper; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private WmsToAcsService wmsToAcsService; |
|
|
private WebServiceClient webServiceClient; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private MaterialMapper materialMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
// @Transactional(rollbackFor = Exception.class)
|
|
|
// @Transactional(rollbackFor = Exception.class)
|
|
@ -76,7 +84,17 @@ public class YCLCKTask extends AbstractTask { |
|
|
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>() |
|
|
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>() |
|
|
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE)); |
|
|
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE)); |
|
|
for (SchBaseTask task : tasks) { |
|
|
for (SchBaseTask task : tasks) { |
|
|
SchBasePoint point = findNextPoint(task); |
|
|
JSONObject jsonObject = JSONObject.parseObject(task.getExt_group_data()); |
|
|
|
|
|
String region; |
|
|
|
|
|
if ("0".equals(jsonObject.getString("mode"))) { |
|
|
|
|
|
region = "HW"; |
|
|
|
|
|
} else if ("1".equals(jsonObject.getString("mode"))) { |
|
|
|
|
|
region = "HWK"; |
|
|
|
|
|
} else { |
|
|
|
|
|
log.error("任务:" + task.getTask_code() + "回温mode:" + jsonObject.getString("mode") + "模式不正确!"); |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
SchBasePoint point = findNextPoint(task, region); |
|
|
if (ObjectUtil.isEmpty(point)) { |
|
|
if (ObjectUtil.isEmpty(point)) { |
|
|
task.setRemark("未找到所需点位!"); |
|
|
task.setRemark("未找到所需点位!"); |
|
|
taskService.update(task); |
|
|
taskService.update(task); |
|
@ -88,7 +106,7 @@ public class YCLCKTask extends AbstractTask { |
|
|
task.setPoint_code2(point.getPoint_code()); |
|
|
task.setPoint_code2(point.getPoint_code()); |
|
|
task.setTask_status(TaskStatus.CREATED.getCode()); |
|
|
task.setTask_status(TaskStatus.CREATED.getCode()); |
|
|
task.setRemark(""); |
|
|
task.setRemark(""); |
|
|
SchBasePoint schBasePoint= pointService.getOne(new LambdaQueryWrapper<SchBasePoint>() |
|
|
SchBasePoint schBasePoint = pointService.getOne(new LambdaQueryWrapper<SchBasePoint>() |
|
|
.eq(SchBasePoint::getPoint_code, task.getPoint_code1())); |
|
|
.eq(SchBasePoint::getPoint_code, task.getPoint_code1())); |
|
|
task.setVehicle_code(schBasePoint.getVehicle_code()); |
|
|
task.setVehicle_code(schBasePoint.getVehicle_code()); |
|
|
task.setVehicle_code2(schBasePoint.getVehicle_code2()); |
|
|
task.setVehicle_code2(schBasePoint.getVehicle_code2()); |
|
@ -106,22 +124,18 @@ public class YCLCKTask extends AbstractTask { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* todo 待确认怎么区分普通回温和快速回温 |
|
|
|
|
|
* todo 设置回温时间 |
|
|
|
|
|
* |
|
|
|
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
private SchBasePoint findNextPoint(SchBaseTask task) { |
|
|
private SchBasePoint findNextPoint(SchBaseTask task, String regionCode) { |
|
|
String regionCode = "HW"; |
|
|
List<SchBasePoint> schBasePointList = pointMapper.findPointByRegion(regionCode, "0"); |
|
|
List<SchBasePoint> schBasePointList = pointMapper.findPointByRegion(regionCode,"0"); |
|
|
|
|
|
for (SchBasePoint schBasePoint : schBasePointList) { |
|
|
for (SchBasePoint schBasePoint : schBasePointList) { |
|
|
//已锁定直接返回
|
|
|
//已锁定直接返回
|
|
|
if(task.getTask_code().equals(schBasePoint.getIng_task_code())){ |
|
|
if (task.getTask_code().equals(schBasePoint.getIng_task_code())) { |
|
|
return schBasePoint; |
|
|
return schBasePoint; |
|
|
} |
|
|
} |
|
|
if (schBasePoint.getIs_used() |
|
|
if (schBasePoint.getIs_used() |
|
|
&& schBasePoint.getVehicle_qty() ==0) { |
|
|
&& schBasePoint.getVehicle_qty() == 0) { |
|
|
log.info("原材料出库任务找到当前符合条件的缓存区位置{}",schBasePoint.getPoint_code()); |
|
|
log.info("原材料出库任务找到当前符合条件的缓存区位置{}", schBasePoint.getPoint_code()); |
|
|
return schBasePoint; |
|
|
return schBasePoint; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -129,7 +143,7 @@ public class YCLCKTask extends AbstractTask { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* todo 任务完成设置完成时间为开始固化时间 |
|
|
* 任务完成设置完成时间为开始固化时间 |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
// @Transactional(rollbackFor = Exception.class)
|
|
|
// @Transactional(rollbackFor = Exception.class)
|
|
@ -152,8 +166,8 @@ public class YCLCKTask extends AbstractTask { |
|
|
taskObj.setRemark("执行中"); |
|
|
taskObj.setRemark("执行中"); |
|
|
} |
|
|
} |
|
|
if (status.equals(TaskStatus.FINISHED)) { // 完成
|
|
|
if (status.equals(TaskStatus.FINISHED)) { // 完成
|
|
|
String vehicleCode=taskObj.getVehicle_code(); |
|
|
String vehicleCode = taskObj.getVehicle_code(); |
|
|
String vehicleCode2= taskObj.getVehicle_code2(); |
|
|
String vehicleCode2 = taskObj.getVehicle_code2(); |
|
|
SchBaseVehiclematerialgroup one = vehiclematerialgroupService.getOne(new LambdaQueryWrapper<SchBaseVehiclematerialgroup>() |
|
|
SchBaseVehiclematerialgroup one = vehiclematerialgroupService.getOne(new LambdaQueryWrapper<SchBaseVehiclematerialgroup>() |
|
|
.eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicleCode) |
|
|
.eq(SchBaseVehiclematerialgroup::getVehicle_code, vehicleCode) |
|
|
.eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status, |
|
|
.eq(SchBaseVehiclematerialgroup::getGroup_bind_material_status, |
|
@ -166,6 +180,7 @@ public class YCLCKTask extends AbstractTask { |
|
|
one.setPoint_name(endPointObj.getPoint_name()); |
|
|
one.setPoint_name(endPointObj.getPoint_name()); |
|
|
one.setMove_way(one.getMove_way() == null ? "" : (one.getMove_way() + " -> ") + endPointObj.getPoint_code()); |
|
|
one.setMove_way(one.getMove_way() == null ? "" : (one.getMove_way() + " -> ") + endPointObj.getPoint_code()); |
|
|
one.setGroup_bind_material_status(GroupBindMaterialStatusEnum.BOUND.getValue()); |
|
|
one.setGroup_bind_material_status(GroupBindMaterialStatusEnum.BOUND.getValue()); |
|
|
|
|
|
one.setInstorage_time(DateUtil.now()); |
|
|
one.setUpdate_id(GeneralDefinition.ACS_ID); |
|
|
one.setUpdate_id(GeneralDefinition.ACS_ID); |
|
|
one.setUpdate_name(GeneralDefinition.ACS_NAME); |
|
|
one.setUpdate_name(GeneralDefinition.ACS_NAME); |
|
|
one.setUpdate_time(DateUtil.now()); |
|
|
one.setUpdate_time(DateUtil.now()); |
|
@ -183,6 +198,7 @@ public class YCLCKTask extends AbstractTask { |
|
|
one.setPoint_name(endPointObj.getPoint_name()); |
|
|
one.setPoint_name(endPointObj.getPoint_name()); |
|
|
one.setMove_way(one.getMove_way() == null ? "" : (one.getMove_way() + " -> ") + endPointObj.getPoint_code()); |
|
|
one.setMove_way(one.getMove_way() == null ? "" : (one.getMove_way() + " -> ") + endPointObj.getPoint_code()); |
|
|
one.setGroup_bind_material_status(GroupBindMaterialStatusEnum.BOUND.getValue()); |
|
|
one.setGroup_bind_material_status(GroupBindMaterialStatusEnum.BOUND.getValue()); |
|
|
|
|
|
one.setInstorage_time(DateUtil.now()); |
|
|
one.setUpdate_id(GeneralDefinition.ACS_ID); |
|
|
one.setUpdate_id(GeneralDefinition.ACS_ID); |
|
|
one.setUpdate_name(GeneralDefinition.ACS_NAME); |
|
|
one.setUpdate_name(GeneralDefinition.ACS_NAME); |
|
|
one.setUpdate_time(DateUtil.now()); |
|
|
one.setUpdate_time(DateUtil.now()); |
|
@ -206,9 +222,29 @@ public class YCLCKTask extends AbstractTask { |
|
|
taskObj.setGroup_id(one.getGroup_id()); |
|
|
taskObj.setGroup_id(one.getGroup_id()); |
|
|
taskObj.setRemark("任务完成"); |
|
|
taskObj.setRemark("任务完成"); |
|
|
try { |
|
|
try { |
|
|
//todo 出库成功后上报mes
|
|
|
//todo 待确认具体传值
|
|
|
}catch (Exception e){ |
|
|
List<Material> materialList = materialMapper.selectList(new LambdaQueryWrapper<Material>() |
|
|
log.error("原材料出库上报MES失败{}",e.getMessage(),e); |
|
|
.eq(Material::getPalletSN, taskObj.getVehicle_code2()) |
|
|
|
|
|
.eq(Material::getGroup_bind_material_status, GroupBindMaterialStatusEnum.BOUND.getValue())); |
|
|
|
|
|
if (ObjectUtil.isNotEmpty(materialList)) { |
|
|
|
|
|
PdmBdWorkorder pdmBdWorkorder=workorderService.getOne(new LambdaQueryWrapper<PdmBdWorkorder>() |
|
|
|
|
|
.eq(PdmBdWorkorder::getMaterial_code, materialList.get(0).getProductName())); |
|
|
|
|
|
String url = "http://11.111.11.111:9556/xxx/ws/powerAlarmWs"; |
|
|
|
|
|
QPMES065Request qpmes065Request = new QPMES065Request(); |
|
|
|
|
|
qpmes065Request.setDEST_SYSTEM("1"); |
|
|
|
|
|
qpmes065Request.setINTF_ID("1"); |
|
|
|
|
|
qpmes065Request.setSRC_MSGID("1"); |
|
|
|
|
|
qpmes065Request.setSRC_SYSTEM("1"); |
|
|
|
|
|
qpmes065Request.setMoname(pdmBdWorkorder.getWorkorder_code()); |
|
|
|
|
|
qpmes065Request.setLotSN(materialList.get(0).getPalletSN()); |
|
|
|
|
|
qpmes065Request.setQty(String.valueOf(one.getMaterial_qty())); |
|
|
|
|
|
qpmes065Request.setSiteName(materialList.get(0).getLocationCode()); |
|
|
|
|
|
webServiceClient.callWebService(qpmes065Request, url); |
|
|
|
|
|
} else { |
|
|
|
|
|
log.error("当前子托盘:" + taskObj.getVehicle_code2() + "不存在未解绑的物料信息,请确认!"); |
|
|
|
|
|
} |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
log.error("原材料出库上报MES失败{}", e.getMessage(), e); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if (status.equals(TaskStatus.CANCELED)) { // 取消
|
|
|
if (status.equals(TaskStatus.CANCELED)) { // 取消
|
|
@ -239,7 +275,7 @@ public class YCLCKTask extends AbstractTask { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
protected void feedbackTaskState(JSONObject param,SchBaseTask schBaseTask, BaseResponse result) { |
|
|
protected void feedbackTaskState(JSONObject param, SchBaseTask schBaseTask, BaseResponse result) { |
|
|
//该场景无需重算等待点
|
|
|
//该场景无需重算等待点
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|