|
|
|
@ -112,12 +112,15 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
Integer typeId = ObjectFormatUtil.toInteger(map.get("typeId").toString()); |
|
|
|
MaterialType materialTypeById = materialTypeMapper.findMaterialTypeById(typeId); |
|
|
|
map.put("materialTypeId", materialTypeById.getOldId()); |
|
|
|
String code = materialTypeById.getOldId().toString(); |
|
|
|
List<Material> materialByType = materialMapper.findMaterialByType(materialTypeById.getOldId()); |
|
|
|
String newCode = ""; |
|
|
|
if (materialByType == null) { |
|
|
|
materialByType = new ArrayList<>(); |
|
|
|
newCode = String.format("%04d", 1); |
|
|
|
} else { |
|
|
|
newCode = String.format("%04d",Integer.parseInt(materialByType.get(materialByType.size() - 1).getCode()) + 1); |
|
|
|
|
|
|
|
} |
|
|
|
map.put("code", code + String.format("%04d", materialByType.size() + 1)); |
|
|
|
map.put("code",newCode); |
|
|
|
} |
|
|
|
if (map.containsKey("barCode")) { |
|
|
|
materialMapper.addBarCodeAndMcode(map); |
|
|
|
|