Commit 466dc68e hjh

PN出库增加供货商

1 个父辈 12c1121a
...@@ -426,7 +426,7 @@ public class DataCache { ...@@ -426,7 +426,7 @@ public class DataCache {
*/ */
public boolean lockOneReel(String cid, String partNumber){ public boolean lockOneReel(String cid, String partNumber){
boolean result = false; boolean result = false;
InventoryItem inventoryItem = getStorageInventoryByPartNumber(cid, partNumber); InventoryItem inventoryItem = getStorageInventoryByPartNumber(cid, partNumber,"");
if(inventoryItem != null) { if(inventoryItem != null) {
int lockReel = inventoryItem.getLockReel(); int lockReel = inventoryItem.getLockReel();
//理论上这里是同一个对象,不需要再显式的放入map 中 //理论上这里是同一个对象,不需要再显式的放入map 中
...@@ -440,7 +440,7 @@ public class DataCache { ...@@ -440,7 +440,7 @@ public class DataCache {
* 解除锁定库存(出库任务完成或取消时调用) * 解除锁定库存(出库任务完成或取消时调用)
*/ */
public void unLockOneReel(String cid, String partNumber){ public void unLockOneReel(String cid, String partNumber){
InventoryItem partNumberInventory = getStorageInventoryByPartNumber(cid, partNumber); InventoryItem partNumberInventory = getStorageInventoryByPartNumber(cid, partNumber,"");
if(partNumberInventory != null) { if(partNumberInventory != null) {
int lockReel = partNumberInventory.getLockReel(); int lockReel = partNumberInventory.getLockReel();
//理论上这里是同一个对象,不需要再显式的放入map 中 //理论上这里是同一个对象,不需要再显式的放入map 中
...@@ -467,18 +467,27 @@ public class DataCache { ...@@ -467,18 +467,27 @@ public class DataCache {
Map<String, InventoryItem> resultMap = new HashMap<>(); Map<String, InventoryItem> resultMap = new HashMap<>();
for (InventoryItem item : map.values()) { for (InventoryItem item : map.values()) {
if (ObjectUtil.isNotEmpty(blurry)) { if (ObjectUtil.isNotEmpty(blurry)) {
if (item.getPartNumber().contains(blurry)) { if (item.getPartNumber().contains(blurry) || item.getProvider().contains(blurry)) {
resultMap.put(item.getPartNumberAndProvider(), item); resultMap.put(item.getPartNumberAndProvider(), item);
// resultMap.put(item.getPartNumber(), item);
} }
} else { } else {
resultMap.put(item.getPartNumberAndProvider(), item); resultMap.put(item.getPartNumberAndProvider(), item);
// resultMap.put(item.getPartNumber(), item);
} }
} }
return resultMap; return resultMap;
} }
/**
* 获取料仓的库存信息
*/
public Map<String, InventoryItem> getStorageInventory(String cid){
Map<String, InventoryItem> storageInventory = inventoryMap.get(cid);
if(storageInventory == null){
storageInventory = initInventory(cid);
}
return storageInventory;
}
/** /**
* 获取某些料仓的库存信息 * 获取某些料仓的库存信息
...@@ -514,27 +523,15 @@ public class DataCache { ...@@ -514,27 +523,15 @@ public class DataCache {
return resultMap; return resultMap;
} }
/**
* 获取料仓的库存信息
*/
public Map<String, InventoryItem> getStorageInventory(String cid){
Map<String, InventoryItem> storageInventory = inventoryMap.get(cid);
if(storageInventory == null){
storageInventory = initInventory(cid);
}
return storageInventory;
}
public InventoryItem getStorageInventoryByPartNumber(String cid, String partNumber){ public InventoryItem getStorageInventoryByPartNumber(String cid, String partNumber,String provider){
Map<String, InventoryItem> storageInventory = getStorageInventory(cid); Map<String, InventoryItem> storageInventory = getStorageInventory(cid);
// 修改 InventoryItem partNumberInventoryItem = storageInventory.get(partNumber+"_"+provider);
InventoryItem partNumberInventoryItem = storageInventory.get(partNumber);
if(partNumberInventoryItem == null){ if(partNumberInventoryItem == null){
partNumberInventoryItem = new InventoryItem(); partNumberInventoryItem = new InventoryItem();
partNumberInventoryItem.setPartNumber(partNumber); partNumberInventoryItem.setPartNumber(partNumber);
// 添加供货商 // 添加供货商
partNumberInventoryItem.setProvider(""); partNumberInventoryItem.setProvider(provider);
} }
return partNumberInventoryItem; return partNumberInventoryItem;
} }
...@@ -569,12 +566,13 @@ public class DataCache { ...@@ -569,12 +566,13 @@ 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,String provider,int amount){
if(amount != 0){ if(amount != 0){
InventoryItem inventoryItem = getStorageInventoryByPartNumber(cid,partNumber); InventoryItem inventoryItem = getStorageInventoryByPartNumber(cid,partNumber,provider);
if(inventoryItem == null){ if(inventoryItem == null){
inventoryItem = new InventoryItem(); inventoryItem = new InventoryItem();
inventoryItem.setPartNumber(partNumber); inventoryItem.setPartNumber(partNumber);
inventoryItem.setProvider(provider);
} }
inventoryItem.updateInventory(amount); inventoryItem.updateInventory(amount);
updateStorageInventory(cid, inventoryItem); updateStorageInventory(cid, inventoryItem);
...@@ -591,6 +589,7 @@ public class DataCache { ...@@ -591,6 +589,7 @@ public class DataCache {
String cid = storage.getCid(); String cid = storage.getCid();
String partNumber = barcode.getPartNumber(); String partNumber = barcode.getPartNumber();
String provider = barcode.getProvider();
int amount = 0; int amount = 0;
String sizeStr = pos.getSizeStr(); String sizeStr = pos.getSizeStr();
if(pos.getBarcode() == null){ if(pos.getBarcode() == null){
...@@ -609,12 +608,12 @@ public class DataCache { ...@@ -609,12 +608,12 @@ public class DataCache {
} }
} }
allStorage.put(cid, storage); allStorage.put(cid, storage);
return updateInventoryAmount(cid,partNumber,amount); return updateInventoryAmount(cid,partNumber,provider,amount);
} }
private void updateStorageInventory(String cid, InventoryItem inventoryItem){ private void updateStorageInventory(String cid, InventoryItem inventoryItem){
Map<String, InventoryItem> storageInventory = inventoryMap.get(cid); Map<String, InventoryItem> storageInventory = inventoryMap.get(cid);
storageInventory.put(inventoryItem.getPartNumber(), inventoryItem); storageInventory.put(inventoryItem.getPartNumberAndProvider(), inventoryItem);
inventoryMap.put(cid, storageInventory); inventoryMap.put(cid, storageInventory);
} }
public List<String> getCidsByGroupId(String groupId,boolean nullReturnAll){ public List<String> getCidsByGroupId(String groupId,boolean nullReturnAll){
......
...@@ -123,7 +123,7 @@ public class MaterialController { ...@@ -123,7 +123,7 @@ public class MaterialController {
} }
} }
Comparator<InventoryItemDto> comparator = Comparator.comparing(InventoryItemDto::getPartNumber); Comparator<InventoryItemDto> comparator = Comparator.comparing(InventoryItemDto::getPartNumber).thenComparing(InventoryItemDto::getProvider);
Sort.Order lockReelOrder = pageable.getSort().getOrderFor("lockReel"); Sort.Order lockReelOrder = pageable.getSort().getOrderFor("lockReel");
if(lockReelOrder != null){ if(lockReelOrder != null){
comparator = Comparator.comparing(InventoryItemDto::getStockReel,Comparator.nullsFirst(Integer::compareTo)); comparator = Comparator.comparing(InventoryItemDto::getStockReel,Comparator.nullsFirst(Integer::compareTo));
......
...@@ -69,10 +69,11 @@ public class StoragePosManagerImpl implements IStoragePosManager { ...@@ -69,10 +69,11 @@ public class StoragePosManagerImpl implements IStoragePosManager {
} }
Aggregation agg = Aggregation.newAggregation( Aggregation agg = Aggregation.newAggregation(
Aggregation.match(c), Aggregation.match(c),
Aggregation.group("barcode.partNumber") Aggregation.group("barcode.partNumber","barcode.provider")
.first("barcode.provider").as("provider") .first("barcode.provider").as("provider")
.first("barcode.partNumber").as("partNumber")
.sum("barcode.amount").as("stockCount").count().as("stockReel"), .sum("barcode.amount").as("stockCount").count().as("stockReel"),
Aggregation.project("stockCount", "stockReel", "provider").and("partNumber").previousOperation() Aggregation.project("stockCount", "stockReel", "provider","partNumber")
); );
AggregationResults<InventoryItem> results = storagePosDao.getMongoTemplate().aggregate(agg, StoragePos.class, InventoryItem.class); AggregationResults<InventoryItem> results = storagePosDao.getMongoTemplate().aggregate(agg, StoragePos.class, InventoryItem.class);
return results.getMappedResults(); return results.getMappedResults();
...@@ -120,7 +121,7 @@ public class StoragePosManagerImpl implements IStoragePosManager { ...@@ -120,7 +121,7 @@ public class StoragePosManagerImpl implements IStoragePosManager {
} }
inventoryMap.put(expireInventoryItem.getPartNumberAndProvider(), inventoryItem); inventoryMap.put(expireInventoryItem.getPartNumberAndProvider(), inventoryItem);
} }
//统计2个小时内即将过期的 // 统计2个小时内即将过期的
int inHours = 2; int inHours = 2;
List<InventoryItem> willExpireInventory = expireInventory(type, inHours, storageIds); List<InventoryItem> willExpireInventory = expireInventory(type, inHours, storageIds);
for (InventoryItem wiilExpireInventoryItem : willExpireInventory) { for (InventoryItem wiilExpireInventoryItem : willExpireInventory) {
...@@ -342,7 +343,7 @@ public class StoragePosManagerImpl implements IStoragePosManager { ...@@ -342,7 +343,7 @@ public class StoragePosManagerImpl implements IStoragePosManager {
c.and("labelId").is(labelId); c.and("labelId").is(labelId);
} }
if (ObjectUtil.isNotEmpty(provider)) { if (ObjectUtil.isNotEmpty(provider)) {
c.and("provider").is(provider); c.and("barcode.provider").is(provider);
} }
Query q = new Query(c); Query q = new Query(c);
//Sort sort = getSortByCheckOutType(checkOutType); //Sort sort = getSortByCheckOutType(checkOutType);
......
...@@ -471,7 +471,7 @@ public class AgvBoxDeviceClientController { ...@@ -471,7 +471,7 @@ public class AgvBoxDeviceClientController {
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.getProvider(), subCode.getAmount());
} }
} }
barcode.setSubCodeList(subCodes); barcode.setSubCodeList(subCodes);
...@@ -530,7 +530,7 @@ public class AgvBoxDeviceClientController { ...@@ -530,7 +530,7 @@ public class AgvBoxDeviceClientController {
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.getProvider(), -subCode.getAmount());
} }
} }
} }
......
...@@ -874,7 +874,7 @@ public class OutLineController { ...@@ -874,7 +874,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.getProvider(), -subCode.getAmount());
} }
} }
} }
...@@ -912,7 +912,7 @@ public class OutLineController { ...@@ -912,7 +912,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.getProvider(),subCode.getAmount());
} }
} }
barcode.setSubCodeList(subCodeList); barcode.setSubCodeList(subCodeList);
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!