Commit 35d882b9 zshaohui

盘点功能 优化提交

1 个父辈 33d99616
......@@ -291,4 +291,9 @@ public class BarcodeDto implements Serializable {
@ApiModelProperty("标签id")
private String labelId;
//出库异常信息
private String outExpInfo = "";
private Map<String,String> extraDataMap = new HashMap<>();
}
......@@ -33,6 +33,8 @@ import com.neotel.smfcore.custom.lizhen.agvBox.service.manager.InventoryDataMana
import com.neotel.smfcore.custom.lizhen.agvBox.util.BoxUtil;
import com.neotel.smfcore.custom.lizhen.agvBox.util.StationCacheUtil;
import com.neotel.smfcore.custom.lizhen.innerBox.enums.ExtendType;
import com.neotel.smfcore.custom.luxsan.api.bean.request.QueryBinRequest;
import com.neotel.smfcore.custom.luxsan.factory_c.common.util.CommonUtil;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.enums.TaskCurrentLoc;
import com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util.BoxHandleUtil;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
......@@ -120,35 +122,69 @@ public class InventoryController {
break;
}
}
int count = storagePosManager.countByQuery(new Query(Criteria.where("storageId").is(storageId)));
//统计箱子总数
Query query = new Query(Criteria.where("storageId").is(storageId));
query.fields().include("posName", "barcode.barcode","barcode.extraDataMap");
List<StoragePos> storagePosList = storagePosManager.findByQuery(query);
//开始获取已经盘点的料箱信息
String inventoryBatch = dataCache.getCache(INVENTORY_DATA) + "";
if (StringUtils.isNotBlank(inventoryBatch) && !"-1".equals(inventoryBatch)) {
List<InventoryData> dataList = inventoryDataManager.findByQuery(new Query(Criteria.where("inventoryBatch").is(inventoryBatch)/*.and("status").is(InventoryStatus.FINISHED.name())*/));
List<InventoryData> dataList = inventoryDataManager.findByQuery(new Query(Criteria.where("inventoryBatch").is(inventoryBatch)));
if (dataList != null && !dataList.isEmpty()) {
List<String> posNameList = new ArrayList<>();
//料箱库位有变化,重新赋值
for (InventoryData data : dataList) {
boolean isFinished = isInventoryDataFinshed(data.getPosName(), dataList);
if (isFinished) {
if (posNameList.isEmpty()) {
posNameList.add(data.getPosName());
} else {
if (!posNameList.contains(data.getPosName())) {
posNameList.add(data.getPosName());
for (StoragePos pos : storagePosList) {
Barcode barcode = pos.getBarcode();
if (barcode != null){
if (barcode.getBarcode().equals(data.getBox())){
data.setPosName(pos.getPosName());
data.setOriPosName(pos.getPosName());
//data.setExtraDataMap(barcode.getExtraDataMap());
break;
}
}
}
}
//判断是否盘点完成
for (InventoryData data : dataList) {
boolean isFinished = isInventoryDataFinshed(data.getPosName(), dataList);
if (isFinished){
inventoryCount++;
}
}
inventoryCount = posNameList.size();
//获取到哪一列已经盘点完成
finishInventory = getFinishInventoryPosName(storagePosList, dataList);
}
finishInventory = getFinishInventoryPosName(inventoryBatch, dataList);
}
List<String> outExpBox = getOutExpBarcodePosName(storagePosList);
resultMap.put("inventoryCount", inventoryCount);
resultMap.put("count", count);
resultMap.put("count", storagePosList.size());
resultMap.put("inventoryBatch", StringUtils.isBlank(inventoryBatch) || "-1".equals(inventoryBatch) ? "" : inventoryBatch);
resultMap.put("finishInventory", finishInventory);
resultMap.put("outExpBox",outExpBox);
return ResultBean.newOkResult(resultMap);
}
private List<String> getOutExpBarcodePosName(List<StoragePos> storagePosList) {
List<String> posNameList = new ArrayList<>();
for (StoragePos pos : storagePosList) {
Barcode barcode = pos.getBarcode();
if (barcode != null) {
Map<String, String> extraDataMap = barcode.getExtraDataMap();
if (extraDataMap != null && !extraDataMap.isEmpty()) {
for (String key : extraDataMap.keySet()) {
if (key.startsWith(CommonUtil.outExpPrefix)) {
posNameList.add(pos.getPosName());
break;
}
}
}
}
}
return posNameList;
}
private boolean isInventoryDataFinshed(String posName, List<InventoryData> dataList) {
boolean isFinished = true;
for (InventoryData data : dataList) {
......@@ -163,7 +199,6 @@ public class InventoryController {
return isFinished;
}
/**
* 开始盘点
*
......@@ -229,26 +264,24 @@ public class InventoryController {
@RequestMapping("/getStoragePosData")
//@AnonymousAccess
public List<StoragePosDto> getStoragePosData(String posName) {
List<Storage> storageList = new ArrayList<>();
for (Storage storage : dataCache.getAllStorage().values()) {
if (!storage.isVirtual()) {
storageList.add(storage);
}
}
String inventoryBatch = dataCache.getCache(INVENTORY_DATA) + "";
//获取所有库位信息
for (Storage storage : storageList) {
List<StoragePos> storagePosList = storagePosManager.findByQuery(inventoryQuery(posName, storage.getId(), null));
List<StoragePosDto> resultList = new ArrayList<>();
List<StoragePosDto> storagePosDtos = storagePosMapper.toDto(storagePosList);
if (inventoryBatch != null) {
for (StoragePosDto pos : storagePosDtos) {
//获取盘点批次
String inventoryBatch = dataCache.getCache(INVENTORY_DATA) + "";
//模糊查询,对应的所有库位信息
Query query = new Query(Criteria.where("posName").regex(posName));
query.fields().exclude("barcode.subCodeList");
List<StoragePos> storagePosList = storagePosManager.findByQuery(query);
if (storagePosList != null && !storagePosList.isEmpty()) {
//提取到所有料箱信息
List<StoragePosDto> storagePosDtoList = storagePosMapper.toDto(storagePosList);
for (StoragePosDto pos : storagePosDtoList) {
BarcodeDto barcode = pos.getBarcode();
if (barcode != null) {
if (barcode.getStatus() != BARCODE_STATUS.IN_STORE) {
pos.setBarcode(null);
} else {
List<InventoryData> dataList = inventoryDataManager.findByQuery(new Query(Criteria.where("inventoryBatch").is(inventoryBatch).and("box").is(barcode.getBarcode())));
List<InventoryData> dataList = inventoryDataManager.findByQuery(new Query(Criteria.where("inventoryBatch").is(inventoryBatch)
.and("box").is(barcode.getBarcode())));
if (dataList != null && !dataList.isEmpty()) {
List<String> statusList = new ArrayList<>();
for (InventoryData data : dataList) {
......@@ -262,15 +295,29 @@ public class InventoryController {
pos.setInventoryStatus(InventoryStatus.FINISHED.name());
}
}
//判断是否有异常
Map<String, String> extraDataMap = barcode.getExtraDataMap();
if (extraDataMap != null && !extraDataMap.isEmpty()) {
for (String key : extraDataMap.keySet()) {
if (key.startsWith(CommonUtil.outExpPrefix)) {
String outExpInfo = barcode.getOutExpInfo();
String value = extraDataMap.get(key);
if (StringUtils.isNotEmpty(outExpInfo)) {
barcode.setOutExpInfo(outExpInfo + "," + value);
} else {
barcode.setOutExpInfo(value);
}
}
}
}
}
resultList.add(pos);
}
}
if (resultList != null && !resultList.isEmpty()) {
resultList = resultList.stream().sorted(Comparator.comparing(StoragePosDto::getPosName).reversed()).collect(Collectors.toList());
return resultList;
}
return new ArrayList<>();
return resultList;
}
......@@ -283,7 +330,6 @@ public class InventoryController {
@RequestMapping("/inventoryOut")
//@AnonymousAccess
public synchronized ResultBean inventoryOut(@RequestBody List<String> storagePosIdList) {
String msg = "";
String inventoryBatch = dataCache.getCache(INVENTORY_DATA) + "";
if (StringUtils.isBlank(inventoryBatch) || "-1".equals(inventoryBatch)) {
return ResultBean.newErrorResult(-1, "", "请点击开始盘点");
......@@ -291,54 +337,41 @@ public class InventoryController {
if (storagePosIdList == null || storagePosIdList.isEmpty()) {
return ResultBean.newErrorResult(-1, "smfcore.valueCanotNull", "{0}不能为空", new String[]{"库位"});
}
if (storagePosIdList != null && !storagePosIdList.isEmpty()) {
List<StoragePos> storagePosList = storagePosManager.findByQuery(inventoryQuery(null, null, storagePosIdList));
if (storagePosList == null || storagePosList.isEmpty()) {
return ResultBean.newErrorResult(-1, "smfcore.label.noReel", "未找到可出库的物料");
}
//查询到料箱信息
List<String> barcodeList = new ArrayList<>();
//查询料箱信息
Query query = new Query(Criteria.where("id").in(storagePosIdList));
List<StoragePos> storagePosList = storagePosManager.findByQuery(query);
//开始循环处理数据
for (StoragePos pos : storagePosList) {
//判断料箱在不在库
Barcode barcode = pos.getBarcode();
if (barcode != null) {
if (barcode.getStatus() != BARCODE_STATUS.IN_STORE) {
log.info(barcode.getBarcode() + "料箱不在库,跳过");
} else {
barcodeList.add(barcode.getBarcode());
}
if (barcode == null || barcode.getStatus() != BARCODE_STATUS.IN_STORE) {
return ResultBean.newErrorResult(-1, "", barcode.getBarcode() + "不在库,请核实");
}
}
//判断是否已经生成盘点记录
List<InventoryData> dataList = inventoryDataManager.findByQuery(new Query(Criteria.where("inventoryBatch").is(inventoryBatch).and("box").in(barcodeList)));
//判断是否有未完成的任务
String barcodeStr = barcode.getBarcode();
List<InventoryData> dataList = inventoryDataManager.findByQuery(new Query(Criteria.where("inventoryBatch").is(inventoryBatch).and("box").is(barcodeStr)));
if (dataList != null && !dataList.isEmpty()) {
List<String> boxList = dataList.stream().map(InventoryData::getBox).collect(Collectors.toList());
boxList = boxList.stream().distinct().collect(Collectors.toList());
return ResultBean.newErrorResult(-1, "", JsonUtil.toJsonStr(boxList) + "已经进行过盘点出库,请核实");
return ResultBean.newErrorResult(-1, "", "料箱:" + barcodeStr + "已经进行过盘点出库,请核实");
}
//判断是否有未完成的任务
List<DataLog> allTasks = taskService.getAllTasks();
for (String barcodeStr : barcodeList) {
for (DataLog dataLog : allTasks) {
if (!dataLog.isFinished() && !dataLog.isCancel()) {
if (barcodeStr.equals(dataLog.getBarcode())) {
log.info(barcodeStr + "有未完成的任务");
return ResultBean.newErrorResult(-1, "", barcodeStr + "有未完成的任务,请确认");
if (!dataLog.isFinished() && !dataLog.isCancel()) {
return ResultBean.newErrorResult(-1, "", barcodeStr + "有未完成出库/入库任务,请核实");
}
}
}
}
//开始生成出库任务
String msg = "";
for (StoragePos pos : storagePosList) {
log.info("盘点出库的库位为:" + pos.getPosName());
Barcode barcode = pos.getBarcode();
if (barcode != null) {
if (barcode.getStatus() != BARCODE_STATUS.IN_STORE) {
if (barcode == null || barcode.getStatus() != BARCODE_STATUS.IN_STORE) {
continue;
}
log.info("盘点出库的物料为:" + barcode.getBarcode());
log.info("盘点出库的物料为:" + barcode.getBarcode() + ",库位为:" + pos.getPosName());
Storage storage = dataCache.getStorageById(pos.getStorageId());
//生成出库任务
DataLog dataLog = new DataLog(storage, barcode, pos);
......@@ -355,16 +388,12 @@ public class InventoryController {
msg = StringUtils.isBlank(msg) ? dataLog.getBarcode() : msg + "," + dataLog.getBarcode();
continue;
}
}
//生成盘点数据
generateInventoryData(barcode, pos);
}
}
if (StringUtils.isNotBlank(msg)) {
msg = msg + "已经有出入库任务请核实";
return ResultBean.newOkResult("", "", msg);
}
return ResultBean.newOkResult("");
ResultBean resultBean = ResultBean.newOkResult("");
resultBean.setMsg(msg);
return resultBean;
}
......@@ -688,6 +717,11 @@ public class InventoryController {
data.setPosName(pos.getPosName());
inventoryDataManager.save(data);
} else {
//获取到异常出库的数据
Map<String, String> extraDataMap = barcode.getExtraDataMap();
if (extraDataMap == null){
extraDataMap = new HashMap<>();
}
List<Barcode> subCodeList = barcode.getSubCodeList();
String partition = getInventoryPartition(subCodeList);
String boxStr = barcode.getBarcode();
......@@ -712,7 +746,9 @@ public class InventoryController {
data.setAmout(partitionNum);
data.setInventoryBatch(inventoryBatch);
data.setOriPosName(posName);
if (partition.equals(boxStr + "-0" + i)) {
String boxPar = boxStr + "-0" + i;
if (partition.equals(boxPar) || extraDataMap.get(CommonUtil.outExpPrefix+boxPar) != null) {
data.setNeedInventory(true);
} else {
data.setNeedInventory(false);
......@@ -742,45 +778,71 @@ public class InventoryController {
}
private Query inventoryQuery(String posName, String storageId, List<String> storagePosIdList) {
Query query = new Query();
//Criteria criteria = Criteria.where("barcode.status").is(BARCODE_STATUS.IN_STORE);
Criteria criteria = new Criteria();
if (storagePosIdList != null && !storagePosIdList.isEmpty()) {
criteria.and("id").in(storagePosIdList);
private List<String> getFinishInventoryPosName(List<StoragePos> storagePosList, List<InventoryData> dataList) {
List<String> finishPosName = new ArrayList<>();
//构造数据
Map<String, List<String>> cachePosNameMap = new HashMap<>();
for (StoragePos pos : storagePosList) {
String posName = pos.getPosName();
Barcode barcode = pos.getBarcode();
if(barcode != null){
posName = posName.substring(0,posName.length()-3);
List<String> cacheBarcodeList = cachePosNameMap.get(posName);
if (cacheBarcodeList == null){
cacheBarcodeList = new ArrayList<>();
}
if (StringUtils.isNotBlank(storageId)) {
criteria.and("storageId").is(storageId);
cacheBarcodeList.add(barcode.getBarcode());
cachePosNameMap.put(posName,cacheBarcodeList);
}
}
//开始循环处理数据
for (String key : cachePosNameMap.keySet()) {
List<String> barcodeList = cachePosNameMap.get(key);
if (barcodeList == null || barcodeList.isEmpty()){
finishPosName.add(key);
} else {
boolean hasData = true;
for (String barcodeStr : barcodeList) {
boolean hasSameData = false;
for (InventoryData data : dataList) {
if (barcodeStr.equals(data.getBox())){
hasSameData =true;
break;
}
}
if (!hasSameData){
hasData = false;
break;
}
if (StringUtils.isNotBlank(posName)) {
Pattern pattern = Pattern.compile(QueryHelp.escapeExprSpecialWord(posName), Pattern.CASE_INSENSITIVE);
criteria.and("posName").regex(pattern);
}
//获取到在库的库存信息
query.addCriteria(criteria);
//query.fields().include("barcode", "updateDate", "storageId","posName");
return query;
if (!hasData){
continue;
}
private List<String> getFinishInventoryPosName(String inventoryBatch,List<InventoryData> dataList) {
List<String> finishPosName = new ArrayList<>();
//List<InventoryData> dataList = inventoryDataManager.findByQuery(new Query(Criteria.where("inventoryBatch").is(inventoryBatch)));
//获取原始库位
List<String> oriPosNameList = dataList.stream().map(InventoryData::getOriPosName).collect(Collectors.toList());
oriPosNameList = oriPosNameList.stream().distinct().collect(Collectors.toList());
for (String oriPosName : oriPosNameList) {
boolean isFinished = true;
//判断是否全部完成
boolean finished = true;
for (String barcodeStr : barcodeList) {
for (InventoryData data : dataList) {
if (data.getOriPosName().equals(oriPosName)){
if (barcodeStr.equals(data.getBox())) {
if (!data.getStatus().equals(InventoryStatus.FINISHED.name())){
isFinished = false;
finished = false;
break;
}
}
}
if (isFinished) {
finishPosName.add(oriPosName);
if (!finished){
break;
}
}
if (finished){
finishPosName.add(key);
}
}
}
if (finishPosName != null && !finishPosName.isEmpty()) {
finishPosName = finishPosName.stream().distinct().collect(Collectors.toList());
}
return finishPosName;
}
......
......@@ -12,4 +12,6 @@ public class CommonUtil {
private void setPlantCode(String code){
CommonUtil.plantCode = code;
}
public static String outExpPrefix = "Out_Exp";
}
......@@ -1213,87 +1213,66 @@ public class CDeviceController {
log.info("物料放到料串上,通知出库,隔口号为:" + boxPar + ",条码信息为:" + code + "当前位置为:" + currentLoc + "条码编号为:" + stacker);
//code为1,代表数据异常
if (StringUtils.isEmpty(boxPar)) {
saveMessage(MessageType.ERROR.name(), currentLoc, "料箱隔口号不能为空");
return ResultBean.newErrorResult(1, "", "料箱隔口号不能为空");
}
Barcode boxBarcode = null;
String box = BoxHandleUtil.getBoxStr(boxPar, false);
StoragePos pos = storagePosManager.getByBarcode(box);
if (pos != null) {
boxBarcode = pos.getBarcode();
Barcode alearyOutBarcode = null;
try {
if (StringUtils.isEmpty(code)) {
saveMessage(MessageType.ERROR.name(), currentLoc, "未扫到条码信息");
} else {
boxBarcode = barcodeManager.findByBarcode(box);
alearyOutBarcode = codeResolve.resolveOneValideBarcode(code);
}
if (boxBarcode == null) {
saveMessage(MessageType.ERROR.name(), currentLoc, "料箱隔口号:" + boxPar + "对应的料箱信息不存在");
return ResultBean.newErrorResult(2, "", "料箱隔口号:" + boxPar + "对应的料箱信息不存在");
} catch (Exception e) {
log.info("解析出库的条码失败:", e);
saveMessage(MessageType.ERROR.name(), currentLoc, code + "解析条码失败,错误信息为:" + e.getMessage());
}
Barcode barcode = null;
//如果code为空,或者为"noCode",则寻找第一盘
if (StringUtils.isEmpty(code) || "noCode".equals(code)) {
//1.解析条码内容
//Barcode binCode = codeResolve.resolveOneValideBarcode(boxStr);
//解析料箱信息
String box = BoxHandleUtil.getBoxStr(boxPar, true);
Barcode boxBarcode = codeResolve.resolveOneValideBarcode(box);
StoragePos inPos = storagePosManager.getByBarcode(boxBarcode.getBarcode());
if (inPos != null) {
boxBarcode = inPos.getBarcode();
//log.error("流程异常:料箱["+boxStr+"]在库位["+inPos.getPosName()+"],但物料从料格中出库");
}
List<Barcode> subCodeList = boxBarcode.getSubCodeList();
//2.获取要出库的code
int seq = BoxHandleUtil.getSeq(boxBarcode, boxPar);
for (Barcode subCode : boxBarcode.getSubCodeList()) {
Barcode barcode = null;
for (Barcode subCode : subCodeList) {
if (seq == subCode.getSeq() && boxPar.equals(subCode.getPosName())) {
barcode = subCode;
break;
}
}
saveMessage(MessageType.ERROR.name(), currentLoc, "条码信息为空,寻找到序列号为:" + seq);
//return ResultBean.newErrorResult(1, "", "条码信息不能为空");
} else {
barcode = codeResolve.resolveOneValideBarcode(code);
}
//3.判断barcode是否为空
if (barcode == null) {
saveMessage(MessageType.ERROR.name(), currentLoc, "条码:" + code + "解析失败");
return ResultBean.newErrorResult(2, "", "条码:" + code + "解析失败");
return ResultBean.newErrorResult(-1, "", "未找到可以出库的物料");
}
//更新料串缓存信息
// log.info("先清空:" + stacker + "位置缓存的信息");
// MaterialLocUtil.updateStackerLoc(stacker, "", null,);
//code为3时,代表不在此箱子中,直接出库/通知WMS失败
List<String> messageList = new ArrayList<>();
String posName = barcode.getPosName();
log.info("当前料箱是:" + boxPar + "要出库的料盘信息为:" + barcode.getBarcode() + "对应的库位为:" + posName);
if (!boxPar.equals(posName)) {
//先清空数据
if (StringUtils.isNotEmpty(posName)) {
Barcode newBoxBarcode = null;
String newBoxStr = BoxHandleUtil.getBoxStr(posName, false);
StoragePos newPos = storagePosManager.getByBarcode(newBoxStr);
if (newPos != null) {
newBoxBarcode = newPos.getBarcode();
} else {
newBoxBarcode = barcodeManager.findByBarcode(newBoxStr);
}
if (newBoxBarcode != null) {
newBoxBarcode.removeFromSubCodes(barcode);
barcodeManager.save(newBoxBarcode);
if (newPos != null) {
newPos.setBarcode(newBoxBarcode);
storagePosManager.save(newPos);
}
}
}
messageList.add(barcode.getBarcode() + "对应的库位为:" + posName + "与当前要出库的料箱隔口号:" + boxPar + "不一致");
saveMessage(MessageType.WARNING.name(), currentLoc, barcode.getBarcode() + "对应的库位为:" + posName + "与当前要出库的料箱隔口号:" + boxPar + "不一致");
} else {
List<Barcode> subCodeList = boxBarcode.getSubCodeList();
//找到对应的料箱隔口,判断是否有要出的物料信息
//log.info("先清空:"+materialStr+"位置缓存的信息");
//MaterialLocUtil.updateStackerLoc(materialStr,"",null);
List<Barcode> barcodeList = new ArrayList<>();
for (Barcode subCode : subCodeList) {
if (boxPar.equals(subCode.getPosName())) {
barcodeList.add(subCode);
}
}
//判断barcode是否为需要出库的
if (!barcode.isOut()) {
log.info(barcode.getBarcode() + "不是要出库的料盘,隔口号为:" + boxPar);
log.info(barcode.getBarcode() + "不是要出库的料盘");
Barcode needOutBarcode = null;
for (Barcode subCode : barcodeList) {
if (subCode.isOut()) {
......@@ -1310,22 +1289,34 @@ public class CDeviceController {
boxBarcode.updateSubCodes(needOutBarcode);
barcode.setOut(true);
barcode.setOrderItemId(orderItemId);
barcodeManager.save(barcode);
boxBarcode.updateSubCodes(barcode);
barcodeManager.save(boxBarcode);
if (pos != null) {
pos.setBarcode(boxBarcode);
storagePosManager.save(pos);
}
log.info(barcode.getBarcode() + "改成要出库,orderItemId为:" + orderItemId);
}
}
//判断是否异常
if (alearyOutBarcode != null) {
String barcodeStr = alearyOutBarcode.getBarcode();
if (!barcodeStr.equals(barcode.getBarcode())) {
saveMessage(MessageType.ERROR.name(), currentLoc, "传入的条码为:" + barcodeStr + ",按顺序出库的条码为:" + barcode.getBarcode() + "不一致");
boxBarcode.updateExtraData(CommonUtil.outExpPrefix + boxPar, boxPar);
}
}
//4.开始生成出库任务
log.info(barcode.getBarcode() + "从" + boxPar + "出库,序列号为:" + seq + ".位置为:" + currentLoc);
if (!barcode.isOut()) {
return ResultBean.newErrorResult(-1, "", barcode.getPosName() + "没有要出库的料盘");
}
log.info(barcode.getBarcode() + "从" + boxPar + "出库,位置为:" + currentLoc + "料串为:" + stacker);
String orderItemId = barcode.getOrderItemId();
String orderId = "";
String orderNo = "";
if (StringUtils.isNotEmpty(orderItemId)) {
int checkType = -1;
String pkItemId = "";
String face = "";
......@@ -1348,35 +1339,65 @@ public class CDeviceController {
checkType = order.getCheckType();
}
}
//通知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())));
//同时 更新下 缓存目的地
if (StringUtils.isNotEmpty(targetLoc)) {
if (targetLoc.endsWith("BG")) {
log.info("自动绑定料串[" + stacker + "]目的地:C2-3F-BG");
MaterialLocUtil.updateStackerLoc(stacker, "", "C2-3F-BG",1,orderNo);
MaterialLocUtil.updateStackerLoc(stacker, "", "C2-3F-BG", 1, orderItem.getOrderNo());
} else if (targetLoc.endsWith("CG")) {
log.info("自动绑定料串[" + stacker + "]目的地:C2-3F-CG");
MaterialLocUtil.updateStackerLoc(stacker, "", "C2-3F-CG",1,orderNo);
MaterialLocUtil.updateStackerLoc(stacker, "", "C2-3F-CG", 1, orderItem.getOrderNo());
}
}
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) {
saveMessage(MessageType.ERROR.name(), currentLoc, "通知WMS失败:" + e.getMessage() + "隔口号为" + boxPar);
log.info(barcode.getBarcode() + "通知WMS失败:" + e.getMessage() + "隔口号为" + boxPar);
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() + "出库信息已清空");
}
}
} else {
//人工出库,
try {
LuxsanApi.pickingIssue(new PickingIssueRequest(CommonUtil.plantCode, "SMFW" + System.currentTimeMillis(), "0", barcode.getPartNumber()
, barcode.getWarehouseCode(), "", "", "", Arrays.asList(barcode.getBarcode())));
} catch (Exception e) {
saveMessage(MessageType.ERROR.name(), currentLoc, "通知WMS失败:" + e.getMessage() + "隔口号为" + boxPar);
log.info(barcode.getBarcode() + "通知WMS失败:" + e.getMessage() + "隔口号为" + boxPar);
}
}
DataLog dataLog = new DataLog(new Storage(), barcode, new StoragePos());
dataLog.setSubSourceId(orderItemId);
......@@ -1400,15 +1421,14 @@ public class CDeviceController {
boxBarcode.updateExtraData(barcode.getPosName(), null);
boxBarcode.removeFromSubCodes(barcode);
barcodeManager.save(boxBarcode);
if (pos != null) {
if (inPos != null) {
//为保证数据一致性, pos中的box barcode也需要更新
pos.setBarcode(boxBarcode);
storagePosManager.save(pos);
inPos.setBarcode(boxBarcode);
storagePosManager.save(inPos);
}
saveMessage(MessageType.INFO.name(), currentLoc, barcode.getBarcode() + "从料箱隔口号:" + barcode.getPosName() + "出库成功");
//清理条码档案信息
log.info(barcode.getBarcode() + "的库位设置为空");
barcode.setPosName("");
barcode.setOut(false);
barcode.setOrderId("");
......@@ -1416,10 +1436,9 @@ public class CDeviceController {
barcode.setBarSource("");
barcodeManager.save(barcode);
Map<String, String> resultMap = new HashMap<>();
resultMap.put("binCode", boxPar);
//resultMap.put("seq",seq+"");
resultMap.put("seq", seq + "");
resultMap.put("barcode", barcode.getBarcode());
resultMap.put("pickingId", orderNo);
resultMap.put("platSize", barcode.getPlateSize() + "");
......
......@@ -391,6 +391,20 @@ public class ManualGrPutInController {
}
boxBarcode.setSubCodeList(newSubCodeList);
//清除标记
Map<String, String> extraDataMap = boxBarcode.getExtraDataMap();
if (extraDataMap != null && !extraDataMap.isEmpty()){
Map<String, String> resultMap = new HashMap<>();
for (String key: extraDataMap.keySet()) {
if (key.startsWith(CommonUtil.outExpPrefix)){
continue;
}
resultMap.put(key,extraDataMap.get(key));
}
boxBarcode.setExtraDataMap(resultMap);
}
boxBarcode = barcodeManager.save(boxBarcode);
//同时更新pos表
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!