修改库存统一方法;查询动态表单配置返回修改;
This commit is contained in:
+21
-1
@@ -98,4 +98,24 @@ public interface IMaterialInventoryService extends IService<MaterialInventory>
|
|||||||
public BigDecimal sumInventoryQuantityByShipperAndMaterialCode(Long shipperCode, Long materialBaseInfoId);
|
public BigDecimal sumInventoryQuantityByShipperAndMaterialCode(Long shipperCode, Long materialBaseInfoId);
|
||||||
|
|
||||||
MaterialInventoryPO selectOneByWhere(MaterialInventoryDO materialInventoryDO);
|
MaterialInventoryPO selectOneByWhere(MaterialInventoryDO materialInventoryDO);
|
||||||
}
|
|
||||||
|
/*
|
||||||
|
* 库存调整方法
|
||||||
|
* netWeight 总净重
|
||||||
|
* grossWeight 总毛重
|
||||||
|
* volume 体积
|
||||||
|
* area 面积
|
||||||
|
* quantity 数量
|
||||||
|
* type 类型(1:上架2:分配3:取消分配4:出库交接5:移位6:库存调整7:库存冻结)
|
||||||
|
* materialInventoryId 物料库存ID
|
||||||
|
* */
|
||||||
|
public void xgkc(BigDecimal netWeight,
|
||||||
|
BigDecimal grossWeight,
|
||||||
|
BigDecimal volume,
|
||||||
|
BigDecimal area,
|
||||||
|
BigDecimal quantity,
|
||||||
|
String type,
|
||||||
|
Long materialInventoryId);
|
||||||
|
|
||||||
|
//public void kctzjl();
|
||||||
|
}
|
||||||
+383
@@ -501,4 +501,387 @@ public class MaterialInventoryImpl extends ServiceImpl<MaterialInventoryMapper,
|
|||||||
public MaterialInventoryPO selectOneByWhere(MaterialInventoryDO materialInventoryDO) {
|
public MaterialInventoryPO selectOneByWhere(MaterialInventoryDO materialInventoryDO) {
|
||||||
return materialInventoryMapper.selectOneByWhere(materialInventoryDO);
|
return materialInventoryMapper.selectOneByWhere(materialInventoryDO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void xgkc(BigDecimal netWeight, BigDecimal grossWeight, BigDecimal volume, BigDecimal area, BigDecimal quantity, String type, Long materialInventoryId) {
|
||||||
|
netWeight = netWeight != null ? netWeight : BigDecimal.ZERO;
|
||||||
|
grossWeight = grossWeight != null ? grossWeight : BigDecimal.ZERO;
|
||||||
|
volume = volume != null ? volume : BigDecimal.ZERO;
|
||||||
|
area = area != null ? area : BigDecimal.ZERO;
|
||||||
|
quantity = quantity != null ? quantity : BigDecimal.ZERO;
|
||||||
|
|
||||||
|
MaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId);
|
||||||
|
if (materialInventoryPO != null) {
|
||||||
|
//类型(1:上架2:分配3:取消分配4:出库交接5:移位6:库存调整7:库存冻结)
|
||||||
|
switch (type) {
|
||||||
|
case "1":
|
||||||
|
// 上架
|
||||||
|
sj(netWeight, grossWeight, volume, area, quantity, materialInventoryId);
|
||||||
|
break;
|
||||||
|
case "2":
|
||||||
|
// 分配
|
||||||
|
ff(netWeight, grossWeight, volume, area, quantity, materialInventoryId);
|
||||||
|
break;
|
||||||
|
case "3":
|
||||||
|
// 取消分配
|
||||||
|
qxff(netWeight, grossWeight, volume, area, quantity, materialInventoryId);
|
||||||
|
break;
|
||||||
|
case "4":
|
||||||
|
// 出库交接
|
||||||
|
ckjj(netWeight, grossWeight, volume, area, quantity, materialInventoryId);
|
||||||
|
break;
|
||||||
|
case "5":
|
||||||
|
// 移位
|
||||||
|
yw(netWeight, grossWeight, volume, area, quantity, materialInventoryId);
|
||||||
|
break;
|
||||||
|
case "6":
|
||||||
|
// 库存调整
|
||||||
|
kctz(netWeight, grossWeight, volume, area, quantity, materialInventoryId);
|
||||||
|
break;
|
||||||
|
case "7":
|
||||||
|
// 库存冻结
|
||||||
|
kcdj(netWeight, grossWeight, volume, area, quantity, materialInventoryId);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new ServiceException("错误的类型");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sj(BigDecimal netWeight, BigDecimal grossWeight, BigDecimal volume, BigDecimal area, BigDecimal quantity, Long materialInventoryId) {
|
||||||
|
MaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId);
|
||||||
|
if (materialInventoryPO != null) {
|
||||||
|
//库存数量
|
||||||
|
BigDecimal oldInventoryQuantity = materialInventoryPO.getInventoryQuantity();
|
||||||
|
oldInventoryQuantity = oldInventoryQuantity != null ? oldInventoryQuantity : BigDecimal.ZERO;
|
||||||
|
//可用数量
|
||||||
|
BigDecimal oldAllocationQuantity = materialInventoryPO.getAllocationQuantity();
|
||||||
|
oldAllocationQuantity = oldAllocationQuantity != null ? oldAllocationQuantity : BigDecimal.ZERO;
|
||||||
|
//冻结数量(出库交接不变动冻结数量)
|
||||||
|
BigDecimal oldFreezeQuantity = materialInventoryPO.getFreezeQuantity();
|
||||||
|
oldFreezeQuantity = oldFreezeQuantity != null ? oldFreezeQuantity : BigDecimal.ZERO;
|
||||||
|
//扣减后库存数量
|
||||||
|
BigDecimal newInventoryQuantity = oldInventoryQuantity.subtract(quantity);
|
||||||
|
//扣减后可用数量
|
||||||
|
BigDecimal newAllocationQuantity = oldAllocationQuantity.subtract(quantity);
|
||||||
|
BigDecimal newFreezeQuantity = oldFreezeQuantity.subtract(quantity);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
BigDecimal oldArea = materialInventoryPO.getArea();
|
||||||
|
BigDecimal oldVolume = materialInventoryPO.getVolume();
|
||||||
|
BigDecimal oldGrossWeight = materialInventoryPO.getGrossWeight();
|
||||||
|
BigDecimal oldNetWeight = materialInventoryPO.getNetWeight();
|
||||||
|
|
||||||
|
// 初始化旧数据,避免空指针
|
||||||
|
oldArea = oldArea != null ? oldArea : BigDecimal.ZERO;
|
||||||
|
oldVolume = oldVolume != null ? oldVolume : BigDecimal.ZERO;
|
||||||
|
oldGrossWeight = oldGrossWeight != null ? oldGrossWeight : BigDecimal.ZERO;
|
||||||
|
oldNetWeight = oldNetWeight != null ? oldNetWeight : BigDecimal.ZERO;
|
||||||
|
|
||||||
|
BigDecimal newArea = oldArea.add(area);
|
||||||
|
BigDecimal newVolume = oldVolume.add(volume);
|
||||||
|
BigDecimal newGrossWeight = oldGrossWeight.add(grossWeight);
|
||||||
|
BigDecimal newNetWeight = oldNetWeight.add(netWeight);
|
||||||
|
|
||||||
|
materialInventoryPO.setInventoryQuantity(newInventoryQuantity);
|
||||||
|
//materialInventoryPO.setAllocationQuantity(materialInventoryPO.getAllocationQuantity());
|
||||||
|
materialInventoryPO.setFreezeQuantity(newFreezeQuantity);
|
||||||
|
materialInventoryPO.setArea(newArea);
|
||||||
|
materialInventoryPO.setVolume(newVolume);
|
||||||
|
materialInventoryPO.setGrossWeight(newGrossWeight);
|
||||||
|
materialInventoryPO.setNetWeight(newNetWeight);
|
||||||
|
MaterialInventory materialInventory = new MaterialInventory();
|
||||||
|
com.mhd.common.core.utils.bean.BeanUtils.copyProperties(materialInventoryPO, materialInventory);
|
||||||
|
materialInventoryMapper.updateById(materialInventory);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ff(BigDecimal netWeight, BigDecimal grossWeight, BigDecimal volume, BigDecimal area, BigDecimal quantity, Long materialInventoryId) {
|
||||||
|
MaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId);
|
||||||
|
if (materialInventoryPO != null) {
|
||||||
|
//库存数量
|
||||||
|
BigDecimal oldInventoryQuantity = materialInventoryPO.getInventoryQuantity();
|
||||||
|
oldInventoryQuantity = oldInventoryQuantity != null ? oldInventoryQuantity : BigDecimal.ZERO;
|
||||||
|
//可用数量
|
||||||
|
BigDecimal oldAllocationQuantity = materialInventoryPO.getAllocationQuantity();
|
||||||
|
oldAllocationQuantity = oldAllocationQuantity != null ? oldAllocationQuantity : BigDecimal.ZERO;
|
||||||
|
//冻结数量(出库交接不变动冻结数量)
|
||||||
|
BigDecimal oldFreezeQuantity = materialInventoryPO.getFreezeQuantity();
|
||||||
|
oldFreezeQuantity = oldFreezeQuantity != null ? oldFreezeQuantity : BigDecimal.ZERO;
|
||||||
|
//扣减后库存数量
|
||||||
|
BigDecimal newInventoryQuantity = oldInventoryQuantity.subtract(quantity);
|
||||||
|
//扣减后可用数量
|
||||||
|
BigDecimal newAllocationQuantity = oldAllocationQuantity.subtract(quantity);
|
||||||
|
BigDecimal newFreezeQuantity = oldFreezeQuantity.add(quantity);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
BigDecimal oldArea = materialInventoryPO.getArea();
|
||||||
|
BigDecimal oldVolume = materialInventoryPO.getVolume();
|
||||||
|
BigDecimal oldGrossWeight = materialInventoryPO.getGrossWeight();
|
||||||
|
BigDecimal oldNetWeight = materialInventoryPO.getNetWeight();
|
||||||
|
|
||||||
|
// 初始化旧数据,避免空指针
|
||||||
|
oldArea = oldArea != null ? oldArea : BigDecimal.ZERO;
|
||||||
|
oldVolume = oldVolume != null ? oldVolume : BigDecimal.ZERO;
|
||||||
|
oldGrossWeight = oldGrossWeight != null ? oldGrossWeight : BigDecimal.ZERO;
|
||||||
|
oldNetWeight = oldNetWeight != null ? oldNetWeight : BigDecimal.ZERO;
|
||||||
|
|
||||||
|
BigDecimal newArea = oldArea.subtract(area);
|
||||||
|
BigDecimal newVolume = oldVolume.subtract(volume);
|
||||||
|
BigDecimal newGrossWeight = oldGrossWeight.subtract(grossWeight);
|
||||||
|
BigDecimal newNetWeight = oldNetWeight.subtract(netWeight);
|
||||||
|
|
||||||
|
//materialInventoryPO.setInventoryQuantity(newInventoryQuantity);
|
||||||
|
materialInventoryPO.setAllocationQuantity(newAllocationQuantity);
|
||||||
|
materialInventoryPO.setFreezeQuantity(newFreezeQuantity);
|
||||||
|
materialInventoryPO.setArea(newArea);
|
||||||
|
materialInventoryPO.setVolume(newVolume);
|
||||||
|
materialInventoryPO.setGrossWeight(newGrossWeight);
|
||||||
|
materialInventoryPO.setNetWeight(newNetWeight);
|
||||||
|
MaterialInventory materialInventory = new MaterialInventory();
|
||||||
|
com.mhd.common.core.utils.bean.BeanUtils.copyProperties(materialInventoryPO, materialInventory);
|
||||||
|
materialInventoryMapper.updateById(materialInventory);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void qxff(BigDecimal netWeight, BigDecimal grossWeight, BigDecimal volume, BigDecimal area, BigDecimal quantity, Long materialInventoryId) {
|
||||||
|
MaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId);
|
||||||
|
if (materialInventoryPO != null) {
|
||||||
|
//库存数量
|
||||||
|
BigDecimal oldInventoryQuantity = materialInventoryPO.getInventoryQuantity();
|
||||||
|
oldInventoryQuantity = oldInventoryQuantity != null ? oldInventoryQuantity : BigDecimal.ZERO;
|
||||||
|
//可用数量
|
||||||
|
BigDecimal oldAllocationQuantity = materialInventoryPO.getAllocationQuantity();
|
||||||
|
oldAllocationQuantity = oldAllocationQuantity != null ? oldAllocationQuantity : BigDecimal.ZERO;
|
||||||
|
//冻结数量(出库交接不变动冻结数量)
|
||||||
|
BigDecimal oldFreezeQuantity = materialInventoryPO.getFreezeQuantity();
|
||||||
|
oldFreezeQuantity = oldFreezeQuantity != null ? oldFreezeQuantity : BigDecimal.ZERO;
|
||||||
|
//扣减后库存数量
|
||||||
|
BigDecimal newInventoryQuantity = oldInventoryQuantity.subtract(quantity);
|
||||||
|
//扣减后可用数量
|
||||||
|
BigDecimal newAllocationQuantity = oldAllocationQuantity.add(quantity);
|
||||||
|
BigDecimal newFreezeQuantity = oldFreezeQuantity.subtract(quantity);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
BigDecimal oldArea = materialInventoryPO.getArea();
|
||||||
|
BigDecimal oldVolume = materialInventoryPO.getVolume();
|
||||||
|
BigDecimal oldGrossWeight = materialInventoryPO.getGrossWeight();
|
||||||
|
BigDecimal oldNetWeight = materialInventoryPO.getNetWeight();
|
||||||
|
|
||||||
|
// 初始化旧数据,避免空指针
|
||||||
|
oldArea = oldArea != null ? oldArea : BigDecimal.ZERO;
|
||||||
|
oldVolume = oldVolume != null ? oldVolume : BigDecimal.ZERO;
|
||||||
|
oldGrossWeight = oldGrossWeight != null ? oldGrossWeight : BigDecimal.ZERO;
|
||||||
|
oldNetWeight = oldNetWeight != null ? oldNetWeight : BigDecimal.ZERO;
|
||||||
|
|
||||||
|
BigDecimal newArea = oldArea.subtract(area);
|
||||||
|
BigDecimal newVolume = oldVolume.subtract(volume);
|
||||||
|
BigDecimal newGrossWeight = oldGrossWeight.subtract(grossWeight);
|
||||||
|
BigDecimal newNetWeight = oldNetWeight.subtract(netWeight);
|
||||||
|
|
||||||
|
//materialInventoryPO.setInventoryQuantity(newInventoryQuantity);
|
||||||
|
materialInventoryPO.setAllocationQuantity(newAllocationQuantity);
|
||||||
|
materialInventoryPO.setFreezeQuantity(newFreezeQuantity);
|
||||||
|
materialInventoryPO.setArea(newArea);
|
||||||
|
materialInventoryPO.setVolume(newVolume);
|
||||||
|
materialInventoryPO.setGrossWeight(newGrossWeight);
|
||||||
|
materialInventoryPO.setNetWeight(newNetWeight);
|
||||||
|
MaterialInventory materialInventory = new MaterialInventory();
|
||||||
|
com.mhd.common.core.utils.bean.BeanUtils.copyProperties(materialInventoryPO, materialInventory);
|
||||||
|
materialInventoryMapper.updateById(materialInventory);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ckjj(BigDecimal netWeight, BigDecimal grossWeight, BigDecimal volume, BigDecimal area, BigDecimal quantity, Long materialInventoryId) {
|
||||||
|
MaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId);
|
||||||
|
if (materialInventoryPO != null) {
|
||||||
|
//库存数量
|
||||||
|
BigDecimal oldInventoryQuantity = materialInventoryPO.getInventoryQuantity();
|
||||||
|
oldInventoryQuantity = oldInventoryQuantity != null ? oldInventoryQuantity : BigDecimal.ZERO;
|
||||||
|
//可用数量
|
||||||
|
BigDecimal oldAllocationQuantity = materialInventoryPO.getAllocationQuantity();
|
||||||
|
oldAllocationQuantity = oldAllocationQuantity != null ? oldAllocationQuantity : BigDecimal.ZERO;
|
||||||
|
//冻结数量(出库交接不变动冻结数量)
|
||||||
|
BigDecimal oldFreezeQuantity = materialInventoryPO.getFreezeQuantity();
|
||||||
|
oldFreezeQuantity = oldFreezeQuantity != null ? oldFreezeQuantity : BigDecimal.ZERO;
|
||||||
|
//扣减后库存数量
|
||||||
|
BigDecimal newInventoryQuantity = oldInventoryQuantity.subtract(quantity);
|
||||||
|
//扣减后可用数量
|
||||||
|
BigDecimal newAllocationQuantity = oldAllocationQuantity.subtract(quantity);
|
||||||
|
BigDecimal newFreezeQuantity = oldFreezeQuantity.subtract(quantity);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
BigDecimal oldArea = materialInventoryPO.getArea();
|
||||||
|
BigDecimal oldVolume = materialInventoryPO.getVolume();
|
||||||
|
BigDecimal oldGrossWeight = materialInventoryPO.getGrossWeight();
|
||||||
|
BigDecimal oldNetWeight = materialInventoryPO.getNetWeight();
|
||||||
|
|
||||||
|
// 初始化旧数据,避免空指针
|
||||||
|
oldArea = oldArea != null ? oldArea : BigDecimal.ZERO;
|
||||||
|
oldVolume = oldVolume != null ? oldVolume : BigDecimal.ZERO;
|
||||||
|
oldGrossWeight = oldGrossWeight != null ? oldGrossWeight : BigDecimal.ZERO;
|
||||||
|
oldNetWeight = oldNetWeight != null ? oldNetWeight : BigDecimal.ZERO;
|
||||||
|
|
||||||
|
BigDecimal newArea = oldArea.subtract(area);
|
||||||
|
BigDecimal newVolume = oldVolume.subtract(volume);
|
||||||
|
BigDecimal newGrossWeight = oldGrossWeight.subtract(grossWeight);
|
||||||
|
BigDecimal newNetWeight = oldNetWeight.subtract(netWeight);
|
||||||
|
|
||||||
|
materialInventoryPO.setInventoryQuantity(newInventoryQuantity);
|
||||||
|
//materialInventoryPO.setAllocationQuantity(materialInventoryPO.getAllocationQuantity());
|
||||||
|
materialInventoryPO.setFreezeQuantity(newFreezeQuantity);
|
||||||
|
materialInventoryPO.setArea(newArea);
|
||||||
|
materialInventoryPO.setVolume(newVolume);
|
||||||
|
materialInventoryPO.setGrossWeight(newGrossWeight);
|
||||||
|
materialInventoryPO.setNetWeight(newNetWeight);
|
||||||
|
MaterialInventory materialInventory = new MaterialInventory();
|
||||||
|
com.mhd.common.core.utils.bean.BeanUtils.copyProperties(materialInventoryPO, materialInventory);
|
||||||
|
materialInventoryMapper.updateById(materialInventory);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void yw(BigDecimal netWeight, BigDecimal grossWeight, BigDecimal volume, BigDecimal area, BigDecimal quantity, Long materialInventoryId) {
|
||||||
|
MaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId);
|
||||||
|
if (materialInventoryPO != null) {
|
||||||
|
//库存数量
|
||||||
|
BigDecimal oldInventoryQuantity = materialInventoryPO.getInventoryQuantity();
|
||||||
|
oldInventoryQuantity = oldInventoryQuantity != null ? oldInventoryQuantity : BigDecimal.ZERO;
|
||||||
|
//可用数量
|
||||||
|
BigDecimal oldAllocationQuantity = materialInventoryPO.getAllocationQuantity();
|
||||||
|
oldAllocationQuantity = oldAllocationQuantity != null ? oldAllocationQuantity : BigDecimal.ZERO;
|
||||||
|
//冻结数量(出库交接不变动冻结数量)
|
||||||
|
BigDecimal oldFreezeQuantity = materialInventoryPO.getFreezeQuantity();
|
||||||
|
oldFreezeQuantity = oldFreezeQuantity != null ? oldFreezeQuantity : BigDecimal.ZERO;
|
||||||
|
//扣减后库存数量
|
||||||
|
BigDecimal newInventoryQuantity = oldInventoryQuantity.subtract(quantity);
|
||||||
|
//扣减后可用数量
|
||||||
|
BigDecimal newAllocationQuantity = oldAllocationQuantity.subtract(quantity);
|
||||||
|
BigDecimal newFreezeQuantity = oldFreezeQuantity.subtract(quantity);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
BigDecimal oldArea = materialInventoryPO.getArea();
|
||||||
|
BigDecimal oldVolume = materialInventoryPO.getVolume();
|
||||||
|
BigDecimal oldGrossWeight = materialInventoryPO.getGrossWeight();
|
||||||
|
BigDecimal oldNetWeight = materialInventoryPO.getNetWeight();
|
||||||
|
|
||||||
|
// 初始化旧数据,避免空指针
|
||||||
|
oldArea = oldArea != null ? oldArea : BigDecimal.ZERO;
|
||||||
|
oldVolume = oldVolume != null ? oldVolume : BigDecimal.ZERO;
|
||||||
|
oldGrossWeight = oldGrossWeight != null ? oldGrossWeight : BigDecimal.ZERO;
|
||||||
|
oldNetWeight = oldNetWeight != null ? oldNetWeight : BigDecimal.ZERO;
|
||||||
|
|
||||||
|
BigDecimal newArea = oldArea.subtract(area);
|
||||||
|
BigDecimal newVolume = oldVolume.subtract(volume);
|
||||||
|
BigDecimal newGrossWeight = oldGrossWeight.subtract(grossWeight);
|
||||||
|
BigDecimal newNetWeight = oldNetWeight.subtract(netWeight);
|
||||||
|
|
||||||
|
materialInventoryPO.setInventoryQuantity(newInventoryQuantity);
|
||||||
|
//materialInventoryPO.setAllocationQuantity(materialInventoryPO.getAllocationQuantity());
|
||||||
|
materialInventoryPO.setFreezeQuantity(newFreezeQuantity);
|
||||||
|
materialInventoryPO.setArea(newArea);
|
||||||
|
materialInventoryPO.setVolume(newVolume);
|
||||||
|
materialInventoryPO.setGrossWeight(newGrossWeight);
|
||||||
|
materialInventoryPO.setNetWeight(newNetWeight);
|
||||||
|
MaterialInventory materialInventory = new MaterialInventory();
|
||||||
|
com.mhd.common.core.utils.bean.BeanUtils.copyProperties(materialInventoryPO, materialInventory);
|
||||||
|
materialInventoryMapper.updateById(materialInventory);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void kctz(BigDecimal netWeight, BigDecimal grossWeight, BigDecimal volume, BigDecimal area, BigDecimal quantity, Long materialInventoryId) {
|
||||||
|
MaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId);
|
||||||
|
if (materialInventoryPO != null) {
|
||||||
|
//库存数量
|
||||||
|
BigDecimal oldInventoryQuantity = materialInventoryPO.getInventoryQuantity();
|
||||||
|
oldInventoryQuantity = oldInventoryQuantity != null ? oldInventoryQuantity : BigDecimal.ZERO;
|
||||||
|
//可用数量
|
||||||
|
BigDecimal oldAllocationQuantity = materialInventoryPO.getAllocationQuantity();
|
||||||
|
oldAllocationQuantity = oldAllocationQuantity != null ? oldAllocationQuantity : BigDecimal.ZERO;
|
||||||
|
//冻结数量(出库交接不变动冻结数量)
|
||||||
|
BigDecimal oldFreezeQuantity = materialInventoryPO.getFreezeQuantity();
|
||||||
|
oldFreezeQuantity = oldFreezeQuantity != null ? oldFreezeQuantity : BigDecimal.ZERO;
|
||||||
|
//扣减后库存数量
|
||||||
|
BigDecimal newInventoryQuantity = oldInventoryQuantity.subtract(quantity);
|
||||||
|
//扣减后可用数量
|
||||||
|
BigDecimal newAllocationQuantity = oldAllocationQuantity.subtract(quantity);
|
||||||
|
BigDecimal newFreezeQuantity = oldFreezeQuantity.subtract(quantity);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
BigDecimal oldArea = materialInventoryPO.getArea();
|
||||||
|
BigDecimal oldVolume = materialInventoryPO.getVolume();
|
||||||
|
BigDecimal oldGrossWeight = materialInventoryPO.getGrossWeight();
|
||||||
|
BigDecimal oldNetWeight = materialInventoryPO.getNetWeight();
|
||||||
|
|
||||||
|
// 初始化旧数据,避免空指针
|
||||||
|
oldArea = oldArea != null ? oldArea : BigDecimal.ZERO;
|
||||||
|
oldVolume = oldVolume != null ? oldVolume : BigDecimal.ZERO;
|
||||||
|
oldGrossWeight = oldGrossWeight != null ? oldGrossWeight : BigDecimal.ZERO;
|
||||||
|
oldNetWeight = oldNetWeight != null ? oldNetWeight : BigDecimal.ZERO;
|
||||||
|
|
||||||
|
BigDecimal newArea = oldArea.subtract(area);
|
||||||
|
BigDecimal newVolume = oldVolume.subtract(volume);
|
||||||
|
BigDecimal newGrossWeight = oldGrossWeight.subtract(grossWeight);
|
||||||
|
BigDecimal newNetWeight = oldNetWeight.subtract(netWeight);
|
||||||
|
|
||||||
|
materialInventoryPO.setInventoryQuantity(newInventoryQuantity);
|
||||||
|
//materialInventoryPO.setAllocationQuantity(materialInventoryPO.getAllocationQuantity());
|
||||||
|
materialInventoryPO.setFreezeQuantity(newFreezeQuantity);
|
||||||
|
materialInventoryPO.setArea(newArea);
|
||||||
|
materialInventoryPO.setVolume(newVolume);
|
||||||
|
materialInventoryPO.setGrossWeight(newGrossWeight);
|
||||||
|
materialInventoryPO.setNetWeight(newNetWeight);
|
||||||
|
MaterialInventory materialInventory = new MaterialInventory();
|
||||||
|
com.mhd.common.core.utils.bean.BeanUtils.copyProperties(materialInventoryPO, materialInventory);
|
||||||
|
materialInventoryMapper.updateById(materialInventory);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void kcdj(BigDecimal netWeight, BigDecimal grossWeight, BigDecimal volume, BigDecimal area, BigDecimal quantity, Long materialInventoryId) {
|
||||||
|
MaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId);
|
||||||
|
if (materialInventoryPO != null) {
|
||||||
|
//库存数量
|
||||||
|
BigDecimal oldInventoryQuantity = materialInventoryPO.getInventoryQuantity();
|
||||||
|
oldInventoryQuantity = oldInventoryQuantity != null ? oldInventoryQuantity : BigDecimal.ZERO;
|
||||||
|
//可用数量
|
||||||
|
BigDecimal oldAllocationQuantity = materialInventoryPO.getAllocationQuantity();
|
||||||
|
oldAllocationQuantity = oldAllocationQuantity != null ? oldAllocationQuantity : BigDecimal.ZERO;
|
||||||
|
//冻结数量(出库交接不变动冻结数量)
|
||||||
|
BigDecimal oldFreezeQuantity = materialInventoryPO.getFreezeQuantity();
|
||||||
|
oldFreezeQuantity = oldFreezeQuantity != null ? oldFreezeQuantity : BigDecimal.ZERO;
|
||||||
|
//扣减后库存数量
|
||||||
|
BigDecimal newInventoryQuantity = oldInventoryQuantity.subtract(quantity);
|
||||||
|
//扣减后可用数量
|
||||||
|
BigDecimal newAllocationQuantity = oldAllocationQuantity.subtract(quantity);
|
||||||
|
BigDecimal newFreezeQuantity = oldFreezeQuantity.subtract(quantity);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
BigDecimal oldArea = materialInventoryPO.getArea();
|
||||||
|
BigDecimal oldVolume = materialInventoryPO.getVolume();
|
||||||
|
BigDecimal oldGrossWeight = materialInventoryPO.getGrossWeight();
|
||||||
|
BigDecimal oldNetWeight = materialInventoryPO.getNetWeight();
|
||||||
|
|
||||||
|
// 初始化旧数据,避免空指针
|
||||||
|
oldArea = oldArea != null ? oldArea : BigDecimal.ZERO;
|
||||||
|
oldVolume = oldVolume != null ? oldVolume : BigDecimal.ZERO;
|
||||||
|
oldGrossWeight = oldGrossWeight != null ? oldGrossWeight : BigDecimal.ZERO;
|
||||||
|
oldNetWeight = oldNetWeight != null ? oldNetWeight : BigDecimal.ZERO;
|
||||||
|
|
||||||
|
BigDecimal newArea = oldArea.subtract(area);
|
||||||
|
BigDecimal newVolume = oldVolume.subtract(volume);
|
||||||
|
BigDecimal newGrossWeight = oldGrossWeight.subtract(grossWeight);
|
||||||
|
BigDecimal newNetWeight = oldNetWeight.subtract(netWeight);
|
||||||
|
|
||||||
|
materialInventoryPO.setInventoryQuantity(newInventoryQuantity);
|
||||||
|
//materialInventoryPO.setAllocationQuantity(materialInventoryPO.getAllocationQuantity());
|
||||||
|
materialInventoryPO.setFreezeQuantity(newFreezeQuantity);
|
||||||
|
materialInventoryPO.setArea(newArea);
|
||||||
|
materialInventoryPO.setVolume(newVolume);
|
||||||
|
materialInventoryPO.setGrossWeight(newGrossWeight);
|
||||||
|
materialInventoryPO.setNetWeight(newNetWeight);
|
||||||
|
MaterialInventory materialInventory = new MaterialInventory();
|
||||||
|
com.mhd.common.core.utils.bean.BeanUtils.copyProperties(materialInventoryPO, materialInventory);
|
||||||
|
materialInventoryMapper.updateById(materialInventory);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -75,7 +75,7 @@ public class SysTableConfigApi extends BaseController {
|
|||||||
try {
|
try {
|
||||||
SysTableConfig config = sysTableConfigService.getByOrgIdAndKey(organizationId, key, warehouseId);
|
SysTableConfig config = sysTableConfigService.getByOrgIdAndKey(organizationId, key, warehouseId);
|
||||||
if (config == null) {
|
if (config == null) {
|
||||||
return Result.error("未找到对应配置");
|
return Result.ok("未找到对应配置");
|
||||||
}
|
}
|
||||||
return Result.ok(config);
|
return Result.ok(config);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user