Commit ab9dcf15 LN

库存报表却分满料数量和非满料数量

1 个父辈 44310ce5
...@@ -367,7 +367,8 @@ public class DataCache { ...@@ -367,7 +367,8 @@ public class DataCache {
for (Storage storage : all) { for (Storage storage : all) {
List<PlateSizeBean> plateSizeBeanList = storagePosManager.getStoragePosUsage(storage.getId()); List<PlateSizeBean> plateSizeBeanList = storagePosManager.getStoragePosUsage(storage.getId());
storage.initUsage(plateSizeBeanList); int fullReelCount=storagePosManager.getUseCount(storage.getId(),1 );
storage.initUsage(plateSizeBeanList,fullReelCount);
map.put(storage.getCid(), storage); map.put(storage.getCid(), storage);
...@@ -433,7 +434,8 @@ public class DataCache { ...@@ -433,7 +434,8 @@ public class DataCache {
} }
List<PlateSizeBean> plateSizeBeanList = storagePosManager.getStoragePosUsage(storage.getId()); List<PlateSizeBean> plateSizeBeanList = storagePosManager.getStoragePosUsage(storage.getId());
storage.initUsage(plateSizeBeanList); int fullReelCount=storagePosManager.getUseCount(storage.getId(),1 );
storage.initUsage(plateSizeBeanList,fullReelCount);
storage = storageManager.save(storage); storage = storageManager.save(storage);
allStorage.put(storage.getCid(), storage); allStorage.put(storage.getCid(), storage);
return storage; return storage;
...@@ -730,6 +732,9 @@ public class DataCache { ...@@ -730,6 +732,9 @@ public class DataCache {
//出库 //出库
amount = -barcode.getAmount(); amount = -barcode.getAmount();
storage.emptyOnePos(pos); storage.emptyOnePos(pos);
//需要更新存储的满料的数量
int fullReelCount=storagePosManager.getUseCount(storage.getId(),1);
storage.setFullReelCount(fullReelCount);
updateSpUsePosCount(storage, pos, -1); updateSpUsePosCount(storage, pos, -1);
removeUsedPosList(cid, pos ); removeUsedPosList(cid, pos );
} else { } else {
......
...@@ -119,7 +119,8 @@ public class ReportController { ...@@ -119,7 +119,8 @@ public class ReportController {
posCount+=item.getTotalCount(); posCount+=item.getTotalCount();
usePosCount+=item.getUsedCount(); usePosCount+=item.getUsedCount();
} }
InventoryBoxDto boxDto = new InventoryBoxDto(storage.getId(), storage.getName(), storage.getCid(),storage.getType(), storage.getUsageMap(),posCount,usePosCount); int fullReelCount=storage.getFullReelCount();
InventoryBoxDto boxDto = new InventoryBoxDto(storage.getId(), storage.getName(), storage.getCid(),storage.getType(), storage.getUsageMap(),posCount,usePosCount,fullReelCount);
boxDtos.add(boxDto); boxDtos.add(boxDto);
} }
if (boxDtos.size() > 0) { if (boxDtos.size() > 0) {
......
...@@ -36,4 +36,6 @@ public class InventoryBoxDto implements Serializable { ...@@ -36,4 +36,6 @@ public class InventoryBoxDto implements Serializable {
@ApiModelProperty("已使用库位数量") @ApiModelProperty("已使用库位数量")
private Integer usedPosCount; private Integer usedPosCount;
@ApiModelProperty("已存储的满料数量")
private Integer fullReelCount;
} }
...@@ -88,4 +88,7 @@ public interface IStoragePosManager extends IBaseManager<StoragePos> { ...@@ -88,4 +88,7 @@ public interface IStoragePosManager extends IBaseManager<StoragePos> {
List<StoragePos> findInStoragesByPN( Collection<String> excludePosIds,String pn,CHECKOUT_TYPE checkOutType ); List<StoragePos> findInStoragesByPN( Collection<String> excludePosIds,String pn,CHECKOUT_TYPE checkOutType );
int getUseCount(String storageId, int type);
} }
...@@ -42,6 +42,23 @@ public class StoragePosManagerImpl implements IStoragePosManager { ...@@ -42,6 +42,23 @@ public class StoragePosManagerImpl implements IStoragePosManager {
private IStoragePosDao storagePosDao; private IStoragePosDao storagePosDao;
@Override @Override
public int getUseCount(String storageId, int type) {
Criteria c = Criteria.where("storageId").is(storageId)
.and("enabled").is(true)
.and("barcode").exists(true);
if (type == 1) {
c = c.orOperator(
Criteria.where("barcode.xrayCount").exists(false),
Criteria.where("barcode.xrayCount").lt(1)
);
} else if (type == 2) {
c = c.and("barcode.xrayCount").gte(1);
}
Query q = new Query(c);
return storagePosDao.countByQuery(q);
}
@Override
public List<PlateSizeBean> getStoragePosUsage(String storageId){ public List<PlateSizeBean> getStoragePosUsage(String storageId){
Aggregation agg = Aggregation.newAggregation( Aggregation agg = Aggregation.newAggregation(
Aggregation.match(Criteria.where("storageId").is(storageId).and("enabled").is(true)), Aggregation.match(Criteria.where("storageId").is(storageId).and("enabled").is(true)),
......
...@@ -3,7 +3,6 @@ package com.neotel.smfcore.core.storage.service.po; ...@@ -3,7 +3,6 @@ package com.neotel.smfcore.core.storage.service.po;
import com.neotel.smfcore.common.base.BasePo; import com.neotel.smfcore.common.base.BasePo;
import com.neotel.smfcore.core.storage.enums.COMPATIBLE_TYPE; import com.neotel.smfcore.core.storage.enums.COMPATIBLE_TYPE;
import com.neotel.smfcore.core.storage.enums.DeviceType; import com.neotel.smfcore.core.storage.enums.DeviceType;
import com.neotel.smfcore.common.utils.StorageConstants;
import com.neotel.smfcore.core.barcode.bean.PlateSizeBean; import com.neotel.smfcore.core.barcode.bean.PlateSizeBean;
import com.neotel.smfcore.core.storage.bean.UsageItem; import com.neotel.smfcore.core.storage.bean.UsageItem;
import lombok.Data; import lombok.Data;
...@@ -26,6 +25,8 @@ public class Storage extends BasePo implements Serializable { ...@@ -26,6 +25,8 @@ public class Storage extends BasePo implements Serializable {
private String cid; private String cid;
private int totalSlots; private int totalSlots;
private int emptySlots; private int emptySlots;
//存储的满料的数量
private int fullReelCount =0;
/** /**
* 兼容类型:完全匹配,完全兼容,同尺寸兼容 * 兼容类型:完全匹配,完全兼容,同尺寸兼容
...@@ -254,6 +255,11 @@ public class Storage extends BasePo implements Serializable { ...@@ -254,6 +255,11 @@ public class Storage extends BasePo implements Serializable {
usageMap.put(sizeStr, usageItem); usageMap.put(sizeStr, usageItem);
} }
} }
if(pos.getBarcode()!=null&&pos.getBarcode().getXrayCount()>=1){
}else{
setFullReelCount(fullReelCount+1);
}
} }
public void emptyOnePos(StoragePos pos){ public void emptyOnePos(StoragePos pos){
...@@ -269,7 +275,7 @@ public class Storage extends BasePo implements Serializable { ...@@ -269,7 +275,7 @@ public class Storage extends BasePo implements Serializable {
} }
} }
public void initUsage(List<PlateSizeBean> plateSizeBeanList){ public void initUsage(List<PlateSizeBean> plateSizeBeanList,int fullReelCount ){
usageMap = new ConcurrentHashMap<>(); usageMap = new ConcurrentHashMap<>();
int totalPosCount = 0; int totalPosCount = 0;
int emptyPosCount = 0; int emptyPosCount = 0;
...@@ -296,6 +302,8 @@ public class Storage extends BasePo implements Serializable { ...@@ -296,6 +302,8 @@ public class Storage extends BasePo implements Serializable {
} }
this.setEmptySlots(emptyPosCount); this.setEmptySlots(emptyPosCount);
this.setTotalSlots(totalPosCount); this.setTotalSlots(totalPosCount);
this.setFullReelCount(fullReelCount);
} }
public boolean IsRightGroup(String groupId) { public boolean IsRightGroup(String groupId) {
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!