diff --git a/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IAdvanceDetailClient.java b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IAdvanceDetailClient.java index 639f43261..444bda54a 100644 --- a/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IAdvanceDetailClient.java +++ b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IAdvanceDetailClient.java @@ -81,10 +81,11 @@ public interface IAdvanceDetailClient { /** - * 根据卸车车次 查询老系统中 这个车次中装的包间明细 + * 根据卸车车次 查询老系统中 这个车次中装的包间 * @param unloadCarNum * @return */ @GetMapping(API_PREFIX + "/getByCarNum") - List getByCarNum(@RequestParam String unloadCarNum); + List getByCarNum(@RequestParam String unloadCarNum); + } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryOrderMainServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryOrderMainServiceImpl.java index 2379ba004..96a6c58d3 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryOrderMainServiceImpl.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryOrderMainServiceImpl.java @@ -1,5 +1,6 @@ package com.logpm.factory.mt.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import com.logpm.factory.mt.entity.MtFactoryOrderMain; import com.logpm.factory.mt.mapper.MtFactoryOrderMainMapper; @@ -25,7 +26,7 @@ public class MtFactoryOrderMainServiceImpl extends BaseServiceImpl findMtFactoryOrderMainByInvoiceOrderCode(String invoiceOrderCode) { - LambdaQueryChainWrapper lambdaQueryChainWrapper = new LambdaQueryChainWrapper(MtFactoryOrderMain.class); + QueryWrapper lambdaQueryChainWrapper = new QueryWrapper(); lambdaQueryChainWrapper.eq("invoice_order_code", invoiceOrderCode); List ls = mtFactoryOrderMainMapper.selectList(lambdaQueryChainWrapper); return ls; diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/UnloadCarComHandler.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/UnloadCarComHandler.java index 48894a44b..b8334602d 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/UnloadCarComHandler.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/UnloadCarComHandler.java @@ -1,6 +1,7 @@ package com.logpm.factory.receiver; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import com.fasterxml.jackson.core.JsonProcessingException; @@ -75,58 +76,44 @@ public class UnloadCarComHandler { 3.通过运单查询货物上的包件 4.需要过滤出来 只要梦天的 */ - List carNumList = advanceDetailClient.getByCarNum(unloadCarDTO.getUnloadCarNum()); + List carNumList = advanceDetailClient.getByCarNum(unloadCarDTO.getUnloadCarNum()); log.info("##################unloadCarComDataHandler carNumList:{}", carNumList); - /** - * 安装品类进行分组 - */ - Map> carNumMapList = carNumList.stream().collect(Collectors.groupingBy(AdvanceDetailEntity::getType)); - - List mtListdata = carNumMapList.get("梦天"); - - if (mtListdata == null || mtListdata.size() == 0) { - log.info("##################{} 车次 不存在梦天的数据 无需返回", unloadCarDTO.getUnloadCarNum()); - return; - } - - // 得到车次下面梦天的包条码集合 - List mtStrs = mtListdata.stream().map(AdvanceDetailEntity::getUnitNo).collect(Collectors.toList()); - if (mtStrs == null || mtStrs.size() == 0) { - log.error("##################{} 车次 梦天的包条数据存在异常! 请联系管理员", unloadCarDTO.getUnloadCarNum()); - return; - } - - List allMtData = mtFactoryOrderMainService.mtOrderPackageRelation(); - // 对这个集合内进行分组 - Map> stringListMap = allMtData.stream().collect(Collectors.groupingBy(MTOrderPackageRelationVO::getInvoiceOrderCode)); - Set set = stringListMap.keySet(); - String carNum = null; - for (String s : set) { - // 得到某个工厂运输批次的集合 - List t = stringListMap.get(s); - //得到这个批次下面所有的包间 - List strs = t.stream().map(MTOrderPackageRelationVO::getPackageCode).collect(Collectors.toList()); - // 当前批次的包间 在 这个配载计划中存在一个 则进行通知 - for (String mtStr : mtStrs) { - if (strs.contains(mtStr)) { - carNum = s; - break; + try { + + List allMtData = mtFactoryOrderMainService.mtOrderPackageRelation(); + // 对这个集合内进行分组 + Map> stringListMap = allMtData.stream().collect(Collectors.groupingBy(MTOrderPackageRelationVO::getInvoiceOrderCode)); + Set set = stringListMap.keySet(); + String carNum = null; + for (String s : set) { + // 得到某个工厂运输批次的集合 + List t = stringListMap.get(s); + //得到这个批次下面所有的包间 + List strs = t.stream().map(MTOrderPackageRelationVO::getPackageCode).collect(Collectors.toList()); + // 当前批次的包间 在 这个配载计划中存在一个 则进行通知 + for (String mtStr : carNumList) { + if (strs.contains(mtStr)) { + carNum = s; + break; + } } - } - try { - if (StringUtil.isNoneBlank(carNum)) { - sendDataCarNum(carNum, unloadCarDTO.getCompleteDate()); + try { + if (StringUtil.isNoneBlank(carNum)) { + sendDataCarNum(carNum, unloadCarDTO.getCompleteDate()); + } + } catch (ParseException e) { + e.printStackTrace(); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } catch (JsonProcessingException e) { + e.printStackTrace(); } - } catch (ParseException e) { - e.printStackTrace(); - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - } catch (JsonProcessingException e) { - e.printStackTrace(); - } + } + }catch (Exception e){ + e.printStackTrace(); } @@ -144,8 +131,8 @@ public class UnloadCarComHandler { private void sendDataCarNum(String carNum, String completeDate) throws ParseException, NoSuchAlgorithmException, JsonProcessingException { // 需要判断这个发货单编号是否推送过 - LambdaQueryChainWrapper lambdaQueryChainWrapper = new LambdaQueryChainWrapper(MtPushData.class); - lambdaQueryChainWrapper.eq(MtPushData::getRefCode, carNum); + QueryWrapper lambdaQueryChainWrapper = new QueryWrapper(); + lambdaQueryChainWrapper.eq("ref_code", carNum); MtPushData ms = mtPushDataService.getOne(lambdaQueryChainWrapper); if (ObjectUtils.isNotNull(ms)) { log.info("##################{} 车次已经推送过", carNum); diff --git a/blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java b/blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java index d52d9b5c4..495771f01 100644 --- a/blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java +++ b/blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java @@ -1,21 +1,30 @@ //package com.logpm.factory; // +//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +//import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; //import com.baomidou.mybatisplus.extension.conditions.update.UpdateChainWrapper; //import com.fasterxml.jackson.core.JsonProcessingException; //import com.logpm.factory.comfac.controller.FactoryCommonController; //import com.logpm.factory.comfac.dto.UnloadCarDTO; //import com.logpm.factory.mt.entity.MtFactoryOrderMain; +//import com.logpm.factory.mt.entity.MtPushData; //import com.logpm.factory.mt.service.IMtFactoryDataService; //import com.logpm.factory.mt.service.IMtFactoryOrderMainService; +//import com.logpm.factory.mt.service.IMtPushDataService; //import com.logpm.factory.mt.service.impl.MtFactoryDataServiceImpl; //import com.logpm.factory.snm.vo.MTOrderPackageRelationVO; //import com.logpm.oldproject.entity.AdvanceDetailEntity; //import com.logpm.oldproject.feign.IAdvanceDetailClient; +//import com.rabbitmq.client.Channel; //import org.junit.jupiter.api.Test; //import org.junit.jupiter.api.extension.ExtendWith; //import org.springblade.core.test.BladeBootTest; //import org.springblade.core.test.BladeSpringExtension; //import org.springblade.core.tool.api.R; +//import org.springblade.core.tool.api.ResultCode; +//import org.springblade.core.tool.utils.StringUtil; +//import org.springframework.amqp.core.Message; +//import org.springframework.amqp.rabbit.annotation.RabbitHandler; //import org.springframework.beans.factory.annotation.Autowired; // //import java.security.NoSuchAlgorithmException; @@ -28,13 +37,11 @@ //import java.util.stream.Collectors; // //@ExtendWith(BladeSpringExtension.class) -//@BladeBootTest(appName = "logpm-factory-zhy", enableLoader = true) +//@BladeBootTest(appName = "logpm-factory-pref", enableLoader = true) //public class TestService { // // // -// -// // @Autowired // private IAdvanceDetailClient advanceDetailClient; // @@ -45,102 +52,109 @@ // @Autowired // private IMtFactoryDataService mtFactoryDataService; // +// @Autowired +// private IMtPushDataService mtPushDataService; +// +// // -// @Test -// public void testUpdate(){ // -//// UpdateChainWrapper updateChainWrapper =new UpdateChainWrapper(MtFactoryOrderMain.class); -//// updateChainWrapper.set("push_status","1"); -//// updateChainWrapper.set("push_time",new Date()); -//// updateChainWrapper.eq("invoice_order_code","HYLEJIA-230730"); -//// mtFactoryOrderMainService.update(updateChainWrapper); -// } // // // @Test -// public void contextLoads() { +// public void test2() { // -///* +// /* // 1.得到传递的车次 // 2. 需要判断这个车次是否市梦天的 // 3. 查询这个车次上的运单是否市梦天的 // -//// 4.查询包间对应的梦天发给我们的批次号 -//// */ -//// UnloadCarDTO unloadCarDTO = new UnloadCarDTO(); -//// unloadCarDTO.setUnloadCarNum("LQGX230719001"); -//// unloadCarDTO.setCompleteDate("2023-07-19 16:48:45"); -//// -//// /* -//// 2.通过车次查询来系统中车次绑定的运单 -//// 3.通过运单查询货物上的包件 -//// 4.需要过滤出来 只要梦天的 -//// */ -//// List carNumList = advanceDetailClient.getByCarNum(unloadCarDTO.getUnloadCarNum()); -//// -//// -//// /** -//// * 安装品类进行分组 -//// */ -//// Map> carNumMapList = carNumList.stream().collect(Collectors.groupingBy(AdvanceDetailEntity::getType)); -//// -//// List mtListdata = carNumMapList.get("梦天"); -//// -//// if (mtListdata == null || mtListdata.size() == 0) { -//// return; -//// } -//// -//// // 得到车次下面梦天的包条码集合 -//// List mtStrs = mtListdata.stream().map(AdvanceDetailEntity::getUnitNo).collect(Collectors.toList()); -//// if (mtStrs == null || mtStrs.size() == 0) { -//// return; -//// } -//// -//// List allMtData = mtFactoryOrderMainService.mtOrderPackageRelation(); -//// // 对这个集合内进行分组 -//// Map> stringListMap = allMtData.stream().collect(Collectors.groupingBy(MTOrderPackageRelationVO::getInvoiceOrderCode)); -//// Set set = stringListMap.keySet(); -//// boolean isPush = false; -//// for (String s : set) { -//// // 得到某个工厂运输批次的集合 -//// List t = stringListMap.get(s); -//// //得到这个批次下面所有的包间 -//// List strs = t.stream().map(MTOrderPackageRelationVO::getPackageCode).collect(Collectors.toList()); -//// // 当前批次的包间 在 这个配载计划中存在一个 则进行通知 -//// for (String mtStr : mtStrs) { -//// if (strs.contains(mtStr)) { -//// isPush = true; -//// break; -//// } -//// } -//// if (isPush) { -//// break; -//// } -//// } -//// if (isPush) { -//// try { -//// -//// Date data = new SimpleDateFormat().parse(unloadCarDTO.getCompleteDate()); -//// R r = mtFactoryDataService.sendUnloadCarNum(unloadCarDTO.getUnloadCarNum(), data); -//// // 更新订单状态 -//// UpdateChainWrapper updateChainWrapper =new UpdateChainWrapper(MtFactoryOrderMain.class); -//// updateChainWrapper.set("push_status","1"); -//// updateChainWrapper.set("push_time",data); -//// updateChainWrapper.eq("invoice_order_code",unloadCarDTO.getUnloadCarNum()); -//// mtFactoryOrderMainService.update(updateChainWrapper); -//// -//// } catch (ParseException e) { -//// e.printStackTrace(); -//// } catch (JsonProcessingException e) { -//// e.printStackTrace(); -//// } catch (NoSuchAlgorithmException e) { -//// e.printStackTrace(); -//// } -//// -//// -//// } +// 4.查询包间对应的梦天发给我们的批次号 +// */ +// UnloadCarDTO unloadCarDTO = new UnloadCarDTO(); +// unloadCarDTO.setCompleteDate("2023-08-08 15:39:40"); +// unloadCarDTO.setUnloadCarNum("MTZX230808001"); +// +// /* +// 2.通过车次查询来系统中车次绑定的运单 +// 3.通过运单查询货物上的包件 +// 4.需要过滤出来 只要梦天的 +// */ +// +// try { +// List carNumList = advanceDetailClient.getByCarNum(unloadCarDTO.getUnloadCarNum()); +// List allMtData = mtFactoryOrderMainService.mtOrderPackageRelation(); +// // 对这个集合内进行分组 +// Map> stringListMap = allMtData.stream().collect(Collectors.groupingBy(MTOrderPackageRelationVO::getInvoiceOrderCode)); +// Set set = stringListMap.keySet(); +// +// for (String s : set) { +// String carNum = null; +// // 得到某个工厂运输批次的集合 +// List t = stringListMap.get(s); +// //得到这个批次下面所有的包间 +// List strs = t.stream().map(MTOrderPackageRelationVO::getPackageCode).collect(Collectors.toList()); +// // 当前批次的包间 在 这个配载计划中存在一个 则进行通知 +// for (String mtStr : carNumList) { +// if (strs.contains(mtStr)) { +// carNum = s; +// break; +// } +// } +// +// try { +// if (StringUtil.isNoneBlank(carNum)) { +// sendDataCarNum(carNum, unloadCarDTO.getCompleteDate()); +// } +// } catch (ParseException e) { +// e.printStackTrace(); +// } catch (NoSuchAlgorithmException e) { +// e.printStackTrace(); +// } catch (JsonProcessingException e) { +// e.printStackTrace(); +// } +// +// } +// } catch (Exception e) { +// e.printStackTrace(); +// } // // // } // +// /** +// * 根基匹配到的发货单编号 推送梦天 +// * +// * @param carNum +// * @param completeDate +// * @throws ParseException +// * @throws NoSuchAlgorithmException +// * @throws JsonProcessingException +// */ +// private void sendDataCarNum(String carNum, String completeDate) throws ParseException, NoSuchAlgorithmException, JsonProcessingException { +// +// // 需要判断这个发货单编号是否推送过 +// QueryWrapper lambdaQueryChainWrapper = new QueryWrapper(); +// lambdaQueryChainWrapper.eq("ref_code", carNum); +// MtPushData ms = mtPushDataService.getOne(lambdaQueryChainWrapper); +// if (ObjectUtils.isNotNull(ms)) { +// return; +// } +// R r = mtFactoryDataService.sendUnloadCarNum(carNum, completeDate); +// if (r.getCode() == ResultCode.SUCCESS.getCode()) { +// MtPushData mtPushData = new MtPushData(); +// mtPushData.setPushTime(new Date()); +// mtPushData.setPushStatus(1);// 推送状态 +// mtPushData.setRefCode(carNum); +// mtPushData.setRefType(1);// 订单主表 +// // todo 这里需要查询主推送单的 ID +// List mtFactoryOrderMainList = mtFactoryOrderMainService.findMtFactoryOrderMainByInvoiceOrderCode(carNum); +// if (mtFactoryOrderMainList.size() > 0) { +// mtFactoryOrderMainList.get(0); +// mtPushData.setRefId(mtFactoryOrderMainList.get(0).getId()); +// } +// // 插入推送数据 +// mtPushDataService.save(mtPushData); +// } +// } +// //} diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/AdvanceDetailClient.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/AdvanceDetailClient.java index b61d9095d..d6be4ed49 100644 --- a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/AdvanceDetailClient.java +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/AdvanceDetailClient.java @@ -87,7 +87,7 @@ public class AdvanceDetailClient implements IAdvanceDetailClient { } @Override - public List getByCarNum(String unloadCarNum) { + public List getByCarNum(String unloadCarNum) { return advanceDetailService.getByCarNum(unloadCarNum); } } diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.java index a5aeb1cfe..ab35f485d 100644 --- a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.java +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.java @@ -54,5 +54,7 @@ public interface AdvanceDetailMapper extends BaseMapper { DistributionParcelListEntityVO getByUnitNo(@Param("unitNo") String unitNo); - List getByCarNum(@Param("unloadCarNum") String unloadCarNum); + List getByCarNum(@Param("unloadCarNum") String unloadCarNum); + + } diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.xml b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.xml index 2fa940d89..a7b3b1269 100644 --- a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.xml +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.xml @@ -112,74 +112,8 @@ - + SELECT cls.unitNo FROM ht_cars_load_scan cls LEFT JOIN ht_advance_detail ad on ad.unitNo=cls.unitNo WHERE cls.start_cars_no=#{unloadCarNum} and cls.type=0 and ad.type="梦天" diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IAdvanceDetailService.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IAdvanceDetailService.java index 30a56d5ca..51b612543 100644 --- a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IAdvanceDetailService.java +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/IAdvanceDetailService.java @@ -41,5 +41,5 @@ public interface IAdvanceDetailService { Integer getAllNumByOrderNo(String orderSelfNum); - List getByCarNum(String unloadCarNum); + List getByCarNum(String unloadCarNum); } diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/AdvanceDetailServiceImpl.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/AdvanceDetailServiceImpl.java index ba13533ed..616fd366c 100644 --- a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/AdvanceDetailServiceImpl.java +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/AdvanceDetailServiceImpl.java @@ -74,9 +74,9 @@ public class AdvanceDetailServiceImpl implements IAdvanceDetailService { } @Override - public List getByCarNum(String unloadCarNum) { + public List getByCarNum(String unloadCarNum) { - List ls = advanceDetailMapper.getByCarNum(unloadCarNum); + List ls = advanceDetailMapper.getByCarNum(unloadCarNum); return ls; } diff --git a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java index 655ecf9ee..3f4557abe 100644 --- a/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java +++ b/blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java @@ -107,9 +107,9 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl