Commit b540bcfd LN

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

1 个父辈 435a42a7
......@@ -546,7 +546,22 @@ public class StorageController {
}
}
}
if(newList.size()>0){
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,"");
......
......@@ -11,8 +11,6 @@ import com.neotel.smfcore.core.storage.service.po.StoragePos;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.core.query.Query;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;
public interface IStoragePosManager extends IBaseManager<StoragePos> {
......@@ -85,4 +83,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,15 @@ 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);
}
}
......@@ -344,6 +344,7 @@ smfcore.task.updatePutInFail=\u5165\u5E93\u4EFB\u52A1{0}[{1}]\u4E0D\u80FD\u66F4\
smfcore.saveOk=\u4FDD\u5B58\u6210\u529F
smfcore.lockMaterials=\u9501\u5B9A\u7269\u6599
smfcore.emptyOut.fail=\u4EFB\u52A1[{0}]\u7A7A\u51FA\u5904\u7406\u5931\u8D25:{1}
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
......
......@@ -343,4 +343,5 @@ smfcore.selfAudit.noPos=Self Audit{0}No depot number found
smfcore.task.updatePutInFail=Cannot update the status of the inbound task {0}[{1}] to {2}
smfcore.saveOk=save successfully
smfcore.lockMaterials=Locking Materials
smfcore.emptyOut.fail=Task [{0}] empty processing failure:{1}
\ No newline at end of file
smfcore.emptyOut.fail=Task [{0}] empty processing failure:{1}
smfcore.storage.error.posNameExist=Bin number already exists in other bins\uFF1A{0}
\ No newline at end of file
......@@ -340,4 +340,5 @@ smfcore.selfAudit.noPos=\u76D8\u70B9{0}\u672A\u627E\u5230\u5E93\u4F4D\u53F7
smfcore.task.updatePutInFail=\u5165\u5E93\u4EFB\u52A1{0}[{1}]\u4E0D\u80FD\u66F4\u65B0\u72B6\u6001\u4E3A{2}
smfcore.saveOk=\u4FDD\u5B58\u6210\u529F
smfcore.lockMaterials=\u9501\u5B9A\u7269\u6599
smfcore.emptyOut.fail=\u4EFB\u52A1[{0}]\u7A7A\u51FA\u5904\u7406\u5931\u8D25:{1}
\ No newline at end of file
smfcore.emptyOut.fail=\u4EFB\u52A1[{0}]\u7A7A\u51FA\u5904\u7406\u5931\u8D25:{1}
smfcore.storage.error.posNameExist=\u5E93\u4F4D\u53F7\u5DF2\u5728\u5176\u4ED6\u6599\u4ED3\u5B58\u5728\uFF1A{0}
\ No newline at end of file
......@@ -340,4 +340,5 @@ smfcore.selfAudit.noPos=\u76D8\u70B9{0}\u672A\u627E\u5230\u5E93\u4F4D\u53F7
smfcore.task.updatePutInFail=\u5165\u5E93\u4EFB\u52A1{0}[{1}]\u4E0D\u80FD\u66F4\u65B0\u72B6\u6001\u4E3A{2}
smfcore.saveOk=\u4FDD\u5B58\u6210\u529F
smfcore.lockMaterials=\u9501\u5B9A\u7269\u6599
smfcore.emptyOut.fail=\u4EFB\u52A1[{0}]\u7A7A\u51FA\u5904\u7406\u5931\u8D25:{1}
\ No newline at end of file
smfcore.emptyOut.fail=\u4EFB\u52A1[{0}]\u7A7A\u51FA\u5904\u7406\u5931\u8D25:{1}
smfcore.storage.error.posNameExist=\u5E93\u4F4D\u53F7\u5DF2\u5728\u5176\u4ED6\u6599\u4ED3\u5B58\u5728\uFF1A{0}
\ No newline at end of file
......@@ -341,4 +341,5 @@ smfcore.selfAudit.noPos=\u76E4\u9EDE{0}\u672A\u627E\u5230\u5EAB\u4F4D\u865F
smfcore.task.updatePutInFail=\u5165\u5EAB\u4EFB\u52D9{0}[{1}]\u4E0D\u80FD\u66F4\u65B0\u72C0\u614B\u70BA{2}
smfcore.saveOk=\u4FDD\u5B58\u6210\u529F
smfcore.lockMaterials=\u9396\u5B9A\u7269\u6599
smfcore.emptyOut.fail=\u4EFB\u52D9[{0}]\u7A7A\u51FA\u8655\u7406\u5931\u6557:{1}
\ No newline at end of file
smfcore.emptyOut.fail=\u4EFB\u52D9[{0}]\u7A7A\u51FA\u8655\u7406\u5931\u6557:{1}
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!