目标箱号添加ewm检验接口
This commit is contained in:
parent
2cec12510e
commit
ea8dfb6fb6
Binary file not shown.
|
|
@ -1,8 +1,8 @@
|
|||
import axios from 'axios'
|
||||
|
||||
const request = axios.create({
|
||||
baseURL: 'http://172.18.222.253:12315/wms',
|
||||
//baseURL: 'http://localhost:12315/wms',
|
||||
//baseURL: 'http://172.18.222.253:12315/wms',
|
||||
baseURL: 'http://localhost:12315/wms',
|
||||
timeout: 5000
|
||||
})
|
||||
// 172.18.222.253
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ public enum AppConfigKeyEnums {
|
|||
EWM_SEND_WAREHOUSE_IN_COMPLETED_URL("EwmSendTaskCompleteUrl", "发送入库完成地址"),
|
||||
EWM_SEND_CONTAINER_EMPTY_URL("VehicleEmpty", "发送箱体清空地址"),
|
||||
EWM_GET_STOCK_LIST_URL("EwmStockBackUrl", "发送出库任务地址"),
|
||||
EWM_CHECK_CONTAINER_NO_URL("EwmCheckContainerNo", "检验目标箱号是否可用"),
|
||||
EWM_SEND_WAREHOUSE_OUT_COMPLETED_URL("EwmSendOutTaskCompleteUrl", "发送出库完成地址");
|
||||
private final String key;
|
||||
private final String desc;
|
||||
|
|
|
|||
|
|
@ -141,6 +141,13 @@ public class EwmOutTaskRequest {
|
|||
@JsonProperty("batchNo")
|
||||
private String batchNo;
|
||||
|
||||
|
||||
/**
|
||||
* 颗粒度
|
||||
*/
|
||||
@JsonProperty("secondPickingKey")
|
||||
private String secondPickingKey;
|
||||
|
||||
// Getters and Setters
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
package com.wms_main.model.dto.request.ewm;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SendEwmCheckContainerNo {
|
||||
|
||||
/**
|
||||
* 载具号
|
||||
*/
|
||||
@JsonProperty("containerNo")
|
||||
private String containerNo;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
@JsonProperty("type")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 是否二次
|
||||
*/
|
||||
@JsonProperty("firstOrSecond")
|
||||
private boolean firstOrSecond;
|
||||
|
||||
/**
|
||||
* 颗粒度
|
||||
*/
|
||||
@JsonProperty("checkKey")
|
||||
private String checkKey;
|
||||
}
|
||||
|
|
@ -127,4 +127,11 @@ public class TAppOuts {
|
|||
*/
|
||||
@TableField(value = "unit")
|
||||
private String unit;
|
||||
|
||||
|
||||
/**
|
||||
* 二次拣货码/颗粒度
|
||||
*/
|
||||
@TableField(value = "second_picking_code")
|
||||
private String secondPickingCode;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,4 +63,18 @@ public class TAppOutsCheck {
|
|||
*/
|
||||
@TableField(value = "container_no")
|
||||
private String containerNo;
|
||||
|
||||
|
||||
/**
|
||||
* 二次拣货码/颗粒度
|
||||
*/
|
||||
@TableField(value = "second_picking_code")
|
||||
private String secondPickingCode;
|
||||
|
||||
|
||||
/**
|
||||
* 客户工单号
|
||||
*/
|
||||
@TableField(value = "order_no")
|
||||
private String orderNo;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
package com.wms_main.service.api;
|
||||
|
||||
import com.wms_main.model.dto.request.ewm.SendEwmGetStockInformationRequest;
|
||||
import com.wms_main.model.dto.request.ewm.SendEwmVehicleForInRequest;
|
||||
import com.wms_main.model.dto.request.ewm.SendWarehouseInCompletedRequest;
|
||||
import com.wms_main.model.dto.request.ewm.SendWarehouseOutCompletedRequest;
|
||||
import com.wms_main.model.dto.request.ewm.*;
|
||||
import com.wms_main.model.dto.response.ewm.EwmApiBackResponse;
|
||||
import com.wms_main.model.dto.response.ewm.EwmApiLocalResponse;
|
||||
import com.wms_main.model.dto.response.ewm.EwmApiStockResponse;
|
||||
|
|
@ -45,4 +42,10 @@ public interface IEwmApiService {
|
|||
*/
|
||||
EwmApiStockResponse getEwmStock(SendEwmGetStockInformationRequest request);
|
||||
|
||||
|
||||
/**
|
||||
* 目标箱号向EWM系统验证
|
||||
* @return 获取到的库存
|
||||
*/
|
||||
EwmApiBackResponse sendEwmCheckContainerNo(SendEwmCheckContainerNo request);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,10 +2,7 @@ package com.wms_main.service.api.serviceImpl;
|
|||
|
||||
import com.wms_main.app.AppCommon;
|
||||
import com.wms_main.constant.enums.wms.AppConfigKeyEnums;
|
||||
import com.wms_main.model.dto.request.ewm.SendEwmGetStockInformationRequest;
|
||||
import com.wms_main.model.dto.request.ewm.SendEwmVehicleForInRequest;
|
||||
import com.wms_main.model.dto.request.ewm.SendWarehouseInCompletedRequest;
|
||||
import com.wms_main.model.dto.request.ewm.SendWarehouseOutCompletedRequest;
|
||||
import com.wms_main.model.dto.request.ewm.*;
|
||||
import com.wms_main.model.dto.response.ewm.EwmApiBackResponse;
|
||||
import com.wms_main.model.dto.response.ewm.EwmApiLocalResponse;
|
||||
import com.wms_main.model.dto.response.ewm.EwmApiStockResponse;
|
||||
|
|
@ -187,4 +184,32 @@ public class EwmApiServiceImpl implements IEwmApiService {
|
|||
return EwmApiStockResponse.error("调用EWM系统接口异常: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EwmApiBackResponse sendEwmCheckContainerNo(SendEwmCheckContainerNo request) {
|
||||
try {
|
||||
// 构建Basic Auth认证信息
|
||||
String auth = "mom:test@123";
|
||||
String encodedAuth = java.util.Base64.getEncoder().encodeToString(auth.getBytes());
|
||||
|
||||
// 设置http请求
|
||||
HttpRequest httpRequest = HttpRequest.postInstanceOf(
|
||||
appCommon.getConfigByKey(AppConfigKeyEnums.EWM_CHECK_CONTAINER_NO_URL.getKey()),
|
||||
request,
|
||||
5000,
|
||||
"application/json",
|
||||
"Basic " + encodedAuth);
|
||||
HttpResponse httpResponse = httpClient.httpPost(httpRequest);
|
||||
|
||||
if (httpResponse != null && httpResponse.isSuccess()) {
|
||||
return httpResponse.getData(EwmApiBackResponse.class);
|
||||
}
|
||||
|
||||
log.warn("请求验证EWM系统返回空响应或请求失败,请求参数: {}", request);
|
||||
return EwmApiBackResponse.error("EWM系统返回空响应或请求失败");
|
||||
} catch (Exception e) {
|
||||
log.error("调用EWM系统接口异常,请求参数: {}", request, e);
|
||||
return EwmApiBackResponse.error("调用EWM系统接口异常: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -355,7 +355,7 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
null,
|
||||
null,
|
||||
null,
|
||||
null,null
|
||||
null,null, null
|
||||
);
|
||||
appOutsService.save(task);
|
||||
return BaseWmsApiResponse.success("添加出库请求成功。");
|
||||
|
|
@ -501,7 +501,8 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
task.getBatchNo(),
|
||||
ewmOutTaskRequest.getPickingType(),
|
||||
ewmOutTaskRequest.getWaveNo(),
|
||||
task.getSkuUnit()
|
||||
task.getSkuUnit(),
|
||||
task.getSecondPickingKey()
|
||||
);
|
||||
//appOuts.add(outs);
|
||||
appOutsService.save(outs);
|
||||
|
|
@ -809,7 +810,8 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
null,
|
||||
null,
|
||||
null,
|
||||
null,null
|
||||
null,null,
|
||||
null
|
||||
));
|
||||
}
|
||||
|
||||
|
|
@ -1426,9 +1428,52 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
if (pickTaskList.size() > 1) {
|
||||
return BaseWmsApiResponse.error("当前站台有多个箱子到达,请检查。");
|
||||
}
|
||||
|
||||
TAppOuts thisOut = appOutsService.getOne(new LambdaQueryWrapper<TAppOuts>()
|
||||
.eq(TAppOuts::getTaskId, confirmTaskRequest.getTaskConfirm().getTaskId()));
|
||||
|
||||
// 调用EWM系统检验箱子
|
||||
SendEwmCheckContainerNo request = new SendEwmCheckContainerNo();
|
||||
request.setContainerNo(confirmTaskRequest.getTaskConfirm().getContainerNo());
|
||||
request.setType(thisOut.getPickingType());
|
||||
request.setFirstOrSecond(false);
|
||||
request.setCheckKey(thisOut.getSecondPickingCode());
|
||||
EwmApiBackResponse ewmResponse = ewmApiService.sendEwmCheckContainerNo(request);
|
||||
// 判断EWM系统返回结果
|
||||
if (ewmResponse == null || !"successfully".equals(ewmResponse.getState())) {
|
||||
if (ewmResponse != null) {
|
||||
return BaseWmsApiResponse.error(ewmResponse.getContent().toString());
|
||||
}
|
||||
return BaseWmsApiResponse.error("EWM系统异常,请检查。");
|
||||
}
|
||||
|
||||
// 检测目标箱号是否存在别的物料,以颗粒度为第一优先级,如果颗粒度为空,则使用工单号
|
||||
List<TAppOutsCheck> thisOutsChecks = appOutsCheckService.list(new LambdaQueryWrapper<TAppOutsCheck>()
|
||||
.eq(TAppOutsCheck::getContainerNo, confirmTaskRequest.getTaskConfirm().getContainerNo()));
|
||||
if (thisOutsChecks != null && !thisOutsChecks.isEmpty()) {
|
||||
TAppOutsCheck existingCheck = thisOutsChecks.getFirst();
|
||||
|
||||
// 1. 检测是否是颗粒度相同(考虑 null 和 empty)
|
||||
String existingSecondPickingCode = existingCheck.getSecondPickingCode();
|
||||
String newSecondPickingCode = thisOut.getSecondPickingCode();
|
||||
|
||||
boolean isSecondPickingCodeMatch = (StringUtils.isEmpty(existingSecondPickingCode) && StringUtils.isEmpty(newSecondPickingCode))
|
||||
|| Objects.equals(existingSecondPickingCode, newSecondPickingCode);
|
||||
|
||||
if (!isSecondPickingCodeMatch) {
|
||||
return BaseWmsApiResponse.error("当前目标箱号已存在其他颗粒度物料,请检查。");
|
||||
}
|
||||
|
||||
// 2. 如果颗粒度一致(包括都为空),再检测工单号是否相同
|
||||
String existingOrderNo = existingCheck.getOrderNo();
|
||||
String newOrderNo = thisOut.getOrderNo();
|
||||
|
||||
boolean isOrderNoMatch = Objects.equals(existingOrderNo, newOrderNo);
|
||||
if (!isOrderNoMatch) {
|
||||
return BaseWmsApiResponse.error("当前目标箱号已存在其他工单号物料,请检查。");
|
||||
}
|
||||
}
|
||||
|
||||
// 将出库完成需要反馈的信息插入outsCheck表中
|
||||
List<TAppOutsCheck> outsChecks = new ArrayList<>();
|
||||
outsChecks.add(new TAppOutsCheck(
|
||||
|
|
@ -1439,7 +1484,9 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
confirmTaskRequest.getTaskConfirm().getTotalNeed(),
|
||||
confirmTaskRequest.getTaskConfirm().getRealPickQty(),
|
||||
thisOut.getUnit(),
|
||||
confirmTaskRequest.getTaskConfirm().getContainerNo()
|
||||
confirmTaskRequest.getTaskConfirm().getContainerNo(),
|
||||
thisOut.getSecondPickingCode(),
|
||||
thisOut.getOrderNo()
|
||||
));
|
||||
appOutsCheckService.saveBatch(outsChecks);
|
||||
// 当前站台到达的拣选任务
|
||||
|
|
@ -1966,7 +2013,7 @@ public class TaskControllerServiceImpl implements ITaskControllerService {
|
|||
// 触发事务回滚
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
// 返回错误信息
|
||||
return "调用EWM系统接口异常";
|
||||
return ewmApiBackResponse.toString();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user