给单据的序列号和批号增加重复的校验
This commit is contained in:
@@ -419,12 +419,20 @@ public class DepotItemService {
|
||||
}
|
||||
}
|
||||
if (StringUtil.isExist(rowObj.get("batchNumber"))) {
|
||||
depotItem.setBatchNumber(rowObj.getString("batchNumber"));
|
||||
//入库的时候批号不能重复
|
||||
Long bnCount = depotItemMapperEx.getCountByMaterialAndBatchNumber(materialExtend.getId(), rowObj.getString("batchNumber"), "入库");
|
||||
if(bnCount == 0) {
|
||||
depotItem.setBatchNumber(rowObj.getString("batchNumber"));
|
||||
} else {
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_BATCH_NUMBERE_EXISTS_CODE,
|
||||
String.format(ExceptionConstants.DEPOT_HEAD_BATCH_NUMBERE_EXISTS_MSG, barCode));
|
||||
}
|
||||
|
||||
} else {
|
||||
//批号不能为空
|
||||
if(BusinessConstants.ENABLE_BATCH_NUMBER_ENABLED.equals(material.getEnableBatchNumber())) {
|
||||
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_BATCH_NUMBERE_EMPTY_CODE,
|
||||
String.format(ExceptionConstants.MATERIAL_BATCH_NUMBERE_EMPTY_MSG, barCode));
|
||||
throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_BATCH_NUMBERE_EMPTY_CODE,
|
||||
String.format(ExceptionConstants.DEPOT_HEAD_BATCH_NUMBERE_EMPTY_MSG, barCode));
|
||||
}
|
||||
}
|
||||
if (StringUtil.isExist(rowObj.get("expirationDate"))) {
|
||||
|
||||
@@ -418,6 +418,9 @@ public class SerialNumberService {
|
||||
serialNumber.setUpdater(userInfo == null ? null : userInfo.getId());
|
||||
serialNumber.setInBillNo(inBillNo);
|
||||
serialNumberMapper.insertSelective(serialNumber);
|
||||
} else {
|
||||
throw new BusinessRunTimeException(ExceptionConstants.SERIAL_NUMBERE_ALREADY_EXISTS_CODE,
|
||||
String.format(ExceptionConstants.SERIAL_NUMBERE_ALREADY_EXISTS_MSG, sn));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user