|
|
|
@ -80,11 +80,9 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Override |
|
|
|
public Integer insertMaterial(Map<String, Object> map) { |
|
|
|
if (map.containsKey("quantity") && map.containsKey("price")) { |
|
|
|
int quantity = (int) Math.round(Double.parseDouble(map.get("quantity").toString())); |
|
|
|
if (map.containsKey("price")) { |
|
|
|
int price = (int) (Double.parseDouble(map.get("price").toString()) * 100); |
|
|
|
map.put("price", price); |
|
|
|
map.put("amounts", quantity * price); |
|
|
|
} |
|
|
|
// 判断是否有保质期
|
|
|
|
Integer shelfLife = 0; |
|
|
|
@ -214,10 +212,10 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
map.put("state", state); |
|
|
|
List<Material> list = materialMapper.findMaterialByCondition(map); |
|
|
|
for (Material material : list) { |
|
|
|
if(material.getPrice() != null){ |
|
|
|
if (material.getPrice() != null) { |
|
|
|
|
|
|
|
material.setPrice(material.getPrice() / 100); |
|
|
|
}else{ |
|
|
|
material.setPrice(material.getPrice() / 100); |
|
|
|
} else { |
|
|
|
material.setPrice(0.0); |
|
|
|
} |
|
|
|
material.setAmounts(material.getPrice() * material.getQuantity()); |
|
|
|
@ -267,9 +265,9 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
} |
|
|
|
map.put("state", state); |
|
|
|
List<Material> materialByCondition = materialMapper.findMaterialByCondition(map); |
|
|
|
for (Material material:materialByCondition |
|
|
|
) { |
|
|
|
if(material.getPrice() != null){ |
|
|
|
for (Material material : materialByCondition |
|
|
|
) { |
|
|
|
if (material.getPrice() != null) { |
|
|
|
material.setPrice(material.getPrice() / 100); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -373,7 +371,7 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
} |
|
|
|
List<Material> list = materialMapper.findMaterialByCondition(map); |
|
|
|
for (Material material : list) { |
|
|
|
if(material.getPrice() == null){ |
|
|
|
if (material.getPrice() == null) { |
|
|
|
material.setPrice(0.0); |
|
|
|
} |
|
|
|
material.setPrice(material.getPrice() / 100); |
|
|
|
@ -441,7 +439,7 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
public List<Material> findMaterialAll() { |
|
|
|
List<Material> materialList = materialMapper.findMaterialByCondition(new HashMap<String, Object>()); |
|
|
|
for (Material material : materialList) { |
|
|
|
if(material.getPrice() == null){ |
|
|
|
if (material.getPrice() == null) { |
|
|
|
material.setPrice(0.0); |
|
|
|
} |
|
|
|
material.setPrice(material.getPrice() / 100); |
|
|
|
@ -461,10 +459,10 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
Material material = materialMapper.findMaterialById(id); |
|
|
|
MaterialType materialTypeByOldId = materialTypeMapper.findMaterialTypeByOldId(material.getMaterialTypeId()); |
|
|
|
material.setTypeName(materialTypeByOldId.getTname()); |
|
|
|
if(material.getPrice() != null){ |
|
|
|
if (material.getPrice() != null) { |
|
|
|
|
|
|
|
material.setPrice(material.getPrice() / 100); |
|
|
|
}else{ |
|
|
|
material.setPrice(material.getPrice() / 100); |
|
|
|
} else { |
|
|
|
material.setPrice(0.0); |
|
|
|
} |
|
|
|
material.setAmounts(material.getPrice() * material.getQuantity()); |
|
|
|
@ -501,13 +499,13 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
for (Inventory inventory : inventoryByMid) { |
|
|
|
MaterialType materialTypeByOldId = materialTypeMapper.findMaterialTypeByOldId(inventory.getMaterialTypeId()); |
|
|
|
inventory.setTypeName(materialTypeByOldId.getTname()); |
|
|
|
if(inventory.getPlaceCode() != null){ |
|
|
|
if (inventory.getPlaceCode() != null) { |
|
|
|
|
|
|
|
inventory.setPrice(inventory.getPrice() / 100); |
|
|
|
}else{ |
|
|
|
inventory.setPrice(inventory.getPrice() / 100); |
|
|
|
} else { |
|
|
|
inventory.setPrice(0.0); |
|
|
|
} |
|
|
|
inventory.setAmounts(inventory.getPrice() * inventory.getQuantity()); |
|
|
|
inventory.setAmounts(inventory.getPrice() * inventory.getQuantity()); |
|
|
|
} |
|
|
|
return inventoryByMid; |
|
|
|
} |
|
|
|
@ -621,10 +619,10 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
public List<Inventory> findMaterialByIds(List<Integer> ids) { |
|
|
|
List<Inventory> materialList = materialMapper.findInventoryByIds(ids); |
|
|
|
for (Inventory material : materialList) { |
|
|
|
if(material.getPrice() != null){ |
|
|
|
if (material.getPrice() != null) { |
|
|
|
|
|
|
|
material.setPrice(material.getPrice() / 100); |
|
|
|
}else{ |
|
|
|
material.setPrice(material.getPrice() / 100); |
|
|
|
} else { |
|
|
|
material.setPrice(0.0); |
|
|
|
} |
|
|
|
|
|
|
|
@ -820,7 +818,7 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
splitInventoryForUnit.put(splitInfo.getNewUnit(), saveQuantity); |
|
|
|
|
|
|
|
} |
|
|
|
if(inventory.getPrice() == null){ |
|
|
|
if (inventory.getPrice() == null) { |
|
|
|
inventory.setPrice(0.0); |
|
|
|
} |
|
|
|
BigDecimal bigDecimal = BigDecimal.valueOf(inventory.getPrice() / splitInfo.getQuantity()); |
|
|
|
@ -1095,7 +1093,7 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
if (materialAndBarCode.getIid() != null) { |
|
|
|
Inventory inventoryByMid = materialMapper.findInventoryById(materialAndBarCode.getIid()); |
|
|
|
if (inventoryByMid != null) { |
|
|
|
if(inventoryByMid.getPrice() == null){ |
|
|
|
if (inventoryByMid.getPrice() == null) { |
|
|
|
inventoryByMid.setPrice(0.0); |
|
|
|
} |
|
|
|
materialAndBarCode.setPrice(inventoryByMid.getPrice() / 100); |
|
|
|
@ -1537,7 +1535,7 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
Map<String, Object> insertForSplitInventory = new HashMap<>(); |
|
|
|
insertForSplitInventory.put("mid", inventoryByMid.getMid()); |
|
|
|
insertForSplitInventory.put("mcode", inventoryByMid.getCode()); |
|
|
|
if(inventoryByMid.getPrice() == null){ |
|
|
|
if (inventoryByMid.getPrice() == null) { |
|
|
|
inventoryByMid.setPrice(0.0); |
|
|
|
} |
|
|
|
insertForSplitInventory.put("price", inventoryByMid.getPrice() / scale); |
|
|
|
@ -1555,7 +1553,7 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
// 定义进制时算法需要的参数
|
|
|
|
Map<String, Object> paramForNewMap = new HashMap<>(); |
|
|
|
paramForNewMap.put("mid", inventoryByMid.getMid()); |
|
|
|
if(inventoryByMid.getPrice() == null){ |
|
|
|
if (inventoryByMid.getPrice() == null) { |
|
|
|
inventoryByMid.setPrice(0.0); |
|
|
|
} |
|
|
|
paramForNewMap.put("price", String.valueOf(inventoryByMid.getPrice() / 100)); |
|
|
|
@ -1594,13 +1592,13 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
SplitInfo parentSplitInfo = splitUnitMapper.findSplitInfoById(splitInfo.getParentId()); |
|
|
|
splitUnitService.updateSplitInfoSaveQuantity(parentSplitInfo, dispose, pidAndMidForAfter.getId(), paramForNewMap, quantity, splitInfo); |
|
|
|
} else { |
|
|
|
if(inventoryByMid.getPrice() == null){ |
|
|
|
if (inventoryByMid.getPrice() == null) { |
|
|
|
inventoryByMid.setPrice(0.0); |
|
|
|
} |
|
|
|
paramForNewMap.put("price", Double.toString(inventoryByMid.getPrice() / 100)); |
|
|
|
paramForNewMap.put("realQuantity", String.valueOf(dispose)); |
|
|
|
paramForNewMap.put("quantity", String.valueOf(dispose)); |
|
|
|
depositoryRecordService.applicationInPlace(paramForNewMap,false); |
|
|
|
depositoryRecordService.applicationInPlace(paramForNewMap, false); |
|
|
|
depositoryRecordMapper.deleteApplicationInRecordById(ObjectFormatUtil.toInteger(paramForNewMap.get("id"))); |
|
|
|
} |
|
|
|
// 调用新算法
|
|
|
|
@ -1641,13 +1639,13 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
SplitInfo parentSplitInfo = splitUnitMapper.findSplitInfoById(splitInfo.getParentId()); |
|
|
|
splitUnitService.updateSplitInfoSaveQuantity(parentSplitInfo, dispose, pidAndMidForAfter.getId(), paramForNewMap, quantity, splitInfo); |
|
|
|
} else { |
|
|
|
if(inventoryByMid.getPrice() == null){ |
|
|
|
if (inventoryByMid.getPrice() == null) { |
|
|
|
inventoryByMid.setPrice(0.0); |
|
|
|
} |
|
|
|
paramForNewMap.put("price", Double.toString(inventoryByMid.getPrice() / 100)); |
|
|
|
paramForNewMap.put("realQuantity", String.valueOf(dispose)); |
|
|
|
paramForNewMap.put("quantity", String.valueOf(dispose)); |
|
|
|
depositoryRecordService.applicationInPlace(paramForNewMap,false); |
|
|
|
depositoryRecordService.applicationInPlace(paramForNewMap, false); |
|
|
|
depositoryRecordMapper.deleteApplicationInRecordById(ObjectFormatUtil.toInteger(paramForNewMap.get("id"))); |
|
|
|
} |
|
|
|
} else { |
|
|
|
@ -1690,13 +1688,13 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
SplitInfo parentSplitInfo = splitUnitMapper.findSplitInfoById(splitInfo.getParentId()); |
|
|
|
splitUnitService.updateSplitInfoSaveQuantity(parentSplitInfo, dispose, ObjectFormatUtil.toInteger(insertForSplitInventory.get("id")), paramForNewMap, quantity, splitInfo); |
|
|
|
} else { |
|
|
|
if(inventoryByMid.getPrice() == null){ |
|
|
|
if (inventoryByMid.getPrice() == null) { |
|
|
|
inventoryByMid.setPrice(0.0); |
|
|
|
} |
|
|
|
paramForNewMap.put("price", Double.toString(inventoryByMid.getPrice() / 100)); |
|
|
|
paramForNewMap.put("realQuantity", String.valueOf(dispose)); |
|
|
|
paramForNewMap.put("quantity", String.valueOf(dispose)); |
|
|
|
depositoryRecordService.applicationInPlace(paramForNewMap,false); |
|
|
|
depositoryRecordService.applicationInPlace(paramForNewMap, false); |
|
|
|
depositoryRecordMapper.deleteApplicationInRecordById(ObjectFormatUtil.toInteger(paramForNewMap.get("id"))); |
|
|
|
} |
|
|
|
|
|
|
|
@ -2419,7 +2417,6 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 构造树形组件数据模板
|
|
|
|
public Map<String, Object> InitTreeMenus_New(MaterialType mt, List<Object> children) { |
|
|
|
if (mt != null) { |
|
|
|
@ -2585,6 +2582,7 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取当前仓库列表下的库存数量 |
|
|
|
* |
|
|
|
* @param depositoryIds 待查询仓库列表 |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
|