bms改造;

This commit is contained in:
王奎兴
2026-09-04 11:11:39 +08:00
parent 2c60dc8f84
commit 6108606daa
54 changed files with 1052 additions and 81 deletions
@@ -23,6 +23,8 @@ import com.mhd.wms.domain.handoverTaskOrder.repository.facade.IHandoverTaskOrder
import com.mhd.wms.domain.handoverTaskOrder.repository.po.HandoverTaskOrderPO;
import com.mhd.wms.domain.handoverTaskOrder.repository.todo.HandoverTaskOrderDO;
import com.mhd.wms.domain.handoverTaskOrder.service.HandoverTaskOrderDomainService;
import com.mhd.wms.application.service.materialInventory.MaterialInventoryApplicationService;
import com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryParamDO;
import com.mhd.wms.domain.shiftManage.repository.todo.ShiftManageDO;
import com.mhd.wms.domain.stockOutOrder.entity.StockOutOrder;
import com.mhd.wms.domain.stockOutOrder.repository.facade.IStockOutOrderService;
@@ -33,6 +35,7 @@ import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
@@ -58,6 +61,9 @@ public class HandoverTaskOrderApplicationService {
@Autowired
private IStockOutOrderService stockOutOrderService;
@Autowired
private MaterialInventoryApplicationService materialInventoryApplicationService;
/**
* 分页查询交接作业单列表
@@ -200,7 +206,12 @@ public class HandoverTaskOrderApplicationService {
* @return Boolean
*/
public Boolean completeHandover(HandoverTaskOrderDO handoverTaskOrderDO){
return handoverTaskOrderDomainService.completeHandover(handoverTaskOrderDO);
Boolean result = handoverTaskOrderDomainService.completeHandover(handoverTaskOrderDO);
List<MaterialInventoryParamDO> clearoutParamDOs = handoverTaskOrderDomainService.getLastClearoutParamDOs();
for (MaterialInventoryParamDO paramDO : clearoutParamDOs) {
materialInventoryApplicationService.pushBillingRecordClearout(paramDO.getMaterialInventoryId(), paramDO.getQuantity());
}
return result;
}
@@ -297,6 +308,10 @@ public class HandoverTaskOrderApplicationService {
completeDO.setHandoverTaskOrderIds(handoverTaskOrderIds.stream().map(String::valueOf).collect(Collectors.toList()));
completeDO.setBillingJson(handoverTaskOrderDO.getBillingJson());
handoverTaskOrderDomainService.completeHandover(completeDO);
List<MaterialInventoryParamDO> clearoutParamDOs = handoverTaskOrderDomainService.getLastClearoutParamDOs();
for (MaterialInventoryParamDO paramDO : clearoutParamDOs) {
materialInventoryApplicationService.pushBillingRecordClearout(paramDO.getMaterialInventoryId(), paramDO.getQuantity());
}
}
}
}
@@ -5,6 +5,7 @@ import com.alibaba.fastjson2.JSONObject;
import com.alibaba.nacos.common.utils.CollectionUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.mhd.common.core.exception.ServiceException;
import com.mhd.common.core.utils.OrderSequence;
import com.mhd.common.core.utils.bean.BeanUtils;
import com.mhd.common.core.utils.StringUtils;
import com.mhd.common.core.web.domain.AjaxResult;
@@ -18,6 +19,7 @@ import com.mhd.system.api.domain.cache.SystemServiceCacheUtil;
import com.mhd.system.api.model.LoginUser;
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.mapper.MaterialInventoryMapper;
import com.mhd.wms.domain.materialInventory.repository.po.MaterialInventoryPO;
import com.mhd.wms.domain.materialInventory.repository.po.MaterialInventoryQueryListPO;
@@ -33,6 +35,7 @@ import com.mhd.wms.domain.outMaterialDetail.repository.mapper.OutMaterialDetailM
import com.mhd.wms.domain.stockOutOrder.repository.facade.IStockOutOrderService;
import com.mhd.wms.domain.stockOutOrder.repository.po.StockOutOrderPO;
import com.mhd.wms.util.BatchNoTokenUtil;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -43,6 +46,7 @@ import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.stream.Collectors;
@@ -886,16 +890,36 @@ public class MaterialInventoryApplicationService {
}
}
public void pushBillingRecord(String shipperId) {
//非首次推送
List<MaterialInventoryPO> materialInventoryPOS = materialInventoryDomainService.queryPushBms(shipperId);
if (materialInventoryPOS==null || materialInventoryPOS.size()==0) return;
for (MaterialInventoryPO materialInventoryPO : materialInventoryPOS) {
Date createTime = materialInventoryPO.getCreateTime();
Long materialBaseInfoId = materialInventoryPO.getMaterialBaseInfoId();
String lotNumber = materialInventoryPO.getLotNumber();
String inOrderNumber = materialInventoryPO.getInOrderNumber();
//推送清仓计费记录
public void pushBillingRecordClearout(Long materialInventoryId,BigDecimal quantity) {
MaterialInventory materialInventory = materialInventoryMapper.selectById(materialInventoryId);
MaterialInventoryPO materialInventoryPO = new MaterialInventoryPO();
BeanUtils.copyProperties(materialInventory, materialInventoryPO);
//未查询到库存记录
Long shipperId = materialInventoryPO.getShipperId();
Date createTime = materialInventoryPO.getCreateTime();
Long materialBaseInfoId = materialInventoryPO.getMaterialBaseInfoId();
String lotNumber = materialInventoryPO.getLotNumber();
String inOrderNumber = materialInventoryPO.getInOrderNumber();
Long warehouseId = materialInventoryPO.getWarehouseId();
Date lastBillingTime = materialInventoryPO.getLastBillingTime();
if (warehouseId==19) {//干仓计费
Map<String,Object> shipperParameters = materialInventoryDomainService.queryShipperParameters(shipperId,"干仓计费配置");
//客户未配置干仓计费配置
if (shipperParameters == null || shipperParameters.size()==0) return;
Long contractManageId = (Long) shipperParameters.get("contractManageId");
Long settlementCustomersId = (Long) shipperParameters.get("settlementCustomersId");
String contractNumber = (String) shipperParameters.get("contractNumber");
String content = (String) shipperParameters.get("content");
Map<String, Object> contentMap = content != null ? JSON.parseObject(content, Map.class) : new HashMap<>();
Integer sfzdcz = (Integer) contentMap.get("sfzdcz");
//客户未配置或是否自动推送设置为否
if (sfzdcz==null) return;
if (sfzdcz!=1) return;
//计算费用
List<Map<String, Object>> monthFee = materialInventoryDomainService.getMonthFee(inOrderNumber, materialBaseInfoId,lotNumber);
//入库业务单未设置每月仓租
if (monthFee == null || monthFee.size()==0) return;
Map<String, Object> feeMap = monthFee.get(0);
//半月仓租
@@ -912,7 +936,7 @@ public class MaterialInventoryApplicationService {
if (isYesterday) {
//首次计费 需要夫力费
//库存数量
BigDecimal inventoryQuantity = materialInventoryPO.getInventoryQuantity();
BigDecimal inventoryQuantity = quantity;
//仓租
BigDecimal totalWarehouseRent = inventoryQuantity.multiply(monthlyWarehouseFee);
//夫力费
@@ -921,7 +945,9 @@ public class MaterialInventoryApplicationService {
BigDecimal unitPrice = materialBaseInfo.getUnitPrice();
//火险保费
BigDecimal fireInsureFee = unitPrice.multiply(inventoryQuantity).multiply(new BigDecimal("0.0003"));
buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D081","干仓仓租费用",contractManageId,"干仓");
buildBusinessDocument(manpowerFee, materialInventoryPO,"0D082","夫力费",contractManageId,"干仓");
buildBusinessDocument(fireInsureFee, materialInventoryPO,"0D083","火险保费",contractManageId,"干仓");
} else {
//期间付费 不需要夫力费
@@ -933,13 +959,188 @@ public class MaterialInventoryApplicationService {
BigDecimal unitPrice = materialBaseInfo.getUnitPrice();
//火险保费
BigDecimal fireInsureFee = unitPrice.multiply(inventoryQuantity).multiply(new BigDecimal("0.0003"));
buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D081","干仓仓租费用",contractManageId,"冻仓");
buildBusinessDocument(fireInsureFee, materialInventoryPO,"0D083","火险保费",contractManageId,"冻仓");
}
} else if (warehouseId==20) {//冻仓计费
Map<String,Object> shipperParameters = materialInventoryDomainService.queryShipperParameters(Long.valueOf(shipperId),"冻仓计费配置");
if (shipperParameters == null || shipperParameters.size()==0) return;
Long contractManageId = (Long) shipperParameters.get("contractManageId");
Long settlementCustomersId = (Long) shipperParameters.get("settlementCustomersId");
String contractNumber = (String) shipperParameters.get("contractNumber");
String content = (String) shipperParameters.get("content");
Map<String, Object> contentMap = content != null ? JSON.parseObject(content, Map.class) : new HashMap<>();
Integer sfzdcz = (Integer) contentMap.get("sfzdcz");
//客户未配置或是否自动推送设置为否
if (sfzdcz==null) return;
if (sfzdcz!=1) return;
//计算费用
MaterialBaseInfo materialBaseInfo = materialBaseInfoMapper.selectById(materialBaseInfoId);
BigDecimal unitPrice = materialBaseInfo.getUnitPrice();
String materialClassifyId = materialBaseInfo.getMaterialClassifyId();
BigDecimal weightLimit = materialBaseInfo.getWeightLimit();
Map<String,Object> materialClassify = materialInventoryDomainService.queryMaterialClassify(Long.valueOf(materialClassifyId));
//物料分类不存在
if (materialClassify == null || materialClassify.size()==0) return;
BigDecimal monthlyWarehouseRent = (BigDecimal) materialClassify.get("monthlyWarehouseRent");
BigDecimal halfMonthWarehouseRent = (BigDecimal) materialClassify.get("halfMonthWarehouseRent");
String monthlyWarehouseRentUnit = (String) materialClassify.get("monthlyWarehouseRentUnit");
String halfMonthWarehouseRentUnit = (String) materialClassify.get("halfMonthWarehouseRentUnit");
//半月仓租
BigDecimal halfMonthWhFee = halfMonthWarehouseRent;
//整月仓租
BigDecimal monthlyWarehouseFee = monthlyWarehouseRent;
long daysDiff = 0;
if (lastBillingTime != null) {
LocalDate lastBillingDate = lastBillingTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
daysDiff = ChronoUnit.DAYS.between(lastBillingDate, LocalDate.now());
} else {
daysDiff = -1;
}
BigDecimal inventoryQuantity = quantity;
if (daysDiff < 15) {
// 不足半月: 收半月仓租
BigDecimal totalWarehouseRent = inventoryQuantity.multiply(halfMonthWhFee).multiply(weightLimit);
buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D081","冻仓仓租费用",contractManageId,"冻仓");
} else {
// 大于等于半月: 收整月仓租
BigDecimal totalWarehouseRent = inventoryQuantity.multiply(monthlyWarehouseFee).multiply(weightLimit);
buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D081","冻仓仓租费用",contractManageId,"冻仓");
}
//更新最后计费时间
Long id = materialInventoryPO.getMaterialInventoryId();
MaterialInventory Inventory = materialInventoryMapper.selectById(id);
Inventory.setLastBillingTime(new Date());
materialInventoryMapper.updateById(Inventory);
}
}
public void pushBillingRecord(String shipperId) {
List<MaterialInventoryPO> materialInventoryPOS = materialInventoryDomainService.queryPushBms(shipperId);
//未查询到库存记录
if (materialInventoryPOS==null || materialInventoryPOS.size()==0) return;
for (MaterialInventoryPO materialInventoryPO : materialInventoryPOS) {
Date createTime = materialInventoryPO.getCreateTime();
Long materialBaseInfoId = materialInventoryPO.getMaterialBaseInfoId();
String lotNumber = materialInventoryPO.getLotNumber();
String inOrderNumber = materialInventoryPO.getInOrderNumber();
Long warehouseId = materialInventoryPO.getWarehouseId();
Date lastBillingTime = materialInventoryPO.getLastBillingTime();
if (warehouseId==19) {//干仓计费
Map<String,Object> shipperParameters = materialInventoryDomainService.queryShipperParameters(Long.valueOf(shipperId),"干仓计费配置");
//客户未配置干仓计费配置
if (shipperParameters == null || shipperParameters.size()==0) continue;
Long contractManageId = (Long) shipperParameters.get("contractManageId");
Long settlementCustomersId = (Long) shipperParameters.get("settlementCustomersId");
String contractNumber = (String) shipperParameters.get("contractNumber");
String content = (String) shipperParameters.get("content");
Map<String, Object> contentMap = content != null ? JSON.parseObject(content, Map.class) : new HashMap<>();
Integer sfzdcz = (Integer) contentMap.get("sfzdcz");
//客户未配置或是否自动推送设置为否
if (sfzdcz==null) continue;
if (sfzdcz!=1) continue;
//计算费用
List<Map<String, Object>> monthFee = materialInventoryDomainService.getMonthFee(inOrderNumber, materialBaseInfoId,lotNumber);
//入库业务单未设置每月仓租
if (monthFee == null || monthFee.size()==0) continue;
Map<String, Object> feeMap = monthFee.get(0);
//半月仓租
BigDecimal halfMonthWhFee = (BigDecimal) feeMap.get("halfMonthWhFee");
//整月仓租
BigDecimal monthlyWarehouseFee = (BigDecimal) feeMap.get("monthlyWarehouseFee");
// 判断是否为昨天
boolean isYesterday = false;
if (createTime != null) {
LocalDate yesterday = LocalDate.now().minusDays(1);
LocalDate createDate = createTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
isYesterday = yesterday.isEqual(createDate);
}
if (isYesterday) {
//首次计费 需要夫力费
//库存数量
BigDecimal inventoryQuantity = materialInventoryPO.getInventoryQuantity();
//仓租
BigDecimal totalWarehouseRent = inventoryQuantity.multiply(monthlyWarehouseFee);
//夫力费
BigDecimal manpowerFee = totalWarehouseRent.multiply(new BigDecimal("0.2"));
MaterialBaseInfo materialBaseInfo = materialBaseInfoMapper.selectById(materialBaseInfoId);
BigDecimal unitPrice = materialBaseInfo.getUnitPrice();
//火险保费
BigDecimal fireInsureFee = unitPrice.multiply(inventoryQuantity).multiply(new BigDecimal("0.0003"));
buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D081","干仓仓租费用",contractManageId,"干仓");
buildBusinessDocument(manpowerFee, materialInventoryPO,"0D082","夫力费",contractManageId,"干仓");
buildBusinessDocument(fireInsureFee, materialInventoryPO,"0D083","火险保费",contractManageId,"干仓");
} else {
//期间付费 不需要夫力费
//库存数量
BigDecimal inventoryQuantity = materialInventoryPO.getInventoryQuantity();
//仓租
BigDecimal totalWarehouseRent = inventoryQuantity.multiply(monthlyWarehouseFee);
MaterialBaseInfo materialBaseInfo = materialBaseInfoMapper.selectById(materialBaseInfoId);
BigDecimal unitPrice = materialBaseInfo.getUnitPrice();
//火险保费
BigDecimal fireInsureFee = unitPrice.multiply(inventoryQuantity).multiply(new BigDecimal("0.0003"));
buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D081","干仓仓租费用",contractManageId,"干仓");
buildBusinessDocument(fireInsureFee, materialInventoryPO,"0D083","火险保费",contractManageId,"干仓");
}
} else if (warehouseId==20) {//冻仓计费
Map<String,Object> shipperParameters = materialInventoryDomainService.queryShipperParameters(Long.valueOf(shipperId),"冻仓计费配置");
if (shipperParameters == null || shipperParameters.size()==0) continue;
Long contractManageId = (Long) shipperParameters.get("contractManageId");
Long settlementCustomersId = (Long) shipperParameters.get("settlementCustomersId");
String contractNumber = (String) shipperParameters.get("contractNumber");
String content = (String) shipperParameters.get("content");
Map<String, Object> contentMap = content != null ? JSON.parseObject(content, Map.class) : new HashMap<>();
Integer sfzdcz = (Integer) contentMap.get("sfzdcz");
//客户未配置或是否自动推送设置为否
if (sfzdcz==null) continue;
if (sfzdcz!=1) continue;
//计算费用
MaterialBaseInfo materialBaseInfo = materialBaseInfoMapper.selectById(materialBaseInfoId);
BigDecimal unitPrice = materialBaseInfo.getUnitPrice();
String materialClassifyId = materialBaseInfo.getMaterialClassifyId();
BigDecimal weightLimit = materialBaseInfo.getWeightLimit();
Map<String,Object> materialClassify = materialInventoryDomainService.queryMaterialClassify(Long.valueOf(materialClassifyId));
//物料分类不存在
if (materialClassify == null || materialClassify.size()==0) continue;
BigDecimal monthlyWarehouseRent = (BigDecimal) materialClassify.get("monthlyWarehouseRent");
BigDecimal halfMonthWarehouseRent = (BigDecimal) materialClassify.get("halfMonthWarehouseRent");
String monthlyWarehouseRentUnit = (String) materialClassify.get("monthlyWarehouseRentUnit");
String halfMonthWarehouseRentUnit = (String) materialClassify.get("halfMonthWarehouseRentUnit");
//半月仓租
BigDecimal halfMonthWhFee = halfMonthWarehouseRent;
//整月仓租
BigDecimal monthlyWarehouseFee = monthlyWarehouseRent;
long daysDiff = 0;
if (lastBillingTime != null) {
LocalDate lastBillingDate = lastBillingTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
daysDiff = ChronoUnit.DAYS.between(lastBillingDate, LocalDate.now());
} else {
daysDiff = -1;
}
BigDecimal inventoryQuantity = materialInventoryPO.getInventoryQuantity();
if (daysDiff < 15) {
// 不足半月: 收半月仓租
BigDecimal totalWarehouseRent = inventoryQuantity.multiply(halfMonthWhFee).multiply(weightLimit);
buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D081","冻仓仓租费用",contractManageId,"冻仓");
} else {
// 大于等于半月: 收整月仓租
BigDecimal totalWarehouseRent = inventoryQuantity.multiply(monthlyWarehouseFee).multiply(weightLimit);
buildBusinessDocument(totalWarehouseRent, materialInventoryPO,"0D081","冻仓仓租费用",contractManageId,"冻仓");
}
//更新最后计费时间
Long materialInventoryId = materialInventoryPO.getMaterialInventoryId();
MaterialInventory materialInventory = materialInventoryMapper.selectById(materialInventoryId);
materialInventory.setLastBillingTime(new Date());
materialInventoryMapper.updateById(materialInventory);
}
}
}
private void buildBusinessDocument(BigDecimal fee, MaterialInventoryPO materialInventoryPO) {
private void buildBusinessDocument(BigDecimal fee, MaterialInventoryPO materialInventoryPO,String code,String name,Long contractManageId,String warehouseType) {
Long shipperId = materialInventoryPO.getShipperId();
Map<String, Object> shipper = materialInventoryMapper.querySetlleByShipperId(shipperId);
if (shipper == null) {
@@ -960,23 +1161,27 @@ public class MaterialInventoryApplicationService {
businessDocumentFeign.setSettlementEntity(settlementEntity);
businessDocumentFeign.setSettlementCustomersId(settlementCustomersId);
businessDocumentFeign.setSettlementCustomersCode(settlementCustomersCode);
businessDocumentFeign.setDocumentTypeId(5l);
businessDocumentFeign.setDocumentTypeCode("CM_SZ");
businessDocumentFeign.setDocumentType("码散租");
businessDocumentFeign.setFirstSubjectCode("0D81");
businessDocumentFeign.setFirstSubjectName("仓租费");
businessDocumentFeign.setDocumentTypeId(4l);
businessDocumentFeign.setDocumentTypeCode("CM_ZL");
businessDocumentFeign.setDocumentType("库租赁单");
businessDocumentFeign.setFirstSubjectCode(code);
businessDocumentFeign.setFirstSubjectName(name);
businessDocumentFeign.setBillingTime(new Date());
businessDocumentFeign.setServiceItemsCode("CMCZ");
businessDocumentFeign.setServiceItemsName("干仓仓租");
businessDocumentFeign.setServiceItemsCode("GC_CZ");
businessDocumentFeign.setServiceItemsName("干仓仓租费用");
businessDocumentFeign.setSettlementWay(1);
Map<String, Object> contract = materialInventoryDomainService.queryContract(materialInventoryPO.getShipperId());
businessDocumentFeign.setOriginalBusinessNum(materialInventoryPO.getInOrderNumber());
businessDocumentFeign.setWarehouseType(warehouseType);
businessDocumentFeign.setOriginalBusinessNum(materialInventoryPO.getInOrderNumber());
Map<String, Object> contract = materialInventoryDomainService.queryContract(contractManageId);
if (contract == null) {return;}
String contractName = (String) contract.get("contractName");
String contractNumber = (String) contract.get("contractNumber");
Long contractManageId = (Long) contract.get("contractManageId");
businessDocumentFeign.setContractName(contractName);
businessDocumentFeign.setContractNumber(contractNumber);
businessDocumentFeign.setContractManageId(contractManageId);
businessDocumentFeign.setBusinessFlow(OrderSequence.getOrderCode("LS"));
businessDocumentFeign.setIsPush(1);
AjaxResult ajaxResult = bmsServiceFeign.feignSaveBusinessDocument(businessDocumentFeign);
if (ajaxResult == null || !"200".equals(String.valueOf(ajaxResult.get("code")))) {
log.error("保存业务单据失败: {}", ajaxResult != null ? ajaxResult.get("msg") : "feign调用异常");
@@ -351,7 +351,7 @@ public class HandoverTaskOrderDomainService {
}
LoginUser loginUser = SecurityUtils.getLoginUser();
//修改库存
xgkc(handoverTaskOrderIds,loginUser);
List<MaterialInventoryParamDO> clearoutParamDOs = xgkc(handoverTaskOrderIds,loginUser);
//推送oms(需报关的单子等海关确认放行后再推)
for (Long handoverTaskOrderId : handoverTaskOrderIds) {
// HandoverTaskOrder hto = handoverTaskOrderService.getById(handoverTaskOrderId);
@@ -371,6 +371,7 @@ public class HandoverTaskOrderDomainService {
}
HandoverTaskOrder handoverTaskOrder = handoverTaskOrderService.getById(handoverTaskOrderIds.get(0));
stockOutOrderService.update(null,new UpdateWrapper<StockOutOrder>().lambda().set(StockOutOrder::getBillingJson,handoverTaskOrderDO.getBillingJson()).eq(StockOutOrder::getOutOrderNumber,handoverTaskOrder.getOrderNumber()));
this.lastClearoutParamDOs = clearoutParamDOs;
return handoverTaskOrderService.update(null, new UpdateWrapper<HandoverTaskOrder>().lambda()
.set(HandoverTaskOrder::getStatus, 2)
.set(HandoverTaskOrder::getUpdateBy, loginUser.getUserid())
@@ -398,11 +399,18 @@ public class HandoverTaskOrderDomainService {
@Autowired
private ICopyCodeReferenceService copyCodeReferenceService;
public synchronized void xgkc(List<Long> handoverTaskOrderIds,LoginUser loginUser) {
private List<MaterialInventoryParamDO> lastClearoutParamDOs = new ArrayList<>();
public List<MaterialInventoryParamDO> getLastClearoutParamDOs() {
return lastClearoutParamDOs;
}
public synchronized List<MaterialInventoryParamDO> xgkc(List<Long> handoverTaskOrderIds,LoginUser loginUser) {
List<MaterialInventoryParamDO> allClearoutParamDOs = new ArrayList<>();
for (Long handoverTaskOrderId : handoverTaskOrderIds) {
HandoverTaskOrder handoverTaskOrder = handoverTaskOrderService.getById(handoverTaskOrderId);
if (handoverTaskOrder == null) {
return;
continue;
}
//交接完成节点修改库存
String orderNumber = handoverTaskOrder.getOrderNumber();
@@ -422,15 +430,17 @@ public class HandoverTaskOrderDomainService {
//完成交接状态改为已出库
stockOutOrder.setStatus(9);
stockOutOrderMapper.updateById(stockOutOrder);
doStockOutDeduct(orderNumber, stockOutOrder, loginUser);
allClearoutParamDOs.addAll(doStockOutDeduct(orderNumber, stockOutOrder, loginUser));
}
return allClearoutParamDOs;
}
/**
* 出库扣减:同步OMS明细 + 联单状态 + 扣实物库存 + 推OMS库存
* (从 xgkc 抽取,供「不需报关交接」和「海关确认」两处复用)
*/
private void doStockOutDeduct(String orderNumber, StockOutOrder stockOutOrder, LoginUser loginUser) {
private List<MaterialInventoryParamDO> doStockOutDeduct(String orderNumber, StockOutOrder stockOutOrder, LoginUser loginUser) {
List<MaterialInventoryParamDO> clearoutParamDOs = new ArrayList<>();
List<OutMaterialDetail> outMaterialDetailList = outMaterialDetailMapper.selectList(new QueryWrapper<OutMaterialDetail>().lambda()
.eq(OutMaterialDetail::getOutOrderNumber, orderNumber)
.eq(OutMaterialDetail::getDelFlag, 1));
@@ -489,16 +499,17 @@ public class HandoverTaskOrderDomainService {
materialInventoryOmsParamDO.setLoginUser(loginUser);
if (stockOutOrder != null && !"yang_pin_chu_ku".equals(stockOutOrder.getBusinessType())) {
materialInventoryService.kctzjl(materialInventoryParamDO,"出库",loginUser);
materialInventoryService.xgkc(materialInventoryParamDO);
clearoutParamDOs.addAll(materialInventoryService.xgkc(materialInventoryParamDO));
//库存推送oms
omsServiceFeign.omsEdit(materialInventoryOmsParamDO);
}
}
}
return clearoutParamDOs;
}
// /**
// * 定时任务入口:每小时整点扫描「已交接(13)」状态的需报关出库单,调 sendDec 查报关结果,
// * 定时任务入口
// * 放行/结关的 → 状态 13→9 + 扣库存 + 推OMS;未放行 → 跳过下次再查。
// * 由 @Scheduled 触发,无需在 sys_job 表配置。
// */
@@ -243,4 +243,20 @@ public class MaterialBaseInfo extends BaseVOEntity {
@ApiModelProperty(name = "是否正常物料: 0-是 1-否")
private Integer isNormalMaterial;
@ApiModelProperty("每月仓租")
@Excel(name = "每月仓租")
private BigDecimal monthlyWarehouseRent;
@ApiModelProperty("半月仓租")
@Excel(name = "半月仓租")
private BigDecimal halfMonthWarehouseRent;
@ApiModelProperty("每月仓租单位")
@Excel(name = "每月仓租单位")
private String monthlyWarehouseRentUnit;
@ApiModelProperty("半月仓租单位")
@Excel(name = "半月仓租单位")
private String halfMonthWarehouseRentUnit;
}
@@ -292,4 +292,20 @@ public class MaterialBaseInfoPO extends BaseVOEntity {
@ApiModelProperty(name = "是否正常物料: 0-是 1-否")
private Integer isNormalMaterial;
@ApiModelProperty("每月仓租")
@Excel(name = "每月仓租")
private BigDecimal monthlyWarehouseRent;
@ApiModelProperty("半月仓租")
@Excel(name = "半月仓租")
private BigDecimal halfMonthWarehouseRent;
@ApiModelProperty("每月仓租单位")
@Excel(name = "每月仓租单位")
private String monthlyWarehouseRentUnit;
@ApiModelProperty("半月仓租单位")
@Excel(name = "半月仓租单位")
private String halfMonthWarehouseRentUnit;
}
@@ -265,4 +265,20 @@ public class MaterialBaseInfoDO extends BaseVOEntity {
@ApiModelProperty(name = "是否正常物料: 0-是 1-否")
private Integer isNormalMaterial;
@ApiModelProperty("每月仓租")
@Excel(name = "每月仓租")
private BigDecimal monthlyWarehouseRent;
@ApiModelProperty("半月仓租")
@Excel(name = "半月仓租")
private BigDecimal halfMonthWarehouseRent;
@ApiModelProperty("每月仓租单位")
@Excel(name = "每月仓租单位")
private String monthlyWarehouseRentUnit;
@ApiModelProperty("半月仓租单位")
@Excel(name = "半月仓租单位")
private String halfMonthWarehouseRentUnit;
}
@@ -236,4 +236,10 @@ public class MaterialInventory extends BaseVOEntity {
@Excel(name = "LOT编号")
private String lotNumber;
@ApiModelProperty("上次计费时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "上次计费时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date lastBillingTime;
}
@@ -15,6 +15,7 @@ import com.mhd.wms.domain.statementStatistics.todo.ImmediateInventoryDO;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* 物料库存Service接口
@@ -118,7 +119,7 @@ public interface IMaterialInventoryService extends IService<MaterialInventory>
* type 类型(1:上架2:分配3:取消分配4:出库交接5:移位6:库存调整7:库存冻结)
* materialInventoryId 物料库存ID
* */
public void xgkc(MaterialInventoryParamDO materialInventoryParamDO);
public List<MaterialInventoryParamDO> xgkc(MaterialInventoryParamDO materialInventoryParamDO);
public void kctzjl(MaterialInventoryParamDO materialInventoryParamDO,String adjustAction,LoginUser loginUser);
@@ -130,5 +131,9 @@ public interface IMaterialInventoryService extends IService<MaterialInventory>
public Map<String,Object> querySetlleByShipperId(Long ShipperId);
public Map<String,Object> queryContract(Long shipperId);
public Map<String,Object> queryContract(Long contractManageId);
public Map<String,Object> queryShipperParameters(Long shipperId,String parametersName);
Map<String, Object> queryMaterialClassify(Long id);
}
@@ -135,5 +135,9 @@ public interface MaterialInventoryMapper extends BaseMapper<MaterialInventory>
public Map<String,Object> querySetlleByShipperId(@Param("shipperId") Long shipperId);
public Map<String,Object> queryContract(@Param("shipperId") Long shipperId);
public Map<String,Object> queryContract(@Param("contractManageId") Long contractManageId);
public Map<String,Object> queryShipperParameters(@Param("shipperId") Long shipperId,@Param("parametersName") String parametersName);
public Map<String, Object> queryMaterialClassify(@Param("id") Long id);
}
@@ -544,7 +544,7 @@ public class MaterialInventoryImpl extends ServiceImpl<MaterialInventoryMapper,
}
@Override
public void xgkc(MaterialInventoryParamDO materialInventoryParamDO) {
public List<MaterialInventoryParamDO> xgkc(MaterialInventoryParamDO materialInventoryParamDO) {
BigDecimal netWeight = materialInventoryParamDO.getNetWeight() != null ? materialInventoryParamDO.getNetWeight() : BigDecimal.ZERO;
BigDecimal grossWeight = materialInventoryParamDO.getGrossWeight() != null ? materialInventoryParamDO.getGrossWeight() : BigDecimal.ZERO;
BigDecimal volume = materialInventoryParamDO.getVolume() != null ? materialInventoryParamDO.getVolume() : BigDecimal.ZERO;
@@ -552,6 +552,7 @@ public class MaterialInventoryImpl extends ServiceImpl<MaterialInventoryMapper,
BigDecimal quantity = materialInventoryParamDO.getQuantity() != null ? materialInventoryParamDO.getQuantity() : BigDecimal.ZERO;
String type = materialInventoryParamDO.getType();
Long materialInventoryId = materialInventoryParamDO.getMaterialInventoryId();
List<MaterialInventoryParamDO> clearoutList = new ArrayList<>();
//类型(1:上架2:分配3:取消分配4:出库交接5:移位6:库存调整7:库存冻结)
switch (type) {
@@ -569,7 +570,10 @@ public class MaterialInventoryImpl extends ServiceImpl<MaterialInventoryMapper,
break;
case "4":
// 出库交接
ckjj(netWeight, grossWeight, volume, area, quantity, materialInventoryId);
MaterialInventoryPO po = ckjj(netWeight, grossWeight, volume, area, quantity, materialInventoryId);
if (po != null) {
clearoutList.add(materialInventoryParamDO);
}
break;
case "5":
// 移位
@@ -586,6 +590,7 @@ public class MaterialInventoryImpl extends ServiceImpl<MaterialInventoryMapper,
default:
throw new ServiceException("错误的类型");
}
return clearoutList;
}
@Override
@@ -1040,7 +1045,7 @@ public class MaterialInventoryImpl extends ServiceImpl<MaterialInventoryMapper,
materialInventoryMapper.updateById(materialInventory);
}
}
private void ckjj(BigDecimal netWeight, BigDecimal grossWeight, BigDecimal volume, BigDecimal area, BigDecimal quantity, Long materialInventoryId) {
private MaterialInventoryPO ckjj(BigDecimal netWeight, BigDecimal grossWeight, BigDecimal volume, BigDecimal area, BigDecimal quantity, Long materialInventoryId) {
MaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId);
if (materialInventoryPO != null) {
//库存数量
@@ -1087,7 +1092,22 @@ public class MaterialInventoryImpl extends ServiceImpl<MaterialInventoryMapper,
MaterialInventory materialInventory = new MaterialInventory();
com.mhd.common.core.utils.bean.BeanUtils.copyProperties(materialInventoryPO, materialInventory);
materialInventoryMapper.updateById(materialInventory);
Long warehouseId = materialInventoryPO.getWarehouseId();
boolean needPush = false;
if (warehouseId != null && warehouseId == 20) {
needPush = true;
} else if (warehouseId != null && warehouseId == 19 && newInventoryQuantity.compareTo(BigDecimal.ZERO) == 0) {
needPush = true;
}
if (needPush) {
MaterialInventoryPO resultPO = new MaterialInventoryPO();
com.mhd.common.core.utils.bean.BeanUtils.copyProperties(materialInventoryPO, resultPO);
resultPO.setMaterialInventoryId(materialInventoryId);
return resultPO;
}
}
return null;
}
private void yw(BigDecimal netWeight, BigDecimal grossWeight, BigDecimal volume, BigDecimal area, BigDecimal quantity, Long materialInventoryId) {
MaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId);
@@ -1253,7 +1273,16 @@ public class MaterialInventoryImpl extends ServiceImpl<MaterialInventoryMapper,
return materialInventoryMapper.querySetlleByShipperId(shipperId);
}
public Map<String,Object> queryContract(Long shipperId) {
return materialInventoryMapper.queryContract(shipperId);
public Map<String,Object> queryContract(Long contractManageId) {
return materialInventoryMapper.queryContract(contractManageId);
}
public Map<String,Object> queryShipperParameters(Long shipperId,String parametersName) {
return materialInventoryMapper.queryShipperParameters(shipperId,parametersName);
}
@Override
public Map<String, Object> queryMaterialClassify(Long id) {
return materialInventoryMapper.queryMaterialClassify(id);
}
}
@@ -233,4 +233,10 @@ public class MaterialInventoryPO extends MaterialBasePO {
@ApiModelProperty("规格型号")
@Excel(name = "规格型号")
private String specificationModel;
@ApiModelProperty("上次计费时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "上次计费时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date lastBillingTime;
}
@@ -288,4 +288,10 @@ public class MaterialInventoryQueryListPO extends MaterialBasePO {
@ApiModelProperty("总面积(SQM)PDA 表单区显示")
private BigDecimal totalArea;
@ApiModelProperty("上次计费时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "上次计费时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date lastBillingTime;
}
@@ -271,4 +271,13 @@ public class MaterialInventoryDO extends MaterialBaseDO {
@ApiModelProperty("库存分配匹配:Batch Ref NO's token 列表(默认不启用,仅显式赋值时参与匹配)")
private List<String> batchRefNoList;
@ApiModelProperty("上次计费时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "上次计费时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date lastBillingTime;
private String lastBillingTimeStart;
private String lastBillingTimeEnd;
}
@@ -268,4 +268,13 @@ public class MaterialInventoryQueryListDO extends MaterialBaseDO {
private String updateTimeStart;
private String updateTimeEnd;
@ApiModelProperty("上次计费时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "上次计费时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date lastBillingTime;
private String lastBillingTimeStart;
private String lastBillingTimeEnd;
}
@@ -138,7 +138,15 @@ public class MaterialInventoryDomainService {
return materialInventoryService.querySetlleByShipperId(shipperId);
}
public Map<String,Object> queryContract(Long shipperId) {
return materialInventoryService.queryContract(shipperId);
public Map<String,Object> queryContract(Long contractManageId) {
return materialInventoryService.queryContract(contractManageId);
}
public Map<String,Object> queryShipperParameters(Long shipperId,String parametersName) {
return materialInventoryService.queryShipperParameters(shipperId,parametersName);
}
public Map<String,Object> queryMaterialClassify(Long id) {
return materialInventoryService.queryMaterialClassify(id);
}
}
@@ -316,4 +316,20 @@ public class MaterialBaseInfoDTO extends BaseVOEntity {
private String orgId;
@ApiModelProperty(name = "是否正常物料: 0-是 1-否")
private Integer isNormalMaterial;
@ApiModelProperty("每月仓租")
@Excel(name = "每月仓租")
private BigDecimal monthlyWarehouseRent;
@ApiModelProperty("半月仓租")
@Excel(name = "半月仓租")
private BigDecimal halfMonthWarehouseRent;
@ApiModelProperty("每月仓租单位")
@Excel(name = "每月仓租单位")
private String monthlyWarehouseRentUnit;
@ApiModelProperty("半月仓租单位")
@Excel(name = "半月仓租单位")
private String halfMonthWarehouseRentUnit;
}
@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
@@ -203,4 +204,10 @@ public class MaterialInventoryDTO extends MaterialBaseDTO {
private String updateTimeStart;
private String updateTimeEnd;
@ApiModelProperty("上次计费时间")
private Date lastBillingTime;
private String lastBillingTimeStart;
private String lastBillingTimeEnd;
}
@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
@@ -201,4 +202,10 @@ public class MaterialInventoryQueryListDTO extends MaterialBaseDTO {
private String updateTimeStart;
private String updateTimeEnd;
@ApiModelProperty("上次计费时间")
private Date lastBillingTime;
private String lastBillingTimeStart;
private String lastBillingTimeEnd;
}