|
|
|
@ -126,6 +126,14 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
map.remove("producedDate"); |
|
|
|
} |
|
|
|
} |
|
|
|
// 将输入的值扩大100倍存入数据库
|
|
|
|
Double oldInventory = ObjectFormatUtil.toDouble(map.get("oldInventory")); |
|
|
|
Double newInventory = ObjectFormatUtil.toDouble(map.get("newInventory")); |
|
|
|
Double inventory = ObjectFormatUtil.toDouble(map.get("inventory")); |
|
|
|
map.put("oldInventory", (int) (oldInventory * 100)); |
|
|
|
map.put("newInventory", (int) (newInventory * 100)); |
|
|
|
map.put("inventory", (int) (inventory * 100)); |
|
|
|
|
|
|
|
return stockTakingMapper.insertStockTakingChild(map); |
|
|
|
} |
|
|
|
|
|
|
|
@ -184,14 +192,14 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
String takingResult = (String) redisTemplate.opsForHash().get(key, "takingResult"); |
|
|
|
Object number = redisTemplate.opsForHash().get(key, "number"); |
|
|
|
Object oldInventory = redisTemplate.opsForHash().get(key, "oldInventory"); |
|
|
|
Integer newInventory = ObjectFormatUtil.toInteger(oldInventory); |
|
|
|
Double newInventory = ObjectFormatUtil.toDouble(oldInventory); |
|
|
|
if ("Inventory_down".equals(takingResult)) { |
|
|
|
// 如果盘亏
|
|
|
|
newInventory -= ObjectFormatUtil.toInteger(number); |
|
|
|
newInventory -= ObjectFormatUtil.toDouble(number); |
|
|
|
|
|
|
|
} else if ("Inventory_up".equals(takingResult)) { |
|
|
|
// 如果盘盈
|
|
|
|
newInventory += ObjectFormatUtil.toInteger(number); |
|
|
|
newInventory += ObjectFormatUtil.toDouble(number); |
|
|
|
} |
|
|
|
param.put("newInventory", newInventory); |
|
|
|
param.put("depositoryId", mpv.getDepository_id().toString()); |
|
|
|
@ -346,22 +354,24 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<StockTakingChildP> findStockTakingChildPByMainId(Integer mainId) { |
|
|
|
List<StockTakingChildP> stockTakingChildPS = stockTakingMapper.selectStockTakingChildByMainId(mainId); |
|
|
|
for (StockTakingChildP stockTakingChildP : stockTakingChildPS) { |
|
|
|
if ("Inventory_up".equals(stockTakingChildP.getTakingResult())) { |
|
|
|
stockTakingChildP.setTakingResultShow("盘盈"); |
|
|
|
} else if ("Inventory_down".equals(stockTakingChildP.getTakingResult())) { |
|
|
|
stockTakingChildP.setTakingResultShow("盘亏"); |
|
|
|
List<StockTakingChild> stockTakingChildS = stockTakingMapper.selectStockTakingChildByMainId(mainId); |
|
|
|
List<StockTakingChildP> stockTakingChildPS = new ArrayList<>(); |
|
|
|
for (StockTakingChild stockTakingChild : stockTakingChildS) { |
|
|
|
if ("Inventory_up".equals(stockTakingChild.getTakingResult())) { |
|
|
|
stockTakingChild.setTakingResultShow("盘盈"); |
|
|
|
} else if ("Inventory_down".equals(stockTakingChild.getTakingResult())) { |
|
|
|
stockTakingChild.setTakingResultShow("盘亏"); |
|
|
|
} else { |
|
|
|
stockTakingChildP.setTakingResultShow("正常"); |
|
|
|
stockTakingChild.setTakingResultShow("正常"); |
|
|
|
} |
|
|
|
stockTakingChildP.setShowUnit(stockTakingChildP.getUnit()); |
|
|
|
if ("-1".equals(stockTakingChildP.getShowUnit())) { |
|
|
|
Inventory inventoryById = materialMapper.findInventoryById(stockTakingChildP.getMid()); |
|
|
|
stockTakingChildP.setShowUnit(inventoryById.getUnit()); |
|
|
|
stockTakingChild.setShowUnit(stockTakingChild.getUnit()); |
|
|
|
if ("-1".equals(stockTakingChild.getShowUnit())) { |
|
|
|
Inventory inventoryById = materialMapper.findInventoryById(stockTakingChild.getMid()); |
|
|
|
stockTakingChild.setShowUnit(inventoryById.getUnit()); |
|
|
|
} |
|
|
|
List<MaterialAndBarCode> materialByBarCodeByMcode = materialMapper.findMaterialByBarCodeByMcode(stockTakingChildP.getMcode()); |
|
|
|
stockTakingChildP.setMaterialAndBarCodeList(materialByBarCodeByMcode); |
|
|
|
List<MaterialAndBarCode> materialByBarCodeByMcode = materialMapper.findMaterialByBarCodeByMcode(stockTakingChild.getMcode()); |
|
|
|
stockTakingChild.setMaterialAndBarCodeList(materialByBarCodeByMcode); |
|
|
|
stockTakingChildPS.add(new StockTakingChildP(stockTakingChild)); |
|
|
|
} |
|
|
|
return stockTakingChildPS; |
|
|
|
} |
|
|
|
@ -374,7 +384,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public StockTakingChildP findStockTakingChildPById(Integer id) { |
|
|
|
return stockTakingMapper.selectStockTakingChildPById(id); |
|
|
|
return new StockTakingChildP(stockTakingMapper.selectStockTakingChildPById(id)); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -452,8 +462,8 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
Integer depositoryId = mainRecord.getDepositoryId(); |
|
|
|
|
|
|
|
// 获取所有子单
|
|
|
|
List<StockTakingChildP> minRecordList = stockTakingMapper.selectStockTakingChildByMainId(mainId); |
|
|
|
for (StockTakingChildP minRecord : minRecordList) { |
|
|
|
List<StockTakingChild> minRecordList = stockTakingMapper.selectStockTakingChildByMainId(mainId); |
|
|
|
for (StockTakingChild minRecord : minRecordList) { |
|
|
|
// 获取子单详情
|
|
|
|
// 获取盘点的物料详情
|
|
|
|
|
|
|
|
@ -469,7 +479,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
} |
|
|
|
|
|
|
|
// 获取盈亏数量
|
|
|
|
Integer inventory = minRecord.getInventory(); |
|
|
|
double inventory = minRecord.getInventory() / 100.0; |
|
|
|
|
|
|
|
|
|
|
|
Inventory inventoryById = materialMapper.findInventoryById(minRecord.getMid()); |
|
|
|
@ -484,12 +494,12 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
// 根据盘点结果重新计算物料的单价
|
|
|
|
|
|
|
|
|
|
|
|
Integer newInventory = minRecord.getNewInventory(); |
|
|
|
double newInventory = minRecord.getNewInventory() / 100.0; |
|
|
|
|
|
|
|
// 获取当前库位上物料数量
|
|
|
|
int oldQuantity = inventoryById.getQuantity() - placeAndMaterialByMidAndPid.getQuantity(); |
|
|
|
|
|
|
|
inventoryById.setQuantity(oldQuantity + newInventory * 100); |
|
|
|
inventoryById.setQuantity(oldQuantity + (int) (newInventory * 100)); |
|
|
|
|
|
|
|
|
|
|
|
// 用于计算新的库位数量
|
|
|
|
@ -500,7 +510,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
// 如果盘盈
|
|
|
|
|
|
|
|
// 更新当前库位数量
|
|
|
|
newNumberForPlace = placeById.getQuantity() + inventory * 100; |
|
|
|
newNumberForPlace = placeById.getQuantity() + (int) (inventory * 100); |
|
|
|
|
|
|
|
if (newNumberForPlace < placeById.getMax()) { |
|
|
|
|
|
|
|
@ -516,14 +526,14 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() + inventory * 100; |
|
|
|
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() + (int) (inventory * 100); |
|
|
|
// 更新物料与库位对应关系的数量
|
|
|
|
placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 如果盘亏
|
|
|
|
newNumberForPlace = placeById.getQuantity() - inventory * 100; |
|
|
|
newNumberForPlace = placeById.getQuantity() - (int) (inventory * 100); |
|
|
|
|
|
|
|
if (newNumberForPlace > placeById.getMin()) { |
|
|
|
//如果更新后的库位数量没有下溢
|
|
|
|
@ -532,7 +542,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
placeById.setQuantity(newNumberForPlace); |
|
|
|
|
|
|
|
// 更新物料与库位对应关系的数量
|
|
|
|
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - inventory * 100; |
|
|
|
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - (int) (inventory * 100); |
|
|
|
|
|
|
|
} else { |
|
|
|
placeById.setQuantity(0); |
|
|
|
@ -689,9 +699,9 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
List<String> err = new ArrayList<>(); |
|
|
|
|
|
|
|
// 获取所有子单
|
|
|
|
List<StockTakingChildP> minRecordList = stockTakingMapper.selectStockTakingChildByMainId(mainId); |
|
|
|
List<StockTakingChild> minRecordList = stockTakingMapper.selectStockTakingChildByMainId(mainId); |
|
|
|
// 遍历当前拆单的子单详情
|
|
|
|
for (StockTakingChildP minRecord : minRecordList) { |
|
|
|
for (StockTakingChild minRecord : minRecordList) { |
|
|
|
|
|
|
|
|
|
|
|
// 获取子单详情
|
|
|
|
@ -727,7 +737,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
} |
|
|
|
|
|
|
|
// 获取盈亏数量
|
|
|
|
Integer inventory = minRecord.getInventory(); |
|
|
|
double inventory = minRecord.getInventory() / 100.0; |
|
|
|
|
|
|
|
|
|
|
|
// 获取判断对应的生产日期
|
|
|
|
@ -735,7 +745,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
|
|
|
|
|
|
|
|
// 当前盘点数目
|
|
|
|
Integer newInventory = minRecord.getNewInventory(); |
|
|
|
double newInventory = minRecord.getNewInventory() / 100.0; |
|
|
|
|
|
|
|
|
|
|
|
if (producedDate != null) { |
|
|
|
@ -752,24 +762,24 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
// 如果当前盘点数量大于库存数量
|
|
|
|
|
|
|
|
// 修改当前库存
|
|
|
|
materialAndProducedDate.setInventory(newInventory * 100); |
|
|
|
materialAndProducedDate.setInventory((int)(newInventory * 100)); |
|
|
|
// 修改使用数量
|
|
|
|
materialAndProducedDate.setExpendnum(materialAndProducedDate.getQuantity() - newInventory * 100); |
|
|
|
materialAndProducedDate.setExpendnum((int)(materialAndProducedDate.getQuantity() - newInventory * 100)); |
|
|
|
|
|
|
|
// 修改物料对应数量
|
|
|
|
inventoryById.setQuantity(inventoryById.getQuantity() + newInventory * 100 - oldInventory * 100); |
|
|
|
inventoryById.setQuantity((int)(inventoryById.getQuantity() + newInventory * 100 - oldInventory * 100)); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
// 如果当前盘点数量小于库存数量
|
|
|
|
|
|
|
|
// 修改当前库存
|
|
|
|
materialAndProducedDate.setInventory(newInventory * 100); |
|
|
|
materialAndProducedDate.setInventory((int)(newInventory * 100)); |
|
|
|
// 修改使用数量
|
|
|
|
materialAndProducedDate.setExpendnum(materialAndProducedDate.getQuantity() - newInventory * 100); |
|
|
|
materialAndProducedDate.setExpendnum((int)(materialAndProducedDate.getQuantity() - newInventory * 100)); |
|
|
|
|
|
|
|
// 修改物料对应数量
|
|
|
|
inventoryById.setQuantity(inventoryById.getQuantity() - oldInventory * 100 + newInventory * 100); |
|
|
|
inventoryById.setQuantity((int)(inventoryById.getQuantity() - oldInventory * 100 + newInventory * 100)); |
|
|
|
} |
|
|
|
|
|
|
|
materialMapper.updateMaterialAndProducedDate(materialAndProducedDate); |
|
|
|
@ -787,7 +797,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
if ("-1".equals(unit) || inventoryById.getUnit().equals(minRecord.getUnit())) { |
|
|
|
|
|
|
|
// 更新当前库位数量
|
|
|
|
newNumberForPlace = placeById.getQuantity() + inventory * 100; |
|
|
|
newNumberForPlace = placeById.getQuantity() +(int)( inventory * 100); |
|
|
|
|
|
|
|
if (newNumberForPlace <= placeById.getMax()) { |
|
|
|
// 如果更新后的库位数量没有上溢
|
|
|
|
@ -801,9 +811,9 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
|
|
|
|
continue; |
|
|
|
} |
|
|
|
inventoryById.setQuantity(inventoryById.getQuantity() + inventory * 100); |
|
|
|
inventoryById.setQuantity(inventoryById.getQuantity() +(int)( inventory * 100)); |
|
|
|
|
|
|
|
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() + inventory * 100; |
|
|
|
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() +(int)( inventory * 100); |
|
|
|
// 更新物料与库位对应关系的数量
|
|
|
|
placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace); |
|
|
|
|
|
|
|
@ -885,7 +895,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
if ("-1".equals(unit) || inventoryById.getUnit().equals(minRecord.getUnit())) { |
|
|
|
// 如果盘点的是基础单位
|
|
|
|
|
|
|
|
newNumberForPlace = placeById.getQuantity() - inventory * 100; |
|
|
|
newNumberForPlace = placeById.getQuantity() - (int)(inventory * 100); |
|
|
|
|
|
|
|
if (newNumberForPlace > placeById.getMin()) { |
|
|
|
//如果更新后的库位数量没有下溢
|
|
|
|
@ -894,19 +904,18 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
placeById.setQuantity(newNumberForPlace); |
|
|
|
|
|
|
|
// 更新物料与库位对应关系的数量
|
|
|
|
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - inventory * 100; |
|
|
|
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - (int)(inventory * 100); |
|
|
|
|
|
|
|
} else { |
|
|
|
placeById.setQuantity(0); |
|
|
|
newNumberForMatrialAndPlace = 0; |
|
|
|
} |
|
|
|
|
|
|
|
inventoryById.setQuantity(inventoryById.getQuantity() - inventory * 100); |
|
|
|
inventoryById.setQuantity(inventoryById.getQuantity() - (int)(inventory * 100)); |
|
|
|
|
|
|
|
placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace); |
|
|
|
|
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
// 如果是拆单单位
|
|
|
|
// 用于查找对应的拆单记录
|
|
|
|
Map<String, Object> paramForSplitInfo = new HashMap<>(); |
|
|
|
@ -924,7 +933,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
// 如果单纯的拆单库存满足数量
|
|
|
|
|
|
|
|
// 设置当前拆单库存的数量
|
|
|
|
splitInventory.setSaveQuantity(splitInventory.getSaveQuantity() - inventory * 100); |
|
|
|
splitInventory.setSaveQuantity(splitInventory.getSaveQuantity() - (int)(inventory * 100)); |
|
|
|
// 修改拆单库存
|
|
|
|
splitUnitMapper.updateSplitInventory(splitInventory); |
|
|
|
} else { |
|
|
|
@ -981,8 +990,8 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
|
|
|
|
|
|
|
|
// 设置剩余拆单库存处理数量
|
|
|
|
splitInventory.setSaveQuantity(splitInfo.getQuantity() + splitInventory.getSaveQuantity() - inventory * 100); |
|
|
|
splitInventory.setOutQuantity(splitInventory.getOutQuantity() + inventory * 100); |
|
|
|
splitInventory.setSaveQuantity(splitInfo.getQuantity() + splitInventory.getSaveQuantity() - (int)(inventory * 100)); |
|
|
|
splitInventory.setOutQuantity(splitInventory.getOutQuantity() + (int)(inventory * 100)); |
|
|
|
splitUnitMapper.updateSplitInventory(splitInventory); |
|
|
|
} |
|
|
|
} else { |
|
|
|
@ -1027,8 +1036,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
// 如果盘点后的库存数非法
|
|
|
|
|
|
|
|
placeById.setQuantity(placeById.getQuantity() - placeAndMaterialByMidAndPid.getQuantity()); |
|
|
|
@ -1067,7 +1075,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
int residue = (int) (Math.ceil(inventory / (double) scale)); |
|
|
|
|
|
|
|
// 获取剩余数目
|
|
|
|
int residue_realQuantity = residue * scale - inventory; |
|
|
|
int residue_realQuantity = residue * scale - (int)(inventory); |
|
|
|
|
|
|
|
|
|
|
|
// 更新库存数量
|
|
|
|
@ -1209,9 +1217,9 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
Depository depositoryById = depositoryMapper.findDepositoryById(depositoryId); |
|
|
|
|
|
|
|
// 获取所有子单
|
|
|
|
List<StockTakingChildP> minRecordList = stockTakingMapper.selectStockTakingChildByMainId(mainId); |
|
|
|
List<StockTakingChild> minRecordList = stockTakingMapper.selectStockTakingChildByMainId(mainId); |
|
|
|
// 遍历当前拆单的子单详情
|
|
|
|
for (StockTakingChildP minRecord : minRecordList) { |
|
|
|
for (StockTakingChild minRecord : minRecordList) { |
|
|
|
|
|
|
|
|
|
|
|
// 获取子单详情
|
|
|
|
@ -1247,7 +1255,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
} |
|
|
|
|
|
|
|
// 获取盈亏数量
|
|
|
|
Integer inventory = minRecord.getInventory(); |
|
|
|
double inventory = minRecord.getInventory() / 100.0; |
|
|
|
|
|
|
|
|
|
|
|
// 获取判断对应的生产日期
|
|
|
|
@ -1255,7 +1263,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
|
|
|
|
|
|
|
|
// 当前盘点数目
|
|
|
|
Integer newInventory = minRecord.getNewInventory(); |
|
|
|
double newInventory = minRecord.getNewInventory() / 100.0; |
|
|
|
|
|
|
|
|
|
|
|
if (producedDate != null) { |
|
|
|
@ -1272,24 +1280,24 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
// 如果当前盘点数量大于库存数量
|
|
|
|
|
|
|
|
// 修改当前库存
|
|
|
|
materialAndProducedDate.setInventory(newInventory * 100); |
|
|
|
materialAndProducedDate.setInventory((int)(newInventory * 100)); |
|
|
|
// 修改使用数量
|
|
|
|
materialAndProducedDate.setExpendnum(materialAndProducedDate.getQuantity() - newInventory * 100); |
|
|
|
materialAndProducedDate.setExpendnum((int)(materialAndProducedDate.getQuantity() - newInventory * 100)); |
|
|
|
|
|
|
|
// 修改物料对应数量
|
|
|
|
inventoryById.setQuantity(inventoryById.getQuantity() + newInventory * 100 - oldInventory * 100); |
|
|
|
inventoryById.setQuantity((int)(inventoryById.getQuantity() + newInventory * 100 - oldInventory * 100)); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
// 如果当前盘点数量小于库存数量
|
|
|
|
|
|
|
|
// 修改当前库存
|
|
|
|
materialAndProducedDate.setInventory(newInventory * 100); |
|
|
|
materialAndProducedDate.setInventory((int)(newInventory * 100)); |
|
|
|
// 修改使用数量
|
|
|
|
materialAndProducedDate.setExpendnum(materialAndProducedDate.getQuantity() - newInventory * 100); |
|
|
|
materialAndProducedDate.setExpendnum((int)(materialAndProducedDate.getQuantity() - newInventory * 100)); |
|
|
|
|
|
|
|
// 修改物料对应数量
|
|
|
|
inventoryById.setQuantity(inventoryById.getQuantity() - oldInventory * 100 + newInventory * 100); |
|
|
|
inventoryById.setQuantity((int)(inventoryById.getQuantity() - oldInventory * 100 + newInventory * 100)); |
|
|
|
} |
|
|
|
|
|
|
|
materialMapper.updateMaterialAndProducedDate(materialAndProducedDate); |
|
|
|
@ -1307,7 +1315,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
if ("-1".equals(unit) || inventoryById.getUnit().equals(minRecord.getUnit())) { |
|
|
|
|
|
|
|
// 更新当前库位数量
|
|
|
|
newNumberForPlace = placeById.getQuantity() + inventory * 100; |
|
|
|
newNumberForPlace = placeById.getQuantity() +(int)( inventory * 100); |
|
|
|
|
|
|
|
if (newNumberForPlace <= placeById.getMax()) { |
|
|
|
// 如果更新后的库位数量没有上溢
|
|
|
|
@ -1321,9 +1329,9 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
|
|
|
|
continue; |
|
|
|
} |
|
|
|
inventoryById.setQuantity(inventoryById.getQuantity() + inventory * 100); |
|
|
|
inventoryById.setQuantity(inventoryById.getQuantity() +(int)( inventory * 100)); |
|
|
|
|
|
|
|
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() + inventory * 100; |
|
|
|
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() +(int)( inventory * 100); |
|
|
|
// 更新物料与库位对应关系的数量
|
|
|
|
placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace); |
|
|
|
|
|
|
|
@ -1405,7 +1413,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
if ("-1".equals(unit) || inventoryById.getUnit().equals(minRecord.getUnit())) { |
|
|
|
// 如果盘点的是基础单位
|
|
|
|
|
|
|
|
newNumberForPlace = placeById.getQuantity() - inventory * 100; |
|
|
|
newNumberForPlace = placeById.getQuantity() - (int)(inventory * 100); |
|
|
|
|
|
|
|
if (newNumberForPlace > placeById.getMin()) { |
|
|
|
//如果更新后的库位数量没有下溢
|
|
|
|
@ -1414,14 +1422,14 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
placeById.setQuantity(newNumberForPlace); |
|
|
|
|
|
|
|
// 更新物料与库位对应关系的数量
|
|
|
|
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - inventory * 100; |
|
|
|
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - (int)(inventory * 100); |
|
|
|
|
|
|
|
} else { |
|
|
|
placeById.setQuantity(0); |
|
|
|
newNumberForMatrialAndPlace = 0; |
|
|
|
} |
|
|
|
|
|
|
|
inventoryById.setQuantity(inventoryById.getQuantity() - inventory * 100); |
|
|
|
inventoryById.setQuantity(inventoryById.getQuantity() - (int)(inventory * 100)); |
|
|
|
|
|
|
|
placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace); |
|
|
|
|
|
|
|
@ -1443,7 +1451,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
// 如果单纯的拆单库存满足数量
|
|
|
|
|
|
|
|
// 设置当前拆单库存的数量
|
|
|
|
splitInventory.setSaveQuantity(splitInventory.getSaveQuantity() - inventory * 100); |
|
|
|
splitInventory.setSaveQuantity(splitInventory.getSaveQuantity() - (int)(inventory * 100)); |
|
|
|
// 修改拆单库存
|
|
|
|
splitUnitMapper.updateSplitInventory(splitInventory); |
|
|
|
} else { |
|
|
|
@ -1500,8 +1508,8 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
|
|
|
|
|
|
|
|
// 设置剩余拆单库存处理数量
|
|
|
|
splitInventory.setSaveQuantity(splitInfo.getQuantity() + splitInventory.getSaveQuantity() - inventory * 100); |
|
|
|
splitInventory.setOutQuantity(splitInventory.getOutQuantity() + inventory * 100); |
|
|
|
splitInventory.setSaveQuantity(splitInfo.getQuantity() + splitInventory.getSaveQuantity() - (int)(inventory * 100)); |
|
|
|
splitInventory.setOutQuantity(splitInventory.getOutQuantity() + (int)(inventory * 100)); |
|
|
|
splitUnitMapper.updateSplitInventory(splitInventory); |
|
|
|
} |
|
|
|
} else { |
|
|
|
@ -1585,7 +1593,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
int residue = (int) (Math.ceil(inventory / (double) scale)); |
|
|
|
|
|
|
|
// 获取剩余数目
|
|
|
|
int residue_realQuantity = residue * scale - inventory; |
|
|
|
int residue_realQuantity = residue * scale - (int)(inventory); |
|
|
|
|
|
|
|
|
|
|
|
// 更新库存数量
|
|
|
|
@ -1768,8 +1776,8 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
Integer depositoryId = mainRecord.getDepositoryId(); |
|
|
|
|
|
|
|
// 获取所有子单
|
|
|
|
List<StockTakingChildP> minRecordList = stockTakingMapper.selectStockTakingChildByMainId(ObjectFormatUtil.toInteger(mainId)); |
|
|
|
for (StockTakingChildP minRecord : minRecordList) { |
|
|
|
List<StockTakingChild> minRecordList = stockTakingMapper.selectStockTakingChildByMainId(ObjectFormatUtil.toInteger(mainId)); |
|
|
|
for (StockTakingChild minRecord : minRecordList) { |
|
|
|
// 获取子单详情
|
|
|
|
Integer placeId = minRecord.getPid(); |
|
|
|
// 获取库位详情
|
|
|
|
@ -1786,7 +1794,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
} |
|
|
|
|
|
|
|
// 获取盈亏数量
|
|
|
|
Integer inventory = minRecord.getInventory(); |
|
|
|
double inventory = minRecord.getInventory() / 100.0; |
|
|
|
|
|
|
|
|
|
|
|
Inventory inventoryById = materialMapper.findInventoryById(minRecord.getMid()); |
|
|
|
@ -1800,23 +1808,23 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
// 根据盘点结果重新计算物料的单价
|
|
|
|
|
|
|
|
|
|
|
|
Integer newInventory = minRecord.getNewInventory(); |
|
|
|
double newInventory = minRecord.getNewInventory() / 100.0; |
|
|
|
|
|
|
|
// 获取当前库位上物料数量
|
|
|
|
Integer oldQuantity = inventoryById.getQuantity() - placeAndMaterialByMidAndPid.getQuantity(); |
|
|
|
int oldQuantity = inventoryById.getQuantity() - placeAndMaterialByMidAndPid.getQuantity(); |
|
|
|
|
|
|
|
inventoryById.setQuantity(oldQuantity + newInventory); |
|
|
|
inventoryById.setQuantity(oldQuantity + (int)(newInventory * 100)); |
|
|
|
|
|
|
|
|
|
|
|
// 用于计算新的库位数量
|
|
|
|
Integer newNumberForPlace = 0; |
|
|
|
int newNumberForPlace = 0; |
|
|
|
// 用于计算新的库位与物料对应关系的数量
|
|
|
|
Integer newNumberForMatrialAndPlace = 0; |
|
|
|
int newNumberForMatrialAndPlace = 0; |
|
|
|
if ("Inventory_up".equals(takingResult)) { |
|
|
|
// 如果盘盈
|
|
|
|
|
|
|
|
// 更新当前库位数量
|
|
|
|
newNumberForPlace = placeById.getQuantity() + inventory; |
|
|
|
newNumberForPlace = placeById.getQuantity() +(int)( inventory * 100); |
|
|
|
|
|
|
|
if (newNumberForPlace < placeById.getMax()) { |
|
|
|
|
|
|
|
@ -1832,14 +1840,14 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() + inventory; |
|
|
|
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() + (int)(inventory*100); |
|
|
|
// 更新物料与库位对应关系的数量
|
|
|
|
placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 如果盘亏
|
|
|
|
newNumberForPlace = placeById.getQuantity() - inventory; |
|
|
|
newNumberForPlace = placeById.getQuantity() - (int)(inventory*100); |
|
|
|
|
|
|
|
if (newNumberForPlace > placeById.getMin()) { |
|
|
|
//如果更新后的库位数量没有下溢
|
|
|
|
@ -1848,7 +1856,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
placeById.setQuantity(newNumberForPlace); |
|
|
|
|
|
|
|
// 更新物料与库位对应关系的数量
|
|
|
|
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - inventory; |
|
|
|
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - (int)(inventory*100); |
|
|
|
|
|
|
|
} else { |
|
|
|
placeById.setQuantity(0); |
|
|
|
@ -1958,7 +1966,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
for (Integer minId : minIds) { |
|
|
|
|
|
|
|
// 获取对应子订单
|
|
|
|
StockTakingChildP minRecord = stockTakingMapper.selectStockTakingChildPById(minId); |
|
|
|
StockTakingChild minRecord = stockTakingMapper.selectStockTakingChildPById(minId); |
|
|
|
|
|
|
|
|
|
|
|
// 获取当前物料库存记录
|
|
|
|
@ -2812,11 +2820,11 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
|
|
|
|
|
|
|
|
// 用于标识是否向盘点人员发送卡片
|
|
|
|
Boolean flag = true; |
|
|
|
boolean flag = true; |
|
|
|
|
|
|
|
// 获取主单
|
|
|
|
StockTaking mainRecord = stockTakingMapper.selectStockTakingById(mainId); |
|
|
|
Integer departmentManagerState = 2; |
|
|
|
int departmentManagerState = 2; |
|
|
|
|
|
|
|
// 获取当前处理时间
|
|
|
|
String simpleTime = DateUtil.getSimpleTime(new Date()); |
|
|
|
@ -2833,11 +2841,9 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
|
|
|
|
|
|
|
|
// 获取所有子单
|
|
|
|
List<StockTakingChildP> minRecordList = stockTakingMapper.selectStockTakingChildByMainId(mainId); |
|
|
|
for (int i = 0; i < minRecordList.size(); i++) { |
|
|
|
List<StockTakingChild> minRecordList = stockTakingMapper.selectStockTakingChildByMainId(mainId); |
|
|
|
for (StockTakingChild minRecord : minRecordList) { |
|
|
|
// 获取子单详情
|
|
|
|
StockTakingChildP minRecord = minRecordList.get(i); |
|
|
|
|
|
|
|
Integer placeId = minRecord.getPid(); |
|
|
|
// 获取库位详情
|
|
|
|
Place placeById = placeMapper.findPlaceById(placeId); |
|
|
|
@ -2850,7 +2856,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
} |
|
|
|
|
|
|
|
// 获取盈亏数量
|
|
|
|
Integer inventory = minRecord.getInventory(); |
|
|
|
double inventory = minRecord.getInventory() / 100.0; |
|
|
|
|
|
|
|
|
|
|
|
Material materialById = materialMapper.findMaterialById(minRecord.getMid()); |
|
|
|
@ -2864,24 +2870,24 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
// 根据盘点结果重新计算物料的单价
|
|
|
|
|
|
|
|
|
|
|
|
Integer newInventory = minRecord.getNewInventory(); |
|
|
|
double newInventory = minRecord.getNewInventory() / 100.0; |
|
|
|
|
|
|
|
|
|
|
|
// 获取当前库位上物料数量
|
|
|
|
Integer oldQuantity = materialById.getQuantity() - placeAndMaterialByMidAndPid.getQuantity(); |
|
|
|
int oldQuantity = materialById.getQuantity() - placeAndMaterialByMidAndPid.getQuantity(); |
|
|
|
|
|
|
|
materialById.setQuantity(oldQuantity + newInventory); |
|
|
|
materialById.setQuantity(oldQuantity + (int)(newInventory*100)); |
|
|
|
|
|
|
|
|
|
|
|
// 用于计算新的库位数量
|
|
|
|
Integer newNumberForPlace = 0; |
|
|
|
int newNumberForPlace = 0; |
|
|
|
// 用于计算新的库位与物料对应关系的数量
|
|
|
|
Integer newNumberForMatrialAndPlace = 0; |
|
|
|
int newNumberForMatrialAndPlace = 0; |
|
|
|
if ("Inventory_up".equals(takingResult)) { |
|
|
|
// 如果盘盈
|
|
|
|
|
|
|
|
// 更新当前库位数量
|
|
|
|
newNumberForPlace = placeById.getQuantity() + inventory; |
|
|
|
newNumberForPlace = placeById.getQuantity() +(int)(inventory*100); |
|
|
|
|
|
|
|
if (newNumberForPlace < placeById.getMax()) { |
|
|
|
|
|
|
|
@ -2897,14 +2903,14 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() + inventory; |
|
|
|
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() + (int)(inventory*100); |
|
|
|
// 更新物料与库位对应关系的数量
|
|
|
|
placeAndMaterialByMidAndPid.setQuantity(newNumberForMatrialAndPlace); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 如果盘亏
|
|
|
|
newNumberForPlace = placeById.getQuantity() - inventory; |
|
|
|
newNumberForPlace = placeById.getQuantity() - (int)(inventory*100); |
|
|
|
|
|
|
|
if (newNumberForPlace > placeById.getMin()) { |
|
|
|
//如果更新后的库位数量没有下溢
|
|
|
|
@ -2913,7 +2919,7 @@ public class StockTakingServiceImpl implements StockTakingService { |
|
|
|
placeById.setQuantity(newNumberForPlace); |
|
|
|
|
|
|
|
// 更新物料与库位对应关系的数量
|
|
|
|
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() - inventory; |
|
|
|
newNumberForMatrialAndPlace = placeAndMaterialByMidAndPid.getQuantity() -(int)( inventory*100); |
|
|
|
|
|
|
|
} else { |
|
|
|
placeById.setQuantity(0); |
|
|
|
|