| | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.gs.xiaomi.config.DataAcquisitionConfiguration; |
| | | import com.gs.xiaomi.dto.*; |
| | | import com.gs.xiaomi.entity.DeliveryDetail; |
| | |
| | | private final LogisticsPackageService logisticsPackageService; |
| | | |
| | | public void getDb() { |
| | | |
| | | String format = DateUtil.format(new Date(), "yyyy-MM-dd"); |
| | | getXM104Save(format); |
| | | } |
| | | |
| | | private void getXM104Save(String format) { |
| | | |
| | | BizDocument doc = new BizDocument(); |
| | | doc.setBizDate(format); |
| | | doc.setLifnr(DataAcquisitionConfiguration.LIFNR); |
| | | |
| | | getXM104(doc); |
| | | } |
| | | |
| | | private void getXM104(BizDocument doc) { |
| | | |
| | | ZfmWsApiRequest req = new ZfmWsApiRequest(); |
| | | req.setIvCode(DataAcquisitionConfiguration.IV_CODEXM104); |
| | | req.setIvEvent(""); |
| | | req.setIvFlag(""); |
| | | BizDocument doc = new BizDocument(); |
| | | doc.setBizDate("2025-04-01"); |
| | | doc.setLifnr(DataAcquisitionConfiguration.LIFNR); |
| | | req.setIvInfo(doc); |
| | | req.setIvPass(DataAcquisitionConfiguration.getIvPass(DataAcquisitionConfiguration.IV_CODEXM104)); |
| | | req.setIvUser(DataAcquisitionConfiguration.IV_USER); |
| | |
| | | log.error("【读取列表异常】参数: {} 异常: {}", JSON.toJSONString(req), e.getMessage(), e); |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | } |
| | | |
| | | private BizDocumentResult getDeliveryNo(ZfmWsApiRequest request) throws Exception { |
| | |
| | | List<EtHeader> etHeaders = result.getEtHeaders(); |
| | | |
| | | etHeaders.forEach(etHeader -> { |
| | | |
| | | LambdaQueryWrapper<DeliveryMain> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(DeliveryMain::getZzasn, etHeader.getZzasn()); |
| | | |
| | | DeliveryMain one = deliveryMainService.getOne(queryWrapper, false); |
| | | |
| | | if (one != null) { |
| | | deliveryMainService.removeById(one.getId()); |
| | | |
| | | LambdaUpdateWrapper<DeliveryDetail> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.eq(DeliveryDetail::getPid, one.getId()); |
| | | deliveryDetailService.remove(updateWrapper); |
| | | |
| | | //PackageDetail |
| | | LambdaUpdateWrapper<PackageDetail> updateWrapper1 = new LambdaUpdateWrapper<>(); |
| | | updateWrapper1.eq(PackageDetail::getPid, one.getId()); |
| | | packageDetailService.remove(updateWrapper1); |
| | | |
| | | //LogisticsPackage |
| | | LambdaUpdateWrapper<LogisticsPackage> updateWrapper2 = new LambdaUpdateWrapper<>(); |
| | | updateWrapper2.eq(LogisticsPackage::getPid, one.getId()); |
| | | logisticsPackageService.remove(updateWrapper2); |
| | | } |
| | | |
| | | DeliveryMain deliveryMain = new DeliveryMain(); |
| | | |
| | | BeanUtil.copyProperties(etHeader, deliveryMain); |
| | |
| | | |
| | | } |
| | | |
| | | deliveryMainService.callPdaReceiptBtn("送货单签收[BTNOK[PL017[" + etHeader.getZzasn(), ""); |
| | | }); |
| | | } |
| | | |
| | | public boolean manualSynchronization(NumbericalDto numbericalDto) { |
| | | try { |
| | | String[] asns = numbericalDto.getAsn().split(","); |
| | | for (String asn : asns) { |
| | | BizDocument doc = new BizDocument(); |
| | | doc.setLifnr(DataAcquisitionConfiguration.LIFNR); |
| | | doc.setZzasn(asn); |
| | | getXM104(doc); |
| | | } |
| | | return true; |
| | | } catch (Exception e) { |
| | | log.error("【手动读取ASN异常】 异常: {}", e.getMessage(), e); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | public boolean manualSynchronizationByDate(NumbericalDto numbericalDto) { |
| | | try { |
| | | BizDocument doc = new BizDocument(); |
| | | doc.setLifnr(DataAcquisitionConfiguration.LIFNR); |
| | | doc.setBizDate(numbericalDto.getDate()); |
| | | getXM104(doc); |
| | | return true; |
| | | } catch (Exception e) { |
| | | log.error("【手动读取ASN异常】 异常: {}", e.getMessage(), e); |
| | | return false; |
| | | } |
| | | } |
| | | } |