Browse Source

1.结算bug修复

2.干线开单逻辑优化
dist.1.2.0^2
zhenghaoyu 6 months ago
parent
commit
b01718a8b0
  1. 4
      blade-service-api/logpm-basic-api/src/main/java/com/logpm/basic/feign/IBasicMaterialClient.java
  2. 3
      blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/dto/MerchantStatisticsDTO.java
  3. 15
      blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/AdvancenceTotalNumberVO.java
  4. 3
      blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/OpenOrderVO.java
  5. 5
      blade-service/logpm-basic/src/main/java/com/logpm/basic/feign/BasicMaterialClient.java
  6. 17
      blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsBalanceOrderInfoMapper.xml
  7. 6
      blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsOrderInfoMapper.xml
  8. 2
      blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsReconciliationOrderInfoMapper.java
  9. 2
      blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsReconciliationOrderInfoMapper.xml
  10. 13
      blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsOrderInfoServiceImpl.java
  11. 5
      blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsReconciliationOrderInfoServiceImpl.java
  12. 2
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.java
  13. 20
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml
  14. 2
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineAdvanceDetailService.java
  15. 121
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java
  16. 5
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceDetailServiceImpl.java

4
blade-service-api/logpm-basic-api/src/main/java/com/logpm/basic/feign/IBasicMaterialClient.java

@ -89,4 +89,8 @@ public interface IBasicMaterialClient {
@GetMapping(API_PREFIX+"/findEntityByPid") @GetMapping(API_PREFIX+"/findEntityByPid")
List<BasicMaterialEntity> findEntityByPid(@RequestParam Long pid); List<BasicMaterialEntity> findEntityByPid(@RequestParam Long pid);
@GetMapping(API_PREFIX+"/findAllList")
List<BasicMaterialEntity> findAllList();
} }

3
blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/dto/MerchantStatisticsDTO.java

@ -36,7 +36,10 @@ public class MerchantStatisticsDTO implements Serializable {
private Integer syncFeeSstatus; private Integer syncFeeSstatus;
private Integer signStatus; private Integer signStatus;
private Integer isAftersales; private Integer isAftersales;
private Integer balanceStatus;
private Integer abnormalBalanceStatus;
private String balanceOrderNo;
private String waybillNo; private String waybillNo;
private String orderCode; private String orderCode;
private String departureWarehouseName; private String departureWarehouseName;

15
blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/AdvancenceTotalNumberVO.java

@ -0,0 +1,15 @@
package com.logpm.trunkline.vo;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
public class AdvancenceTotalNumberVO implements Serializable {
private Integer totalNum;
private BigDecimal totalWeight;
private BigDecimal totalVolume;
}

3
blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/OpenOrderVO.java

@ -4,6 +4,7 @@ import lombok.Data;
import org.springblade.system.entity.DictBiz; import org.springblade.system.entity.DictBiz;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -60,5 +61,7 @@ public class OpenOrderVO implements Serializable {
private String openOrderDate;//开单时间 private String openOrderDate;//开单时间
private String openOrderUserName;//开单人 private String openOrderUserName;//开单人
private Integer totalNum; private Integer totalNum;
private BigDecimal totalWeight;
private BigDecimal totalVolume;
} }

5
blade-service/logpm-basic/src/main/java/com/logpm/basic/feign/BasicMaterialClient.java

@ -130,4 +130,9 @@ public class BasicMaterialClient implements IBasicMaterialClient {
return basicMaterialService.list(Wrappers.<BasicMaterialEntity>query().lambda().eq(BasicMaterialEntity::getPid,pid)); return basicMaterialService.list(Wrappers.<BasicMaterialEntity>query().lambda().eq(BasicMaterialEntity::getPid,pid));
} }
@Override
public List<BasicMaterialEntity> findAllList() {
return basicMaterialService.list();
}
} }

17
blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsBalanceOrderInfoMapper.xml

