|
|
@ -30,6 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.stream.Collectors; |
|
|
@ -101,8 +102,6 @@ public class FJRKTask extends AbstractTask { |
|
|
|
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE)); |
|
|
|
String requestParam = task.getRequest_param();// 任务的其他数据
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(requestParam); |
|
|
|
String workOrderCode = jsonObject.getString("workorder_code"); // 工单
|
|
|
|
PdmBdWorkorder workorder = workorderService.getByCode(workOrderCode); |
|
|
|
TaskUtils.setUpdateByAcs(task); |
|
|
|
List<String> nextRegionStr = Arrays.stream(taskConfig.getNext_region_str().split(",")).collect(Collectors.toList()); |
|
|
|
List<String> startRegionStr = Arrays.stream(taskConfig.getStart_region_str().split(",")).collect(Collectors.toList()); |
|
|
@ -115,18 +114,9 @@ public class FJRKTask extends AbstractTask { |
|
|
|
throw new BadRequestException("找不到可用的包装位!"); |
|
|
|
} |
|
|
|
task.setPoint_code2(packagePoint.getPoint_code()); |
|
|
|
// 1 剩余量
|
|
|
|
Integer surplusQuantity = jsonObject.getInteger("surplus_quantity"); // 码垛上剩余数量
|
|
|
|
// 2 获取库存量 surplusNumber
|
|
|
|
int surplusNumber = fjMapper.getInventoryQuantity(workorder.getMaterial_id()); |
|
|
|
// 3 现有总数 total
|
|
|
|
int total = surplusNumber + surplusQuantity; |
|
|
|
// 4 获取木托盘需要多少块 needFullNumber
|
|
|
|
String needFullNumberStr = fjMapper.getNeedFullNumber(workorder.getMaterial_id()); |
|
|
|
int needFullNumber = TaskUtils.convertMultiply(needFullNumberStr); |
|
|
|
// 5 校验是否够码满一托
|
|
|
|
// 大于等于1就可以码
|
|
|
|
if (total/needFullNumber >= 1) { |
|
|
|
boolean enoughCallEmpty = workorderService.isEnoughCallEmpty(task.getPoint_code1()); |
|
|
|
if (enoughCallEmpty) { |
|
|
|
/** 覆膜机木托盘位 */ |
|
|
|
SchBasePoint LaminatePoint = findStartPoint(startRegionStr, jsonObject); |
|
|
|
if (ObjectUtil.isEmpty(LaminatePoint)) { |
|
|
@ -301,17 +291,22 @@ public class FJRKTask extends AbstractTask { |
|
|
|
} |
|
|
|
|
|
|
|
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) { |
|
|
|
String requestParam = taskObj.getRequest_param(); |
|
|
|
JSONObject jsonObject = JSONObject.parseObject(requestParam); |
|
|
|
String workorderCode = jsonObject.getString("workorder_code"); |
|
|
|
PdmBdWorkorder workorder = workorderService.getByCode(workorderCode); |
|
|
|
// 获取参数
|
|
|
|
String endPoint = taskObj.getPoint_code2(); // 获取终点
|
|
|
|
String startPoint = taskObj.getPoint_code1(); // 获取终点
|
|
|
|
SchBasePoint startPointObj = pointService.getById(startPoint); |
|
|
|
String fjcPoint = taskObj.getPoint_code4(); // 获取起点
|
|
|
|
String fmPoint = taskObj.getPoint_code3(); // 获取覆膜机
|
|
|
|
SchBasePoint fjcPointObj = pointService.getById(fjcPoint); |
|
|
|
SchBasePoint endPointObj = pointService.getById(endPoint); |
|
|
|
SchBasePoint fmPointObj = pointService.getById(fmPoint); |
|
|
|
// 设置载具类型、点位状态、释放点位
|
|
|
|
if (ObjectUtil.isNotEmpty(endPoint)) { |
|
|
|
endPointObj.setIng_task_code(""); |
|
|
|
PointUtils.setUpdateByType(endPointObj, taskFinishedType); |
|
|
|
pointService.updateById(endPointObj); |
|
|
|
|
|
|
|
// 组盘设置已经解绑
|
|
|
|
SchBaseVehiclematerialgroup vehicleMaterialGroupObj = |
|
|
|
vehiclematerialgroupService.getById(taskObj.getGroup_id()); |
|
|
@ -322,8 +317,25 @@ public class FJRKTask extends AbstractTask { |
|
|
|
TaskUtils.setGroupUpdateByType(vehicleMaterialGroupObj, taskFinishedType); |
|
|
|
vehiclematerialgroupService.updateById(vehicleMaterialGroupObj); |
|
|
|
} |
|
|
|
PointUtils.setUpdateByType(startPointObj, taskFinishedType); |
|
|
|
PointUtils.clearPoint(startPointObj); |
|
|
|
if (ObjectUtil.isNotEmpty(fmPointObj)) { |
|
|
|
// 覆膜位: 解锁 . 清空
|
|
|
|
PointUtils.setUpdateByType(fmPointObj, taskFinishedType); |
|
|
|
PointUtils.clearPoint(fmPointObj); |
|
|
|
// 工单的真实数+1
|
|
|
|
workorder.setReal_qty(workorder.getReal_qty().add(BigDecimal.ONE)); |
|
|
|
TaskUtils.setWorkOrderUpdateByType(workorder, taskFinishedType); |
|
|
|
workorderService.updateById(workorder); |
|
|
|
} |
|
|
|
// 分拣机械手: 清空
|
|
|
|
if (ObjectUtil.isNotEmpty(fjcPointObj)) { |
|
|
|
// 机械手对接位: 赋值
|
|
|
|
fjcPointObj.setPoint_status(PointStatusEnum.EMPTY_VEHICLE.getCode()); |
|
|
|
fjcPointObj.setVehicle_qty(1); |
|
|
|
fjcPointObj.setVehicle_type(taskObj.getVehicle_type()); |
|
|
|
fjcPointObj.setVehicle_code(taskObj.getVehicle_code2()); // 拿过来的载具编码
|
|
|
|
PointUtils.setUpdateByType(fjcPointObj, taskFinishedType); |
|
|
|
pointService.updateById(fjcPointObj); |
|
|
|
} |
|
|
|
taskObj.setTask_status(TaskStatus.FINISHED.getCode()); |
|
|
|
taskObj.setRemark(GeneralDefinition.TASK_FINISH); |
|
|
|
taskObj.setFinished_type(taskFinishedType.getCode()); |
|
|
|