|
|
@ -62,7 +62,21 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
map.put("price",price); |
|
|
map.put("price",price); |
|
|
map.put("amounts",quantity * price); |
|
|
map.put("amounts",quantity * price); |
|
|
} |
|
|
} |
|
|
materialMapper.addBarCodeAndMcode(map); |
|
|
// 获取当前类型
|
|
|
|
|
|
if(map.containsKey("typeId")) { |
|
|
|
|
|
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()); |
|
|
|
|
|
if (materialByType == null) { |
|
|
|
|
|
materialByType = new ArrayList<>(); |
|
|
|
|
|
} |
|
|
|
|
|
map.put("code", code + String.format("%04d", materialByType.size() + 1)); |
|
|
|
|
|
} |
|
|
|
|
|
if(map.containsKey("barCode")){ |
|
|
|
|
|
materialMapper.addBarCodeAndMcode(map); |
|
|
|
|
|
} |
|
|
return materialMapper.insertMaterial(map); |
|
|
return materialMapper.insertMaterial(map); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -96,8 +110,8 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
map.put("price",price); |
|
|
map.put("price",price); |
|
|
} |
|
|
} |
|
|
if(map.containsKey("materialTypeId")) { |
|
|
if(map.containsKey("materialTypeId")) { |
|
|
Object materialTypeId = map.get("materialTypeId"); |
|
|
map.put("typeId", map.get("materialTypeId")); |
|
|
map.put("typeId", materialTypeId); |
|
|
map.remove("materialTypeId"); |
|
|
} |
|
|
} |
|
|
String barCode = (String) map.get("barCode"); |
|
|
String barCode = (String) map.get("barCode"); |
|
|
if(!"0".equals(barCode)) { |
|
|
if(!"0".equals(barCode)) { |
|
|
@ -223,7 +237,7 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
public Material findMaterialByCode(Long code) { |
|
|
public Material findMaterialByCode(String code) { |
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
map.put("code",code); |
|
|
map.put("code",code); |
|
|
Material material = materialMapper.findMaterialByCondition(map).get(0); |
|
|
Material material = materialMapper.findMaterialByCondition(map).get(0); |
|
|
@ -363,7 +377,7 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
m.setDepositoryName(depositoryMapper.findDepositoryNameById(depositoryId)); |
|
|
m.setDepositoryName(depositoryMapper.findDepositoryNameById(depositoryId)); |
|
|
m.setWarehouseManager(depositoryMapper.findUserNameByDepositoryId(depositoryId)); |
|
|
m.setWarehouseManager(depositoryMapper.findUserNameByDepositoryId(depositoryId)); |
|
|
} |
|
|
} |
|
|
m.setTypeName(materialTypeMapper.findMaterialTypeNameById(material.getTypeId())); |
|
|
m.setTypeName(materialTypeMapper.findMaterialTypeNameByOldId(material.getTypeId())); |
|
|
result.add(m); |
|
|
result.add(m); |
|
|
} |
|
|
} |
|
|
return result; |
|
|
return result; |
|
|
@ -557,7 +571,7 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
for (int i = 0; i < materialTypeNoParent.size(); i++) { |
|
|
for (int i = 0; i < materialTypeNoParent.size(); i++) { |
|
|
// 获取当前顶级类别
|
|
|
// 获取当前顶级类别
|
|
|
MaterialType mt = materialTypeNoParent.get(i); |
|
|
MaterialType mt = materialTypeNoParent.get(i); |
|
|
List<Object> childForMaterialTypeByParent = findChildForMaterialTypeByParent(mt.getId(),mname,adminorg); |
|
|
List<Object> childForMaterialTypeByParent = findChildForMaterialTypeByParent(mt.getOldId(),mname,adminorg); |
|
|
Map<String, Object> stringObjectMap = new HashMap<>(); |
|
|
Map<String, Object> stringObjectMap = new HashMap<>(); |
|
|
if(childForMaterialTypeByParent != null) { |
|
|
if(childForMaterialTypeByParent != null) { |
|
|
stringObjectMap = InitTreeMenus(mt, childForMaterialTypeByParent); |
|
|
stringObjectMap = InitTreeMenus(mt, childForMaterialTypeByParent); |
|
|
@ -583,7 +597,7 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
MaterialType mt = materialTypeNoParent.get(i); |
|
|
MaterialType mt = materialTypeNoParent.get(i); |
|
|
Future<Object> objectFuture = taskCenterUtil.submitTask(() -> { |
|
|
Future<Object> objectFuture = taskCenterUtil.submitTask(() -> { |
|
|
List<Object> childForMaterialTypeByParent = findChildForMaterialTypeByParent(mt.getId(), mname, ""); |
|
|
List<Object> childForMaterialTypeByParent = findChildForMaterialTypeByParent(mt.getOldId(), mname, ""); |
|
|
Map<String, Object> stringObjectMap = new HashMap<>(); |
|
|
Map<String, Object> stringObjectMap = new HashMap<>(); |
|
|
if (childForMaterialTypeByParent != null) { |
|
|
if (childForMaterialTypeByParent != null) { |
|
|
stringObjectMap = InitTreeMenus(mt, childForMaterialTypeByParent); |
|
|
stringObjectMap = InitTreeMenus(mt, childForMaterialTypeByParent); |
|
|
@ -610,7 +624,7 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
if(mt != null) { |
|
|
if(mt != null) { |
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
map.put("title", mt.getTname()); |
|
|
map.put("title", mt.getTname()); |
|
|
map.put("id", mt.getId()); |
|
|
map.put("id", mt.getOldId()); |
|
|
map.put("children",children); |
|
|
map.put("children",children); |
|
|
return map; |
|
|
return map; |
|
|
} |
|
|
} |
|
|
@ -623,21 +637,21 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
public List<Object> AddMaterialByType(MaterialType mt,String mname,String adminorg){ |
|
|
public List<Object> AddMaterialByType(MaterialType mt,String mname,String adminorg){ |
|
|
if(mt != null) { |
|
|
if(mt != null) { |
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
param.put("materialTypeId", mt.getId()); |
|
|
param.put("materialTypeId", mt.getOldId()); |
|
|
// 获取当前部门管理的仓库
|
|
|
|
|
|
List<Depository> depositoryByAdminorg = depositoryMapper.findDepositoryByAdminorg(adminorg); |
|
|
|
|
|
List<Integer> dids = new ArrayList<>(); |
|
|
|
|
|
for (Depository depository : depositoryByAdminorg) { |
|
|
|
|
|
// 将仓库编号存储到列表中
|
|
|
|
|
|
dids.add(depository.getId()); |
|
|
|
|
|
} |
|
|
|
|
|
List<Material> materialPByCondition = new ArrayList<>(); |
|
|
List<Material> materialPByCondition = new ArrayList<>(); |
|
|
// List<Material> materialByDepositorys = new ArrayList<>();
|
|
|
// List<Material> materialByDepositorys = new ArrayList<>();
|
|
|
if("".equals(adminorg)){ |
|
|
if("".equals(adminorg)){ |
|
|
// 获取当前类别下的物料
|
|
|
// 获取当前类别下的物料
|
|
|
materialPByCondition = materialMapper.findMaterialByCondition(param); |
|
|
materialPByCondition = materialMapper.findMaterialByCondition(param); |
|
|
}else{ |
|
|
}else{ |
|
|
|
|
|
// 获取当前部门管理的仓库
|
|
|
|
|
|
List<Depository> depositoryByAdminorg = depositoryMapper.findDepositoryByAdminorg(adminorg); |
|
|
// 获取当前仓库下的所有物料库存
|
|
|
// 获取当前仓库下的所有物料库存
|
|
|
|
|
|
List<Integer> dids = new ArrayList<>(); |
|
|
|
|
|
for (Depository depository : depositoryByAdminorg) { |
|
|
|
|
|
// 将仓库编号存储到列表中
|
|
|
|
|
|
dids.add(depository.getId()); |
|
|
|
|
|
} |
|
|
param.put("list",dids); |
|
|
param.put("list",dids); |
|
|
materialPByCondition = materialMapper.findMaterialByDepositorysAndType(param); |
|
|
materialPByCondition = materialMapper.findMaterialByDepositorysAndType(param); |
|
|
} |
|
|
} |
|
|
@ -700,10 +714,9 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 根据类别id获取子类
|
|
|
// 根据类别id获取子类
|
|
|
public List<Object> findChildForMaterialTypeByParent(Integer id,String mname,String adminorg){ |
|
|
public List<Object> findChildForMaterialTypeByParent(Long id,String mname,String adminorg){ |
|
|
Map<String,Object> param = new HashMap<>(); |
|
|
Map<String,Object> param = new HashMap<>(); |
|
|
List<Object> result = new ArrayList<>(); |
|
|
List<Object> result = new ArrayList<>(); |
|
|
Map<String,Object> children = new HashMap<>(); |
|
|
|
|
|
param.put("parentId",id); |
|
|
param.put("parentId",id); |
|
|
// 获取当前父类的子类
|
|
|
// 获取当前父类的子类
|
|
|
List<MaterialType> materialTypeByCondition = materialTypeMapper.findMaterialTypeByCondition(param); |
|
|
List<MaterialType> materialTypeByCondition = materialTypeMapper.findMaterialTypeByCondition(param); |
|
|
@ -711,7 +724,7 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
// 如果当前类别有子类
|
|
|
// 如果当前类别有子类
|
|
|
for (MaterialType mt : materialTypeByCondition) { |
|
|
for (MaterialType mt : materialTypeByCondition) { |
|
|
// 递归直至到最底层子类
|
|
|
// 递归直至到最底层子类
|
|
|
List<Object> childForMaterialTypeByParent = findChildForMaterialTypeByParent(mt.getId(),mname,adminorg); |
|
|
List<Object> childForMaterialTypeByParent = findChildForMaterialTypeByParent(mt.getOldId(),mname,adminorg); |
|
|
Map<String, Object> stringObjectMap = null; |
|
|
Map<String, Object> stringObjectMap = null; |
|
|
if(childForMaterialTypeByParent == null) { |
|
|
if(childForMaterialTypeByParent == null) { |
|
|
// 如果当前类别没有子类
|
|
|
// 如果当前类别没有子类
|
|
|
|