|
|
@ -27,14 +27,12 @@ import org.nl.b_lms.sch.tasks.slitter.StockAreaSendVehicleTask; |
|
|
|
import org.nl.b_lms.sch.tasks.slitter.TrussCallAirShaftTask; |
|
|
|
import org.nl.b_lms.sch.tasks.slitter.constant.SlitterConstant; |
|
|
|
import org.nl.b_lms.sch.tasks.slitter.constant.SlitterEnum; |
|
|
|
import org.nl.b_lms.sch.tasks.slitter.mapper.SlitterMapper; |
|
|
|
import org.nl.b_lms.sch.tasks.slitter.mapper.dto.BhTubeMovePointDto; |
|
|
|
import org.nl.b_lms.sch.tasks.slitter.mapper.dto.BhTubePointDto; |
|
|
|
import org.nl.b_lms.sch.tasks.slitter.mapper.dto.SlitterPlanDistinctDto; |
|
|
|
import org.nl.b_lms.sch.tasks.slitter.util.SlitterTaskUtil; |
|
|
|
import org.nl.common.enums.NoticeTypeEnum; |
|
|
|
import org.nl.common.utils.TaskUtils; |
|
|
|
import org.nl.modules.common.utils.RedisUtils; |
|
|
|
import org.nl.system.service.notice.ISysNoticeService; |
|
|
|
import org.nl.system.service.param.ISysParamService; |
|
|
|
import org.nl.system.service.param.dao.Param; |
|
|
@ -85,18 +83,12 @@ public class AutoCallAirShaftTask extends Prun { |
|
|
|
private IschBaseTaskService taskService; |
|
|
|
@Autowired |
|
|
|
private ISysParamService paramService; |
|
|
|
@Autowired |
|
|
|
private RedisUtils redisUtils; |
|
|
|
@Autowired |
|
|
|
private SlitterMapper slitterMapper; |
|
|
|
|
|
|
|
public final static String PARAM_CODE_PLAN_AREA = "PARAM_CODE_PLAN_AREA"; |
|
|
|
public final static String IS_ONLY_PULLING = "IS_ONLY_PULLING"; |
|
|
|
public final static String TZ_DAY = "TZ_DAY"; |
|
|
|
public final static String USE_XN = "USE_XN"; |
|
|
|
public final static String MAX_QZZ_NUM = "MAX_QZZ_NUM"; |
|
|
|
public String stepStr = ""; |
|
|
|
public List<String> stepErrorInfo = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
public void run() { |
|
|
@ -116,9 +108,7 @@ public class AutoCallAirShaftTask extends Prun { |
|
|
|
"", "0"); |
|
|
|
//循环点位,最多循环两次
|
|
|
|
for (BstIvtShafttubeivt empty : emptyPoints) { |
|
|
|
stepErrorInfo = new ArrayList<>(); |
|
|
|
doCallShaft(isOnlyPulling, tzDay, tzArea, useXn, max_qzz_num); |
|
|
|
redisUtils.set("ERROR" + empty.getPoint_code(), stepErrorInfo); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -133,7 +123,7 @@ public class AutoCallAirShaftTask extends Prun { |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void doCallShaft(Param isOnlyPulling, Param tzDay, Param tzArea, Param useXn, Param max_qzz_num) { |
|
|
|
//查询套轴缓存位:点位启用、有子卷、气胀轴字段不为空、且无未完成的任务
|
|
|
|
List<CutpointAirShhaftDto> notTaskPoints = bcutpointivtService.getAreaNotTaskPointByTcQzzPoint("0"); |
|
|
|
List<CutpointAirShhaftDto> notTaskPoints = bcutpointivtService.getAreaNotTaskPointByTcQzzPoint(""); |
|
|
|
//若有拔轴任务,则会执行本段代码
|
|
|
|
//对满足的需拔轴子卷遍历下发任务,同时每次拔轴下发前判断是否有可以接续的套轴计划
|
|
|
|
for(int i= 0;i<notTaskPoints.size();i++){ |
|
|
@ -165,24 +155,17 @@ public class AutoCallAirShaftTask extends Prun { |
|
|
|
} |
|
|
|
//需拔子卷计划
|
|
|
|
PdmBiSlittingproductionplan plan = list.get(0); |
|
|
|
//再次查询空的拔轴机构点位,优先查同区的拔轴设备
|
|
|
|
//再次查询空的拔轴机构点位,查同区的拔轴设备
|
|
|
|
List<BstIvtShafttubeivt> emptyPoints = bstIvtShafttubeivtService.getAllShaftPointsByConditions("2", |
|
|
|
cutpointivt.getPoint_location(), "0"); |
|
|
|
cutpointivt.getProduct_area(), "0"); |
|
|
|
if(emptyPoints.size() == 0){ |
|
|
|
String point_location = "0"; |
|
|
|
if (StrUtil.equals(cutpointivt.getPoint_location(), "0")) |
|
|
|
point_location = "1"; |
|
|
|
if (StrUtil.equals(cutpointivt.getPoint_location(), "1")) |
|
|
|
point_location = "0"; |
|
|
|
emptyPoints = bstIvtShafttubeivtService.getAllShaftPointsByConditions("2", |
|
|
|
point_location, "0"); |
|
|
|
if(emptyPoints.size() == 0){ |
|
|
|
log.warn("气涨轴[{}]排队中,暂时无空闲拔轴机构!", qzzNo); |
|
|
|
bcutpointivtService.update(new UpdateWrapper<BstIvtCutpointivt>() |
|
|
|
.eq("ivt_id",cutpointivt.getIvt_id()) |
|
|
|
.set("remark","排队中,暂时无空闲拔轴机构!") |
|
|
|
.set("update_time",DateUtil.now())); |
|
|
|
//跳过当前子卷
|
|
|
|
//跳过当前子卷任务
|
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
@ -213,7 +196,6 @@ public class AutoCallAirShaftTask extends Prun { |
|
|
|
|
|
|
|
//判断系统参数是否只做拔轴
|
|
|
|
if (ObjectUtil.isNotEmpty(isOnlyPulling) && SlitterConstant.SLITTER_YES.equals(isOnlyPulling.getValue())) { |
|
|
|
stepErrorInfo.add("系统设置了只做拔轴,详细看参数表:" + IS_ONLY_PULLING); |
|
|
|
//校验是否有空气胀轴位
|
|
|
|
if(!this.havaEmptyShaft(emptyPoints.get(0),plan,max_qzz_num)) { |
|
|
|
log.warn("气涨轴[{}]排队中,暂时无空闲气胀轴空位放空轴!", qzzNo); |
|
|
@ -297,6 +279,7 @@ public class AutoCallAirShaftTask extends Prun { |
|
|
|
setIsSleeveShaft(param); |
|
|
|
// 当前拔轴的分切计划,一根轴最多2卷子卷
|
|
|
|
List<PdmBiSlittingproductionplan> oldPlans = slittingproductionplanService.getByQzzNo(qzzNo); |
|
|
|
|
|
|
|
// 保存所需要的分切计划数据到点位上(套轴对接位)更新分切计划
|
|
|
|
saveCutPlanMessage(emptyPoints.get(0), needPlans, qzzSize, needPlan.getQzz_generation()); |
|
|
|
//设置当前的拔管纸管信息到param里
|
|
|
@ -322,7 +305,6 @@ public class AutoCallAirShaftTask extends Prun { |
|
|
|
//拔轴任务循环已结束,判断系统参数是否只做拔轴,若否进入套轴计划判断循环
|
|
|
|
if (!(ObjectUtil.isNotEmpty(isOnlyPulling) && SlitterConstant.SLITTER_YES.equals(isOnlyPulling.getValue()))) { |
|
|
|
log.error("系统设置了只做拔轴,详细看参数表:" + IS_ONLY_PULLING); |
|
|
|
stepErrorInfo.add("系统设置了只做拔轴,详细看参数表:" + IS_ONLY_PULLING); |
|
|
|
//获取可下发的分切计划
|
|
|
|
List<SlitterPlanDistinctDto> plans = this.getCanIssuedCutPlan(tzDay, tzArea, useXn); |
|
|
|
//对满足的计划遍历下发任务
|
|
|
@ -332,24 +314,17 @@ public class AutoCallAirShaftTask extends Prun { |
|
|
|
String qzzSize = planDto.getQzz_size(); |
|
|
|
//计划中需要的气胀轴代数
|
|
|
|
String qzz_generation = planDto.getQzz_generation(); |
|
|
|
String location = "0"; |
|
|
|
String product_area = ""; |
|
|
|
if (StrUtil.equals(qzz_generation, "4")){ |
|
|
|
location = "0"; |
|
|
|
product_area = "A"; |
|
|
|
}else if (StrUtil.equals(qzz_generation, "5")){ |
|
|
|
location = "1"; |
|
|
|
product_area = "B"; |
|
|
|
} |
|
|
|
|
|
|
|
//再次查询空的拔轴机构点位,优先查同区的拔轴设备
|
|
|
|
List<BstIvtShafttubeivt> emptyPoints = bstIvtShafttubeivtService.getAllShaftPointsByConditions("2", |
|
|
|
location, "0"); |
|
|
|
product_area, "0"); |
|
|
|
if(emptyPoints.size() == 0){ |
|
|
|
if (StrUtil.equals(location, "0")){ |
|
|
|
location = "1"; |
|
|
|
}else if (StrUtil.equals(location, "1")){ |
|
|
|
location = "0"; |
|
|
|
} |
|
|
|
emptyPoints = bstIvtShafttubeivtService.getAllShaftPointsByConditions("2", |
|
|
|
location, "0"); |
|
|
|
if(emptyPoints.size() == 0){ |
|
|
|
log.warn("分切计划{}排队中,暂时无空闲拔轴机构!", planDto.getWorkorder_id()); |
|
|
|
slittingproductionplanService.update(new UpdateWrapper<PdmBiSlittingproductionplan>() |
|
|
@ -391,7 +366,6 @@ public class AutoCallAirShaftTask extends Prun { |
|
|
|
// 调用ACS滚条气涨轴下来
|
|
|
|
if (!toAcsOutShaft(planDto, emptyPoints.get(0))) { |
|
|
|
log.error("呼叫出轴失败-穿拔轴{}不进行套轴,跳过!", emptyPoints.get(0).getPoint_code()); |
|
|
|
stepErrorInfo.add("呼叫出轴失败-穿拔轴" + emptyPoints.get(0).getPoint_code() + "不进行套轴,跳过!"); |
|
|
|
return; |
|
|
|
} |
|
|
|
//调用agv换托盘
|
|
|
@ -438,77 +412,19 @@ public class AutoCallAirShaftTask extends Prun { |
|
|
|
String qzzSize = planD.getQzz_size(); |
|
|
|
//代数4或5
|
|
|
|
String qzzGeneration = planD.getQzz_generation(); |
|
|
|
//当前拔轴设备所在区域0或1
|
|
|
|
String location = empty.getPoint_location(); |
|
|
|
//当前拔轴设备所在区域
|
|
|
|
String product_area = empty.getProduct_area(); |
|
|
|
|
|
|
|
// 根据尺寸和代数,查询气涨轴暂存架是否有库存
|
|
|
|
List<BstIvtShafttubeivt> qzzCache = bstIvtShafttubeivtService.getNotTaskShaftCache2(qzzSize, |
|
|
|
qzzGeneration, ""); |
|
|
|
qzzGeneration, product_area); |
|
|
|
if (qzzCache.size() > 0) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
else{//若暂存架无库存,根据当前拔轴设备所在区域判断是否有缓存架,以及缓存架是否有库存
|
|
|
|
//若点位是短区,且计划需要4短;若点位是长区,且计划需要5长
|
|
|
|
if ((StrUtil.equals(qzzGeneration, "4") && StrUtil.equals(location, "0")) || (StrUtil.equals(qzzGeneration, "5") && StrUtil.equals(location, "1"))){ |
|
|
|
// 查询拔轴设备旁边缓存架点位是否存在
|
|
|
|
List<BstIvtShafttubeivt> shafttubeivts = bstIvtShafttubeivtService.getByQzzSize(qzzSize ,empty.getPoint_code(), location); |
|
|
|
if (shafttubeivts.size() == 0) { |
|
|
|
log.error("气胀轴库找不到[" + qzzSize + "]规格的气涨轴缓存位"); |
|
|
|
return false; |
|
|
|
} |
|
|
|
// 对应尺寸的气涨轴库
|
|
|
|
BstIvtShafttubeivt shafttubeivt = shafttubeivts.get(0); |
|
|
|
//判断是否存在残留的脏数据
|
|
|
|
String plan = shafttubeivt.getPlan(); |
|
|
|
if(ObjectUtil.isNotEmpty(plan) && StrUtil.equals(plan, "1")){ |
|
|
|
log.error("气胀轴库" + shafttubeivt.getPoint_code() + "预分配字段plan异常,需要确认并初始化!"); |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
// 判断气胀轴是否有轴
|
|
|
|
JSONArray device_rows = new JSONArray(); |
|
|
|
JSONObject device_obj = new JSONObject(); |
|
|
|
device_rows.add(device_obj); |
|
|
|
device_obj.put("device_code", shafttubeivt.getPoint_code()); |
|
|
|
device_obj.put("product_area", "B1"); |
|
|
|
JSONObject pointStatus = wmsToAcsService.getPointStatus(device_rows); |
|
|
|
if (ObjectUtil.isEmpty(pointStatus) || ObjectUtil.isEmpty(pointStatus.getJSONArray("data"))) { |
|
|
|
log.error("获取气胀轴库信息失败"); |
|
|
|
return false; |
|
|
|
} |
|
|
|
JSONObject data2 = pointStatus.getJSONArray("data").getJSONObject(0); |
|
|
|
if (data2.getInteger("qty") > 0) { |
|
|
|
return true; |
|
|
|
}else{ |
|
|
|
log.warn("气胀轴库【" + shafttubeivt.getPoint_code() + "】没有气胀轴。"); |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
} |
|
|
|
/** |
|
|
|
* 判断是不是有足够的 对应尺寸、代数的气胀轴空位 |
|
|
|
* @param empty 当前分配的拔轴设备点位 |
|
|
|
* @param plan 当前需拔轴的计划信息 |
|
|
|
* @param max_qzz_num 气胀轴缓存架最大缓存数量 |
|
|
|
* @return true 有空位, false无空位 |
|
|
|
*/ |
|
|
|
public boolean havaEmptyShaft(BstIvtShafttubeivt empty, PdmBiSlittingproductionplan plan, Param max_qzz_num) { |
|
|
|
//气胀轴尺寸3寸或6寸
|
|
|
|
String qzzSize = plan.getQzz_size(); |
|
|
|
//代数4或5
|
|
|
|
String qzzGeneration = plan.getQzz_generation(); |
|
|
|
//当前拔轴设备所在区域0或1
|
|
|
|
String location = empty.getPoint_location(); |
|
|
|
//获取气胀轴缓存架最大缓存数量
|
|
|
|
Integer max_num = Integer.valueOf(max_qzz_num.getValue()); |
|
|
|
|
|
|
|
//若点位是短区,且计划需要4短;若点位是长区,且计划需要5长
|
|
|
|
if ((StrUtil.equals(qzzGeneration, "4") && StrUtil.equals(location, "0")) || (StrUtil.equals(qzzGeneration, "5") && StrUtil.equals(location, "1"))) |
|
|
|
{ |
|
|
|
else{ |
|
|
|
//若暂存架无库存,根据当前拔轴设备所在区域判断是否有缓存架,以及缓存架是否有库存
|
|
|
|
// 查询拔轴设备旁边缓存架点位是否存在
|
|
|
|
List<BstIvtShafttubeivt> shafttubeivts = bstIvtShafttubeivtService.getByQzzSize(qzzSize ,empty.getPoint_code(), location); |
|
|
|
List<BstIvtShafttubeivt> shafttubeivts = bstIvtShafttubeivtService.getByQzzSize(qzzSize ,empty.getPoint_code(), product_area); |
|
|
|
if (shafttubeivts.size() == 0) { |
|
|
|
log.error("气胀轴库找不到[" + qzzSize + "]规格的气涨轴缓存位"); |
|
|
|
return false; |
|
|
@ -516,49 +432,80 @@ public class AutoCallAirShaftTask extends Prun { |
|
|
|
// 对应尺寸的气涨轴库
|
|
|
|
BstIvtShafttubeivt shafttubeivt = shafttubeivts.get(0); |
|
|
|
//判断是否存在残留的脏数据
|
|
|
|
String planStr = shafttubeivt.getPlan(); |
|
|
|
if(ObjectUtil.isNotEmpty(planStr) && StrUtil.equals(planStr, "1")){ |
|
|
|
String plan = shafttubeivt.getPlan(); |
|
|
|
if(ObjectUtil.isNotEmpty(plan) && StrUtil.equals(plan, "1")){ |
|
|
|
log.error("气胀轴库" + shafttubeivt.getPoint_code() + "预分配字段plan异常,需要确认并初始化!"); |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
// 判断气胀轴是否有轴
|
|
|
|
JSONArray device_rows = new JSONArray(); |
|
|
|
JSONObject device_obj = new JSONObject(); |
|
|
|
device_rows.add(device_obj); |
|
|
|
device_obj.put("device_code", shafttubeivt.getPoint_code()); |
|
|
|
device_obj.put("product_area", "B1"); |
|
|
|
device_obj.put("product_area", product_area); |
|
|
|
JSONObject pointStatus = wmsToAcsService.getPointStatus(device_rows); |
|
|
|
if (ObjectUtil.isEmpty(pointStatus) || ObjectUtil.isEmpty(pointStatus.getJSONArray("data"))) { |
|
|
|
log.error("获取气胀轴库信息失败"); |
|
|
|
return false; |
|
|
|
} |
|
|
|
JSONObject data2 = pointStatus.getJSONArray("data").getJSONObject(0); |
|
|
|
//若缓存架数量已经满了
|
|
|
|
if (data2.getInteger("qty") >= max_num) { |
|
|
|
log.warn("气胀轴库【" + shafttubeivt.getPoint_code() + "】没有气胀轴空位。"); |
|
|
|
// 根据尺寸和代数,查询气涨轴暂存架是否有空位
|
|
|
|
List<BstIvtShafttubeivt> qzzCache = bstIvtShafttubeivtService.getNotTaskShaftCacheEmpty2(qzzSize,qzzGeneration); |
|
|
|
if (qzzCache.size() <= 0) { |
|
|
|
log.warn("气胀轴暂存架没空位,无法分配拔轴任务"); |
|
|
|
return false; |
|
|
|
} |
|
|
|
// 预扣除暂存架库存
|
|
|
|
BstIvtShafttubeivt waitUsedPoint = qzzCache.get(0); |
|
|
|
waitUsedPoint.setPlan("1"); |
|
|
|
waitUsedPoint.setUpdate_time(DateUtil.now()); |
|
|
|
bstIvtShafttubeivtService.updateById(waitUsedPoint); |
|
|
|
log.info("暂存架空位被预分配 - {}", waitUsedPoint); |
|
|
|
if (data2.getInteger("qty") > 0) { |
|
|
|
return true; |
|
|
|
}else{ |
|
|
|
// 预扣除缓存架库存
|
|
|
|
shafttubeivt.setPlan("1"); |
|
|
|
shafttubeivt.setUpdate_time(DateUtil.now()); |
|
|
|
bstIvtShafttubeivtService.updateById(shafttubeivt); |
|
|
|
log.info("缓存架空位被预分配 - {}", shafttubeivt); |
|
|
|
log.warn("气胀轴库【" + shafttubeivt.getPoint_code() + "】没有气胀轴。"); |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
/** |
|
|
|
* 判断是不是有足够的 对应尺寸、代数的气胀轴空位 |
|
|
|
* @param empty 当前分配的拔轴设备点位 |
|
|
|
* @param plan 当前需拔轴的计划信息 |
|
|
|
* @param max_qzz_num 气胀轴缓存架最大缓存数量 |
|
|
|
* @return true 有空位, false无空位 |
|
|
|
*/ |
|
|
|
public boolean havaEmptyShaft(BstIvtShafttubeivt empty, PdmBiSlittingproductionplan plan, Param max_qzz_num) { |
|
|
|
//气胀轴尺寸3寸或6寸
|
|
|
|
String qzzSize = plan.getQzz_size(); |
|
|
|
//代数4或5
|
|
|
|
String qzzGeneration = plan.getQzz_generation(); |
|
|
|
//当前拔轴设备所在区域
|
|
|
|
String product_area = empty.getProduct_area(); |
|
|
|
//获取气胀轴缓存架最大缓存数量
|
|
|
|
Integer max_num = Integer.valueOf(max_qzz_num.getValue()); |
|
|
|
|
|
|
|
}else{ |
|
|
|
// 根据尺寸和代数,查询气涨轴暂存架是否有库存
|
|
|
|
List<BstIvtShafttubeivt> qzzCache = bstIvtShafttubeivtService.getNotTaskShaftCacheEmpty2(qzzSize,qzzGeneration); |
|
|
|
// 查询拔轴设备旁边缓存架点位是否存在
|
|
|
|
List<BstIvtShafttubeivt> shafttubeivts = bstIvtShafttubeivtService.getByQzzSize(qzzSize ,empty.getPoint_code(), product_area); |
|
|
|
if (shafttubeivts.size() == 0) { |
|
|
|
log.error("气胀轴库找不到[" + qzzSize + "]规格的气涨轴缓存位"); |
|
|
|
return false; |
|
|
|
} |
|
|
|
// 对应尺寸的气涨轴库
|
|
|
|
BstIvtShafttubeivt shafttubeivt = shafttubeivts.get(0); |
|
|
|
//判断是否存在残留的脏数据
|
|
|
|
String planStr = shafttubeivt.getPlan(); |
|
|
|
if(ObjectUtil.isNotEmpty(planStr) && StrUtil.equals(planStr, "1")){ |
|
|
|
log.error("气胀轴库" + shafttubeivt.getPoint_code() + "预分配字段plan异常,需要确认并初始化!"); |
|
|
|
return false; |
|
|
|
} |
|
|
|
// 判断气胀轴是否有轴
|
|
|
|
JSONArray device_rows = new JSONArray(); |
|
|
|
JSONObject device_obj = new JSONObject(); |
|
|
|
device_rows.add(device_obj); |
|
|
|
device_obj.put("device_code", shafttubeivt.getPoint_code()); |
|
|
|
device_obj.put("product_area", product_area); |
|
|
|
JSONObject pointStatus = wmsToAcsService.getPointStatus(device_rows); |
|
|
|
if (ObjectUtil.isEmpty(pointStatus) || ObjectUtil.isEmpty(pointStatus.getJSONArray("data"))) { |
|
|
|
log.error("获取气胀轴库信息失败"); |
|
|
|
return false; |
|
|
|
} |
|
|
|
JSONObject data2 = pointStatus.getJSONArray("data").getJSONObject(0); |
|
|
|
//若缓存架数量已经满了
|
|
|
|
if (data2.getInteger("qty") >= max_num) { |
|
|
|
log.warn("气胀轴库【" + shafttubeivt.getPoint_code() + "】没有气胀轴空位。"); |
|
|
|
// 根据尺寸和代数和车间区域,查询气涨轴暂存架是否有空位
|
|
|
|
List<BstIvtShafttubeivt> qzzCache = bstIvtShafttubeivtService.getNotTaskShaftCacheEmpty2(qzzSize,qzzGeneration,product_area); |
|
|
|
if (qzzCache.size() <= 0) { |
|
|
|
log.warn("气胀轴暂存架没空位,无法分配拔轴任务"); |
|
|
|
return false; |
|
|
@ -569,7 +516,14 @@ public class AutoCallAirShaftTask extends Prun { |
|
|
|
waitUsedPoint.setUpdate_time(DateUtil.now()); |
|
|
|
bstIvtShafttubeivtService.updateById(waitUsedPoint); |
|
|
|
log.info("暂存架空位被预分配 - {}", waitUsedPoint); |
|
|
|
}else{ |
|
|
|
// 预扣除缓存架库存
|
|
|
|
shafttubeivt.setPlan("1"); |
|
|
|
shafttubeivt.setUpdate_time(DateUtil.now()); |
|
|
|
bstIvtShafttubeivtService.updateById(shafttubeivt); |
|
|
|
log.info("缓存架空位被预分配 - {}", shafttubeivt); |
|
|
|
} |
|
|
|
|
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
@ -640,6 +594,7 @@ public class AutoCallAirShaftTask extends Prun { |
|
|
|
// 兜底
|
|
|
|
needQuantity = needTemp > 0 ? needTemp : 1; |
|
|
|
} |
|
|
|
// todo: 要考虑type=0的正在搬运往套轴区三个点的托盘是否有该库存,如有直接返回true
|
|
|
|
// 查找type=0的位置(待命的托盘)中是否存在(需要判断的是单独一个托盘) 校验了不在搬运中
|
|
|
|
List<BhTubePointDto> stockingivtList = stockingivtService.getNeedPaperTubePoint("0", tubes.get(0), location); |
|
|
|
// 找一个点位: 目的需要的点位
|
|
|
@ -656,7 +611,6 @@ public class AutoCallAirShaftTask extends Prun { |
|
|
|
noticeService.createNotice("备货区找不到[" + tubes.get(0) + "]的纸管信息", |
|
|
|
"点位[" + empty.getPoint_name() + "]无法从备货区找到纸管信息", |
|
|
|
NoticeTypeEnum.EXCEPTION.getCode()); |
|
|
|
stepErrorInfo.add("备货区找不到[" + tubes.get(0) + "]的纸管信息"); |
|
|
|
return false; |
|
|
|
} |
|
|
|
// 找到就创建AGV搬运任务
|
|
|
@ -685,7 +639,6 @@ public class AutoCallAirShaftTask extends Prun { |
|
|
|
noticeService.createNotice("备货区找不到空位置搬运", |
|
|
|
"点位[" + empty.getPoint_name() + "]无法从备货区找到空位", |
|
|
|
NoticeTypeEnum.EXCEPTION.getCode()); |
|
|
|
stepErrorInfo.add("备货区找不到空位置搬运。"); |
|
|
|
return false; |
|
|
|
} |
|
|
|
BstIvtStockingivt endPoint = list.get(0); |
|
|
@ -699,14 +652,12 @@ public class AutoCallAirShaftTask extends Prun { |
|
|
|
param.put("task_type", SlitterEnum.TASK_TYPE.code("备货区送载具")); |
|
|
|
param.put("product_area", SlitterConstant.SLITTER_TASK_AREA); |
|
|
|
stockAreaSendVehicleTask.createTask(param); |
|
|
|
stepErrorInfo.add("备货区交换托盘中...请等待。"); |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 获取对应的气胀轴库1 |
|
|
|
* |
|
|
|
* @param empty 套拔轴点位 |
|
|
|
*/ |
|
|
|
private Boolean toAcsOutShaft(SlitterPlanDistinctDto planD, BstIvtShafttubeivt empty) { |
|
|
@ -716,26 +667,29 @@ public class AutoCallAirShaftTask extends Prun { |
|
|
|
//代数4或5
|
|
|
|
String qzzGeneration = planD.getQzz_generation(); |
|
|
|
//当前拔轴设备所在区域0或1
|
|
|
|
String location = empty.getPoint_location(); |
|
|
|
String product_area = empty.getProduct_area(); |
|
|
|
|
|
|
|
//若点位是短区,且计划需要4短;若点位是长区,且计划需要5长
|
|
|
|
if ((StrUtil.equals(qzzGeneration, "4") && StrUtil.equals(location, "0")) || (StrUtil.equals(qzzGeneration, "5") && StrUtil.equals(location, "1"))) |
|
|
|
{ |
|
|
|
// 查询拔轴设备旁边缓存架点位是否存在
|
|
|
|
List<BstIvtShafttubeivt> shafttubeivts = bstIvtShafttubeivtService.getByQzzSize(qzzSize ,empty.getPoint_code(), location); |
|
|
|
if (shafttubeivts.size() == 0) { |
|
|
|
log.error("气胀轴库找不到[" + qzzSize + "]规格的气涨轴缓存位"); |
|
|
|
return false; |
|
|
|
} |
|
|
|
// 对应尺寸的气涨轴库
|
|
|
|
BstIvtShafttubeivt shafttubeivt = shafttubeivts.get(0); |
|
|
|
// 判断气胀轴是否有轴
|
|
|
|
// 查询拔轴设备旁边缓存架点位是否存在
|
|
|
|
List<BstIvtShafttubeivt> shafttubeivts = bstIvtShafttubeivtService.getByQzzSize(qzzSize ,empty.getPoint_code(), product_area); |
|
|
|
if (shafttubeivts.size() == 0) { |
|
|
|
log.error("气胀轴库找不到[" + qzzSize + "]规格的气涨轴缓存位"); |
|
|
|
return false; |
|
|
|
} |
|
|
|
// 对应尺寸的气涨轴库
|
|
|
|
BstIvtShafttubeivt shafttubeivt = shafttubeivts.get(0); |
|
|
|
|
|
|
|
// 根据尺寸和代数,查询气涨轴缓存架是否有库存
|
|
|
|
List<BstIvtShafttubeivt> qzzCache = bstIvtShafttubeivtService.getNotTaskShaftCache2(qzzSize, |
|
|
|
qzzGeneration, product_area); |
|
|
|
if (qzzCache.size() <= 0) { |
|
|
|
log.warn("没有气胀轴,不给ACS写出轴信息"); |
|
|
|
//判断暂存架是否有库存
|
|
|
|
JSONArray device_rows = new JSONArray(); |
|
|
|
JSONObject device_obj = new JSONObject(); |
|
|
|
device_rows.add(device_obj); |
|
|
|
device_obj.put("device_code", shafttubeivt.getPoint_code()); |
|
|
|
//
|
|
|
|
device_obj.put("product_area", "B1"); |
|
|
|
device_obj.put("product_area", product_area); |
|
|
|
JSONObject pointStatus = wmsToAcsService.getPointStatus(device_rows); |
|
|
|
if (ObjectUtil.isEmpty(pointStatus) || ObjectUtil.isEmpty(pointStatus.getJSONArray("data"))) { |
|
|
|
log.error("获取气胀轴库信息失败"); |
|
|
@ -744,66 +698,21 @@ public class AutoCallAirShaftTask extends Prun { |
|
|
|
JSONObject data2 = pointStatus.getJSONArray("data").getJSONObject(0); |
|
|
|
if (data2.getInteger("qty") <= 0) { |
|
|
|
log.warn("气胀轴库【" + shafttubeivt.getPoint_code() + "】没有气胀轴。"); |
|
|
|
|
|
|
|
// 根据尺寸和代数,查询气涨轴暂存架是否有库存
|
|
|
|
List<BstIvtShafttubeivt> qzzCache = bstIvtShafttubeivtService.getNotTaskShaftCache2(qzzSize, |
|
|
|
qzzGeneration, ""); |
|
|
|
if (qzzCache.size() <= 0) { |
|
|
|
log.warn("没有气胀轴,不给ACS写出轴信息"); |
|
|
|
return false; |
|
|
|
} |
|
|
|
// 预扣除暂存架库存
|
|
|
|
BstIvtShafttubeivt waitUsedPoint = qzzCache.get(0); |
|
|
|
waitUsedPoint.setPlan("1"); |
|
|
|
waitUsedPoint.setUpdate_time(DateUtil.now()); |
|
|
|
bstIvtShafttubeivtService.updateById(waitUsedPoint); |
|
|
|
}else{ |
|
|
|
// 预扣除缓存架库存
|
|
|
|
shafttubeivt.setPlan("1"); |
|
|
|
shafttubeivt.setUpdate_time(DateUtil.now()); |
|
|
|
bstIvtShafttubeivtService.updateById(shafttubeivt); |
|
|
|
} |
|
|
|
// 判断气胀轴密集库是否有数据
|
|
|
|
JSONArray acsParam = new JSONArray(); |
|
|
|
// 出轴的信号,若缓存架没轴,电气会通过acs申请acsCallShaftFromCache,从暂存架出轴
|
|
|
|
JSONObject acsQzz = new JSONObject(); |
|
|
|
acsQzz.put("device_code", shafttubeivt.getPoint_code()); |
|
|
|
acsQzz.put("code", "to_command"); |
|
|
|
acsQzz.put("value", "1"); |
|
|
|
acsQzz.put("product_area", SlitterConstant.SLITTER_TASK_AREA); |
|
|
|
acsParam.add(acsQzz); |
|
|
|
log.info("开始给ACS写信号出气胀轴 - {}", acsQzz); |
|
|
|
JSONObject action = wmsToAcsService.action(acsParam); |
|
|
|
log.info("下发给ACS写信号出气涨轴返回参数:{}", action); |
|
|
|
|
|
|
|
}else{ |
|
|
|
// 根据尺寸和代数,查询气涨轴暂存架是否有库存
|
|
|
|
List<BstIvtShafttubeivt> qzzCache = bstIvtShafttubeivtService.getNotTaskShaftCache2(qzzSize, |
|
|
|
qzzGeneration, ""); |
|
|
|
if (qzzCache.size() > 0) { |
|
|
|
// 判断气胀轴密集库是否有数据
|
|
|
|
JSONArray acsParam = new JSONArray(); |
|
|
|
// 出轴的信号,若缓存架没轴,电气会通过acs申请acsCallShaftFromCache,从暂存架出轴
|
|
|
|
JSONObject acsQzz = new JSONObject(); |
|
|
|
acsQzz.put("device_code", empty.getPoint_code()); |
|
|
|
acsQzz.put("code", "to_command"); |
|
|
|
// todo: 需要和电气沟通协议,直接从暂存架出轴
|
|
|
|
acsQzz.put("value", "1"); |
|
|
|
acsQzz.put("product_area", SlitterConstant.SLITTER_TASK_AREA); |
|
|
|
acsParam.add(acsQzz); |
|
|
|
log.info("开始给ACS写信号出气胀轴 - {}", acsQzz); |
|
|
|
JSONObject action = wmsToAcsService.action(acsParam); |
|
|
|
log.info("下发给ACS写信号出气涨轴返回参数:{}", action); |
|
|
|
// 预扣除暂存架库存
|
|
|
|
BstIvtShafttubeivt waitUsedPoint = qzzCache.get(0); |
|
|
|
waitUsedPoint.setPlan("1"); |
|
|
|
waitUsedPoint.setUpdate_time(DateUtil.now()); |
|
|
|
bstIvtShafttubeivtService.updateById(waitUsedPoint); |
|
|
|
}else{ |
|
|
|
log.warn("没有气胀轴,不给ACS写出轴信息"); |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
// 判断气胀轴密集库是否有数据
|
|
|
|
JSONArray acsParam = new JSONArray(); |
|
|
|
// 出轴的信号,若缓存架没轴,电气会通过acs申请acsCallShaftFromCache,从暂存架出轴
|
|
|
|
JSONObject acsQzz = new JSONObject(); |
|
|
|
acsQzz.put("device_code", shafttubeivt.getPoint_code()); |
|
|
|
acsQzz.put("code", "to_command"); |
|
|
|
acsQzz.put("value", "1"); |
|
|
|
acsQzz.put("product_area", SlitterConstant.SLITTER_TASK_AREA); |
|
|
|
acsParam.add(acsQzz); |
|
|
|
log.info("开始给ACS写信号出气胀轴 - {}", acsQzz); |
|
|
|
JSONObject action = wmsToAcsService.action(acsParam); |
|
|
|
log.info("下发给ACS写信号出气涨轴返回参数:{}", action); |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
@ -820,7 +729,6 @@ public class AutoCallAirShaftTask extends Prun { |
|
|
|
|
|
|
|
empty.setHave_qzz(SlitterConstant.SLITTER_YES); |
|
|
|
empty.setQzz_size(qzzSize); |
|
|
|
empty.setQzz_generation(qzz_generation); |
|
|
|
|
|
|
|
TaskUtils.updateOptMessageByBShaftPoint(empty); |
|
|
|
for (PdmBiSlittingproductionplan plan : needPlans) { |
|
|
|