|
|
|
|
@ -162,25 +162,6 @@ public class WmsInventoryDetailsServiceImpl implements IWmsInventoryDetailsServi
|
|
|
|
|
return baseMapper.deleteByIds(ids) > 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Double workUpdateInventory(Long inventoryDetailsId, Double disposalQty) {
|
|
|
|
|
|
|
|
|
|
WmsInventoryDetails inventory = baseMapper.selectById(inventoryDetailsId);
|
|
|
|
|
Double inventoryAmount = inventory.getInventoryAmount();
|
|
|
|
|
double lossQty = inventoryAmount - disposalQty;
|
|
|
|
|
if (lossQty < 0) {
|
|
|
|
|
throw new IllegalArgumentException("库存数量不足");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inventory.setInventoryAmount(lossQty);
|
|
|
|
|
if (lossQty == 0.0) {
|
|
|
|
|
inventory.setDelFlag("1");
|
|
|
|
|
}
|
|
|
|
|
inventory.setUpdateBy(LoginHelper.getUserId());
|
|
|
|
|
inventory.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
|
baseMapper.updataDetailsByInventoryId(inventory);
|
|
|
|
|
return inventoryAmount;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public WmsInventoryDetails selectDetailsById(Long sampleLedgerId) {
|
|
|
|
|
@ -223,7 +204,7 @@ public class WmsInventoryDetailsServiceImpl implements IWmsInventoryDetailsServi
|
|
|
|
|
Double inventoryTableAmount = 0.0;
|
|
|
|
|
if (queryInventory != null) {
|
|
|
|
|
inventoryTableAmount = queryInventory.getInventoryAmount();
|
|
|
|
|
baseMapper.updateTableById(queryInventory.getInventoryDetailsId(), inStockAmount, DateUtils.getNowDate(), LoginHelper.getUserId()); // 更新库存数量
|
|
|
|
|
baseMapper.updateTableById(queryInventory.getInventoryDetailsId(), inStockAmount, DateUtils.getNowDate(), LoginHelper.getUserId()); // update增加库存数量
|
|
|
|
|
} else {
|
|
|
|
|
inventory.setUnitName(unitName);
|
|
|
|
|
inventory.setInventoryAmount(inStockAmount);
|
|
|
|
|
@ -263,4 +244,28 @@ public class WmsInventoryDetailsServiceImpl implements IWmsInventoryDetailsServi
|
|
|
|
|
|
|
|
|
|
return baseMapper.selectOne(lqw);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Boolean outStoreLossInventoryAmount(Long inventoryId, Double outStockAmount, Long warehouseId,
|
|
|
|
|
String batchNumber, Long materielId, String changeType) {
|
|
|
|
|
WmsInventoryDetails inventory = baseMapper.selectById(inventoryId);
|
|
|
|
|
Double inventoryAmount = inventory.getInventoryAmount();
|
|
|
|
|
double lossQty = inventoryAmount - outStockAmount;
|
|
|
|
|
if (lossQty < 0) {
|
|
|
|
|
throw new IllegalArgumentException("库存数量不足");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
baseMapper.updataDetailsByInventoryId(inventoryId, outStockAmount, DateUtils.getNowDate(), LoginHelper.getUserId(), lossQty == 0.0 ? "1" : "0");
|
|
|
|
|
//库存变动
|
|
|
|
|
WmsInventoryLedger wmsInventoryLedger = new WmsInventoryLedger();
|
|
|
|
|
wmsInventoryLedger.setWarehouseId(warehouseId);
|
|
|
|
|
wmsInventoryLedger.setBatchNumber(batchNumber);
|
|
|
|
|
wmsInventoryLedger.setMaterielId(materielId);
|
|
|
|
|
wmsInventoryLedger.setChangeType(changeType);//变动类型
|
|
|
|
|
wmsInventoryLedger.setLedgerState("0");
|
|
|
|
|
wmsInventoryLedger.setChangeAmount(outStockAmount);
|
|
|
|
|
wmsInventoryLedger.setInventoryAmount(inventoryAmount);
|
|
|
|
|
wmsInventoryLedgerMapper.insert(wmsInventoryLedger);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|