|
|
@ -149,10 +149,6 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
public Integer updateMaterial(Map<String, Object> map) { |
|
|
public Integer updateMaterial(Map<String, Object> map) { |
|
|
if (map.containsKey("price")) { |
|
|
if (map.containsKey("price")) { |
|
|
Double price = Double.parseDouble((String) map.get("price")) * 100; |
|
|
Double price = Double.parseDouble((String) map.get("price")) * 100; |
|
|
Integer quantity = Integer.parseInt((String) map.get("quantity")); |
|
|
|
|
|
if (!map.containsKey("amounts")) { |
|
|
|
|
|
map.put("amounts", price * quantity); |
|
|
|
|
|
} |
|
|
|
|
|
map.put("price", price); |
|
|
map.put("price", price); |
|
|
} |
|
|
} |
|
|
// 判断是否有保质期
|
|
|
// 判断是否有保质期
|
|
|
@ -218,8 +214,13 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
map.put("state", state); |
|
|
map.put("state", state); |
|
|
List<Material> list = materialMapper.findMaterialByCondition(map); |
|
|
List<Material> list = materialMapper.findMaterialByCondition(map); |
|
|
for (Material material : list) { |
|
|
for (Material material : list) { |
|
|
|
|
|
if(material.getPrice() != null){ |
|
|
|
|
|
|
|
|
material.setPrice(material.getPrice() / 100); |
|
|
material.setPrice(material.getPrice() / 100); |
|
|
material.setAmounts(material.getAmounts() / 100); |
|
|
}else{ |
|
|
|
|
|
material.setPrice(0.0); |
|
|
|
|
|
} |
|
|
|
|
|
material.setAmounts(material.getPrice() * material.getQuantity()); |
|
|
// 获取当前物料所处仓库
|
|
|
// 获取当前物料所处仓库
|
|
|
Integer depositoryId = material.getDepositoryId(); |
|
|
Integer depositoryId = material.getDepositoryId(); |
|
|
// 获取当前物料所处库位
|
|
|
// 获取当前物料所处库位
|
|
|
@ -245,6 +246,7 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 根据条件查询符合条件的物料信息(用于表格展示) |
|
|
* 根据条件查询符合条件的物料信息(用于表格展示) |
|
|
|
|
|
* |
|
|
* @param map 条件map |
|
|
* @param map 条件map |
|
|
* @return 符合条件的物料信息 |
|
|
* @return 符合条件的物料信息 |
|
|
*/ |
|
|
*/ |
|
|
@ -302,8 +304,13 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
map.put("state", state); |
|
|
map.put("state", state); |
|
|
List<Inventory> list = materialMapper.findInventory(map); |
|
|
List<Inventory> list = materialMapper.findInventory(map); |
|
|
for (Inventory inventory : list) { |
|
|
for (Inventory inventory : list) { |
|
|
|
|
|
if (inventory.getPrice() != null) { |
|
|
|
|
|
|
|
|
inventory.setPrice(inventory.getPrice() / 100); |
|
|
inventory.setPrice(inventory.getPrice() / 100); |
|
|
inventory.setAmounts(inventory.getAmounts() / 100); |
|
|
} else { |
|
|
|
|
|
inventory.setPrice(0.0); |
|
|
|
|
|
} |
|
|
|
|
|
inventory.setAmounts(inventory.getPrice() * inventory.getQuantity()); |
|
|
// 获取当前物料所处仓库
|
|
|
// 获取当前物料所处仓库
|
|
|
Integer depositoryId = inventory.getDepositoryId(); |
|
|
Integer depositoryId = inventory.getDepositoryId(); |
|
|
// 获取当前物料所处库位
|
|
|
// 获取当前物料所处库位
|
|
|
@ -325,6 +332,7 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 根据物料编码及所处仓库查询库存 |
|
|
* 根据物料编码及所处仓库查询库存 |
|
|
|
|
|
* |
|
|
* @param map 待查询条件 |
|
|
* @param map 待查询条件 |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
@ -357,13 +365,16 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
map.put("begin", (page - 1) * size); |
|
|
map.put("begin", (page - 1) * size); |
|
|
} |
|
|
} |
|
|
List<Material> list = materialMapper.findMaterialByCondition(map); |
|
|
List<Material> list = materialMapper.findMaterialByCondition(map); |
|
|
for (int i = 0; i < list.size(); i++) { |
|
|
for (Material material : list) { |
|
|
list.get(i).setPrice(list.get(i).getPrice() / 100); |
|
|
if(material.getPrice() == null){ |
|
|
list.get(i).setAmounts(list.get(i).getAmounts() / 100); |
|
|
material.setPrice(0.0); |
|
|
|
|
|
} |
|
|
|
|
|
material.setPrice(material.getPrice() / 100); |
|
|
|
|
|
material.setAmounts(material.getPrice() * material.getQuantity()); |
|
|
// 获取当前物料所处仓库
|
|
|
// 获取当前物料所处仓库
|
|
|
Integer depositoryId = list.get(i).getDepositoryId(); |
|
|
Integer depositoryId = material.getDepositoryId(); |
|
|
// 获取当前物料所处库位
|
|
|
// 获取当前物料所处库位
|
|
|
Integer mid = list.get(i).getId(); |
|
|
Integer mid = material.getId(); |
|
|
List<PlaceP> placeByMidAndDid = placeService.findPlaceByMidAndDid(mid, depositoryId); |
|
|
List<PlaceP> placeByMidAndDid = placeService.findPlaceByMidAndDid(mid, depositoryId); |
|
|
StringBuilder placeCode = new StringBuilder(); |
|
|
StringBuilder placeCode = new StringBuilder(); |
|
|
for (int j = 0; j < placeByMidAndDid.size(); j++) { |
|
|
for (int j = 0; j < placeByMidAndDid.size(); j++) { |
|
|
@ -372,9 +383,9 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
if (depositoryId != null) { |
|
|
if (depositoryId != null) { |
|
|
Depository depositoryRecordById = depositoryMapper.findDepositoryById(depositoryId); |
|
|
Depository depositoryRecordById = depositoryMapper.findDepositoryById(depositoryId); |
|
|
String code = depositoryRecordById.getCode(); |
|
|
String code = depositoryRecordById.getCode(); |
|
|
list.get(i).setDepositoryCode(code); |
|
|
material.setDepositoryCode(code); |
|
|
} |
|
|
} |
|
|
list.get(i).setPlaceCode(placeCode.toString()); |
|
|
material.setPlaceCode(placeCode.toString()); |
|
|
} |
|
|
} |
|
|
return packForMatieral(list); |
|
|
return packForMatieral(list); |
|
|
} |
|
|
} |
|
|
@ -422,9 +433,12 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
@Override |
|
|
@Override |
|
|
public List<Material> findMaterialAll() { |
|
|
public List<Material> findMaterialAll() { |
|
|
List<Material> materialList = materialMapper.findMaterialByCondition(new HashMap<String, Object>()); |
|
|
List<Material> materialList = materialMapper.findMaterialByCondition(new HashMap<String, Object>()); |
|
|
for (int i = 0; i < materialList.size(); i++) { |
|
|
for (Material material : materialList) { |
|
|
materialList.get(i).setPrice(materialList.get(i).getPrice() / 100); |
|
|
if(material.getPrice() == null){ |
|
|
materialList.get(i).setAmounts(materialList.get(i).getAmounts() / 100); |
|
|
material.setPrice(0.0); |
|
|
|
|
|
} |
|
|
|
|
|
material.setPrice(material.getPrice() / 100); |
|
|
|
|
|
material.setAmounts(material.getPrice() * material.getQuantity()); |
|
|
} |
|
|
} |
|
|
return materialList; |
|
|
return materialList; |
|
|
} |
|
|
} |
|
|
@ -440,8 +454,13 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
Material material = materialMapper.findMaterialById(id); |
|
|
Material material = materialMapper.findMaterialById(id); |
|
|
MaterialType materialTypeByOldId = materialTypeMapper.findMaterialTypeByOldId(material.getMaterialTypeId()); |
|
|
MaterialType materialTypeByOldId = materialTypeMapper.findMaterialTypeByOldId(material.getMaterialTypeId()); |
|
|
material.setTypeName(materialTypeByOldId.getTname()); |
|
|
material.setTypeName(materialTypeByOldId.getTname()); |
|
|
|
|
|
if(material.getPrice() != null){ |
|
|
|
|
|
|
|
|
material.setPrice(material.getPrice() / 100); |
|
|
material.setPrice(material.getPrice() / 100); |
|
|
material.setAmounts(material.getAmounts() / 100); |
|
|
}else{ |
|
|
|
|
|
material.setPrice(0.0); |
|
|
|
|
|
} |
|
|
|
|
|
material.setAmounts(material.getPrice() * material.getQuantity()); |
|
|
return material; |
|
|
return material; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -454,10 +473,13 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
@Override |
|
|
@Override |
|
|
public Inventory findInventoryById(int id) { |
|
|
public Inventory findInventoryById(int id) { |
|
|
Inventory material = materialMapper.findInventoryById(id); |
|
|
Inventory material = materialMapper.findInventoryById(id); |
|
|
MaterialType materialTypeByOldId = materialTypeMapper.findMaterialTypeByOldId(material.getMaterialTypeId()); |
|
|
if (material.getPrice() != null) { |
|
|
material.setTypeName(materialTypeByOldId.getTname()); |
|
|
|
|
|
material.setPrice(material.getPrice() / 100); |
|
|
material.setPrice(material.getPrice() / 100); |
|
|
material.setAmounts(material.getAmounts() / 100); |
|
|
} else { |
|
|
|
|
|
material.setPrice(0.0); |
|
|
|
|
|
} |
|
|
|
|
|
material.setAmounts(material.getPrice() * material.getQuantity()); |
|
|
return material; |
|
|
return material; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -473,8 +495,13 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
for (Inventory inventory : inventoryByMid) { |
|
|
for (Inventory inventory : inventoryByMid) { |
|
|
MaterialType materialTypeByOldId = materialTypeMapper.findMaterialTypeByOldId(inventory.getMaterialTypeId()); |
|
|
MaterialType materialTypeByOldId = materialTypeMapper.findMaterialTypeByOldId(inventory.getMaterialTypeId()); |
|
|
inventory.setTypeName(materialTypeByOldId.getTname()); |
|
|
inventory.setTypeName(materialTypeByOldId.getTname()); |
|
|
|
|
|
if(inventory.getPlaceCode() != null){ |
|
|
|
|
|
|
|
|
inventory.setPrice(inventory.getPrice() / 100); |
|
|
inventory.setPrice(inventory.getPrice() / 100); |
|
|
inventory.setAmounts(inventory.getAmounts() / 100); |
|
|
}else{ |
|
|
|
|
|
inventory.setPrice(0.0); |
|
|
|
|
|
} |
|
|
|
|
|
inventory.setAmounts(inventory.getPrice() * inventory.getQuantity()); |
|
|
} |
|
|
} |
|
|
return inventoryByMid; |
|
|
return inventoryByMid; |
|
|
} |
|
|
} |
|
|
@ -549,8 +576,13 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
@Override |
|
|
@Override |
|
|
public Material findMaterialAndTypeById(int id) { |
|
|
public Material findMaterialAndTypeById(int id) { |
|
|
Material material = materialMapper.findMaterialAndTypeById(id); |
|
|
Material material = materialMapper.findMaterialAndTypeById(id); |
|
|
|
|
|
if (material.getPrice() != null) { |
|
|
|
|
|
|
|
|
material.setPrice(material.getPrice() / 100); |
|
|
material.setPrice(material.getPrice() / 100); |
|
|
material.setAmounts(material.getAmounts() / 100); |
|
|
} else { |
|
|
|
|
|
material.setPrice(0.0); |
|
|
|
|
|
} |
|
|
|
|
|
material.setAmounts(material.getPrice() * material.getQuantity()); |
|
|
Long producedDate = material.getProducedDate(); |
|
|
Long producedDate = material.getProducedDate(); |
|
|
if (producedDate != null) { |
|
|
if (producedDate != null) { |
|
|
material.setShowProducedDate(DateUtil.TimeStampToDateTimeForDay(producedDate)); |
|
|
material.setShowProducedDate(DateUtil.TimeStampToDateTimeForDay(producedDate)); |
|
|
@ -582,10 +614,15 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
@Override |
|
|
@Override |
|
|
public List<Inventory> findMaterialByIds(List<Integer> ids) { |
|
|
public List<Inventory> findMaterialByIds(List<Integer> ids) { |
|
|
List<Inventory> materialList = materialMapper.findInventoryByIds(ids); |
|
|
List<Inventory> materialList = materialMapper.findInventoryByIds(ids); |
|
|
for (int i = 0; i < materialList.size(); i++) { |
|
|
for (Inventory material : materialList) { |
|
|
Inventory material = materialList.get(i); |
|
|
if(material.getPrice() != null){ |
|
|
materialList.get(i).setPrice(material.getPrice() / 100); |
|
|
|
|
|
materialList.get(i).setAmounts(material.getAmounts() / 100); |
|
|
material.setPrice(material.getPrice() / 100); |
|
|
|
|
|
}else{ |
|
|
|
|
|
material.setPrice(0.0); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
material.setAmounts(material.getPrice() * material.getQuantity()); |
|
|
} |
|
|
} |
|
|
return materialList; |
|
|
return materialList; |
|
|
} |
|
|
} |
|
|
@ -648,7 +685,10 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
Double sum = 0.0; |
|
|
Double sum = 0.0; |
|
|
List<Inventory> materialAll = materialMapper.findInventory(new HashMap<String, Object>()); |
|
|
List<Inventory> materialAll = materialMapper.findInventory(new HashMap<String, Object>()); |
|
|
for (int i = 0; i < materialAll.size(); i++) { |
|
|
for (int i = 0; i < materialAll.size(); i++) { |
|
|
sum += materialAll.get(i).getAmounts() / 100; |
|
|
Inventory inventory = materialAll.get(i); |
|
|
|
|
|
if (inventory.getPrice() != null) { |
|
|
|
|
|
sum += inventory.getPrice() * inventory.getQuantity() / 100; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
BigDecimal bg = new BigDecimal(sum); |
|
|
BigDecimal bg = new BigDecimal(sum); |
|
|
sum = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
|
sum = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
|
@ -774,6 +814,9 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
splitInventoryForUnit.put(splitInfo.getNewUnit(), saveQuantity); |
|
|
splitInventoryForUnit.put(splitInfo.getNewUnit(), saveQuantity); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
if(inventory.getPrice() == null){ |
|
|
|
|
|
inventory.setPrice(0.0); |
|
|
|
|
|
} |
|
|
BigDecimal bigDecimal = BigDecimal.valueOf(inventory.getPrice() / splitInfo.getQuantity()); |
|
|
BigDecimal bigDecimal = BigDecimal.valueOf(inventory.getPrice() / splitInfo.getQuantity()); |
|
|
double split_price = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
|
double split_price = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
|
amounts += split_price * saveQuantity; |
|
|
amounts += split_price * saveQuantity; |
|
|
@ -861,18 +904,23 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
Integer depositoryId = ObjectFormatUtil.toInteger(map.get("depositoryId")); |
|
|
Integer depositoryId = ObjectFormatUtil.toInteger(map.get("depositoryId")); |
|
|
Depository depositoryRecordById = depositoryMapper.findDepositoryById(depositoryId); |
|
|
Depository depositoryRecordById = depositoryMapper.findDepositoryById(depositoryId); |
|
|
List<Inventory> materialByDepository = materialMapper.findMaterialByDepository(map); |
|
|
List<Inventory> materialByDepository = materialMapper.findMaterialByDepository(map); |
|
|
for (int i = 0; i < materialByDepository.size(); i++) { |
|
|
for (Inventory inventory : materialByDepository) { |
|
|
materialByDepository.get(i).setDepositoryCode(depositoryRecordById.getCode()); |
|
|
inventory.setDepositoryCode(depositoryRecordById.getCode()); |
|
|
// 获取当前物料所处库位
|
|
|
// 获取当前物料所处库位
|
|
|
Integer mid = materialByDepository.get(i).getId(); |
|
|
Integer mid = inventory.getId(); |
|
|
List<PlaceP> placeByMidAndDid = placeService.findPlaceByMidAndDid(mid, depositoryId); |
|
|
List<PlaceP> placeByMidAndDid = placeService.findPlaceByMidAndDid(mid, depositoryId); |
|
|
StringBuilder placeCode = new StringBuilder(); |
|
|
StringBuilder placeCode = new StringBuilder(); |
|
|
for (int j = 0; j < placeByMidAndDid.size(); j++) { |
|
|
for (int j = 0; j < placeByMidAndDid.size(); j++) { |
|
|
placeCode.append(placeByMidAndDid.get(j).getCode()).append(" "); |
|
|
placeCode.append(placeByMidAndDid.get(j).getCode()).append(" "); |
|
|
} |
|
|
} |
|
|
materialByDepository.get(i).setPlaceCode(placeCode.toString()); |
|
|
inventory.setPlaceCode(placeCode.toString()); |
|
|
materialByDepository.get(i).setAmounts(materialByDepository.get(i).getAmounts() / 100); |
|
|
if (inventory.getPrice() != null) { |
|
|
materialByDepository.get(i).setPrice(materialByDepository.get(i).getPrice() / 100); |
|
|
|
|
|
|
|
|
inventory.setPrice(inventory.getPrice() / 100); |
|
|
|
|
|
} else { |
|
|
|
|
|
inventory.setPrice(0.0); |
|
|
|
|
|
} |
|
|
|
|
|
inventory.setAmounts(inventory.getPrice() * inventory.getQuantity()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return pack(materialByDepository); |
|
|
return pack(materialByDepository); |
|
|
@ -893,12 +941,6 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
public Integer insertInventoryForImport(Map<String, Object> map) { |
|
|
public Integer insertInventoryForImport(Map<String, Object> map) { |
|
|
if (map.containsKey("quantity")) { |
|
|
if (map.containsKey("quantity")) { |
|
|
int quantity = (int) Math.round(Double.parseDouble(map.get("quantity").toString())); |
|
|
int quantity = (int) Math.round(Double.parseDouble(map.get("quantity").toString())); |
|
|
int price = 0; |
|
|
|
|
|
if (map.containsKey("price")) { |
|
|
|
|
|
price = (int) (Double.parseDouble(map.get("price").toString())); |
|
|
|
|
|
} |
|
|
|
|
|
map.put("price", price); |
|
|
|
|
|
map.put("amounts", quantity * price); |
|
|
|
|
|
} |
|
|
} |
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
// params.put("code", map.get("code"));
|
|
|
// params.put("code", map.get("code"));
|
|
|
@ -913,17 +955,8 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
// 如果该物料存在
|
|
|
// 如果该物料存在
|
|
|
Inventory material = inventory.get(0); |
|
|
Inventory material = inventory.get(0); |
|
|
|
|
|
|
|
|
Double price = 0.0; |
|
|
|
|
|
if (map.containsKey("price")) { |
|
|
|
|
|
price = (Double.parseDouble(map.get("price").toString())) / 100; |
|
|
|
|
|
} |
|
|
|
|
|
int quantity = (int) Math.round(Double.parseDouble(map.get("quantity").toString())); |
|
|
int quantity = (int) Math.round(Double.parseDouble(map.get("quantity").toString())); |
|
|
// 获取当前入库金额
|
|
|
|
|
|
Double amounts = (quantity * price * 100); |
|
|
|
|
|
// 获取平均价格
|
|
|
|
|
|
Double avgPrice = (material.getAmounts() + amounts) / (material.getQuantity() + quantity); |
|
|
|
|
|
material.setPrice(avgPrice); |
|
|
|
|
|
material.setAmounts(material.getAmounts() + amounts); |
|
|
|
|
|
material.setQuantity(material.getQuantity() + quantity); |
|
|
material.setQuantity(material.getQuantity() + quantity); |
|
|
|
|
|
|
|
|
// 获取当前物料要存入的库位
|
|
|
// 获取当前物料要存入的库位
|
|
|
@ -1056,6 +1089,9 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
if (materialAndBarCode.getIid() != null) { |
|
|
if (materialAndBarCode.getIid() != null) { |
|
|
Inventory inventoryByMid = materialMapper.findInventoryById(materialAndBarCode.getIid()); |
|
|
Inventory inventoryByMid = materialMapper.findInventoryById(materialAndBarCode.getIid()); |
|
|
if (inventoryByMid != null) { |
|
|
if (inventoryByMid != null) { |
|
|
|
|
|
if(inventoryByMid.getPrice() == null){ |
|
|
|
|
|
inventoryByMid.setPrice(0.0); |
|
|
|
|
|
} |
|
|
materialAndBarCode.setPrice(inventoryByMid.getPrice() / 100); |
|
|
materialAndBarCode.setPrice(inventoryByMid.getPrice() / 100); |
|
|
} else { |
|
|
} else { |
|
|
materialAndBarCode.setPrice(0.0); |
|
|
materialAndBarCode.setPrice(0.0); |
|
|
@ -1476,8 +1512,7 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
// 修改转移前的记录
|
|
|
// 修改转移前的记录
|
|
|
splitUnitMapper.updateSplitInventory(splitInventoryForBefore); |
|
|
splitUnitMapper.updateSplitInventory(splitInventoryForBefore); |
|
|
|
|
|
|
|
|
} |
|
|
} else { |
|
|
else{ |
|
|
|
|
|
// 如果不存在
|
|
|
// 如果不存在
|
|
|
|
|
|
|
|
|
// 获取当前单位对应的进制
|
|
|
// 获取当前单位对应的进制
|
|
|
@ -1496,6 +1531,9 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
Map<String, Object> insertForSplitInventory = new HashMap<>(); |
|
|
Map<String, Object> insertForSplitInventory = new HashMap<>(); |
|
|
insertForSplitInventory.put("mid", inventoryByMid.getMid()); |
|
|
insertForSplitInventory.put("mid", inventoryByMid.getMid()); |
|
|
insertForSplitInventory.put("mcode", inventoryByMid.getCode()); |
|
|
insertForSplitInventory.put("mcode", inventoryByMid.getCode()); |
|
|
|
|
|
if(inventoryByMid.getPrice() == null){ |
|
|
|
|
|
inventoryByMid.setPrice(0.0); |
|
|
|
|
|
} |
|
|
insertForSplitInventory.put("price", inventoryByMid.getPrice() / scale); |
|
|
insertForSplitInventory.put("price", inventoryByMid.getPrice() / scale); |
|
|
insertForSplitInventory.put("quantity", num * scale - quantity); |
|
|
insertForSplitInventory.put("quantity", num * scale - quantity); |
|
|
insertForSplitInventory.put("unit", unit); |
|
|
insertForSplitInventory.put("unit", unit); |
|
|
@ -1511,6 +1549,9 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
// 定义进制时算法需要的参数
|
|
|
// 定义进制时算法需要的参数
|
|
|
Map<String, Object> paramForNewMap = new HashMap<>(); |
|
|
Map<String, Object> paramForNewMap = new HashMap<>(); |
|
|
paramForNewMap.put("mid", inventoryByMid.getMid()); |
|
|
paramForNewMap.put("mid", inventoryByMid.getMid()); |
|
|
|
|
|
if(inventoryByMid.getPrice() == null){ |
|
|
|
|
|
inventoryByMid.setPrice(0.0); |
|
|
|
|
|
} |
|
|
paramForNewMap.put("price", String.valueOf(inventoryByMid.getPrice() / 100)); |
|
|
paramForNewMap.put("price", String.valueOf(inventoryByMid.getPrice() / 100)); |
|
|
paramForNewMap.put("unit", unit); |
|
|
paramForNewMap.put("unit", unit); |
|
|
paramForNewMap.put("depositoryId", map.get("depositoryId")); |
|
|
paramForNewMap.put("depositoryId", map.get("depositoryId")); |
|
|
@ -1547,6 +1588,9 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
SplitInfo parentSplitInfo = splitUnitMapper.findSplitInfoById(splitInfo.getParentId()); |
|
|
SplitInfo parentSplitInfo = splitUnitMapper.findSplitInfoById(splitInfo.getParentId()); |
|
|
splitUnitService.updateSplitInfoSaveQuantity(parentSplitInfo, dispose, pidAndMidForAfter.getId(), paramForNewMap, quantity, splitInfo); |
|
|
splitUnitService.updateSplitInfoSaveQuantity(parentSplitInfo, dispose, pidAndMidForAfter.getId(), paramForNewMap, quantity, splitInfo); |
|
|
} else { |
|
|
} else { |
|
|
|
|
|
if(inventoryByMid.getPrice() == null){ |
|
|
|
|
|
inventoryByMid.setPrice(0.0); |
|
|
|
|
|
} |
|
|
paramForNewMap.put("price", Double.toString(inventoryByMid.getPrice() / 100)); |
|
|
paramForNewMap.put("price", Double.toString(inventoryByMid.getPrice() / 100)); |
|
|
paramForNewMap.put("realQuantity", String.valueOf(dispose)); |
|
|
paramForNewMap.put("realQuantity", String.valueOf(dispose)); |
|
|
paramForNewMap.put("quantity", String.valueOf(dispose)); |
|
|
paramForNewMap.put("quantity", String.valueOf(dispose)); |
|
|
@ -1566,8 +1610,7 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
// 修改库存数量
|
|
|
// 修改库存数量
|
|
|
splitUnitMapper.updateSplitInventory(splitInventoryForAfter); |
|
|
splitUnitMapper.updateSplitInventory(splitInventoryForAfter); |
|
|
} |
|
|
} |
|
|
} |
|
|
} else { |
|
|
else { |
|
|
|
|
|
// 如果不存在转移后的拆单库存记录
|
|
|
// 如果不存在转移后的拆单库存记录
|
|
|
|
|
|
|
|
|
// 定义用于添加拆单库存记录
|
|
|
// 定义用于添加拆单库存记录
|
|
|
@ -1592,6 +1635,9 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
SplitInfo parentSplitInfo = splitUnitMapper.findSplitInfoById(splitInfo.getParentId()); |
|
|
SplitInfo parentSplitInfo = splitUnitMapper.findSplitInfoById(splitInfo.getParentId()); |
|
|
splitUnitService.updateSplitInfoSaveQuantity(parentSplitInfo, dispose, pidAndMidForAfter.getId(), paramForNewMap, quantity, splitInfo); |
|
|
splitUnitService.updateSplitInfoSaveQuantity(parentSplitInfo, dispose, pidAndMidForAfter.getId(), paramForNewMap, quantity, splitInfo); |
|
|
} else { |
|
|
} else { |
|
|
|
|
|
if(inventoryByMid.getPrice() == null){ |
|
|
|
|
|
inventoryByMid.setPrice(0.0); |
|
|
|
|
|
} |
|
|
paramForNewMap.put("price", Double.toString(inventoryByMid.getPrice() / 100)); |
|
|
paramForNewMap.put("price", Double.toString(inventoryByMid.getPrice() / 100)); |
|
|
paramForNewMap.put("realQuantity", String.valueOf(dispose)); |
|
|
paramForNewMap.put("realQuantity", String.valueOf(dispose)); |
|
|
paramForNewMap.put("quantity", String.valueOf(dispose)); |
|
|
paramForNewMap.put("quantity", String.valueOf(dispose)); |
|
|
@ -1638,6 +1684,9 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
SplitInfo parentSplitInfo = splitUnitMapper.findSplitInfoById(splitInfo.getParentId()); |
|
|
SplitInfo parentSplitInfo = splitUnitMapper.findSplitInfoById(splitInfo.getParentId()); |
|
|
splitUnitService.updateSplitInfoSaveQuantity(parentSplitInfo, dispose, ObjectFormatUtil.toInteger(insertForSplitInventory.get("id")), paramForNewMap, quantity, splitInfo); |
|
|
splitUnitService.updateSplitInfoSaveQuantity(parentSplitInfo, dispose, ObjectFormatUtil.toInteger(insertForSplitInventory.get("id")), paramForNewMap, quantity, splitInfo); |
|
|
} else { |
|
|
} else { |
|
|
|
|
|
if(inventoryByMid.getPrice() == null){ |
|
|
|
|
|
inventoryByMid.setPrice(0.0); |
|
|
|
|
|
} |
|
|
paramForNewMap.put("price", Double.toString(inventoryByMid.getPrice() / 100)); |
|
|
paramForNewMap.put("price", Double.toString(inventoryByMid.getPrice() / 100)); |
|
|
paramForNewMap.put("realQuantity", String.valueOf(dispose)); |
|
|
paramForNewMap.put("realQuantity", String.valueOf(dispose)); |
|
|
paramForNewMap.put("quantity", String.valueOf(dispose)); |
|
|
paramForNewMap.put("quantity", String.valueOf(dispose)); |
|
|
@ -2905,12 +2954,10 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
if ("1".equals(type)) { |
|
|
if ("1".equals(type)) { |
|
|
// 如果是入库
|
|
|
// 如果是入库
|
|
|
materialByTypeIds = materialMapper.findMaterialByTypeIdsAndMname(paramForMnameAndMtid); |
|
|
materialByTypeIds = materialMapper.findMaterialByTypeIdsAndMname(paramForMnameAndMtid); |
|
|
} |
|
|
} else if ("2".equals(type)) { |
|
|
else if ("2".equals(type)) { |
|
|
|
|
|
// 如果是出库
|
|
|
// 如果是出库
|
|
|
inventoryByTypeIdsAndMname = materialMapper.findInventoryByTypeIdsAndMname(paramForMnameAndMtid); |
|
|
inventoryByTypeIdsAndMname = materialMapper.findInventoryByTypeIdsAndMname(paramForMnameAndMtid); |
|
|
} |
|
|
} else if ("3".equals(type)) { |
|
|
else if ("3".equals(type)) { |
|
|
|
|
|
// 如果是盘点
|
|
|
// 如果是盘点
|
|
|
List<Inventory> inventoryList = materialMapper.findInventoryByTypeIdsAndMname(paramForMnameAndMtid); |
|
|
List<Inventory> inventoryList = materialMapper.findInventoryByTypeIdsAndMname(paramForMnameAndMtid); |
|
|
|
|
|
|
|
|
|