|
|
|
@ -149,10 +149,6 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
public Integer updateMaterial(Map<String, Object> map) { |
|
|
|
if (map.containsKey("price")) { |
|
|
|
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); |
|
|
|
} |
|
|
|
// 判断是否有保质期
|
|
|
|
@ -218,8 +214,13 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
map.put("state", state); |
|
|
|
List<Material> list = materialMapper.findMaterialByCondition(map); |
|
|
|
for (Material material : list) { |
|
|
|
if(material.getPrice() != null){ |
|
|
|
|
|
|
|
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(); |
|
|
|
// 获取当前物料所处库位
|
|
|
|
@ -245,6 +246,7 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
|
|
|
|
/** |
|
|
|
* 根据条件查询符合条件的物料信息(用于表格展示) |
|
|
|
* |
|
|
|
* @param map 条件map |
|
|
|
* @return 符合条件的物料信息 |
|
|
|
*/ |
|
|
|
@ -302,8 +304,13 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
map.put("state", state); |
|
|
|
List<Inventory> list = materialMapper.findInventory(map); |
|
|
|
for (Inventory inventory : list) { |
|
|
|
inventory.setPrice(inventory.getPrice() / 100); |
|
|
|
inventory.setAmounts(inventory.getAmounts() / 100); |
|
|
|
if (inventory.getPrice() != null) { |
|
|
|
|
|
|
|
inventory.setPrice(inventory.getPrice() / 100); |
|
|
|
} else { |
|
|
|
inventory.setPrice(0.0); |
|
|
|
} |
|
|
|
inventory.setAmounts(inventory.getPrice() * inventory.getQuantity()); |
|
|
|
// 获取当前物料所处仓库
|
|
|
|
Integer depositoryId = inventory.getDepositoryId(); |
|
|
|
// 获取当前物料所处库位
|
|
|
|
@ -325,6 +332,7 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
|
|
|
|
/** |
|
|
|
* 根据物料编码及所处仓库查询库存 |
|
|
|
* |
|
|
|
* @param map 待查询条件 |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@ -357,13 +365,16 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
map.put("begin", (page - 1) * size); |
|
|
|
} |
|
|
|
List<Material> list = materialMapper.findMaterialByCondition(map); |
|
|
|
for (int i = 0; i < list.size(); i++) { |
|
|
|
list.get(i).setPrice(list.get(i).getPrice() / 100); |
|
|
|
list.get(i).setAmounts(list.get(i).getAmounts() / 100); |
|
|
|
for (Material material : list) { |
|
|
|
if(material.getPrice() == null){ |
|
|
|
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); |
|
|
|
StringBuilder placeCode = new StringBuilder(); |
|
|
|
for (int j = 0; j < placeByMidAndDid.size(); j++) { |
|
|
|
@ -372,9 +383,9 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
if (depositoryId != null) { |
|
|
|
Depository depositoryRecordById = depositoryMapper.findDepositoryById(depositoryId); |
|
|
|
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); |
|
|
|
} |
|
|
|
@ -422,9 +433,12 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
@Override |
|
|
|
public List<Material> findMaterialAll() { |
|
|
|
List<Material> materialList = materialMapper.findMaterialByCondition(new HashMap<String, Object>()); |
|
|
|
for (int i = 0; i < materialList.size(); i++) { |
|
|
|
materialList.get(i).setPrice(materialList.get(i).getPrice() / 100); |
|
|
|
materialList.get(i).setAmounts(materialList.get(i).getAmounts() / 100); |
|
|
|
for (Material material : materialList) { |
|
|
|
if(material.getPrice() == null){ |
|
|
|
material.setPrice(0.0); |
|
|
|
} |
|
|
|
material.setPrice(material.getPrice() / 100); |
|
|
|
material.setAmounts(material.getPrice() * material.getQuantity()); |
|
|
|
} |
|
|
|
return materialList; |
|
|
|
} |
|
|
|
@ -440,8 +454,13 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
Material material = materialMapper.findMaterialById(id); |
|
|
|
MaterialType materialTypeByOldId = materialTypeMapper.findMaterialTypeByOldId(material.getMaterialTypeId()); |
|
|
|
material.setTypeName(materialTypeByOldId.getTname()); |
|
|
|
if(material.getPrice() != null){ |
|
|
|
|
|
|
|
material.setPrice(material.getPrice() / 100); |
|
|
|
material.setAmounts(material.getAmounts() / 100); |
|
|
|
}else{ |
|
|
|
material.setPrice(0.0); |
|
|
|
} |
|
|
|
material.setAmounts(material.getPrice() * material.getQuantity()); |
|
|
|
return material; |
|
|
|
} |
|
|
|
|
|
|
|
@ -454,10 +473,13 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
@Override |
|
|
|
public Inventory findInventoryById(int id) { |
|
|
|
Inventory material = materialMapper.findInventoryById(id); |
|
|
|
MaterialType materialTypeByOldId = materialTypeMapper.findMaterialTypeByOldId(material.getMaterialTypeId()); |
|
|
|
material.setTypeName(materialTypeByOldId.getTname()); |
|
|
|
material.setPrice(material.getPrice() / 100); |
|
|
|
material.setAmounts(material.getAmounts() / 100); |
|
|
|
if (material.getPrice() != null) { |
|
|
|
|
|
|
|
material.setPrice(material.getPrice() / 100); |
|
|
|
} else { |
|
|
|
material.setPrice(0.0); |
|
|
|
} |
|
|
|
material.setAmounts(material.getPrice() * material.getQuantity()); |
|
|
|
return material; |
|
|
|
} |
|
|
|
|
|
|
|
@ -473,8 +495,13 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
for (Inventory inventory : inventoryByMid) { |
|
|
|
MaterialType materialTypeByOldId = materialTypeMapper.findMaterialTypeByOldId(inventory.getMaterialTypeId()); |
|
|
|
inventory.setTypeName(materialTypeByOldId.getTname()); |
|
|
|
if(inventory.getPlaceCode() != null){ |
|
|
|
|
|
|
|
inventory.setPrice(inventory.getPrice() / 100); |
|
|
|
inventory.setAmounts(inventory.getAmounts() / 100); |
|
|
|
}else{ |
|
|
|
inventory.setPrice(0.0); |
|
|
|
} |
|
|
|
inventory.setAmounts(inventory.getPrice() * inventory.getQuantity()); |
|
|
|
} |
|
|
|
return inventoryByMid; |
|
|
|
} |
|
|
|
@ -549,8 +576,13 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
@Override |
|
|
|
public Material findMaterialAndTypeById(int id) { |
|
|
|
Material material = materialMapper.findMaterialAndTypeById(id); |
|
|
|
material.setPrice(material.getPrice() / 100); |
|
|
|
material.setAmounts(material.getAmounts() / 100); |
|
|
|
if (material.getPrice() != null) { |
|
|
|
|
|
|
|
material.setPrice(material.getPrice() / 100); |
|
|
|
} else { |
|
|
|
material.setPrice(0.0); |
|
|
|
} |
|
|
|
material.setAmounts(material.getPrice() * material.getQuantity()); |
|
|
|
Long producedDate = material.getProducedDate(); |
|
|
|
if (producedDate != null) { |
|
|
|
material.setShowProducedDate(DateUtil.TimeStampToDateTimeForDay(producedDate)); |
|
|
|
@ -582,10 +614,15 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
@Override |
|
|
|
public List<Inventory> findMaterialByIds(List<Integer> ids) { |
|
|
|
List<Inventory> materialList = materialMapper.findInventoryByIds(ids); |
|
|
|
for (int i = 0; i < materialList.size(); i++) { |
|
|
|
Inventory material = materialList.get(i); |
|
|
|
materialList.get(i).setPrice(material.getPrice() / 100); |
|
|
|
materialList.get(i).setAmounts(material.getAmounts() / 100); |
|
|
|
for (Inventory material : materialList) { |
|
|
|
if(material.getPrice() != null){ |
|
|
|
|
|
|
|
material.setPrice(material.getPrice() / 100); |
|
|
|
}else{ |
|
|
|
material.setPrice(0.0); |
|
|
|
} |
|
|
|
|
|
|
|
material.setAmounts(material.getPrice() * material.getQuantity()); |
|
|
|
} |
|
|
|
return materialList; |
|
|
|
} |
|
|
|
@ -648,7 +685,10 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
Double sum = 0.0; |
|
|
|
List<Inventory> materialAll = materialMapper.findInventory(new HashMap<String, Object>()); |
|
|
|
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); |
|
|
|
sum = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
|
|
@ -757,29 +797,32 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
// 获取当前具体数据
|
|
|
|
MaterialAndPlace placeAndMaterialByMidAndPid = placeService.findPlaceAndMaterialByMidAndPid(place.getId(), m.getId()); |
|
|
|
// 获取当前是否存在拆单处理记录
|
|
|
|
// 获取当前物料对应的所有拆单数目
|
|
|
|
List<SplitInfo> splitInfoByMid = splitUnitMapper.findSplitInfoByMid(inventory.getMid()); |
|
|
|
for (SplitInfo splitInfo : splitInfoByMid |
|
|
|
) { |
|
|
|
// 获取当前拆单单位的总数
|
|
|
|
int saveQuantity = splitUnitService.findAllInventoryForSplitInfo(-1, placeAndMaterialByMidAndPid, splitInfo.getId(), 0, true); |
|
|
|
|
|
|
|
if (splitInventoryForUnit.containsKey(splitInfo.getNewUnit())) { |
|
|
|
// 如果当前存在该拆单类型的记录
|
|
|
|
|
|
|
|
// 更新当前类型数据
|
|
|
|
splitInventoryForUnit.put(splitInfo.getNewUnit(), splitInventoryForUnit.get(splitInfo.getNewUnit()) + saveQuantity); |
|
|
|
} else { |
|
|
|
// 如果不存在,则新增
|
|
|
|
splitInventoryForUnit.put(splitInfo.getNewUnit(), saveQuantity); |
|
|
|
|
|
|
|
} |
|
|
|
BigDecimal bigDecimal = BigDecimal.valueOf(inventory.getPrice() / splitInfo.getQuantity()); |
|
|
|
double split_price = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
|
|
amounts += split_price * saveQuantity; |
|
|
|
unit = splitInfo.getNewUnit(); |
|
|
|
// 获取当前物料对应的所有拆单数目
|
|
|
|
List<SplitInfo> splitInfoByMid = splitUnitMapper.findSplitInfoByMid(inventory.getMid()); |
|
|
|
for (SplitInfo splitInfo : splitInfoByMid |
|
|
|
) { |
|
|
|
// 获取当前拆单单位的总数
|
|
|
|
int saveQuantity = splitUnitService.findAllInventoryForSplitInfo(-1, placeAndMaterialByMidAndPid, splitInfo.getId(), 0, true); |
|
|
|
|
|
|
|
if (splitInventoryForUnit.containsKey(splitInfo.getNewUnit())) { |
|
|
|
// 如果当前存在该拆单类型的记录
|
|
|
|
|
|
|
|
// 更新当前类型数据
|
|
|
|
splitInventoryForUnit.put(splitInfo.getNewUnit(), splitInventoryForUnit.get(splitInfo.getNewUnit()) + saveQuantity); |
|
|
|
} else { |
|
|
|
// 如果不存在,则新增
|
|
|
|
splitInventoryForUnit.put(splitInfo.getNewUnit(), saveQuantity); |
|
|
|
|
|
|
|
} |
|
|
|
if(inventory.getPrice() == null){ |
|
|
|
inventory.setPrice(0.0); |
|
|
|
} |
|
|
|
BigDecimal bigDecimal = BigDecimal.valueOf(inventory.getPrice() / splitInfo.getQuantity()); |
|
|
|
double split_price = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
|
|
amounts += split_price * saveQuantity; |
|
|
|
unit = splitInfo.getNewUnit(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// }
|
|
|
|
} |
|
|
|
@ -815,11 +858,11 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
m.setProducedDate(DateUtil.TimeStampToDateTimeForDay(producedDate)); |
|
|
|
} |
|
|
|
List<SplitInfo> splitInfoByMid = splitUnitService.findSplitInfoByMid(m.getMid()); |
|
|
|
if(splitInfoByMid == null){ |
|
|
|
if (splitInfoByMid == null) { |
|
|
|
splitInfoByMid = new ArrayList<>(); |
|
|
|
} |
|
|
|
|
|
|
|
Map<String,Object> paramByBarcode = new HashMap<>(); |
|
|
|
Map<String, Object> paramByBarcode = new HashMap<>(); |
|
|
|
paramByBarcode.put("mcode", m.getCode()); |
|
|
|
paramByBarcode.put("codeFlag", 1); |
|
|
|
List<MaterialAndBarCode> materialByBarCodeByCondition = materialMapper.findMaterialByBarCodeByCondition(paramByBarcode); |
|
|
|
@ -861,18 +904,23 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
Integer depositoryId = ObjectFormatUtil.toInteger(map.get("depositoryId")); |
|
|
|
Depository depositoryRecordById = depositoryMapper.findDepositoryById(depositoryId); |
|
|
|
List<Inventory> materialByDepository = materialMapper.findMaterialByDepository(map); |
|
|
|
for (int i = 0; i < materialByDepository.size(); i++) { |
|
|
|
materialByDepository.get(i).setDepositoryCode(depositoryRecordById.getCode()); |
|
|
|
for (Inventory inventory : materialByDepository) { |
|
|
|
inventory.setDepositoryCode(depositoryRecordById.getCode()); |
|
|
|
// 获取当前物料所处库位
|
|
|
|
Integer mid = materialByDepository.get(i).getId(); |
|
|
|
Integer mid = inventory.getId(); |
|
|
|
List<PlaceP> placeByMidAndDid = placeService.findPlaceByMidAndDid(mid, depositoryId); |
|
|
|
StringBuilder placeCode = new StringBuilder(); |
|
|
|
for (int j = 0; j < placeByMidAndDid.size(); j++) { |
|
|
|
placeCode.append(placeByMidAndDid.get(j).getCode()).append(" "); |
|
|
|
} |
|
|
|
materialByDepository.get(i).setPlaceCode(placeCode.toString()); |
|
|
|
materialByDepository.get(i).setAmounts(materialByDepository.get(i).getAmounts() / 100); |
|
|
|
materialByDepository.get(i).setPrice(materialByDepository.get(i).getPrice() / 100); |
|
|
|
inventory.setPlaceCode(placeCode.toString()); |
|
|
|
if (inventory.getPrice() != null) { |
|
|
|
|
|
|
|
inventory.setPrice(inventory.getPrice() / 100); |
|
|
|
} else { |
|
|
|
inventory.setPrice(0.0); |
|
|
|
} |
|
|
|
inventory.setAmounts(inventory.getPrice() * inventory.getQuantity()); |
|
|
|
} |
|
|
|
|
|
|
|
return pack(materialByDepository); |
|
|
|
@ -893,12 +941,6 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
public Integer insertInventoryForImport(Map<String, Object> map) { |
|
|
|
if (map.containsKey("quantity")) { |
|
|
|
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<>(); |
|
|
|
// params.put("code", map.get("code"));
|
|
|
|
@ -913,17 +955,8 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
// 如果该物料存在
|
|
|
|
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())); |
|
|
|
// 获取当前入库金额
|
|
|
|
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); |
|
|
|
|
|
|
|
// 获取当前物料要存入的库位
|
|
|
|
@ -1056,6 +1089,9 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
if (materialAndBarCode.getIid() != null) { |
|
|
|
Inventory inventoryByMid = materialMapper.findInventoryById(materialAndBarCode.getIid()); |
|
|
|
if (inventoryByMid != null) { |
|
|
|
if(inventoryByMid.getPrice() == null){ |
|
|
|
inventoryByMid.setPrice(0.0); |
|
|
|
} |
|
|
|
materialAndBarCode.setPrice(inventoryByMid.getPrice() / 100); |
|
|
|
} else { |
|
|
|
materialAndBarCode.setPrice(0.0); |
|
|
|
@ -1466,7 +1502,7 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
paramForSplitInventory.put("iid", pidAndMidForBefore.getId()); |
|
|
|
// 转移之前的拆单库存记录
|
|
|
|
SplitInventory splitInventoryForBefore = splitUnitMapper.findSplitInventoryByIidAndSid(paramForSplitInventory); |
|
|
|
if(splitInventoryForBefore != null) { |
|
|
|
if (splitInventoryForBefore != null) { |
|
|
|
//如果存在
|
|
|
|
|
|
|
|
// 设置转移前库存的数量
|
|
|
|
@ -1476,14 +1512,13 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
// 修改转移前的记录
|
|
|
|
splitUnitMapper.updateSplitInventory(splitInventoryForBefore); |
|
|
|
|
|
|
|
} |
|
|
|
else{ |
|
|
|
} else { |
|
|
|
// 如果不存在
|
|
|
|
|
|
|
|
// 获取当前单位对应的进制
|
|
|
|
int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1); |
|
|
|
// 计算当前转移数目对应需要减少的数目
|
|
|
|
int num = (int)Math.ceil(quantity / (double)scale); |
|
|
|
int num = (int) Math.ceil(quantity / (double) scale); |
|
|
|
|
|
|
|
// 修改当前库存数量
|
|
|
|
inventoryByMid.setQuantity(inventoryByMid.getQuantity() - num); |
|
|
|
@ -1493,15 +1528,18 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
pidAndMidForBefore.setQuantity(pidAndMidForBefore.getQuantity() - num); |
|
|
|
placeService.updateMaterialAndPlace(pidAndMidForBefore); |
|
|
|
|
|
|
|
Map<String,Object> insertForSplitInventory = new HashMap<>(); |
|
|
|
insertForSplitInventory.put("mid",inventoryByMid.getMid()); |
|
|
|
insertForSplitInventory.put("mcode",inventoryByMid.getCode()); |
|
|
|
insertForSplitInventory.put("price",inventoryByMid.getPrice() / scale); |
|
|
|
insertForSplitInventory.put("quantity",num * scale - quantity); |
|
|
|
insertForSplitInventory.put("unit",unit); |
|
|
|
insertForSplitInventory.put("depositoryId",map.get("depositoryId")); |
|
|
|
insertForSplitInventory.put("placeId",pidAndMidForBefore.getPid()); |
|
|
|
insertForSplitInventory.put("type","in"); |
|
|
|
Map<String, Object> insertForSplitInventory = new HashMap<>(); |
|
|
|
insertForSplitInventory.put("mid", inventoryByMid.getMid()); |
|
|
|
insertForSplitInventory.put("mcode", inventoryByMid.getCode()); |
|
|
|
if(inventoryByMid.getPrice() == null){ |
|
|
|
inventoryByMid.setPrice(0.0); |
|
|
|
} |
|
|
|
insertForSplitInventory.put("price", inventoryByMid.getPrice() / scale); |
|
|
|
insertForSplitInventory.put("quantity", num * scale - quantity); |
|
|
|
insertForSplitInventory.put("unit", unit); |
|
|
|
insertForSplitInventory.put("depositoryId", map.get("depositoryId")); |
|
|
|
insertForSplitInventory.put("placeId", pidAndMidForBefore.getPid()); |
|
|
|
insertForSplitInventory.put("type", "in"); |
|
|
|
splitUnitService.addSplitInventory(insertForSplitInventory); |
|
|
|
Integer new_id = ObjectFormatUtil.toInteger(insertForSplitInventory.get("newInMid")); |
|
|
|
depositoryRecordMapper.deleteApplicationInRecordById(new_id); |
|
|
|
@ -1511,6 +1549,9 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
// 定义进制时算法需要的参数
|
|
|
|
Map<String, Object> paramForNewMap = new HashMap<>(); |
|
|
|
paramForNewMap.put("mid", inventoryByMid.getMid()); |
|
|
|
if(inventoryByMid.getPrice() == null){ |
|
|
|
inventoryByMid.setPrice(0.0); |
|
|
|
} |
|
|
|
paramForNewMap.put("price", String.valueOf(inventoryByMid.getPrice() / 100)); |
|
|
|
paramForNewMap.put("unit", unit); |
|
|
|
paramForNewMap.put("depositoryId", map.get("depositoryId")); |
|
|
|
@ -1547,6 +1588,9 @@ 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){ |
|
|
|
inventoryByMid.setPrice(0.0); |
|
|
|
} |
|
|
|
paramForNewMap.put("price", Double.toString(inventoryByMid.getPrice() / 100)); |
|
|
|
paramForNewMap.put("realQuantity", String.valueOf(dispose)); |
|
|
|
paramForNewMap.put("quantity", String.valueOf(dispose)); |
|
|
|
@ -1566,8 +1610,7 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
// 修改库存数量
|
|
|
|
splitUnitMapper.updateSplitInventory(splitInventoryForAfter); |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
// 如果不存在转移后的拆单库存记录
|
|
|
|
|
|
|
|
// 定义用于添加拆单库存记录
|
|
|
|
@ -1592,6 +1635,9 @@ 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){ |
|
|
|
inventoryByMid.setPrice(0.0); |
|
|
|
} |
|
|
|
paramForNewMap.put("price", Double.toString(inventoryByMid.getPrice() / 100)); |
|
|
|
paramForNewMap.put("realQuantity", String.valueOf(dispose)); |
|
|
|
paramForNewMap.put("quantity", String.valueOf(dispose)); |
|
|
|
@ -1638,6 +1684,9 @@ 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){ |
|
|
|
inventoryByMid.setPrice(0.0); |
|
|
|
} |
|
|
|
paramForNewMap.put("price", Double.toString(inventoryByMid.getPrice() / 100)); |
|
|
|
paramForNewMap.put("realQuantity", String.valueOf(dispose)); |
|
|
|
paramForNewMap.put("quantity", String.valueOf(dispose)); |
|
|
|
@ -2658,7 +2707,7 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
} |
|
|
|
StringBuilder title = new StringBuilder(); |
|
|
|
Depository depositoryById = depositoryMapper.findDepositoryById(inventory.getDepositoryId()); |
|
|
|
title = new StringBuilder(inventory.getMname() + ",规格型号: " + version + ","+depositoryById.getDname()+"库存数量:" + inventory.getUnit() + ":" + inventory.getQuantity()); |
|
|
|
title = new StringBuilder(inventory.getMname() + ",规格型号: " + version + "," + depositoryById.getDname() + "库存数量:" + inventory.getUnit() + ":" + inventory.getQuantity()); |
|
|
|
// 获取对应拆单库存处理记录
|
|
|
|
List<SplitInventory> splitInventoryList = splitUnitMapper.findSplitInventoryByIid(inventory.getId()); |
|
|
|
if (splitInventoryList.size() > 0) { |
|
|
|
@ -2905,12 +2954,10 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
if ("1".equals(type)) { |
|
|
|
// 如果是入库
|
|
|
|
materialByTypeIds = materialMapper.findMaterialByTypeIdsAndMname(paramForMnameAndMtid); |
|
|
|
} |
|
|
|
else if ("2".equals(type)) { |
|
|
|
} else if ("2".equals(type)) { |
|
|
|
// 如果是出库
|
|
|
|
inventoryByTypeIdsAndMname = materialMapper.findInventoryByTypeIdsAndMname(paramForMnameAndMtid); |
|
|
|
} |
|
|
|
else if ("3".equals(type)) { |
|
|
|
} else if ("3".equals(type)) { |
|
|
|
// 如果是盘点
|
|
|
|
List<Inventory> inventoryList = materialMapper.findInventoryByTypeIdsAndMname(paramForMnameAndMtid); |
|
|
|
|
|
|
|
|