Commit 468d4c82 LN

1.入库单执行时出错。

2.库存报表数量错误。
1 个父辈 7c8bc054
...@@ -735,15 +735,41 @@ public class Barcode extends BasePo implements Serializable { ...@@ -735,15 +735,41 @@ public class Barcode extends BasePo implements Serializable {
if (subCodeList == null) { if (subCodeList == null) {
subCodeList = new ArrayList<>(); subCodeList = new ArrayList<>();
} }
if (subCodeList == null || subCodeList.isEmpty()) { if (subCodeList .size()<=0|| subCodeList.isEmpty()) {
subCodeList.add(subCode); subCodeList.add(subCode);
} else { } else {
//移除 //移除
subCodeList.removeIf(t -> t.getBarcode().equals(subCode.getBarcode())); subCodeList.removeIf(t -> t.getBarcode().equals(subCode.getBarcode()));
if (subCode.getAmount() > 0){
subCodeList.add(subCode); subCodeList.add(subCode);
} }
}
subListNum=subCodeList.size(); subListNum=subCodeList.size();
} }
public String getEmptySubName(){
int maxNum=getMaxSubNum();
if(subCodeList==null){
subCodeList=new ArrayList<>();
}
for (int i=1 ;i<=maxNum;i++
) {
String sName=barcode+"-"+i;
boolean has=false;
for (Barcode sub :
subCodeList) {
if(sub.getBarcode().equals(sName)){
has=true;
break;
}
}
if(has){
continue;
}else{
return sName;
}
}
return "";
}
} }
...@@ -580,13 +580,21 @@ public class DataCache { ...@@ -580,13 +580,21 @@ public class DataCache {
* @param amount * @param amount
* @return * @return
*/ */
public int updateInventoryAmount(String cid,String partNumber,int amount){ public int updateInventoryAmount(String cid,String partNumber,int amount,String pn,String wcode){
if(amount != 0){ if(amount != 0){
log.info("updateInventoryAmount : cid="+cid+",pn="+partNumber+",amount="+amount); if(ObjectUtil.isEmpty(pn)){
pn="";
}
if(ObjectUtil.isEmpty(wcode)){
wcode="";
}
log.info("updateInventoryAmount : cid="+cid+",pn="+partNumber+",amount="+amount+",pn="+pn);
InventoryItem inventoryItem = getStorageInventoryByPartNumber(cid,partNumber); InventoryItem inventoryItem = getStorageInventoryByPartNumber(cid,partNumber);
if(inventoryItem == null){ if(inventoryItem == null){
inventoryItem = new InventoryItem(); inventoryItem = new InventoryItem();
inventoryItem.setPartNumber(partNumber); inventoryItem.setPartNumber(partNumber);
inventoryItem.setWareHouseCode(wcode);
inventoryItem.setPartname(pn);
} }
inventoryItem.updateInventory(amount); inventoryItem.updateInventory(amount);
updateStorageInventory(cid, inventoryItem); updateStorageInventory(cid, inventoryItem);
......
...@@ -54,10 +54,19 @@ public class InventoryItem { ...@@ -54,10 +54,19 @@ public class InventoryItem {
*/ */
private String storageName ; private String storageName ;
/**
* 库别
*/
private String wareHouseCode; private String wareHouseCode;
private String posName; private String posName;
/**
* 格口号
*/
private String gekouName; private String gekouName;
/**
* 品名
*/
private String partname; private String partname;
/** /**
......
...@@ -842,7 +842,7 @@ public class OutLineController { ...@@ -842,7 +842,7 @@ public class OutLineController {
List<Barcode> subCodeList = barcode.getSubCodeList(); List<Barcode> subCodeList = barcode.getSubCodeList();
if (subCodeList != null && !subCodeList.isEmpty()) { if (subCodeList != null && !subCodeList.isEmpty()) {
for (Barcode subCode : subCodeList) { for (Barcode subCode : subCodeList) {
dataCache.updateInventoryAmount(dataCache.getStorageById(pos.getStorageId()).getCid(), subCode.getPartNumber(), -subCode.getAmount()); dataCache.updateInventoryAmount(dataCache.getStorageById(pos.getStorageId()).getCid(), subCode.getPartNumber(), -subCode.getAmount(),subCode.getPn(),pos.getWareHouseCode());
} }
} }
} }
...@@ -880,7 +880,7 @@ public class OutLineController { ...@@ -880,7 +880,7 @@ public class OutLineController {
for (Barcode subCode : subCodeList) { for (Barcode subCode : subCodeList) {
subCode.setStorageId(storage.getId()); subCode.setStorageId(storage.getId());
barcodeManager.save(subCode); barcodeManager.save(subCode);
dataCache.updateInventoryAmount(storage.getCid(), subCode.getPartNumber(), subCode.getAmount()); dataCache.updateInventoryAmount(storage.getCid(), subCode.getPartNumber(), subCode.getAmount(),subCode.getPn(),pos.getWareHouseCode());
} }
} }
barcode.setSubCodeList(subCodeList); barcode.setSubCodeList(subCodeList);
......
...@@ -412,7 +412,7 @@ public class SpAgvDeviceClientController { ...@@ -412,7 +412,7 @@ public class SpAgvDeviceClientController {
for (Barcode subCode : subCodes) { for (Barcode subCode : subCodes) {
subCode.setStorageId(storage.getId()); subCode.setStorageId(storage.getId());
barcodeManager.save(subCode); barcodeManager.save(subCode);
dataCache.updateInventoryAmount(storage.getCid(), subCode.getPartNumber(), subCode.getAmount()); dataCache.updateInventoryAmount(storage.getCid(), subCode.getPartNumber(), subCode.getAmount(),subCode.getPn(),storagePos.getWareHouseCode());
} }
} }
barcode.setSubCodeList(subCodes); barcode.setSubCodeList(subCodes);
...@@ -473,7 +473,7 @@ public class SpAgvDeviceClientController { ...@@ -473,7 +473,7 @@ public class SpAgvDeviceClientController {
if (subCodes != null && !subCodes.isEmpty()) { if (subCodes != null && !subCodes.isEmpty()) {
Storage storage = dataCache.getStorageById(storagePos.getStorageId()); Storage storage = dataCache.getStorageById(storagePos.getStorageId());
for (Barcode subCode : subCodes) { for (Barcode subCode : subCodes) {
dataCache.updateInventoryAmount(storage.getCid(), subCode.getPartNumber(), -subCode.getAmount()); dataCache.updateInventoryAmount(storage.getCid(), subCode.getPartNumber(), -subCode.getAmount(),subCode.getPn(),storagePos.getWareHouseCode());
} }
} }
} }
......
...@@ -221,7 +221,7 @@ public class SpBoxCheckOutController { ...@@ -221,7 +221,7 @@ public class SpBoxCheckOutController {
//更新库存 //更新库存
Storage storage=dataCache.getStorageById(pos.getStorageId()); Storage storage=dataCache.getStorageById(pos.getStorageId());
dataCache.updateInventoryAmount(storage.getCid(),codeBarcode.getPartNumber(), -codeBarcode.getQty()); // dataCache.updateInventoryAmount(storage.getCid(),codeBarcode.getPartNumber(), -codeBarcode.getQty());
if(liteOrder!=null){ if(liteOrder!=null){
handleOrderNo(liteOrder,gekouBarcode.getPartNumber(),taskOutNum); handleOrderNo(liteOrder,gekouBarcode.getPartNumber(),taskOutNum);
......
...@@ -55,7 +55,7 @@ public class SpBoxPutInController { ...@@ -55,7 +55,7 @@ public class SpBoxPutInController {
String currentRfid = station.getCurrentRfid(); String currentRfid = station.getCurrentRfid();
if(ObjectUtil.isEmpty(currentRfid)){ if(ObjectUtil.isEmpty(currentRfid)){
if(LuxsanSpApi.Debug){ if(LuxsanSpApi.Debug){
currentRfid="CB0066A"; currentRfid="CS9999";
} }
} }
// log.info("getStationInfo工位上"+currentRfid); // log.info("getStationInfo工位上"+currentRfid);
......
...@@ -226,7 +226,7 @@ public class SpBoxPutInManagerImpl implements ISpBoxPutInManager { ...@@ -226,7 +226,7 @@ public class SpBoxPutInManagerImpl implements ISpBoxPutInManager {
barcodeManager.save(boxBarcode); barcodeManager.save(boxBarcode);
//更新库存 //更新库存
Storage storage = dataCache.getStorageById(pos.getStorageId()); Storage storage = dataCache.getStorageById(pos.getStorageId());
dataCache.updateInventoryAmount(storage.getCid(), codeBarcode.getPartNumber(), codeBarcode.getQty()); // dataCache.updateInventoryAmount(storage.getCid(), codeBarcode.getPartNumber(), codeBarcode.getQty());
Map<String, String> res = new HashMap<>(); Map<String, String> res = new HashMap<>();
res.put("PN", codeBarcode.getPartNumber()); res.put("PN", codeBarcode.getPartNumber());
......
...@@ -280,15 +280,20 @@ public class SpareNoCache { ...@@ -280,15 +280,20 @@ public class SpareNoCache {
StoragePos emptyPos = null; StoragePos emptyPos = null;
for (StoragePos exPos : for (StoragePos exPos :
needOutPos.values()) { needOutPos.values()) {
int subCount = exPos.getBarcode().getMaxSubNum(); // int subCount = exPos.getBarcode().getMaxSubNum();
if (exPos.getBarcode().getSubCodeList().size() < subCount) { // if (exPos.getBarcode().getSubCodeList().size() < subCount) {
//验证库别 // //验证库别
if(exPos.getWareHouseCode().equals(baseNo.getWhCode())){ // if(exPos.getWareHouseCode().equals(baseNo.getWhCode())){
// emptyPos = exPos;
// break;
// }
// }
String epPos=exPos.getBarcode().getEmptySubName();
if(ObjectUtil.isNotEmpty(epPos)){
emptyPos = exPos; emptyPos = exPos;
break; break;
} }
} }
}
Barcode emptyBox = null; Barcode emptyBox = null;
//TODO 查找空格口是必须要是同一个库别的 //TODO 查找空格口是必须要是同一个库别的
...@@ -296,17 +301,25 @@ public class SpareNoCache { ...@@ -296,17 +301,25 @@ public class SpareNoCache {
if (emptyPos != null) { if (emptyPos != null) {
//使用此格口 //使用此格口
emptyBox = emptyPos.getBarcode(); emptyBox = emptyPos.getBarcode();
newPn.setBarcode(emptyBox.getBarcode() + "-" + emptyBox.getSubCodeList().size()); String emptySubPn=emptyBox.getEmptySubName();
newPn.setBarcode(emptySubPn);
newPn = barcodeManager.saveBarcode(newPn); newPn = barcodeManager.saveBarcode(newPn);
List<Barcode> subL = emptyBox.getSubCodeList(); // List<Barcode> subL = emptyBox.getSubCodeList();
subL.add(newPn); // subL.add(newPn);
emptyBox.setSubCodeList(subL); // emptyBox.setSubCodeList(subL);
emptyBox.updateSubCodes(newPn);
barcodeManager.save(emptyBox);
emptyPos.setBarcode(emptyBox); emptyPos.setBarcode(emptyBox);
storagePosManager.save(emptyPos);
needOutPos.put(emptyPos.getPosName(),emptyPos); needOutPos.put(emptyPos.getPosName(),emptyPos);
log.info("入库单" + orderNo + ", Pn=" + pn + ",使用料箱的空格口=" + emptyPos.getPosName() + ",料箱号=" + emptyBox.getBarcode() + ",格口号=" + newPn.getBarcode() + ",需要入库数量=" + detail.getInQty()); log.info("入库单" + orderNo + ", Pn=" + pn + ",使用料箱的空格口=" + emptyPos.getPosName() + ",料箱号=" + emptyBox.getBarcode() + ",格口号=" + newPn.getBarcode() + ",需要入库数量=" + detail.getInQty());
} else { } else {
Collection<String> excludePosIds = taskService.excludePosIds(); Collection<String> excludePosIds = taskService.excludePosIds();
for (StoragePos exPos :
needOutPos.values()) {
excludePosIds.add(exPos.getId());
}
//寻找一个空格口 //寻找一个空格口
List<String> boxTypes = new ArrayList<>(); List<String> boxTypes = new ArrayList<>();
boxTypes.add(""); boxTypes.add("");
...@@ -323,18 +336,25 @@ public class SpareNoCache { ...@@ -323,18 +336,25 @@ public class SpareNoCache {
} }
if (emptyPos != null) { if (emptyPos != null) {
emptyBox = emptyPos.getBarcode(); emptyBox = emptyPos.getBarcode();
newPn.setBarcode(emptyBox.getBarcode() + "-" + (emptyBox.getSubCodeList() == null ? 1 : emptyBox.getSubCodeList().size())); // newPn.setBarcode(emptyBox.getBarcode() + "-" + (emptyBox.getSubCodeList() == null ? 1 : emptyBox.getSubCodeList().size()));
// newPn = barcodeManager.save(newPn);
String emptySubPn=emptyBox.getEmptySubName();
newPn.setBarcode(emptySubPn);
newPn = barcodeManager.saveBarcode(newPn); newPn = barcodeManager.saveBarcode(newPn);
List<Barcode> subL = emptyBox.getSubCodeList(); // newPn = barcodeManager.save(newPn);
if (subL == null) { // newPn = barcodeManager.saveBarcode(newPn);
subL = new ArrayList<>(); // List<Barcode> subL = emptyBox.getSubCodeList();
} // if (subL == null) {
subL.add(newPn); // subL = new ArrayList<>();
emptyBox.setSubCodeList(subL); // }
// subL.add(newPn);
// emptyBox.setSubCodeList(subL);
emptyBox.updateSubCodes(newPn);
emptyBox.setOut(false); emptyBox.setOut(false);
emptyBox.setStatus(BARCODE_STATUS.IN_STORE); emptyBox.setStatus(BARCODE_STATUS.IN_STORE);
barcodeManager.save(emptyBox);
emptyPos.setBarcode(emptyBox); emptyPos.setBarcode(emptyBox);
storagePosManager.save(emptyPos);
needOutPos.put(emptyPos.getPosName(), emptyPos); needOutPos.put(emptyPos.getPosName(), emptyPos);
log.info("入库单" + orderNo + ", Pn=" + pn + "," + type + "查找到有空格口料箱=" + emptyPos.getPosName() + ",料箱号=" + emptyBox.getBarcode() + ",格口号=" + newPn.getBarcode() + ",需要入库数量=" + detail.getInQty()); log.info("入库单" + orderNo + ", Pn=" + pn + "," + type + "查找到有空格口料箱=" + emptyPos.getPosName() + ",料箱号=" + emptyBox.getBarcode() + ",格口号=" + newPn.getBarcode() + ",需要入库数量=" + detail.getInQty());
...@@ -353,7 +373,7 @@ public class SpareNoCache { ...@@ -353,7 +373,7 @@ public class SpareNoCache {
for (StoragePos pos : needOutPos.values() for (StoragePos pos : needOutPos.values()
) { ) {
Barcode barcode = pos.getBarcode(); Barcode barcode = pos.getBarcode();
log.info("入库单" + orderNo + ", 为库位=" + pos.getPosName() + ",料箱=" + barcode.getBarcode() + "生成出库任务:" + index); log.info("入库单" + orderNo + ", 为库位=" + pos.getPosName() + ",料箱=" + barcode.getBarcode() + "生成出库任务:" + (index+1));
pos.setBarcode(barcode); pos.setBarcode(barcode);
barcodeManager.save(barcode); barcodeManager.save(barcode);
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!