Commit d8f273dd LN

1

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