@ -6,6 +6,23 @@
select * select *
from logpm_statistics_balance_order_info from logpm_statistics_balance_order_info
where 1=1 where 1=1
<if test="param.waybillNo != null and param.waybillNo != ''">
and LOCATE(#{param.waybillNo},waybill_no) > 0
</if>
<if test="param.orderCode != null and param.orderCode != ''">
and LOCATE(#{param.orderCode},order_code) > 0
</if>
<if test="param.balanceOrderNo != null and param.balanceOrderNo != ''">
and LOCATE(#{param.balanceOrderNo},balance_order_no) > 0
</if>
<if test="param.balanceStatus != null ">
and balance_status = #{param.balanceStatus}
</if>
<if test="param.abnormalBalanceStatus != null ">
and abnormal_balance_status = #{param.abnormalBalanceStatus}
</if>
</select> </select>
</mapper> </mapper>

6
blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsOrderInfoMapper.xml

@ -248,7 +248,7 @@
lsoi.brand brand, lsoi.brand brand,
lsoi.waybill_id waybillId, lsoi.waybill_id waybillId,
lsoi.waybill_no waybillNo, lsoi.waybill_no waybillNo,
lsoi.order_code orderNo, lsoi.order_code orderCode,
lsoi.type_service typeService, lsoi.type_service typeService,
lww.shipper shipper, lww.shipper shipper,
lww.shipper_name shipperPerson, lww.shipper_name shipperPerson,
@ -281,7 +281,7 @@
left join logpm_warehouse_waybill lww on lww.id = lsoi.waybill_id left join logpm_warehouse_waybill lww on lww.id = lsoi.waybill_id
where 1=1 where 1=1
<if test="reconciliationOrderId != null"> <if test="reconciliationOrderId != null">
and lsoi.mall_statistics_order_id = #{reconciliationOrderId} and lsoi.reconciliation_order_id = #{reconciliationOrderId}
</if> </if>
group by lsoi.id group by lsoi.id
</select> </select>
@ -475,7 +475,7 @@
select id select id
from logpm_statistics_order_info lsoi from logpm_statistics_order_info lsoi
where 1=1 where 1=1
and lsoi.mall_statistics_order_id in and lsoi.reconciliation_order_id in
<foreach collection="reconciliationOrderIds" item="item" open="(" separator="," close=")"> <foreach collection="reconciliationOrderIds" item="item" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>

2
blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsReconciliationOrderInfoMapper.java

@ -19,5 +19,5 @@ public interface StatisticsReconciliationOrderInfoMapper extends BaseMapper<Stat
void addAftersalesFeeById(@Param("reconciliationOrderId") Long reconciliationOrderId, @Param("aftersalesFee") BigDecimal aftersalesFee); void addAftersalesFeeById(@Param("reconciliationOrderId") Long reconciliationOrderId, @Param("aftersalesFee") BigDecimal aftersalesFee);
List<StatisticsReconciliationInfoExportVO> reconciliationListExport(IPage<Object> page, @Param("param") MerchantStatisticsDTO merchantStatisticsDTO); List<StatisticsReconciliationInfoExportVO> reconciliationListExport(@Param("param") MerchantStatisticsDTO merchantStatisticsDTO);
} }

2
blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsReconciliationOrderInfoMapper.xml

@ -7,6 +7,7 @@
select * select *
from logpm_statistics_reconciliation_order_info from logpm_statistics_reconciliation_order_info
where 1=1 where 1=1
and is_deleted = 0
<if test="param.orderCode != null and param.orderCode != ''"> <if test="param.orderCode != null and param.orderCode != ''">
and LOCATE(#{param.orderCode},order_code) > 0 and LOCATE(#{param.orderCode},order_code) > 0
</if> </if>
@ -82,6 +83,7 @@
changes_remark changesRemark changes_remark changesRemark
from logpm_statistics_reconciliation_order_info from logpm_statistics_reconciliation_order_info
where 1=1 where 1=1
and is_deleted = 0
<if test="param.orderCode != null and param.orderCode != ''"> <if test="param.orderCode != null and param.orderCode != ''">
and LOCATE(#{param.orderCode},order_code) > 0 and LOCATE(#{param.orderCode},order_code) > 0
</if> </if>

13
blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsOrderInfoServiceImpl.java

@ -331,6 +331,7 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
//把records中所有的orderInfoId放入一个集合 //把records中所有的orderInfoId放入一个集合
List<Long> orderInfoIdList = records.stream().map(StatisticsOrderInfoVO::getOrderInfoId).collect(Collectors.toList()); List<Long> orderInfoIdList = records.stream().map(StatisticsOrderInfoVO::getOrderInfoId).collect(Collectors.toList());
if(CollUtil.isNotEmpty(orderInfoIdList)){
List<StatisticsPackageFeeInfoVO> orderPackageInfoList = baseMapper.findPackageListByOrderIdsGroupById(orderInfoIdList); List<StatisticsPackageFeeInfoVO> orderPackageInfoList = baseMapper.findPackageListByOrderIdsGroupById(orderInfoIdList);
//把orderPackageInfoList转化成以orderInfoId为key的Map //把orderPackageInfoList转化成以orderInfoId为key的Map
Map<Long, StatisticsPackageFeeInfoVO> orderPackageInfoMap = orderPackageInfoList.stream() Map<Long, StatisticsPackageFeeInfoVO> orderPackageInfoMap = orderPackageInfoList.stream()
@ -341,6 +342,8 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
StatisticsPackageFeeInfoVO statisticsPackageFeeInfoVO = orderPackageInfoMap.get(orderInfoId); StatisticsPackageFeeInfoVO statisticsPackageFeeInfoVO = orderPackageInfoMap.get(orderInfoId);
BeanUtil.copy(statisticsPackageFeeInfoVO, statisticsOrderInfoVO); BeanUtil.copy(statisticsPackageFeeInfoVO, statisticsOrderInfoVO);
}); });
}
return records; return records;
} }
@ -511,6 +514,8 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
reconciliationOrder.setIsChanges(0); reconciliationOrder.setIsChanges(0);
reconciliationOrder.setChangesFee(BigDecimal.ZERO); reconciliationOrder.setChangesFee(BigDecimal.ZERO);
reconciliationOrder.setCheckStatus(0);
boolean saveFlag = reconciliationOrderInfoService.save(reconciliationOrder); boolean saveFlag = reconciliationOrderInfoService.save(reconciliationOrder);
if(saveFlag){ if(saveFlag){
Long reconciliationOrderId = reconciliationOrder.getId(); Long reconciliationOrderId = reconciliationOrder.getId();
@ -656,7 +661,7 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
List<Long> orderInfoIds = baseMapper.findOrderInfoIdListByReconciliationOrderIds(reconciliationOrderIdList); List<Long> orderInfoIds = baseMapper.findOrderInfoIdListByReconciliationOrderIds(reconciliationOrderIdList);
if(CollUtil.isNotEmpty(orderInfoIds)){
List<StatisticsOrderInfoEntity> orderInfoEntities = baseMapper.selectBatchIds(orderInfoIds); List<StatisticsOrderInfoEntity> orderInfoEntities = baseMapper.selectBatchIds(orderInfoIds);
if(CollUtil.isEmpty(orderInfoEntities)){ if(CollUtil.isEmpty(orderInfoEntities)){
log.warn("############calculateReconcilitionOrder: 未找到对应订单信息"); log.warn("############calculateReconcilitionOrder: 未找到对应订单信息");
@ -735,6 +740,12 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
reconciliationOrderInfo.setChangesFee(changesFee); reconciliationOrderInfo.setChangesFee(changesFee);
reconciliationOrderInfoService.updateById(reconciliationOrderInfo); reconciliationOrderInfoService.updateById(reconciliationOrderInfo);
}else{
reconciliationOrderInfoService.removeById(reconciliationOrderId);
}
} }

5
blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsReconciliationOrderInfoServiceImpl.java

@ -41,13 +41,10 @@ public class StatisticsReconciliationOrderInfoServiceImpl extends BaseServiceImp
@Override @Override
public List<StatisticsReconciliationInfoExportVO> reconciliationListExport(MerchantStatisticsDTO merchantStatisticsDTO) { public List<StatisticsReconciliationInfoExportVO> reconciliationListExport(MerchantStatisticsDTO merchantStatisticsDTO) {
IPage<Object> page = new Page<>();
page.setCurrent(merchantStatisticsDTO.getPageNum());
page.setSize(merchantStatisticsDTO.getPageSize());
merchantStatisticsDTO.setOpenTimeStart(CommonUtil.getStartByDateStr(merchantStatisticsDTO.getOpenTimeStartStr())); merchantStatisticsDTO.setOpenTimeStart(CommonUtil.getStartByDateStr(merchantStatisticsDTO.getOpenTimeStartStr()));
merchantStatisticsDTO.setOpenTimeEnd(CommonUtil.getEndByDateStr(merchantStatisticsDTO.getOpenTimeEndStr())); merchantStatisticsDTO.setOpenTimeEnd(CommonUtil.getEndByDateStr(merchantStatisticsDTO.getOpenTimeEndStr()));
return baseMapper.reconciliationListExport(page, merchantStatisticsDTO); return baseMapper.reconciliationListExport(merchantStatisticsDTO);
} }
} }

