@@ -16,7 +16,6 @@ import org.nl.common.enums.StatusEnum;
import org.nl.common.utils.* ;
import org.nl.config.thread.ThreadPoolExecutorUtil ;
import org.nl.modules.common.exception.BadRequestException ;
import org.nl.modules.common.exception.BizCoreException ;
import org.nl.modules.common.utils.RedisUtils ;
import org.nl.modules.wql.WQL ;
import org.nl.modules.wql.core.bean.WQLObject ;
@@ -26,12 +25,12 @@ import org.nl.wms.pda.dto.MaterialDto;
import org.nl.wms.pda.service.CacheLineHandService ;
import org.nl.wms.sch.tasks.SpeMachineryTask ;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.beans.factory.annotation.Value ;
import org.springframework.data.domain.Pageable ;
import org.springframework.scheduling.annotation.Async ;
import org.springframework.stereotype.Service ;
import org.springframework.transaction.annotation.Transactional ;
import javax.xml.transform.Result ;
import java.util.* ;
import java.util.concurrent.CompletableFuture ;
import java.util.concurrent.ThreadPoolExecutor ;
@@ -53,8 +52,8 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
private final RedisUtils redisUtils ;
@Autowired
private LocalCache cache ;
@Autowired
private ClassstandardService classstandardService ;
@Value ( " ${acs.url} " )
private String acsUrl ;
@Override
public JSONArray dropdownListQuery ( String param , String type ) {
@@ -115,7 +114,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
private List < MaterialDto > getMaterialDto ( List < MaterialDto > materialList , String param ) {
if ( StringUtils . isNotEmpty ( param ) ) {
//按条件搜索
materialList = materialList . stream ( ) . filter ( m - > ( m . getMaterial_name ( ) . indexOf ( param ) > - 1 ) | | ( m . getMaterial_code ( ) . indexOf ( param ) ) > - 1 | | ( m . getMaterial_spec ( ) . indexOf ( param ) ) > - 1 | | ( m . getClass_name ( ) . indexOf ( param ) ) > - 1 ) . collect ( Collectors . toList ( ) ) ;
materialList = materialList . stream ( ) . filter ( m - > ( m . getMaterial_name ( ) . indexOf ( param ) > - 1 ) | | ( m . getMaterial_code ( ) . indexOf ( param ) ) > - 1 | | ( m . getMaterial_spec ( ) . indexOf ( param ) ) > - 1 | | ( m . getClass_name ( ) . indexOf ( param ) ) > - 1 ) . collect ( Collectors . toList ( ) ) ;
return materialList ;
}
return materialList ;
@@ -194,12 +193,12 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
SpeMachineryTask SpeMachineryTask = new SpeMachineryTask ( ) ;
WQLObject taskTab = WQLObject . getWQLObject ( " sch_base_task " ) ;
JSONObject taskObject = taskTab . query ( " task_id = " + param . getString ( " instruct_uuid " ) ) . uniqueResult ( 0 ) ;
//0 1-取消、0 2-完成、0 3-任务下发,根据操作类型执行相关操作
if ( " 1 " . equals ( optType ) | | " 2 " . equals ( optType ) ) {
//1-取消、2-完成、3-任务下发,根据操作类型执行相关操作
if ( StatusEnum . TASK_CANNEL . getCode ( ) . equals ( optType ) | | StatusEnum . TASK_FINISH . getCode ( ) . equals ( optType ) ) {
return updateTaskStatus ( taskObject , optType ) ;
}
//任务下发
else if ( " 3 " . equals ( optType ) ) {
else if ( StatusEnum . TASK_PUBLISH . getCode ( ) . equals ( optType ) ) {
return SpeMachineryTask . createTask ( taskObject ) ;
}
else {
@@ -256,7 +255,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
}
/**
* status = 0 : 空位 status = 1 : 绿色空箱 || status = 2 :黄色满箱 || status = 3 :红色异常 || status = 4 :不展示
* status = 1 : 空位 status = 2 : 绿色空箱 || status = 3 :黄色满箱 || status = 4 :红色异常 || status = 5 :不展示
*/
@Override
public JSONArray cacheLineMaterInfoQuery ( JSONObject param ) {
@@ -273,14 +272,14 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
json . put ( " weight " , " 0 " ) ;
json . put ( " quantity " , " 0 " ) ;
//不展示
if ( " 0 " . equals ( json . getString ( " is_show " ) ) ) {
json . put ( " vehicle_status " , " 4 " ) ;
if ( StatusEnum . CACHE_VEL_DIS . getCode ( ) . equals ( json . getString ( " is_show " ) ) ) {
json . put ( " vehicle_status " , StatusEnum . CACHE_VEL_DIS . getCode ( ) ) ;
}
//展示
else {
//是否空位
if ( " 1 " . equals ( json . getString ( " is_empty " ) ) ) {
json . put ( " vehicle_status " , " 0 " ) ;
if ( StatusEnum . CACHE_VEL_NULL . getCode ( ) . equals ( json . getString ( " is_empty " ) ) ) {
json . put ( " vehicle_status " , StatusEnum . STATUS_FLASE . getCode ( ) ) ;
}
else {
// 载具不是空位
@@ -289,7 +288,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
JSONObject ivtObj = ivtTab . query ( " vehicle_code = ' " + vehicle_code + " ' and cacheLine_code like '% " + param . getString ( " wcsdevice_code " ) + " %' " ) . uniqueResult ( 0 ) ;
if ( ivtObj = = null ) {
//标记为红色异常
json . put ( " vehicle_status " , " 3 " ) ;
json . put ( " vehicle_status " , StatusEnum . CACHE_VEL_ERR . getCode ( ) ) ;
}
else {
json . put ( " vehicle_status " , ivtObj . getString ( " vehicle_status " ) ) ;
@@ -441,7 +440,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
//缓存线载具物料表
WQLObject vehMaterTab = WQLObject . getWQLObject ( " sch_cacheline_vehilematerial " ) ;
// 入空箱
if ( " 1 " . equals ( inOut_type ) ) {
if ( StatusEnum . IN_VEHICLE . getCode ( ) . equals ( inOut_type ) ) {
// 1.判断是否可以放入空箱子
JSONObject ivtObj = positionTab . query ( " vehicle_code = ' " + vehicle_code + " ' " ) . uniqueResult ( 0 ) ;
if ( ivtObj ! = null ) {
@@ -457,13 +456,13 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
afterIvt . put ( " vehmaterial_id " , IdUtil . getStringId ( ) ) ;
afterIvt . put ( " vehicle_code " , vehicle_code ) ;
afterIvt . put ( " cacheLine_code " , cacheLine_code ) ;
afterIvt . put ( " vehicle_status " , " 1 " ) ;
afterIvt . put ( " vehicle_status " , StatusEnum . STATUS_TRUE . getCode ( ) ) ;
afterIvt . put ( " update_time " , DateUtil . now ( ) ) ;
afterIvt . put ( " create_time " , DateUtil . now ( ) ) ;
result = vehMaterTab . insert ( afterIvt ) . getSucess ( ) ;
}
// 出空箱
if ( " 2 " . equals ( inOut_type ) ) {
if ( StatusEnum . OUT_VEHICLE . getCode ( ) . equals ( inOut_type ) ) {
// 缓存线载具物料表
JSONObject json = vehMaterTab . query ( " cacheLine_code = ' " + cacheLine_code + " 'and vehicle_code = ' " + vehicle_code + " ' and vehicle_status= '1' " ) . uniqueResult ( 0 ) ;
if ( json = = null ) {
@@ -493,7 +492,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
WQLObject instructTab = WQLObject . getWQLObject ( " sch_base_task " ) ;
JSONArray result = new JSONArray ( ) ;
// 入箱扫码异常
if ( " 1 " . equals ( inOut_type ) ) {
if ( StatusEnum . IN_VEHICLE . getCode ( ) . equals ( inOut_type ) ) {
String where = " point_code2 = ' " + wcsdevice_code + " ' and task_status <> '7' " ;
if ( StringUtils . isNotBlank ( vehicle_code ) ) {
where = " point_code2 = ' " + wcsdevice_code + " ' and vehicle_code = ' " + vehicle_code + " ' and task_status <> '7' " ;
@@ -513,7 +512,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
}
}
// 出箱扫码异常
if ( " 2 " . equals ( inOut_type ) ) {
if ( StatusEnum . OUT_VEHICLE . getCode ( ) . equals ( inOut_type ) ) {
String where = " point_code1 = ' " + wcsdevice_code + " ' and task_status <> '7' " ;
if ( StringUtils . isNotBlank ( vehicle_code ) ) {
where = " point_code1 = ' " + wcsdevice_code + " ' and vehicle_code = ' " + vehicle_code + " ' and task_status <> '7' " ;
@@ -536,13 +535,14 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
}
/**
* 扫码异常确认
* 出入类型 inOut_type 1 扫码异常-入箱扫码 2 扫码异常-出箱扫码
* 缓存线编码 wcsdevice_code
* 缓存线位置编码 position_code
* 料箱码 vehicle_code
*/
@Override
public String inOutExceptionInstConfirm ( JSONObject param ) {
public Map < String , Object > inOutExceptionInstConfirm ( JSONObject param ) {
// 1 扫码异常-入箱扫码 2 扫码异常-出箱扫码
String inOut_type = param . getString ( " inOut_type " ) ;
// 缓存线编码
@@ -554,33 +554,48 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
// 封装给acs的数据
JSONArray jsonArray = new JSONArray ( ) ;
JSONObject jsonObject = new JSONObject ( ) ;
// 1 扫码异常-入箱扫码 2 出箱扫码
jsonObject . put ( " inOut_type " , inOut_type ) ;
//缓存线编号
jsonObject . put ( " wcsdevice_code " , wcsdevice_code ) ;
//料箱码
jsonObject . put ( " vehicle_code " , vehicle_code ) ;
//缓存线点位编码
jsonObject . put ( " position_code " , position_code ) ;
jsonArray . add ( jsonObject ) ;
//TOFIX 等确定api后, 换成下发的url
return AcsUtil . notifyAcs ( " api " , jsonArray ) . getString ( " status " ) ;
try {
//TOFIX 等确定api后, 换成下发的url
return AcsUtil . notifyAcs ( acsUrl , jsonArray ) ;
}
catch ( NullPointerException e ) {
throw new BadRequestException ( e . toString ( ) ) ;
}
}
@Override
public String cacheLineExcepOpt ( JSONObject param ) {
public Map < String , Object > cacheLineExcepOpt ( JSONObject param ) {
// 缓存线编码
String wcsdevice_code = param . getString ( " wcsdevice_code " ) ;
// 1-暂停、2-启动
// opt_type 1-暂停、2-启动,默认为1暂停
String type = StatusEnum . PAUSE_CACHELINE . getCode ( ) ;
String opt_type = param . getString ( " opt_type " ) ;
// 类型:恢复是0, 暂停是1
String type = " 1 " ;
if ( " 2 " . equals ( opt_type ) ) {
if ( StatusEnum . START_CACHELINE . getCode ( ) . equals ( opt_type ) ) {
type = " 0 " ;
}
JSONArray jsonArray = new JSONArray ( ) ;
JSONObject jsonObject = new JSONObject ( ) ;
//下发接收的, 恢复是0, 暂停是1
jsonObject . put ( " type " , type ) ;
//缓存线编码
jsonObject . put ( " wcsdevice_code " , wcsdevice_code ) ;
jsonArray . add ( jsonObject ) ;
//TOFIX 等确定api后, 换成下发的url
return AcsUtil . notifyAcs ( " api " , jsonArray ) . getString ( " status " ) ;
try {
//TOFIX 等确定api后, 换成下发的url
return AcsUtil . notifyAcs ( acsUrl , jsonArray ) ;
}
catch ( NullPointerException e ) {
throw new BadRequestException ( e . toString ( ) ) ;
}
}
/**
@@ -646,7 +661,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
json . put ( " vehmaterial_id " , IdUtil . getStringId ( ) ) ;
json . put ( " create_time " , DateUtil . now ( ) ) ;
// 入满箱扫码异常
if ( " 1 " . equals ( inOut_type ) ) {
if ( StatusEnum . IN_VEHICLE . getCode ( ) . equals ( inOut_type ) ) {
//5.通过缓存线位置表当前执行任务id, 获取任务信息中的物料信息
JSONObject positionInfo = positionTab . query ( " vehicle_code = ' " + vehicle_code + " ' " ) . uniqueResult ( 0 ) ;
//查不到点位信息
@@ -672,12 +687,12 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
json . put ( " material_name " , meObj . getString ( " material_name " ) ) ;
json . put ( " quantity " , instructObj . getString ( " material_qty " ) ) ;
json . put ( " product_area " , instructObj . getString ( " product_area " ) ) ;
json . put ( " vehicle_status " , " 2 " ) ;
json . put ( " vehicle_status " , StatusEnum . CACHE_VEL_EMT . getCode ( ) ) ;
}
// 出满箱扫码异常
if ( " 2 " . equals ( inOut_type ) ) {
if ( StatusEnum . OUT_VEHICLE . getCode ( ) . equals ( inOut_type ) ) {
//5.重新新建该缓存线位置上的料箱为空箱子,是空料箱没有放物料等其他信息
json . put ( " vehicle_status " , " 1 " ) ;
json . put ( " vehicle_status " , StatusEnum . STATUS_TRUE . getCode ( ) ) ;
json . put ( " material_uuid " , " " ) ;
json . put ( " material_code " , " " ) ;
json . put ( " material_spec " , " " ) ;
@@ -798,7 +813,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
}
@Override
public void pourMaterial ( JSONObject param ) {
public Map < String , Object > pourMaterial ( JSONObject param ) {
// 指令标识
String instruct_uuid = param . getString ( " instruct_uuid " ) ;
// 指令点位表【sch_base_task】
@@ -810,8 +825,13 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
jsonObject . put ( " producer " , producer ) ;
jsonObject . put ( " putquantity " , putquantity ) ;
jsonArray . add ( jsonObject ) ;
//TOFIX 等确定api后, 换成下发的url
AcsUtil . notifyAcs ( " api " , jsonArray ) ;
try {
//TOFIX 等确定api后, 换成下发的url
return AcsUtil . notifyAcs ( acsUrl , jsonArray ) ;
}
catch ( NullPointerException e ) {
throw new BadRequestException ( e . toString ( ) ) ;
}
}
@Override