Commit 1ea87e8f LN

上传库位时若库位号已在其他料仓存在,不新增库位。

1 个父辈 e18aad70
......@@ -548,6 +548,21 @@ public class StorageController {
}
}
if(newList.size()>0){
//判断库位号是否在其他料仓存在
List<String> list = new ArrayList<>();
newList.forEach(pos -> list.add(pos.getPosName()));
List<StoragePos> existPoss = storagePosManager.findExistPosList(storage.getId(), list);
if (existPoss.size() > 0) {
String msg = "读取到["+row+"]行数据:新增【"+newRowCount+"】失败,已存在【"+existRowCount+"】,更新【" +updateRowCount +"】";
log.info(msg);
List<String> existPosName = new ArrayList<>();
existPoss.forEach(pos -> existPosName.add(pos.getPosName()));
log.error("为["+storage.getName()+"]导入库位时,库位号【"+String.join(",", existPosName)+"】已在其他料仓存在,不新增库位");
throw new ValidateException("smfcore.storage.error.posNameExist", "库位号已存在{0}", new String[]{String.join(",", existPosName)});
}
storagePosManager.insertAll(newList);
}
dataCache.reloadStorage(storage,"");
......
......@@ -85,4 +85,6 @@ public interface IStoragePosManager extends IBaseManager<StoragePos> {
StoragePos findMpnInStorages(List<String> availableStorageIds, String mpn, Collection<String> excludePosIds, CHECKOUT_TYPE checkoutType,Map<String,String> appendData);
List<StoragePos> findExpiredOrSluggishBarcode(Date date,int type);
List<StoragePos> findExistPosList(String id, List<String> list);
}
......@@ -803,4 +803,14 @@ public class StoragePosManagerImpl implements IStoragePosManager {
}
return storagePosDao.findByQuery(q.addCriteria(c));
}
@Override
public List<StoragePos> findExistPosList(String storageId, List<String> posNames) {
if(posNames == null || posNames.isEmpty()){
return Lists.newArrayList();
}
Criteria c = Criteria.where("storageId").ne(storageId)
.and("posName").in(posNames);
Query q = new Query(c);
return storagePosDao.findByQuery(q);
}
}
......@@ -351,6 +351,7 @@ smfcore.mesApi.inCheck.error=MES\u9A8C\u8BC1\u51FA\u9519\uFF1A{0}
smfcore.mesApi.loginCheck.fail=MES\u767B\u9646\u9A8C\u8BC1\u5931\u8D25
smfcore.mesApi.loginCheck.error=MES\u767B\u9646\u9A8C\u8BC1\u9519\u8BEF\uFF1A{0}
smfcore.lockMaterials=\u9501\u5B9A\u7269\u6599
smfcore.storage.error.posNameExist=\u5E93\u4F4D\u53F7\u5DF2\u5728\u5176\u4ED6\u6599\u4ED3\u5B58\u5728\uFF1A{0}
#smfclient.nlp.onlyOneTray=\u4E0D\u53EF\u540C\u65F6\u653E\u5165\u591A\u76D8\u7269\u6599:{0}
#smfclient.nlp.cannotFindPos={0}\u672A\u627E\u5230\u5E93\u4F4D:{1}
#smfclient.nlp.inputOk={0}\u5165\u5E93\u5230{1}\u6210\u529F
......
......@@ -349,4 +349,5 @@ smfcore.selfAudit.noPos=Self Audit{0}No depot number found
smfcore.mesApi.inCheck.error=MES verification error\uFF1A{0}
smfcore.mesApi.loginCheck.fail=MES Login fail
smfcore.mesApi.loginCheck.error=MES Login error\uFF1A{0}
smfcore.lockMaterials=Locking Materials
\ No newline at end of file
smfcore.lockMaterials=Locking Materials
smfcore.storage.error.posNameExist=Bin number already exists in other bins\uFF1A{0}
\ No newline at end of file
......@@ -346,4 +346,5 @@ smfcore.selfAudit.noPos=\u76D8\u70B9{0}\u672A\u627E\u5230\u5E93\u4F4D\u53F7
smfcore.mesApi.inCheck.error=MES\u9A8C\u8BC1\u51FA\u9519\uFF1A{0}
smfcore.mesApi.loginCheck.fail=MES\u767B\u9646\u9A8C\u8BC1\u5931\u8D25
smfcore.mesApi.loginCheck.error=MES\u767B\u9646\u9A8C\u8BC1\u9519\u8BEF\uFF1A{0}
smfcore.lockMaterials=\u9501\u5B9A\u7269\u6599
\ No newline at end of file
smfcore.lockMaterials=\u9501\u5B9A\u7269\u6599
smfcore.storage.error.posNameExist=\u5E93\u4F4D\u53F7\u5DF2\u5728\u5176\u4ED6\u6599\u4ED3\u5B58\u5728\uFF1A{0}
\ No newline at end of file
......@@ -346,4 +346,5 @@ smfcore.selfAudit.noPos=\u76D8\u70B9{0}\u672A\u627E\u5230\u5E93\u4F4D\u53F7
smfcore.mesApi.inCheck.error=MES\u9A8C\u8BC1\u51FA\u9519\uFF1A{0}
smfcore.mesApi.loginCheck.fail=MES\u767B\u9646\u9A8C\u8BC1\u5931\u8D25
smfcore.mesApi.loginCheck.error=MES\u767B\u9646\u9A8C\u8BC1\u9519\u8BEF\uFF1A{0}
smfcore.lockMaterials=\u9501\u5B9A\u7269\u6599
\ No newline at end of file
smfcore.lockMaterials=\u9501\u5B9A\u7269\u6599
smfcore.storage.error.posNameExist=\u5E93\u4F4D\u53F7\u5DF2\u5728\u5176\u4ED6\u6599\u4ED3\u5B58\u5728\uFF1A{0}
\ No newline at end of file
......@@ -347,4 +347,5 @@ smfcore.selfAudit.noPos=\u76E4\u9EDE{0}\u672A\u627E\u5230\u5EAB\u4F4D\u865F
smfcore.mesApi.inCheck.error=MES\u9A57\u8B49\u51FA\u932F\uFF1A{0}
smfcore.mesApi.loginCheck.fail=MES\u767B\u9678\u9A57\u8B49\u5931\u6557
smfcore.mesApi.loginCheck.error=MES\u767B\u9678\u9A57\u8B49\u932F\u8AA4\uFF1A{0}
smfcore.lockMaterials=\u9396\u5B9A\u7269\u6599
\ No newline at end of file
smfcore.lockMaterials=\u9396\u5B9A\u7269\u6599
smfcore.storage.error.posNameExist=\u5EAB\u4F4D\u865F\u5DF2\u5728\u5176\u4ED6\u6599\u5009\u5B58\u5728\uFF1A{0}
\ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!