2
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.java

@ -81,4 +81,6 @@ public interface TrunklineAdvanceDetailMapper extends BaseMapper<TrunklineAdvanc
List<OrderCodeNumVO> findTotalNumByOrderCodes(@Param("orderCodeSet") Set<String> orderCodeSet); List<OrderCodeNumVO> findTotalNumByOrderCodes(@Param("orderCodeSet") Set<String> orderCodeSet);
void clearWaybillInfoByWaybillId(@Param("waybillId") Long waybillId); void clearWaybillInfoByWaybillId(@Param("waybillId") Long waybillId);
AdvancenceTotalNumberVO findTotalNumberByAdvanceIds(@Param("advanceIds") List<Long> advanceIds);
} }

20
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineAdvanceDetailMapper.xml

@ -48,12 +48,12 @@
select lbfc.category_id goodsId, select lbfc.category_id goodsId,
IFNULL(lbfc.category,'其他') goodsName, IFNULL(lbfc.category,'其他') goodsName,
ltad.charge_type chargeType, ltad.charge_type chargeType,
sum(ltad.quantity) num, IFNULL(sum(ltad.quantity),0) num,
sum(ltad.weight) weight, IFNULL(sum(ltad.weight),0) weight,
sum(ltad.volume) volume IFNULL(sum(ltad.volume),0) volume
from logpm_trunkline_advance_detail ltad from logpm_trunkline_advance_detail ltad
left join logpm_basicdata_factory_category lbfc on lbfc.brand = ltad.brand and type=1 left join logpm_basicdata_factory_category lbfc on lbfc.brand = ltad.brand and type=1
and lbfc.firsts = ltad.first_pack_name and lbfc.seconds = ltad.second_pack_name and lbfc.thirds = ltad.third_pack_name and lbfc.materiel_name=ltad.material_name and IFNULL(lbfc.firsts,1) = IFNULL(ltad.first_pack_name,1) and IFNULL(lbfc.seconds,2) = IFNULL(ltad.second_pack_name,2) and IFNULL(lbfc.thirds,3) = IFNULL(ltad.third_pack_name,3) and IFNULL(lbfc.materiel_name,4)=IFNULL(ltad.material_name,4)
left join logpm_basicdata_category lbc on lbc.id = lbfc.category_id left join logpm_basicdata_category lbc on lbc.id = lbfc.category_id
where ltad.is_deleted = 0 where ltad.is_deleted = 0
and ltad.advance_id in and ltad.advance_id in
@ -501,4 +501,16 @@
and is_deleted = 0 and is_deleted = 0
</update> </update>
<select id="findTotalNumberByAdvanceIds" resultType="com.logpm.trunkline.vo.AdvancenceTotalNumberVO">
select IFNULL(sum(quantity),0) totalNum,
IFNULL(sum(weight),0) totalWeight,
IFNULL(sum(volume),0) totalVolume
from logpm_trunkline_advance_detail
where advance_id in
<foreach collection="advanceIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
and is_deleted = 0
</select>
</mapper> </mapper>

