@@ -19,16 +19,12 @@ import com.ruoyi.api.domain.agv.genAgvSchedulingTask.PositionCodeData;
import com.ruoyi.api.domain.wcs2wms.JobParam ;
import com.ruoyi.api.domain.wcs2wms.ReceiveJob ;
import com.ruoyi.api.domain.wcs2wms.ResponseResult ;
import com.ruoyi.api.domain.wcs2wms.exception.TaskExceptionReceive ;
import com.ruoyi.api.domain.wcs2wms.exception.TaskExceptionRequest ;
import com.ruoyi.api.domain.wcs2wms.stockout.StockoutReceive ;
import com.ruoyi.api.service.IApiService ;
import com.ruoyi.bas.cargospace.domain.BasCargoSpace ;
import com.ruoyi.bas.cargospace.service.IBasCargoSpaceService ;
import com.ruoyi.bas.port.domain.WcsPort ;
import com.ruoyi.bas.port.service.IWcsPortService ;
import com.ruoyi.common.GoodsType ;
import com.ruoyi.common.TaskType ;
import com.ruoyi.common.core.domain.AjaxResult ;
import com.ruoyi.common.utils.DateUtils ;
import com.ruoyi.job.domain.MydoJob ;
@@ -80,7 +76,7 @@ public class ApiServiceImpl implements IApiService {
*/
@Override
public RequestLog finishMydoJob ( Map < String , Object > param ) {
return requestLogService . getRequestLog ( WMS_TASK _FINISH , " 任务完成上报 " , JSONUtil . toJsonStr ( param ) ) ;
return requestLogService . getRequestLog ( WMS_JOB _FINISH_URL , " 任务完成上报 " , JSONUtil . toJsonStr ( param ) ) ;
}
@@ -91,7 +87,7 @@ public class ApiServiceImpl implements IApiService {
*/
@Override
public AjaxResult reAssign ( JobParam jobParam ) {
RequestLog requestLog = requestLogService . getRequestLog ( RE_ASSIGN_URL , " 重新分配货位 " , JSONUtil . toJsonStr ( jobParam ) ) ;
RequestLog requestLog = requestLogService . getRequestLog ( WMS_ RE_ASSIGN_URL, " 重新分配货位 " , JSONUtil . toJsonStr ( jobParam ) ) ;
if ( " 1 " . equals ( requestLog . getIsSuccessful ( ) ) ) {
InterfaceReceive bean = JSONUtil . toBean ( requestLog . getResponseBody ( ) , InterfaceReceive . class ) ;
MydoJob wmsMydoJob = BeanUtil . toBean ( bean . getData ( ) , MydoJob . class ) ;
@@ -111,7 +107,7 @@ public class ApiServiceImpl implements IApiService {
*/
@Override
public AjaxResult reMaterial ( JobParam jobParam ) {
RequestLog requestLog = requestLogService . getRequestLog ( RE_MATERIAL_URL , " 重新分配物料 " , JSONUtil . toJsonStr ( jobParam ) ) ;
RequestLog requestLog = requestLogService . getRequestLog ( WMS_ RE_MATERIAL_URL, " 重新分配物料 " , JSONUtil . toJsonStr ( jobParam ) ) ;
if ( " 1 " . equals ( requestLog . getIsSuccessful ( ) ) ) {
return AjaxResult . success ( ) ;
}
@@ -142,7 +138,7 @@ public class ApiServiceImpl implements IApiService {
*/
@Override
public AjaxResult createMydoJobForStockin ( Map < String , Object > param ) {
RequestLog requestLog = requestLogService . getRequestLogForResponseResult ( WMS_STOCKIN_MYDOJOB , " 入库请求生成作业 " , JSONUtil . toJsonStr ( param ) ) ;
RequestLog requestLog = requestLogService . getRequestLog ( WMS_STOCKIN_MYDOJOB , " 入库请求生成作业 " , JSONUtil . toJsonStr ( param ) ) ;
if ( " 1 " . equals ( requestLog . getIsSuccessful ( ) ) ) {
ResponseResult bean = JSONUtil . toBean ( requestLog . getResponseBody ( ) , ResponseResult . class ) ;
return AjaxResult . success ( bean . getResult ( ) ) ;
@@ -232,7 +228,7 @@ public class ApiServiceImpl implements IApiService {
// mydoJob.setTaskNo(stockoutReceive.getTaskNo());
//// mydoJob.setWmsTaskNo(stockoutReceive.getTaskCode());
// mydoJob.setCargoSpaceId(stockoutReceive.getCargoSpaceId());
// mydoJob. setInOrOut( stockoutReceive. getInOrOut()) ;
mydoJob. setInOrOut( stockoutReceive. getInOrOut( ) ) ;
//
mydoJob . setTraySize ( GoodsType . TYPE_DEFAULT ) ; //默认
mydoJob . setStatus ( TASK_STATUS_CREATED ) ;
@@ -299,7 +295,7 @@ public class ApiServiceImpl implements IApiService {
MydoJob mydoJob = new MydoJob ( ) ;
mydoJob = BeanUtil . copyProperties ( receiveInJob , MydoJob . class ) ;
// mydoJob.setJobId(mydoJobService.getJobId("RK"));
// mydoJob. setTaskNo( mydoJobService. getTaskNo("3")) ;
mydoJob. setTaskNo( mydoJobService. getTaskNo( " 3 " ) ) ;
// mydoJob.setWmsTaskNo(receiveInJob.getJobId());
// mydoJob.setCargoSpaceId(receiveInJob.getTrayCode());
// mydoJob.setTrayCode(receiveOutJob.getTrayCode());
@@ -307,11 +303,9 @@ public class ApiServiceImpl implements IApiService {
basCargoSpaceService . selectBasCargoSpaceByCargoSpaceId ( receiveInJob . getCargoSpaceId ( ) ) . getRoadwayId ( )
) ;
// mydoJob.setTraySize(GoodsType.TYPE_DEFAULT);
mydoJob. setInOrOut( " 1 " ) ;
// mydoJob. setInOrOut("1") ;
mydoJob . setStatus ( TASK_STATUS_CREATED ) ;
mydoJob . setPriority ( Long . valueOf ( 10 ) ) ;
//todo 可能需要查本地库存信息获取条码?
mydoJob . setCreateTime ( DateUtils . getNowDate ( ) ) ;
mydoJob . setExecutionPhase ( TASK_EP_CREATED ) ;
// mydoJob.setTraySize(receiveOutJob.getDepartmentId());
@@ -334,6 +328,74 @@ public class ApiServiceImpl implements IApiService {
}
@Override
public AjaxResult receiveMoveMydoJob ( ReceiveJob receiveInJob ) {
RequestLog requestLog = requestLogService . getRequestLog ( JSONUtil . toJsonStr ( receiveInJob ) , " 推送移库作业 " ) ;
requestLog . setResponseBody ( JSONUtil . toJsonStr ( AjaxResult . success ( ) ) ) ;
requestLog . setResponseStatus ( " 0 " ) ;
requestLog . setIsSuccessful ( " 1 " ) ;
requestLogService . insertRequestLog ( requestLog ) ;
// -------------------------检查推送的任务参数-------------------------
log . info (
" 【wms推送移库】作业号:{},源货位:{},目标货位:{},托盘号:{} " , receiveInJob . getJobId ( ) , receiveInJob . getCargoSpaceId ( ) , receiveInJob . getTargetCargoSpaceId ( ) , receiveInJob . getTrayCode ( )
) ;
// 1.wms推送的作业号是否重复
MydoJob job = new MydoJob ( ) . builder ( ) . jobId ( receiveInJob . getJobId ( ) ) . build ( ) ;
List < MydoJob > tasks = mydoJobService . selectMydoJobList ( job ) ;
if ( tasks . size ( ) ! = 0 ) {
log . info ( " 【请求错误】wms下发移库任务失败, 该任务已存在, wms作业号:{},源货位:{},目标货位:{} " , receiveInJob . getJobId ( ) , receiveInJob . getCargoSpaceId ( ) , receiveInJob . getTargetCargoSpaceId ( ) ) ;
return AjaxResult . error ( " 【请求错误】wms下发移库任务失败, 该任务已存在, 推送作业号:{} " + receiveInJob . getJobId ( ) + " ,目标货位: " + receiveInJob . getCargoSpaceId ( ) ) ;
}
// 2.wms推送的目标货位是否已经有任务
job = new MydoJob ( ) . builder ( ) . cargoSpaceId ( receiveInJob . getCargoSpaceId ( ) ) . build ( ) ;
tasks = mydoJobService . selectMydoJobList ( job ) ;
if ( tasks . size ( ) ! = 0 ) {
log . info ( " 【请求错误】wms下发移库任务失败, 已经存在该货位任务, 推送作业号:{},源货位:{},目标货位:{} " , receiveInJob . getJobId ( ) , receiveInJob . getCargoSpaceId ( ) , receiveInJob . getTargetCargoSpaceId ( ) ) ;
return AjaxResult . error ( " 【请求错误】wms下发移库任务失败, 已经存在目标货位任务, 目标货位:{} " + receiveInJob . getJobId ( ) + " ,目标货位: " + receiveInJob . getCargoSpaceId ( ) ) ;
}
//生成入库作业
MydoJob mydoJob = new MydoJob ( ) ;
mydoJob = BeanUtil . copyProperties ( receiveInJob , MydoJob . class ) ;
// mydoJob.setJobId(mydoJobService.getJobId("RK"));
mydoJob . setTaskNo ( mydoJobService . getTaskNo ( " 3 " ) ) ;
// mydoJob.setWmsTaskNo(receiveInJob.getJobId());
// mydoJob.setCargoSpaceId(receiveInJob.getTrayCode());
// mydoJob.setTrayCode(receiveOutJob.getTrayCode());
mydoJob . setRoadwayId (
basCargoSpaceService . selectBasCargoSpaceByCargoSpaceId ( receiveInJob . getCargoSpaceId ( ) ) . getRoadwayId ( )
) ;
// mydoJob.setTraySize(GoodsType.TYPE_DEFAULT);
// mydoJob.setInOrOut("1");
mydoJob . setStatus ( TASK_STATUS_CREATED ) ;
mydoJob . setPriority ( Long . valueOf ( 10 ) ) ;
mydoJob . setCreateTime ( DateUtils . getNowDate ( ) ) ;
mydoJob . setExecutionPhase ( TASK_EP_CREATED ) ;
// mydoJob.setTraySize(receiveOutJob.getDepartmentId());
if ( mydoJobService . selectMydoJobByJobId ( mydoJob . getJobId ( ) ) ! = null ) {
log . info ( " 【警告】生成作业失败,已存在的作业号:{} " , mydoJob . getJobId ( ) + " (仅提示) " ) ;
return AjaxResult . error ( " 【警告】生成作业失败,已存在的作业号:{} " + mydoJob . getJobId ( ) + " (仅提示) " ) ;
}
int i = mydoJobService . insertMydoJob ( mydoJob ) ;
// boolean success = mydoJobService.saveOrUpdate(mydoJob);
if ( i ! = 0 ) {
requestLog . setResponseStatus ( " 1 " ) ;
requestLogService . updateRequestLog ( requestLog ) ;
log . info ( " 【推送移库】wms下发移库任务成功, wms作业号:{},源货位:{},目标货位:{} " , receiveInJob . getJobId ( ) , receiveInJob . getCargoSpaceId ( ) , receiveInJob . getTargetCargoSpaceId ( ) ) ;
return AjaxResult . success (
" 【推送移库】wms下发移库作业, 作业号: " + receiveInJob . getJobId ( ) + " ,目标货位: " + receiveInJob . getCargoSpaceId ( ) ) ;
} else {
return AjaxResult . error ( ) ;
}
}
@Override
public AjaxResult receiveInventoryMydoJob ( ReceiveJob receiveInventoryJob ) {
@@ -405,7 +467,7 @@ public class ApiServiceImpl implements IApiService {
@Override
public AjaxResult selectMydoJobByTrayCodeAndEntranceId ( HashMap < String , Object > paramMap ) {
RequestLog requestLog = requestLogService . getRequestLog ( REQUEST_ENTER_URL , " 请求获取入库作业 " , JSONUtil . toJsonStr ( paramMap ) ) ;
RequestLog requestLog = requestLogService . getRequestLog ( WMS_ REQUEST_ENTER_URL, " 请求获取入库作业 " , JSONUtil . toJsonStr ( paramMap ) ) ;
if ( " 1 " . equals ( requestLog . getIsSuccessful ( ) ) ) {
InterfaceReceive bean = JSONUtil . toBean ( requestLog . getResponseBody ( ) , InterfaceReceive . class ) ;
return AjaxResult . success ( bean . getData ( ) ) ;
@@ -424,7 +486,7 @@ public class ApiServiceImpl implements IApiService {
*/
@Override
public AjaxResult requestWmsSpace ( MydoJob mydoJob ) {
RequestLog requestLog = requestLogService . getRequestLog ( REQUEST_IN_SPACE_URL , " 入库请求分货位 " , JSONUtil . toJsonStr ( mydoJob ) ) ;
RequestLog requestLog = requestLogService . getRequestLog ( WMS_ REQUEST_IN_SPACE_URL, " 入库请求分货位 " , JSONUtil . toJsonStr ( mydoJob ) ) ;
if ( " 1 " . equals ( requestLog . getIsSuccessful ( ) ) ) {
InterfaceReceive bean = JSONUtil . toBean ( requestLog . getResponseBody ( ) , InterfaceReceive . class ) ;
return AjaxResult . success ( bean . getData ( ) ) ;
@@ -436,7 +498,7 @@ public class ApiServiceImpl implements IApiService {
@Override
public AjaxResult selectMydoJobByNoTrayCode ( Map < String , Object > param ) {
RequestLog requestLog = requestLogService . getRequestLog ( REQUEST_MYDO_JOB_URL , " 入库请求补码作业 " , JSONUtil . toJsonStr ( param ) ) ;
RequestLog requestLog = requestLogService . getRequestLog ( WMS_ REQUEST_MYDO_JOB_URL, " 入库请求补码作业 " , JSONUtil . toJsonStr ( param ) ) ;
if ( " 1 " . equals ( requestLog . getIsSuccessful ( ) ) ) {
InterfaceReceive bean = JSONUtil . toBean ( requestLog . getResponseBody ( ) , InterfaceReceive . class ) ;
return AjaxResult . success ( bean . getData ( ) ) ;
@@ -468,8 +530,8 @@ public class ApiServiceImpl implements IApiService {
}
public AjaxResult cancelTask ( String taskNo ) {
return mydoJobService . cancelTask ( taskNo ) ;
public AjaxResult cancelTask ( String jobId ) {
return mydoJobService . cancelTask ( jobId ) ;
}