|
|
@ -13,7 +13,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.nl.common.domain.query.PageQuery; |
|
|
|
import org.nl.wms.ext.service.AcsToWmsService; |
|
|
|
import org.nl.wms.ext.service.dto.to.BaseResponse; |
|
|
|
import org.nl.wms.pda.service.PdaService; |
|
|
|
import org.nl.wms.pda.service.dao.vo.PdaResponseVo; |
|
|
|
import org.nl.wms.pdm.service.dao.PointDetailAdd; |
|
|
|
import org.nl.wms.sch.point.service.ISchBasePointService; |
|
|
|
import org.nl.wms.sch.point.service.dao.SchBasePoint; |
|
|
@ -130,8 +132,23 @@ public class WorkorderServiceImpl extends ServiceImpl<WorkorderMapper, Workorder |
|
|
|
List<String> pointCodes = pointDetailAdd.getPointCodes(); |
|
|
|
//下发状态
|
|
|
|
String status = pointDetailAdd.getStatus(); |
|
|
|
//查询是否有目的空点位
|
|
|
|
List<SchBasePoint> nextList = schBasePointService.list(new LambdaQueryWrapper<SchBasePoint>() |
|
|
|
.eq(SchBasePoint::getRegion_code, "YL") |
|
|
|
.eq(SchBasePoint::getIs_used, true) |
|
|
|
.eq(SchBasePoint::getVehicle_qty, 0) |
|
|
|
.and(slam -> slam.isNull(SchBasePoint::getVehicle_code2) |
|
|
|
.or() |
|
|
|
.eq(SchBasePoint::getVehicle_code2, "")) |
|
|
|
.and(slam -> slam.isNull(SchBasePoint::getIng_task_code) |
|
|
|
.or() |
|
|
|
.eq(SchBasePoint::getIng_task_code, ""))); |
|
|
|
if("1".equals(status)){ |
|
|
|
for(String pointCode : pointCodes){ |
|
|
|
if(nextList.size()==0){ |
|
|
|
log.info("原料库存区无可用点位,取消后续循环"); |
|
|
|
return; |
|
|
|
} |
|
|
|
//查询当前点位最新信息
|
|
|
|
SchBasePoint schBasePoint =schBasePointService.getOne(new LambdaQueryWrapper<SchBasePoint>() |
|
|
|
.eq(SchBasePoint::getIs_used, true) |
|
|
@ -143,23 +160,10 @@ public class WorkorderServiceImpl extends ServiceImpl<WorkorderMapper, Workorder |
|
|
|
.eq(SchBasePoint::getIng_task_code, "") |
|
|
|
)); |
|
|
|
if(ObjectUtil.isNull(schBasePoint)){ |
|
|
|
log.info("移库点位异常:"+pointCode); |
|
|
|
continue; |
|
|
|
} |
|
|
|
//查询是否有目的空点位
|
|
|
|
SchBasePoint nexSchBasePoint = schBasePointService.getOne(new LambdaQueryWrapper<SchBasePoint>() |
|
|
|
.eq(SchBasePoint::getRegion_code, "YL") |
|
|
|
.eq(SchBasePoint::getIs_used, true) |
|
|
|
.eq(SchBasePoint::getVehicle_qty, 0) |
|
|
|
.and(slam -> slam.isNull(SchBasePoint::getVehicle_code2) |
|
|
|
.or() |
|
|
|
.eq(SchBasePoint::getVehicle_code2, "")) |
|
|
|
.and(slam -> slam.isNull(SchBasePoint::getIng_task_code) |
|
|
|
.or() |
|
|
|
.eq(SchBasePoint::getIng_task_code, ""))); |
|
|
|
if(ObjectUtil.isNull(nexSchBasePoint)){ |
|
|
|
log.info("原料库存区无可用点位,取消后续循环"); |
|
|
|
break; |
|
|
|
} |
|
|
|
SchBasePoint nexSchBasePoint = nextList.get(0); |
|
|
|
JSONObject param = new JSONObject(); |
|
|
|
param.put("start_point", schBasePoint.getPoint_code()); |
|
|
|
param.put("next_point", nexSchBasePoint.getPoint_code()); |
|
|
@ -169,12 +173,19 @@ public class WorkorderServiceImpl extends ServiceImpl<WorkorderMapper, Workorder |
|
|
|
param.put("vehicle_code",schBasePoint.getVehicle_code()); |
|
|
|
param.put("vehicle_code2",schBasePoint.getVehicle_code2()); |
|
|
|
param.put("device_code", schBasePoint.getPoint_code()); |
|
|
|
acsToWmsService.pdaApply(param); |
|
|
|
//发起任务时先把点位占用,防止发起重复任务
|
|
|
|
schBasePoint.setIng_task_code("1"); |
|
|
|
pointService.update(schBasePoint); |
|
|
|
nexSchBasePoint.setIng_task_code("1"); |
|
|
|
pointService.update(nexSchBasePoint); |
|
|
|
|
|
|
|
BaseResponse baseResponse= acsToWmsService.pdaApply(param); |
|
|
|
Integer resultCode = baseResponse.getCode(); |
|
|
|
if(resultCode.equals(200)){ |
|
|
|
//发起任务时先把点位占用,防止发起重复任务
|
|
|
|
schBasePoint.setIng_task_code("1"); |
|
|
|
pointService.update(schBasePoint); |
|
|
|
nexSchBasePoint.setIng_task_code("1"); |
|
|
|
pointService.update(nexSchBasePoint); |
|
|
|
nextList.remove(0); |
|
|
|
}else{ |
|
|
|
log.info(baseResponse.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -216,11 +227,20 @@ public class WorkorderServiceImpl extends ServiceImpl<WorkorderMapper, Workorder |
|
|
|
param.put("batch", DateUtil.format(DateUtil.date(), "yyyyMMddHHmmss")); |
|
|
|
param.put("user_id","1"); |
|
|
|
param.put("person_name", "管理员"); |
|
|
|
pdaService.yclck(param); |
|
|
|
//更新对应载具工单状态为已生成任务,不可在工单页面取消
|
|
|
|
//pdm_bd_workorder_two任务生成时,status改为2
|
|
|
|
this.update(vehicle_code2,"2"); |
|
|
|
tcmn--; |
|
|
|
param.put("request_medthod_code", "YCLCKTask"); |
|
|
|
param.put("request_medthod_name", "原材料出库"); |
|
|
|
param.put("device_code",param.getString("start_point")); |
|
|
|
BaseResponse baseResponse=acsToWmsService.pdaApply(param); |
|
|
|
Integer resultCode = baseResponse.getCode(); |
|
|
|
if(resultCode.equals(200)){ |
|
|
|
//更新对应载具工单状态为已生成任务,不可在工单页面取消
|
|
|
|
//pdm_bd_workorder_two任务生成时,status改为2
|
|
|
|
this.update(vehicle_code2,"2"); |
|
|
|
tcmn--; |
|
|
|
}else{ |
|
|
|
log.info(baseResponse.toString()); |
|
|
|
continue; |
|
|
|
} |
|
|
|
}else{ |
|
|
|
break; |
|
|
|
} |
|
|
|