@@ -76,7 +76,6 @@ import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal ;
import java.util.* ;
import java.util.concurrent.TimeUnit ;
import java.util.function.Consumer ;
import java.util.regex.Pattern ;
import java.util.stream.Collectors ;
import java.util.stream.Stream ;
@@ -296,26 +295,26 @@ public class SlitterServiceImpl implements SlitterService {
String leftSpec = " " ;
String rightSize = " " ;
String rightSpec = " " ;
if ( ObjectUtil . isNotEmpty ( point . getTube_name1 ( ) ) ) {
String isFrpOrPaper = point . getTube_name1 ( ) . contains ( " FRP " ) ? " 2 " : " 1 " ;
if ( isFrpOrPaper . equals ( " 1 " ) ) {
if ( ObjectUtil . isNotEmpty ( point . getTube_name1 ( ) ) ) {
String isFrpOrPaper = point . getTube_name1 ( ) . contains ( " FRP " ) ? " 2 " : " 1 " ;
if ( isFrpOrPaper . equals ( " 1 " ) ) {
leftSize = MdmDescriptionParseUtils . extractPaperTubeSize ( point . getTube_name1 ( ) ) ;
} else {
} else {
leftSize = MdmDescriptionParseUtils . extractFRPTubeSizeTrans ( point . getTube_name1 ( ) ) ;
}
if ( ObjectUtil . isNotEmpty ( point . getTube_code1 ( ) ) ) {
leftSpec = SlitterTaskUtil . getComposePaperTubeInformation ( point . getTube_name1 ( ) , isFrpOrPaper ) ;
if ( ObjectUtil . isNotEmpty ( point . getTube_code1 ( ) ) ) {
leftSpec = SlitterTaskUtil . getComposePaperTubeInformation ( point . getTube_name1 ( ) , isFrpOrPaper ) ;
}
}
if ( ObjectUtil . isNotEmpty ( point . getTube_name2 ( ) ) ) {
String isFrpOrPaper = point . getTube_name2 ( ) . contains ( " FRP " ) ? " 2 " : " 1 " ;
if ( isFrpOrPaper . equals ( " 1 " ) ) {
if ( ObjectUtil . isNotEmpty ( point . getTube_name2 ( ) ) ) {
String isFrpOrPaper = point . getTube_name2 ( ) . contains ( " FRP " ) ? " 2 " : " 1 " ;
if ( isFrpOrPaper . equals ( " 1 " ) ) {
rightSize = MdmDescriptionParseUtils . extractPaperTubeSize ( point . getTube_name2 ( ) ) ;
} else {
} else {
rightSize = MdmDescriptionParseUtils . extractFRPTubeSizeTrans ( point . getTube_name2 ( ) ) ;
}
if ( ObjectUtil . isNotEmpty ( point . getTube_code2 ( ) ) ) {
rightSpec = SlitterTaskUtil . getComposePaperTubeInformation ( point . getTube_name2 ( ) , isFrpOrPaper ) ;
if ( ObjectUtil . isNotEmpty ( point . getTube_code2 ( ) ) ) {
rightSpec = SlitterTaskUtil . getComposePaperTubeInformation ( point . getTube_name2 ( ) , isFrpOrPaper ) ;
}
}
con . put ( " leftSize " , leftSize ) ;
@@ -478,10 +477,9 @@ public class SlitterServiceImpl implements SlitterService {
. collect ( Collectors . toList ( ) ) ;
// 6. 尝试拼单
// Param xnParam = paramService.findByCode(USE_XN);
String end_point = tryCombineOrder ( demoPlan , deviceCode , startPoint , qzzNo ) ;
if ( end_point = = null ) {
// 7. 正常业务流程(不拼单)
// 7. 正常业务流程(不拼单,如果是虚拟卷就等待被拼 )
handleNormalProcess ( demoPlan , startPoint , qzzNo , containerNames , deviceCode , stepTipLogs ) ;
}
res = new JSONObject ( ) ;
@@ -798,7 +796,7 @@ public class SlitterServiceImpl implements SlitterService {
if ( ObjectUtil . isEmpty ( ivt1 ) | | ObjectUtil . isEmpty ( ivt2 ) ) {
throw new BadRequestException ( " 没找到完整的气胀轴为空气胀轴暂存点! " ) ;
}
if ( currentUpPlan ! = null ) {
if ( currentUpPlan ! = null ) {
taskParam . put ( " point_code1 " , ivt1 . getPoint_code ( ) ) ;
taskParam . put ( " point_code2 " , actualDevice . getUp_point_code ( ) ) ;
taskParam . put ( " point_code3 " , actualDevice . getUp_point_code ( ) ) ;
@@ -827,7 +825,7 @@ public class SlitterServiceImpl implements SlitterService {
taskParam2 . put ( " up_roll " , nextDownPlans . stream ( ) . map ( PdmBiSlittingproductionplan : : getContainer_name ) . collect ( Collectors . toList ( ) ) ) ;
taskParam2 . put ( " flag " , " 3 " ) ;
taskParam2 . put ( " to_Task1_Axis_Type " , nextDownPlan . getQzz_size ( ) ) ;
} else {
} else {
taskParam . put ( " point_code1 " , ivt1 . getPoint_code ( ) ) ;
taskParam . put ( " point_code2 " , actualDevice . getDown_point_code ( ) ) ;
taskParam . put ( " point_code3 " , actualDevice . getDown_point_code ( ) ) ;
@@ -1588,8 +1586,8 @@ public class SlitterServiceImpl implements SlitterService {
}
//校验对应分切计划是否已经创建过任务搬运到拔轴区进行拔轴
List < PdmBiSlittingproductionplan > error_plans = plans . stream ( ) . filter ( plan - > " 1 " . equals ( plan . getSysdeptid ( ) ) ) . collect ( Collectors . toList ( ) ) ;
if ( error_plans . size ( ) > 0 ) {
throw new BadRequestException ( " 操作失败,子卷【 " + error_plans . get ( 0 ) . getContainer_name ( ) + " 】已经创建过任务搬运至拔轴区,请核对子卷号是否正确! " ) ;
if ( error_plans . size ( ) > 0 ) {
throw new BadRequestException ( " 操作失败,子卷【 " + error_plans . get ( 0 ) . getContainer_name ( ) + " 】已经创建过任务搬运至拔轴区,请核对子卷号是否正确! " ) ;
}
taskParam . put ( " containers " , collect ) ;
@@ -1638,6 +1636,10 @@ public class SlitterServiceImpl implements SlitterService {
@Override
public JSONObject toCleanCutCacheInventory ( JSONObject param ) {
log . info ( " 手持清理分切暂存位参数:{} " , param ) ;
JSONObject res = new JSONObject ( ) ;
res . put ( " status " , HttpStatus . HTTP_OK ) ;
res . put ( " message " , " 库存清除成功! " ) ;
// param: point_code
String pointCode = param . getString ( " point_code " ) ;
RLock open = redissonClient . getLock ( pointCode ) ;
@@ -1651,6 +1653,23 @@ public class SlitterServiceImpl implements SlitterService {
if ( openLock ) {
BstIvtCutpointivt agvCode = bcutpointivtService . getPintByTrussCode ( pointCode , false ) ;
if ( ObjectUtil . isEmpty ( agvCode ) ) {
// 可能是分切缓存架子
Deliverycachepointivt deliverycachepointivt = deliverycachepointivtService . getPintByCode ( pointCode , false ) ;
if ( ObjectUtil . isNotEmpty ( deliverycachepointivt ) ) {
// 删除对应的气胀轴信息
if ( ObjectUtil . isNotEmpty ( deliverycachepointivt . getQzzno ( ) ) ) {
List < PdmBiSlittingproductionplan > byQzzNoNotDeleted = slittingproductionplanService . getByQzzNoNotDeleted ( deliverycachepointivt . getQzzno ( ) ) ;
if ( ! byQzzNoNotDeleted . isEmpty ( ) ) {
slittingproductionplanService . deleteAll ( byQzzNoNotDeleted . stream ( ) . map ( PdmBiSlittingproductionplan : : getWorkorder_id ) . collect ( Collectors . toSet ( ) ) ) ;
}
}
deliverycachepointivt . setQzzno ( " " ) ;
deliverycachepointivt . setPoint_status ( " 01 " ) ;
deliverycachepointivt . setUpdate_optid ( SecurityUtils . getCurrentUserId ( ) ) ;
deliverycachepointivt . setUpdate_optname ( SecurityUtils . getCurrentNickName ( ) ) ;
deliverycachepointivt . setUpdate_time ( DateUtil . now ( ) ) ;
return res ;
}
throw new BadRequestException ( " 请输入正确的点位编码,未查询到该点位【 " + pointCode + " 】 " ) ;
}
if ( agvCode . getTruss_point_code1 ( ) . equals ( pointCode ) ) {
@@ -1672,9 +1691,6 @@ public class SlitterServiceImpl implements SlitterService {
open . unlock ( ) ;
}
}
JSONObject res = new JSONObject ( ) ;
res . put ( " status " , HttpStatus . HTTP_OK ) ;
res . put ( " message " , " 库存清除成功! " ) ;
return res ;
}
@@ -2657,7 +2673,7 @@ public class SlitterServiceImpl implements SlitterService {
if ( cutPointList . size ( ) = = 0 & & cachePointList . size ( ) = = 0 ) {
tips . add ( " 没有为设备[ " + deviceCode + " ]套好轴的位置!或者已经创建任务! " ) ;
} else {
if ( cutPointList . size ( ) > 0 ) {
if ( cutPointList . size ( ) > 0 ) {
String collect = timePlans . stream ( ) . map ( PdmBiSlittingproductionplan : : getContainer_name ) . collect ( Collectors . joining ( " ',' " ) ) ;
// 找到该分切计划的点位
tips . add ( " 为设备[ " + deviceCode + " ]套好轴的位置在[ " + cutPointList . stream ( ) . map ( BstIvtCutpointivt : : getPoint_code ) . collect ( Collectors . joining ( " ',' " ) ) + " ], " +
@@ -3901,8 +3917,8 @@ public class SlitterServiceImpl implements SlitterService {
// location, qzz_size, qzz_generation
// 虚拟设备: A1_XNFQ_01
String area = param . getString ( " area " ) ;
String device_code = param . getString ( " device_code " ) ;
Integer number = param . getInteger ( " qz z_num " ) ;
String device_code = param . getString ( " location " ) ;
Integer number = param . getInteger ( " qq z_num " ) ;
String qzz_generation = param . getString ( " qzz_generation " ) ;
StIvtCutpointivt xnDevice = cutpointivtService . getPintByPointCode ( device_code , true ) ;
if ( ObjectUtil . isEmpty ( xnDevice ) ) {
@@ -3910,19 +3926,19 @@ public class SlitterServiceImpl implements SlitterService {
}
// mes的设备号
String deviceCode = xnDevice . getExt_code ( ) ;
// todo: 判断位置是否够用
// // 判断还有没有位置(没有就不给创建)
// List<Deliverycachepointivt> canUsePoint = deliverycachepointivtService.list(new LambdaQueryWrapper<Deliverycachepointivt>( )
// .eq( Deliverycachepointivt::getProduct_area, area )
// .eq( Deliverycachepointivt::getPoint_location, location )
// .eq( Deliverycachepointivt::getIs_used, "1")
// .eq(Deliverycachepointivt::getPoint_status, "01")
// .like(Deliverycachepointivt::getCan_size, qzz_size));
// // 获取当前区域、位置的分切计划
// int planCount = p dmBiSlittingproductionplanService.getCountXN(area, location) ;
// if (canUsePoint.size() < (number + planCount)) {
// throw new BadRequestException("该半区该尺寸类型的位置剩余【" + canUsePoint.size() + "】个") ;
// }
// 判断还有没有位置(没有就不给创建)
List < Deliverycachepointivt > canUsePoint = deliverycachepointivtService . list ( new LambdaQueryWrapper < Deliverycachepointivt > ( )
. eq ( Deliverycachepointivt : : getProduct_area , area )
. eq ( Deliverycachepointivt: : getPlan , xnDevice . getPlan ( ) )
. eq ( Deliverycachepointivt: : getIs_used , " 1 " )
. eq ( Deliverycachepointivt: : getPoint_status , " 01 " ) ) ;
// 获取当前区域、位置的分切计划
int planCount = slittingproductionplanService . count ( new LambdaQueryWrapper < PdmBiSlittingproductionplan > ( )
. eq ( PdmBiSlittingproductionplan : : getResource_name , xnDevice . getExt_code ( ) )
. eq ( P dmBiSlittingproductionplan: : getIs_delete , " 0 " ) ) ;
if ( canUsePoint . size ( ) < ( number + planCount ) ) {
throw new BadRequestException( " 该区域的位置不够,只剩 " + canUsePoint . size ( ) + " 个空位可用 " ) ;
}
// 当前轴需要的管芯名称 ...
String upLeftSizeK = param . getString ( " up_left_size_k " ) ;
String upRightSizeK = param . getString ( " up_right_size_k " ) ;
@@ -4003,32 +4019,32 @@ public class SlitterServiceImpl implements SlitterService {
plan . setQzz_size ( upLeftQzzSize ) ;
if ( frp ) {
plan . setPaper_tube_or_FRP ( " 2 " ) ;
plan . setPaper_tube_material ( upLeftSizeV ) ;
plan . setPaper_tube_model ( upLeftSizeK ) ;
plan . setPaper_tube_description ( upLeftSizeK ) ;
} else {
plan . setPaper_tube_or_FRP ( " 1 " ) ;
plan . setFRP_material ( upLeftSizeV ) ;
plan . setFRP_model ( upLeftSizeK ) ;
plan . setFRP_description ( upLeftSizeK ) ;
} else {
plan . setPaper_tube_or_FRP ( " 1 " ) ;
plan . setPaper_tube_material ( upLeftSizeV ) ;
plan . setPaper_tube_model ( upLeftSizeK ) ;
plan . setPaper_tube_description ( upLeftSizeK ) ;
}
plan . setUp_or_down ( " 1 " ) ;
plan . setLeft_or_right ( " 1 " ) ;
}
if ( ObjectUtil . isNotEmpty ( upRightSizeK ) & & j = = 1 ) {
if ( ObjectUtil . isNotEmpty ( upRightSizeK ) & & j = = 1 ) {
// 上右
boolean frp = upRightSizeK . contains ( " FRP " ) ;
plan . setQzz_size ( upRightQzzSize ) ;
if ( frp ) {
plan . setPaper_tube_or_FRP ( " 2 " ) ;
plan . setPaper_tube_material ( upRightSizeV ) ;
plan . setPaper_tube_model ( upRightSizeK ) ;
plan . setPaper_tube_description ( upRightSizeK ) ;
} else {
plan . setPaper_tube_or_FRP ( " 1 " ) ;
plan . setFRP_material ( upRightSizeV ) ;
plan . setFRP_model ( upRightSizeK ) ;
plan . setFRP_description ( upRightSizeK ) ;
} else {
plan . setPaper_tube_or_FRP ( " 1 " ) ;
plan . setPaper_tube_material ( upRightSizeV ) ;
plan . setPaper_tube_model ( upRightSizeK ) ;
plan . setPaper_tube_description ( upRightSizeK ) ;
}
plan . setUp_or_down ( " 1 " ) ;
plan . setLeft_or_right ( " 2 " ) ;
@@ -4064,20 +4080,38 @@ public class SlitterServiceImpl implements SlitterService {
@Transactional ( rollbackFor = Exception . class )
public JSONObject doBindPlanDevice ( JSONObject param ) {
log . info ( " {} 操作绑定分切计划与气胀轴,请求参数:{} " , SecurityUtils . getCurrentNickName ( ) , param . toJSONString ( ) ) ;
String upShelf = param . getString ( " upShelf " ) ;
String upPlanCode = param . getString ( " upPlanCode " ) ;
String downShelf = param . getString ( " downShelf " ) ;
String downPlanCode = param . getString ( " downPlanCode " ) ;
String force = param . getString ( " force " ) ;
String device = param . getString ( " device " ) ;
if ( upPlanCode . equals ( downPlanCode ) ) {
throw new BadRequestException ( " 不能绑定相同的两个计划 " ) ;
RLock open = redissonClient . getLock ( " lockDoBindPlanDevice " ) ;
boolean openLock ;
try {
openLock = open . tryLock ( 0 , TimeUnit . SECONDS ) ;
} catch ( InterruptedException e ) {
throw new RuntimeException ( e ) ;
}
if ( ObjectUtil . isNotEmpty ( upShelf ) ) {
doBindNewPlanInfo ( upShelf , upPlanCode , force , device ) ;
}
if ( ObjectUtil . isNotEmpty ( downShelf ) ) {
doBindNewPlanInfo ( downShelf , downPlanCode , force , device ) ;
try {
if ( openLock ) {
String upShelf = param . getString ( " upShelf " ) ;
String upPlanCode = param . getString ( " upPlanCode " ) ;
String downShelf = param . getString ( " downShelf " ) ;
String downPlanCode = param . getString ( " downPlanCode " ) ;
String force = param . getString ( " force " ) ;
String device = param . getString ( " device " ) ;
if ( upPlanCode . equals ( downPlanCode ) ) {
throw new BadRequestException ( " 不能绑定相同的两个计划 " ) ;
}
if ( ObjectUtil . isNotEmpty ( upShelf ) ) {
doBindNewPlanInfo ( upShelf , upPlanCode , force , device ) ;
}
if ( ObjectUtil . isNotEmpty ( downShelf ) ) {
doBindNewPlanInfo ( downShelf , downPlanCode , force , device ) ;
}
} else {
throw new BadRequestException ( " 系统繁忙,稍后在试!! " ) ;
}
} finally {
if ( open . isLocked ( ) & & open . isHeldByCurrentThread ( ) ) {
open . unlock ( ) ;
}
}
JSONObject res = new JSONObject ( ) ;
res . put ( " status " , HttpStatus . HTTP_OK ) ;
@@ -4085,7 +4119,9 @@ public class SlitterServiceImpl implements SlitterService {
return res ;
}
/** 绑定新计划信息 */
/**
* 绑定新计划信息
*/
private void doBindNewPlanInfo ( String shelfCode , String containerName , String force , String device ) {
Deliverycachepointivt shelf = deliverycachepointivtService . getPintByCode ( shelfCode , true ) ;
StIvtCutpointivt cutDevice = cutpointivtService . getPintByExtCode ( device , false ) ;
@@ -4103,14 +4139,15 @@ public class SlitterServiceImpl implements SlitterService {
throw new BadRequestException ( " 子卷: " + containerName + " 计划信息不存在! " ) ;
}
// 判断子卷有没有绑定到分切对接位上
List < BstIvtCutpointivt > alreadBindPlans = bcutpointivtService . list ( new LambdaQueryWrapper < BstIvtCutpointivt > ( )
List < BstIvtCutpointivt > already BindPlans = bcutpointivtService . list ( new LambdaQueryWrapper < BstIvtCutpointivt > ( )
. eq ( BstIvtCutpointivt : : getIs_used , true )
. and ( l - > l . eq ( BstIvtCutpointivt : : getQzz_no1 , planOne . getQzzno ( ) ) . or ( )
. eq ( BstIvtCutpointivt : : getQzz_no2 , planOne . getQzzno ( ) ) )
) ;
if ( ! alreadBindPlans . isEmpty ( ) ) {
if ( ! already BindPlans . isEmpty ( ) ) {
throw new BadRequestException ( " 子卷: " + containerName + " 已经绑定过子卷到暂存架上! " ) ;
}
// todo: 这台分切机已经绑定过其他子卷???
if ( ObjectUtil . isNotEmpty ( planOne . getQzzno ( ) ) ) {
// 判断是不是绑定过的,就查一下这个气胀轴编码在缓存架子上存不存在
@@ -4347,7 +4384,7 @@ public class SlitterServiceImpl implements SlitterService {
* 尝试拼单逻辑
*/
private String tryCombineOrder ( PdmBiSlittingproductionplan demoPlan , String deviceCode ,
BstIvtShafttubeivt startPoint , String qzzNo ) {
BstIvtShafttubeivt startPoint , String qzzNo ) {
Param codParam = paramService . findByCode ( IS_COMBINED_ORDER ) ;
// 判断是否有同组(判断自己能不能拼单)
Integer sameNumber = slittingproductionplanService . getSameTripParentContainerPlanCount ( demoPlan ) ;
@@ -4377,7 +4414,7 @@ public class SlitterServiceImpl implements SlitterService {
. device ( resourceName )
. area ( deviceInfo . getProduct_area ( ) )
. build ( ) ) ;
if ( ObjectUtil . isEmpty ( emptyNotTaskPoint ) ) {
if ( ObjectUtil . isEmpty ( emptyNotTaskPoint ) ) {
return null ;
}
BstIvtCutpointivt cutPoint = emptyNotTaskPoint . get ( 0 ) ;
@@ -4387,7 +4424,7 @@ public class SlitterServiceImpl implements SlitterService {
// 如果找到可拼单点位,创建任务
if ( ! StrUtil . isEmpty ( end_point ) ) {
createCombinedOrderTask ( startPoint , demoPlan , qzzNo , end_point ) ;
createCombinedOrderTask ( startPoint , demoPlan , qzzNo , end_point ) ;
return end_point ;
}
@@ -4398,7 +4435,7 @@ public class SlitterServiceImpl implements SlitterService {
* 尝试与运行中的任务拼单
*/
private String tryMatchRunningTask ( PdmBiSlittingproductionplan demoPlan ,
String deviceCode , StIvtCutpointivt deviceInfo ) {
String deviceCode , StIvtCutpointivt deviceInfo ) {
SchBaseTask runningTask = taskService . getOne ( new LambdaQueryWrapper < SchBaseTask > ( )
. eq ( SchBaseTask : : getHandle_class , " org.nl.b_lms.sch.tasks.slitter.TrussSendAirShaftTask " )
. lt ( SchBaseTask : : getTask_status , " 07 " )
@@ -4410,7 +4447,7 @@ public class SlitterServiceImpl implements SlitterService {
}
List < String > qzzNoList = Stream . of ( runningTask . getVehicle_code ( ) , runningTask . getVehicle_code2 ( ) )
. filter ( s - > s ! = null & & StrUtil. isNotEmpty( s ) ) // 过滤 null 和空字符串
. filter ( StrUtil : : isNotEmpty) // 过滤 null 和空字符串
. collect ( Collectors . toList ( ) ) ;
List < PdmBiSlittingproductionplan > runningShafts = slittingproductionplanService . getByQzzNos ( qzzNoList ) ;
@@ -4431,8 +4468,8 @@ public class SlitterServiceImpl implements SlitterService {
. eq ( BstIvtCutpointivt : : getTruss_point_code1 , runningTask . getPoint_code2 ( ) ) . or ( )
. eq ( BstIvtCutpointivt : : getTruss_point_code2 , runningTask . getPoint_code2 ( ) ) ) ;
if ( one ! = null & & StrUtil . isNotEmpty ( canCombineWithRunningTask ( one , runningTask ) ) ) {
return canCombineWithRunningTask ( one , runningTask ) ;
if ( one ! = null & & StrUtil . isNotEmpty ( canCombineWithRunningTask ( one , runningTask ) ) ) {
return canCombineWithRunningTask ( one , runningTask ) ;
}
}
}
@@ -4554,6 +4591,7 @@ public class SlitterServiceImpl implements SlitterService {
private void createNormalTask ( BstIvtCutpointivt cutPoint , BstIvtShafttubeivt startPoint ,
PdmBiSlittingproductionplan demoPlan , String qzzNo ,
List < String > containerNames ) {
Param xnParam = paramService . findByCode ( USE_XN ) ;
JSONObject taskParam = new JSONObject ( ) ;
taskParam . put ( " point_code1 " , startPoint . getPoint_code ( ) ) ;
taskParam . put ( " point_code2 " , SlitterConstant . SLITTER_SHAFT_UP . equals ( demoPlan . getUp_or_down ( ) )
@@ -4566,7 +4604,9 @@ public class SlitterServiceImpl implements SlitterService {
taskParam . put ( " qzz_size " , demoPlan . getQzz_size ( ) ) ;
taskParam . put ( " product_area " , SlitterConstant . SLITTER_TASK_AREA ) ;
taskParam . put ( " immediateNotifyAcs " , " 1 " ) ;
if ( ObjectUtil . isNotEmpty ( xnParam ) & & " 1 " . equals ( xnParam . getValue ( ) ) ) {
taskParam . put ( " flag " , " 1 " ) ;
}
trussSendAirShaftTask . createTask ( taskParam ) ;
}
}