|
|
@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.sun.org.apache.regexp.internal.RE; |
|
|
|
import org.nl.common.exception.BadRequestException; |
|
|
|
import org.nl.common.utils.CodeUtil; |
|
|
|
import org.nl.config.MapOf; |
|
|
@ -80,6 +81,7 @@ public class FJMKTask extends AbstractTask { |
|
|
|
.collect(Collectors.toList()); |
|
|
|
String requestParam = task.getRequest_param();// 任务的其他数据
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(requestParam); |
|
|
|
String workOrderCode = jsonObject.getString("workorder_code"); // 工单
|
|
|
|
String startPoint = task.getPoint_code1(); |
|
|
|
// 获取起点 回写载具编码
|
|
|
|
SchBasePoint startPointObj = pointService.getById(startPoint); |
|
|
@ -103,51 +105,52 @@ public class FJMKTask extends AbstractTask { |
|
|
|
for (ApplyDeviceDto applyDeviceDto : list) { |
|
|
|
sum += Integer.parseInt(applyDeviceDto.getQty()); |
|
|
|
} |
|
|
|
// todo: 需要提供两个托盘上的数量
|
|
|
|
// 2.1 获取库存剩余数量 + 2.2 获取在搬运任务 - 组盘绑定状态是带绑定状态、任务类型是创建完成、下发、执行中
|
|
|
|
// 2 获取剩余量 surplusNumber
|
|
|
|
// 2.1 获取库存剩余数量 + 2.2 获取在搬运任务 ( 组盘绑定状态是带绑定状态、任务类型是创建完成、下发、执行中 )
|
|
|
|
int surplusNumber = fjMapper.getInventoryQuantity(); |
|
|
|
int total = sum + surplusNumber; // 现有总数
|
|
|
|
// 3 获取木托盘需要多少块
|
|
|
|
int needFullNumber = 255; // todo: 具体未知如何获取
|
|
|
|
JSONObject response = new JSONObject(); |
|
|
|
String responseParam = task.getResponse_param(); |
|
|
|
if (ObjectUtil.isNotEmpty(responseParam)) { |
|
|
|
response = JSON.parseObject(responseParam); |
|
|
|
} |
|
|
|
// 3 现有总数 total
|
|
|
|
int total = sum + surplusNumber; |
|
|
|
// 4 获取木托盘需要多少块 needFullNumber
|
|
|
|
PdmBdWorkorder workorder = workorderService.getByCode(workOrderCode); |
|
|
|
String needFullNumberStr = fjMapper.getNeedFullNumber(workorder.getMaterial_id()); |
|
|
|
int needFullNumber = TaskUtils.convertMultiply(needFullNumberStr); |
|
|
|
// 大于两托正常,大于1托给1,小于1托给2
|
|
|
|
// 4 校验是否够码满一托/两托
|
|
|
|
// 5 校验是否够码满一托/两托
|
|
|
|
// 大于等于2就可以码
|
|
|
|
/** 覆膜机木托盘位 */ |
|
|
|
SchBasePoint LaminatePoint = findStartPoint(startRegionStr, jsonObject); |
|
|
|
if (ObjectUtil.isEmpty(LaminatePoint)) { |
|
|
|
task.setRemark("覆膜区不可用!"); |
|
|
|
noticeService.createNotice(task.getRemark(), TASK_CONFIG_CODE + task.getTask_code(), |
|
|
|
NoticeTypeEnum.WARN.getCode()); |
|
|
|
taskService.updateById(task); |
|
|
|
// 消息通知
|
|
|
|
continue; |
|
|
|
if (total/needFullNumber >= 2) { |
|
|
|
/** 覆膜机木托盘位 */ |
|
|
|
SchBasePoint LaminatePoint = findStartPoint(startRegionStr, jsonObject); |
|
|
|
if (ObjectUtil.isEmpty(LaminatePoint)) { |
|
|
|
noticeService.createNotice("覆膜区不可用!", TASK_CONFIG_CODE + task.getPoint_code1(), |
|
|
|
NoticeTypeEnum.WARN.getCode()); |
|
|
|
// 消息通知
|
|
|
|
throw new BadRequestException("覆膜区不可用!"); |
|
|
|
} |
|
|
|
// 把这个设备位放到任务中
|
|
|
|
JSONObject response = new JSONObject(); |
|
|
|
String responseParam = task.getResponse_param(); |
|
|
|
if (ObjectUtil.isNotEmpty(responseParam)) { |
|
|
|
response = JSON.parseObject(responseParam); |
|
|
|
} |
|
|
|
response.put("fmj_device", LaminatePoint.getPoint_code()); |
|
|
|
// 生产木托盘编码
|
|
|
|
// 设置终点并修改创建成功状态
|
|
|
|
task.setPoint_code3(LaminatePoint.getParent_point_code()); |
|
|
|
task.setPoint_code4(startPoint); |
|
|
|
task.setResponse_param(response.toJSONString()); |
|
|
|
// 覆膜机对接位上锁
|
|
|
|
SchBasePoint basePoint = pointService.getById(LaminatePoint.getParent_point_code()); |
|
|
|
basePoint.setIng_task_code(task.getTask_code()); |
|
|
|
PointUtils.setUpdateByAcs(basePoint); |
|
|
|
pointService.updateById(basePoint); |
|
|
|
} |
|
|
|
// 把这个设备位放到任务中
|
|
|
|
response.put("fmj_device", LaminatePoint.getPoint_code()); |
|
|
|
// 生产木托盘编码
|
|
|
|
// 设置终点并修改创建成功状态
|
|
|
|
task.setPoint_code3(LaminatePoint.getParent_point_code()); |
|
|
|
task.setPoint_code4(startPoint); |
|
|
|
task.setTask_status(TaskStatus.CREATED.getCode()); |
|
|
|
task.setRemark(""); |
|
|
|
taskService.updateById(task); |
|
|
|
|
|
|
|
taskService.save(task); |
|
|
|
// 包装线上锁
|
|
|
|
packagePoint.setIng_task_code(task.getTask_code()); |
|
|
|
PointUtils.setUpdateByAcs(packagePoint); |
|
|
|
pointService.updateById(packagePoint); |
|
|
|
// 覆膜机对接位
|
|
|
|
SchBasePoint basePoint = pointService.getById(LaminatePoint.getParent_point_code()); |
|
|
|
basePoint.setIng_task_code(task.getTask_code()); |
|
|
|
PointUtils.setUpdateByAcs(basePoint); |
|
|
|
pointService.updateById(basePoint); |
|
|
|
|
|
|
|
//下发
|
|
|
|
//this.renotifyAcs(task);
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -164,6 +167,7 @@ public class FJMKTask extends AbstractTask { |
|
|
|
.collect(Collectors.toList()); |
|
|
|
String requestParam = task.getRequest_param();// 任务的其他数据
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(requestParam); |
|
|
|
String workOrderCode = jsonObject.getString("workorder_code"); // 工单
|
|
|
|
String startPoint = task.getPoint_code1(); |
|
|
|
// 获取起点 回写载具编码
|
|
|
|
SchBasePoint startPointObj = pointService.getById(startPoint); |
|
|
@ -185,51 +189,53 @@ public class FJMKTask extends AbstractTask { |
|
|
|
for (ApplyDeviceDto applyDeviceDto : list) { |
|
|
|
sum += Integer.parseInt(applyDeviceDto.getQty()); |
|
|
|
} |
|
|
|
// 2.1 获取库存剩余数量 + 2.2 获取在搬运任务 - 组盘绑定状态是带绑定状态、任务类型是创建完成、下发、执行中
|
|
|
|
// 2 获取剩余量 surplusNumber
|
|
|
|
// 2.1 获取库存剩余数量 + 2.2 获取在搬运任务 ( 组盘绑定状态是带绑定状态、任务类型是创建完成、下发、执行中 )
|
|
|
|
int surplusNumber = fjMapper.getInventoryQuantity(); |
|
|
|
int total = sum + surplusNumber; // 现有总数
|
|
|
|
// 3 获取木托盘需要多少块
|
|
|
|
int needFullNumber = 255; // todo: 具体未知如何获取
|
|
|
|
JSONObject response = new JSONObject(); |
|
|
|
String responseParam = task.getResponse_param(); |
|
|
|
if (ObjectUtil.isNotEmpty(responseParam)) { |
|
|
|
response = JSON.parseObject(responseParam); |
|
|
|
} |
|
|
|
// 大于两托正常,大于1托给个1,小于1托给2
|
|
|
|
// 4 校验是否够码满一托/两托
|
|
|
|
if ((total % needFullNumber) == 0) { |
|
|
|
// 不可以叫空木托盘
|
|
|
|
// response.put("")
|
|
|
|
} else if ((total % needFullNumber) < 2) { |
|
|
|
// 不可以叫空木托盘
|
|
|
|
} |
|
|
|
// 大于2就可以码
|
|
|
|
/** 覆膜机木托盘位 */ |
|
|
|
SchBasePoint LaminatePoint = findStartPoint(startRegionStr, jsonObject); |
|
|
|
if (ObjectUtil.isEmpty(LaminatePoint)) { |
|
|
|
noticeService.createNotice("覆膜区不可用!", TASK_CONFIG_CODE + task.getPoint_code1(), |
|
|
|
NoticeTypeEnum.WARN.getCode()); |
|
|
|
// 消息通知
|
|
|
|
throw new BadRequestException("覆膜区不可用!"); |
|
|
|
// 3 现有总数 total
|
|
|
|
int total = sum + surplusNumber; |
|
|
|
// 4 获取木托盘需要多少块 needFullNumber
|
|
|
|
PdmBdWorkorder workorder = workorderService.getByCode(workOrderCode); |
|
|
|
String needFullNumberStr = fjMapper.getNeedFullNumber(workorder.getMaterial_id()); |
|
|
|
int needFullNumber = TaskUtils.convertMultiply(needFullNumberStr); |
|
|
|
// 大于两托正常,大于1托给1,小于1托给2
|
|
|
|
// 5 校验是否够码满一托/两托
|
|
|
|
// 大于等于2就可以码
|
|
|
|
if (total/needFullNumber >= 2) { |
|
|
|
/** 覆膜机木托盘位 */ |
|
|
|
SchBasePoint LaminatePoint = findStartPoint(startRegionStr, jsonObject); |
|
|
|
if (ObjectUtil.isEmpty(LaminatePoint)) { |
|
|
|
noticeService.createNotice("覆膜区不可用!", TASK_CONFIG_CODE + task.getPoint_code1(), |
|
|
|
NoticeTypeEnum.WARN.getCode()); |
|
|
|
// 消息通知
|
|
|
|
throw new BadRequestException("覆膜区不可用!"); |
|
|
|
} |
|
|
|
// 把这个设备位放到任务中
|
|
|
|
JSONObject response = new JSONObject(); |
|
|
|
String responseParam = task.getResponse_param(); |
|
|
|
if (ObjectUtil.isNotEmpty(responseParam)) { |
|
|
|
response = JSON.parseObject(responseParam); |
|
|
|
} |
|
|
|
response.put("fmj_device", LaminatePoint.getPoint_code()); |
|
|
|
// 生产木托盘编码
|
|
|
|
// 设置终点并修改创建成功状态
|
|
|
|
task.setPoint_code3(LaminatePoint.getParent_point_code()); |
|
|
|
task.setPoint_code4(startPoint); |
|
|
|
task.setResponse_param(response.toJSONString()); |
|
|
|
// 覆膜机对接位上锁
|
|
|
|
SchBasePoint basePoint = pointService.getById(LaminatePoint.getParent_point_code()); |
|
|
|
basePoint.setIng_task_code(task.getTask_code()); |
|
|
|
PointUtils.setUpdateByAcs(basePoint); |
|
|
|
pointService.updateById(basePoint); |
|
|
|
} |
|
|
|
// 把这个设备位放到任务中
|
|
|
|
response.put("fmj_device", LaminatePoint.getPoint_code()); |
|
|
|
// 生产木托盘编码
|
|
|
|
// 设置终点并修改创建成功状态
|
|
|
|
task.setPoint_code3(LaminatePoint.getParent_point_code()); |
|
|
|
task.setPoint_code4(startPoint); |
|
|
|
task.setTask_status(TaskStatus.CREATED.getCode()); |
|
|
|
task.setRemark(""); |
|
|
|
taskService.save(task); |
|
|
|
|
|
|
|
// 包装线上锁
|
|
|
|
packagePoint.setIng_task_code(task.getTask_code()); |
|
|
|
PointUtils.setUpdateByAcs(packagePoint); |
|
|
|
pointService.updateById(packagePoint); |
|
|
|
// 覆膜机对接位
|
|
|
|
SchBasePoint basePoint = pointService.getById(LaminatePoint.getParent_point_code()); |
|
|
|
basePoint.setIng_task_code(task.getTask_code()); |
|
|
|
PointUtils.setUpdateByAcs(basePoint); |
|
|
|
pointService.updateById(basePoint); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|