@ -52,8 +52,6 @@ import java.util.List;
@RequiredArgsConstructor
@RequiredArgsConstructor
@Slf4j
@Slf4j
public class RawFoilServiceImpl implements RawFoilService {
public class RawFoilServiceImpl implements RawFoilService {
private final AcsToWmsService acsToWmsService ;
private final PointService pointService ;
@Autowired
@Autowired
RawfoilWorkOrderMapper rawfoilWorkOrderMapper ;
RawfoilWorkOrderMapper rawfoilWorkOrderMapper ;
@ -171,218 +169,6 @@ public class RawFoilServiceImpl implements RawFoilService {
return jo ;
return jo ;
}
}
@Override
@Transactional ( rollbackFor = Exception . class )
public JSONObject needEmptyAxis ( JSONObject whereJson ) {
String message = "操作完成!" ;
WQLObject pdmBiRawfoilworkorderService = WQLObject . getWQLObject ( "PDM_BI_RawFoilWorkOrder" ) ; // 生箔工单表
WQLObject stIvtSbpointivtService = WQLObject . getWQLObject ( "ST_IVT_SbPointIvt" ) ; // 生箔点位库存表
JSONObject raw_jo = whereJson . getJSONObject ( "raw_jo" ) ;
JSONObject jsonRaw = pdmBiRawfoilworkorderService . query ( "workorder_id = '" + raw_jo . getString ( "workorder_id" ) + "'" ) . uniqueResult ( 0 ) ;
if ( ! StrUtil . equals ( jsonRaw . getString ( "status" ) , "01" ) ) {
throw new BadRequestException ( "工单状态不为开始" ) ;
}
JSONObject jsonSb = stIvtSbpointivtService . query ( "ext_code = '" + jsonRaw . getString ( "resource_name" ) + "'" ) . uniqueResult ( 0 ) ;
if ( ObjectUtil . isEmpty ( jsonSb ) ) {
throw new BadRequestException ( "点位:" + jsonRaw . getString ( "resource_name" ) + "生箔设备不存在" ) ;
}
if ( StrUtil . equals ( "0" , jsonSb . getString ( "is_used" ) ) ) {
throw new BadRequestException ( "当前生箔机:" + jsonSb . getString ( "ext_code" ) + "未启用!" ) ;
}
String start_pint_code = "" ;
String point_code4 = "" ;
String orderType = jsonRaw . getString ( "order_type" ) ;
//二期B1、B3的生箔烘箱任务和其他不一致
if ( jsonSb . getString ( "product_area" ) . equals ( "B1" ) ) {
// 2.根据就近原则查对应空卷轴
JSONObject map = new JSONObject ( ) ;
map . put ( "flag" , "601" ) ;
map . put ( "product_area" , jsonSb . getString ( "product_area" ) ) ;
map . put ( "point_location" , jsonSb . getString ( "point_location" ) ) ;
// 查找冷却区空轴位状态是空轴的点位
JSONObject jsonIvt = WQL . getWO ( "PDA_RAWFOIL_01" ) . addParamMap ( map ) . process ( ) . uniqueResult ( 0 ) ;
// 3.如果没找到则继续找下一节点
if ( ObjectUtil . isEmpty ( jsonIvt ) ) {
String point_location = jsonSb . getString ( "point_location" ) ;
if ( StrUtil . equals ( point_location , "0" ) ) map . put ( "point_location" , "1" ) ;
if ( StrUtil . equals ( point_location , "1" ) ) map . put ( "point_location" , "0" ) ;
// 没有找到就往其他位置(上下位置)查找
jsonIvt = WQL . getWO ( "PDA_RAWFOIL_01" ) . addParamMap ( map ) . process ( ) . uniqueResult ( 0 ) ;
if ( ObjectUtil . isEmpty ( jsonIvt ) ) {
throw new BadRequestException ( "未查询到有空轴的点位!" ) ;
}
}
//查询可用的对接位
String reging_id = "" ;
String product_area = jsonSb . getString ( "product_area" ) ;
// 获取对应的烘箱对接位区域id
switch ( product_area ) {
case "A1" :
reging_id = RegionTypeEnum . A_HKZC . getId ( ) ;
break ;
case "A2" :
reging_id = RegionTypeEnum . B_HKZC . getId ( ) ;
break ;
case "A3" :
reging_id = RegionTypeEnum . C_HKZC . getId ( ) ;
break ;
case "A4" :
reging_id = RegionTypeEnum . D_HKZC . getId ( ) ;
break ;
case "B1" :
reging_id = RegionTypeEnum . B1_HKZC . getId ( ) ;
break ;
case "B2" :
reging_id = RegionTypeEnum . B2_HKZC . getId ( ) ;
break ;
default :
break ;
}
JSONObject cache_map = new JSONObject ( ) ;
cache_map . put ( "flag" , "4" ) ;
cache_map . put ( "reging_id" , reging_id ) ;
cache_map . put ( "point_location" , jsonSb . getString ( "point_location" ) ) ;
//只找入箱点位(point_type : 4)
cache_map . put ( "point_type" , "4" ) ;
JSONObject point_code2_jo = WQL . getWO ( "PDA_OVENINANDOUT_01" ) . addParamMap ( cache_map ) . process ( ) . uniqueResult ( 0 ) ;
if ( ObjectUtil . isEmpty ( point_code2_jo ) ) {
// 找不到就找其他上下位置的
cache_map . put ( "point_location" , jsonSb . getString ( "point_location" ) . equals ( "0" ) ? "1" : "0" ) ;
point_code2_jo = WQL . getWO ( "PDA_OVENINANDOUT_01" ) . addParamMap ( cache_map ) . process ( ) . uniqueResult ( 0 ) ;
}
if ( ObjectUtil . isEmpty ( point_code2_jo ) ) {
throw new BadRequestException ( "未查询到可用的点位类型为入箱的烘箱对接位!" ) ;
}
// 起点和终点确定 生成任务
JSONObject param = new JSONObject ( ) ;
param . put ( "point_code1" , jsonIvt . getString ( "empty_point_code" ) ) ;
param . put ( "point_code2" , jsonSb . getString ( "point_code" ) + "_K" ) ;
param . put ( "point_code3" , jsonSb . getString ( "point_code" ) + "_M" ) ;
param . put ( "point_code4" , point_code2_jo . getString ( "point_code" ) ) ;
param . put ( "task_type" , "010104" ) ;
param . put ( "material_code" , jsonRaw . getString ( "container_name" ) ) ;
param . put ( "product_area" , jsonSb . getString ( "product_area" ) ) ;
CallEmpReelTask callEmpReelTask = new CallEmpReelTask ( ) ;
callEmpReelTask . createTask ( param ) ;
} else {
// 2.根据就近原则查对应空卷轴
JSONObject map = new JSONObject ( ) ;
map . put ( "flag" , "1" ) ;
map . put ( "product_area" , jsonSb . getString ( "product_area" ) ) ;
map . put ( "point_location" , jsonSb . getString ( "point_location" ) ) ;
map . put ( "point_type" , "1" ) ;
// 如果是B2, 需要根据标箔或者锂电来判断是哪个位置
if ( jsonSb . getString ( "product_area" ) . equals ( "B2" ) ) {
// order_type 1-标箔;2-锂电
if ( "2" . equals ( orderType ) ) {
map . put ( "point_type" , "4" ) ;
}
}
JSONObject jsonIvt = WQL . getWO ( "PDA_RAWFOIL_01" ) . addParamMap ( map ) . process ( ) . uniqueResult ( 0 ) ;
// 3.如果没找到则继续找下一节点
String bigType = whereJson . getString ( "big_type" ) ;
if ( ObjectUtil . isEmpty ( jsonIvt ) ) {
/ * String point_location = jsonSb . getString ( "point_location" ) ;
if ( StrUtil . equals ( point_location , "0" ) ) map . put ( "point_location" , "1" ) ;
if ( StrUtil . equals ( point_location , "1" ) ) map . put ( "point_location" , "0" ) ;
JSONObject jsonIvt_tow = WQL . getWO ( "PDA_RAWFOIL_01" ) . addParamMap ( map ) . process ( ) . uniqueResult ( 0 ) ; * /
if ( ! ( jsonSb . getString ( "product_area" ) . startsWith ( "A1" )
& & ObjectUtil . isNotEmpty ( bigType )
& & "1" . equals ( bigType ) ) ) {
throw new BadRequestException ( "未查询到有空轴且母卷位置为空的点位!" ) ;
}
} else {
start_pint_code = jsonIvt . getString ( "empty_point_code" ) ;
point_code4 = jsonIvt . getString ( "full_point_code" ) ;
}
// 起点和终点确定 生成任务
JSONObject param = new JSONObject ( ) ;
// 只有一期A2才需要指定车号
if ( jsonSb . getString ( "product_area" ) . startsWith ( "A2" )
& & ObjectUtil . isNotEmpty ( bigType )
& & "1" . equals ( bigType ) ) {
param . put ( "car_no" , TaskUtils . getParam ( "A2_USE_CAR" ) ) ;
// 不能创建四点任务,需要创建两条。
map . put ( "flag" , "101" ) ;
JSONObject emptyPoint = WQL . getWO ( "PDA_RAWFOIL_01" ) . addParamMap ( map ) . process ( ) . uniqueResult ( 0 ) ;
if ( ObjectUtil . isEmpty ( emptyPoint ) ) {
throw new BadRequestException ( "未查询到母卷位置为空且空轴位也是空的点位!" ) ;
}
// 找全空的放满轴,任务完成后找有空轴的取
param . put ( "point_code1" , jsonSb . getString ( "point_code" ) + "_M" ) ;
param . put ( "point_code2" , emptyPoint . getString ( "full_point_code" ) ) ;
param . put ( "task_type" , "010105" ) ;
param . put ( "material_code" , jsonRaw . getString ( "container_name" ) ) ;
param . put ( "product_area" , jsonSb . getString ( "product_area" ) ) ;
} else if ( jsonSb . getString ( "product_area" ) . equals ( "B2" ) & & "2" . equals ( orderType ) ) {
// 如果是B2直接送到对接位。(找到对应满足温度的烘箱、没有禁用的烘箱。)
BakingServiceImpl bean = SpringContextHolder . getBean ( BakingServiceImpl . class ) ;
// 温度
String temperature = whereJson . getString ( "temperature" ) ;
// 时间
String hours = whereJson . getString ( "hours" ) ;
JSONObject map2 = new JSONObject ( ) ;
map2 . put ( "flag" , "301" ) ;
map2 . put ( "reging_id" , RegionTypeEnum . B2_HKZC . getId ( ) ) ;
//只找入箱点位
map2 . put ( "point_type" , "4" ) ;
JSONArray point_code2_jos = WQL . getWO ( "PDA_OVENINANDOUT_01" ) . addParamMap ( map2 ) . process ( ) . getResultJSONArray ( 0 ) ;
if ( ObjectUtil . isNotEmpty ( point_code2_jos ) ) {
// 遍历查找
for ( int i = 0 ; i < point_code2_jos . size ( ) ; i + + ) {
JSONObject point_code2_jo = point_code2_jos . getJSONObject ( i ) ;
JSONObject productArea = bean . getJsonObject ( jsonSb . getString ( "product_area" ) , point_code2_jo , temperature ) ;
if ( ObjectUtil . isNotEmpty ( productArea ) ) {
param . put ( "point_code4" , point_code2_jo . getString ( "point_code" ) ) ;
param . put ( "task_type" , "010106" ) ;
param . put ( "temperature" , temperature ) ;
param . put ( "hours" , hours ) ;
message = "送到烘箱对接位!" ;
break ;
}
}
}
if ( ObjectUtil . isEmpty ( point_code2_jos ) | | ObjectUtil . isEmpty ( param . getString ( "point_code4" ) ) ) {
param . put ( "point_code4" , point_code4 ) ;
param . put ( "task_type" , "010101" ) ;
message = "送到冷却区!" ;
}
param . put ( "point_code1" , start_pint_code ) ;
param . put ( "point_code2" , jsonSb . getString ( "point_code" ) + "_K" ) ;
param . put ( "point_code3" , jsonSb . getString ( "point_code" ) + "_M" ) ;
param . put ( "material_code" , jsonRaw . getString ( "container_name" ) ) ;
param . put ( "product_area" , jsonSb . getString ( "product_area" ) ) ;
} else {
param . put ( "point_code1" , start_pint_code ) ;
param . put ( "point_code2" , jsonSb . getString ( "point_code" ) + "_K" ) ;
param . put ( "point_code3" , jsonSb . getString ( "point_code" ) + "_M" ) ;
param . put ( "point_code4" , point_code4 ) ;
param . put ( "task_type" , "010101" ) ;
param . put ( "material_code" , jsonRaw . getString ( "container_name" ) ) ;
param . put ( "product_area" , jsonSb . getString ( "product_area" ) ) ;
}
CallEmpReelTask callEmpReelTask = new CallEmpReelTask ( ) ;
callEmpReelTask . createTask ( param ) ;
}
// 更新工单状态
JSONObject jo_map = new JSONObject ( ) ;
jo_map . put ( "status" , "02" ) ;
pdmBiRawfoilworkorderService . update ( jo_map , "workorder_id = '" + raw_jo . getString ( "workorder_id" ) + "'" ) ;
JSONObject jo = new JSONObject ( ) ;
jo . put ( "message" , message ) ;
return jo ;
}
@Override
@Override
public JSONObject createOrder ( JSONObject whereJson ) {
public JSONObject createOrder ( JSONObject whereJson ) {
@ -425,145 +211,6 @@ public class RawFoilServiceImpl implements RawFoilService {
return jo ;
return jo ;
}
}
@Override
@Transactional ( rollbackFor = Exception . class )
public JSONObject needEmptyAxisTest ( JSONObject whereJson ) {
WQLObject rawTab = WQLObject . getWQLObject ( "PDM_BI_RawFoilWorkOrder" ) ; // 生箔工单表
WQLObject sbTab = WQLObject . getWQLObject ( "ST_IVT_SbPointIvt" ) ; // 生箔点位库存表
JSONObject device_jo = sbTab . query ( "point_code = '" + whereJson . getString ( "point_code" ) + "'" ) . uniqueResult ( 0 ) ;
String bigType = whereJson . getString ( "big_type" ) ;
// 插入生箔工序工单表
JSONObject json = new JSONObject ( ) ;
json . put ( "workorder_id" , IdUtil . getSnowflake ( 1 , 1 ) . nextId ( ) ) ;
json . put ( "container_name" , whereJson . getString ( "container_name" ) ) ;
json . put ( "resource_name" , device_jo . getString ( "ext_code" ) ) ;
json . put ( "mfg_order_name" , "test" ) ;
json . put ( "product_name" , "741011000000361" ) ;
json . put ( "description" , "铜箔|双面光|原箔|6微米|1350" ) ;
json . put ( "theory_height" , 2000 . 00 ) ;
json . put ( "eqp_velocity" , 20 . 00 ) ;
json . put ( "up_coiler_date" , DateUtil . now ( ) ) ;
json . put ( "is_reload_send" , 0 ) ;
json . put ( "order_type" , device_jo . getString ( "device_type" ) ) ;
json . put ( "product_area" , "B2" ) ;
json . put ( "realstart_time" , DateUtil . now ( ) ) ;
json . put ( "status" , "01" ) ;
json . put ( "is_delete" , "0" ) ;
json . put ( "agvno" , "0" ) ;
json . put ( "productin_qty" , 0 ) ;
json . put ( "create_id" , "1" ) ;
json . put ( "create_name" , "管理员" ) ;
json . put ( "create_time" , DateUtil . now ( ) ) ;
if ( ObjectUtil . isNotEmpty ( bigType ) & & "1" . equals ( bigType ) ) {
json . put ( "agvno" , "99" ) ;
}
rawTab . insert ( json ) ;
JSONObject jsonSb = sbTab . query ( "point_code = '" + whereJson . getString ( "point_code" ) + "'" ) . uniqueResult ( 0 ) ;
if ( ObjectUtil . isEmpty ( jsonSb ) ) {
throw new BadRequestException ( "点位:" + whereJson . getString ( "point_code" ) + "生箔设备不存在" ) ;
}
if ( StrUtil . equals ( "0" , jsonSb . getString ( "is_used" ) ) ) {
throw new BadRequestException ( "当前生箔机:" + jsonSb . getString ( "ext_code" ) + "未启用!" ) ;
}
String start_pint_code = "" ;
String point_code4 = "" ;
// 2.根据就近原则查对应空卷抽
JSONObject map = new JSONObject ( ) ;
map . put ( "flag" , "1" ) ;
map . put ( "product_area" , jsonSb . getString ( "product_area" ) ) ;
map . put ( "point_location" , jsonSb . getString ( "point_location" ) ) ;
JSONObject jsonIvt = WQL . getWO ( "PDA_RAWFOIL_01" ) . addParamMap ( map ) . process ( ) . uniqueResult ( 0 ) ;
// 3.如果没找到则继续找下一节点
if ( ObjectUtil . isEmpty ( jsonIvt ) ) {
/ * String point_location = jsonSb . getString ( "point_location" ) ;
if ( StrUtil . equals ( point_location , "0" ) ) map . put ( "point_location" , "1" ) ;
if ( StrUtil . equals ( point_location , "1" ) ) map . put ( "point_location" , "0" ) ;
JSONObject jsonIvt_tow = WQL . getWO ( "PDA_RAWFOIL_01" ) . addParamMap ( map ) . process ( ) . uniqueResult ( 0 ) ; * /
throw new BadRequestException ( "未查询到有空轴且母卷位置为空的点位!" ) ;
} else {
start_pint_code = jsonIvt . getString ( "empty_point_code" ) ;
point_code4 = jsonIvt . getString ( "full_point_code" ) ;
}
// 起点和终点确定 生成任务
JSONObject param = new JSONObject ( ) ;
param . put ( "point_code1" , start_pint_code ) ;
param . put ( "point_code2" , jsonSb . getString ( "point_code" ) + "_K" ) ;
param . put ( "point_code3" , jsonSb . getString ( "point_code" ) + "_M" ) ;
param . put ( "point_code4" , point_code4 ) ;
param . put ( "task_type" , "010101" ) ;
if ( ObjectUtil . isNotEmpty ( bigType ) & & "1" . equals ( bigType ) ) {
param . put ( "car_no" , TaskUtils . getParam ( "A2_USE_CAR" ) ) ;
}
param . put ( "material_code" , whereJson . getString ( "container_name" ) ) ;
param . put ( "product_area" , jsonSb . getString ( "product_area" ) ) ;
CallEmpReelTask callEmpReelTask = new CallEmpReelTask ( ) ;
callEmpReelTask . createTask ( param ) ;
// 更新工单状态
json . put ( "status" , "02" ) ;
rawTab . update ( json ) ;
JSONObject jo = new JSONObject ( ) ;
jo . put ( "message" , "操作成功!" ) ;
return jo ;
}
@Override
@Transactional ( rollbackFor = Exception . class )
public JSONObject needEmptyVehicle ( JSONObject whereJson ) {
throw new BadRequestException ( "请点击呼叫按钮进行搬运!" ) ;
/ * String point_code = whereJson . getString ( "point_code" ) ;
if ( ObjectUtil . isEmpty ( point_code ) ) {
throw new BadRequestException ( "输入的点位不能为空!" ) ;
}
JSONObject raw_jo = WQLObject . getWQLObject ( "st_ivt_sbpointivt" ) . query ( "point_code = '" + point_code + "'" ) . uniqueResult ( 0 ) ;
if ( ObjectUtil . isEmpty ( raw_jo ) ) {
throw new BadRequestException ( "未查到相关的生箔机点位!" ) ;
}
if ( StrUtil . equals ( "0" , raw_jo . getString ( "is_used" ) ) ) {
throw new BadRequestException ( "当前生箔机:" + raw_jo . getString ( "ext_code" ) + "未启用!" ) ;
}
// 2.根据就近原则查对应空卷抽
JSONObject map = new JSONObject ( ) ;
map . put ( "flag" , "1" ) ;
map . put ( "product_area" , raw_jo . getString ( "product_area" ) ) ;
map . put ( "point_location" , raw_jo . getString ( "point_location" ) ) ;
JSONObject jsonIvt = WQL . getWO ( "PDA_RAWFOIL_01" ) . addParamMap ( map ) . process ( ) . uniqueResult ( 0 ) ;
// 3.如果没找到则继续找下一节点
String start_pint_code = "" ;
if ( ObjectUtil . isEmpty ( jsonIvt ) ) {
* //*String point_location = jsonSb.getString("point_location");
if ( StrUtil . equals ( point_location , "0" ) ) map . put ( "point_location" , "1" ) ;
if ( StrUtil . equals ( point_location , "1" ) ) map . put ( "point_location" , "0" ) ;
JSONObject jsonIvt_tow = WQL . getWO ( "PDA_RAWFOIL_01" ) . addParamMap ( map ) . process ( ) . uniqueResult ( 0 ) ; * //*
throw new BadRequestException ( "未查询到有空轴且母卷位置为空的点位!" ) ;
} else {
start_pint_code = jsonIvt . getString ( "empty_point_code" ) ;
}
// 起点和终点确定 生成任务
JSONObject param = new JSONObject ( ) ;
param . put ( "point_code1" , start_pint_code ) ;
param . put ( "point_code2" , point_code + "_K" ) ;
param . put ( "task_type" , "010103" ) ;
param . put ( "product_area" , jsonIvt . getString ( "product_area" ) ) ;
CallEmpReelTask callEmpReelTask = new CallEmpReelTask ( ) ;
callEmpReelTask . createTask ( param ) ;
JSONObject jo = new JSONObject ( ) ;
jo . put ( "message" , "操作成功!" ) ;
return jo ; * /
}
@Override
@Override
public JSONObject confirmBlanking ( JSONObject whereJson ) {
public JSONObject confirmBlanking ( JSONObject whereJson ) {
WQLObject pdmBiRawfoilworkorderService = WQLObject . getWQLObject ( "PDM_BI_RawFoilWorkOrder" ) ; // 生箔工单
WQLObject pdmBiRawfoilworkorderService = WQLObject . getWQLObject ( "PDM_BI_RawFoilWorkOrder" ) ; // 生箔工单
@ -582,6 +229,9 @@ public class RawFoilServiceImpl implements RawFoilService {
//查询该母卷号对应的任务
//查询该母卷号对应的任务
String container_name = rawfoilWorkOrder . getContainer_name ( ) ;
String container_name = rawfoilWorkOrder . getContainer_name ( ) ;
JSONObject task_jo = WQLObject . getWQLObject ( "SCH_BASE_Task" ) . query ( "material_code = '" + container_name + "' and task_status <> '07' AND is_delete = '0'" ) . uniqueResult ( 0 ) ;
JSONObject task_jo = WQLObject . getWQLObject ( "SCH_BASE_Task" ) . query ( "material_code = '" + container_name + "' and task_status <> '07' AND is_delete = '0'" ) . uniqueResult ( 0 ) ;
if ( ObjectUtil . isEmpty ( task_jo ) ) {
throw new BadRequestException ( "母卷号是" + container_name + "的任务不存在!" ) ;
}
// 查询生箔点位库存表
// 查询生箔点位库存表
SbPointIvt stIvtSbpointivt = sbPointIvtMapper . selectOne ( new LambdaQueryWrapper < SbPointIvt > ( )
SbPointIvt stIvtSbpointivt = sbPointIvtMapper . selectOne ( new LambdaQueryWrapper < SbPointIvt > ( )
@ -615,77 +265,6 @@ public class RawFoilServiceImpl implements RawFoilService {
return jo ;
return jo ;
}
}
@Override
public JSONObject finishBlanking ( JSONObject whereJson ) {
JSONObject raw_jo = whereJson . getJSONObject ( "raw_jo" ) ;
WQLObject pdmBiRawfoilworkorderService = WQLObject . getWQLObject ( "PDM_BI_RawFoilWorkOrder" ) ; // 生箔工单表
JSONObject jsonRaw = pdmBiRawfoilworkorderService . query ( "container_name = '" + raw_jo . getString ( "container_name" ) + "'" ) . uniqueResult ( 0 ) ;
if ( ! StrUtil . equals ( jsonRaw . getString ( "status" ) , "03" ) ) {
throw new BadRequestException ( "工单不为确认下卷" ) ;
}
//查询该母卷号对应的任务
String container_name = jsonRaw . getString ( "container_name" ) ;
JSONObject task_jo = WQLObject . getWQLObject ( "SCH_BASE_Task" ) . query ( "material_code = '" + container_name + "' and task_status <> '07' AND is_delete = '0'" ) . uniqueResult ( 0 ) ;
// 查询生箔点位库存表
JSONObject jsonSb = WQLObject . getWQLObject ( "st_ivt_sbpointivt" ) . query ( "ext_code = '" + jsonRaw . getString ( "resource_name" ) + "'" ) . uniqueResult ( 0 ) ;
if ( ObjectUtil . isEmpty ( jsonSb ) ) {
throw new BadRequestException ( "点位不存在" ) ;
}
//下发ACS,执行取满放空的AGV动作
JSONArray paramArr = new JSONArray ( ) ;
JSONObject param = new JSONObject ( ) ;
param . put ( "device_code" , jsonSb . getString ( "point_code" ) ) ;
param . put ( "task_code" , task_jo . getString ( "task_code" ) ) ;
param . put ( "option" , "2" ) ;
paramArr . add ( param ) ;
WmsToAcsServiceImpl wmsToAcsService = new WmsToAcsServiceImpl ( ) ;
JSONObject result = wmsToAcsService . updateTask ( paramArr ) ;
if ( ! StrUtil . equals ( result . getString ( "status" ) , "200" ) ) {
throw new BadRequestException ( "操作失败:" + result . getString ( "message " ) ) ;
}
// 更新工单状态为下卷完成
jsonRaw . put ( "status" , "04" ) ;
pdmBiRawfoilworkorderService . update ( jsonRaw ) ;
JSONObject jo = new JSONObject ( ) ;
jo . put ( "message" , "操作成功!" ) ;
return jo ;
}
@Override
public JSONObject finish ( JSONObject whereJson ) {
WQLObject stIvtCoolRegionIoService = WQLObject . getWQLObject ( "PDM_BI_RawFoilWorkOrder" ) ; // 生箔工单表
JSONObject raw_jo = whereJson . getJSONObject ( "raw_jo" ) ;
JSONObject jsonCool = stIvtCoolRegionIoService . query ( "workorder_id = '" + raw_jo . getString ( "workorder_id" ) + "'" ) . uniqueResult ( 0 ) ;
//查询该生箔工单是否存在未完成的任务
String container_name = raw_jo . getString ( "container_name" ) ;
JSONObject task_jo = WQLObject . getWQLObject ( "sch_base_task" ) . query ( "material_code = '" + container_name + "' AND task_status < '07' AND is_delete = '0'" ) . uniqueResult ( 0 ) ;
if ( ObjectUtil . isNotEmpty ( task_jo ) ) {
throw new BadRequestException ( "该生箔工单存在未完成的任务,请先完成任务!" ) ;
}
jsonCool . put ( "status" , "40" ) ;
jsonCool . put ( "realend_time" , DateUtil . now ( ) ) ;
jsonCool . put ( "finish_type" , "02" ) ;
stIvtCoolRegionIoService . update ( jsonCool ) ;
JSONObject jo = new JSONObject ( ) ;
jo . put ( "message" , "操作成功!" ) ;
return jo ;
}
@Override
@Override
@Transactional ( rollbackFor = Exception . class )
@Transactional ( rollbackFor = Exception . class )
@ -693,28 +272,14 @@ public class RawFoilServiceImpl implements RawFoilService {
String message = "操作完成!" ;
String message = "操作完成!" ;
String type = whereJson . getString ( "type" ) ;
String type = whereJson . getString ( "type" ) ;
JSONObject raw_jo = whereJson . getJSONObject ( "raw_jo" ) ;
JSONObject raw_jo = whereJson . getJSONObject ( "raw_jo" ) ;
SbPointIvt stIvtSbpointivt ;
String point_code = whereJson . getString ( "point_code" ) ;
if ( ObjectUtil . isNotEmpty ( whereJson . getString ( "point_code" ) ) ) {
stIvtSbpointivt = sbPointIvtMapper . selectOne ( new LambdaQueryWrapper < SbPointIvt > ( )
. eq ( ObjectUtil . isNotEmpty ( whereJson . getString ( "point_code" ) ) , SbPointIvt : : getPoint_code , whereJson . getString ( "point_code" ) ) ) ;
} else {
stIvtSbpointivt = sbPointIvtMapper . selectOne ( new LambdaQueryWrapper < SbPointIvt > ( )
. eq ( ObjectUtil . isNotEmpty ( raw_jo . getString ( "point_code" ) ) , SbPointIvt : : getPoint_code , raw_jo . getString ( "point_code" ) ) ) ;
}
if ( ObjectUtil . isEmpty ( stIvtSbpointivt ) ) {
throw new BadRequestException ( "点位:" + stIvtSbpointivt . getExt_code ( ) + "生箔设备不存在" ) ;
}
if ( StrUtil . equals ( "0" , stIvtSbpointivt . getIs_used ( ) ) ) {
throw new BadRequestException ( "当前生箔机:" + stIvtSbpointivt . getExt_code ( ) + "未启用!" ) ;
}
JSONObject param = new JSONObject ( ) ;
JSONObject param = new JSONObject ( ) ;
if ( "1" . equals ( type ) | | "3" . equals ( type ) ) { // 1:取空取满放空放满,
if ( "1" . equals ( type ) | | "3" . equals ( type ) ) { // 1:取空取满放空放满,
handleType1And3 ( stIvtSbpointivt , raw_jo , param , type ) ;
handleType1And3 ( raw_jo , param , type ) ;
} else if ( "2" . equals ( type ) ) { //2:单上空轴
} else if ( "2" . equals ( type ) ) { //2:单上空轴
handleType2 ( stIvtSbpointivt , param ) ;
handleType2 ( point_code , param ) ;
} else if ( "4" . equals ( type ) ) { //4:单下空轴
} else if ( "4" . equals ( type ) ) { //4:单下空轴
handleType4 ( stIvtSbpointivt , param ) ;
handleType4 ( point_code , param ) ;
}
}
CallEmpReelTask callEmpReelTask = new CallEmpReelTask ( ) ;
CallEmpReelTask callEmpReelTask = new CallEmpReelTask ( ) ;
@ -737,7 +302,9 @@ public class RawFoilServiceImpl implements RawFoilService {
WQLObject pointTab = WQLObject . getWQLObject ( "ST_IVT_SbPointIvt" ) ;
WQLObject pointTab = WQLObject . getWQLObject ( "ST_IVT_SbPointIvt" ) ;
JSONObject raw_jo = whereJson . getJSONObject ( "raw_jo" ) ;
JSONObject raw_jo = whereJson . getJSONObject ( "raw_jo" ) ;
if ( ObjectUtil . isEmpty ( raw_jo ) ) {
throw new BadRequestException ( "生箔工单不能为空!" ) ;
}
JSONObject jsonRaw = stIvtCoolRegionIoService . query ( "workorder_id = '" + raw_jo . getString ( "workorder_id" ) + "'" ) . uniqueResult ( 0 ) ;
JSONObject jsonRaw = stIvtCoolRegionIoService . query ( "workorder_id = '" + raw_jo . getString ( "workorder_id" ) + "'" ) . uniqueResult ( 0 ) ;
if ( ! StrUtil . equals ( jsonRaw . getString ( "status" ) , "00" ) ) {
if ( ! StrUtil . equals ( jsonRaw . getString ( "status" ) , "00" ) ) {
@ -794,10 +361,18 @@ public class RawFoilServiceImpl implements RawFoilService {
return jo ;
return jo ;
}
}
private void handleType1And3 ( SbPointIvt stIvtSbpointivt , JSONObject raw_jo , JSONObject param , String type ) {
private void handleType1And3 ( JSONObject raw_jo , JSONObject param , String type ) {
if ( ObjectUtil . isEmpty ( raw_jo ) ) {
if ( ObjectUtil . isEmpty ( raw_jo ) ) {
throw new BadRequestException ( "生箔工单不能为空!" ) ;
throw new BadRequestException ( "生箔工单不能为空!" ) ;
}
}
SbPointIvt stIvtSbpointivt = sbPointIvtMapper . selectOne ( new LambdaQueryWrapper < SbPointIvt > ( )
. eq ( ObjectUtil . isNotEmpty ( raw_jo . getString ( "point_code" ) ) , SbPointIvt : : getPoint_code , raw_jo . getString ( "point_code" ) ) ) ;
if ( ObjectUtil . isEmpty ( stIvtSbpointivt ) ) {
throw new BadRequestException ( "点位:" + stIvtSbpointivt . getExt_code ( ) + "生箔设备不存在" ) ;
}
if ( StrUtil . equals ( "0" , stIvtSbpointivt . getIs_used ( ) ) ) {
throw new BadRequestException ( "当前生箔机:" + stIvtSbpointivt . getExt_code ( ) + "未启用!" ) ;
}
JSONObject task_jo = WQLObject . getWQLObject ( "sch_base_task" ) . query ( "material_code = '" + raw_jo . getString ( "container_name" ) + "' AND task_status < '07' AND is_delete = '0'" ) . uniqueResult ( 0 ) ;
JSONObject task_jo = WQLObject . getWQLObject ( "sch_base_task" ) . query ( "material_code = '" + raw_jo . getString ( "container_name" ) + "' AND task_status < '07' AND is_delete = '0'" ) . uniqueResult ( 0 ) ;
if ( ObjectUtil . isNotEmpty ( task_jo ) ) {
if ( ObjectUtil . isNotEmpty ( task_jo ) ) {
throw new BadRequestException ( "该生箔工单存在未完成的任务,请先完成任务!" ) ;
throw new BadRequestException ( "该生箔工单存在未完成的任务,请先完成任务!" ) ;
@ -862,7 +437,18 @@ public class RawFoilServiceImpl implements RawFoilService {
}
}
}
}
private void handleType2 ( SbPointIvt stIvtSbpointivt , JSONObject param ) {
private void handleType2 ( String point_code , JSONObject param ) {
if ( ObjectUtil . isEmpty ( point_code ) ) {
throw new BadRequestException ( "点位不能为空!" ) ;
}
SbPointIvt stIvtSbpointivt = sbPointIvtMapper . selectOne ( new LambdaQueryWrapper < SbPointIvt > ( )
. eq ( SbPointIvt : : getPoint_code , point_code ) ) ;
if ( ObjectUtil . isEmpty ( stIvtSbpointivt ) ) {
throw new BadRequestException ( "点位:" + stIvtSbpointivt . getExt_code ( ) + "生箔设备不存在" ) ;
}
if ( StrUtil . equals ( "0" , stIvtSbpointivt . getIs_used ( ) ) ) {
throw new BadRequestException ( "当前生箔机:" + stIvtSbpointivt . getExt_code ( ) + "未启用!" ) ;
}
if ( StrUtil . equals ( "01" , stIvtSbpointivt . getEmpty_point_status ( ) ) & & StrUtil . equals ( "01" , stIvtSbpointivt . getFull_point_status ( ) ) ) {
if ( StrUtil . equals ( "01" , stIvtSbpointivt . getEmpty_point_status ( ) ) & & StrUtil . equals ( "01" , stIvtSbpointivt . getFull_point_status ( ) ) ) {
JSONObject map = new JSONObject ( ) ;
JSONObject map = new JSONObject ( ) ;
map . put ( "product_area" , stIvtSbpointivt . getProduct_area ( ) ) ;
map . put ( "product_area" , stIvtSbpointivt . getProduct_area ( ) ) ;
@ -892,17 +478,24 @@ public class RawFoilServiceImpl implements RawFoilService {
}
}
}
}
private void handleType4 ( SbPointIvt stIvtSbpointivt , JSONObject param ) {
private void handleType4 ( String point_code , JSONObject param ) {
if ( ObjectUtil . isEmpty ( point_code ) ) {
throw new BadRequestException ( "点位不能为空!" ) ;
}
SbPointIvt stIvtSbpointivt = sbPointIvtMapper . selectOne ( new LambdaQueryWrapper < SbPointIvt > ( )
. eq ( SbPointIvt : : getPoint_code , point_code ) ) ;
if ( ObjectUtil . isEmpty ( stIvtSbpointivt ) ) {
throw new BadRequestException ( "点位:" + stIvtSbpointivt . getExt_code ( ) + "生箔设备不存在" ) ;
}
if ( StrUtil . equals ( "0" , stIvtSbpointivt . getIs_used ( ) ) ) {
throw new BadRequestException ( "当前生箔机:" + stIvtSbpointivt . getExt_code ( ) + "未启用!" ) ;
}
List < RawfoilWorkOrder > rawfoilWorkOrderList = rawfoilWorkOrderMapper . selectList ( new LambdaQueryWrapper < RawfoilWorkOrder > ( )
List < RawfoilWorkOrder > rawfoilWorkOrderList = rawfoilWorkOrderMapper . selectList ( new LambdaQueryWrapper < RawfoilWorkOrder > ( )
. eq ( ObjectUtil . isNotEmpty ( stIvtSbpointivt . getExt_code ( ) ) , RawfoilWorkOrder : : getResource_name , stIvtSbpointivt . getExt_code ( ) )
. eq ( ObjectUtil . isNotEmpty ( stIvtSbpointivt . getExt_code ( ) ) , RawfoilWorkOrder : : getResource_name , stIvtSbpointivt . getExt_code ( ) )
. eq ( RawfoilWorkOrder : : getStatus , "30" ) ) ;
. eq ( RawfoilWorkOrder : : getStatus , "30" ) ) ;
if ( CollectionUtil . isEmpty ( rawfoilWorkOrderList ) ) {
if ( CollectionUtil . isEmpty ( rawfoilWorkOrderList ) ) {
throw new BadRequestException ( "工单状态不为开始生产" ) ;
throw new BadRequestException ( "工单状态不为开始生产" ) ;
}
}
// JSONArray arr = pdmBiRawfoilworkorderService.query("resource_name = '" + sbPointIvt.getString("ext_code") + "' AND status = '30'").getResultJSONArray(0);
// if (arr.size() > 0) {
// throw new BadRequestException("当前生箔机存在已经开始生产的生箔工单,任务不能创建!");
// }
if ( StrUtil . equals ( "02" , stIvtSbpointivt . getEmpty_point_status ( ) ) & & StrUtil . equals ( "01" , stIvtSbpointivt . getFull_point_status ( ) ) ) {
if ( StrUtil . equals ( "02" , stIvtSbpointivt . getEmpty_point_status ( ) ) & & StrUtil . equals ( "01" , stIvtSbpointivt . getFull_point_status ( ) ) ) {
JSONObject map = new JSONObject ( ) ;
JSONObject map = new JSONObject ( ) ;