添加入库出库回调流程
This commit is contained in:
parent
e546c45afd
commit
80a309a83b
|
|
@ -8,10 +8,14 @@ import com.wms_main.constant.enums.wcs.WcsStackerTaskStatusEnums;
|
|||
import com.wms_main.constant.enums.wcs.WcsStackerTaskTypeEnums;
|
||||
import com.wms_main.constant.enums.wms.*;
|
||||
import com.wms_main.dao.*;
|
||||
import com.wms_main.model.bo.ycwms.YCWmsApiResponse;
|
||||
import com.wms_main.model.dto.request.ycwms.OrderInCBReq;
|
||||
import com.wms_main.model.dto.request.ycwms.OrderOutCBReq;
|
||||
import com.wms_main.model.po.*;
|
||||
import com.wms_main.repository.utils.ConvertUtils;
|
||||
import com.wms_main.repository.utils.StringUtils;
|
||||
import com.wms_main.repository.utils.UUIDUtils;
|
||||
import com.wms_main.service.api.IExternalApiService;
|
||||
import com.wms_main.service.business.IStackerTaskService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -69,6 +73,8 @@ public class StackerTaskServiceImpl implements IStackerTaskService {
|
|||
private final ITAppOrderInService appOrderInService;
|
||||
|
||||
private final ITAppOrderOutService appOrderOutService;
|
||||
|
||||
private final IExternalApiService externalApiService;
|
||||
/**
|
||||
* 业务通用
|
||||
*/
|
||||
|
|
@ -370,10 +376,12 @@ public class StackerTaskServiceImpl implements IStackerTaskService {
|
|||
List<TAppStock> newStockList = null;
|
||||
// 需要删除的任务id
|
||||
List<String> needDeleteOrderIns = new ArrayList<>();
|
||||
List<String> orderCBIds = new ArrayList<>();
|
||||
Map<String, TAppStock> stockMap = new HashMap<>();
|
||||
for (TAppOrderIn thisOrderIn : thisOrderInList) {
|
||||
// 删除任务
|
||||
needDeleteOrderIns.add(thisOrderIn.getRecordId());
|
||||
orderCBIds.add(thisOrderIn.getOrderId());
|
||||
// 添加库存
|
||||
String validateStr = thisOrderIn.getGoodsId() + thisOrderIn.getBatch() + thisOrderIn.getGoodsType() + thisOrderIn.getSpecification();
|
||||
if (!stockMap.containsKey(validateStr)) {
|
||||
|
|
@ -437,6 +445,26 @@ public class StackerTaskServiceImpl implements IStackerTaskService {
|
|||
}
|
||||
// TODO 上报 亚驰 WMS 入库单完成,一个载具应该对应一个入库单
|
||||
|
||||
orderCBIds = orderCBIds.stream().distinct().collect(Collectors.toList());
|
||||
for (String orderId : orderCBIds) {
|
||||
OrderInCBReq orderInCBReq = new OrderInCBReq();
|
||||
orderInCBReq.setOrderId(orderId);
|
||||
orderInCBReq.setVehicleNo(vehicleId);
|
||||
orderInCBReq.setOrderStatus(OrderStatusEnum.COMPLETE.getCode());
|
||||
orderInCBReq.setMessage("入库完成");
|
||||
|
||||
int times = 0;
|
||||
YCWmsApiResponse response = null;
|
||||
do {
|
||||
response = externalApiService.invokeOrderInCB(orderInCBReq);
|
||||
times++;
|
||||
} while (!response.getState().equals("success") && times <= 3);
|
||||
if (response.getState().equals("error") && times >= 3) {
|
||||
log.error("上报失败");
|
||||
} else {
|
||||
log.info("上报成功");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -769,6 +797,26 @@ public class StackerTaskServiceImpl implements IStackerTaskService {
|
|||
.eq(TAppWcsTask::getWcsTaskType, WcsStackerTaskTypeEnums.OUT.getCode())
|
||||
.in(TAppWcsTask::getWcsTaskId, thisVehicleOutTasks.stream().map(TAppWcsTask::getWcsTaskId).toList()));
|
||||
}
|
||||
List<String> orderOutsId = thisVehicleOutTasks.stream().map(TAppWcsTask::getOrderId).distinct().toList();
|
||||
for (String orderId : orderOutsId) {
|
||||
OrderOutCBReq orderOutCBReq = new OrderOutCBReq();
|
||||
orderOutCBReq.setOrderId(orderId);
|
||||
orderOutCBReq.setVehicleNo(vehicleId);
|
||||
orderOutCBReq.setOrderStatus(OrderStatusEnum.COMPLETE.getCode());
|
||||
orderOutCBReq.setMessage("出库完成");
|
||||
|
||||
int times = 0;
|
||||
YCWmsApiResponse response = null;
|
||||
do {
|
||||
response = externalApiService.invokeOrderOutCB(orderOutCBReq);
|
||||
times++;
|
||||
} while (!response.getState().equals("success") && times <= 3);
|
||||
if (response.getState().equals("error") && times >= 3) {
|
||||
log.error("上报失败");
|
||||
} else {
|
||||
log.info("上报成功");
|
||||
}
|
||||
}
|
||||
}
|
||||
appOrderOutService.remove(new LambdaUpdateWrapper<TAppOrderOut>().le(TAppOrderOut::getQuantity, 0));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user