修复bug:
1. 删除库位锁定, 因入库任务由场内wms下发生成, 故不存在库位竞争 2. 修改入库订单生成逻辑, 由wcs_require接口生成, 改为由ycwms接口生成, 加入FC载具号生成订单的绿色通道, 从而使场内wms的空托空盘入库任务状态闭环 新需求: 1. 修改单机出库: 先查询库存, 后勾选出库
This commit is contained in:
parent
b90f03e1a6
commit
59c978231a
|
|
@ -48,9 +48,9 @@ public class YcwmsController {
|
||||||
return ycwmsControllerService.getAvailPercent(equipmentId);
|
return ycwmsControllerService.getAvailPercent(equipmentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/localOut")
|
@PostMapping("/localQuery")
|
||||||
public YcwmsResponse<Object> localOut(@RequestBody LocalOrderReq request) {
|
public YcwmsResponse<List<StockResp>> localQuery(@RequestBody LocalOrderReq request) {
|
||||||
return ycwmsControllerService.localOrderOut(request);
|
return ycwmsControllerService.localQuery(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/getOutLocation")
|
@PostMapping("/getOutLocation")
|
||||||
|
|
@ -62,4 +62,9 @@ public class YcwmsController {
|
||||||
return YcwmsResponse.success(outLoc);
|
return YcwmsResponse.success(outLoc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/localOut")
|
||||||
|
public YcwmsResponse<Object> localOut(@RequestBody List<String> vehicleNos) {
|
||||||
|
return ycwmsControllerService.localOut(vehicleNos);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.wms_main.model.bo.erp;
|
package com.wms_main.model.bo.erp;
|
||||||
|
|
||||||
|
import com.wms_main.model.dto.request.ycwms.OrderInGoodsDetail;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
@ -22,4 +23,18 @@ public class ErpGoodsDetail {
|
||||||
private String xsfbillno;
|
private String xsfbillno;
|
||||||
private Integer xsfseq;
|
private Integer xsfseq;
|
||||||
private String neibubianhao;
|
private String neibubianhao;
|
||||||
|
|
||||||
|
public static ErpGoodsDetail of(OrderInGoodsDetail goodsDetail) {
|
||||||
|
ErpGoodsDetail erpGoodsDetail = new ErpGoodsDetail();
|
||||||
|
erpGoodsDetail.setGoodsId(goodsDetail.getGoodsId());
|
||||||
|
erpGoodsDetail.setGoodsName(goodsDetail.getGoodsName());
|
||||||
|
erpGoodsDetail.setBatch(goodsDetail.getBatch());
|
||||||
|
erpGoodsDetail.setGoodsType(goodsDetail.getGoodsType());
|
||||||
|
erpGoodsDetail.setSpecification(goodsDetail.getSpecification());
|
||||||
|
erpGoodsDetail.setQuantity(goodsDetail.getQuantity());
|
||||||
|
erpGoodsDetail.setGoodsDesc(goodsDetail.getGoodsDesc());
|
||||||
|
erpGoodsDetail.setGoodsBarcode(goodsDetail.getGoodsBarcode());
|
||||||
|
|
||||||
|
return erpGoodsDetail;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,15 +7,16 @@ import lombok.Setter;
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
public class LocalOrderReq {
|
public class LocalOrderReq {
|
||||||
@JsonProperty("specification")
|
@JsonProperty("goodsType")
|
||||||
private String specification;
|
private String goodsType;
|
||||||
|
|
||||||
@JsonProperty("xsfbillno")
|
@JsonProperty("xsfbillno")
|
||||||
private String xsfbillno;
|
private String xsfbillno;
|
||||||
|
|
||||||
@JsonProperty("xsfseq")
|
|
||||||
private Integer xsfseq;
|
|
||||||
|
|
||||||
@JsonProperty("neibubianhao")
|
@JsonProperty("neibubianhao")
|
||||||
private String neibubianhao;
|
private String neibubianhao;
|
||||||
|
|
||||||
|
public boolean empty() {
|
||||||
|
return goodsType == null && xsfbillno == null && neibubianhao == null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ public interface IStackerTaskService {
|
||||||
* 完成堆垛机入库任务
|
* 完成堆垛机入库任务
|
||||||
* @param stackerInTasks 已完成的入库任务
|
* @param stackerInTasks 已完成的入库任务
|
||||||
*/
|
*/
|
||||||
void finishStackerInTasks(List<TAppOrderIn> stackerInTasks);
|
void finishStackerInTasks(List<TAppOrderIn> stackerInTasks) throws InterruptedException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 完成堆垛机入库任务---合并相同物料
|
* 完成堆垛机入库任务---合并相同物料
|
||||||
|
|
@ -44,5 +44,5 @@ public interface IStackerTaskService {
|
||||||
* 完成堆垛机出库任务
|
* 完成堆垛机出库任务
|
||||||
* @param stackerOutTasks 已完成的出库任务
|
* @param stackerOutTasks 已完成的出库任务
|
||||||
*/
|
*/
|
||||||
void finishStackerOutTasks(List<TAppWcsTask> stackerOutTasks);
|
void finishStackerOutTasks(List<TAppWcsTask> stackerOutTasks) throws InterruptedException;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -357,133 +357,6 @@ public class StackerTaskServiceImpl implements IStackerTaskService {
|
||||||
.map(Map.Entry::getKey)
|
.map(Map.Entry::getKey)
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 实现
|
|
||||||
*
|
|
||||||
* @param stackerInTasks 已完成的入库任务
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public void finishStackerInTasks(List<TAppOrderIn> stackerInTasks) {
|
|
||||||
// 根据载具号map一下
|
|
||||||
Map<String, List<TAppOrderIn>> vehicleIdToTaskMap = stackerInTasks.stream()
|
|
||||||
.filter(orderIn -> Objects.equals(orderIn.getOrderStatus(), OrderStatusEnum.COMPLETE.getCode()))
|
|
||||||
.collect(Collectors.groupingBy(TAppOrderIn::getVehicleNo));
|
|
||||||
for (String vehicleId : vehicleIdToTaskMap.keySet()) {
|
|
||||||
List<TAppOrderIn> thisOrderInList = vehicleIdToTaskMap.get(vehicleId);
|
|
||||||
if (thisOrderInList == null || thisOrderInList.isEmpty()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
String location = thisOrderInList.getFirst().getDestination();
|
|
||||||
// 新的库存信息
|
|
||||||
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());
|
|
||||||
// 添加库存
|
|
||||||
TAppStock newStock = new TAppStock();
|
|
||||||
newStock.setStockId(UUIDUtils.getNewUUID());
|
|
||||||
newStock.setVehicleId(vehicleId);
|
|
||||||
newStock.setLocationId(thisOrderIn.getDestination());
|
|
||||||
newStock.setStockStatus(WmsStockStatusEnums.OK.getCode());
|
|
||||||
newStock.setGoodsId(thisOrderIn.getGoodsId());
|
|
||||||
newStock.setGoodsStatus(WmsGoodsStatusEnums.OK.getCode());
|
|
||||||
newStock.setFirstInTime(thisOrderIn.getCreateTime());
|
|
||||||
newStock.setFirstInUser(thisOrderIn.getClientId());
|
|
||||||
newStock.setLastUpdateTime(LocalDateTime.now());
|
|
||||||
newStock.setLastUpdateUser(thisOrderIn.getClientId());
|
|
||||||
newStock.setTotalNum(thisOrderIn.getQuantity());
|
|
||||||
newStock.setRemainNum(thisOrderIn.getQuantity());
|
|
||||||
newStock.setRealNum(thisOrderIn.getQuantity());
|
|
||||||
newStock.setGoodsDesc(thisOrderIn.getGoodsName());
|
|
||||||
newStock.setSled(thisOrderIn.getSpecification());
|
|
||||||
newStock.setMesId(thisOrderIn.getOrderId());
|
|
||||||
newStock.setBatch(thisOrderIn.getBatch());
|
|
||||||
newStock.setGoodsType(thisOrderIn.getGoodsType());
|
|
||||||
newStock.setBarCode(thisOrderIn.getInStand());
|
|
||||||
newStock.setGoodsBarCode(thisOrderIn.getGoodsBarcode());
|
|
||||||
newStock.setXsfbillno(thisOrderIn.getXsfbillno());
|
|
||||||
newStock.setXsfseq(thisOrderIn.getXsfseq());
|
|
||||||
newStock.setNeibubianhao(thisOrderIn.getNeibubianhao());
|
|
||||||
|
|
||||||
appStockService.save(newStock);
|
|
||||||
}
|
|
||||||
// 将目标库位的工作状态设置为未工作
|
|
||||||
appLocationService.update(new LambdaUpdateWrapper<TAppLocation>()
|
|
||||||
.set(TAppLocation::getIsWorking, 0)
|
|
||||||
.set(TAppLocation::getVehicleId, vehicleId)
|
|
||||||
.eq(TAppLocation::getLocationId, location)
|
|
||||||
);
|
|
||||||
// 需要更新下当前载具下的库存其他信息
|
|
||||||
// appStockService.update(new LambdaUpdateWrapper<TAppStock>()
|
|
||||||
// .set(TAppStock::getStockStatus, WmsStockStatusEnums.OK.getCode())
|
|
||||||
// .set(TAppStock::getLocationId, location)
|
|
||||||
// .eq(TAppStock::getVehicleId, vehicleId));
|
|
||||||
// 保存载具表
|
|
||||||
TAppVehicle vehicle = new TAppVehicle();
|
|
||||||
vehicle.setVehicleId(vehicleId);
|
|
||||||
vehicle.setIsEmpty(0);
|
|
||||||
vehicle.setVehicleStatus(WmsVehicleStatusEnums.ON.getCode());
|
|
||||||
vehicle.setIsLock(0);
|
|
||||||
vehicle.setVehicleType("1");
|
|
||||||
vehicle.setLocationId(location);
|
|
||||||
vehicle.setLastInTime(LocalDateTime.now());
|
|
||||||
appVehicleService.saveOrUpdate(vehicle);
|
|
||||||
|
|
||||||
TAppWcsTaskBak wcsTaskBak = new TAppWcsTaskBak();
|
|
||||||
wcsTaskBak.setWcsTaskId(UUIDUtils.getNewUUID());
|
|
||||||
wcsTaskBak.setWcsTaskStatus(100);
|
|
||||||
wcsTaskBak.setWcsTaskType(WmsTaskTypeEnums.IN.getCode());
|
|
||||||
wcsTaskBak.setTaskPriority(1);
|
|
||||||
wcsTaskBak.setVehicleId(vehicleId);
|
|
||||||
wcsTaskBak.setOrigin(thisOrderInList.getFirst().getInStand());
|
|
||||||
wcsTaskBak.setDestination(location);
|
|
||||||
wcsTaskBak.setCreateTime(LocalDateTime.now());
|
|
||||||
wcsTaskBak.setSendTime(LocalDateTime.now());
|
|
||||||
wcsTaskBak.setFinishTime(LocalDateTime.now());
|
|
||||||
wcsTaskBak.setRemark(thisOrderInList.getFirst().getClientId());
|
|
||||||
wcsTaskBak.setCount(thisOrderInList.size());
|
|
||||||
wcsTaskBak.setTotalNum(thisOrderInList.stream().mapToDouble(TAppOrderIn::getQuantity).sum());
|
|
||||||
appWcsTaskBakService.save(wcsTaskBak);
|
|
||||||
|
|
||||||
// 删除已经完成的入库单
|
|
||||||
if (!needDeleteOrderIns.isEmpty()) {
|
|
||||||
appOrderInService.removeByIds(needDeleteOrderIns);
|
|
||||||
}
|
|
||||||
// TODO 上报 亚驰 WMS 入库单完成,一个载具应该对应一个入库单
|
|
||||||
|
|
||||||
orderCBIds = orderCBIds.stream().distinct().collect(Collectors.toList());
|
|
||||||
for (String orderId : orderCBIds) {
|
|
||||||
if (orderId.contains("baokai")) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
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("上报成功");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 实现---这里是合并库存的部分
|
* 实现---这里是合并库存的部分
|
||||||
*
|
*
|
||||||
|
|
@ -701,6 +574,126 @@ public class StackerTaskServiceImpl implements IStackerTaskService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实现
|
||||||
|
*
|
||||||
|
* @param stackerInTasks 已完成的入库任务
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void finishStackerInTasks(List<TAppOrderIn> stackerInTasks) throws InterruptedException {
|
||||||
|
// 根据载具号map一下
|
||||||
|
Map<String, List<TAppOrderIn>> vehicleIdToTaskMap = stackerInTasks.stream()
|
||||||
|
.filter(orderIn -> Objects.equals(orderIn.getOrderStatus(), OrderStatusEnum.COMPLETE.getCode()))
|
||||||
|
.collect(Collectors.groupingBy(TAppOrderIn::getVehicleNo));
|
||||||
|
for (String vehicleId : vehicleIdToTaskMap.keySet()) {
|
||||||
|
List<TAppOrderIn> thisOrderInList = vehicleIdToTaskMap.get(vehicleId);
|
||||||
|
if (thisOrderInList == null || thisOrderInList.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String location = thisOrderInList.getFirst().getDestination();
|
||||||
|
// 需要删除的任务id
|
||||||
|
List<String> needDeleteOrderIns = new ArrayList<>();
|
||||||
|
List<String> orderCBIds = new ArrayList<>();
|
||||||
|
for (TAppOrderIn thisOrderIn : thisOrderInList) {
|
||||||
|
// 删除任务
|
||||||
|
needDeleteOrderIns.add(thisOrderIn.getRecordId());
|
||||||
|
orderCBIds.add(thisOrderIn.getOrderId());
|
||||||
|
// 添加库存
|
||||||
|
TAppStock newStock = new TAppStock();
|
||||||
|
newStock.setStockId(UUIDUtils.getNewUUID());
|
||||||
|
newStock.setVehicleId(vehicleId);
|
||||||
|
newStock.setLocationId(thisOrderIn.getDestination());
|
||||||
|
newStock.setStockStatus(WmsStockStatusEnums.OK.getCode());
|
||||||
|
newStock.setGoodsId(thisOrderIn.getGoodsId());
|
||||||
|
newStock.setGoodsStatus(WmsGoodsStatusEnums.OK.getCode());
|
||||||
|
newStock.setFirstInTime(thisOrderIn.getCreateTime());
|
||||||
|
newStock.setFirstInUser(thisOrderIn.getClientId());
|
||||||
|
newStock.setLastUpdateTime(LocalDateTime.now());
|
||||||
|
newStock.setLastUpdateUser(thisOrderIn.getClientId());
|
||||||
|
newStock.setTotalNum(thisOrderIn.getQuantity());
|
||||||
|
newStock.setRemainNum(thisOrderIn.getQuantity());
|
||||||
|
newStock.setRealNum(thisOrderIn.getQuantity());
|
||||||
|
newStock.setGoodsDesc(thisOrderIn.getGoodsName());
|
||||||
|
newStock.setSled(thisOrderIn.getSpecification());
|
||||||
|
newStock.setMesId(thisOrderIn.getOrderId());
|
||||||
|
newStock.setBatch(thisOrderIn.getBatch());
|
||||||
|
newStock.setGoodsType(thisOrderIn.getGoodsType());
|
||||||
|
newStock.setBarCode(thisOrderIn.getInStand());
|
||||||
|
newStock.setGoodsBarCode(thisOrderIn.getGoodsBarcode());
|
||||||
|
newStock.setXsfbillno(thisOrderIn.getXsfbillno());
|
||||||
|
newStock.setXsfseq(thisOrderIn.getXsfseq());
|
||||||
|
newStock.setNeibubianhao(thisOrderIn.getNeibubianhao());
|
||||||
|
|
||||||
|
appStockService.save(newStock);
|
||||||
|
}
|
||||||
|
// 将目标库位的工作状态设置为未工作
|
||||||
|
appLocationService.update(new LambdaUpdateWrapper<TAppLocation>()
|
||||||
|
.set(TAppLocation::getVehicleId, vehicleId)
|
||||||
|
.set(TAppLocation::getIsOccupy, WmsLocationOccupyStatusEnums.OCCUPY.getCode())
|
||||||
|
.eq(TAppLocation::getLocationId, location)
|
||||||
|
);
|
||||||
|
// 保存载具表
|
||||||
|
TAppVehicle vehicle = new TAppVehicle();
|
||||||
|
vehicle.setVehicleId(vehicleId);
|
||||||
|
vehicle.setIsEmpty(0);
|
||||||
|
vehicle.setVehicleStatus(WmsVehicleStatusEnums.ON.getCode());
|
||||||
|
vehicle.setIsLock(0);
|
||||||
|
vehicle.setVehicleType("1");
|
||||||
|
vehicle.setLocationId(location);
|
||||||
|
vehicle.setLastInTime(LocalDateTime.now());
|
||||||
|
appVehicleService.saveOrUpdate(vehicle);
|
||||||
|
|
||||||
|
TAppWcsTaskBak wcsTaskBak = new TAppWcsTaskBak();
|
||||||
|
wcsTaskBak.setWcsTaskId(UUIDUtils.getNewUUID());
|
||||||
|
wcsTaskBak.setWcsTaskStatus(100);
|
||||||
|
wcsTaskBak.setWcsTaskType(WmsTaskTypeEnums.IN.getCode());
|
||||||
|
wcsTaskBak.setTaskPriority(1);
|
||||||
|
wcsTaskBak.setVehicleId(vehicleId);
|
||||||
|
wcsTaskBak.setOrigin(thisOrderInList.getFirst().getInStand());
|
||||||
|
wcsTaskBak.setDestination(location);
|
||||||
|
wcsTaskBak.setCreateTime(LocalDateTime.now());
|
||||||
|
wcsTaskBak.setSendTime(LocalDateTime.now());
|
||||||
|
wcsTaskBak.setFinishTime(LocalDateTime.now());
|
||||||
|
wcsTaskBak.setRemark(thisOrderInList.getFirst().getClientId());
|
||||||
|
wcsTaskBak.setCount(thisOrderInList.size());
|
||||||
|
wcsTaskBak.setTotalNum(thisOrderInList.stream().mapToDouble(TAppOrderIn::getQuantity).sum());
|
||||||
|
appWcsTaskBakService.save(wcsTaskBak);
|
||||||
|
// TODO 上报 亚驰 WMS 入库单完成,一个载具应该对应一个入库单
|
||||||
|
|
||||||
|
orderCBIds = orderCBIds.stream().distinct().collect(Collectors.toList());
|
||||||
|
for (String orderId : orderCBIds) {
|
||||||
|
if (orderId.contains("baokai")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
OrderInCBReq orderInCBReq = new OrderInCBReq();
|
||||||
|
orderInCBReq.setOrderId(orderId);
|
||||||
|
orderInCBReq.setVehicleNo(vehicleId);
|
||||||
|
orderInCBReq.setOrderStatus(OrderStatusEnum.COMPLETE.getCode());
|
||||||
|
orderInCBReq.setMessage("入库完成");
|
||||||
|
|
||||||
|
int times = 0;
|
||||||
|
YCWmsApiResponse response = null;
|
||||||
|
do {
|
||||||
|
Thread.sleep(15000L * times);
|
||||||
|
response = externalApiService.invokeOrderInCB(orderInCBReq);
|
||||||
|
times++;
|
||||||
|
} while (!response.getState().equals("success") && times <= 10);
|
||||||
|
if (response.getState().equals("error")) {
|
||||||
|
log.error("[wms]上报失败");
|
||||||
|
} else {
|
||||||
|
log.info("[wms]上报成功");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 删除已经完成的入库单
|
||||||
|
if (!needDeleteOrderIns.isEmpty()) {
|
||||||
|
appOrderInService.removeByIds(needDeleteOrderIns);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 实现
|
* 实现
|
||||||
*
|
*
|
||||||
|
|
@ -708,7 +701,7 @@ public class StackerTaskServiceImpl implements IStackerTaskService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void finishStackerOutTasks(List<TAppWcsTask> stackerOutTasks) {
|
public void finishStackerOutTasks(List<TAppWcsTask> stackerOutTasks) throws InterruptedException {
|
||||||
// 出库完成需要完成以下事情:
|
// 出库完成需要完成以下事情:
|
||||||
// 1. 更新库存状态
|
// 1. 更新库存状态
|
||||||
// 2. 更新载具状态
|
// 2. 更新载具状态
|
||||||
|
|
@ -848,11 +841,12 @@ public class StackerTaskServiceImpl implements IStackerTaskService {
|
||||||
do {
|
do {
|
||||||
response = externalApiService.invokeOrderOutCB(orderOutCBReq);
|
response = externalApiService.invokeOrderOutCB(orderOutCBReq);
|
||||||
times++;
|
times++;
|
||||||
} while (!response.getState().equals("success") && times <= 3);
|
Thread.sleep(15000L * times);
|
||||||
if (response.getState().equals("error") && times >= 3) {
|
} while (!response.getState().equals("success") && times <= 10);
|
||||||
log.error("上报失败");
|
if (response.getState().equals("error")) {
|
||||||
|
log.error("[WMS]上报失败");
|
||||||
} else {
|
} else {
|
||||||
log.info("上报成功");
|
log.info("[WMS]上报成功");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ public interface IYcwmsControllerService {
|
||||||
YcwmsResponse<Object> orderOut(OrderOutReq request);
|
YcwmsResponse<Object> orderOut(OrderOutReq request);
|
||||||
YcwmsResponse<List<StockResp>> stock(StockReq request);
|
YcwmsResponse<List<StockResp>> stock(StockReq request);
|
||||||
YcwmsResponse<Object> getAvailPercent(String equipmentId);
|
YcwmsResponse<Object> getAvailPercent(String equipmentId);
|
||||||
YcwmsResponse<Object> localOrderOut(LocalOrderReq request);
|
YcwmsResponse<List<StockResp>> localQuery(LocalOrderReq request);
|
||||||
String getLocByGoodsId(String goodsId);
|
String getLocByGoodsId(String goodsId);
|
||||||
|
YcwmsResponse<Object> localOut(List<String> vehicleNos);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package com.wms_main.service.controller.serviceImpl;
|
package com.wms_main.service.controller.serviceImpl;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.wms_main.constant.enums.wcs.WcsStackerTaskStatusEnums;
|
import com.wms_main.constant.enums.wcs.WcsStackerTaskStatusEnums;
|
||||||
import com.wms_main.constant.enums.wcs.WcsStackerTaskTypeEnums;
|
import com.wms_main.constant.enums.wcs.WcsStackerTaskTypeEnums;
|
||||||
import com.wms_main.constant.enums.wms.OrderStatusEnum;
|
import com.wms_main.constant.enums.wms.OrderStatusEnum;
|
||||||
|
|
@ -25,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
|
|
@ -34,7 +37,6 @@ public class WcsControllerServiceImpl implements IWcsControllerService {
|
||||||
private final ITAppOrderInService orderInService;
|
private final ITAppOrderInService orderInService;
|
||||||
private final IStackerTaskService stackerTaskService;
|
private final IStackerTaskService stackerTaskService;
|
||||||
private final ITAppWcsTaskService wcsTaskService;
|
private final ITAppWcsTaskService wcsTaskService;
|
||||||
private final ITAppLocationService locationService;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -48,11 +50,6 @@ public class WcsControllerServiceImpl implements IWcsControllerService {
|
||||||
}
|
}
|
||||||
// 一号堆垛机,全部存空托盘
|
// 一号堆垛机,全部存空托盘
|
||||||
if(point.equals("105") || point.equals("106") || point.equals("107")) {
|
if(point.equals("105") || point.equals("106") || point.equals("107")) {
|
||||||
// 选一个库位
|
|
||||||
TAppLocation targetLocation = stackerTaskService.getEmptyLocation(1, point.equals("105") ? WmsLocationTypeEnums.TYPE_600 : WmsLocationTypeEnums.TYPE_500);
|
|
||||||
if(targetLocation == null) {
|
|
||||||
return WcsApiResponse.error("没有空闲库位,请稍后再试", null);
|
|
||||||
}
|
|
||||||
String goodsId567 = "";
|
String goodsId567 = "";
|
||||||
if (point.equals("105")) {
|
if (point.equals("105")) {
|
||||||
goodsId567 = "2";
|
goodsId567 = "2";
|
||||||
|
|
@ -61,134 +58,136 @@ public class WcsControllerServiceImpl implements IWcsControllerService {
|
||||||
} else {
|
} else {
|
||||||
goodsId567 = "4";
|
goodsId567 = "4";
|
||||||
}
|
}
|
||||||
String vehicleId = UUIDUtils.getNewUUID();
|
|
||||||
// 插入一条默认入库单
|
|
||||||
TAppOrderIn orderIn = new TAppOrderIn();
|
|
||||||
orderIn.setRecordId(UUIDUtils.getNewUUID());
|
|
||||||
orderIn.setOrderId(UUIDUtils.getNewUUID());
|
|
||||||
orderIn.setVehicleNo(vehicleId);
|
|
||||||
orderIn.setVehicleSize(point);
|
|
||||||
orderIn.setInStand(point);
|
|
||||||
orderIn.setDestination(targetLocation.getLocationId());
|
|
||||||
orderIn.setClientId("WCS");
|
|
||||||
orderIn.setGoodsId(goodsId567);
|
|
||||||
orderIn.setGoodsName("空托盘");
|
|
||||||
orderIn.setBatch("0");
|
|
||||||
orderIn.setGoodsType("0");
|
|
||||||
orderIn.setQuantity(4.0);
|
|
||||||
orderIn.setGoodsDesc("");
|
|
||||||
|
|
||||||
orderIn.setSpecification("empty");
|
List<TAppOrderIn> withOrderId = orderInService.list(
|
||||||
orderIn.setXsfbillno(goodsId567);
|
new LambdaQueryWrapper<TAppOrderIn>()
|
||||||
orderIn.setXsfseq(0);
|
.like(TAppOrderIn::getVehicleNo, "FC")
|
||||||
orderIn.setNeibubianhao("0");
|
.in(TAppOrderIn::getInStand, List.of("105", "106", "107"))
|
||||||
orderIn.setOrderStatus(OrderStatusEnum.RUNNING.getCode());
|
.eq(TAppOrderIn::getOrderStatus, OrderStatusEnum.CREATE.getCode())
|
||||||
orderIn.setCreateTime(LocalDateTime.now());
|
);
|
||||||
orderIn.setUpdateTime(LocalDateTime.now());
|
if(withOrderId == null) {
|
||||||
boolean saveOrderIn = orderInService.save(orderIn);
|
return WcsApiResponse.error("数据服务异常,请稍后重试", null);
|
||||||
if(!saveOrderIn) {
|
|
||||||
return WcsApiResponse.error("入库单保存失败,请稍后再试", null);
|
|
||||||
}
|
}
|
||||||
// 插入一条WcsTask
|
if(withOrderId.isEmpty()) {
|
||||||
String taskId = UUIDUtils.getNewUUID();
|
return WcsApiResponse.error("无入库订单", null);
|
||||||
TAppWcsTask wcsTask = new TAppWcsTask();
|
|
||||||
wcsTask.setWcsTaskId(taskId);
|
|
||||||
wcsTask.setWcsTaskStatus(WcsStackerTaskStatusEnums.RUN.getCode());
|
|
||||||
wcsTask.setWcsTaskType(WcsStackerTaskTypeEnums.IN.getCode());
|
|
||||||
wcsTask.setTaskPriority(0);
|
|
||||||
wcsTask.setVehicleId(vehicleId);
|
|
||||||
wcsTask.setOrigin(point);
|
|
||||||
wcsTask.setDestination(targetLocation.getLocationId());
|
|
||||||
wcsTask.setCreateTime(LocalDateTime.now());
|
|
||||||
wcsTask.setSendTime(LocalDateTime.now());
|
|
||||||
wcsTask.setRemark("WCS");
|
|
||||||
boolean saveWcsTask = wcsTaskService.save(wcsTask);
|
|
||||||
if(!saveWcsTask) {
|
|
||||||
return WcsApiResponse.error("任务创建失败,请稍后再试", null);
|
|
||||||
}
|
}
|
||||||
// 锁定库位
|
List<String> vehicleNos = withOrderId.stream().map(TAppOrderIn::getVehicleNo).toList();
|
||||||
boolean lockLocation = locationService.updateLocationOccupy(targetLocation.getLocationId(), 1);
|
for (String vehicleNo : vehicleNos) {
|
||||||
if(!lockLocation) {
|
// 选一个库位
|
||||||
return WcsApiResponse.error("库位锁定失败,请稍后再试", null);
|
TAppLocation targetLocation = stackerTaskService.getEmptyLocation(1, point.equals("105") ? WmsLocationTypeEnums.TYPE_600 : WmsLocationTypeEnums.TYPE_500);
|
||||||
|
if(targetLocation == null) {
|
||||||
|
return WcsApiResponse.error("没有空闲库位,请稍后再试", null);
|
||||||
|
}
|
||||||
|
orderInService.update(
|
||||||
|
new LambdaUpdateWrapper<TAppOrderIn>()
|
||||||
|
.eq(TAppOrderIn::getVehicleNo, vehicleNo)
|
||||||
|
.set(TAppOrderIn::getOrderStatus, OrderStatusEnum.RUNNING.getCode())
|
||||||
|
.set(TAppOrderIn::getDestination, targetLocation.getLocationId())
|
||||||
|
.set(TAppOrderIn::getGoodsId, goodsId567)
|
||||||
|
.set(TAppOrderIn::getBatch, "0")
|
||||||
|
.set(TAppOrderIn::getQuantity, 4.0)
|
||||||
|
|
||||||
|
.set(TAppOrderIn::getSpecification, "empty")
|
||||||
|
.set(TAppOrderIn::getXsfbillno, goodsId567)
|
||||||
|
.set(TAppOrderIn::getXsfseq, 0)
|
||||||
|
.set(TAppOrderIn::getNeibubianhao, "0")
|
||||||
|
.set(TAppOrderIn::getUpdateTime, LocalDateTime.now())
|
||||||
|
);
|
||||||
|
// 插入一条WcsTask
|
||||||
|
String taskId = UUIDUtils.getNewUUID();
|
||||||
|
TAppWcsTask wcsTask = new TAppWcsTask();
|
||||||
|
wcsTask.setWcsTaskId(taskId);
|
||||||
|
wcsTask.setWcsTaskStatus(WcsStackerTaskStatusEnums.RUN.getCode());
|
||||||
|
wcsTask.setWcsTaskType(WcsStackerTaskTypeEnums.IN.getCode());
|
||||||
|
wcsTask.setTaskPriority(0);
|
||||||
|
wcsTask.setVehicleId(vehicleNo);
|
||||||
|
wcsTask.setOrigin(point);
|
||||||
|
wcsTask.setDestination(targetLocation.getLocationId());
|
||||||
|
wcsTask.setCreateTime(LocalDateTime.now());
|
||||||
|
wcsTask.setSendTime(LocalDateTime.now());
|
||||||
|
wcsTask.setRemark("WCS");
|
||||||
|
boolean saveWcsTask = wcsTaskService.save(wcsTask);
|
||||||
|
if(!saveWcsTask) {
|
||||||
|
return WcsApiResponse.error("任务创建失败,请稍后再试", null);
|
||||||
|
}
|
||||||
|
|
||||||
|
InTaskResp inTaskResp = new InTaskResp();
|
||||||
|
inTaskResp.setTaskId(taskId);
|
||||||
|
inTaskResp.setUser("WMS");
|
||||||
|
inTaskResp.setVehicleNo(vehicleNo);
|
||||||
|
inTaskResp.setDestination(targetLocation.getLocationId());
|
||||||
|
inTaskResp.setSpare1("");
|
||||||
|
inTaskResp.setSpare2("");
|
||||||
|
return WcsApiResponse.success(inTaskResp);
|
||||||
}
|
}
|
||||||
InTaskResp inTaskResp = new InTaskResp();
|
|
||||||
inTaskResp.setTaskId(taskId);
|
|
||||||
inTaskResp.setUser("WMS");
|
|
||||||
inTaskResp.setVehicleNo(vehicleId);
|
|
||||||
inTaskResp.setDestination(targetLocation.getLocationId());
|
|
||||||
inTaskResp.setSpare1("");
|
|
||||||
inTaskResp.setSpare2("");
|
|
||||||
return WcsApiResponse.success(inTaskResp);
|
|
||||||
}
|
}
|
||||||
// 二号堆垛机,一部分存空一部分存有货位置
|
// 二号堆垛机,一部分存空一部分存有货位置
|
||||||
if(point.equals("103") || point.equals("104")) {
|
if(point.equals("103") || point.equals("104")) {
|
||||||
List<String> vehicleNos = List.of(request.getVehicleNo().split(";"));
|
List<String> vehicleNos = List.of(request.getVehicleNo().split(";"));
|
||||||
for (String vehicleNo : vehicleNos) {
|
for (String vehicleNo : vehicleNos) {
|
||||||
if(vehicleNo.equals("0")) { // 空托盘
|
if(vehicleNo.equals("0")) { // 空托盘
|
||||||
// 选一个库位
|
|
||||||
TAppLocation targetLocation = stackerTaskService.getEmptyLocation(2, WmsLocationTypeEnums.TYPE_EMPTY);
|
|
||||||
if(targetLocation == null) {
|
|
||||||
return WcsApiResponse.error("没有空闲库位,请稍后再试", null);
|
|
||||||
}
|
|
||||||
String goodsId34 = point.equals("103") ? "0" : "1";
|
String goodsId34 = point.equals("103") ? "0" : "1";
|
||||||
String vehicleId = UUIDUtils.getNewUUID();
|
|
||||||
// 插入一条默认入库单
|
|
||||||
TAppOrderIn orderIn = new TAppOrderIn();
|
|
||||||
orderIn.setRecordId(UUIDUtils.getNewUUID());
|
|
||||||
orderIn.setOrderId(UUIDUtils.getNewUUID());
|
|
||||||
orderIn.setVehicleNo(vehicleId);
|
|
||||||
orderIn.setVehicleSize(point);
|
|
||||||
orderIn.setInStand(point);
|
|
||||||
orderIn.setDestination(targetLocation.getLocationId());
|
|
||||||
orderIn.setClientId("WCS");
|
|
||||||
orderIn.setGoodsId(goodsId34);
|
|
||||||
orderIn.setGoodsName("空托盘");
|
|
||||||
orderIn.setBatch("0");
|
|
||||||
orderIn.setGoodsType("0");
|
|
||||||
orderIn.setQuantity(1.0);
|
|
||||||
orderIn.setGoodsDesc("");
|
|
||||||
|
|
||||||
orderIn.setSpecification("empty");
|
List<TAppOrderIn> withOrderId = orderInService.list(
|
||||||
orderIn.setXsfbillno(goodsId34);
|
new LambdaQueryWrapper<TAppOrderIn>()
|
||||||
orderIn.setXsfseq(0);
|
.like(TAppOrderIn::getVehicleNo, "FC")
|
||||||
orderIn.setNeibubianhao("0");
|
.in(TAppOrderIn::getInStand, List.of("103", "104"))
|
||||||
orderIn.setOrderStatus(OrderStatusEnum.RUNNING.getCode());
|
.eq(TAppOrderIn::getOrderStatus, OrderStatusEnum.CREATE.getCode())
|
||||||
orderIn.setCreateTime(LocalDateTime.now());
|
);
|
||||||
orderIn.setUpdateTime(LocalDateTime.now());
|
if(withOrderId == null) {
|
||||||
boolean saveOrderIn = orderInService.save(orderIn);
|
return WcsApiResponse.error("数据服务异常,请稍后重试", null);
|
||||||
if(!saveOrderIn) {
|
|
||||||
return WcsApiResponse.error("入库单保存失败,请稍后再试", null);
|
|
||||||
}
|
}
|
||||||
// 插入一条WcsTask
|
if(withOrderId.isEmpty()) {
|
||||||
String taskId = UUIDUtils.getNewUUID();
|
return WcsApiResponse.error("无入库订单", null);
|
||||||
TAppWcsTask wcsTask = new TAppWcsTask();
|
|
||||||
wcsTask.setWcsTaskId(taskId);
|
|
||||||
wcsTask.setWcsTaskStatus(WcsStackerTaskStatusEnums.RUN.getCode());
|
|
||||||
wcsTask.setWcsTaskType(WcsStackerTaskTypeEnums.IN.getCode());
|
|
||||||
wcsTask.setTaskPriority(0);
|
|
||||||
wcsTask.setVehicleId(vehicleId);
|
|
||||||
wcsTask.setOrigin(point);
|
|
||||||
wcsTask.setDestination(targetLocation.getLocationId());
|
|
||||||
wcsTask.setCreateTime(LocalDateTime.now());
|
|
||||||
wcsTask.setSendTime(LocalDateTime.now());
|
|
||||||
wcsTask.setRemark("WCS");
|
|
||||||
boolean saveWcsTask = wcsTaskService.save(wcsTask);
|
|
||||||
if(!saveWcsTask) {
|
|
||||||
return WcsApiResponse.error("任务创建失败,请稍后再试", null);
|
|
||||||
}
|
}
|
||||||
// 锁定库位
|
List<String> withVehicleNos = withOrderId.stream().map(TAppOrderIn::getVehicleNo).toList();
|
||||||
boolean lockLocation = locationService.updateLocationOccupy(targetLocation.getLocationId(), 1);
|
for (String withVehicleNo : withVehicleNos) {
|
||||||
if(!lockLocation) {
|
// 选一个库位
|
||||||
return WcsApiResponse.error("库位锁定失败,请稍后再试", null);
|
TAppLocation targetLocation = stackerTaskService.getEmptyLocation(2, WmsLocationTypeEnums.TYPE_EMPTY);
|
||||||
|
if(targetLocation == null) {
|
||||||
|
return WcsApiResponse.error("没有空闲库位,请稍后再试", null);
|
||||||
|
}
|
||||||
|
orderInService.update(
|
||||||
|
new LambdaUpdateWrapper<TAppOrderIn>()
|
||||||
|
.eq(TAppOrderIn::getVehicleNo, withVehicleNo)
|
||||||
|
.set(TAppOrderIn::getOrderStatus, OrderStatusEnum.RUNNING.getCode())
|
||||||
|
.set(TAppOrderIn::getDestination, targetLocation.getLocationId())
|
||||||
|
.set(TAppOrderIn::getGoodsId, goodsId34)
|
||||||
|
.set(TAppOrderIn::getBatch, "0")
|
||||||
|
.set(TAppOrderIn::getQuantity, 1.0)
|
||||||
|
|
||||||
|
.set(TAppOrderIn::getSpecification, "empty")
|
||||||
|
.set(TAppOrderIn::getXsfbillno, goodsId34)
|
||||||
|
.set(TAppOrderIn::getXsfseq, 0)
|
||||||
|
.set(TAppOrderIn::getNeibubianhao, "0")
|
||||||
|
.set(TAppOrderIn::getUpdateTime, LocalDateTime.now())
|
||||||
|
);
|
||||||
|
// 插入一条WcsTask
|
||||||
|
String taskId = UUIDUtils.getNewUUID();
|
||||||
|
TAppWcsTask wcsTask = new TAppWcsTask();
|
||||||
|
wcsTask.setWcsTaskId(taskId);
|
||||||
|
wcsTask.setWcsTaskStatus(WcsStackerTaskStatusEnums.RUN.getCode());
|
||||||
|
wcsTask.setWcsTaskType(WcsStackerTaskTypeEnums.IN.getCode());
|
||||||
|
wcsTask.setTaskPriority(0);
|
||||||
|
wcsTask.setVehicleId(withVehicleNo);
|
||||||
|
wcsTask.setOrigin(point);
|
||||||
|
wcsTask.setDestination(targetLocation.getLocationId());
|
||||||
|
wcsTask.setCreateTime(LocalDateTime.now());
|
||||||
|
wcsTask.setSendTime(LocalDateTime.now());
|
||||||
|
wcsTask.setRemark("WCS");
|
||||||
|
boolean saveWcsTask = wcsTaskService.save(wcsTask);
|
||||||
|
if(!saveWcsTask) {
|
||||||
|
return WcsApiResponse.error("任务创建失败,请稍后再试", null);
|
||||||
|
}
|
||||||
|
InTaskResp inTaskResp = new InTaskResp();
|
||||||
|
inTaskResp.setTaskId(taskId);
|
||||||
|
inTaskResp.setUser("WMS");
|
||||||
|
inTaskResp.setVehicleNo(withVehicleNo);
|
||||||
|
inTaskResp.setDestination(targetLocation.getLocationId());
|
||||||
|
inTaskResp.setSpare1("");
|
||||||
|
inTaskResp.setSpare2("");
|
||||||
|
return WcsApiResponse.success(inTaskResp);
|
||||||
}
|
}
|
||||||
InTaskResp inTaskResp = new InTaskResp();
|
|
||||||
inTaskResp.setTaskId(taskId);
|
|
||||||
inTaskResp.setUser("WMS");
|
|
||||||
inTaskResp.setVehicleNo(vehicleId);
|
|
||||||
inTaskResp.setDestination(targetLocation.getLocationId());
|
|
||||||
inTaskResp.setSpare1("");
|
|
||||||
inTaskResp.setSpare2("");
|
|
||||||
return WcsApiResponse.success(inTaskResp);
|
|
||||||
} else { // 带料
|
} else { // 带料
|
||||||
// 选一个库位
|
// 选一个库位
|
||||||
TAppLocation targetLocation = stackerTaskService.getEmptyLocation(2, WmsLocationTypeEnums.TYPE_PRODUCT);
|
TAppLocation targetLocation = stackerTaskService.getEmptyLocation(2, WmsLocationTypeEnums.TYPE_PRODUCT);
|
||||||
|
|
@ -228,11 +227,7 @@ public class WcsControllerServiceImpl implements IWcsControllerService {
|
||||||
if(!saveWcsTask) {
|
if(!saveWcsTask) {
|
||||||
return WcsApiResponse.error("任务创建失败,请稍后再试", null);
|
return WcsApiResponse.error("任务创建失败,请稍后再试", null);
|
||||||
}
|
}
|
||||||
// 锁定库位
|
|
||||||
boolean lockLocation = locationService.updateLocationOccupy(targetLocation.getLocationId(), 1);
|
|
||||||
if(!lockLocation) {
|
|
||||||
return WcsApiResponse.error("库位锁定失败,请稍后再试", null);
|
|
||||||
}
|
|
||||||
InTaskResp inTaskResp = new InTaskResp();
|
InTaskResp inTaskResp = new InTaskResp();
|
||||||
inTaskResp.setTaskId(taskId);
|
inTaskResp.setTaskId(taskId);
|
||||||
inTaskResp.setUser("WMS");
|
inTaskResp.setUser("WMS");
|
||||||
|
|
@ -286,11 +281,7 @@ public class WcsControllerServiceImpl implements IWcsControllerService {
|
||||||
if(!saveWcsTask) {
|
if(!saveWcsTask) {
|
||||||
return WcsApiResponse.error("任务创建失败,请稍后再试", null);
|
return WcsApiResponse.error("任务创建失败,请稍后再试", null);
|
||||||
}
|
}
|
||||||
// 锁定库位
|
|
||||||
boolean lockLocation = locationService.updateLocationOccupy(targetLocation.getLocationId(), 1);
|
|
||||||
if(!lockLocation) {
|
|
||||||
return WcsApiResponse.error("库位锁定失败,请稍后再试", null);
|
|
||||||
}
|
|
||||||
InTaskResp inTaskResp = new InTaskResp();
|
InTaskResp inTaskResp = new InTaskResp();
|
||||||
inTaskResp.setTaskId(taskId);
|
inTaskResp.setTaskId(taskId);
|
||||||
inTaskResp.setUser("WMS");
|
inTaskResp.setUser("WMS");
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
|
@ -95,6 +96,10 @@ public class YcwmsControllerServiceImpl implements IYcwmsControllerService {
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (request.getVehicleNo().contains("FC")) {
|
||||||
|
erpGoodsDetails = mesGoodsDetails.stream().map(ErpGoodsDetail::of).collect(Collectors.toList());
|
||||||
|
mesGoodsDetails.clear();
|
||||||
|
}
|
||||||
if (!mesGoodsDetails.isEmpty()) {
|
if (!mesGoodsDetails.isEmpty()) {
|
||||||
return YcwmsResponse.error("MES与ERP校验失败", null);
|
return YcwmsResponse.error("MES与ERP校验失败", null);
|
||||||
}
|
}
|
||||||
|
|
@ -174,12 +179,17 @@ public class YcwmsControllerServiceImpl implements IYcwmsControllerService {
|
||||||
if(request.empty()) {
|
if(request.empty()) {
|
||||||
stocks = appStockService.list();
|
stocks = appStockService.list();
|
||||||
} else {
|
} else {
|
||||||
TAppStock queryEntity = new TAppStock();
|
stocks = appStockService.list(
|
||||||
queryEntity.setGoodsId(request.getGoodsId());
|
new LambdaQueryWrapper<TAppStock>()
|
||||||
queryEntity.setLocationId(request.getLocation());
|
.eq(StringUtils.isNotEmpty(request.getGoodsId()), TAppStock::getGoodsId, request.getGoodsId())
|
||||||
queryEntity.setSled(request.getSpecification());
|
.eq(StringUtils.isNotEmpty(request.getLocation()), TAppStock::getLocationId, request.getLocation())
|
||||||
queryEntity.setVehicleId(request.getVehicleNo());
|
.eq(StringUtils.isNotEmpty(request.getSpecification()), TAppStock::getSled, request.getSpecification())
|
||||||
stocks = appStockService.getWithEntity(queryEntity);
|
.eq(StringUtils.isNotEmpty(request.getVehicleNo()), TAppStock::getVehicleId, request.getVehicleNo())
|
||||||
|
.eq(StringUtils.isNotEmpty(request.getXsfbillno()), TAppStock::getXsfbillno, request.getXsfbillno())
|
||||||
|
.eq(request.getXsfseq() != null, TAppStock::getXsfseq, request.getXsfseq())
|
||||||
|
.eq(StringUtils.isNotEmpty(request.getNeibubianhao()), TAppStock::getNeibubianhao, request.getNeibubianhao())
|
||||||
|
.eq(StringUtils.isNotEmpty(request.getGoodsBarCode()), TAppStock::getGoodsBarCode, request.getGoodsBarCode())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if(stocks == null) {
|
if(stocks == null) {
|
||||||
return YcwmsResponse.error("数据服务异常,请稍后重试", null);
|
return YcwmsResponse.error("数据服务异常,请稍后重试", null);
|
||||||
|
|
@ -221,6 +231,7 @@ public class YcwmsControllerServiceImpl implements IYcwmsControllerService {
|
||||||
return YcwmsResponse.success(respList);
|
return YcwmsResponse.success(respList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public YcwmsResponse<Object> getAvailPercent(String equipmentId) {
|
public YcwmsResponse<Object> getAvailPercent(String equipmentId) {
|
||||||
if (equipmentId == null || equipmentId.isEmpty()) {
|
if (equipmentId == null || equipmentId.isEmpty()) {
|
||||||
return YcwmsResponse.error("参数错误", null);
|
return YcwmsResponse.error("参数错误", null);
|
||||||
|
|
@ -229,7 +240,7 @@ public class YcwmsControllerServiceImpl implements IYcwmsControllerService {
|
||||||
Integer queryId = Integer.parseInt(equipmentId);
|
Integer queryId = Integer.parseInt(equipmentId);
|
||||||
Long locationNum500 = appLocationService.count(
|
Long locationNum500 = appLocationService.count(
|
||||||
new LambdaQueryWrapper<TAppLocation>()
|
new LambdaQueryWrapper<TAppLocation>()
|
||||||
.eq(TAppLocation::getEquipmentId, queryId)
|
.eq(TAppLocation::getEquipmentId, 4 - queryId)
|
||||||
.eq(TAppLocation::getLocationType, WmsLocationTypeEnums.TYPE_500.getCode())
|
.eq(TAppLocation::getLocationType, WmsLocationTypeEnums.TYPE_500.getCode())
|
||||||
.eq(TAppLocation::getIsOccupy, WmsLocationOccupyStatusEnums.OCCUPY.getCode())
|
.eq(TAppLocation::getIsOccupy, WmsLocationOccupyStatusEnums.OCCUPY.getCode())
|
||||||
);
|
);
|
||||||
|
|
@ -246,7 +257,7 @@ public class YcwmsControllerServiceImpl implements IYcwmsControllerService {
|
||||||
Integer queryId = Integer.parseInt(equipmentId);
|
Integer queryId = Integer.parseInt(equipmentId);
|
||||||
Long locationNum = appLocationService.count(
|
Long locationNum = appLocationService.count(
|
||||||
new LambdaQueryWrapper<TAppLocation>()
|
new LambdaQueryWrapper<TAppLocation>()
|
||||||
.eq(TAppLocation::getEquipmentId, queryId)
|
.eq(TAppLocation::getEquipmentId, 4 - queryId)
|
||||||
.eq(TAppLocation::getLocationType, WmsLocationTypeEnums.TYPE_PRODUCT.getCode())
|
.eq(TAppLocation::getLocationType, WmsLocationTypeEnums.TYPE_PRODUCT.getCode())
|
||||||
.eq(TAppLocation::getIsOccupy, WmsLocationOccupyStatusEnums.OCCUPY.getCode())
|
.eq(TAppLocation::getIsOccupy, WmsLocationOccupyStatusEnums.OCCUPY.getCode())
|
||||||
);
|
);
|
||||||
|
|
@ -256,7 +267,7 @@ public class YcwmsControllerServiceImpl implements IYcwmsControllerService {
|
||||||
Integer queryId = Integer.parseInt(equipmentId);
|
Integer queryId = Integer.parseInt(equipmentId);
|
||||||
Long locationNum = appLocationService.count(
|
Long locationNum = appLocationService.count(
|
||||||
new LambdaQueryWrapper<TAppLocation>()
|
new LambdaQueryWrapper<TAppLocation>()
|
||||||
.eq(TAppLocation::getEquipmentId, queryId)
|
.eq(TAppLocation::getEquipmentId, 4 - queryId)
|
||||||
.eq(TAppLocation::getLocationType, WmsLocationTypeEnums.TYPE_PRODUCT.getCode())
|
.eq(TAppLocation::getLocationType, WmsLocationTypeEnums.TYPE_PRODUCT.getCode())
|
||||||
.eq(TAppLocation::getIsOccupy, WmsLocationOccupyStatusEnums.OCCUPY.getCode())
|
.eq(TAppLocation::getIsOccupy, WmsLocationOccupyStatusEnums.OCCUPY.getCode())
|
||||||
);
|
);
|
||||||
|
|
@ -266,51 +277,63 @@ public class YcwmsControllerServiceImpl implements IYcwmsControllerService {
|
||||||
return YcwmsResponse.error("equipmentId无效", null);
|
return YcwmsResponse.error("equipmentId无效", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public YcwmsResponse<Object> localOrderOut(LocalOrderReq request) {
|
@Override
|
||||||
log.info("亚驰单机出库单请求参数{}", JSON.toJSON(request));
|
public YcwmsResponse<List<StockResp>> localQuery(LocalOrderReq request) {
|
||||||
|
log.info("亚驰库存请求参数{}", JSON.toJSON(request));
|
||||||
if(request == null) return YcwmsResponse.error("参数错误", null);
|
if(request == null) return YcwmsResponse.error("参数错误", null);
|
||||||
if (StringUtils.isEmpty(request.getNeibubianhao())
|
// stocks: 请求库存的当前库存
|
||||||
|| StringUtils.isEmpty(request.getXsfbillno())
|
List<TAppStock> stocks = null;
|
||||||
|| StringUtils.isEmpty(String.valueOf(request.getXsfseq()))
|
if(request.empty()) {
|
||||||
|| StringUtils.isEmpty(request.getSpecification())) {
|
stocks = appStockService.list();
|
||||||
return YcwmsResponse.error("参数错误", null);
|
|
||||||
}
|
|
||||||
List<TAppStock> stocks = appStockService.list(
|
|
||||||
new LambdaQueryWrapper<TAppStock>()
|
|
||||||
.eq(TAppStock::getNeibubianhao, request.getNeibubianhao())
|
|
||||||
.eq(TAppStock::getXsfbillno, request.getXsfbillno())
|
|
||||||
.eq(TAppStock::getXsfseq, request.getXsfseq())
|
|
||||||
.eq(TAppStock::getSled, request.getSpecification())
|
|
||||||
);
|
|
||||||
if (stocks == null || stocks.isEmpty()) {
|
|
||||||
return YcwmsResponse.error("库存不足, 出库失败", null);
|
|
||||||
}
|
|
||||||
TAppOrderOut orderOut = new TAppOrderOut();
|
|
||||||
orderOut.setRecordId(UUIDUtils.getNewUUID());
|
|
||||||
orderOut.setOrderId(UUIDUtils.getNewUUID("baokai"));
|
|
||||||
orderOut.setBatch(stocks.getFirst().getBatch());
|
|
||||||
orderOut.setSpecification(request.getSpecification());
|
|
||||||
orderOut.setOrderStatus(OrderStatusEnum.CREATE.getCode());
|
|
||||||
orderOut.setCreateTime(LocalDateTime.now());
|
|
||||||
orderOut.setUpdateTime(LocalDateTime.now());
|
|
||||||
orderOut.setRemark("Local");
|
|
||||||
|
|
||||||
String tmpGoodsId = stocks.getFirst().getGoodsId();
|
|
||||||
if (tmpGoodsId.length() < 3) {
|
|
||||||
orderOut.setGoodsId(tmpGoodsId);
|
|
||||||
int tmpGoodsNum = Integer.parseInt(tmpGoodsId);
|
|
||||||
orderOut.setQuantity((tmpGoodsNum <= 1) ? 1.0 : 4.0);
|
|
||||||
} else {
|
} else {
|
||||||
orderOut.setGoodsId(stocks.getFirst().getVehicleId());
|
stocks = appStockService.list(
|
||||||
orderOut.setQuantity(0.0);
|
new LambdaQueryWrapper<TAppStock>()
|
||||||
tmpGoodsId = stocks.getFirst().getVehicleId();
|
.eq(StringUtils.isNotEmpty(request.getXsfbillno()), TAppStock::getXsfbillno, request.getXsfbillno())
|
||||||
|
.eq(StringUtils.isNotEmpty(request.getNeibubianhao()), TAppStock::getNeibubianhao, request.getNeibubianhao())
|
||||||
|
.eq(StringUtils.isNotEmpty(request.getGoodsType()), TAppStock::getGoodsType, request.getGoodsType())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if(!appOrderOutService.save(orderOut)) {
|
if(stocks == null) {
|
||||||
return YcwmsResponse.error("出库单保存失败,请稍后再试", null);
|
return YcwmsResponse.error("数据服务异常,请稍后重试", null);
|
||||||
}
|
}
|
||||||
return YcwmsResponse.success(getLocByGoodsId(tmpGoodsId));
|
List<StockResp> respList = new ArrayList<>();
|
||||||
|
// locations: 当前库存的对应库位
|
||||||
|
List<String> locations = stocks.stream().map(TAppStock::getLocationId).distinct().toList();
|
||||||
|
// 检查每个库存的库位location
|
||||||
|
for (var location : locations) {
|
||||||
|
// 库存反馈
|
||||||
|
StockResp stockResp = new StockResp();
|
||||||
|
// 查询location库位上当前有多少库存locationStocks
|
||||||
|
List<TAppStock> locationStocks = stocks.stream().filter(stock -> stock.getLocationId().equals(location)).toList();
|
||||||
|
if(locationStocks.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
stockResp.setVehicleNo(locationStocks.getFirst().getVehicleId());
|
||||||
|
stockResp.setLocation(location);
|
||||||
|
List<StockRespGoodsDetail> goodsDetails = new ArrayList<>();
|
||||||
|
for (var stock : locationStocks) {
|
||||||
|
StockRespGoodsDetail goodsDetail = new StockRespGoodsDetail();
|
||||||
|
goodsDetail.setGoodsId(stock.getGoodsId());
|
||||||
|
goodsDetail.setGoodsName(stock.getGoodsDesc());
|
||||||
|
goodsDetail.setSpecification(stock.getSled());
|
||||||
|
goodsDetail.setQuantity(stock.getTotalNum());
|
||||||
|
goodsDetail.setGoodsDesc(stock.getGoodsDesc());
|
||||||
|
goodsDetail.setStoreTime(stock.getFirstInTime());
|
||||||
|
goodsDetail.setBatch(stock.getBatch());
|
||||||
|
goodsDetail.setGoodsType(stock.getGoodsType());
|
||||||
|
goodsDetail.setGoodsBarCode(stock.getGoodsBarCode());
|
||||||
|
goodsDetail.setXsfbillno(stock.getXsfbillno());
|
||||||
|
goodsDetail.setXsfseq(stock.getXsfseq());
|
||||||
|
goodsDetail.setNeibubianhao(stock.getNeibubianhao());
|
||||||
|
goodsDetails.add(goodsDetail);
|
||||||
|
}
|
||||||
|
stockResp.setGoodsDetail(goodsDetails);
|
||||||
|
respList.add(stockResp);
|
||||||
|
}
|
||||||
|
return YcwmsResponse.success(respList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getLocByGoodsId(String goodsId) {
|
public String getLocByGoodsId(String goodsId) {
|
||||||
if (goodsId.length() < 3) {
|
if (goodsId.length() < 3) {
|
||||||
return switch (goodsId) {
|
return switch (goodsId) {
|
||||||
|
|
@ -329,4 +352,43 @@ public class YcwmsControllerServiceImpl implements IYcwmsControllerService {
|
||||||
return ConvertUtils.convertDestinationToPoint(stocks.getFirst().getBarCode());
|
return ConvertUtils.convertDestinationToPoint(stocks.getFirst().getBarCode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public YcwmsResponse<Object> localOut(List<String> vehicleIds) {
|
||||||
|
if(vehicleIds == null || vehicleIds.isEmpty()) {
|
||||||
|
return YcwmsResponse.error("出库失败", null);
|
||||||
|
} else {
|
||||||
|
for (String vehicleId : vehicleIds.stream().distinct().toList()) {
|
||||||
|
List<TAppStock> stocks = appStockService.list(
|
||||||
|
new LambdaQueryWrapper<TAppStock>()
|
||||||
|
.eq(StringUtils.isNotEmpty(vehicleId), TAppStock::getVehicleId, vehicleId)
|
||||||
|
);
|
||||||
|
TAppOrderOut orderOut = new TAppOrderOut();
|
||||||
|
orderOut.setRecordId(UUIDUtils.getNewUUID());
|
||||||
|
orderOut.setOrderId(UUIDUtils.getNewUUID("baokai"));
|
||||||
|
orderOut.setBatch(stocks.getFirst().getBatch());
|
||||||
|
orderOut.setSpecification(stocks.getFirst().getSled());
|
||||||
|
orderOut.setOrderStatus(OrderStatusEnum.CREATE.getCode());
|
||||||
|
orderOut.setCreateTime(LocalDateTime.now());
|
||||||
|
orderOut.setUpdateTime(LocalDateTime.now());
|
||||||
|
orderOut.setRemark("Local");
|
||||||
|
|
||||||
|
String tmpGoodsId = stocks.getFirst().getGoodsId();
|
||||||
|
if (tmpGoodsId.length() < 3) {
|
||||||
|
orderOut.setGoodsId(tmpGoodsId);
|
||||||
|
int tmpGoodsNum = Integer.parseInt(tmpGoodsId);
|
||||||
|
orderOut.setQuantity((tmpGoodsNum <= 1) ? 1.0 : 4.0);
|
||||||
|
} else {
|
||||||
|
orderOut.setGoodsId(stocks.getFirst().getVehicleId());
|
||||||
|
orderOut.setQuantity(0.0);
|
||||||
|
tmpGoodsId = stocks.getFirst().getVehicleId();
|
||||||
|
}
|
||||||
|
if(!appOrderOutService.save(orderOut)) {
|
||||||
|
return YcwmsResponse.error("出库单保存失败,请稍后再试", null);
|
||||||
|
}
|
||||||
|
log.info("{} 出库成功", orderOut.getGoodsId());
|
||||||
|
}
|
||||||
|
return YcwmsResponse.success("出库成功", null);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -121,15 +121,6 @@ public class WcsStackerTaskSender implements Job {
|
||||||
// 若有库存
|
// 若有库存
|
||||||
if (preStocks != null && !preStocks.isEmpty()) {
|
if (preStocks != null && !preStocks.isEmpty()) {
|
||||||
TAppLocation preLocation = stackerTaskService.getEmptyLocation(equipmentId, null);
|
TAppLocation preLocation = stackerTaskService.getEmptyLocation(equipmentId, null);
|
||||||
// TAppWcsTask preTask = new TAppWcsTask();
|
|
||||||
// preTask.setWcsTaskId(UUIDUtils.getNewUUID());
|
|
||||||
// preTask.setWcsTaskType(WcsStackerTaskTypeEnums.IN.getCode());
|
|
||||||
// preTask.setWcsTaskStatus(WcsStackerTaskStatusEnums.WAIT.getCode());
|
|
||||||
// preTask.setOrigin(locationId);
|
|
||||||
// preTask.setDestination(preLocation.getLocationId());
|
|
||||||
// preTask.setVehicleId(preLocation.getVehicleId());
|
|
||||||
// preTask.setTaskPriority(2);
|
|
||||||
// preTask.setCreateTime(LocalDateTime.now());
|
|
||||||
|
|
||||||
WcsStackerTaskRequest request = new WcsStackerTaskRequest();
|
WcsStackerTaskRequest request = new WcsStackerTaskRequest();
|
||||||
request.setTaskId(UUIDUtils.getNewUUID());
|
request.setTaskId(UUIDUtils.getNewUUID());
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import request from "@/http/request";
|
||||||
|
|
||||||
const loginWithoutAuth = (params) => {
|
const loginWithoutAuth = (params) => {
|
||||||
return request({
|
return request({
|
||||||
url: '/login/loginWithoutAuth',
|
url: '/wms/login/loginWithoutAuth',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: params
|
data: params
|
||||||
})
|
})
|
||||||
|
|
@ -10,7 +10,7 @@ const loginWithoutAuth = (params) => {
|
||||||
|
|
||||||
const loginWithAuth = (params) => {
|
const loginWithAuth = (params) => {
|
||||||
return request({
|
return request({
|
||||||
url: '/login/loginWithAuth',
|
url: '/wms/login/loginWithAuth',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: params
|
data: params
|
||||||
})
|
})
|
||||||
|
|
@ -18,7 +18,7 @@ const loginWithAuth = (params) => {
|
||||||
|
|
||||||
const getUser = (params) => {
|
const getUser = (params) => {
|
||||||
return request({
|
return request({
|
||||||
url: '/user/getUser',
|
url: '/wms/user/getUser',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: params
|
data: params
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,7 @@
|
||||||
import request from "@/http/request";
|
import request from "@/http/request";
|
||||||
import axios from "axios";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 提交入库单
|
|
||||||
*/
|
|
||||||
|
|
||||||
const _request = axios.create({
|
|
||||||
// baseURL: 'http://localhost:12315',
|
|
||||||
baseURL: 'http://10.18.58.21:12315',
|
|
||||||
timeout: 5000
|
|
||||||
})
|
|
||||||
|
|
||||||
const submitOrderInForm = (params) => {
|
const submitOrderInForm = (params) => {
|
||||||
return _request({
|
return request({
|
||||||
url: '/ycwms/orderIn',
|
url: '/ycwms/orderIn',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: params
|
data: params
|
||||||
|
|
@ -24,7 +13,7 @@ const submitOrderInForm = (params) => {
|
||||||
*/
|
*/
|
||||||
const getOrderIns = (params) => {
|
const getOrderIns = (params) => {
|
||||||
return request({
|
return request({
|
||||||
url: '/order/getOrderIns',
|
url: '/wms/order/getOrderIns',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: params
|
data: params
|
||||||
})
|
})
|
||||||
|
|
@ -33,7 +22,7 @@ const getOrderIns = (params) => {
|
||||||
// 修改update方法
|
// 修改update方法
|
||||||
const updateOrderIn = (recordId, orderStatus) => {
|
const updateOrderIn = (recordId, orderStatus) => {
|
||||||
return request({
|
return request({
|
||||||
url: '/order/updateOrderIn',
|
url: '/wms/order/updateOrderIn',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
params: { // 使用params传递URL参数
|
params: { // 使用params传递URL参数
|
||||||
recordId,
|
recordId,
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,22 @@
|
||||||
import request from "@/http/request";
|
import request from "@/http/request";
|
||||||
import axios from "axios";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 提交入库单
|
|
||||||
*/
|
|
||||||
|
|
||||||
const _request = axios.create({
|
|
||||||
baseURL: 'http://localhost:12315',
|
|
||||||
// baseURL: 'http://10.18.58.21:12315',
|
|
||||||
timeout: 5000
|
|
||||||
})
|
|
||||||
|
|
||||||
const submitOrderOutForm = (params) => {
|
const submitOrderOutForm = (params) => {
|
||||||
return _request({
|
return request({
|
||||||
url: '/ycwms/localOut',
|
url: '/ycwms/localOut',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: params
|
data: params
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export {
|
const localQuery = (params) => {
|
||||||
submitOrderOutForm
|
return request({
|
||||||
|
url: '/ycwms/localQuery',
|
||||||
|
method: 'post',
|
||||||
|
data: params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
submitOrderOutForm,
|
||||||
|
localQuery
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import request from "@/http/request";
|
||||||
|
|
||||||
const queryStocksByPage = (params) => {
|
const queryStocksByPage = (params) => {
|
||||||
return request({
|
return request({
|
||||||
url: '/stock/queryStocksByPage',
|
url: '/wms/stock/queryStocksByPage',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: params
|
data: params
|
||||||
})
|
})
|
||||||
|
|
@ -10,7 +10,7 @@ const queryStocksByPage = (params) => {
|
||||||
|
|
||||||
const updateStockInfo = (params) => {
|
const updateStockInfo = (params) => {
|
||||||
return request({
|
return request({
|
||||||
url: '/stock/updateStockInfo',
|
url: '/wms/stock/updateStockInfo',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: params
|
data: params
|
||||||
})
|
})
|
||||||
|
|
@ -18,7 +18,7 @@ const updateStockInfo = (params) => {
|
||||||
|
|
||||||
const getStockNumByGoodsId = (params) => {
|
const getStockNumByGoodsId = (params) => {
|
||||||
return request({
|
return request({
|
||||||
url: '/stock/getStockNumByGoodsId',
|
url: '/wms/stock/getStockNumByGoodsId',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: params
|
data: params
|
||||||
})
|
})
|
||||||
|
|
@ -26,7 +26,7 @@ const getStockNumByGoodsId = (params) => {
|
||||||
|
|
||||||
const getStockUpdateRecord = (params) => {
|
const getStockUpdateRecord = (params) => {
|
||||||
return request({
|
return request({
|
||||||
url: '/stock/getStockUpdateRecord',
|
url: '/wms/stock/getStockUpdateRecord',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: params
|
data: params
|
||||||
})
|
})
|
||||||
|
|
@ -34,7 +34,7 @@ const getStockUpdateRecord = (params) => {
|
||||||
|
|
||||||
const handleExceptionStock = (params) => {
|
const handleExceptionStock = (params) => {
|
||||||
return request({
|
return request({
|
||||||
url: '/stock/handleExceptionStock',
|
url: '/wms/stock/handleExceptionStock',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: params
|
data: params
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
|
||||||
const request = axios.create({
|
const request = axios.create({
|
||||||
baseURL: 'http://10.18.58.21:12315/wms',
|
baseURL: 'http://10.18.58.21:12315',
|
||||||
// baseURL: 'http://localhost:12315/wms',
|
// baseURL: 'http://localhost:12315',
|
||||||
timeout: 5000
|
timeout: 5000
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,37 +3,67 @@
|
||||||
<el-container class="content">
|
<el-container class="content">
|
||||||
<div class="work-area">
|
<div class="work-area">
|
||||||
<fieldset class="main-area">
|
<fieldset class="main-area">
|
||||||
<legend>出库单信息</legend>
|
<legend>物料查询</legend>
|
||||||
<el-form ref="orderOutFormRef" :model="orderOutForm" :rules="rules" label-width="70px" :label-position="labelPosition" status-icon>
|
<el-form ref="queryFormRef" :model="queryForm" label-width="70px" :label-position="labelPosition">
|
||||||
<el-row :gutter="5" class="form-row">
|
<el-row :gutter="5" class="form-row">
|
||||||
<el-col :xs="24" :sm="4" :md="4" :lg="4">
|
<el-col :xs="24" :sm="4" :md="4" :lg="4">
|
||||||
<el-form-item label="内部编号" prop="neibubianhao">
|
<el-form-item label="内部编号">
|
||||||
<el-input v-model="orderOutForm.neibubianhao" clearable @keyup.enter="handleEnter('xsfbillno')" ref="neibubianhaoRef" class="custom-input" />
|
<el-input v-model="queryForm.neibubianhao" clearable class="custom-input" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :xs="24" :sm="4" :md="4" :lg="4">
|
<el-col :xs="24" :sm="4" :md="4" :lg="4">
|
||||||
<el-form-item label="销售单号" prop="xsfbillno">
|
<el-form-item label="规格">
|
||||||
<el-input v-model="orderOutForm.xsfbillno" clearable @keyup.enter="handleEnter('xsfseq')" ref="xsfbillnoRef" class="custom-input" />
|
<el-input v-model="queryForm.goodsType" clearable class="custom-input" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :xs="24" :sm="4" :md="4" :lg="4">
|
<el-col :xs="24" :sm="4" :md="4" :lg="4">
|
||||||
<el-form-item label="行号" prop="xsfseq">
|
<el-form-item label="销售单号">
|
||||||
<el-input-number v-model="orderOutForm.xsfseq" :min="0" controls-position="right" clearable @keyup.enter="handleEnter('specification')" ref="xsfseqRef" class="custom-input" />
|
<el-input v-model="queryForm.xsfbillno" clearable class="custom-input" />
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :xs="24" :sm="4" :md="4" :lg="4">
|
|
||||||
<el-form-item label="规格" prop="specification">
|
|
||||||
<el-input v-model="orderOutForm.specification" placeholder="请输入规格" clearable ref="specificationRef" class="custom-input" />
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :xs="24" :sm="4" :md="4" :lg="4" class="btn-col">
|
<el-col :xs="24" :sm="4" :md="4" :lg="4" class="btn-col">
|
||||||
<el-button type="success" @click="submitOrderOut">提交</el-button>
|
<el-button type="primary" @click="queryGoods">查询</el-button>
|
||||||
<el-button type="warning" @click="resetForm">重置</el-button>
|
<el-button type="info" @click="resetQueryForm">重置</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset v-if="tableData.length > 0" class="main-area">
|
||||||
|
<legend>查询结果</legend>
|
||||||
|
<div v-for="(locationItem, locationIndex) in tableData" :key="locationIndex" class="location-group">
|
||||||
|
<div class="location-header">
|
||||||
|
<h3>库位: {{ locationItem.location }} | 托盘号: {{ locationItem.vehicleNo }}</h3>
|
||||||
|
</div>
|
||||||
|
<el-table
|
||||||
|
:data="locationItem.goodsDetail"
|
||||||
|
border
|
||||||
|
stripe
|
||||||
|
style="width: 100%"
|
||||||
|
@selection-change="(selection) => handleSelectionChange(selection, locationItem.vehicleNo)"
|
||||||
|
:ref="`table_${locationIndex}`">
|
||||||
|
<el-table-column type="selection" width="55" />
|
||||||
|
<el-table-column prop="goodsId" label="物料编号" />
|
||||||
|
<el-table-column prop="goodsName" label="物料名称" />
|
||||||
|
<el-table-column prop="goodsType" label="规格" />
|
||||||
|
<el-table-column prop="specification" label="说明" />
|
||||||
|
<el-table-column prop="quantity" label="数量" />
|
||||||
|
<el-table-column prop="neibubianhao" label="内部编号" />
|
||||||
|
<el-table-column prop="xsfbillno" label="销售单号" />
|
||||||
|
<el-table-column prop="xsfseq" label="行号" />
|
||||||
|
<el-table-column prop="storeTime" label="入库时间">
|
||||||
|
<template #default="scope">
|
||||||
|
{{ scope.row.storeTime ? scope.row.storeTime.split('T')[0] + ' ' + scope.row.storeTime.split('T')[1] : '' }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
<div class="batch-action-bar">
|
||||||
|
<el-button type="danger" @click="batchOut" :disabled="getTotalSelectedCount() === 0">出库</el-button>
|
||||||
|
<span class="selection-info">已选择 {{ getTotalSelectedCount() }} 项</span>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
<el-dialog v-model="responseDialogVisible" title="请求结果" width="500px">
|
<el-dialog v-model="responseDialogVisible" title="请求结果" width="500px">
|
||||||
<pre>{{ responseResult }}</pre>
|
<pre>{{ responseResult }}</pre>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
|
|
@ -54,7 +84,7 @@ import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
||||||
import { loading } from '@/utils/loading.js'
|
import { loading } from '@/utils/loading.js'
|
||||||
import { errorBox } from '@/utils/myMessageBox.js'
|
import { errorBox } from '@/utils/myMessageBox.js'
|
||||||
import { labelPosition } from '@/constant/form'
|
import { labelPosition } from '@/constant/form'
|
||||||
import { submitOrderOutForm } from '@/api/orderOut.js'
|
import { submitOrderOutForm, localQuery } from '@/api/orderOut.js'
|
||||||
|
|
||||||
// 生成订单号方法
|
// 生成订单号方法
|
||||||
const generateOrderId = () => {
|
const generateOrderId = () => {
|
||||||
|
|
@ -75,24 +105,33 @@ const orderOutForm = reactive({
|
||||||
orderId: generateOrderId(),
|
orderId: generateOrderId(),
|
||||||
neibubianhao: '',
|
neibubianhao: '',
|
||||||
xsfbillno: '',
|
xsfbillno: '',
|
||||||
xsfseq: null,
|
goodsType: '',
|
||||||
specification: '',
|
|
||||||
clientId: "WMS"
|
clientId: "WMS"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 查询表单数据
|
||||||
|
const queryFormRef = ref()
|
||||||
|
const queryForm = reactive({
|
||||||
|
neibubianhao: '',
|
||||||
|
goodsType: '',
|
||||||
|
xsfbillno: ''
|
||||||
|
})
|
||||||
|
|
||||||
|
// 表格数据
|
||||||
|
const tableData = ref([])
|
||||||
|
const selectedItemsMap = ref(new Map()) // 用Map存储每个载具对应的选中物料
|
||||||
|
|
||||||
// 表单规则
|
// 表单规则
|
||||||
const rules = reactive({
|
const rules = reactive({
|
||||||
neibubianhao: [{ required: true, message: '请输入内部编号', trigger: 'blur' }],
|
neibubianhao: [{ required: true, message: '请输入内部编号', trigger: 'blur' }],
|
||||||
xsfbillno: [{ required: true, message: '请输入销售单号', trigger: 'blur' }],
|
xsfbillno: [{ required: true, message: '请输入销售单号', trigger: 'blur' }],
|
||||||
xsfseq: [{ required: true, message: '请输入行号', trigger: 'blur' }],
|
goodsType: [{ required: true, message: '请输入规格', trigger: 'blur' }]
|
||||||
specification: [{ required: true, message: '请输入规格', trigger: 'blur' }]
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// 引用DOM元素
|
// 引用DOM元素
|
||||||
const neibubianhaoRef = ref()
|
const neibubianhaoRef = ref()
|
||||||
const xsfbillnoRef = ref()
|
const xsfbillnoRef = ref()
|
||||||
const xsfseqRef = ref()
|
const goodsTypeRef = ref()
|
||||||
const specificationRef = ref()
|
|
||||||
|
|
||||||
// 响应结果对话框
|
// 响应结果对话框
|
||||||
const responseDialogVisible = ref(false)
|
const responseDialogVisible = ref(false)
|
||||||
|
|
@ -120,10 +159,9 @@ const handleEnter = (nextField) => {
|
||||||
const refMap = {
|
const refMap = {
|
||||||
'neibubianhao': neibubianhaoRef,
|
'neibubianhao': neibubianhaoRef,
|
||||||
'xsfbillno': xsfbillnoRef,
|
'xsfbillno': xsfbillnoRef,
|
||||||
'xsfseq': xsfseqRef,
|
'goodsType': goodsTypeRef
|
||||||
'specification': specificationRef
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (refMap[nextField]) {
|
if (refMap[nextField]) {
|
||||||
refMap[nextField].value.focus()
|
refMap[nextField].value.focus()
|
||||||
}
|
}
|
||||||
|
|
@ -139,35 +177,101 @@ const resetForm = () => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 提交出库单
|
// 重置查询表单
|
||||||
const submitOrderOut = () => {
|
const resetQueryForm = () => {
|
||||||
orderOutFormRef.value.validate((valid) => {
|
queryFormRef.value.resetFields()
|
||||||
if (valid) {
|
tableData.value = []
|
||||||
// 发送请求
|
selectedItemsMap.value.clear()
|
||||||
loading.open()
|
}
|
||||||
submitOrderOutForm(orderOutForm)
|
|
||||||
.then(res => {
|
// 查询物料
|
||||||
responseResult.value = res.data
|
const queryGoods = () => {
|
||||||
responseDialogVisible.value = true
|
loading.open()
|
||||||
|
localQuery(queryForm)
|
||||||
if (res.data.code === 0) {
|
.then(res => {
|
||||||
ElMessage.success('出库单提交成功')
|
if (res.data.code === 0) {
|
||||||
resetForm() // 提交成功后重置表单
|
tableData.value = res.data.returnData || []
|
||||||
} else {
|
selectedItemsMap.value.clear() // 清空之前的选择
|
||||||
errorBox(`出库单提交失败: ${res.data.message}`)
|
if (tableData.value.length === 0) {
|
||||||
}
|
ElMessage.info('未查询到相关物料信息')
|
||||||
})
|
}
|
||||||
.catch(err => {
|
} else {
|
||||||
console.error(err)
|
errorBox(`查询失败: ${res.data.message}`)
|
||||||
errorBox('提交出库单时发生错误')
|
}
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.catch(err => {
|
||||||
loading.close()
|
console.error(err)
|
||||||
})
|
errorBox('查询物料时发生错误')
|
||||||
} else {
|
})
|
||||||
errorBox('请填写完整的出库单信息')
|
.finally(() => {
|
||||||
}
|
loading.close()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理表格选择变化
|
||||||
|
const handleSelectionChange = (selection, vehicleNo) => {
|
||||||
|
// 为每个载具单独存储选中的物料
|
||||||
|
if (selection.length > 0) {
|
||||||
|
selectedItemsMap.value.set(vehicleNo, selection)
|
||||||
|
} else {
|
||||||
|
selectedItemsMap.value.delete(vehicleNo)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取总选择项数
|
||||||
|
const getTotalSelectedCount = () => {
|
||||||
|
let count = 0
|
||||||
|
selectedItemsMap.value.forEach(items => {
|
||||||
|
count += items.length
|
||||||
})
|
})
|
||||||
|
return count
|
||||||
|
}
|
||||||
|
|
||||||
|
// 批量出库
|
||||||
|
const batchOut = () => {
|
||||||
|
if (getTotalSelectedCount() === 0) {
|
||||||
|
ElMessage.warning('请至少选择一项物料')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据选中的物料生成载具号列表
|
||||||
|
const selectedVehicleNos = []
|
||||||
|
|
||||||
|
selectedItemsMap.value.forEach((selectedItems, vehicleNo) => {
|
||||||
|
// 为每个选中的物料项添加一个载具号
|
||||||
|
selectedItems.forEach(item => {
|
||||||
|
selectedVehicleNos.push(vehicleNo)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
console.log('选中的载具号列表:', selectedVehicleNos)
|
||||||
|
|
||||||
|
if (selectedVehicleNos.length === 0) {
|
||||||
|
ElMessage.warning('无法获取选中物料的载具号')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
loading.open()
|
||||||
|
submitOrderOutForm(selectedVehicleNos)
|
||||||
|
.then(res => {
|
||||||
|
responseResult.value = res.data
|
||||||
|
responseDialogVisible.value = true
|
||||||
|
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
ElMessage.success(`出库成功,共处理 ${selectedVehicleNos.length} 项物料`)
|
||||||
|
// 刷新查询结果
|
||||||
|
queryGoods()
|
||||||
|
} else {
|
||||||
|
errorBox(`出库失败: ${res.data.message}`)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.error(err)
|
||||||
|
errorBox('出库时发生错误')
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
loading.close()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -243,4 +347,33 @@ pre {
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.location-group {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.location-header {
|
||||||
|
background-color: #f5f7fa;
|
||||||
|
padding: 8px 15px;
|
||||||
|
border-radius: 4px 4px 0 0;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.location-header h3 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #606266;
|
||||||
|
}
|
||||||
|
|
||||||
|
.batch-action-bar {
|
||||||
|
margin-top: 15px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.selection-info {
|
||||||
|
margin-left: 15px;
|
||||||
|
color: #606266;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
Loading…
Reference in New Issue
Block a user