|
|
@ -3,12 +3,16 @@ package org.nl.wms.pda.service.impl; |
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
import cn.hutool.core.util.IdUtil; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.nl.common.exception.BadRequestException; |
|
|
|
import org.nl.common.utils.SecurityUtils; |
|
|
|
import org.nl.wms.database.material.service.IMdBaseMaterialService; |
|
|
|
import org.nl.wms.database.material.service.dao.MdBaseMaterial; |
|
|
|
import org.nl.wms.ext.acs.service.WmsToAcsService; |
|
|
|
import org.nl.wms.ext.acs.service.dto.to.acs.DeviceInfoDto; |
|
|
|
import org.nl.wms.ext.acs.service.dto.to.wms.AcsResponse; |
|
|
|
import org.nl.wms.pda.service.PdaService; |
|
|
|
import org.nl.wms.pda.service.dao.dto.*; |
|
|
|
import org.nl.wms.pda.service.dao.mapper.PdaMapper; |
|
|
@ -30,6 +34,7 @@ import org.nl.wms.util.TaskUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
/** |
|
|
@ -54,6 +59,8 @@ public class PdaServiceImpl implements PdaService { |
|
|
|
private ISchBaseTaskService taskService; |
|
|
|
@Autowired |
|
|
|
private IPdmBdVehicleBindingService vehicleBindingService; |
|
|
|
@Autowired |
|
|
|
private WmsToAcsService wmsToAcsService; |
|
|
|
@Override |
|
|
|
public List<DropdownListVo> getDeviceInfo() { |
|
|
|
// 暂定压机区域
|
|
|
@ -120,20 +127,18 @@ public class PdaServiceImpl implements PdaService { |
|
|
|
if (ObjectUtil.isEmpty(blendingMoveDto.getStart_point_code())) { |
|
|
|
throw new BadRequestException("混碾位不能为空"); |
|
|
|
} |
|
|
|
// if (ObjectUtil.isEmpty(blendingMoveDto.getEnd_point_code())) {
|
|
|
|
// throw new BadRequestException("目标压机位不能为空");
|
|
|
|
// }
|
|
|
|
// 获取压机对应的困料线、空位、无任务
|
|
|
|
// SchBasePoint point = pdaMapper.findKLXPoint(blendingMoveDto.getEnd_point_code());
|
|
|
|
// if (ObjectUtil.isEmpty(point)) {
|
|
|
|
// throw new BadRequestException("创建失败,已有搬运到【" + blendingMoveDto.getEnd_point_code() + "】的任务, 请稍后在试!");
|
|
|
|
// }
|
|
|
|
// todo: 1、向acs获取吨袋号、重量
|
|
|
|
// 向acs获取吨袋号、重量
|
|
|
|
SchBasePoint basePoint = pointService.getById(blendingMoveDto.getStart_point_code()); |
|
|
|
List<DeviceInfoDto> list = new ArrayList<>(); |
|
|
|
list.add(DeviceInfoDto.buildDevice(basePoint.getParent_point_code())); |
|
|
|
AcsResponse statusByCode = wmsToAcsService.getDeviceStatusByCode(list); |
|
|
|
JSONArray data = statusByCode.getData(); |
|
|
|
JSONObject object = data.getJSONObject(0); |
|
|
|
// 准备参数:设备编码、载具号、载具类型、重量、吨袋号(material_code)
|
|
|
|
JSONObject param = new JSONObject(); |
|
|
|
param.put("device_code", blendingMoveDto.getStart_point_code()); |
|
|
|
param.put("material_code", "吨袋号"); |
|
|
|
param.put("weight", "0"); |
|
|
|
param.put("material_code", object.getString("material_code")); |
|
|
|
param.put("weight", object.getString("weight")); |
|
|
|
param.put("vehicle_code", blendingMoveDto.getVehicle_code()); |
|
|
|
param.put("vehicle_type", GeneralDefinition.MATERIAL_CUP); |
|
|
|
param.put("requestNo", IdUtil.simpleUUID()); |
|
|
@ -216,6 +221,10 @@ public class PdaServiceImpl implements PdaService { |
|
|
|
JSONObject param = new JSONObject(); |
|
|
|
param.put("device_code", "RGCDW01"); |
|
|
|
param.put("config_code", "FJSKTask"); |
|
|
|
// 获取载具类型和载具编码
|
|
|
|
SchBasePoint rgcdw01 = pointService.getById("RGCDW01"); |
|
|
|
param.put("vehicle_code", rgcdw01.getVehicle_code()); |
|
|
|
param.put("vehicle_type", GeneralDefinition.STEEL_TRAY); |
|
|
|
taskService.apply(param); |
|
|
|
return PdaResponseVo.pdaResultOk("空盘入库请求成功"); |
|
|
|
} |
|
|
@ -282,7 +291,7 @@ public class PdaServiceImpl implements PdaService { |
|
|
|
// 准备参数:设备编码
|
|
|
|
JSONObject param = new JSONObject(); |
|
|
|
param.put("device_code", "RGMDW01"); |
|
|
|
param.put("config_code", "FJMLTask"); |
|
|
|
param.put("config_code", "RGFJRKTask"); |
|
|
|
param.put("qty", manualResidueInDto.getQty()); |
|
|
|
param.put("vehicle_code", manualResidueInDto.getVehicle_code()); |
|
|
|
param.put("vehicle_qty", "1"); |
|
|
@ -292,7 +301,7 @@ public class PdaServiceImpl implements PdaService { |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<TaskShowVo> packingTaskShow() { |
|
|
|
return pdaMapper.getRunningTaskByStart("RGMDW01", "FJMLTask"); |
|
|
|
return pdaMapper.getRunningTaskByStart("RGMDW01", "RGFJRKTask"); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|