2
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineAdvanceDetailService.java

@ -91,4 +91,6 @@ public interface ITrunklineAdvanceDetailService extends BaseService<TrunklineAdv
List<OrderCodeNumVO> findTotalNumByOrderCodes(Set<String> orderCodeSet); List<OrderCodeNumVO> findTotalNumByOrderCodes(Set<String> orderCodeSet);
void clearWaybillInfoByWaybillId(Long waybillId); void clearWaybillInfoByWaybillId(Long waybillId);
AdvancenceTotalNumberVO findTotalNumberByAdvanceIds(List<Long> advanceIds);
} }

121
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java

@ -131,6 +131,8 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
//先查询出所有的暂存单 //先查询出所有的暂存单
List<TrunklineAdvanceEntity> list = advanceService.findListByIds(advanceIds); List<TrunklineAdvanceEntity> list = advanceService.findListByIds(advanceIds);
AdvancenceTotalNumberVO totalNumberVO = advanceDetailService.findTotalNumberByAdvanceIds(advanceIds);
if (list.isEmpty()) { if (list.isEmpty()) {
log.warn("##############advanceToWaybill: 暂存单数据不存在 advanceIds={}", advanceIds); log.warn("##############advanceToWaybill: 暂存单数据不存在 advanceIds={}", advanceIds);
return R.fail(405, "暂存单数据不存在"); return R.fail(405, "暂存单数据不存在");
@ -138,7 +140,6 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
String dealerName = null; String dealerName = null;
String dealerCode = null; String dealerCode = null;
String brand = null; String brand = null;
Integer totalNum = 0;
for (TrunklineAdvanceEntity advanceEntity : list) { for (TrunklineAdvanceEntity advanceEntity : list) {
if (StringUtil.isBlank(dealerName)) { if (StringUtil.isBlank(dealerName)) {
dealerName = advanceEntity.getDealerName(); dealerName = advanceEntity.getDealerName();
@ -147,8 +148,6 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
if (StringUtil.isBlank(brand)) { if (StringUtil.isBlank(brand)) {
brand = advanceEntity.getBrand(); brand = advanceEntity.getBrand();
} }
totalNum = totalNum + advanceEntity.getTotalNum();
} }
OpenOrderVO openOrderVO = new OpenOrderVO(); OpenOrderVO openOrderVO = new OpenOrderVO();
//查询品牌 客户车次号 订单自编码 //查询品牌 客户车次号 订单自编码
@ -169,7 +168,10 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
//发站仓-----目前登录人的仓库 //发站仓-----目前登录人的仓库
openOrderVO.setDepartureWarehouseName(basicdataWarehouseEntity.getName()); openOrderVO.setDepartureWarehouseName(basicdataWarehouseEntity.getName());
openOrderVO.setDepartureWarehouseId(warehouseId); openOrderVO.setDepartureWarehouseId(warehouseId);
openOrderVO.setTotalNum(totalNum); openOrderVO.setTotalNum(totalNumberVO.getTotalNum());
openOrderVO.setTotalWeight(totalNumberVO.getTotalWeight());
openOrderVO.setTotalVolume(totalNumberVO.getTotalVolume());
//发货单位 //发货单位
Long shipperId = basicdataForwardingUnitClient.findForwardingUnitByWarehouseId(warehouseId); Long shipperId = basicdataForwardingUnitClient.findForwardingUnitByWarehouseId(warehouseId);
if (!Objects.isNull(shipperId)) { if (!Objects.isNull(shipperId)) {
@ -1834,6 +1836,13 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
log.warn("##################importStandardOuPai: 文件不存在"); log.warn("##################importStandardOuPai: 文件不存在");
return R.fail(405, "文件不存在"); return R.fail(405, "文件不存在");
} }
List<BasicMaterialEntity> materialEntities = basicMaterialClient.findAllList();
//把materialEntities转化成以productCode和productName拼接为key的Map
Map<String, BasicMaterialEntity> materialEntityMap = materialEntities.stream().collect(Collectors.toMap(item -> item.getProductCode() + "&&" + item.getName(), item -> item));
InputStream inputStream = file.getInputStream(); InputStream inputStream = file.getInputStream();
List<ImportStandardOuPaiDTO> importStandardOuPaiDTOS = EasyExcel.read(inputStream).head(ImportStandardOuPaiDTO.class).sheet(0).headRowNumber(1).doReadSync(); List<ImportStandardOuPaiDTO> importStandardOuPaiDTOS = EasyExcel.read(inputStream).head(ImportStandardOuPaiDTO.class).sheet(0).headRowNumber(1).doReadSync();
@ -2101,48 +2110,58 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
advanceDetailModel.setQuantity(1); advanceDetailModel.setQuantity(1);
advanceDetailModel.setServiceNum(advanceEntity.getServiceNum()); advanceDetailModel.setServiceNum(advanceEntity.getServiceNum());
advanceDetailModel.setPackageStatus("0"); advanceDetailModel.setPackageStatus("0");
String materialName = importStandardOuPaiDTO.getMaterialName(); String materialName = StringUtil.isNotBlank(importStandardOuPaiDTO.getMaterialName())?importStandardOuPaiDTO.getMaterialName():"";
String materialCode = importStandardOuPaiDTO.getMaterialCode(); String materialCode = StringUtil.isNotBlank(importStandardOuPaiDTO.getMaterialCode())?importStandardOuPaiDTO.getMaterialCode():"";
if (StringUtil.isNotBlank(materialCode) && StringUtil.isNotBlank(materialName)) { BasicMaterialEntity basicMaterialEntity = materialEntityMap.get(materialCode + "&&" + materialName);
Long materialId = materialMap.get(materialCode);
if(!Objects.isNull(materialId)){ if(!Objects.isNull(basicMaterialEntity)){
advanceDetailModel.setMaterialId(materialId); advanceDetailModel.setMaterialId(basicMaterialEntity.getId());
advanceDetailModel.setMaterialCode(materialCode);
advanceDetailModel.setMaterialName(materialName);
}else{
BasicMaterialEntity basicMaterialEntity = basicMaterialClient.findEntityByCodeAndName(materialCode, materialName);
if (Objects.isNull(basicMaterialEntity)) {
basicMaterialEntity = new BasicMaterialEntity();
basicMaterialEntity.setProductCode(materialCode);
basicMaterialEntity.setName(materialName);
BasicdataBrandEntity basicdataBrandEntity = basicdataBrandClient.findEntityByName(brand);
if(Objects.isNull(basicdataBrandEntity)){
basicMaterialEntity.setBrandId("1713382405517201409");
}else{
basicMaterialEntity.setBrandId(basicdataBrandEntity.getId()+"");
}
basicMaterialEntity.setProperty("家配");
basicMaterialEntity.setSpecification("件");
basicMaterialEntity.setPackingSpecification("1件/箱");
basicMaterialEntity.setLogpmUnit("箱");
basicMaterialEntity.setSku(materialCode);
basicMaterialEntity.setPackageNum(1);
basicMaterialEntity.setHide(1);
Long aLong = basicMaterialClient.addMaterial(basicMaterialEntity);
basicMaterialEntity.setId(aLong);
materialMap.put(materialCode,aLong);
advanceDetailModel.setMaterialId(aLong);
advanceDetailModel.setMaterialCode(materialCode); advanceDetailModel.setMaterialCode(materialCode);
advanceDetailModel.setMaterialName(materialName); advanceDetailModel.setMaterialName(materialName);
}else{ advanceDetailModel.setWeight(new BigDecimal(basicMaterialEntity.getWeight()));
materialMap.put(materialCode,basicMaterialEntity.getId()); advanceDetailModel.setVolume(new BigDecimal(basicMaterialEntity.getVolume()));
advanceDetailModel.setMaterialId(basicMaterialEntity.getId());
advanceDetailModel.setMaterialCode(basicMaterialEntity.getProductCode());
advanceDetailModel.setMaterialName(basicMaterialEntity.getName());
}
}
} }
// if (StringUtil.isNotBlank(materialCode) && StringUtil.isNotBlank(materialName)) {
// Long materialId = materialMap.get(materialCode);
// if(!Objects.isNull(materialId)){
// advanceDetailModel.setMaterialId(materialId);
// advanceDetailModel.setMaterialCode(materialCode);
// advanceDetailModel.setMaterialName(materialName);
// }else{
// BasicMaterialEntity basicMaterialEntity = basicMaterialClient.findEntityByCodeAndName(materialCode, materialName);
// if (Objects.isNull(basicMaterialEntity)) {
// basicMaterialEntity = new BasicMaterialEntity();
// basicMaterialEntity.setProductCode(materialCode);
// basicMaterialEntity.setName(materialName);
// BasicdataBrandEntity basicdataBrandEntity = basicdataBrandClient.findEntityByName(brand);
// if(Objects.isNull(basicdataBrandEntity)){
// basicMaterialEntity.setBrandId("1713382405517201409");
// }else{
// basicMaterialEntity.setBrandId(basicdataBrandEntity.getId()+"");
// }
// basicMaterialEntity.setProperty("家配");
// basicMaterialEntity.setSpecification("件");
// basicMaterialEntity.setPackingSpecification("1件/箱");
// basicMaterialEntity.setLogpmUnit("箱");
// basicMaterialEntity.setSku(materialCode);
// basicMaterialEntity.setPackageNum(1);
// basicMaterialEntity.setHide(1);
// Long aLong = basicMaterialClient.addMaterial(basicMaterialEntity);
// basicMaterialEntity.setId(aLong);
// materialMap.put(materialCode,aLong);
// advanceDetailModel.setMaterialId(aLong);
// advanceDetailModel.setMaterialCode(materialCode);
// advanceDetailModel.setMaterialName(materialName);
// }else{
// materialMap.put(materialCode,basicMaterialEntity.getId());
// advanceDetailModel.setMaterialId(basicMaterialEntity.getId());
// advanceDetailModel.setMaterialCode(basicMaterialEntity.getProductCode());
// advanceDetailModel.setMaterialName(basicMaterialEntity.getName());
// }
// }
// }
advanceDetailEntities.add(advanceDetailModel); advanceDetailEntities.add(advanceDetailModel);
} }
@ -2452,6 +2471,11 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
log.warn("##################batchOpenLabel: 文件不存在"); log.warn("##################batchOpenLabel: 文件不存在");
return R.fail(405, "文件不存在"); return R.fail(405, "文件不存在");
} }
List<BasicMaterialEntity> materialEntities = basicMaterialClient.findAllList();
//把materialEntities转化成以productCode和productName拼接为key的Map
Map<String, BasicMaterialEntity> materialEntityMap = materialEntities.stream().collect(Collectors.toMap(item -> item.getProductCode() + "&&" + item.getName(), item -> item));
InputStream inputStream = file.getInputStream(); InputStream inputStream = file.getInputStream();
List<ImportOrderNoPackageExcelDTO> importOrderNoPackageExcelDTOS = EasyExcel.read(inputStream).head(ImportOrderNoPackageExcelDTO.class).sheet(0).headRowNumber(2).doReadSync(); List<ImportOrderNoPackageExcelDTO> importOrderNoPackageExcelDTOS = EasyExcel.read(inputStream).head(ImportOrderNoPackageExcelDTO.class).sheet(0).headRowNumber(2).doReadSync();
@ -2606,6 +2630,19 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
} }
advanceDetailModel.setPackageStatus("0"); advanceDetailModel.setPackageStatus("0");
String materialName = StringUtil.isNotBlank(importOrderNoPackageExcelDTO.getMaterialName())?importOrderNoPackageExcelDTO.getMaterialName():"";
String materialCode = StringUtil.isNotBlank(importOrderNoPackageExcelDTO.getMaterialCode())?importOrderNoPackageExcelDTO.getMaterialCode():"";
BasicMaterialEntity basicMaterialEntity = materialEntityMap.get(materialCode + "&&" + materialName);
if(!Objects.isNull(basicMaterialEntity)){
advanceDetailModel.setMaterialId(basicMaterialEntity.getId());
advanceDetailModel.setMaterialCode(materialCode);
advanceDetailModel.setMaterialName(materialName);
advanceDetailModel.setWeight(new BigDecimal(basicMaterialEntity.getWeight()));
advanceDetailModel.setVolume(new BigDecimal(basicMaterialEntity.getVolume()));
}
List<String> orderPackageCodes = basicdataCodeClient.getBatchPackageCodeByType(warehouseCode, orderCode, totalNum); List<String> orderPackageCodes = basicdataCodeClient.getBatchPackageCodeByType(warehouseCode, orderCode, totalNum);
orderPackageCodes.forEach(orderPackageCode -> { orderPackageCodes.forEach(orderPackageCode -> {
TrunklineAdvanceDetailEntity advanceDetailEntity = new TrunklineAdvanceDetailEntity(); TrunklineAdvanceDetailEntity advanceDetailEntity = new TrunklineAdvanceDetailEntity();

5
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceDetailServiceImpl.java

@ -367,4 +367,9 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl<Trunkline
public void clearWaybillInfoByWaybillId(Long waybillId) { public void clearWaybillInfoByWaybillId(Long waybillId) {
baseMapper.clearWaybillInfoByWaybillId(waybillId); baseMapper.clearWaybillInfoByWaybillId(waybillId);
} }
@Override
public AdvancenceTotalNumberVO findTotalNumberByAdvanceIds(List<Long> advanceIds) {
return baseMapper.findTotalNumberByAdvanceIds(advanceIds);
}
} }

Loading…
Cancel
Save