调整库存和记录方法集合;
This commit is contained in:
+116
-102
@@ -20,7 +20,9 @@ import com.mhd.wms.domain.inventoryAdjustmentRecord.repository.mapper.InventoryA
|
||||
import com.mhd.wms.domain.materialBarCode.repository.facade.IMaterialBarCodeService;
|
||||
import com.mhd.wms.domain.materialBarCode.repository.po.MaterialBarCodePO;
|
||||
import com.mhd.wms.domain.materialInventory.entity.MaterialInventory;
|
||||
import com.mhd.wms.domain.materialInventory.repository.facade.IMaterialInventoryService;
|
||||
import com.mhd.wms.domain.materialInventory.repository.mapper.MaterialInventoryMapper;
|
||||
import com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryParamDO;
|
||||
import com.mhd.wms.domain.outMaterialDetail.entity.OutMaterialDetail;
|
||||
import com.mhd.wms.domain.outMaterialDetail.repository.mapper.OutMaterialDetailMapper;
|
||||
import com.mhd.wms.domain.pickingMaterialDetail.repository.mapper.PickingMaterialDetailMapper;
|
||||
@@ -70,6 +72,8 @@ public class HandoverTaskOrderDomainService {
|
||||
private PickingMaterialDetailMapper pickingMaterialDetailMapper;
|
||||
@Autowired
|
||||
private IMaterialBarCodeService materialBarCodeService;
|
||||
@Autowired
|
||||
private IMaterialInventoryService materialInventoryService;
|
||||
|
||||
|
||||
/**
|
||||
@@ -330,110 +334,120 @@ public class HandoverTaskOrderDomainService {
|
||||
|
||||
MaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId);
|
||||
if (materialInventoryPO != null) {
|
||||
MaterialInventoryParamDO materialInventoryParamDO = new MaterialInventoryParamDO();
|
||||
//更新库存数量
|
||||
|
||||
//库存数量
|
||||
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(checkQuantity);
|
||||
//扣减后可用数量
|
||||
BigDecimal newAllocationQuantity = oldAllocationQuantity.subtract(checkQuantity);
|
||||
BigDecimal newFreezeQuantity = oldFreezeQuantity;
|
||||
|
||||
|
||||
|
||||
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(checkArea);
|
||||
BigDecimal newVolume = oldVolume.subtract(checkVolume);
|
||||
BigDecimal newGrossWeight = oldGrossWeight.subtract(checkGrossWeight);
|
||||
BigDecimal newNetWeight = oldNetWeight.subtract(checkNetWeight);
|
||||
|
||||
materialInventoryPO.setInventoryQuantity(newInventoryQuantity);
|
||||
materialInventoryPO.setAllocationQuantity(materialInventoryPO.getAllocationQuantity());
|
||||
materialInventoryPO.setFreezeQuantity(materialInventoryPO.getFreezeQuantity().subtract(outMaterialDetail.getCheckQuantity()) );
|
||||
materialInventoryPO.setArea(newArea);
|
||||
materialInventoryPO.setVolume(newVolume);
|
||||
materialInventoryPO.setGrossWeight(newGrossWeight);
|
||||
materialInventoryPO.setNetWeight(newNetWeight);
|
||||
MaterialInventory materialInventory = new MaterialInventory();
|
||||
BeanUtils.copyProperties(materialInventoryPO, materialInventory);
|
||||
materialInventoryMapper.updateById(materialInventory);
|
||||
|
||||
// //库存数量
|
||||
// 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(checkQuantity);
|
||||
// //扣减后可用数量
|
||||
// BigDecimal newAllocationQuantity = oldAllocationQuantity.subtract(checkQuantity);
|
||||
// BigDecimal newFreezeQuantity = oldFreezeQuantity;
|
||||
//
|
||||
//
|
||||
//
|
||||
// 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(checkArea);
|
||||
// BigDecimal newVolume = oldVolume.subtract(checkVolume);
|
||||
// BigDecimal newGrossWeight = oldGrossWeight.subtract(checkGrossWeight);
|
||||
// BigDecimal newNetWeight = oldNetWeight.subtract(checkNetWeight);
|
||||
//
|
||||
// materialInventoryPO.setInventoryQuantity(newInventoryQuantity);
|
||||
// materialInventoryPO.setAllocationQuantity(materialInventoryPO.getAllocationQuantity());
|
||||
// materialInventoryPO.setFreezeQuantity(materialInventoryPO.getFreezeQuantity().subtract(outMaterialDetail.getCheckQuantity()) );
|
||||
// materialInventoryPO.setArea(newArea);
|
||||
// materialInventoryPO.setVolume(newVolume);
|
||||
// materialInventoryPO.setGrossWeight(newGrossWeight);
|
||||
// materialInventoryPO.setNetWeight(newNetWeight);
|
||||
// MaterialInventory materialInventory = new MaterialInventory();
|
||||
// BeanUtils.copyProperties(materialInventoryPO, materialInventory);
|
||||
//materialInventoryMapper.updateById(materialInventory);
|
||||
materialInventoryParamDO.setArea(checkArea);
|
||||
materialInventoryParamDO.setVolume(checkVolume);
|
||||
materialInventoryParamDO.setGrossWeight(checkGrossWeight);
|
||||
materialInventoryParamDO.setNetWeight(checkNetWeight);
|
||||
materialInventoryParamDO.setQuantity(checkQuantity);
|
||||
materialInventoryParamDO.setMaterialInventoryId(materialInventoryPO.getMaterialInventoryId());
|
||||
materialInventoryParamDO.setMaterialBaseInfoId(materialInventoryPO.getMaterialBaseInfoId());
|
||||
materialInventoryParamDO.setType("4");
|
||||
materialInventoryService.kctzjl(materialInventoryParamDO,"出库",loginUser);
|
||||
materialInventoryService.xgkc(materialInventoryParamDO);
|
||||
//库存调整记录
|
||||
InventoryAdjustmentRecord inventoryAdjustmentRecord = new InventoryAdjustmentRecord();
|
||||
inventoryAdjustmentRecord.setAdjustAction("出库");
|
||||
inventoryAdjustmentRecord.setRelateNo(orderNumber);
|
||||
inventoryAdjustmentRecord.setAdjustAfterStatusCode(materialInventory.getMaterialStatusCode() == null ? "" : materialInventory.getMaterialStatusCode());
|
||||
inventoryAdjustmentRecord.setAdjustBeforeStatusCode(materialInventory.getMaterialStatusCode() == null ? "" : materialInventory.getMaterialStatusCode());
|
||||
inventoryAdjustmentRecord.setAdjustAfterStatusName(materialInventory.getMaterialStatusName() == null ? "" : materialInventory.getMaterialStatusName());
|
||||
inventoryAdjustmentRecord.setAdjustBeforeStatusName(materialInventory.getMaterialStatusName() == null ? "" : materialInventory.getMaterialStatusName());
|
||||
// inventoryAdjustmentRecord.setAdjustBeforeStatusCode("he_ge");
|
||||
// inventoryAdjustmentRecord.setAdjustBeforeStatusName("合格");
|
||||
inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventoryPO.getMaterialBaseInfoId());
|
||||
inventoryAdjustmentRecord.setMaterialCode(outMaterialDetail.getMaterialNo());
|
||||
inventoryAdjustmentRecord.setMaterialName(outMaterialDetail.getCommodityName());
|
||||
inventoryAdjustmentRecord.setBarCode(outMaterialDetail.getBarCode());
|
||||
if (inventoryAdjustmentRecord.getBarCode() == null || inventoryAdjustmentRecord.getBarCode().isEmpty()){
|
||||
getBarCode(materialInventoryPO, inventoryAdjustmentRecord);
|
||||
}
|
||||
inventoryAdjustmentRecord.setMaterialBaseInfoId(outMaterialDetail.getMaterialBaseInfoId());
|
||||
inventoryAdjustmentRecord.setAdjustType(1L);
|
||||
inventoryAdjustmentRecord.setOrganizationId(stockOutOrder.getOrganizationId());
|
||||
inventoryAdjustmentRecord.setOrganizationName(stockOutOrder.getOrganizationName());
|
||||
inventoryAdjustmentRecord.setTopOrganizationId(stockOutOrder.getTopOrganizationId());
|
||||
inventoryAdjustmentRecord.setWarehouseCode(stockOutOrder.getWarehouseCode());
|
||||
inventoryAdjustmentRecord.setWarehouseName(stockOutOrder.getWarehouseName());
|
||||
inventoryAdjustmentRecord.setWarehouseId(stockOutOrder.getWarehouseId());
|
||||
inventoryAdjustmentRecord.setStorageCode(materialInventoryPO.getStorageCode());
|
||||
inventoryAdjustmentRecord.setStorageName(materialInventoryPO.getStorageName());
|
||||
inventoryAdjustmentRecord.setStorageLocationId(materialInventoryPO.getStorageLocationId());
|
||||
inventoryAdjustmentRecord.setStorageLocationCode(materialInventoryPO.getStorageLocationCode());
|
||||
inventoryAdjustmentRecord.setStorageLocationName(materialInventoryPO.getStorageLocationName());
|
||||
inventoryAdjustmentRecord.setMaterialInventoryId(materialInventoryPO.getMaterialInventoryId());
|
||||
inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventoryPO.getMaterialBaseInfoId());
|
||||
inventoryAdjustmentRecord.setShipperId(stockOutOrder.getShipperId());
|
||||
inventoryAdjustmentRecord.setShipperName(stockOutOrder.getShipperName());
|
||||
inventoryAdjustmentRecord.setStorageSectionId(materialInventoryPO.getStorageSectionId());
|
||||
inventoryAdjustmentRecord.setStorageLocationId(materialInventoryPO.getStorageLocationId());
|
||||
inventoryAdjustmentRecord.setCreateBy(loginUser.getUserid());
|
||||
UserPo userPo = loginUser.getUserPo();
|
||||
if (userPo != null) inventoryAdjustmentRecord.setCreateByName(userPo.getUserName());
|
||||
inventoryAdjustmentRecord.setCreateTime(new Date());
|
||||
inventoryAdjustmentRecord.setAllocationBeforeQuantity(oldAllocationQuantity);
|
||||
inventoryAdjustmentRecord.setAllocationAfterQuantity(oldAllocationQuantity);
|
||||
inventoryAdjustmentRecord.setFreezeBeforeQuantity(oldFreezeQuantity);
|
||||
inventoryAdjustmentRecord.setFreezeAfterQuantity(newFreezeQuantity.subtract(outMaterialDetail.getCheckQuantity()));//调整后 冻结-出库
|
||||
inventoryAdjustmentRecord.setInventoryBeforeQuantity(oldInventoryQuantity);
|
||||
inventoryAdjustmentRecord.setInventoryAfterQuantity(newInventoryQuantity);
|
||||
// 调整前:库存数量(净重、毛重、体积、面积)
|
||||
inventoryAdjustmentRecord.setNetWeight(oldNetWeight);
|
||||
inventoryAdjustmentRecord.setGrossWeight(oldGrossWeight);
|
||||
inventoryAdjustmentRecord.setVolume(oldVolume);
|
||||
inventoryAdjustmentRecord.setArea(oldArea);
|
||||
// 调整后:库存数量 - 复核时填写的数量
|
||||
inventoryAdjustmentRecord.setAdjustedNetWeight(newNetWeight);
|
||||
inventoryAdjustmentRecord.setAdjustedGrossWeight(newGrossWeight);
|
||||
inventoryAdjustmentRecord.setAdjustedVolume(newVolume);
|
||||
inventoryAdjustmentRecord.setAdjustedArea(newArea);
|
||||
|
||||
inventoryAdjustmentRecordMapper.insert(inventoryAdjustmentRecord);
|
||||
// InventoryAdjustmentRecord inventoryAdjustmentRecord = new InventoryAdjustmentRecord();
|
||||
// inventoryAdjustmentRecord.setAdjustAction("出库");
|
||||
// inventoryAdjustmentRecord.setRelateNo(orderNumber);
|
||||
// inventoryAdjustmentRecord.setAdjustAfterStatusCode(materialInventory.getMaterialStatusCode() == null ? "" : materialInventory.getMaterialStatusCode());
|
||||
// inventoryAdjustmentRecord.setAdjustBeforeStatusCode(materialInventory.getMaterialStatusCode() == null ? "" : materialInventory.getMaterialStatusCode());
|
||||
// inventoryAdjustmentRecord.setAdjustAfterStatusName(materialInventory.getMaterialStatusName() == null ? "" : materialInventory.getMaterialStatusName());
|
||||
// inventoryAdjustmentRecord.setAdjustBeforeStatusName(materialInventory.getMaterialStatusName() == null ? "" : materialInventory.getMaterialStatusName());
|
||||
//// inventoryAdjustmentRecord.setAdjustBeforeStatusCode("he_ge");
|
||||
//// inventoryAdjustmentRecord.setAdjustBeforeStatusName("合格");
|
||||
// inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventoryPO.getMaterialBaseInfoId());
|
||||
// inventoryAdjustmentRecord.setMaterialCode(outMaterialDetail.getMaterialNo());
|
||||
// inventoryAdjustmentRecord.setMaterialName(outMaterialDetail.getCommodityName());
|
||||
// inventoryAdjustmentRecord.setBarCode(outMaterialDetail.getBarCode());
|
||||
// if (inventoryAdjustmentRecord.getBarCode() == null || inventoryAdjustmentRecord.getBarCode().isEmpty()){
|
||||
// getBarCode(materialInventoryPO, inventoryAdjustmentRecord);
|
||||
// }
|
||||
// inventoryAdjustmentRecord.setMaterialBaseInfoId(outMaterialDetail.getMaterialBaseInfoId());
|
||||
// inventoryAdjustmentRecord.setAdjustType(1L);
|
||||
// inventoryAdjustmentRecord.setOrganizationId(stockOutOrder.getOrganizationId());
|
||||
// inventoryAdjustmentRecord.setOrganizationName(stockOutOrder.getOrganizationName());
|
||||
// inventoryAdjustmentRecord.setTopOrganizationId(stockOutOrder.getTopOrganizationId());
|
||||
// inventoryAdjustmentRecord.setWarehouseCode(stockOutOrder.getWarehouseCode());
|
||||
// inventoryAdjustmentRecord.setWarehouseName(stockOutOrder.getWarehouseName());
|
||||
// inventoryAdjustmentRecord.setWarehouseId(stockOutOrder.getWarehouseId());
|
||||
// inventoryAdjustmentRecord.setStorageCode(materialInventoryPO.getStorageCode());
|
||||
// inventoryAdjustmentRecord.setStorageName(materialInventoryPO.getStorageName());
|
||||
// inventoryAdjustmentRecord.setStorageLocationId(materialInventoryPO.getStorageLocationId());
|
||||
// inventoryAdjustmentRecord.setStorageLocationCode(materialInventoryPO.getStorageLocationCode());
|
||||
// inventoryAdjustmentRecord.setStorageLocationName(materialInventoryPO.getStorageLocationName());
|
||||
// inventoryAdjustmentRecord.setMaterialInventoryId(materialInventoryPO.getMaterialInventoryId());
|
||||
// inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventoryPO.getMaterialBaseInfoId());
|
||||
// inventoryAdjustmentRecord.setShipperId(stockOutOrder.getShipperId());
|
||||
// inventoryAdjustmentRecord.setShipperName(stockOutOrder.getShipperName());
|
||||
// inventoryAdjustmentRecord.setStorageSectionId(materialInventoryPO.getStorageSectionId());
|
||||
// inventoryAdjustmentRecord.setStorageLocationId(materialInventoryPO.getStorageLocationId());
|
||||
// inventoryAdjustmentRecord.setCreateBy(loginUser.getUserid());
|
||||
// UserPo userPo = loginUser.getUserPo();
|
||||
// if (userPo != null) inventoryAdjustmentRecord.setCreateByName(userPo.getUserName());
|
||||
// inventoryAdjustmentRecord.setCreateTime(new Date());
|
||||
// inventoryAdjustmentRecord.setAllocationBeforeQuantity(oldAllocationQuantity);
|
||||
// inventoryAdjustmentRecord.setAllocationAfterQuantity(oldAllocationQuantity);
|
||||
// inventoryAdjustmentRecord.setFreezeBeforeQuantity(oldFreezeQuantity);
|
||||
// inventoryAdjustmentRecord.setFreezeAfterQuantity(newFreezeQuantity.subtract(outMaterialDetail.getCheckQuantity()));//调整后 冻结-出库
|
||||
// inventoryAdjustmentRecord.setInventoryBeforeQuantity(oldInventoryQuantity);
|
||||
// inventoryAdjustmentRecord.setInventoryAfterQuantity(newInventoryQuantity);
|
||||
// // 调整前:库存数量(净重、毛重、体积、面积)
|
||||
// inventoryAdjustmentRecord.setNetWeight(oldNetWeight);
|
||||
// inventoryAdjustmentRecord.setGrossWeight(oldGrossWeight);
|
||||
// inventoryAdjustmentRecord.setVolume(oldVolume);
|
||||
// inventoryAdjustmentRecord.setArea(oldArea);
|
||||
// // 调整后:库存数量 - 复核时填写的数量
|
||||
// inventoryAdjustmentRecord.setAdjustedNetWeight(newNetWeight);
|
||||
// inventoryAdjustmentRecord.setAdjustedGrossWeight(newGrossWeight);
|
||||
// inventoryAdjustmentRecord.setAdjustedVolume(newVolume);
|
||||
// inventoryAdjustmentRecord.setAdjustedArea(newArea);
|
||||
//
|
||||
// inventoryAdjustmentRecordMapper.insert(inventoryAdjustmentRecord);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -524,4 +538,4 @@ public class HandoverTaskOrderDomainService {
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+56
-38
@@ -15,6 +15,7 @@ import com.mhd.wms.domain.materialBaseInfo.entity.MaterialBaseInfo;
|
||||
import com.mhd.wms.domain.materialBaseInfo.repository.facade.IMaterialBaseInfoService;
|
||||
import com.mhd.wms.domain.materialInventory.entity.MaterialInventory;
|
||||
import com.mhd.wms.domain.materialInventory.repository.facade.IMaterialInventoryService;
|
||||
import com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryParamDO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -276,45 +277,62 @@ public class InventoryAdjustmentRecordDomainService {
|
||||
*/
|
||||
@Transactional
|
||||
public Boolean inventoryFrozenForAll(InventoryAdjustmentRecordDO inventoryAdjustmentRecordDO) {
|
||||
InventoryAdjustmentRecordDO inventoryAdjustmentRecord = new InventoryAdjustmentRecordDO();
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
inventoryAdjustmentRecord.setAdjustAction("库存冻结");
|
||||
inventoryAdjustmentRecord.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
inventoryAdjustmentRecord.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
||||
inventoryAdjustmentRecord.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
inventoryAdjustmentRecord.setCreateBy(loginUser.getUserid());
|
||||
inventoryAdjustmentRecord.setCreateByName(loginUser.getUsername());
|
||||
inventoryAdjustmentRecord.setCreateTime(new Date());
|
||||
MaterialInventory materialInventory = materialInventoryService.getById(inventoryAdjustmentRecordDO.getMaterialInventoryId());
|
||||
inventoryAdjustmentRecord.setAdjustType(3L);
|
||||
if (ObjectUtil.isNotNull(materialInventory)) {
|
||||
BeanUtils.copyProperties(materialInventory, inventoryAdjustmentRecord);
|
||||
inventoryAdjustmentRecord.setInventoryBeforeQuantity(materialInventory.getInventoryQuantity());
|
||||
inventoryAdjustmentRecord.setAllocationBeforeQuantity(materialInventory.getAllocationQuantity());
|
||||
inventoryAdjustmentRecord.setFreezeBeforeQuantity(materialInventory.getFreezeQuantity());
|
||||
MaterialBaseInfo materialBaseInfo = materialBaseInfoService.getOne(new QueryWrapper<MaterialBaseInfo>().lambda()
|
||||
.eq(MaterialBaseInfo::getMaterialBaseInfoId,materialInventory.getMaterialBaseInfoId()).eq(BaseVOEntity::getDelFlag,1));
|
||||
if (ObjectUtil.isNotNull(materialBaseInfo)) {
|
||||
inventoryAdjustmentRecord.setMaterialCode(materialBaseInfo.getMaterialCode());
|
||||
inventoryAdjustmentRecord.setMaterialName(materialBaseInfo.getMaterialName());
|
||||
inventoryAdjustmentRecord.setBarCode(materialBaseInfo.getBarCode());
|
||||
inventoryAdjustmentRecord.setShipperId(materialBaseInfo.getShipperId());
|
||||
inventoryAdjustmentRecord.setShipperName(materialBaseInfo.getShipperName());
|
||||
}
|
||||
//可用数量减,冻结数量加
|
||||
materialInventory.setAllocationQuantity(materialInventory.getInventoryQuantity().subtract(inventoryAdjustmentRecordDO.getAdjustQuantity()));
|
||||
materialInventory.setFreezeQuantity(inventoryAdjustmentRecordDO.getAdjustQuantity());
|
||||
if (materialInventory.getAllocationQuantity().compareTo(BigDecimal.ZERO) < 0) {
|
||||
throw new ServiceException("冻结可用数量不能小于0");
|
||||
}
|
||||
inventoryAdjustmentRecord.setInventoryAfterQuantity(materialInventory.getInventoryQuantity());
|
||||
inventoryAdjustmentRecord.setAllocationAfterQuantity(materialInventory.getAllocationQuantity());
|
||||
inventoryAdjustmentRecord.setFreezeAfterQuantity(materialInventory.getFreezeQuantity());
|
||||
} else {
|
||||
throw new ServiceException("根据物料库存id查询不到物料库存信息!");
|
||||
//InventoryAdjustmentRecordDO inventoryAdjustmentRecord = new InventoryAdjustmentRecordDO();
|
||||
try {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
BigDecimal adjustQuantity = inventoryAdjustmentRecordDO.getAdjustQuantity();
|
||||
MaterialInventoryParamDO materialInventoryParamDO = new MaterialInventoryParamDO();
|
||||
materialInventoryParamDO.setMaterialInventoryId(inventoryAdjustmentRecordDO.getMaterialInventoryId());
|
||||
materialInventoryParamDO.setQuantity(adjustQuantity);
|
||||
materialInventoryParamDO.setType("7");
|
||||
materialInventoryService.kctzjl(materialInventoryParamDO,"库存冻结",loginUser);
|
||||
materialInventoryService.xgkc(materialInventoryParamDO);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
materialInventoryService.updateById(materialInventory);
|
||||
return inventoryAdjustmentRecordService.insert(inventoryAdjustmentRecord);
|
||||
|
||||
|
||||
|
||||
|
||||
// inventoryAdjustmentRecord.setAdjustAction("库存冻结");
|
||||
// inventoryAdjustmentRecord.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
// inventoryAdjustmentRecord.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
||||
// inventoryAdjustmentRecord.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
// inventoryAdjustmentRecord.setCreateBy(loginUser.getUserid());
|
||||
// inventoryAdjustmentRecord.setCreateByName(loginUser.getUsername());
|
||||
// inventoryAdjustmentRecord.setCreateTime(new Date());
|
||||
// MaterialInventory materialInventory = materialInventoryService.getById(inventoryAdjustmentRecordDO.getMaterialInventoryId());
|
||||
// inventoryAdjustmentRecord.setAdjustType(3L);
|
||||
// if (ObjectUtil.isNotNull(materialInventory)) {
|
||||
// BeanUtils.copyProperties(materialInventory, inventoryAdjustmentRecord);
|
||||
// inventoryAdjustmentRecord.setInventoryBeforeQuantity(materialInventory.getInventoryQuantity());
|
||||
// inventoryAdjustmentRecord.setAllocationBeforeQuantity(materialInventory.getAllocationQuantity());
|
||||
// inventoryAdjustmentRecord.setFreezeBeforeQuantity(materialInventory.getFreezeQuantity());
|
||||
// MaterialBaseInfo materialBaseInfo = materialBaseInfoService.getOne(new QueryWrapper<MaterialBaseInfo>().lambda()
|
||||
// .eq(MaterialBaseInfo::getMaterialBaseInfoId,materialInventory.getMaterialBaseInfoId()).eq(BaseVOEntity::getDelFlag,1));
|
||||
// if (ObjectUtil.isNotNull(materialBaseInfo)) {
|
||||
// inventoryAdjustmentRecord.setMaterialCode(materialBaseInfo.getMaterialCode());
|
||||
// inventoryAdjustmentRecord.setMaterialName(materialBaseInfo.getMaterialName());
|
||||
// inventoryAdjustmentRecord.setBarCode(materialBaseInfo.getBarCode());
|
||||
// inventoryAdjustmentRecord.setShipperId(materialBaseInfo.getShipperId());
|
||||
// inventoryAdjustmentRecord.setShipperName(materialBaseInfo.getShipperName());
|
||||
// }
|
||||
// //可用数量减,冻结数量加
|
||||
// materialInventory.setAllocationQuantity(materialInventory.getInventoryQuantity().subtract(inventoryAdjustmentRecordDO.getAdjustQuantity()));
|
||||
// materialInventory.setFreezeQuantity(inventoryAdjustmentRecordDO.getAdjustQuantity());
|
||||
// if (materialInventory.getAllocationQuantity().compareTo(BigDecimal.ZERO) < 0) {
|
||||
// throw new ServiceException("冻结可用数量不能小于0");
|
||||
// }
|
||||
// inventoryAdjustmentRecord.setInventoryAfterQuantity(materialInventory.getInventoryQuantity());
|
||||
// inventoryAdjustmentRecord.setAllocationAfterQuantity(materialInventory.getAllocationQuantity());
|
||||
// inventoryAdjustmentRecord.setFreezeAfterQuantity(materialInventory.getFreezeQuantity());
|
||||
// } else {
|
||||
// throw new ServiceException("根据物料库存id查询不到物料库存信息!");
|
||||
// }
|
||||
// materialInventoryService.updateById(materialInventory);
|
||||
// return inventoryAdjustmentRecordService.insert(inventoryAdjustmentRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-3
@@ -113,7 +113,5 @@ public interface IMaterialInventoryService extends IService<MaterialInventory>
|
||||
* */
|
||||
public void xgkc(MaterialInventoryParamDO materialInventoryParamDO);
|
||||
|
||||
public void kctzjl(MaterialInventory materialInventory, String orderNumber, LoginUser loginUser,
|
||||
BigDecimal oldArea, BigDecimal oldGrossWeight, BigDecimal oldNetWeight, BigDecimal oldVolume
|
||||
,BigDecimal oldInventoryQuantity, BigDecimal oldAllocationQuantity, BigDecimal oldFreezeQuantity,String adjustAction);
|
||||
public void kctzjl(MaterialInventoryParamDO materialInventoryParamDO,String adjustAction,LoginUser loginUser);
|
||||
}
|
||||
+95
-25
@@ -560,17 +560,18 @@ public class MaterialInventoryImpl extends ServiceImpl<MaterialInventoryMapper,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void kctzjl(MaterialInventory materialInventory, String orderNumber, LoginUser loginUser,
|
||||
BigDecimal oldArea, BigDecimal oldGrossWeight, BigDecimal oldNetWeight, BigDecimal oldVolume
|
||||
,BigDecimal oldInventoryQuantity, BigDecimal oldAllocationQuantity, BigDecimal oldFreezeQuantity,
|
||||
String adjustAction) {
|
||||
public void kctzjl(MaterialInventoryParamDO materialInventoryParamDO,
|
||||
String adjustAction,LoginUser loginUser) {
|
||||
//库存调整记录
|
||||
Long materialInventoryId = materialInventoryParamDO.getMaterialInventoryId();
|
||||
MaterialInventory materialInventory = materialInventoryMapper.selectOne(new QueryWrapper<MaterialInventory>().lambda()
|
||||
.eq(MaterialInventory::getMaterialInventoryId, materialInventoryId));
|
||||
Long materialBaseInfoId = materialInventory.getMaterialBaseInfoId();
|
||||
MaterialBaseInfo materialBaseInfo = materialBaseInfoService.getOne(new QueryWrapper<MaterialBaseInfo>().lambda()
|
||||
.eq(MaterialBaseInfo::getMaterialBaseInfoId, materialBaseInfoId).eq(BaseVOEntity::getDelFlag,1));
|
||||
InventoryAdjustmentRecord inventoryAdjustmentRecord = new InventoryAdjustmentRecord();
|
||||
inventoryAdjustmentRecord.setAdjustAction(adjustAction);
|
||||
inventoryAdjustmentRecord.setRelateNo(orderNumber);
|
||||
inventoryAdjustmentRecord.setRelateNo(materialInventoryParamDO.getInOrderNumber());
|
||||
inventoryAdjustmentRecord.setAdjustAfterStatusCode(materialInventory.getMaterialStatusCode() == null ? "" : materialInventory.getMaterialStatusCode());
|
||||
inventoryAdjustmentRecord.setAdjustBeforeStatusCode(materialInventory.getMaterialStatusCode() == null ? "" : materialInventory.getMaterialStatusCode());
|
||||
inventoryAdjustmentRecord.setAdjustAfterStatusName(materialInventory.getMaterialStatusName() == null ? "" : materialInventory.getMaterialStatusName());
|
||||
@@ -588,6 +589,9 @@ public class MaterialInventoryImpl extends ServiceImpl<MaterialInventoryMapper,
|
||||
}
|
||||
inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventory.getMaterialBaseInfoId());
|
||||
inventoryAdjustmentRecord.setAdjustType(1L);
|
||||
if ("库存冻结".equals(adjustAction)) {
|
||||
inventoryAdjustmentRecord.setAdjustType(3L);
|
||||
}
|
||||
inventoryAdjustmentRecord.setOrganizationId(materialInventory.getOrganizationId());
|
||||
inventoryAdjustmentRecord.setOrganizationName(materialInventory.getOrganizationName());
|
||||
inventoryAdjustmentRecord.setTopOrganizationId(materialInventory.getTopOrganizationId());
|
||||
@@ -607,22 +611,80 @@ public class MaterialInventoryImpl extends ServiceImpl<MaterialInventoryMapper,
|
||||
UserPo userPo = loginUser.getUserPo();
|
||||
if (userPo != null) inventoryAdjustmentRecord.setCreateByName(userPo.getUserName());
|
||||
inventoryAdjustmentRecord.setCreateTime(new Date());
|
||||
inventoryAdjustmentRecord.setAllocationBeforeQuantity(oldAllocationQuantity);
|
||||
inventoryAdjustmentRecord.setAllocationAfterQuantity(oldAllocationQuantity);
|
||||
inventoryAdjustmentRecord.setFreezeBeforeQuantity(oldFreezeQuantity);
|
||||
inventoryAdjustmentRecord.setFreezeAfterQuantity(materialInventory.getFreezeQuantity());//调整后 冻结-出库
|
||||
inventoryAdjustmentRecord.setInventoryBeforeQuantity(oldInventoryQuantity);
|
||||
inventoryAdjustmentRecord.setInventoryAfterQuantity(materialInventory.getInventoryQuantity());
|
||||
// 调整前:库存数量(净重、毛重、体积、面积)
|
||||
inventoryAdjustmentRecord.setNetWeight(oldNetWeight);
|
||||
inventoryAdjustmentRecord.setGrossWeight(oldGrossWeight);
|
||||
inventoryAdjustmentRecord.setVolume(oldVolume);
|
||||
inventoryAdjustmentRecord.setArea(oldArea);
|
||||
// 调整后:库存数量 - 复核时填写的数量
|
||||
inventoryAdjustmentRecord.setAdjustedNetWeight(materialInventory.getNetWeight());
|
||||
inventoryAdjustmentRecord.setAdjustedGrossWeight(materialInventory.getGrossWeight());
|
||||
inventoryAdjustmentRecord.setAdjustedVolume(materialInventory.getVolume());
|
||||
inventoryAdjustmentRecord.setAdjustedArea(materialInventory.getArea());
|
||||
|
||||
if ("分配库存".equals(adjustAction)) {
|
||||
inventoryAdjustmentRecord.setAllocationBeforeQuantity(materialInventory.getAllocationQuantity());
|
||||
inventoryAdjustmentRecord.setAllocationAfterQuantity(materialInventory.getAllocationQuantity().subtract(materialInventoryParamDO.getQuantity()));
|
||||
inventoryAdjustmentRecord.setFreezeBeforeQuantity(materialInventory.getFreezeQuantity());
|
||||
inventoryAdjustmentRecord.setFreezeAfterQuantity(materialInventory.getFreezeQuantity().add(materialInventoryParamDO.getQuantity()));//调整后 冻结-出库
|
||||
inventoryAdjustmentRecord.setInventoryBeforeQuantity(materialInventory.getInventoryQuantity());
|
||||
inventoryAdjustmentRecord.setInventoryAfterQuantity(materialInventory.getInventoryQuantity());
|
||||
} else if ("上架".equals(adjustAction)){
|
||||
if (materialInventory == null) {
|
||||
inventoryAdjustmentRecord.setAllocationBeforeQuantity(BigDecimal.ZERO);
|
||||
inventoryAdjustmentRecord.setAllocationAfterQuantity(materialInventoryParamDO.getQuantity());
|
||||
inventoryAdjustmentRecord.setFreezeBeforeQuantity(BigDecimal.ZERO);
|
||||
inventoryAdjustmentRecord.setFreezeAfterQuantity(BigDecimal.ZERO);//调整后 冻结-出库
|
||||
inventoryAdjustmentRecord.setInventoryBeforeQuantity(BigDecimal.ZERO);
|
||||
inventoryAdjustmentRecord.setInventoryAfterQuantity(materialInventoryParamDO.getQuantity());
|
||||
// 调整前:库存数量(净重、毛重、体积、面积)
|
||||
inventoryAdjustmentRecord.setNetWeight(BigDecimal.ZERO);
|
||||
inventoryAdjustmentRecord.setGrossWeight(BigDecimal.ZERO);
|
||||
inventoryAdjustmentRecord.setVolume(BigDecimal.ZERO);
|
||||
inventoryAdjustmentRecord.setArea(BigDecimal.ZERO);
|
||||
// 调整后:库存数量 - 复核时填写的数量
|
||||
inventoryAdjustmentRecord.setAdjustedNetWeight(materialInventoryParamDO.getNetWeight());
|
||||
inventoryAdjustmentRecord.setAdjustedGrossWeight(materialInventoryParamDO.getGrossWeight());
|
||||
inventoryAdjustmentRecord.setAdjustedVolume(materialInventoryParamDO.getVolume());
|
||||
inventoryAdjustmentRecord.setAdjustedArea(materialInventoryParamDO.getArea());
|
||||
} else {
|
||||
inventoryAdjustmentRecord.setAllocationBeforeQuantity(materialInventory.getAllocationQuantity());
|
||||
inventoryAdjustmentRecord.setAllocationAfterQuantity(materialInventory.getAllocationQuantity().add(materialInventoryParamDO.getQuantity()));
|
||||
inventoryAdjustmentRecord.setFreezeBeforeQuantity(materialInventory.getFreezeQuantity());
|
||||
inventoryAdjustmentRecord.setFreezeAfterQuantity(materialInventory.getFreezeQuantity());//调整后 冻结-出库
|
||||
inventoryAdjustmentRecord.setInventoryBeforeQuantity(materialInventory.getInventoryQuantity());
|
||||
inventoryAdjustmentRecord.setInventoryAfterQuantity(materialInventory.getInventoryQuantity().add(materialInventoryParamDO.getQuantity()));
|
||||
// 调整前:库存数量(净重、毛重、体积、面积)
|
||||
inventoryAdjustmentRecord.setNetWeight(materialInventory.getNetWeight());
|
||||
inventoryAdjustmentRecord.setGrossWeight(materialInventory.getGrossWeight());
|
||||
inventoryAdjustmentRecord.setVolume(materialInventory.getVolume());
|
||||
inventoryAdjustmentRecord.setArea(materialInventory.getArea());
|
||||
// 调整后:库存数量 - 复核时填写的数量
|
||||
inventoryAdjustmentRecord.setAdjustedNetWeight(materialInventory.getNetWeight().add(inventoryAdjustmentRecord.getNetWeight()));
|
||||
inventoryAdjustmentRecord.setAdjustedGrossWeight(materialInventory.getGrossWeight().add(inventoryAdjustmentRecord.getGrossWeight()));
|
||||
inventoryAdjustmentRecord.setAdjustedVolume(materialInventory.getVolume().add(inventoryAdjustmentRecord.getVolume()));
|
||||
inventoryAdjustmentRecord.setAdjustedArea(materialInventory.getArea().add(inventoryAdjustmentRecord.getArea()));
|
||||
}
|
||||
} else if ("出库交接".equals(adjustAction)){
|
||||
inventoryAdjustmentRecord.setAllocationBeforeQuantity(materialInventory.getAllocationQuantity());
|
||||
inventoryAdjustmentRecord.setAllocationAfterQuantity(materialInventory.getAllocationQuantity());
|
||||
inventoryAdjustmentRecord.setFreezeBeforeQuantity(materialInventory.getFreezeQuantity());
|
||||
inventoryAdjustmentRecord.setFreezeAfterQuantity(materialInventory.getFreezeQuantity().subtract(materialInventoryParamDO.getQuantity()));//调整后 冻结-出库
|
||||
inventoryAdjustmentRecord.setInventoryBeforeQuantity(materialInventory.getInventoryQuantity());
|
||||
inventoryAdjustmentRecord.setInventoryAfterQuantity(materialInventory.getInventoryQuantity().subtract(materialInventoryParamDO.getQuantity()));
|
||||
// 调整前:库存数量(净重、毛重、体积、面积)
|
||||
inventoryAdjustmentRecord.setNetWeight(materialInventory.getNetWeight());
|
||||
inventoryAdjustmentRecord.setGrossWeight(materialInventory.getGrossWeight());
|
||||
inventoryAdjustmentRecord.setVolume(materialInventory.getVolume());
|
||||
inventoryAdjustmentRecord.setArea(materialInventory.getArea());
|
||||
// 调整后:库存数量 - 复核时填写的数量
|
||||
inventoryAdjustmentRecord.setAdjustedNetWeight(materialInventory.getNetWeight().subtract(inventoryAdjustmentRecord.getNetWeight()));
|
||||
inventoryAdjustmentRecord.setAdjustedGrossWeight(materialInventory.getGrossWeight().subtract(inventoryAdjustmentRecord.getGrossWeight()));
|
||||
inventoryAdjustmentRecord.setAdjustedVolume(materialInventory.getVolume().subtract(inventoryAdjustmentRecord.getVolume()));
|
||||
inventoryAdjustmentRecord.setAdjustedArea(materialInventory.getArea().subtract(inventoryAdjustmentRecord.getArea()));
|
||||
} else if ("移位".equals(adjustAction)){
|
||||
inventoryAdjustmentRecord.setAllocationBeforeQuantity(materialInventory.getAllocationQuantity());
|
||||
inventoryAdjustmentRecord.setAllocationAfterQuantity(materialInventoryParamDO.getQuantity());
|
||||
//inventoryAdjustmentRecord.setFreezeBeforeQuantity(oldFreezeQuantity);
|
||||
inventoryAdjustmentRecord.setFreezeAfterQuantity(materialInventory.getFreezeQuantity());//调整后 冻结-出库
|
||||
//inventoryAdjustmentRecord.setInventoryBeforeQuantity(oldInventoryQuantity);
|
||||
inventoryAdjustmentRecord.setInventoryAfterQuantity(materialInventory.getInventoryQuantity());
|
||||
} else if ("库存冻结".equals(adjustAction)) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
inventoryAdjustmentRecordMapper.insert(inventoryAdjustmentRecord);
|
||||
}
|
||||
@@ -661,6 +723,7 @@ public class MaterialInventoryImpl extends ServiceImpl<MaterialInventoryMapper,
|
||||
if (materialBaseInfo != null) {
|
||||
materialInventory.setShipperId(materialBaseInfo.getShipperId());
|
||||
materialInventory.setShipperName(materialBaseInfo.getShipperName());
|
||||
materialInventory.setShipperCode(materialBaseInfo.getShipperCode());
|
||||
}
|
||||
//仓库信息
|
||||
materialInventory.setOrganizationId(materialInventoryParamDO.getOrganizationId());
|
||||
@@ -686,7 +749,14 @@ public class MaterialInventoryImpl extends ServiceImpl<MaterialInventoryMapper,
|
||||
materialInventory.setExtAttr4(materialInventoryParamDO.getExtAttr4());
|
||||
materialInventory.setExpiryDate(materialInventoryParamDO.getExpiryDate());
|
||||
materialInventory.setInventoryDate(materialInventoryParamDO.getInventoryDate());
|
||||
|
||||
materialInventory.setBatchNumber(materialInventoryParamDO.getBatchNumber());
|
||||
materialInventory.setUnit(materialBaseInfo.getUnitCode());
|
||||
materialInventory.setUnitName(materialBaseInfo.getUnitName());
|
||||
//创建人信息
|
||||
materialInventory.setCreateBy(materialInventoryParamDO.getCreateBy());
|
||||
materialInventory.setCreateByName(materialInventoryParamDO.getCreateByName());
|
||||
materialInventory.setCreateTime(new Date());
|
||||
materialInventory.setBarCode(materialInventoryParamDO.getBarCode());
|
||||
materialInventoryMapper.insert(materialInventory);
|
||||
} else {
|
||||
MaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId);
|
||||
@@ -993,7 +1063,7 @@ public class MaterialInventoryImpl extends ServiceImpl<MaterialInventoryMapper,
|
||||
BigDecimal newInventoryQuantity = oldInventoryQuantity.subtract(quantity);
|
||||
//扣减后可用数量
|
||||
BigDecimal newAllocationQuantity = oldAllocationQuantity.subtract(quantity);
|
||||
BigDecimal newFreezeQuantity = oldFreezeQuantity.subtract(quantity);
|
||||
BigDecimal newFreezeQuantity = oldFreezeQuantity.add(quantity);
|
||||
|
||||
|
||||
|
||||
@@ -1013,8 +1083,8 @@ public class MaterialInventoryImpl extends ServiceImpl<MaterialInventoryMapper,
|
||||
BigDecimal newGrossWeight = oldGrossWeight.subtract(grossWeight);
|
||||
BigDecimal newNetWeight = oldNetWeight.subtract(netWeight);
|
||||
|
||||
materialInventoryPO.setInventoryQuantity(newInventoryQuantity);
|
||||
//materialInventoryPO.setAllocationQuantity(materialInventoryPO.getAllocationQuantity());
|
||||
//materialInventoryPO.setInventoryQuantity(newInventoryQuantity);
|
||||
materialInventoryPO.setAllocationQuantity(newAllocationQuantity);
|
||||
materialInventoryPO.setFreezeQuantity(newFreezeQuantity);
|
||||
materialInventoryPO.setArea(newArea);
|
||||
materialInventoryPO.setVolume(newVolume);
|
||||
|
||||
+4
@@ -68,6 +68,8 @@ public class MaterialInventoryParamDO extends MaterialBaseDO {
|
||||
//类型(1:上架2:分配3:取消分配4:出库交接5:移位6:库存调整7:库存冻结)
|
||||
private String type;
|
||||
|
||||
private String barCode;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -96,4 +98,6 @@ public class MaterialInventoryParamDO extends MaterialBaseDO {
|
||||
|
||||
private String lotNumber;
|
||||
|
||||
private String batchNumber;
|
||||
|
||||
}
|
||||
+208
-178
@@ -20,9 +20,11 @@ import com.mhd.wms.domain.materialBarCode.repository.po.MaterialBarCodePO;
|
||||
import com.mhd.wms.domain.materialBaseInfo.entity.MaterialBaseInfo;
|
||||
import com.mhd.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper;
|
||||
import com.mhd.wms.domain.materialInventory.entity.MaterialInventory;
|
||||
import com.mhd.wms.domain.materialInventory.repository.facade.IMaterialInventoryService;
|
||||
import com.mhd.wms.domain.materialInventory.repository.mapper.MaterialInventoryMapper;
|
||||
import com.mhd.wms.domain.materialInventory.repository.po.MaterialInventoryPO;
|
||||
import com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryDO;
|
||||
import com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryParamDO;
|
||||
import com.mhd.wms.domain.outMaterialDetail.entity.OutMaterialDetail;
|
||||
import com.mhd.wms.domain.outMaterialDetail.repository.facade.IOutMaterialDetailService;
|
||||
import com.mhd.wms.domain.outMaterialDetail.repository.mapper.OutMaterialDetailMapper;
|
||||
@@ -79,6 +81,9 @@ public class OutMaterialDetailImpl extends ServiceImpl<OutMaterialDetailMapper,
|
||||
private IPickingMaterialDetailService pickingMaterialDetailService;
|
||||
@Autowired
|
||||
private IMaterialBarCodeService materialBarCodeService;
|
||||
@Autowired
|
||||
private IMaterialInventoryService materialInventoryService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询物料明细列表
|
||||
@@ -467,61 +472,72 @@ public class OutMaterialDetailImpl extends ServiceImpl<OutMaterialDetailMapper,
|
||||
materialInventoryPO.setFreezeQuantity(newFreezeQuantity);
|
||||
MaterialInventory materialInventory = new MaterialInventory();
|
||||
BeanUtils.copyProperties(materialInventoryPO, materialInventory);
|
||||
materialInventoryMapper.updateById(materialInventory);
|
||||
MaterialInventoryParamDO materialInventoryParamDO = new MaterialInventoryParamDO();
|
||||
BigDecimal zero = BigDecimal.ZERO;
|
||||
materialInventoryParamDO.setArea(zero);
|
||||
materialInventoryParamDO.setVolume(zero);
|
||||
materialInventoryParamDO.setNetWeight(zero);
|
||||
materialInventoryParamDO.setGrossWeight(zero);
|
||||
materialInventoryParamDO.setQuantity(allocationQuantity);
|
||||
materialInventoryParamDO.setType("2");
|
||||
materialInventoryParamDO.setMaterialInventoryId(materialInventoryPO.getMaterialInventoryId());
|
||||
materialInventoryService.kctzjl(materialInventoryParamDO,"分配库存",loginUser);
|
||||
materialInventoryService.xgkc(materialInventoryParamDO);
|
||||
//materialInventoryMapper.updateById(materialInventory);
|
||||
|
||||
//库存调整记录
|
||||
InventoryAdjustmentRecord inventoryAdjustmentRecord = new InventoryAdjustmentRecord();
|
||||
inventoryAdjustmentRecord.setAdjustAction("分配库存");
|
||||
inventoryAdjustmentRecord.setRelateNo(outOrderNumber);
|
||||
inventoryAdjustmentRecord.setAdjustAfterStatusCode(materialInventory.getMaterialStatusCode() == null ? "" : materialInventory.getMaterialStatusCode());
|
||||
inventoryAdjustmentRecord.setAdjustBeforeStatusCode(materialInventory.getMaterialStatusCode() == null ? "" : materialInventory.getMaterialStatusCode());
|
||||
inventoryAdjustmentRecord.setAdjustAfterStatusName(materialInventory.getMaterialStatusName() == null ? "" : materialInventory.getMaterialStatusName());
|
||||
inventoryAdjustmentRecord.setAdjustBeforeStatusName(materialInventory.getMaterialStatusName() == null ? "" : materialInventory.getMaterialStatusName());
|
||||
inventoryAdjustmentRecord.setAdjustType(1L);
|
||||
inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventoryPO.getMaterialBaseInfoId());
|
||||
inventoryAdjustmentRecord.setMaterialCode(outMaterialDetail.getMaterialNo());
|
||||
inventoryAdjustmentRecord.setMaterialName(outMaterialDetail.getCommodityName());
|
||||
inventoryAdjustmentRecord.setBarCode(outMaterialDetail.getBarCode());
|
||||
if (inventoryAdjustmentRecord.getBarCode().equals("")){
|
||||
getBarCode(materialInventoryPO, inventoryAdjustmentRecord);
|
||||
}
|
||||
inventoryAdjustmentRecord.setMaterialBaseInfoId(outMaterialDetail.getMaterialBaseInfoId());
|
||||
inventoryAdjustmentRecord.setOrganizationId(stockOutOrder.getOrganizationId());
|
||||
inventoryAdjustmentRecord.setOrganizationName(stockOutOrder.getOrganizationName());
|
||||
inventoryAdjustmentRecord.setTopOrganizationId(stockOutOrder.getTopOrganizationId());
|
||||
inventoryAdjustmentRecord.setWarehouseCode(stockOutOrder.getWarehouseCode());
|
||||
inventoryAdjustmentRecord.setWarehouseName(stockOutOrder.getWarehouseName());
|
||||
inventoryAdjustmentRecord.setWarehouseId(stockOutOrder.getWarehouseId());
|
||||
inventoryAdjustmentRecord.setStorageCode(materialInventoryPO.getStorageCode());
|
||||
inventoryAdjustmentRecord.setStorageName(materialInventoryPO.getStorageName());
|
||||
inventoryAdjustmentRecord.setStorageLocationId(materialInventoryPO.getStorageLocationId());
|
||||
inventoryAdjustmentRecord.setStorageLocationCode(materialInventoryPO.getStorageLocationCode());
|
||||
inventoryAdjustmentRecord.setStorageLocationName(materialInventoryPO.getStorageLocationName());
|
||||
inventoryAdjustmentRecord.setMaterialInventoryId(materialInventoryPO.getMaterialInventoryId());
|
||||
inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventoryPO.getMaterialBaseInfoId());
|
||||
inventoryAdjustmentRecord.setShipperId(stockOutOrder.getShipperId());
|
||||
inventoryAdjustmentRecord.setShipperName(stockOutOrder.getShipperName());
|
||||
inventoryAdjustmentRecord.setStorageSectionId(materialInventoryPO.getStorageSectionId());
|
||||
inventoryAdjustmentRecord.setStorageLocationId(materialInventoryPO.getStorageLocationId());
|
||||
inventoryAdjustmentRecord.setCreateBy(loginUser.getUserid());
|
||||
UserPo userPo = loginUser.getUserPo();
|
||||
if (userPo != null) inventoryAdjustmentRecord.setCreateByName(userPo.getUserName());
|
||||
inventoryAdjustmentRecord.setCreateTime(new Date());
|
||||
inventoryAdjustmentRecord.setAllocationAfterQuantity(newAllocationQuantity);
|
||||
inventoryAdjustmentRecord.setAllocationBeforeQuantity(oldAllocationQuantity);
|
||||
inventoryAdjustmentRecord.setFreezeBeforeQuantity(oldFreezeQuantity);
|
||||
inventoryAdjustmentRecord.setFreezeAfterQuantity(newFreezeQuantity);
|
||||
inventoryAdjustmentRecord.setInventoryBeforeQuantity(materialInventoryPO.getInventoryQuantity());
|
||||
inventoryAdjustmentRecord.setInventoryAfterQuantity(materialInventoryPO.getInventoryQuantity());
|
||||
inventoryAdjustmentRecord.setNetWeight(materialInventoryPO.getNetWeight() == null ? BigDecimal.ZERO : materialInventoryPO.getNetWeight());
|
||||
inventoryAdjustmentRecord.setGrossWeight(materialInventoryPO.getGrossWeight() == null ? BigDecimal.ZERO : materialInventoryPO.getGrossWeight());
|
||||
inventoryAdjustmentRecord.setVolume(materialInventoryPO.getVolume() == null ? BigDecimal.ZERO : materialInventoryPO.getVolume());
|
||||
inventoryAdjustmentRecord.setArea(materialInventoryPO.getArea() == null ? BigDecimal.ZERO : materialInventoryPO.getArea());
|
||||
inventoryAdjustmentRecord.setAdjustedNetWeight(materialInventoryPO.getNetWeight() == null ? BigDecimal.ZERO : materialInventoryPO.getNetWeight());
|
||||
inventoryAdjustmentRecord.setAdjustedGrossWeight(materialInventoryPO.getGrossWeight() == null ? BigDecimal.ZERO : materialInventoryPO.getGrossWeight());
|
||||
inventoryAdjustmentRecord.setAdjustedVolume(materialInventoryPO.getVolume() == null ? BigDecimal.ZERO : materialInventoryPO.getVolume());
|
||||
inventoryAdjustmentRecord.setAdjustedArea(materialInventoryPO.getArea() == null ? BigDecimal.ZERO : materialInventoryPO.getArea());
|
||||
inventoryAdjustmentRecordMapper.insert(inventoryAdjustmentRecord);
|
||||
// InventoryAdjustmentRecord inventoryAdjustmentRecord = new InventoryAdjustmentRecord();
|
||||
// inventoryAdjustmentRecord.setAdjustAction("分配库存");
|
||||
// inventoryAdjustmentRecord.setRelateNo(outOrderNumber);
|
||||
// inventoryAdjustmentRecord.setAdjustAfterStatusCode(materialInventory.getMaterialStatusCode() == null ? "" : materialInventory.getMaterialStatusCode());
|
||||
// inventoryAdjustmentRecord.setAdjustBeforeStatusCode(materialInventory.getMaterialStatusCode() == null ? "" : materialInventory.getMaterialStatusCode());
|
||||
// inventoryAdjustmentRecord.setAdjustAfterStatusName(materialInventory.getMaterialStatusName() == null ? "" : materialInventory.getMaterialStatusName());
|
||||
// inventoryAdjustmentRecord.setAdjustBeforeStatusName(materialInventory.getMaterialStatusName() == null ? "" : materialInventory.getMaterialStatusName());
|
||||
// inventoryAdjustmentRecord.setAdjustType(1L);
|
||||
// inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventoryPO.getMaterialBaseInfoId());
|
||||
// inventoryAdjustmentRecord.setMaterialCode(outMaterialDetail.getMaterialNo());
|
||||
// inventoryAdjustmentRecord.setMaterialName(outMaterialDetail.getCommodityName());
|
||||
// inventoryAdjustmentRecord.setBarCode(outMaterialDetail.getBarCode());
|
||||
// if (inventoryAdjustmentRecord.getBarCode().equals("")){
|
||||
// getBarCode(materialInventoryPO, inventoryAdjustmentRecord);
|
||||
// }
|
||||
// inventoryAdjustmentRecord.setMaterialBaseInfoId(outMaterialDetail.getMaterialBaseInfoId());
|
||||
// inventoryAdjustmentRecord.setOrganizationId(stockOutOrder.getOrganizationId());
|
||||
// inventoryAdjustmentRecord.setOrganizationName(stockOutOrder.getOrganizationName());
|
||||
// inventoryAdjustmentRecord.setTopOrganizationId(stockOutOrder.getTopOrganizationId());
|
||||
// inventoryAdjustmentRecord.setWarehouseCode(stockOutOrder.getWarehouseCode());
|
||||
// inventoryAdjustmentRecord.setWarehouseName(stockOutOrder.getWarehouseName());
|
||||
// inventoryAdjustmentRecord.setWarehouseId(stockOutOrder.getWarehouseId());
|
||||
// inventoryAdjustmentRecord.setStorageCode(materialInventoryPO.getStorageCode());
|
||||
// inventoryAdjustmentRecord.setStorageName(materialInventoryPO.getStorageName());
|
||||
// inventoryAdjustmentRecord.setStorageLocationId(materialInventoryPO.getStorageLocationId());
|
||||
// inventoryAdjustmentRecord.setStorageLocationCode(materialInventoryPO.getStorageLocationCode());
|
||||
// inventoryAdjustmentRecord.setStorageLocationName(materialInventoryPO.getStorageLocationName());
|
||||
// inventoryAdjustmentRecord.setMaterialInventoryId(materialInventoryPO.getMaterialInventoryId());
|
||||
// inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventoryPO.getMaterialBaseInfoId());
|
||||
// inventoryAdjustmentRecord.setShipperId(stockOutOrder.getShipperId());
|
||||
// inventoryAdjustmentRecord.setShipperName(stockOutOrder.getShipperName());
|
||||
// inventoryAdjustmentRecord.setStorageSectionId(materialInventoryPO.getStorageSectionId());
|
||||
// inventoryAdjustmentRecord.setStorageLocationId(materialInventoryPO.getStorageLocationId());
|
||||
// inventoryAdjustmentRecord.setCreateBy(loginUser.getUserid());
|
||||
// UserPo userPo = loginUser.getUserPo();
|
||||
// if (userPo != null) inventoryAdjustmentRecord.setCreateByName(userPo.getUserName());
|
||||
// inventoryAdjustmentRecord.setCreateTime(new Date());
|
||||
// inventoryAdjustmentRecord.setAllocationAfterQuantity(newAllocationQuantity);
|
||||
// inventoryAdjustmentRecord.setAllocationBeforeQuantity(oldAllocationQuantity);
|
||||
// inventoryAdjustmentRecord.setFreezeBeforeQuantity(oldFreezeQuantity);
|
||||
// inventoryAdjustmentRecord.setFreezeAfterQuantity(newFreezeQuantity);
|
||||
// inventoryAdjustmentRecord.setInventoryBeforeQuantity(materialInventoryPO.getInventoryQuantity());
|
||||
// inventoryAdjustmentRecord.setInventoryAfterQuantity(materialInventoryPO.getInventoryQuantity());
|
||||
// inventoryAdjustmentRecord.setNetWeight(materialInventoryPO.getNetWeight() == null ? BigDecimal.ZERO : materialInventoryPO.getNetWeight());
|
||||
// inventoryAdjustmentRecord.setGrossWeight(materialInventoryPO.getGrossWeight() == null ? BigDecimal.ZERO : materialInventoryPO.getGrossWeight());
|
||||
// inventoryAdjustmentRecord.setVolume(materialInventoryPO.getVolume() == null ? BigDecimal.ZERO : materialInventoryPO.getVolume());
|
||||
// inventoryAdjustmentRecord.setArea(materialInventoryPO.getArea() == null ? BigDecimal.ZERO : materialInventoryPO.getArea());
|
||||
// inventoryAdjustmentRecord.setAdjustedNetWeight(materialInventoryPO.getNetWeight() == null ? BigDecimal.ZERO : materialInventoryPO.getNetWeight());
|
||||
// inventoryAdjustmentRecord.setAdjustedGrossWeight(materialInventoryPO.getGrossWeight() == null ? BigDecimal.ZERO : materialInventoryPO.getGrossWeight());
|
||||
// inventoryAdjustmentRecord.setAdjustedVolume(materialInventoryPO.getVolume() == null ? BigDecimal.ZERO : materialInventoryPO.getVolume());
|
||||
// inventoryAdjustmentRecord.setAdjustedArea(materialInventoryPO.getArea() == null ? BigDecimal.ZERO : materialInventoryPO.getArea());
|
||||
// inventoryAdjustmentRecordMapper.insert(inventoryAdjustmentRecord);
|
||||
}
|
||||
/*Long uniqueId = outMaterialDetail.getUniqueId();
|
||||
String outOrderNumber1 = outMaterialDetail.getOutOrderNumber();
|
||||
@@ -803,73 +819,79 @@ public class OutMaterialDetailImpl extends ServiceImpl<OutMaterialDetailMapper,
|
||||
BigDecimal allocationQuantity = outMaterialDetail.getActualQuantity();
|
||||
MaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId);
|
||||
if (materialInventoryPO != null) {
|
||||
//更新库存数量
|
||||
//可用数量
|
||||
BigDecimal oldAllocationQuantity = materialInventoryPO.getAllocationQuantity();
|
||||
//冻结数量
|
||||
BigDecimal oldFreezeQuantity = materialInventoryPO.getFreezeQuantity();
|
||||
//分配后可用数量
|
||||
BigDecimal newAllocationQuantity = oldAllocationQuantity.add(allocationQuantity);
|
||||
//分配后冻结数量
|
||||
BigDecimal newFreezeQuantity = oldFreezeQuantity.subtract(allocationQuantity);
|
||||
materialInventoryPO.setAllocationQuantity(newAllocationQuantity);
|
||||
materialInventoryPO.setFreezeQuantity(newFreezeQuantity);
|
||||
materialInventoryMapper.updateById(materialInventoryPO);
|
||||
|
||||
|
||||
//库存调整记录
|
||||
InventoryAdjustmentRecord inventoryAdjustmentRecord = new InventoryAdjustmentRecord();
|
||||
inventoryAdjustmentRecord.setAdjustAction("分配库存");
|
||||
inventoryAdjustmentRecord.setRelateNo(outOrderNumber);
|
||||
inventoryAdjustmentRecord.setAdjustAfterStatusCode(materialInventoryPO.getMaterialStatusCode() == null ? "" : materialInventoryPO.getMaterialStatusCode());
|
||||
inventoryAdjustmentRecord.setAdjustBeforeStatusCode(materialInventoryPO.getMaterialStatusCode() == null ? "" : materialInventoryPO.getMaterialStatusCode());
|
||||
inventoryAdjustmentRecord.setAdjustAfterStatusName(materialInventoryPO.getMaterialStatusName() == null ? "" : materialInventoryPO.getMaterialStatusName());
|
||||
inventoryAdjustmentRecord.setAdjustBeforeStatusName(materialInventoryPO.getMaterialStatusName() == null ? "" : materialInventoryPO.getMaterialStatusName());
|
||||
inventoryAdjustmentRecord.setAdjustType(1L);
|
||||
inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventoryPO.getMaterialBaseInfoId());
|
||||
inventoryAdjustmentRecord.setMaterialCode(outMaterialDetail.getMaterialNo());
|
||||
inventoryAdjustmentRecord.setMaterialName(outMaterialDetail.getCommodityName());
|
||||
inventoryAdjustmentRecord.setBarCode(outMaterialDetail.getBarCode());
|
||||
if (inventoryAdjustmentRecord.getBarCode().equals("")){
|
||||
getBarCode(materialInventoryPO, inventoryAdjustmentRecord);
|
||||
}
|
||||
inventoryAdjustmentRecord.setMaterialBaseInfoId(outMaterialDetail.getMaterialBaseInfoId());
|
||||
inventoryAdjustmentRecord.setOrganizationId(stockOutOrder.getOrganizationId());
|
||||
inventoryAdjustmentRecord.setOrganizationName(stockOutOrder.getOrganizationName());
|
||||
inventoryAdjustmentRecord.setTopOrganizationId(stockOutOrder.getTopOrganizationId());
|
||||
inventoryAdjustmentRecord.setWarehouseCode(stockOutOrder.getWarehouseCode());
|
||||
inventoryAdjustmentRecord.setWarehouseName(stockOutOrder.getWarehouseName());
|
||||
inventoryAdjustmentRecord.setWarehouseId(stockOutOrder.getWarehouseId());
|
||||
inventoryAdjustmentRecord.setStorageCode(materialInventoryPO.getStorageCode());
|
||||
inventoryAdjustmentRecord.setStorageName(materialInventoryPO.getStorageName());
|
||||
inventoryAdjustmentRecord.setStorageLocationId(materialInventoryPO.getStorageLocationId());
|
||||
inventoryAdjustmentRecord.setStorageLocationCode(materialInventoryPO.getStorageLocationCode());
|
||||
inventoryAdjustmentRecord.setStorageLocationName(materialInventoryPO.getStorageLocationName());
|
||||
inventoryAdjustmentRecord.setMaterialInventoryId(materialInventoryPO.getMaterialInventoryId());
|
||||
inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventoryPO.getMaterialBaseInfoId());
|
||||
inventoryAdjustmentRecord.setShipperId(stockOutOrder.getShipperId());
|
||||
inventoryAdjustmentRecord.setShipperName(stockOutOrder.getShipperName());
|
||||
inventoryAdjustmentRecord.setStorageSectionId(materialInventoryPO.getStorageSectionId());
|
||||
inventoryAdjustmentRecord.setStorageLocationId(materialInventoryPO.getStorageLocationId());
|
||||
inventoryAdjustmentRecord.setCreateBy(loginUser.getUserid());
|
||||
inventoryAdjustmentRecord.setNetWeight(materialInventoryPO.getNetWeight() == null ? BigDecimal.ZERO : materialInventoryPO.getNetWeight());
|
||||
inventoryAdjustmentRecord.setGrossWeight(materialInventoryPO.getGrossWeight() == null ? BigDecimal.ZERO : materialInventoryPO.getGrossWeight());
|
||||
inventoryAdjustmentRecord.setVolume(materialInventoryPO.getVolume() == null ? BigDecimal.ZERO : materialInventoryPO.getVolume());
|
||||
inventoryAdjustmentRecord.setArea(materialInventoryPO.getArea() == null ? BigDecimal.ZERO : materialInventoryPO.getArea());
|
||||
inventoryAdjustmentRecord.setAdjustedNetWeight(materialInventoryPO.getNetWeight() == null ? BigDecimal.ZERO : materialInventoryPO.getNetWeight());
|
||||
inventoryAdjustmentRecord.setAdjustedGrossWeight(materialInventoryPO.getGrossWeight() == null ? BigDecimal.ZERO : materialInventoryPO.getGrossWeight());
|
||||
inventoryAdjustmentRecord.setAdjustedVolume(materialInventoryPO.getVolume() == null ? BigDecimal.ZERO : materialInventoryPO.getVolume());
|
||||
inventoryAdjustmentRecord.setAdjustedArea(materialInventoryPO.getArea() == null ? BigDecimal.ZERO : materialInventoryPO.getArea());
|
||||
UserPo userPo = loginUser.getUserPo();
|
||||
if (userPo != null) inventoryAdjustmentRecord.setCreateByName(userPo.getUserName());
|
||||
inventoryAdjustmentRecord.setCreateTime(new Date());
|
||||
inventoryAdjustmentRecord.setAllocationAfterQuantity(newAllocationQuantity);
|
||||
inventoryAdjustmentRecord.setAllocationBeforeQuantity(oldAllocationQuantity);
|
||||
inventoryAdjustmentRecord.setFreezeBeforeQuantity(oldFreezeQuantity);
|
||||
inventoryAdjustmentRecord.setFreezeAfterQuantity(newFreezeQuantity);
|
||||
inventoryAdjustmentRecord.setInventoryBeforeQuantity(materialInventoryPO.getInventoryQuantity());
|
||||
inventoryAdjustmentRecord.setInventoryAfterQuantity(materialInventoryPO.getInventoryQuantity());
|
||||
inventoryAdjustmentRecordMapper.insert(inventoryAdjustmentRecord);
|
||||
MaterialInventoryParamDO materialInventoryParamDO = new MaterialInventoryParamDO();
|
||||
materialInventoryParamDO.setMaterialInventoryId(materialInventoryId);
|
||||
materialInventoryParamDO.setQuantity(allocationQuantity);
|
||||
materialInventoryParamDO.setType("3");
|
||||
materialInventoryService.kctzjl(materialInventoryParamDO,"取消分配",loginUser);
|
||||
materialInventoryService.xgkc(materialInventoryParamDO);
|
||||
// //更新库存数量
|
||||
// //可用数量
|
||||
// BigDecimal oldAllocationQuantity = materialInventoryPO.getAllocationQuantity();
|
||||
// //冻结数量
|
||||
// BigDecimal oldFreezeQuantity = materialInventoryPO.getFreezeQuantity();
|
||||
// //分配后可用数量
|
||||
// BigDecimal newAllocationQuantity = oldAllocationQuantity.add(allocationQuantity);
|
||||
// //分配后冻结数量
|
||||
// BigDecimal newFreezeQuantity = oldFreezeQuantity.subtract(allocationQuantity);
|
||||
// materialInventoryPO.setAllocationQuantity(newAllocationQuantity);
|
||||
// materialInventoryPO.setFreezeQuantity(newFreezeQuantity);
|
||||
// materialInventoryMapper.updateById(materialInventoryPO);
|
||||
//
|
||||
//
|
||||
// //库存调整记录
|
||||
// InventoryAdjustmentRecord inventoryAdjustmentRecord = new InventoryAdjustmentRecord();
|
||||
// inventoryAdjustmentRecord.setAdjustAction("分配库存");
|
||||
// inventoryAdjustmentRecord.setRelateNo(outOrderNumber);
|
||||
// inventoryAdjustmentRecord.setAdjustAfterStatusCode(materialInventoryPO.getMaterialStatusCode() == null ? "" : materialInventoryPO.getMaterialStatusCode());
|
||||
// inventoryAdjustmentRecord.setAdjustBeforeStatusCode(materialInventoryPO.getMaterialStatusCode() == null ? "" : materialInventoryPO.getMaterialStatusCode());
|
||||
// inventoryAdjustmentRecord.setAdjustAfterStatusName(materialInventoryPO.getMaterialStatusName() == null ? "" : materialInventoryPO.getMaterialStatusName());
|
||||
// inventoryAdjustmentRecord.setAdjustBeforeStatusName(materialInventoryPO.getMaterialStatusName() == null ? "" : materialInventoryPO.getMaterialStatusName());
|
||||
// inventoryAdjustmentRecord.setAdjustType(1L);
|
||||
// inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventoryPO.getMaterialBaseInfoId());
|
||||
// inventoryAdjustmentRecord.setMaterialCode(outMaterialDetail.getMaterialNo());
|
||||
// inventoryAdjustmentRecord.setMaterialName(outMaterialDetail.getCommodityName());
|
||||
// inventoryAdjustmentRecord.setBarCode(outMaterialDetail.getBarCode());
|
||||
// if (inventoryAdjustmentRecord.getBarCode().equals("")){
|
||||
// getBarCode(materialInventoryPO, inventoryAdjustmentRecord);
|
||||
// }
|
||||
// inventoryAdjustmentRecord.setMaterialBaseInfoId(outMaterialDetail.getMaterialBaseInfoId());
|
||||
// inventoryAdjustmentRecord.setOrganizationId(stockOutOrder.getOrganizationId());
|
||||
// inventoryAdjustmentRecord.setOrganizationName(stockOutOrder.getOrganizationName());
|
||||
// inventoryAdjustmentRecord.setTopOrganizationId(stockOutOrder.getTopOrganizationId());
|
||||
// inventoryAdjustmentRecord.setWarehouseCode(stockOutOrder.getWarehouseCode());
|
||||
// inventoryAdjustmentRecord.setWarehouseName(stockOutOrder.getWarehouseName());
|
||||
// inventoryAdjustmentRecord.setWarehouseId(stockOutOrder.getWarehouseId());
|
||||
// inventoryAdjustmentRecord.setStorageCode(materialInventoryPO.getStorageCode());
|
||||
// inventoryAdjustmentRecord.setStorageName(materialInventoryPO.getStorageName());
|
||||
// inventoryAdjustmentRecord.setStorageLocationId(materialInventoryPO.getStorageLocationId());
|
||||
// inventoryAdjustmentRecord.setStorageLocationCode(materialInventoryPO.getStorageLocationCode());
|
||||
// inventoryAdjustmentRecord.setStorageLocationName(materialInventoryPO.getStorageLocationName());
|
||||
// inventoryAdjustmentRecord.setMaterialInventoryId(materialInventoryPO.getMaterialInventoryId());
|
||||
// inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventoryPO.getMaterialBaseInfoId());
|
||||
// inventoryAdjustmentRecord.setShipperId(stockOutOrder.getShipperId());
|
||||
// inventoryAdjustmentRecord.setShipperName(stockOutOrder.getShipperName());
|
||||
// inventoryAdjustmentRecord.setStorageSectionId(materialInventoryPO.getStorageSectionId());
|
||||
// inventoryAdjustmentRecord.setStorageLocationId(materialInventoryPO.getStorageLocationId());
|
||||
// inventoryAdjustmentRecord.setCreateBy(loginUser.getUserid());
|
||||
// inventoryAdjustmentRecord.setNetWeight(materialInventoryPO.getNetWeight() == null ? BigDecimal.ZERO : materialInventoryPO.getNetWeight());
|
||||
// inventoryAdjustmentRecord.setGrossWeight(materialInventoryPO.getGrossWeight() == null ? BigDecimal.ZERO : materialInventoryPO.getGrossWeight());
|
||||
// inventoryAdjustmentRecord.setVolume(materialInventoryPO.getVolume() == null ? BigDecimal.ZERO : materialInventoryPO.getVolume());
|
||||
// inventoryAdjustmentRecord.setArea(materialInventoryPO.getArea() == null ? BigDecimal.ZERO : materialInventoryPO.getArea());
|
||||
// inventoryAdjustmentRecord.setAdjustedNetWeight(materialInventoryPO.getNetWeight() == null ? BigDecimal.ZERO : materialInventoryPO.getNetWeight());
|
||||
// inventoryAdjustmentRecord.setAdjustedGrossWeight(materialInventoryPO.getGrossWeight() == null ? BigDecimal.ZERO : materialInventoryPO.getGrossWeight());
|
||||
// inventoryAdjustmentRecord.setAdjustedVolume(materialInventoryPO.getVolume() == null ? BigDecimal.ZERO : materialInventoryPO.getVolume());
|
||||
// inventoryAdjustmentRecord.setAdjustedArea(materialInventoryPO.getArea() == null ? BigDecimal.ZERO : materialInventoryPO.getArea());
|
||||
// UserPo userPo = loginUser.getUserPo();
|
||||
// if (userPo != null) inventoryAdjustmentRecord.setCreateByName(userPo.getUserName());
|
||||
// inventoryAdjustmentRecord.setCreateTime(new Date());
|
||||
// inventoryAdjustmentRecord.setAllocationAfterQuantity(newAllocationQuantity);
|
||||
// inventoryAdjustmentRecord.setAllocationBeforeQuantity(oldAllocationQuantity);
|
||||
// inventoryAdjustmentRecord.setFreezeBeforeQuantity(oldFreezeQuantity);
|
||||
// inventoryAdjustmentRecord.setFreezeAfterQuantity(newFreezeQuantity);
|
||||
// inventoryAdjustmentRecord.setInventoryBeforeQuantity(materialInventoryPO.getInventoryQuantity());
|
||||
// inventoryAdjustmentRecord.setInventoryAfterQuantity(materialInventoryPO.getInventoryQuantity());
|
||||
// inventoryAdjustmentRecordMapper.insert(inventoryAdjustmentRecord);
|
||||
}
|
||||
|
||||
List<OutMaterialDetailDO> children = outMaterialDetail.getChildren();
|
||||
@@ -887,66 +909,74 @@ public class OutMaterialDetailImpl extends ServiceImpl<OutMaterialDetailMapper,
|
||||
BigDecimal allocationQuantity = outMaterialDetail.getActualQuantity();
|
||||
MaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId);
|
||||
if (materialInventoryPO != null) {
|
||||
//更新库存数量
|
||||
//可用数量
|
||||
BigDecimal oldAllocationQuantity = materialInventoryPO.getAllocationQuantity();
|
||||
//冻结数量
|
||||
BigDecimal oldFreezeQuantity = materialInventoryPO.getFreezeQuantity();
|
||||
//分配后可用数量
|
||||
BigDecimal newAllocationQuantity = oldAllocationQuantity.add(allocationQuantity);
|
||||
//分配后冻结数量
|
||||
BigDecimal newFreezeQuantity = oldFreezeQuantity.subtract(allocationQuantity);
|
||||
materialInventoryPO.setAllocationQuantity(newAllocationQuantity);
|
||||
materialInventoryPO.setFreezeQuantity(newFreezeQuantity);
|
||||
materialInventoryMapper.updateById(materialInventoryPO);
|
||||
|
||||
MaterialInventoryParamDO materialInventoryParamDO = new MaterialInventoryParamDO();
|
||||
materialInventoryParamDO.setMaterialInventoryId(materialInventoryId);
|
||||
materialInventoryParamDO.setQuantity(allocationQuantity);
|
||||
materialInventoryParamDO.setType("3");
|
||||
materialInventoryService.kctzjl(materialInventoryParamDO,"取消分配",loginUser);
|
||||
materialInventoryService.xgkc(materialInventoryParamDO);
|
||||
|
||||
|
||||
//库存调整记录
|
||||
InventoryAdjustmentRecord inventoryAdjustmentRecord = new InventoryAdjustmentRecord();
|
||||
inventoryAdjustmentRecord.setAdjustAction("分配库存");
|
||||
inventoryAdjustmentRecord.setRelateNo(outOrderNumber);
|
||||
inventoryAdjustmentRecord.setAdjustAfterStatusCode(materialInventoryPO.getMaterialStatusCode() == null ? "" : materialInventoryPO.getMaterialStatusCode());
|
||||
inventoryAdjustmentRecord.setAdjustBeforeStatusCode(materialInventoryPO.getMaterialStatusCode() == null ? "" : materialInventoryPO.getMaterialStatusCode());
|
||||
inventoryAdjustmentRecord.setAdjustAfterStatusName(materialInventoryPO.getMaterialStatusName() == null ? "" : materialInventoryPO.getMaterialStatusName());
|
||||
inventoryAdjustmentRecord.setAdjustBeforeStatusName(materialInventoryPO.getMaterialStatusName() == null ? "" : materialInventoryPO.getMaterialStatusName());
|
||||
inventoryAdjustmentRecord.setAdjustType(1L);
|
||||
inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventoryPO.getMaterialBaseInfoId());
|
||||
inventoryAdjustmentRecord.setMaterialCode(outMaterialDetail.getMaterialNo());
|
||||
inventoryAdjustmentRecord.setMaterialName(outMaterialDetail.getCommodityName());
|
||||
inventoryAdjustmentRecord.setBarCode(outMaterialDetail.getBarCode());
|
||||
if (inventoryAdjustmentRecord.getBarCode().equals("")){
|
||||
getBarCode(materialInventoryPO, inventoryAdjustmentRecord);
|
||||
}
|
||||
inventoryAdjustmentRecord.setMaterialBaseInfoId(outMaterialDetail.getMaterialBaseInfoId());
|
||||
inventoryAdjustmentRecord.setOrganizationId(stockOutOrder.getOrganizationId());
|
||||
inventoryAdjustmentRecord.setOrganizationName(stockOutOrder.getOrganizationName());
|
||||
inventoryAdjustmentRecord.setTopOrganizationId(stockOutOrder.getTopOrganizationId());
|
||||
inventoryAdjustmentRecord.setWarehouseCode(stockOutOrder.getWarehouseCode());
|
||||
inventoryAdjustmentRecord.setWarehouseName(stockOutOrder.getWarehouseName());
|
||||
inventoryAdjustmentRecord.setWarehouseId(stockOutOrder.getWarehouseId());
|
||||
inventoryAdjustmentRecord.setStorageCode(materialInventoryPO.getStorageCode());
|
||||
inventoryAdjustmentRecord.setStorageName(materialInventoryPO.getStorageName());
|
||||
inventoryAdjustmentRecord.setStorageLocationId(materialInventoryPO.getStorageLocationId());
|
||||
inventoryAdjustmentRecord.setStorageLocationCode(materialInventoryPO.getStorageLocationCode());
|
||||
inventoryAdjustmentRecord.setStorageLocationName(materialInventoryPO.getStorageLocationName());
|
||||
inventoryAdjustmentRecord.setMaterialInventoryId(materialInventoryPO.getMaterialInventoryId());
|
||||
inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventoryPO.getMaterialBaseInfoId());
|
||||
inventoryAdjustmentRecord.setShipperId(stockOutOrder.getShipperId());
|
||||
inventoryAdjustmentRecord.setShipperName(stockOutOrder.getShipperName());
|
||||
inventoryAdjustmentRecord.setStorageSectionId(materialInventoryPO.getStorageSectionId());
|
||||
inventoryAdjustmentRecord.setStorageLocationId(materialInventoryPO.getStorageLocationId());
|
||||
inventoryAdjustmentRecord.setCreateBy(loginUser.getUserid());
|
||||
UserPo userPo = loginUser.getUserPo();
|
||||
if (userPo != null) inventoryAdjustmentRecord.setCreateByName(userPo.getUserName());
|
||||
inventoryAdjustmentRecord.setCreateTime(new Date());
|
||||
inventoryAdjustmentRecord.setAllocationAfterQuantity(newAllocationQuantity);
|
||||
inventoryAdjustmentRecord.setAllocationBeforeQuantity(oldAllocationQuantity);
|
||||
inventoryAdjustmentRecord.setFreezeBeforeQuantity(oldFreezeQuantity);
|
||||
inventoryAdjustmentRecord.setFreezeAfterQuantity(newFreezeQuantity);
|
||||
inventoryAdjustmentRecord.setInventoryBeforeQuantity(materialInventoryPO.getInventoryQuantity());
|
||||
inventoryAdjustmentRecord.setInventoryAfterQuantity(materialInventoryPO.getInventoryQuantity());
|
||||
inventoryAdjustmentRecordMapper.insert(inventoryAdjustmentRecord);
|
||||
// //更新库存数量
|
||||
// //可用数量
|
||||
// BigDecimal oldAllocationQuantity = materialInventoryPO.getAllocationQuantity();
|
||||
// //冻结数量
|
||||
// BigDecimal oldFreezeQuantity = materialInventoryPO.getFreezeQuantity();
|
||||
// //分配后可用数量
|
||||
// BigDecimal newAllocationQuantity = oldAllocationQuantity.add(allocationQuantity);
|
||||
// //分配后冻结数量
|
||||
// BigDecimal newFreezeQuantity = oldFreezeQuantity.subtract(allocationQuantity);
|
||||
// materialInventoryPO.setAllocationQuantity(newAllocationQuantity);
|
||||
// materialInventoryPO.setFreezeQuantity(newFreezeQuantity);
|
||||
// materialInventoryMapper.updateById(materialInventoryPO);
|
||||
//
|
||||
//
|
||||
//
|
||||
// //库存调整记录
|
||||
// InventoryAdjustmentRecord inventoryAdjustmentRecord = new InventoryAdjustmentRecord();
|
||||
// inventoryAdjustmentRecord.setAdjustAction("分配库存");
|
||||
// inventoryAdjustmentRecord.setRelateNo(outOrderNumber);
|
||||
// inventoryAdjustmentRecord.setAdjustAfterStatusCode(materialInventoryPO.getMaterialStatusCode() == null ? "" : materialInventoryPO.getMaterialStatusCode());
|
||||
// inventoryAdjustmentRecord.setAdjustBeforeStatusCode(materialInventoryPO.getMaterialStatusCode() == null ? "" : materialInventoryPO.getMaterialStatusCode());
|
||||
// inventoryAdjustmentRecord.setAdjustAfterStatusName(materialInventoryPO.getMaterialStatusName() == null ? "" : materialInventoryPO.getMaterialStatusName());
|
||||
// inventoryAdjustmentRecord.setAdjustBeforeStatusName(materialInventoryPO.getMaterialStatusName() == null ? "" : materialInventoryPO.getMaterialStatusName());
|
||||
// inventoryAdjustmentRecord.setAdjustType(1L);
|
||||
// inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventoryPO.getMaterialBaseInfoId());
|
||||
// inventoryAdjustmentRecord.setMaterialCode(outMaterialDetail.getMaterialNo());
|
||||
// inventoryAdjustmentRecord.setMaterialName(outMaterialDetail.getCommodityName());
|
||||
// inventoryAdjustmentRecord.setBarCode(outMaterialDetail.getBarCode());
|
||||
// if (inventoryAdjustmentRecord.getBarCode().equals("")){
|
||||
// getBarCode(materialInventoryPO, inventoryAdjustmentRecord);
|
||||
// }
|
||||
// inventoryAdjustmentRecord.setMaterialBaseInfoId(outMaterialDetail.getMaterialBaseInfoId());
|
||||
// inventoryAdjustmentRecord.setOrganizationId(stockOutOrder.getOrganizationId());
|
||||
// inventoryAdjustmentRecord.setOrganizationName(stockOutOrder.getOrganizationName());
|
||||
// inventoryAdjustmentRecord.setTopOrganizationId(stockOutOrder.getTopOrganizationId());
|
||||
// inventoryAdjustmentRecord.setWarehouseCode(stockOutOrder.getWarehouseCode());
|
||||
// inventoryAdjustmentRecord.setWarehouseName(stockOutOrder.getWarehouseName());
|
||||
// inventoryAdjustmentRecord.setWarehouseId(stockOutOrder.getWarehouseId());
|
||||
// inventoryAdjustmentRecord.setStorageCode(materialInventoryPO.getStorageCode());
|
||||
// inventoryAdjustmentRecord.setStorageName(materialInventoryPO.getStorageName());
|
||||
// inventoryAdjustmentRecord.setStorageLocationId(materialInventoryPO.getStorageLocationId());
|
||||
// inventoryAdjustmentRecord.setStorageLocationCode(materialInventoryPO.getStorageLocationCode());
|
||||
// inventoryAdjustmentRecord.setStorageLocationName(materialInventoryPO.getStorageLocationName());
|
||||
// inventoryAdjustmentRecord.setMaterialInventoryId(materialInventoryPO.getMaterialInventoryId());
|
||||
// inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventoryPO.getMaterialBaseInfoId());
|
||||
// inventoryAdjustmentRecord.setShipperId(stockOutOrder.getShipperId());
|
||||
// inventoryAdjustmentRecord.setShipperName(stockOutOrder.getShipperName());
|
||||
// inventoryAdjustmentRecord.setStorageSectionId(materialInventoryPO.getStorageSectionId());
|
||||
// inventoryAdjustmentRecord.setStorageLocationId(materialInventoryPO.getStorageLocationId());
|
||||
// inventoryAdjustmentRecord.setCreateBy(loginUser.getUserid());
|
||||
// UserPo userPo = loginUser.getUserPo();
|
||||
// if (userPo != null) inventoryAdjustmentRecord.setCreateByName(userPo.getUserName());
|
||||
// inventoryAdjustmentRecord.setCreateTime(new Date());
|
||||
// inventoryAdjustmentRecord.setAllocationAfterQuantity(newAllocationQuantity);
|
||||
// inventoryAdjustmentRecord.setAllocationBeforeQuantity(oldAllocationQuantity);
|
||||
// inventoryAdjustmentRecord.setFreezeBeforeQuantity(oldFreezeQuantity);
|
||||
// inventoryAdjustmentRecord.setFreezeAfterQuantity(newFreezeQuantity);
|
||||
// inventoryAdjustmentRecord.setInventoryBeforeQuantity(materialInventoryPO.getInventoryQuantity());
|
||||
// inventoryAdjustmentRecord.setInventoryAfterQuantity(materialInventoryPO.getInventoryQuantity());
|
||||
// inventoryAdjustmentRecordMapper.insert(inventoryAdjustmentRecord);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+130
-219
@@ -50,6 +50,7 @@ import com.mhd.wms.domain.materialInventory.repository.facade.IMaterialInventory
|
||||
import com.mhd.wms.domain.materialInventory.repository.mapper.MaterialInventoryMapper;
|
||||
import com.mhd.wms.domain.materialInventory.repository.po.MaterialInventoryPO;
|
||||
import com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryDO;
|
||||
import com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryParamDO;
|
||||
import com.mhd.wms.domain.materialMoreDetail.repository.todo.MaterialMoreDetailDO;
|
||||
import com.mhd.wms.domain.serialNumber.entity.SerialNumber;
|
||||
import com.mhd.wms.domain.serialNumber.repository.facade.ISerialNumberService;
|
||||
@@ -678,63 +679,64 @@ public class StockShelfOrderDomainService {
|
||||
MaterialBaseInfo materialBaseInfo = materialBaseInfoMapper.selectById(materialBaseInfoId);
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (materialInventoryPOS.size() == 0) {
|
||||
MaterialInventory materialInventory = new MaterialInventory();
|
||||
materialInventory.setInOrderNumber(stockReceiptOrderDO.getInOrderNumber());
|
||||
materialInventory.setLotNumber(shelfMaterialDetail.getLotNumber());
|
||||
//仓库信息
|
||||
materialInventory.setWarehouseId(stockReceiptOrderDO.getWarehouseId());
|
||||
materialInventory.setWarehouseCode(stockReceiptOrderDO.getWarehouseCode());
|
||||
materialInventory.setWarehouseName(stockReceiptOrderDO.getWarehouseName());
|
||||
|
||||
//组织信息
|
||||
materialInventory.setOrganizationId(stockReceiptOrderDO.getOrganizationId());
|
||||
materialInventory.setTopOrganizationId(stockReceiptOrderDO.getTopOrganizationId());
|
||||
materialInventory.setOrganizationName(stockReceiptOrderDO.getOrganizationName());
|
||||
|
||||
//货主信息
|
||||
materialInventory.setShipperId(stockReceiptOrderDO.getShipperId());
|
||||
materialInventory.setShipperName(stockReceiptOrderDO.getShipperName());
|
||||
materialInventory.setShipperCode(stockReceiptOrderDO.getShipperCode());
|
||||
|
||||
//物料信息/库位库区
|
||||
materialInventory.setMaterialBaseInfoId(shelfMaterialDetail.getMaterialBaseInfoId());
|
||||
materialInventory.setStorageSectionId(shelfMaterialDetail.getStorageSectionId());
|
||||
materialInventory.setStorageCode(shelfMaterialDetail.getStorageCode());
|
||||
materialInventory.setStorageName(shelfMaterialDetail.getStorageName());
|
||||
materialInventory.setStorageLocationId(shelfMaterialDetail.getStorageLocationId());
|
||||
materialInventory.setStorageLocationCode(shelfMaterialDetail.getStorageLocationCode());
|
||||
materialInventory.setStorageLocationName(shelfMaterialDetail.getStorageLocationName());
|
||||
|
||||
//批次属性信息
|
||||
materialInventory.setExtAttr1(shelfMaterialDetail.getExtAttr1());
|
||||
materialInventory.setExtAttr2(shelfMaterialDetail.getExtAttr2());
|
||||
materialInventory.setExtAttr3(shelfMaterialDetail.getExtAttr3());
|
||||
materialInventory.setExtAttr4(shelfMaterialDetail.getExtAttr4());
|
||||
materialInventory.setInventoryDate(shelfMaterialDetail.getInventoryDate());
|
||||
materialInventory.setExpiryDate(shelfMaterialDetail.getExpiryDate());
|
||||
materialInventory.setProductionDate(shelfMaterialDetail.getProductionDate());
|
||||
materialInventory.setBoxPalletNo(shelfMaterialDetail.getBoxPalletNo());
|
||||
materialInventory.setSheetRefNo(shelfMaterialDetail.getSheetRefNo());
|
||||
materialInventory.setBatchRefNo(shelfMaterialDetail.getBatchRefNo());
|
||||
materialInventory.setBatchNumber(shelfMaterialDetail.getBatchNumber());
|
||||
|
||||
//库存数量信息
|
||||
materialInventory.setInventoryQuantity(shelfMaterialDetail.getShelvesQuantity());
|
||||
materialInventory.setAllocationQuantity(shelfMaterialDetail.getShelvesQuantity());
|
||||
materialInventory.setFreezeQuantity(BigDecimal.ZERO);
|
||||
|
||||
//创建人信息
|
||||
materialInventory.setCreateBy(loginUser.getUserid());
|
||||
materialInventory.setCreateByName(loginUser.getUsername());
|
||||
materialInventory.setCreateTime(new Date());
|
||||
|
||||
//体积 重量等
|
||||
materialInventory.setVolume(shelfMaterialDetail.getTotalVolume());
|
||||
materialInventory.setArea(shelfMaterialDetail.getTotalArea());
|
||||
materialInventory.setGrossWeight(shelfMaterialDetail.getTotalGrossWeight());
|
||||
materialInventory.setNetWeight(shelfMaterialDetail.getTotalNetWeight());
|
||||
materialInventory.setUnit(materialBaseInfo.getUnitCode());
|
||||
materialInventory.setUnitName(materialBaseInfo.getUnitName());
|
||||
MaterialInventoryParamDO inventoryParamDO = new MaterialInventoryParamDO();
|
||||
// MaterialInventory materialInventory = new MaterialInventory();
|
||||
// materialInventory.setInOrderNumber(stockReceiptOrderDO.getInOrderNumber());
|
||||
// materialInventory.setLotNumber(shelfMaterialDetail.getLotNumber());
|
||||
// //仓库信息
|
||||
// materialInventory.setWarehouseId(stockReceiptOrderDO.getWarehouseId());
|
||||
// materialInventory.setWarehouseCode(stockReceiptOrderDO.getWarehouseCode());
|
||||
// materialInventory.setWarehouseName(stockReceiptOrderDO.getWarehouseName());
|
||||
//
|
||||
// //组织信息
|
||||
// materialInventory.setOrganizationId(stockReceiptOrderDO.getOrganizationId());
|
||||
// materialInventory.setTopOrganizationId(stockReceiptOrderDO.getTopOrganizationId());
|
||||
// materialInventory.setOrganizationName(stockReceiptOrderDO.getOrganizationName());
|
||||
//
|
||||
// //货主信息
|
||||
// materialInventory.setShipperId(stockReceiptOrderDO.getShipperId());
|
||||
// materialInventory.setShipperName(stockReceiptOrderDO.getShipperName());
|
||||
// materialInventory.setShipperCode(stockReceiptOrderDO.getShipperCode());
|
||||
//
|
||||
// //物料信息/库位库区
|
||||
// materialInventory.setMaterialBaseInfoId(shelfMaterialDetail.getMaterialBaseInfoId());
|
||||
// materialInventory.setStorageSectionId(shelfMaterialDetail.getStorageSectionId());
|
||||
// materialInventory.setStorageCode(shelfMaterialDetail.getStorageCode());
|
||||
// materialInventory.setStorageName(shelfMaterialDetail.getStorageName());
|
||||
// materialInventory.setStorageLocationId(shelfMaterialDetail.getStorageLocationId());
|
||||
// materialInventory.setStorageLocationCode(shelfMaterialDetail.getStorageLocationCode());
|
||||
// materialInventory.setStorageLocationName(shelfMaterialDetail.getStorageLocationName());
|
||||
//
|
||||
// //批次属性信息
|
||||
// materialInventory.setExtAttr1(shelfMaterialDetail.getExtAttr1());
|
||||
// materialInventory.setExtAttr2(shelfMaterialDetail.getExtAttr2());
|
||||
// materialInventory.setExtAttr3(shelfMaterialDetail.getExtAttr3());
|
||||
// materialInventory.setExtAttr4(shelfMaterialDetail.getExtAttr4());
|
||||
// materialInventory.setInventoryDate(shelfMaterialDetail.getInventoryDate());
|
||||
// materialInventory.setExpiryDate(shelfMaterialDetail.getExpiryDate());
|
||||
// materialInventory.setProductionDate(shelfMaterialDetail.getProductionDate());
|
||||
// materialInventory.setBoxPalletNo(shelfMaterialDetail.getBoxPalletNo());
|
||||
// materialInventory.setSheetRefNo(shelfMaterialDetail.getSheetRefNo());
|
||||
// materialInventory.setBatchRefNo(shelfMaterialDetail.getBatchRefNo());
|
||||
// materialInventory.setBatchNumber(shelfMaterialDetail.getBatchNumber());
|
||||
//
|
||||
// //库存数量信息
|
||||
// materialInventory.setInventoryQuantity(shelfMaterialDetail.getShelvesQuantity());
|
||||
// materialInventory.setAllocationQuantity(shelfMaterialDetail.getShelvesQuantity());
|
||||
// materialInventory.setFreezeQuantity(BigDecimal.ZERO);
|
||||
//
|
||||
// //创建人信息
|
||||
// materialInventory.setCreateBy(loginUser.getUserid());
|
||||
// materialInventory.setCreateByName(loginUser.getUsername());
|
||||
// materialInventory.setCreateTime(new Date());
|
||||
//
|
||||
// //体积 重量等
|
||||
// materialInventory.setVolume(shelfMaterialDetail.getTotalVolume());
|
||||
// materialInventory.setArea(shelfMaterialDetail.getTotalArea());
|
||||
// materialInventory.setGrossWeight(shelfMaterialDetail.getTotalGrossWeight());
|
||||
// materialInventory.setNetWeight(shelfMaterialDetail.getTotalNetWeight());
|
||||
// materialInventory.setUnit(materialBaseInfo.getUnitCode());
|
||||
// materialInventory.setUnitName(materialBaseInfo.getUnitName());
|
||||
// 条码:优先取上架明细的 barCode,为空则从 material_bar_code 表取(优先 EA 单位)
|
||||
String insertBarCode = shelfMaterialDetail.getBarCode();
|
||||
if (StringUtils.isBlank(insertBarCode) && shelfMaterialDetail.getMaterialBaseInfoId() != null) {
|
||||
@@ -752,91 +754,69 @@ public class StockShelfOrderDomainService {
|
||||
log.warn("获取条码失败,materialBaseInfoId={},错误:{}", shelfMaterialDetail.getMaterialBaseInfoId(), e.getMessage());
|
||||
}
|
||||
}
|
||||
materialInventory.setBarCode(insertBarCode);
|
||||
//materialInventory.setBarCode(insertBarCode);
|
||||
inventoryParamDO.setBarCode(insertBarCode);
|
||||
inventoryParamDO.setArea(shelfMaterialDetail.getTotalArea());
|
||||
inventoryParamDO.setVolume(shelfMaterialDetail.getTotalVolume());
|
||||
inventoryParamDO.setNetWeight(shelfMaterialDetail.getTotalNetWeight());
|
||||
inventoryParamDO.setGrossWeight(shelfMaterialDetail.getTotalGrossWeight());
|
||||
inventoryParamDO.setMaterialInventoryId(null);
|
||||
inventoryParamDO.setMaterialBaseInfoId(materialBaseInfo.getMaterialBaseInfoId());
|
||||
|
||||
materialInventoryMapper.insert(materialInventory);
|
||||
inventoryParamDO.setInOrderNumber(stockReceiptOrderDO.getInOrderNumber());
|
||||
inventoryParamDO.setLotNumber(shelfMaterialDetail.getLotNumber());
|
||||
inventoryParamDO.setQuantity(shelfMaterialDetail.getShelvesQuantity());
|
||||
//仓库信息
|
||||
inventoryParamDO.setMaterialBaseInfoId(shelfMaterialDetail.getMaterialBaseInfoId());
|
||||
inventoryParamDO.setStorageSectionId(shelfMaterialDetail.getStorageSectionId());
|
||||
inventoryParamDO.setStorageCode(shelfMaterialDetail.getStorageCode());
|
||||
inventoryParamDO.setStorageName(shelfMaterialDetail.getStorageName());
|
||||
inventoryParamDO.setStorageLocationId(shelfMaterialDetail.getStorageLocationId());
|
||||
inventoryParamDO.setStorageLocationCode(shelfMaterialDetail.getStorageLocationCode());
|
||||
inventoryParamDO.setStorageLocationName(shelfMaterialDetail.getStorageLocationName());
|
||||
|
||||
inventoryParamDO.setWarehouseId(stockReceiptOrderDO.getWarehouseId());
|
||||
inventoryParamDO.setWarehouseCode(stockReceiptOrderDO.getWarehouseCode());
|
||||
inventoryParamDO.setWarehouseName(stockReceiptOrderDO.getWarehouseName());
|
||||
|
||||
//组织信息
|
||||
inventoryParamDO.setOrganizationId(stockReceiptOrderDO.getOrganizationId());
|
||||
inventoryParamDO.setTopOrganizationId(stockReceiptOrderDO.getTopOrganizationId());
|
||||
inventoryParamDO.setOrganizationName(stockReceiptOrderDO.getOrganizationName());
|
||||
|
||||
//货主信息
|
||||
inventoryParamDO.setShipperId(stockReceiptOrderDO.getShipperId());
|
||||
inventoryParamDO.setShipperName(stockReceiptOrderDO.getShipperName());
|
||||
inventoryParamDO.setShipperCode(stockReceiptOrderDO.getShipperCode());
|
||||
|
||||
inventoryParamDO.setExtAttr1(shelfMaterialDetail.getExtAttr1());
|
||||
inventoryParamDO.setExtAttr2(shelfMaterialDetail.getExtAttr2());
|
||||
inventoryParamDO.setExtAttr3(shelfMaterialDetail.getExtAttr3());
|
||||
inventoryParamDO.setExtAttr4(shelfMaterialDetail.getExtAttr4());
|
||||
inventoryParamDO.setInventoryDate(shelfMaterialDetail.getInventoryDate());
|
||||
inventoryParamDO.setExpiryDate(shelfMaterialDetail.getExpiryDate());
|
||||
inventoryParamDO.setProductionDate(shelfMaterialDetail.getProductionDate());
|
||||
inventoryParamDO.setBoxPalletNo(shelfMaterialDetail.getBoxPalletNo());
|
||||
inventoryParamDO.setSheetRefNo(shelfMaterialDetail.getSheetRefNo());
|
||||
inventoryParamDO.setBatchRefNo(shelfMaterialDetail.getBatchRefNo());
|
||||
inventoryParamDO.setBatchNumber(shelfMaterialDetail.getBatchNumber());
|
||||
|
||||
inventoryParamDO.setCreateBy(loginUser.getUserid());
|
||||
inventoryParamDO.setCreateByName(loginUser.getUsername());
|
||||
inventoryParamDO.setCreateTime(new Date());
|
||||
//materialInventoryMapper.insert(materialInventory);
|
||||
|
||||
|
||||
//库存调整记录
|
||||
InventoryAdjustmentRecord inventoryAdjustmentRecord = new InventoryAdjustmentRecord();
|
||||
inventoryAdjustmentRecord.setInOrderNumber(stockReceiptOrderDO.getInOrderNumber());
|
||||
inventoryAdjustmentRecord.setLotNumber(shelfMaterialDetail.getLotNumber());
|
||||
inventoryAdjustmentRecord.setAdjustAction("入库");
|
||||
inventoryAdjustmentRecord.setRelateNo(stockReceiptOrderDO.getInOrderNumber());
|
||||
inventoryAdjustmentRecord.setAdjustAfterStatusCode(materialInventory.getMaterialStatusCode() == null ? "" : materialInventory.getMaterialStatusCode());
|
||||
inventoryAdjustmentRecord.setAdjustBeforeStatusCode(materialInventory.getMaterialStatusCode() == null ? "" : materialInventory.getMaterialStatusCode());
|
||||
inventoryAdjustmentRecord.setAdjustAfterStatusName(materialInventory.getMaterialStatusName() == null ? "" : materialInventory.getMaterialStatusName());
|
||||
inventoryAdjustmentRecord.setAdjustBeforeStatusName(materialInventory.getMaterialStatusName() == null ? "" : materialInventory.getMaterialStatusName());
|
||||
inventoryAdjustmentRecord.setAdjustType(1L);
|
||||
inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventory.getMaterialBaseInfoId());
|
||||
inventoryAdjustmentRecord.setMaterialCode(shelfMaterialDetail.getMaterialCode());
|
||||
inventoryAdjustmentRecord.setMaterialName(shelfMaterialDetail.getMaterialName());
|
||||
// 条码优先取上架明细上的条码;如果为空,则根据物料基础信息ID从物料条码表中获取(单位代码为EA的条码)
|
||||
String shelfBarCode = shelfMaterialDetail.getBarCode();
|
||||
if (StringUtils.isBlank(shelfBarCode) && shelfMaterialDetail.getMaterialBaseInfoId() != null) {
|
||||
try {
|
||||
java.util.List<MaterialBarCodePO> barCodeList = materialBarCodeService.getInfoByMaterialBaseInfoIds(shelfMaterialDetail.getMaterialBaseInfoId());
|
||||
if (barCodeList != null && !barCodeList.isEmpty()) {
|
||||
// 优先选择单位代码为EA的条码,若不存在则取第一条
|
||||
MaterialBarCodePO eaBarCode = barCodeList.stream()
|
||||
.filter(po -> "EA".equals(po.getUnitCode()))
|
||||
.findFirst()
|
||||
.orElse(barCodeList.get(0));
|
||||
if (eaBarCode != null && StringUtils.isNotBlank(eaBarCode.getBarCode())) {
|
||||
shelfBarCode = eaBarCode.getBarCode();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("根据物料基础信息ID获取条码失败,materialBaseInfoId={},错误:{}", shelfMaterialDetail.getMaterialBaseInfoId(), e.getMessage());
|
||||
}
|
||||
}
|
||||
inventoryAdjustmentRecord.setBarCode(shelfBarCode);
|
||||
inventoryAdjustmentRecord.setMaterialBaseInfoId(shelfMaterialDetail.getMaterialBaseInfoId());
|
||||
inventoryAdjustmentRecord.setOrganizationId(stockReceiptOrderDO.getOrganizationId());
|
||||
inventoryAdjustmentRecord.setOrganizationName(stockReceiptOrderDO.getOrganizationName());
|
||||
inventoryAdjustmentRecord.setTopOrganizationId(stockReceiptOrderDO.getTopOrganizationId());
|
||||
inventoryAdjustmentRecord.setWarehouseCode(stockReceiptOrderDO.getWarehouseCode());
|
||||
inventoryAdjustmentRecord.setWarehouseName(stockReceiptOrderDO.getWarehouseName());
|
||||
inventoryAdjustmentRecord.setWarehouseId(stockReceiptOrderDO.getWarehouseId());
|
||||
inventoryAdjustmentRecord.setStorageCode(materialInventory.getStorageCode());
|
||||
inventoryAdjustmentRecord.setStorageName(materialInventory.getStorageName());
|
||||
inventoryAdjustmentRecord.setStorageLocationId(materialInventory.getStorageLocationId());
|
||||
inventoryAdjustmentRecord.setStorageLocationCode(materialInventory.getStorageLocationCode());
|
||||
inventoryAdjustmentRecord.setStorageLocationName(materialInventory.getStorageLocationName());
|
||||
inventoryAdjustmentRecord.setMaterialInventoryId(materialInventory.getMaterialInventoryId());
|
||||
inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventory.getMaterialBaseInfoId());
|
||||
inventoryAdjustmentRecord.setShipperId(stockReceiptOrderDO.getShipperId());
|
||||
inventoryAdjustmentRecord.setShipperName(stockReceiptOrderDO.getShipperName());
|
||||
inventoryAdjustmentRecord.setStorageSectionId(materialInventory.getStorageSectionId());
|
||||
inventoryAdjustmentRecord.setStorageLocationId(materialInventory.getStorageLocationId());
|
||||
inventoryAdjustmentRecord.setCreateBy(loginUser.getUserid());
|
||||
UserPo userPo = loginUser.getUserPo();
|
||||
if (userPo != null) inventoryAdjustmentRecord.setCreateByName(userPo.getUserName());
|
||||
inventoryAdjustmentRecord.setCreateTime(new Date());
|
||||
inventoryAdjustmentRecord.setAllocationAfterQuantity(materialInventory.getAllocationQuantity());
|
||||
inventoryAdjustmentRecord.setAllocationBeforeQuantity(BigDecimal.ZERO);
|
||||
inventoryAdjustmentRecord.setFreezeBeforeQuantity(BigDecimal.ZERO);
|
||||
inventoryAdjustmentRecord.setFreezeAfterQuantity(BigDecimal.ZERO);
|
||||
inventoryAdjustmentRecord.setInventoryBeforeQuantity(BigDecimal.ZERO);
|
||||
inventoryAdjustmentRecord.setInventoryAfterQuantity(materialInventory.getInventoryQuantity());
|
||||
inventoryAdjustmentRecord.setNetWeight(BigDecimal.ZERO );
|
||||
inventoryAdjustmentRecord.setGrossWeight(BigDecimal.ZERO);
|
||||
inventoryAdjustmentRecord.setVolume(BigDecimal.ZERO);
|
||||
inventoryAdjustmentRecord.setArea(BigDecimal.ZERO);
|
||||
inventoryAdjustmentRecord.setAdjustedNetWeight(materialInventory.getNetWeight() == null ? BigDecimal.ZERO : materialInventory.getNetWeight());
|
||||
inventoryAdjustmentRecord.setAdjustedGrossWeight(materialInventory.getGrossWeight() == null ? BigDecimal.ZERO : materialInventory.getGrossWeight());
|
||||
inventoryAdjustmentRecord.setAdjustedVolume(materialInventory.getVolume() == null ? BigDecimal.ZERO : materialInventory.getVolume());
|
||||
inventoryAdjustmentRecord.setAdjustedArea(materialInventory.getArea() == null ? BigDecimal.ZERO : materialInventory.getArea());
|
||||
inventoryAdjustmentRecordMapper.insert(inventoryAdjustmentRecord);
|
||||
materialInventoryService.kctzjl(inventoryParamDO,"入库", loginUser);
|
||||
materialInventoryService.xgkc(inventoryParamDO);
|
||||
} else if (materialInventoryPOS.size() == 1) {
|
||||
MaterialInventory materialInventory = new MaterialInventory();
|
||||
materialInventory.setInOrderNumber(stockReceiptOrderDO.getInOrderNumber());
|
||||
materialInventory.setLotNumber(shelfMaterialDetail.getLotNumber());
|
||||
MaterialInventoryParamDO inventoryParamDO = new MaterialInventoryParamDO();
|
||||
|
||||
BigDecimal shelvesQuantity = shelfMaterialDetail.getShelvesQuantity();
|
||||
shelvesQuantity = shelvesQuantity != null ? shelvesQuantity : BigDecimal.ZERO;
|
||||
MaterialInventoryPO materialInventoryPO = materialInventoryPOS.get(0);
|
||||
|
||||
BigDecimal oldFreezeQuantity = materialInventoryPO.getFreezeQuantity();
|
||||
BigDecimal oldInventoryQuantity = materialInventoryPO.getInventoryQuantity();
|
||||
oldInventoryQuantity = oldInventoryQuantity != null ? oldInventoryQuantity : BigDecimal.ZERO;
|
||||
BigDecimal newInventoryQuantity = oldInventoryQuantity.add(shelvesQuantity);
|
||||
@@ -848,110 +828,41 @@ public class StockShelfOrderDomainService {
|
||||
BigDecimal oldArea = materialInventoryPO.getArea();
|
||||
oldArea = oldArea != null ? oldArea : BigDecimal.ZERO;
|
||||
BigDecimal totalArea = shelfMaterialDetail.getTotalArea();
|
||||
|
||||
totalArea = totalArea != null ? totalArea : BigDecimal.ZERO;
|
||||
BigDecimal newArea = oldArea.add(totalArea);
|
||||
BigDecimal oldVolume = materialInventoryPO.getVolume();
|
||||
oldVolume = oldVolume != null ? oldVolume : BigDecimal.ZERO;
|
||||
BigDecimal totalVolume = shelfMaterialDetail.getTotalVolume();
|
||||
|
||||
totalVolume = totalVolume != null ? totalVolume : BigDecimal.ZERO;
|
||||
BigDecimal newVolume = oldVolume.add(totalVolume);
|
||||
BigDecimal oldGrossWeight = materialInventoryPO.getGrossWeight();
|
||||
oldGrossWeight = oldGrossWeight != null ? oldGrossWeight : BigDecimal.ZERO;
|
||||
BigDecimal totalGrossWeight = shelfMaterialDetail.getTotalGrossWeight();
|
||||
|
||||
totalGrossWeight = totalGrossWeight != null ? totalGrossWeight : BigDecimal.ZERO;
|
||||
BigDecimal newGrossWeight = oldGrossWeight.add(totalGrossWeight);
|
||||
BigDecimal oldNetWeight = materialInventoryPO.getNetWeight();
|
||||
oldNetWeight = oldNetWeight != null ? oldNetWeight : BigDecimal.ZERO;
|
||||
BigDecimal totalNetWeight = shelfMaterialDetail.getTotalNetWeight();
|
||||
|
||||
totalNetWeight = totalNetWeight != null ? totalNetWeight : BigDecimal.ZERO;
|
||||
BigDecimal newNetWeight = oldNetWeight.add(totalNetWeight);
|
||||
|
||||
materialInventoryPO.setInventoryQuantity(newInventoryQuantity);
|
||||
materialInventoryPO.setAllocationQuantity(newAllocationQuantity);
|
||||
materialInventoryPO.setArea(newArea);
|
||||
materialInventoryPO.setVolume(newVolume);
|
||||
materialInventoryPO.setGrossWeight(newGrossWeight);
|
||||
materialInventoryPO.setNetWeight(newNetWeight);
|
||||
BeanUtils.copyProperties(materialInventoryPO, materialInventory);
|
||||
materialInventory.setUpdateBy(loginUser.getUserid());
|
||||
materialInventory.setUpdateByName(loginUser.getUsername());
|
||||
materialInventory.setUpdateTime(new Date());
|
||||
// 如果库存记录没有 barCode,则补充写入
|
||||
if (StringUtils.isBlank(materialInventoryPO.getBarCode())) {
|
||||
String updateBarCode = shelfMaterialDetail.getBarCode();
|
||||
if (StringUtils.isBlank(updateBarCode) && shelfMaterialDetail.getMaterialBaseInfoId() != null) {
|
||||
try {
|
||||
List<MaterialBarCodePO> barCodeList = materialBarCodeService.getInfoByMaterialBaseInfoIds(shelfMaterialDetail.getMaterialBaseInfoId());
|
||||
if (barCodeList != null && !barCodeList.isEmpty()) {
|
||||
MaterialBarCodePO eaBarCode = barCodeList.stream()
|
||||
.filter(po -> "EA".equals(po.getUnitCode()))
|
||||
.findFirst().orElse(barCodeList.get(0));
|
||||
if (eaBarCode != null && StringUtils.isNotBlank(eaBarCode.getBarCode())) {
|
||||
updateBarCode = eaBarCode.getBarCode();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("获取条码失败,materialBaseInfoId={},错误:{}", shelfMaterialDetail.getMaterialBaseInfoId(), e.getMessage());
|
||||
}
|
||||
}
|
||||
materialInventory.setBarCode(updateBarCode);
|
||||
}
|
||||
materialInventoryMapper.updateById(materialInventory);
|
||||
|
||||
|
||||
InventoryAdjustmentRecord inventoryAdjustmentRecord = new InventoryAdjustmentRecord();
|
||||
inventoryAdjustmentRecord.setInOrderNumber(stockReceiptOrderDO.getInOrderNumber());
|
||||
inventoryAdjustmentRecord.setLotNumber(shelfMaterialDetail.getLotNumber());
|
||||
inventoryAdjustmentRecord.setAdjustAction("入库");
|
||||
inventoryAdjustmentRecord.setRelateNo(stockReceiptOrderDO.getInOrderNumber());
|
||||
inventoryAdjustmentRecord.setAdjustAfterStatusCode(materialInventory.getMaterialStatusCode() == null ? "" : materialInventory.getMaterialStatusCode());
|
||||
inventoryAdjustmentRecord.setAdjustBeforeStatusCode(materialInventory.getMaterialStatusCode() == null ? "" : materialInventory.getMaterialStatusCode());
|
||||
inventoryAdjustmentRecord.setAdjustAfterStatusName(materialInventory.getMaterialStatusName() == null ? "" : materialInventory.getMaterialStatusName());
|
||||
inventoryAdjustmentRecord.setAdjustBeforeStatusName(materialInventory.getMaterialStatusName() == null ? "" : materialInventory.getMaterialStatusName());
|
||||
inventoryAdjustmentRecord.setAdjustType(1L);
|
||||
inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventory.getMaterialBaseInfoId());
|
||||
inventoryAdjustmentRecord.setMaterialCode(shelfMaterialDetail.getMaterialCode());
|
||||
inventoryAdjustmentRecord.setMaterialName(shelfMaterialDetail.getMaterialName());
|
||||
inventoryAdjustmentRecord.setBarCode(shelfMaterialDetail.getBarCode());
|
||||
inventoryAdjustmentRecord.setMaterialBaseInfoId(shelfMaterialDetail.getMaterialBaseInfoId());
|
||||
inventoryAdjustmentRecord.setOrganizationId(stockReceiptOrderDO.getOrganizationId());
|
||||
inventoryAdjustmentRecord.setOrganizationName(stockReceiptOrderDO.getOrganizationName());
|
||||
inventoryAdjustmentRecord.setTopOrganizationId(stockReceiptOrderDO.getTopOrganizationId());
|
||||
inventoryAdjustmentRecord.setWarehouseCode(stockReceiptOrderDO.getWarehouseCode());
|
||||
inventoryAdjustmentRecord.setWarehouseName(stockReceiptOrderDO.getWarehouseName());
|
||||
inventoryAdjustmentRecord.setWarehouseId(stockReceiptOrderDO.getWarehouseId());
|
||||
inventoryAdjustmentRecord.setStorageCode(materialInventory.getStorageCode());
|
||||
inventoryAdjustmentRecord.setStorageName(materialInventory.getStorageName());
|
||||
inventoryAdjustmentRecord.setStorageLocationId(materialInventory.getStorageLocationId());
|
||||
inventoryAdjustmentRecord.setStorageLocationCode(materialInventory.getStorageLocationCode());
|
||||
inventoryAdjustmentRecord.setStorageLocationName(materialInventory.getStorageLocationName());
|
||||
inventoryAdjustmentRecord.setMaterialInventoryId(materialInventory.getMaterialInventoryId());
|
||||
inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventory.getMaterialBaseInfoId());
|
||||
inventoryAdjustmentRecord.setShipperId(stockReceiptOrderDO.getShipperId());
|
||||
inventoryAdjustmentRecord.setShipperName(stockReceiptOrderDO.getShipperName());
|
||||
inventoryAdjustmentRecord.setStorageSectionId(materialInventory.getStorageSectionId());
|
||||
inventoryAdjustmentRecord.setStorageLocationId(materialInventory.getStorageLocationId());
|
||||
inventoryAdjustmentRecord.setCreateBy(loginUser.getUserid());
|
||||
UserPo userPo = loginUser.getUserPo();
|
||||
if (userPo != null) inventoryAdjustmentRecord.setCreateByName(userPo.getUserName());
|
||||
inventoryAdjustmentRecord.setCreateTime(new Date());
|
||||
inventoryAdjustmentRecord.setAllocationAfterQuantity(newAllocationQuantity);
|
||||
inventoryAdjustmentRecord.setAllocationBeforeQuantity(oldAllocationQuantity);
|
||||
inventoryAdjustmentRecord.setFreezeBeforeQuantity(materialInventory.getFreezeQuantity());
|
||||
inventoryAdjustmentRecord.setFreezeAfterQuantity(materialInventory.getFreezeQuantity());
|
||||
inventoryAdjustmentRecord.setInventoryBeforeQuantity(oldInventoryQuantity);
|
||||
inventoryAdjustmentRecord.setInventoryAfterQuantity(newInventoryQuantity);
|
||||
inventoryAdjustmentRecord.setCreateBy(loginUser.getUserid());
|
||||
inventoryAdjustmentRecord.setCreateTime(new Date());
|
||||
inventoryAdjustmentRecord.setNetWeight(BigDecimal.ZERO );
|
||||
inventoryAdjustmentRecord.setGrossWeight(BigDecimal.ZERO);
|
||||
inventoryAdjustmentRecord.setVolume(BigDecimal.ZERO);
|
||||
inventoryAdjustmentRecord.setArea(BigDecimal.ZERO);
|
||||
inventoryAdjustmentRecord.setAdjustedNetWeight(materialInventory.getNetWeight() == null ? BigDecimal.ZERO : materialInventory.getNetWeight());
|
||||
inventoryAdjustmentRecord.setAdjustedGrossWeight(materialInventory.getGrossWeight() == null ? BigDecimal.ZERO : materialInventory.getGrossWeight());
|
||||
inventoryAdjustmentRecord.setAdjustedVolume(materialInventory.getVolume() == null ? BigDecimal.ZERO : materialInventory.getVolume());
|
||||
inventoryAdjustmentRecord.setAdjustedArea(materialInventory.getArea() == null ? BigDecimal.ZERO : materialInventory.getArea());
|
||||
inventoryAdjustmentRecordMapper.insert(inventoryAdjustmentRecord);
|
||||
inventoryParamDO.setArea(totalArea);
|
||||
inventoryParamDO.setVolume(totalVolume);
|
||||
inventoryParamDO.setNetWeight(totalNetWeight);
|
||||
inventoryParamDO.setGrossWeight(totalGrossWeight);
|
||||
inventoryParamDO.setMaterialInventoryId(materialInventoryPO.getMaterialInventoryId());
|
||||
inventoryParamDO.setMaterialBaseInfoId(materialInventoryPO.getMaterialBaseInfoId());
|
||||
inventoryParamDO.setInOrderNumber(stockReceiptOrderDO.getInOrderNumber());
|
||||
inventoryParamDO.setLotNumber(shelfMaterialDetail.getLotNumber());
|
||||
inventoryParamDO.setQuantity(shelfMaterialDetail.getShelvesQuantity());
|
||||
inventoryParamDO.setType("1");
|
||||
//库存调整记录
|
||||
materialInventoryService.kctzjl(inventoryParamDO, "入库", loginUser);
|
||||
materialInventoryService.xgkc(inventoryParamDO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user