@@ -1,5 +1,6 @@
package org.nl.wms.ext.acs.service.impl ;
import cn.hutool.core.collection.CollectionUtil ;
import cn.hutool.core.date.DateUtil ;
import cn.hutool.core.util.IdUtil ;
import cn.hutool.core.util.NumberUtil ;
@@ -7,7 +8,6 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil ;
import com.alibaba.fastjson.JSONArray ;
import com.alibaba.fastjson.JSONObject ;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper ;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper ;
import com.google.common.collect.Interner ;
import com.google.common.collect.Interners ;
@@ -17,18 +17,12 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils ;
import org.apache.commons.lang3.StringUtils ;
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt ;
import org.nl.b_lms.sch.point.dao.mapper.BstIvtPackageinfoivtMapper ;
import org.nl.b_lms.sch.point.dao.mapper.SchBasePointMapper ;
import org.nl.b_lms.sch.point.service.IbstIvtPackageinfoivtService ;
import org.nl.b_lms.sch.point.service.IschBasePointService ;
import org.nl.b_lms.sch.point.service.impl.BstIvtPackageinfoivtServiceImpl ;
import org.nl.b_lms.sch.point.service.impl.SchBasePointServiceImpl ;
import org.nl.b_lms.sch.task.dao.SchBaseTask ;
import org.nl.b_lms.sch.task.dao.mapper.SchBaseTaskMapper ;
import org.nl.b_lms.sch.task.service.IschBaseTaskService ;
import org.nl.b_lms.sch.task.service.impl.SchBaseTaskServiceImpl ;
import org.nl.b_lms.sch.tasks.TwoEmpExcepTask ;
import org.nl.b_lms.sch.tasks.packingA rea.MzhcwTask ;
import org.nl.b_lms.sch.tasks.first_floor_a rea.MzhcwTask ;
import org.nl.b_lms.storage_manage.ios.enums.IOSEnum ;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.InBussManageService ;
import org.nl.b_lms.storage_manage.ios.service.iostorInv.util.service.InVehicleManageService ;
@@ -1719,19 +1713,18 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
*/
@Override
public JSONObject sendProductToFirstFloor ( JSONObject whereJson ) {
log . info ( " sendProductToFirstFloor--------------------------: " + whereJson . toString ( ) ) ;
JSONObject result = new JSONObject ( ) ;
String task_code1 = whereJson . getString ( " task_code1 " ) ;
SchBaseTask schBaseTask = taskService . getOne ( new LambdaUpdateWrapper < SchBaseTask > ( ) . eq ( StringUtils . isNotBlank ( task_code1 ) , SchBaseTask : : getTask_code , task_code1 ) ) ;
if ( schBaseTask = = null ) {
throw new BadRequestException ( " 接口sendProductToFirstFloor, 任务号为空! " ) ;
}
// JSONObject whereJson 应该传子卷信息,子卷等级,载具号,任务号,车间号
// JSONObject whereJson 应该传子卷号,设备号,车间号
// 先查询满轴缓存位是否有可用库位,有创建搬运任务
// 任务完成创建空载具补充到输送线桁架任务, 子卷搬运至待检区或或管制区agv任务
// 如果满轴位没有可用的空点位,先创建一个桁架任务但是不下发,等这边空出来点位,判断是否有这种桁架任务然后补发;
// 这个情况是有agv任务在搬去待检区或管制区的路上, 还没有更新任务状态; 需要查询是否有这种任务, 等这个任务更新完后,
// 再补发之前创建的输送线到满轴缓存位任务;
log . info ( " sendProductToFirstFloor--------------------------: " + whereJson . toString ( ) ) ;
JSONObject result = new JSONObject ( ) ;
if ( StringUtils . isBlank ( whereJson . getString ( " device_code " ) ) | | StringUtils . isBlank ( whereJson . getString ( " material_barcode " ) ) ) {
throw new BadRequestException ( " 接口sendProductToFirstFloor, 任务号或子卷号参数为空! " ) ;
}
//1.查询满轴缓存位是否有空位
List < BstIvtPackageinfoivt > bstIvtPackageinfoivtList = packageinfoivtService
. list ( new LambdaUpdateWrapper < BstIvtPackageinfoivt > ( )
@@ -1739,40 +1732,52 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
. eq ( BstIvtPackageinfoivt : : getIs_used , PackageInfoIvtEnum . IS_USED . code ( " 启用 " ) )
. eq ( BstIvtPackageinfoivt : : getIvt_status , PackageInfoIvtEnum . IVT_STATUS . code ( " 空 " ) ) . orderByAsc ( BstIvtPackageinfoivt : : getSort_seq ) ) ;
JSONObject jo = new JSONObject ( ) ;
//todo 添加任务类型
jo . put ( " task_type " , PackageInfoIvtEnum . TASK_TYPE . code ( " 输送线->满轴缓存位 " ) ) ;
//一楼到输送线任务的目标点为当前位置,为起点
jo . put ( " point_code1 " , schBaseTask . getPoint_code2 ( ) ) ;
//任意一个满轴缓存位为终点
jo . put ( " point_code2 " , bstIvtPackageinfoivtList . get ( 0 ) . getPoint_code ( ) ) ;
//获取子卷号
jo . put ( " vehicle _code" , whereJson . getString ( " container_name1 " ) ) ;
jo . put ( " acs_task_type " , PackageInfoIvtEnum . ACS_TASK_TYPE . code ( " 桁架任务 " ) ) ;
//todo 获取子卷号,子卷号就是载具号?
jo . put ( " vehicle_code " , whereJson . getString ( " material_barcode " ) ) ;
//2.创建输送线->满轴位桁架任务,
String point_code1 = whereJson . getString ( " device_code " ) ;
jo . put ( " point _code1 " , point_code1 ) ;
if ( CollectionUtils . isNotEmpty ( bstIvtPackageinfoivtList ) ) {
jo . put ( " isSend " , true ) ;
//任意一个满轴缓存位为终点
jo . put ( " point_code2 " , bstIvtPackageinfoivtList . get ( 0 ) . getPoint_code ( ) ) ;
jo . put ( " is_send " , true ) ;
mzhcwTask . createTask ( jo ) ;
result . put ( " status " , HttpStatus . OK . value ( ) ) ;
result . put ( " message " , " 反馈成功! " ) ;
return result ;
} else {
//满轴缓存位点位
//3. 满轴缓存位点位,查找正在搬运到待检区的任务
List < BstIvtPackageinfoivt > packageinfoivtList = packageinfoivtService
. list ( new LambdaUpdateWrapper < BstIvtPackageinfoivt > ( )
. eq ( BstIvtPackageinfoivt : : getPoint_status , PackageInfoIvtEnum . POINT_STATUS . code ( " 满轴缓存位 " ) ) ) ;
//todo 查找正在搬运到待检区的任务,假设只有一 个,现场其实有多个车正在搬运过去
//todo 查找正在起点为满轴缓存位点位,且执行中搬运到待检区或管制区的任务,如果有一个或多 个,现场其实有多个车正在搬运过去
List < SchBaseTask > taskList = taskService . list ( new LambdaUpdateWrapper < SchBaseTask > ( )
//执行中
. nested (
r - > r . eq ( SchBaseTask : : getTask_type , PackageInfoIvtEnum . TASK_TYPE . code ( " 满轴缓存位->待检区 " ) )
. or ( ) . eq ( SchBaseTask : : getTask_type , PackageInfoIvtEnum . TASK_TYPE . code ( " 满轴缓存位->管制区 " ) ) )
. eq ( SchBaseTask : : getTask_status , TaskStatusEnum . EXECUTING . getCode ( ) )
. and (
r - > r . in ( SchBaseTask : : getPoint_code1 , packageinfoivtList )
) ) ;
// 如果满轴位没有可用的空点位,先创建一个桁架任务但是不下发,等这边空出来点位,判断是否有这种桁架任务然后补发;
//4.满轴缓存位无空闲库位,且无执行中搬运到待检区或管制区的任务,则报错!
if ( CollectionUtils . isEmpty ( taskList ) ) {
throw new BadRequestException ( " 接口sendProductToFirstFloor, 满轴缓存位暂无空闲库位! " ) ;
}
// 5.如果满轴位没有可用的空点位,先创建一个桁架任务但是不下发,等这边空出来点位,判断是否有这种桁架任务然后补发;
// 创建前先判断是否有已创建相同任务
List < SchBaseTask > existTaskList = taskService . list ( new LambdaUpdateWrapper < SchBaseTask > ( )
//是否存在已创建的目标点相同的未下发的任务
. eq ( SchBaseTask : : getPoint_code2 , t askList . get ( 0 ) . getPoint_c ode1 ( ) )
. eq ( SchBaseTask : : getTask_status , TaskStatusEnum . START_AND_POINT . getCode ( ) ) ) ;
. eq ( SchBaseTask : : getPoint_code1 , point_code1 )
. eq ( SchBaseTask : : getTask_status , T askStatusEnum . SURE_START . getC ode ( ) ) ) ;
//6.如果有就不创建,没有就创建
// 等这边空出来点位,也就是满轴位->待检区或管制区任务完成后,再补发;
if ( CollectionUtils . isEmpty ( existTaskList ) ) {
jo . put ( " point_code2 " , taskList . get ( 0 ) . getPoint_code1 ( ) ) ;
jo . put ( " isSend " , false ) ;
//暂时只确定起点,正在搬运的满轴位->待检区的点位,暂不作为终点
//jo.put("point_code2", taskList.get(0).getPoint_code1()) ;
jo . put ( " task_status " , TaskStatusEnum . SURE_START . getCode ( ) ) ;
jo . put ( " is_send " , false ) ;
mzhcwTask . createTask ( jo ) ;
}
result . put ( " status " , HttpStatus . OK . value ( ) ) ;
@@ -1822,7 +1827,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
} else if ( type . equals ( IOSEnum . ACSTOLMS_TYPE . code ( " 空盘入库 " ) ) ) {
// 2-空盘入库
whereJson . put ( " vehicle_type " , whereJson . getString ( " container_type " ) ) ;
whereJson . put ( " vehicle_type " , whereJson . getString ( " container_type " ) ) ;
inVehicleManageService . inVehicle ( whereJson ) ;
} else if ( type . equals ( IOSEnum . ACSTOLMS_TYPE . code ( " 空盘出库 " ) ) ) {
@@ -1832,7 +1837,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
throw new BadRequestException ( " 载具类型不能为空! " ) ;
}
whereJson . put ( " vehicle_type " , whereJson . getString ( " container_type " ) ) ;
whereJson . put ( " vehicle_type " , whereJson . getString ( " container_type " ) ) ;
outVehicleManageService . outVehicle ( whereJson ) ;
} else if ( type . equals ( IOSEnum . ACSTOLMS_TYPE . code ( " 异常处理位 " ) ) ) {