Commit ae524b11 zshaohui

pk出库时,先调用接口 判断是否ng

1 个父辈 6d3c0d5d
...@@ -47,7 +47,7 @@ public class BoxUtil { ...@@ -47,7 +47,7 @@ public class BoxUtil {
public static String getBoxStr(String str) { public static String getBoxStr(String str) {
String boxStr = ""; String boxStr = "";
if (StringUtils.isNotBlank(str)) { if (StringUtils.isNotBlank(str)) {
if (str.startsWith("CS") || str.startsWith("CM") || str.startsWith("CB")) { if (str.startsWith("C07") || str.startsWith("C13") || str.startsWith("C15")) {
if (str.endsWith("A") || str.endsWith("B")) { if (str.endsWith("A") || str.endsWith("B")) {
boxStr = str.substring(0, str.length() - 1); boxStr = str.substring(0, str.length() - 1);
} else if (str.indexOf("-") != -1) { } else if (str.indexOf("-") != -1) {
......
...@@ -266,10 +266,10 @@ public class LuxsanApi extends DefaultSmfApiListener { ...@@ -266,10 +266,10 @@ public class LuxsanApi extends DefaultSmfApiListener {
String resultStr = HttpHelper.postJson(pickingIssueUrl, request); String resultStr = HttpHelper.postJson(pickingIssueUrl, request);
log.info("pickingIssue接口返回结果为:" + resultStr); log.info("pickingIssue接口返回结果为:" + resultStr);
/*LuxsanApiResult apiResult = JSONObject.parseObject(resultStr, LuxsanApiResult.class); LuxsanApiResult apiResult = JSONObject.parseObject(resultStr, LuxsanApiResult.class);
if (LuxsanApiEnum.ERROR.equals(apiResult.getMSGTY())) { if (LuxsanApiEnum.ERROR.equals(apiResult.getMSGTY())) {
throw new ValidateException("smfcore.api.error", "接口请求失败[{0}]", new String[]{apiResult.getMSGTX()}); throw new ValidateException("smfcore.api.error", "接口请求失败[{0}]", new String[]{apiResult.getMSGTX()});
}*/ }
} catch (ApiException e) { } catch (ApiException e) {
log.error("pickingIssue请求失败:" + e.getMessage()); log.error("pickingIssue请求失败:" + e.getMessage());
throw new ValidateException("smfcore.api.error", "接口请求失败[{0}]", new String[]{e.getMessage()}); throw new ValidateException("smfcore.api.error", "接口请求失败[{0}]", new String[]{e.getMessage()});
......
package com.neotel.smfcore.custom.luxsan.factory_c.rawstor.controller; package com.neotel.smfcore.custom.luxsan.factory_c.rawstor.controller;
import cn.hutool.extra.spring.SpringUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.neotel.smfcore.common.bean.ReelLockPosInfo;
import com.neotel.smfcore.common.bean.ResultBean; import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ValidateException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.DateUtil; import com.neotel.smfcore.common.utils.DateUtil;
import com.neotel.smfcore.common.utils.ReelLockPosUtil;
import com.neotel.smfcore.common.utils.StringUtils; import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.api.SmfApi; import com.neotel.smfcore.core.api.SmfApi;
import com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager; import com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager;
...@@ -26,6 +23,7 @@ import com.neotel.smfcore.core.storage.service.po.Storage; ...@@ -26,6 +23,7 @@ import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.storage.service.po.StoragePos; import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.core.system.service.po.DataLog; 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.agvBox.util.BoxUtil;
import com.neotel.smfcore.custom.luxsan.api.LuxsanApi; import com.neotel.smfcore.custom.luxsan.api.LuxsanApi;
import com.neotel.smfcore.custom.luxsan.api.bean.request.*; import com.neotel.smfcore.custom.luxsan.api.bean.request.*;
import com.neotel.smfcore.custom.luxsan.api.bean.result.BinMoveResult; import com.neotel.smfcore.custom.luxsan.api.bean.result.BinMoveResult;
...@@ -33,10 +31,8 @@ import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean.BindGrInfo; ...@@ -33,10 +31,8 @@ import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean.BindGrInfo;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean.StorTransfer; import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean.StorTransfer;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean.TicketReturn; import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean.TicketReturn;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean.TicketTransfer; import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean.TicketTransfer;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean.dto.CtuTask;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean.dto.ValidBin; import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.bean.dto.ValidBin;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.enums.LiteorderCheckType; import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.enums.LiteorderCheckType;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.enums.TaskCurrentLoc;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util.BinCacheUtil; import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util.BinCacheUtil;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util.BoxHandleUtil; import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util.BoxHandleUtil;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util.MaterialUtil; import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util.MaterialUtil;
...@@ -46,8 +42,6 @@ import com.neotel.smfcore.security.annotation.AnonymousAccess; ...@@ -46,8 +42,6 @@ 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;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.logging.log4j.util.Strings;
import org.ehcache.impl.internal.concurrent.ConcurrentHashMap;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -473,7 +467,11 @@ public class CDeviceController { ...@@ -473,7 +467,11 @@ public class CDeviceController {
//4.开始生成出库任务 //4.开始生成出库任务
log.info(barcode.getBarcode() + "从" + boxStr + "出库,序列号为:" + seq); log.info(barcode.getBarcode() + "从" + boxStr + "出库,序列号为:" + seq);
DataLog dataLog = new DataLog(new Storage(), barcode, new StoragePos()); if (!barcode.isOut()){
return ResultBean.newErrorResult(-1,"",barcode.getPosName()+"没有要出库的料盘");
}
String orderItemId = barcode.getOrderItemId(); String orderItemId = barcode.getOrderItemId();
LiteOrderItem orderItem = null; LiteOrderItem orderItem = null;
...@@ -502,6 +500,52 @@ public class CDeviceController { ...@@ -502,6 +500,52 @@ public class CDeviceController {
} }
} }
//通知WMS
if (checkType == LiteorderCheckType.PICKING_CHECKOUT){
try {
LuxsanApi.pickingIssue(new PickingIssueRequest(CommonUtil.plantCode, orderNo, pkItemId, barcode.getPartNumber()
, barcode.getWarehouseCode(), brand, face, batchCode, Arrays.asList(barcode.getBarcode())));
} catch (Exception e) {
log.info(barcode.getBarcode() + "PK发料失败:" + e.getMessage() + ",隔口:" + barcode.getPosName() + "需要清空出库信息");
List<Barcode> newSubCodeList = new ArrayList<>();
for (Barcode subCode : boxBarcode.getSubCodeList()) {
if (subCode.isOut()){
if (barcode.getPosName().equals(subCode.getPosName())){
newSubCodeList.add(subCode);
}
}
}
for (Barcode subCode : newSubCodeList) {
if (subCode.isOut()){
if (barcode.getPosName().equals(subCode.getPosName())){
String itemId = subCode.getOrderItemId();
subCode.setOut(false);
subCode.setSelectMsg(null);
subCode.setOrderItemId(null);
barcodeManager.save(subCode);
boxBarcode.updateSubCodes(subCode);
//生成任务
generateTask(subCode,OP_STATUS.CANCEL.name(),subCode.getAmount(),OP.CHECKOUT,itemId,"",0,false);
log.info(subCode.getBarcode()+"隔口为:"+subCode.getPosName()+"需清除出库标记");
}
}
}
barcodeManager.save(boxBarcode);
if (inPos != null){
inPos.setBarcode(boxBarcode);
storagePosManager.save(inPos);
}
return ResultBean.newErrorResult(-1, "", barcode.getBarcode() + "请求PK发料失败,隔口:" + barcode.getPosName() + "出库信息已清空");
}
}
DataLog dataLog = new DataLog(new Storage(), barcode, new StoragePos());
dataLog.setSubSourceId(orderItemId); dataLog.setSubSourceId(orderItemId);
dataLog.setSourceId(orderId); dataLog.setSourceId(orderId);
...@@ -529,12 +573,6 @@ public class CDeviceController { ...@@ -529,12 +573,6 @@ public class CDeviceController {
barcode.setOrderItemId(""); barcode.setOrderItemId("");
barcode.setBarSource(""); barcode.setBarSource("");
barcodeManager.saveBarcode(barcode); barcodeManager.saveBarcode(barcode);
//通知WMS
if (checkType == LiteorderCheckType.PICKING_CHECKOUT){
LuxsanApi.pickingIssue(new PickingIssueRequest(CommonUtil.plantCode,orderNo,pkItemId,barcode.getPartNumber()
,barcode.getWarehouseCode(),brand,face,batchCode,Arrays.asList(barcode.getBarcode())));
}
return ResultBean.newOkResult(""); return ResultBean.newOkResult("");
} }
...@@ -873,4 +911,58 @@ public class CDeviceController { ...@@ -873,4 +911,58 @@ public class CDeviceController {
dataLog.setWarehouseCode(barcode.getWarehouseCode()); dataLog.setWarehouseCode(barcode.getWarehouseCode());
taskService.updateQueueTask(dataLog); taskService.updateQueueTask(dataLog);
} }
private DataLog generateTask(Barcode barcode, String opStatus, int opQty, int opType, String orderItemId,String name,int extendType,boolean isBoxOut) {
//生成任务
DataLog task = new DataLog();
task.setStatus(opStatus);
task.setPartNumber(barcode.getPartNumber());
task.setBarcode(barcode.getBarcode());
task.setNum(opQty);
task.setType(opType);
task.setPosName(barcode.getPosName());
//task.setOperator(SecurityUtils.getCurrentUsername());
task.setDateCode(barcode.getDateCode());
task.setBatchInfo(barcode.getBatch());
task.setProvider(barcode.getProvider());
task.setProviderNumber(barcode.getProviderNumber());
task.setKeeperCode(barcode.getKeeperCode());
//task.setReelPosName(barcode.getPosName());
task.setSubSourceId(orderItemId);
task.setWarehouseCode(barcode.getWarehouseCode());
task.setStationName(name);
task.setExtendType(extendType);
if (StringUtils.isNotBlank(orderItemId)) {
LiteOrderItem orderItem = liteOrderItemManager.get(orderItemId);
if (orderItem != null) {
task.setSourceName(orderItem.getOrderNo());
task.setLine(orderItem.getLine());
task.setMo(orderItem.getMo());
task.setSide(orderItem.getSide());
task.setPlantCode(orderItem.getPlantCode());
task.setOrderNo(orderItem.getOrderNo());
task.setSubSourceId(orderItem.getId());
task.setManualUpload(orderItem.isManualUpload());
}
}
//如果是出库任务,增加库位
if (task.isCheckOutTask()) {
String boxStr = BoxUtil.getBoxStr(barcode.getPosName());
String posName = taskService.getPosName(boxStr);
if (StringUtils.isNotBlank(posName)) {
task.setStoragePosName(posName);
}
}
task.setBoxOut(isBoxOut);
if (barcode.getPutInTime() != -1) {
task.setFristPutInDate(new Date(barcode.getPutInTime()));
} else {
task.setFristPutInDate(barcode.getPutInDate());
}
task.setDescribe(barcode.getDescribe());
taskService.updateFinishedTask(task);
return task;
}
} }
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!