|
@@ -78,6 +78,7 @@ public class WcsToWmsApiService {
|
|
|
@Autowired
|
|
|
private AgvCallProxyService agvCallProxyService;
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 组盘上报
|
|
|
*
|
|
@@ -85,7 +86,7 @@ public class WcsToWmsApiService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Transactional
|
|
|
- public synchronized AjaxResult stackingCompletion(StackingCompletionForm stackingCompletion) {
|
|
|
+ public AjaxResult stackingCompletion(StackingCompletionForm stackingCompletion) {
|
|
|
// 上报类型
|
|
|
int reportType = stackingCompletion.getReportType();
|
|
|
// 托盘号
|
|
@@ -101,85 +102,30 @@ public class WcsToWmsApiService {
|
|
|
// 任务号
|
|
|
String wcsNo = stackingCompletion.getWcsNo();
|
|
|
|
|
|
-
|
|
|
- if (asnNo.equals("")) {
|
|
|
+ if (StringUtils.isBlank(asnNo)) {
|
|
|
AjaxResult ajaxResult1 = generateAShippingOrder(sku, new BigDecimal(qty));
|
|
|
- // 判重
|
|
|
- WcsTask wcsTaskQuery = new WcsTask();
|
|
|
- //AsnNO
|
|
|
- wcsTaskQuery.setExt1(ajaxResult1.getData().toString());
|
|
|
- wcsTaskQuery.setExt2(palletNo);
|
|
|
- wcsTaskQuery.setExt3(wcsNo);
|
|
|
- WcsTask wcsTask = iWcsTaskService.selectWcsTaskByModel(wcsTaskQuery);
|
|
|
- if (wcsTask != null) {
|
|
|
- String locationTo = wcsTask.getLocationTo();
|
|
|
- BaseLocationInfo baseLocationInfo = iBaseLocationInfoService.selectBaseLocationInfoByIdOrNo(locationTo, Constant.WAREHOUSE_ID);
|
|
|
- LocationCoordinateVo locationCoordinateVo = new LocationCoordinateVo();
|
|
|
- locationCoordinateVo.setTaskNo(wcsTask.getTaskNo());
|
|
|
- locationCoordinateVo.setLocationId(baseLocationInfo.getLocationNo());
|
|
|
- locationCoordinateVo.setFloor(Integer.valueOf(baseLocationInfo.getShiftNo()));
|
|
|
- locationCoordinateVo.setCol(Integer.valueOf(baseLocationInfo.getRowNo()));
|
|
|
- locationCoordinateVo.setRow(Integer.valueOf(baseLocationInfo.getRowIndex()));
|
|
|
- return AjaxResult.success("仓位获取成功!", locationCoordinateVo);
|
|
|
- }
|
|
|
-
|
|
|
- // 推荐目标库位
|
|
|
- BaseLocationLotattVO baseLocationLotattVO = baseLocationInfoSubService.recommendAReceiptLocation(sku);
|
|
|
- if (baseLocationLotattVO == null) {
|
|
|
- AjaxResult.error("没有可以推荐的目标库位!");
|
|
|
- }
|
|
|
-
|
|
|
- //TODO recommendAReceiptLocation,获取库位时,判断同列库存是否是相同入库日期的,不同相同日期不可放
|
|
|
-
|
|
|
- // 生成任务
|
|
|
- String taskNo = "";
|
|
|
- AjaxResult ajaxResult = wcsTaskSubService.addWcsTask(Constant.LOC_STAGE_CACHE.toString()
|
|
|
- , baseLocationLotattVO.getId().toString()
|
|
|
- , ajaxResult1.getData().toString()
|
|
|
- , palletNo
|
|
|
- , wcsNo);
|
|
|
- if (!ajaxResult.isSuccess()) {
|
|
|
- return ajaxResult;
|
|
|
- }
|
|
|
- taskNo = ajaxResult.get("data").toString();
|
|
|
- // 入库缓存位生成库存
|
|
|
- InvLotLocIdSubService.initInv(Constant.LOC_STAGE_CACHE.toString(), sku, palletNo, ajaxResult1.getData().toString(), taskNo, qty);
|
|
|
- // 反馈
|
|
|
- LocationCoordinateVo locationCoordinateVo = new LocationCoordinateVo();
|
|
|
- locationCoordinateVo.setTaskNo(taskNo);
|
|
|
- locationCoordinateVo.setLocationId(baseLocationLotattVO.getLocationNo());
|
|
|
- locationCoordinateVo.setFloor(Integer.valueOf(baseLocationLotattVO.getShiftNo()));
|
|
|
- locationCoordinateVo.setCol(Integer.valueOf(baseLocationLotattVO.getRowNo()));
|
|
|
- locationCoordinateVo.setRow(Integer.valueOf(baseLocationLotattVO.getRowIndex()));
|
|
|
- return AjaxResult.success("仓位获取成功!", locationCoordinateVo);
|
|
|
+ asnNo = ajaxResult1.getData().toString();
|
|
|
}
|
|
|
+ return insertTaskAndInvLotLocId(asnNo, palletNo, wcsNo, sku, qty);
|
|
|
+ }
|
|
|
|
|
|
- // 判重
|
|
|
+ private AjaxResult insertTaskAndInvLotLocId(String asnNo, String palletNo, String wcsNo, String sku, Double qty){
|
|
|
WcsTask wcsTaskQuery = new WcsTask();
|
|
|
wcsTaskQuery.setExt1(asnNo);
|
|
|
wcsTaskQuery.setExt2(palletNo);
|
|
|
wcsTaskQuery.setExt3(wcsNo);
|
|
|
+ wcsTaskQuery.setState(Long.parseLong(Constant.TASK_STS.TASK10.getValue().toString()));
|
|
|
WcsTask wcsTask = iWcsTaskService.selectWcsTaskByModel(wcsTaskQuery);
|
|
|
if (wcsTask != null) {
|
|
|
- String locationTo = wcsTask.getLocationTo();
|
|
|
- BaseLocationInfo baseLocationInfo = iBaseLocationInfoService.selectBaseLocationInfoByIdOrNo(locationTo, Constant.WAREHOUSE_ID);
|
|
|
- LocationCoordinateVo locationCoordinateVo = new LocationCoordinateVo();
|
|
|
- locationCoordinateVo.setTaskNo(wcsTask.getTaskNo());
|
|
|
- locationCoordinateVo.setLocationId(baseLocationInfo.getLocationNo());
|
|
|
- locationCoordinateVo.setFloor(Integer.valueOf(baseLocationInfo.getShiftNo()));
|
|
|
- locationCoordinateVo.setCol(Integer.valueOf(baseLocationInfo.getRowNo()));
|
|
|
- locationCoordinateVo.setRow(Integer.valueOf(baseLocationInfo.getRowIndex()));
|
|
|
- return AjaxResult.success("仓位获取成功!", locationCoordinateVo);
|
|
|
+ BaseLocationInfo baseLocationInfo = iBaseLocationInfoService.selectBaseLocationInfoByIdOrNo(wcsTask.getLocationTo(), Constant.WAREHOUSE_ID);
|
|
|
+ return AjaxResult.success("仓位获取成功!", buildLocationCoordinateVo(wcsTask.getTaskNo(), baseLocationInfo.getLocationNo(), baseLocationInfo.getShiftNo(), baseLocationInfo.getRowNo(), baseLocationInfo.getRowIndex()));
|
|
|
}
|
|
|
-
|
|
|
// 推荐目标库位
|
|
|
BaseLocationLotattVO baseLocationLotattVO = baseLocationInfoSubService.recommendAReceiptLocation(sku);
|
|
|
if (baseLocationLotattVO == null) {
|
|
|
- AjaxResult.error("没有可以推荐的目标库位!");
|
|
|
+ return AjaxResult.error("没有可以推荐的目标库位!");
|
|
|
}
|
|
|
-
|
|
|
// 生成任务
|
|
|
- String taskNo = "";
|
|
|
AjaxResult ajaxResult = wcsTaskSubService.addWcsTask(Constant.LOC_STAGE_CACHE.toString()
|
|
|
, baseLocationLotattVO.getId().toString()
|
|
|
, asnNo
|
|
@@ -188,17 +134,21 @@ public class WcsToWmsApiService {
|
|
|
if (!ajaxResult.isSuccess()) {
|
|
|
return ajaxResult;
|
|
|
}
|
|
|
- taskNo = ajaxResult.get("data").toString();
|
|
|
+ String taskNo = ajaxResult.get("data").toString();
|
|
|
// 入库缓存位生成库存
|
|
|
InvLotLocIdSubService.initInv(Constant.LOC_STAGE_CACHE.toString(), sku, palletNo, asnNo, taskNo, qty);
|
|
|
// 反馈
|
|
|
+ return AjaxResult.success("仓位获取成功!", buildLocationCoordinateVo(taskNo, baseLocationLotattVO.getLocationNo(), baseLocationLotattVO.getShiftNo(), baseLocationLotattVO.getRowNo(), baseLocationLotattVO.getRowIndex()));
|
|
|
+ }
|
|
|
+
|
|
|
+ private LocationCoordinateVo buildLocationCoordinateVo(String taskNo, String locationId, String floor, String col, String row){
|
|
|
LocationCoordinateVo locationCoordinateVo = new LocationCoordinateVo();
|
|
|
locationCoordinateVo.setTaskNo(taskNo);
|
|
|
- locationCoordinateVo.setLocationId(baseLocationLotattVO.getLocationNo());
|
|
|
- locationCoordinateVo.setFloor(Integer.valueOf(baseLocationLotattVO.getShiftNo()));
|
|
|
- locationCoordinateVo.setCol(Integer.valueOf(baseLocationLotattVO.getRowNo()));
|
|
|
- locationCoordinateVo.setRow(Integer.valueOf(baseLocationLotattVO.getRowIndex()));
|
|
|
- return AjaxResult.success("仓位获取成功!", locationCoordinateVo);
|
|
|
+ locationCoordinateVo.setLocationId(locationId);
|
|
|
+ locationCoordinateVo.setFloor(Integer.valueOf(floor));
|
|
|
+ locationCoordinateVo.setCol(Integer.valueOf(col));
|
|
|
+ locationCoordinateVo.setRow(Integer.valueOf(row));
|
|
|
+ return locationCoordinateVo;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -208,7 +158,7 @@ public class WcsToWmsApiService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Transactional
|
|
|
- public synchronized AjaxResult EmptyPalletLoc(EmptyPalletLocForm emptyPalletLocForm) {
|
|
|
+ public AjaxResult EmptyPalletLoc(EmptyPalletLocForm emptyPalletLocForm) {
|
|
|
// 空托仓位请求类型
|
|
|
int taskType = emptyPalletLocForm.getTaskType();
|
|
|
// 任务号
|
|
@@ -219,82 +169,23 @@ public class WcsToWmsApiService {
|
|
|
}
|
|
|
|
|
|
if (taskType == 1) {
|
|
|
- // 判重
|
|
|
- WcsTask wcsTaskQuery = new WcsTask();
|
|
|
- wcsTaskQuery.setExt1("");
|
|
|
- wcsTaskQuery.setExt2("");
|
|
|
- wcsTaskQuery.setExt3(wcsNo);
|
|
|
- WcsTask wcsTask = iWcsTaskService.selectWcsTaskByModel(wcsTaskQuery);
|
|
|
- if (wcsTask != null) {
|
|
|
- String locationTo = wcsTask.getLocationTo();
|
|
|
- BaseLocationInfo baseLocationInfo = iBaseLocationInfoService.selectBaseLocationInfoByIdOrNo(locationTo, Constant.WAREHOUSE_ID);
|
|
|
- LocationCoordinateVo locationCoordinateVo = new LocationCoordinateVo();
|
|
|
- locationCoordinateVo.setTaskNo(wcsTask.getTaskNo());
|
|
|
- locationCoordinateVo.setLocationId(baseLocationInfo.getLocationNo());
|
|
|
- locationCoordinateVo.setFloor(Integer.valueOf(baseLocationInfo.getShiftNo()));
|
|
|
- locationCoordinateVo.setCol(Integer.valueOf(baseLocationInfo.getRowNo()));
|
|
|
- locationCoordinateVo.setRow(Integer.valueOf(baseLocationInfo.getRowIndex()));
|
|
|
- return AjaxResult.success("仓位获取成功!", locationCoordinateVo);
|
|
|
- }
|
|
|
- BaseLocationLotattVO baseLocationLotattVO = new BaseLocationLotattVO();
|
|
|
-
|
|
|
- // 推荐目标库位
|
|
|
- baseLocationLotattVO = baseLocationInfoSubService.recommendAReceiptLocation(Constant.PALLET_TYPE);
|
|
|
- if (baseLocationLotattVO == null) {
|
|
|
- AjaxResult.error("没有可以推荐的目标库位!");
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- // 生成任务
|
|
|
- String taskNo = "";
|
|
|
- AjaxResult ajaxResult = wcsTaskSubService.addWcsTask(Constant.LOC_STAGE_CACHE.toString()
|
|
|
- , baseLocationLotattVO.getId().toString()
|
|
|
- , ""
|
|
|
- , ""
|
|
|
- , wcsNo);
|
|
|
- if (!ajaxResult.isSuccess()) {
|
|
|
- return ajaxResult;
|
|
|
- }
|
|
|
- taskNo = ajaxResult.get("data").toString();
|
|
|
- // 入库缓存位生成库存
|
|
|
- InvLotLocIdSubService.initInv(Constant.LOC_STAGE_CACHE.toString(), Constant.PALLET_TYPE, "", "", taskNo, 1.0);
|
|
|
- // 反馈
|
|
|
- LocationCoordinateVo locationCoordinateVo = new LocationCoordinateVo();
|
|
|
- locationCoordinateVo.setTaskNo(taskNo);
|
|
|
- locationCoordinateVo.setLocationId(baseLocationLotattVO.getLocationNo());
|
|
|
- locationCoordinateVo.setFloor(Integer.valueOf(baseLocationLotattVO.getShiftNo()));
|
|
|
- locationCoordinateVo.setCol(Integer.valueOf(baseLocationLotattVO.getRowNo()));
|
|
|
- locationCoordinateVo.setRow(Integer.valueOf(baseLocationLotattVO.getRowIndex()));
|
|
|
- return AjaxResult.success("仓位获取成功!", locationCoordinateVo);
|
|
|
+ return insertTaskAndInvLotLocId(StringUtils.EMPTY, StringUtils.EMPTY, wcsNo, Constant.PALLET_TYPE, 1.0);
|
|
|
+ }
|
|
|
+ //出库仓位
|
|
|
+ List<BaseLocationLotattVO> baseLocationLotattVOS = baseLocationInfoSubService.selectAllocatingInventoryAccordingConditionsOrderBy(OUT_ZONES, new LotattDTO(), Constant.PALLET_TYPE, StringUtils.EMPTY);
|
|
|
+ if (baseLocationLotattVOS.size() == 0) {
|
|
|
+ return AjaxResult.error("仓库中无库存");
|
|
|
}
|
|
|
+ BaseLocationLotattVO baseLocationLotattVO = filterInv1(baseLocationLotattVOS);
|
|
|
+ Assert.isTrue(ObjectUtil.isNotNull(baseLocationLotattVO), "仓库中无库存");
|
|
|
|
|
|
- if (taskType == 2) {
|
|
|
- String sku = Constant.PALLET_TYPE;
|
|
|
- LotattDTO lotattDTO = new LotattDTO();
|
|
|
- String orderBy = "";
|
|
|
- List<String> outZones = OUT_ZONES;
|
|
|
- List<BaseLocationLotattVO> baseLocationLotattVOS = baseLocationInfoSubService.selectAllocatingInventoryAccordingConditionsOrderBy(outZones, lotattDTO, sku, orderBy);
|
|
|
- if (baseLocationLotattVOS.size() == 0) {
|
|
|
- return AjaxResult.error("仓库中无库存");
|
|
|
- }
|
|
|
- BaseLocationLotattVO baseLocationLotattVO = filterInv1(baseLocationLotattVOS);
|
|
|
- Assert.isTrue(ObjectUtil.isNotNull(baseLocationLotattVO), "仓库中无库存");
|
|
|
-
|
|
|
- String pallentNo = ObjectUtil.isNotNull(baseLocationLotattVO.getLotattVO())
|
|
|
- ? baseLocationLotattVO.getLotattVO().getLotatt07() : StringUtils.EMPTY;
|
|
|
- String locationFrom = baseLocationLotattVO.getLocationNo();
|
|
|
-
|
|
|
- // 生成四向车出库任务
|
|
|
- AjaxResult ajaxResult = wcsTaskSubService.addWcsOutTask(locationFrom, Constant.LOC_SORTATION_CACHE.toString(), "", pallentNo, wcsNo);
|
|
|
- LocationCoordinateVo locationCoordinateVo1 = new LocationCoordinateVo();
|
|
|
- locationCoordinateVo1.setTaskNo(ajaxResult.get("data").toString());
|
|
|
- locationCoordinateVo1.setLocationId(baseLocationLotattVO.getLocationNo());
|
|
|
- locationCoordinateVo1.setFloor(Integer.valueOf(baseLocationLotattVO.getShiftNo()));
|
|
|
- locationCoordinateVo1.setCol(Integer.valueOf(baseLocationLotattVO.getRowNo()));
|
|
|
- locationCoordinateVo1.setRow(Integer.valueOf(baseLocationLotattVO.getRowIndex()));
|
|
|
- return AjaxResult.success("仓位获取成功", locationCoordinateVo1);
|
|
|
- }
|
|
|
- return AjaxResult.success();
|
|
|
+ String pallentNo = ObjectUtil.isNotNull(baseLocationLotattVO.getLotattVO())
|
|
|
+ ? baseLocationLotattVO.getLotattVO().getLotatt07() : StringUtils.EMPTY;
|
|
|
+ String locationFrom = baseLocationLotattVO.getLocationNo();
|
|
|
+
|
|
|
+ // 生成四向车出库任务
|
|
|
+ AjaxResult ajaxResult = wcsTaskSubService.addWcsOutTask(locationFrom, Constant.LOC_SORTATION_CACHE.toString(), "", pallentNo, wcsNo);
|
|
|
+ return AjaxResult.success("仓位获取成功", buildLocationCoordinateVo(ajaxResult.get("data").toString(), baseLocationLotattVO.getLocationNo(), baseLocationLotattVO.getShiftNo(), baseLocationLotattVO.getRowNo(), baseLocationLotattVO.getRowIndex()));
|
|
|
}
|
|
|
|
|
|
|
|
@@ -562,59 +453,10 @@ public class WcsToWmsApiService {
|
|
|
*/
|
|
|
@Transactional
|
|
|
public synchronized AjaxResult theBucketIsLoadedIntoTheLibrary(String sku, String asnNo, String palletNo, BigDecimal num) {
|
|
|
-
|
|
|
-
|
|
|
// 数量
|
|
|
Double qty = num.doubleValue();
|
|
|
|
|
|
- // 任务号
|
|
|
- String wcsNo = "";
|
|
|
-
|
|
|
- // 判重
|
|
|
- WcsTask wcsTaskQuery = new WcsTask();
|
|
|
- wcsTaskQuery.setExt1(asnNo);
|
|
|
- wcsTaskQuery.setExt2(palletNo);
|
|
|
- wcsTaskQuery.setExt3(wcsNo);
|
|
|
- WcsTask wcsTask = iWcsTaskService.selectWcsTaskByModel(wcsTaskQuery);
|
|
|
- if (wcsTask != null) {
|
|
|
- String locationTo = wcsTask.getLocationTo();
|
|
|
- BaseLocationInfo baseLocationInfo = iBaseLocationInfoService.selectBaseLocationInfoByIdOrNo(locationTo, Constant.WAREHOUSE_ID);
|
|
|
- LocationCoordinateVo locationCoordinateVo = new LocationCoordinateVo();
|
|
|
- locationCoordinateVo.setTaskNo(wcsTask.getTaskNo());
|
|
|
- locationCoordinateVo.setLocationId(baseLocationInfo.getLocationNo());
|
|
|
- locationCoordinateVo.setFloor(Integer.valueOf(baseLocationInfo.getShiftNo()));
|
|
|
- locationCoordinateVo.setCol(Integer.valueOf(baseLocationInfo.getRowNo()));
|
|
|
- locationCoordinateVo.setRow(Integer.valueOf(baseLocationInfo.getRowIndex()));
|
|
|
- return AjaxResult.success("仓位获取成功!", locationCoordinateVo);
|
|
|
- }
|
|
|
-
|
|
|
- // 推荐目标库位
|
|
|
- BaseLocationLotattVO baseLocationLotattVO = baseLocationInfoSubService.recommendAReceiptLocation(sku);
|
|
|
- if (baseLocationLotattVO == null) {
|
|
|
- AjaxResult.error("没有可以推荐的目标库位!");
|
|
|
- }
|
|
|
-
|
|
|
- // 生成任务
|
|
|
- String taskNo = "";
|
|
|
- AjaxResult ajaxResult = wcsTaskSubService.addWcsTask(Constant.LOC_STAGE_CACHE.toString()
|
|
|
- , baseLocationLotattVO.getId().toString()
|
|
|
- , asnNo
|
|
|
- , palletNo
|
|
|
- , wcsNo);
|
|
|
- if (!ajaxResult.isSuccess()) {
|
|
|
- return ajaxResult;
|
|
|
- }
|
|
|
- taskNo = ajaxResult.get("data").toString();
|
|
|
- // 入库缓存位生成库存
|
|
|
- InvLotLocIdSubService.initInv(Constant.LOC_STAGE_CACHE.toString(), sku, palletNo, asnNo, taskNo, qty);
|
|
|
- // 反馈
|
|
|
- LocationCoordinateVo locationCoordinateVo = new LocationCoordinateVo();
|
|
|
- locationCoordinateVo.setTaskNo(taskNo);
|
|
|
- locationCoordinateVo.setLocationId(baseLocationLotattVO.getLocationNo());
|
|
|
- locationCoordinateVo.setFloor(Integer.valueOf(baseLocationLotattVO.getShiftNo()));
|
|
|
- locationCoordinateVo.setCol(Integer.valueOf(baseLocationLotattVO.getRowNo()));
|
|
|
- locationCoordinateVo.setRow(Integer.valueOf(baseLocationLotattVO.getRowIndex()));
|
|
|
- return AjaxResult.success("仓位获取成功!", locationCoordinateVo);
|
|
|
+ return insertTaskAndInvLotLocId(asnNo, palletNo, StringUtils.EMPTY, sku, qty);
|
|
|
}
|
|
|
|
|
|
/**
|