|
|
@ -30,6 +30,7 @@ import org.nl.b_lms.pdm.bi.slittingproductionplan.service.IPdmBiSlittingproducti |
|
|
|
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.dao.PdmBiSlittingproductionplan; |
|
|
|
import org.nl.b_lms.pdm.subpackagerelation.dao.PdmBiSubpackagerelation; |
|
|
|
import org.nl.b_lms.pdm.subpackagerelation.service.IpdmBiSubpackagerelationService; |
|
|
|
import org.nl.b_lms.sch.point.dao.BstIvtPackageinfoivt; |
|
|
|
import org.nl.b_lms.sch.point.dao.StIvtCutpointivt; |
|
|
|
import org.nl.b_lms.sch.point.service.IstIvtCutpointivtService; |
|
|
|
import org.nl.b_lms.sch.task.dao.SchBaseTask; |
|
|
@ -42,6 +43,7 @@ import org.nl.b_lms.sch.tasks.slitter.mapper.dto.CallPlanViewVO; |
|
|
|
import org.nl.b_lms.sch.tasks.slitter.mapper.dto.GxQtyDto; |
|
|
|
import org.nl.b_lms.sch.tasks.slitter.service.SlitterService; |
|
|
|
import org.nl.b_lms.sch.tasks.slitter.util.SlitterTaskUtil; |
|
|
|
import org.nl.common.enums.PackageInfoIvtEnum; |
|
|
|
import org.nl.common.utils.SecurityUtils; |
|
|
|
import org.nl.common.utils.TaskUtils; |
|
|
|
import org.nl.modules.common.exception.BadRequestException; |
|
|
@ -124,6 +126,9 @@ public class SlitterServiceImpl implements SlitterService { |
|
|
|
private UpShaftTrussTask upShaftTrussTask; |
|
|
|
@Autowired |
|
|
|
private ReturnShaftAgvTask returnShaftAgvTask; |
|
|
|
@Autowired |
|
|
|
private DownShaftTrussTask downShaftTrussTask; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
@ -781,15 +786,26 @@ public class SlitterServiceImpl implements SlitterService { |
|
|
|
} |
|
|
|
log.info("分切计划数据:{}", plan); |
|
|
|
String point_type = "5".equals(plan.getLevel()) ? "5" : "4"; |
|
|
|
// todo 如果是成品称重,需要Lms分配一个空位point_code2
|
|
|
|
// 查找终点 确认是废箔还是成品: 根据分切计划的子卷等级来区分,5为报废
|
|
|
|
BstIvtShafttubeivt one = shafttubeivtService.getOne(new LambdaQueryWrapper<BstIvtShafttubeivt>() |
|
|
|
.eq(BstIvtShafttubeivt::getPoint_type, point_type) |
|
|
|
.eq(BstIvtShafttubeivt::getPoint_location, device.getPoint_location()) |
|
|
|
.eq(BstIvtShafttubeivt::getIs_used, SlitterConstant.SLITTER_YES)); |
|
|
|
JSONObject taskParam = new JSONObject(); |
|
|
|
//
|
|
|
|
taskParam.put("point_code2", one.getPoint_code()); |
|
|
|
// 查找终点 确认是废箔还是成品: 根据分切计划的子卷等级来区分,5为报废
|
|
|
|
//成品
|
|
|
|
if(point_type.equals("4")){ |
|
|
|
//设置目的点为有架子的点
|
|
|
|
List<BstIvtPackageinfoivt> mzPointList = bcutpointivtService.getPointByStatus(PackageInfoIvtEnum.POINT_STATUS.code("满轴缓存位"),PackageInfoIvtEnum.IVT_STATUS.code("空")); |
|
|
|
if(mzPointList.size() == 0){ |
|
|
|
throw new BadRequestException("内包间无空闲满轴缓存位!"); |
|
|
|
} |
|
|
|
//设置目的点为满轴位
|
|
|
|
taskParam.put("point_code2", mzPointList.get(0).getPoint_code()); |
|
|
|
}else{//废箔
|
|
|
|
BstIvtShafttubeivt one = shafttubeivtService.getOne(new LambdaQueryWrapper<BstIvtShafttubeivt>() |
|
|
|
.eq(BstIvtShafttubeivt::getPoint_type, point_type) |
|
|
|
.eq(BstIvtShafttubeivt::getPoint_location, device.getPoint_location()) |
|
|
|
.eq(BstIvtShafttubeivt::getIs_used, SlitterConstant.SLITTER_YES)); |
|
|
|
//设置目的点为废箔称重
|
|
|
|
taskParam.put("point_code2", one.getPoint_code()); |
|
|
|
} |
|
|
|
|
|
|
|
taskParam.put("material_code", plan.getContainer_name()); |
|
|
|
//是否打印标签
|
|
|
|
taskParam.put("to_is_labeling", "0"); |
|
|
@ -2323,6 +2339,91 @@ public class SlitterServiceImpl implements SlitterService { |
|
|
|
return res; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public JSONObject downShafts(JSONObject param) { |
|
|
|
log.info("下轴的输入参数为:{}", param); |
|
|
|
// param: device_code, container: [{"site":"上下轴(1/2)"}]
|
|
|
|
String device_code = param.getString("device_code"); |
|
|
|
JSONArray conArray = param.getJSONArray("container"); |
|
|
|
if (conArray.size() == 0) { |
|
|
|
log.error("下空轴参数不能为空!"); |
|
|
|
throw new BadRequestException("下空轴参数不能为空!"); |
|
|
|
} |
|
|
|
// 获得设备
|
|
|
|
StIvtCutpointivt device = cutpointivtService.getOne(new LambdaQueryWrapper<StIvtCutpointivt>() |
|
|
|
.eq(StIvtCutpointivt::getExt_code, device_code)); |
|
|
|
|
|
|
|
List<SchBaseTask> tasks = taskService.checkHaveTrussTask(Arrays.asList(device.getUp_point_code(), device.getDown_point_code())); |
|
|
|
if (tasks.size() > 0) { |
|
|
|
throw new BadRequestException("分切机" + device_code + " 已经有存在的任务"); |
|
|
|
} |
|
|
|
|
|
|
|
List<String> containerList = new ArrayList<>(); |
|
|
|
for (int i = 0; i < conArray.size(); i++) { |
|
|
|
JSONObject container = conArray.getJSONObject(i); |
|
|
|
containerList.add(container.getString("site")); |
|
|
|
//上轴要下,且气胀轴字段为空
|
|
|
|
if(StrUtil.equals(container.getString("site"),"1") && ObjectUtil.isEmpty(device.getUp_point_code())){ |
|
|
|
throw new BadRequestException("分切机上轴无气胀轴信息,无法生成下空轴任务!"); |
|
|
|
} |
|
|
|
//下轴要下,且气胀轴字段为空
|
|
|
|
if(StrUtil.equals(container.getString("site"),"2") && ObjectUtil.isEmpty(device.getDown_point_code())){ |
|
|
|
throw new BadRequestException("分切机下轴无气胀轴信息,无法生成下空轴任务!"); |
|
|
|
} |
|
|
|
//下轴要单下,上轴检测有货
|
|
|
|
if(StrUtil.equals(container.getString("site"),"2") && ObjectUtil.isNotEmpty(device.getUp_point_code()) && (conArray.size() == 1)){ |
|
|
|
throw new BadRequestException("分切机上轴有货,无法生成单下空轴任务!"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
StIvtCutpointivt actualDevice = device; |
|
|
|
String area = device.getProduct_area(); |
|
|
|
// 获取当前分切机的下一组分切计划(最多四条分切计划)
|
|
|
|
// 任务参数
|
|
|
|
JSONObject taskParam = new JSONObject(); |
|
|
|
taskParam.put("containers", containerList); |
|
|
|
// 如果没有下一组的分切计划,就只做下卷任务(判断下单/下双)
|
|
|
|
// 获取分切对接位没任务的空位置
|
|
|
|
List<BstIvtCutpointivt> emptyPoints = slitterMapper.getEmptyCutPointNotTask(area, |
|
|
|
device.getSort_seq(), |
|
|
|
getPointLocationInCutDevice(getNumberByResourceCode(device_code), area)); |
|
|
|
//必须两个位置都为空
|
|
|
|
if (emptyPoints.size() == 0 ) { |
|
|
|
log.error("分切机【" + device.getExt_code() + "】对接位不全为空位, 或已存在任务!"); |
|
|
|
throw new BadRequestException("分切机【" + device.getExt_code() + "】对接位不全为空位,或已存在任务!"); |
|
|
|
} |
|
|
|
// 枷锁
|
|
|
|
BstIvtCutpointivt emptyPoint = emptyPoints.get(0); |
|
|
|
// 创建任务
|
|
|
|
if (containerList.size() == 2) { |
|
|
|
// 双轴任务 下双
|
|
|
|
taskParam.put("point_code1", actualDevice.getUp_point_code()); |
|
|
|
taskParam.put("point_code2", emptyPoint.getTruss_point_code1()); |
|
|
|
taskParam.put("point_code3", actualDevice.getDown_point_code()); |
|
|
|
taskParam.put("point_code4", emptyPoint.getTruss_point_code2()); |
|
|
|
taskParam.put("truss_type", "1"); |
|
|
|
taskParam.put("empty_site", "0"); |
|
|
|
} else if (containerList.size() == 1) { |
|
|
|
// 单轴任务 下单
|
|
|
|
taskParam.put("point_code1", containerList.get(0) == "2" |
|
|
|
? actualDevice.getDown_point_code() : actualDevice.getUp_point_code()); |
|
|
|
taskParam.put("point_code2", containerList.get(0) == "2" |
|
|
|
? emptyPoint.getTruss_point_code2() : emptyPoint.getTruss_point_code1()); |
|
|
|
taskParam.put("truss_type", "1"); |
|
|
|
taskParam.put("empty_site", "0"); |
|
|
|
} |
|
|
|
taskParam.put("task_type", SlitterEnum.TASK_TYPE.code("分切机下气胀轴")); |
|
|
|
taskParam.put("product_area", device.getProduct_area()); |
|
|
|
// 创建任务
|
|
|
|
downShaftTrussTask.createTask(taskParam); |
|
|
|
|
|
|
|
JSONObject res = new JSONObject(); |
|
|
|
res.put("status", HttpStatus.HTTP_OK); |
|
|
|
res.put("message", "下轴任务生成成功!"); |
|
|
|
return res; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public JSONObject rollCacheManage(JSONObject param) { |
|
|
|
// param: point_code、flag(1:清除,2:有空轴)
|
|
|
|