Commit ad15d697 zshaohui

UID出库 先通知WMS 再生成出库任务

1 个父辈 7d9cd8a4
package com.neotel.smfcore.core.storage.rest; package com.neotel.smfcore.core.storage.rest;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.neotel.smfcore.common.base.IExcelDownLoad; import com.neotel.smfcore.common.base.IExcelDownLoad;
import com.neotel.smfcore.common.bean.PageData; import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.bean.ResultBean; import com.neotel.smfcore.common.bean.ResultBean;
...@@ -35,7 +35,7 @@ import com.neotel.smfcore.core.system.service.po.DataLog; ...@@ -35,7 +35,7 @@ import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.core.system.util.TaskService; import com.neotel.smfcore.core.system.util.TaskService;
import com.neotel.smfcore.custom.lizhen.LizhenApi; import com.neotel.smfcore.custom.lizhen.LizhenApi;
import com.neotel.smfcore.custom.lizhen.innerBox.enums.ExtendType; import com.neotel.smfcore.custom.lizhen.innerBox.enums.ExtendType;
import com.neotel.smfcore.custom.siemens.SiemensApi; import java.lang.String;
import com.neotel.smfcore.security.annotation.AnonymousAccess; import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -743,14 +743,14 @@ public class StoragePosController { ...@@ -743,14 +743,14 @@ public class StoragePosController {
for (String pid : pids) { for (String pid : pids) {
StoragePos pos = storagePosManager.get(pid); StoragePos pos = storagePosManager.get(pid);
if (pos == null){ if (pos == null){
throw new ValidateException("smfcore.valueNotExist", "{0}[{1}]不存在", new String[]{"pid", pid}); return ResultBean.newErrorResult(-1,"smfcore.valueNotExist", "{0}[{1}]不存在", new String[]{"pid", pid});
} }
Storage storage = dataCache.getStorageById(pos.getStorageId()); Storage storage = dataCache.getStorageById(pos.getStorageId());
if (storage == null){ if (storage == null){
throw new ValidateException("smfcore.valueNotExist", "{0}[{1}]不存在", new String[]{"storageId", pos.getStorageId()}); return ResultBean.newErrorResult(-1,"smfcore.valueNotExist", "{0}[{1}]不存在", new String[]{"storageId", pos.getStorageId()});
} }
if (excludePosIds.contains(pos.getId())){ if (excludePosIds.contains(pos.getId())){
throw new ValidateException("smfcore.error.pos.inQueue", "位置:[{0}}]已在操作队列中,操作失败", new String[]{pos.getPosName()}); return ResultBean.newErrorResult(-1,"smfcore.error.pos.inQueue", "位置:[{0}}]已在操作队列中,操作失败", new String[]{pos.getPosName()});
} }
needOutPosList.add(pos); needOutPosList.add(pos);
} }
...@@ -775,20 +775,56 @@ public class StoragePosController { ...@@ -775,20 +775,56 @@ public class StoragePosController {
String barcodeStr = barcode.getBarcode(); String barcodeStr = barcode.getBarcode();
if (checkReelList != null && !checkReelList.isEmpty()){ if (checkReelList != null && !checkReelList.isEmpty()){
if (checkReelList.contains(barcodeStr)){ if (checkReelList.contains(barcodeStr)){
return ResultBean.newErrorResult(-1,"",barcodeStr+"已经被禁用,库位为:"+pos.getPosName()); return ResultBean.newErrorResult(-2,"",barcodeStr+"已经被禁用,库位为:"+pos.getPosName());
} }
} }
} }
} }
//生成出库任务 //生成出库任务
List<String> messageList = new ArrayList<>();
for (StoragePos pos : needOutPosList){ for (StoragePos pos : needOutPosList){
String message = "";
Barcode barcode = pos.getBarcode();
String barcodeStr = barcode.getBarcode();
String posName = pos.getPosName();
//生成出库任务
Storage storage = dataCache.getStorageById(pos.getStorageId()); Storage storage = dataCache.getStorageById(pos.getStorageId());
log.info("出库料仓【" + storage.getName() + "_" + storage.getCid() + "】位置仓位【" + pos.getPosName() + "】"); DataLog task = new DataLog(storage, pos.getBarcode(), pos);
String outResult = taskService.checkout(storage, pos, isSingleOut,SecurityUtils.getCurrentUsername(),null,ExtendType.MANUAL_CHECKOUT); task.setItemNo(1);
if (!Strings.isNullOrEmpty(outResult)) { task.setPickingId("");
throw new ValidateException("smfcore.error", outResult); task.setType(OP.CHECKOUT);
task.setStorageId(storage.getId());
task.setPutInDate(barcode.getPutInDate());
task.setSingleOut(isSingleOut);
task.setWarehouseCode(barcode.getWarehouseCode());
task.setDescribe(barcode.getDescribe());
task.setBatchInfo(barcode.getBatch());
task.setDateCode(barcode.getDateCode());
task.setProvider(barcode.getProvider());
task.setProviderNumber(barcode.getProviderNumber());
task.setKeeperCode(barcode.getKeeperCode());
task.setOperator(SecurityUtils.getLoginUsername());
String resultStr = lizhenApi.towerIssue(task);
if (StringUtils.isEmpty(resultStr)){
barcode.setAskPutIn(false);
barcodeManager.save(barcode);
pos.setBarcode(barcode);
storagePosManager.save(pos);
taskService.updateQueueTask(task);
} else {
messageList.add("条码:"+barcodeStr+"调用tower发料失败:"+resultStr);
continue;
}
} }
if (messageList != null && !messageList.isEmpty()){
return ResultBean.newErrorResult(-1,"", JSON.toJSONString(messageList));
} }
return ResultBean.newOkResult(""); return ResultBean.newOkResult("");
......
...@@ -290,7 +290,7 @@ public class LizhenApi extends DefaultSmfApiListener { ...@@ -290,7 +290,7 @@ public class LizhenApi extends DefaultSmfApiListener {
*/ */
@Override @Override
public void outTaskStatusChange(String outNotifyUrl, DataLog task) { public void outTaskStatusChange(String outNotifyUrl, DataLog task) {
if (task.isFinished() && StringUtils.isEmpty(task.getSourceId())) { /*if (task.isFinished() && StringUtils.isEmpty(task.getSourceId())) {
Map<String, Object> paramMap = new HashMap<>(); Map<String, Object> paramMap = new HashMap<>();
paramMap.put("PLANT_CODE", CommonUtil.plantCode); paramMap.put("PLANT_CODE", CommonUtil.plantCode);
paramMap.put("PICKING_ID", "SMFT"+System.currentTimeMillis()); paramMap.put("PICKING_ID", "SMFT"+System.currentTimeMillis());
...@@ -318,13 +318,18 @@ public class LizhenApi extends DefaultSmfApiListener { ...@@ -318,13 +318,18 @@ public class LizhenApi extends DefaultSmfApiListener {
e.printStackTrace(); e.printStackTrace();
log.info(task.getBarcode() + "出库通知,调用Tower发料,异常为:" + e.getMessage()); log.info(task.getBarcode() + "出库通知,调用Tower发料,异常为:" + e.getMessage());
} }
} }*/
} }
public String towerIssue(DataLog task) { public String towerIssue(DataLog task) {
Map<String, Object> paramMap = new HashMap<>(); Map<String, Object> paramMap = new HashMap<>();
paramMap.put("PLANT_CODE", CommonUtil.plantCode); paramMap.put("PLANT_CODE", CommonUtil.plantCode);
if (StringUtils.isEmpty(task.getPickingId())){
paramMap.put("PICKING_ID", "SMFT"+System.currentTimeMillis());
} else {
paramMap.put("PICKING_ID", task.getPickingId()); paramMap.put("PICKING_ID", task.getPickingId());
}
paramMap.put("ITEM_NO",task.getItemNo()); paramMap.put("ITEM_NO",task.getItemNo());
paramMap.put("MATERIAL_CODE", task.getPartNumber()); paramMap.put("MATERIAL_CODE", task.getPartNumber());
paramMap.put("WAREHOUSE_CODE", task.getWarehouseCode()); paramMap.put("WAREHOUSE_CODE", task.getWarehouseCode());
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!