Commit 468d4c82 LN

1.入库单执行时出错。

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