解决序列号会重复新增的bug
This commit is contained in:
@@ -473,6 +473,13 @@ public class SerialNumberService {
|
||||
public void addSerialNumberByBill(Long materialId, Long depotId, String snList) throws Exception {
|
||||
List<String> snArr = StringUtil.strToStringList(snList);
|
||||
for(String sn: snArr) {
|
||||
List<SerialNumber> list = new ArrayList<>();
|
||||
SerialNumberExample example = new SerialNumberExample();
|
||||
example.createCriteria().andMaterialIdEqualTo(materialId).andSerialNumberEqualTo(sn)
|
||||
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
list = serialNumberMapper.selectByExample(example);
|
||||
//判断如果不存在重复序列号就新增
|
||||
if(list == null || list.size() == 0) {
|
||||
SerialNumber serialNumber = new SerialNumber();
|
||||
serialNumber.setMaterialId(materialId);
|
||||
serialNumber.setDepotId(depotId);
|
||||
@@ -487,3 +494,4 @@ public class SerialNumberService {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user