Commit d8f273dd LN

1

1 个父辈 614d16c2
......@@ -179,7 +179,7 @@ public class SpareNoCache {
return "已在执行中";
}
log.info("开始执行 入库单 [" +orderNo + "] ");
log.info("开始执行 入库单 [" + orderNo + "] ");
List<StoragePos> needOutPos = new ArrayList<>();
List<String> storageIdList = new ArrayList<>();
......@@ -187,6 +187,8 @@ public class SpareNoCache {
storageIdList.add(storage.getId());
}
//先查找pn存在的箱子
List<SpareNoDetail> noPnDetial = new ArrayList<>();
for (SpareNoDetail detail : baseNo.getDetailList()) {
String pn = detail.getPartno();
......@@ -202,7 +204,7 @@ public class SpareNoCache {
if (subBarcode.getPartNumber().equals(pn)) {
subBarcode.setOut(false);
subBarcode.updateExtraData("needInNum", detail.getInQty() + "");
log.info("入库单" + orderNo+ ", Pn=" + pn + ",查找到库位号=" + pos.getPosName() + ",料箱号=" + boxBarcode.getBarcode() + ",格口号=" + subBarcode.getBarcode() + ",需要入库数量=" + detail.getInQty());
log.info("入库单" + orderNo + ", Pn=" + pn + ",查找到库位号=" + pos.getPosName() + ",料箱号=" + boxBarcode.getBarcode() + ",格口号=" + subBarcode.getBarcode() + ",需要入库数量=" + detail.getInQty());
}
}
boxBarcode.setOut(false);
......@@ -210,65 +212,71 @@ public class SpareNoCache {
needOutPos.add(pos);
} else {
noPnDetial.add(detail);
}
Barcode newPn = new Barcode();
newPn.setPn(pn);
newPn.setAmount(0);
newPn.setInitialAmount(0);
newPn.setOut(false);
newPn.updateExtraData("needInNum", detail.getInQty() + "");
//查找准备出库的料箱中是否有空格口
StoragePos emptyPos = null;
for (StoragePos exPos :
needOutPos) {
int subCount = SpBoxUtil.GetBoxSubCount(exPos.getBarcode().getBarcode());
if (exPos.getBarcode().getSubCodeList().size() < subCount) {
emptyPos = exPos;
break;
}
}
//PN不存在,需要查找空箱
for (SpareNoDetail detail : noPnDetial) {
String pn = detail.getPartno();
Barcode newPn = new Barcode();
newPn.setPn(pn);
newPn.setAmount(0);
newPn.setInitialAmount(0);
newPn.setOut(false);
newPn.updateExtraData("needInNum", detail.getInQty() + "");
//查找准备出库的料箱中是否有空格口
StoragePos emptyPos = null;
for (StoragePos exPos :
needOutPos) {
int subCount = SpBoxUtil.GetBoxSubCount(exPos.getBarcode().getBarcode());
if (exPos.getBarcode().getSubCodeList().size() < subCount) {
emptyPos = exPos;
break;
}
}
Barcode emptyBox = null;
if (emptyPos != null) {
//使用此格口
emptyBox = emptyPos.getBarcode();
newPn.setBarcode(emptyBox.getBarcode() + "-" + emptyBox.getSubCodeList().size());
newPn = barcodeManager.saveBarcode(newPn);
List<Barcode> subL = emptyBox.getSubCodeList();
subL.add(newPn);
emptyBox.setSubCodeList(subL);
log.info("入库单" + orderNo + ", Pn=" + pn + ",使用料箱的空格口=" + emptyPos.getPosName() + ",料箱号=" + emptyBox.getBarcode() + ",格口号=" + newPn.getBarcode() + ",需要入库数量=" + detail.getInQty());
Barcode emptyBox = null;
if (emptyPos != null) {
//使用此格口
} else {
Collection<String> excludePosIds = taskService.excludePosIds();
//寻找一个空格口
List<String> boxTypes = new ArrayList<>();
boxTypes.add("CS");
boxTypes.add("CB");
boxTypes.add("CM");
for (String type :
boxTypes) {
int count = SpBoxUtil.GetBoxSubCount(type);
emptyPos = storagePosManager.findEmptyBoxToPutIn(storageIdList, pn, excludePosIds, dataCache.getCheckOutType(), type, count);
emptyBox = emptyPos.getBarcode();
newPn.setBarcode(emptyBox.getBarcode() + "-" + emptyBox.getSubCodeList().size());
newPn = barcodeManager.saveBarcode(newPn);
List<Barcode> subL = emptyBox.getSubCodeList();
subL.add(newPn);
emptyBox.setSubCodeList(subL);
log.info("入库单" + orderNo + ", Pn=" + pn + ",使用料箱的空格口=" + pos.getPosName() + ",料箱号=" + emptyBox.getBarcode() + ",格口号=" + newPn.getBarcode() + ",需要入库数量=" + detail.getInQty());
} else {
excludePosIds = taskService.excludePosIds();
//寻找一个空格口
List<String> boxTypes = new ArrayList<>();
boxTypes.add("CS");
boxTypes.add("CB");
boxTypes.add("CM");
for (String type :
boxTypes) {
int count = SpBoxUtil.GetBoxSubCount(type);
emptyPos = storagePosManager.findEmptyBoxToPutIn(storageIdList, pn, excludePosIds, dataCache.getCheckOutType(), type, count);
emptyBox = emptyPos.getBarcode();
if (pos != null) {
newPn.setBarcode(emptyBox.getBarcode() + "-" + emptyBox.getSubCodeList().size());
newPn = barcodeManager.saveBarcode(newPn);
List<Barcode> subL = emptyBox.getSubCodeList();
subL.add(newPn);
emptyBox.setSubCodeList(subL);
emptyBox.setOut(false);
emptyBox.setStatus(BARCODE_STATUS.IN_STORE);
needOutPos.add(pos);
log.info("入库单" + orderNo + ", Pn=" + pn + "," + type + "查找到有空格口料箱=" + pos.getPosName() + ",料箱号=" + emptyBox.getBarcode() + ",格口号=" + newPn.getBarcode() + ",需要入库数量=" + detail.getInQty());
break;
} else {
log.info("入库单" + orderNo + ", Pn=" + pn + "," + type + "未找到可用的空料箱=");
}
}
if (emptyPos != null) {
newPn.setBarcode(emptyBox.getBarcode() + "-" + emptyBox.getSubCodeList().size());
newPn = barcodeManager.saveBarcode(newPn);
List<Barcode> subL = emptyBox.getSubCodeList();
subL.add(newPn);
emptyBox.setSubCodeList(subL);
emptyBox.setOut(false);
emptyBox.setStatus(BARCODE_STATUS.IN_STORE);
needOutPos.add(emptyPos);
log.info("入库单" + orderNo + ", Pn=" + pn + "," + type + "查找到有空格口料箱=" + emptyPos.getPosName() + ",料箱号=" + emptyBox.getBarcode() + ",格口号=" + newPn.getBarcode() + ",需要入库数量=" + detail.getInQty());
break;
} else {
log.info("入库单" + orderNo + ", Pn=" + pn + "," + type + "未找到可用的空料箱=");
}
}
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!