diff --git a/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderApplicationService.java b/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderApplicationService.java index ee558badf..911e1cb00 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderApplicationService.java +++ b/mhd_oms/src/main/java/com/mhd/oms/application/service/businessDocumentOrder/BusinessDocumentOrderApplicationService.java @@ -14,6 +14,8 @@ import com.mhd.oms.domain.businessDocumentOrder.repository.mapper.BusinessDocume import com.mhd.oms.domain.businessDocumentOrder.repository.po.BusinessDocumentOrderPO; import com.mhd.oms.domain.businessDocumentOrder.repository.todo.BusinessDocumentOrderDO; import com.mhd.oms.domain.businessDocumentOrder.service.BusinessDocumentOrderDomainService; +import com.mhd.oms.domain.reservationStockInOrder.repository.mapper.ReservationStockInOrderMapper; +import com.mhd.oms.domain.reservationStockInOrder.repository.po.MaterialBaseInfoPO; import com.mhd.common.security.utils.SecurityUtils; import com.mhd.oms.domain.businessOrderAccount.BusinessOrderAccount; import com.mhd.oms.domain.businessOrderAccount.repository.mapper.BusinessOrderAccountMapper; @@ -73,6 +75,8 @@ public class BusinessDocumentOrderApplicationService { private GwLogMapper gwLogMapper; @Resource private BusinessDocumentCargoMultiMapper businessDocumentCargoMultiMapper; + @Resource + private ReservationStockInOrderMapper reservationStockInOrderMapper; @Autowired private BusinessDeliveryDetailsLinkMapper businessDeliveryDetailsLinkMapper; @Resource @@ -196,15 +200,29 @@ public class BusinessDocumentOrderApplicationService { List cargoList = businessDocumentCargoMultiMapper.selectList( new LambdaQueryWrapper() .eq(BusinessDocumentCargoMulti::getOrderId, id) + .eq(BusinessDocumentCargoMulti::getDelFlag, 1) ); - // 3. 构建推送数据 + // 3. 查询委托方NC编码 + String corpCode = null; + if (order.getAppointShipperId() != null) { + try { + corpCode = businessDocumentOrderMapper.getShipperNcCode( + Long.valueOf(order.getAppointShipperId())); + } catch (NumberFormatException e) { + log.warn("appointShipperId格式异常: {}", order.getAppointShipperId()); + } + } + + // 4. 构建推送数据 Map body = new HashMap<>(); body.put("erpBillNo", String.valueOf(order.getId())); body.put("billDate", order.getDocumentDate()); - body.put("goodsType", order.getGoodsType()); + // 商品类型取第一个cargo的productType(0料件,1半成品,2成品) + Integer goodsType = (cargoList != null && !cargoList.isEmpty()) ? cargoList.get(0).getProductType() : null; + body.put("goodsType", goodsType); body.put("ieFlag", order.getIeType() != null ? order.getIeType() : null); - body.put("corpCode", order.getAppointShipperId() != null ? order.getAppointShipperId() : null); + body.put("corpCode", corpCode); List> billList = new ArrayList<>(); if (cargoList != null && !cargoList.isEmpty()) { @@ -215,6 +233,19 @@ public class BusinessDocumentOrderApplicationService { billMap.put("goodsCode", cargo.getMaterialCode() != null ? cargo.getMaterialCode() : null); billMap.put("packNo", cargo.getCargoNum()); billMap.put("erpQty", cargo.getCargoNum()); + + // 查询物料基础信息,计算净重和毛重 + if (cargo.getMaterialBaseInfoId() != null) { + MaterialBaseInfoPO material = reservationStockInOrderMapper.getinfo(cargo.getMaterialBaseInfoId()); + if (material != null && cargo.getCargoNum() != null) { + if (material.getWeightLimit() != null) { + billMap.put("netWt", material.getWeightLimit().multiply(cargo.getCargoNum())); + } + if (material.getGrossWeight() != null) { + billMap.put("grossWt", material.getGrossWeight().multiply(cargo.getCargoNum())); + } + } + } billList.add(billMap); } } @@ -222,10 +253,10 @@ public class BusinessDocumentOrderApplicationService { List> bodyList = new ArrayList<>(); bodyList.add(body); - // 4. 更新推送状态为推送中 + // 5. 更新推送状态为推送中 updatePushStatus(order.getId(), 2, null, String.valueOf(pushBy), pushByName); - // 5. 记录日志 + // 6. 记录日志 GwLog gwLog = new GwLog(); gwLog.setType("进出口原始单证"); gwLog.setBusinessId(order.getId()); @@ -241,7 +272,7 @@ public class BusinessDocumentOrderApplicationService { gwLog.setDelFlag(1); gwLogMapper.insert(gwLog); - // 6. 调用推送接口 + // 7. 调用推送接口 try { CloseableHttpClient httpClient = HttpClients.createDefault(); HttpPost httpPost = new HttpPost(PUSH_API_URL); diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrder/repository/mapper/BusinessDocumentOrderMapper.java b/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrder/repository/mapper/BusinessDocumentOrderMapper.java index 2f73bbaba..b8b338533 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrder/repository/mapper/BusinessDocumentOrderMapper.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/businessDocumentOrder/repository/mapper/BusinessDocumentOrderMapper.java @@ -28,6 +28,8 @@ public interface BusinessDocumentOrderMapper extends BaseMapper queryListAndMaterial(BusinessDocumentOrderDO businessDocumentOrderDO); + String getShipperNcCode(@Param("id") Long id); + UserPo getAddressByUserAccount(@Param("customerNumber") String customerNumber); String getTmsOrderInfo(@Param("goodsNumber") String goodsNumber); diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/po/MaterialBaseInfoPO.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/po/MaterialBaseInfoPO.java index 7d3b8965b..b7f40a5e2 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/po/MaterialBaseInfoPO.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/po/MaterialBaseInfoPO.java @@ -127,6 +127,10 @@ public class MaterialBaseInfoPO extends BaseVOEntity { @Excel(name = "净重 单位:千克") private BigDecimal weightLimit; + @ApiModelProperty("毛重 单位:千克") + @Excel(name = "毛重 单位:千克") + private BigDecimal grossWeight; + @ApiModelProperty("体积 单位:立方米") @Excel(name = "体积 单位:立方米") private BigDecimal volumeLimit; diff --git a/mhd_oms/src/main/resources/mapper/businessDocumentOrder/BusinessDocumentOrderMapper.xml b/mhd_oms/src/main/resources/mapper/businessDocumentOrder/BusinessDocumentOrderMapper.xml index 9fe12e12d..cb489081d 100644 --- a/mhd_oms/src/main/resources/mapper/businessDocumentOrder/BusinessDocumentOrderMapper.xml +++ b/mhd_oms/src/main/resources/mapper/businessDocumentOrder/BusinessDocumentOrderMapper.xml @@ -712,6 +712,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + +