Commit 466dc68e hjh

PN出库增加供货商

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