From ea241669341e32b702481ac1846905c914b09f0c Mon Sep 17 00:00:00 2001 From: liuy <37787198+LiuyCodes@users.noreply.github.com> Date: Mon, 23 Sep 2024 18:28:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E9=87=8D=E6=9E=84=E5=92=8C?= =?UTF-8?q?=E6=80=A7=E8=83=BD=E6=94=B9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -移除BOM版本在ConsignmachiningIn的设置 - 添加版本号设置为ConsignmachiningInBodyDto - 移除未使用的BdInvmandocEntity查询 - 重构getBomVersion方法以获取最新的BOM版本 - 新增查询基础档案方法用于获取存货基本信息 - 重构ProxyPurchaseReturn和ProxyPurchaseWarehousOrder中关于赠品的判断逻辑 - 修改PoOrderChildrenDto中blargess字段类型为Boolean - 同步处理SaveOrUpdateBusinessLogUtil中的日志保存或更新操作 - 调整数据库连接池配置以提高性能- 更新application-letsprod.yml中的数据库连接超时设置 --- .../plugin/outsourc/ConsignmachiningIn.java | 3 +- .../outsourc/ConsignmachiningInReturn.java | 62 ++++++++++++++++++- .../plugin/purchase/ProxyPurchaseReturn.java | 13 +++- .../purchase/ProxyPurchaseWarehousOrder.java | 9 ++- .../ProxyPurchaseWarehousWarehouse.java | 2 +- .../u8cdto/ConsignmachiningInBodyDto.java | 1 + .../lets/u8cdto/PoOrderChildrenDto.java | 2 +- .../util/SaveOrUpdateBusinessLogUtil.java | 35 ++++++----- .../main/resources/application-letsprod.yml | 2 +- .../src/main/resources/application.yml | 4 +- .../purchase/ProxyPurchaseReturnTest.java | 5 +- 11 files changed, 108 insertions(+), 30 deletions(-) diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningIn.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningIn.java index e80ca82c..4b5d806a 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningIn.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningIn.java @@ -424,8 +424,9 @@ public class ConsignmachiningIn extends PluginBaseEntity { scorderBodyDto.setNordernum(stockinB.getReceivedQty());//数量 scorderBodyDto.setNoriginalnetprice(noriginalcurprice.stripTrailingZeros().toPlainString());//净单价 scorderBodyDto.setCwarehouseid(bdStordocEntity.getPkStordoc());//仓库 - scorderBodyDto.setBomversion(bomVersion.get(0).getVersion());//BOM版本 +// scorderBodyDto.setBomversion(bomVersion.get(0).getVersion());//BOM版本 scorderBodyDto.setDplanarrvdate(generateBusinessDate);//计划到货日期 + scorderBodyDto.setVdef16(bomVersion.get(0).getVersion());//版本号 scorderBodyDtoArrayList.add(scorderBodyDto); } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningInReturn.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningInReturn.java index b94f73a0..9a539fbb 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningInReturn.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningInReturn.java @@ -78,6 +78,9 @@ public class ConsignmachiningInReturn extends PluginBaseEntity { @Autowired private IBdPurorgDao iBdPurorgDao; + @Autowired + private IBdInvbasdocDao iBdInvbasdocDao; + @Autowired private OnlyImplementProxyOrderUtil onlyImplementProxyOrder; @@ -99,6 +102,9 @@ public class ConsignmachiningInReturn extends PluginBaseEntity { @Autowired private OffsetTimeTime offsetTimeTime; + @Autowired + private IBdBomDao iBdBomDao; + private static final String PROD_FILED = "prod"; @Override @@ -386,8 +392,13 @@ public class ConsignmachiningInReturn extends PluginBaseEntity { //通过O采退出库库单明细行,联查OFS采退订单明细行 PurchaseReturnOrderDetails ofsPoOrderDetailRowTraget = findOfsPoOrderDetailRowTraget(detailsDto, purchaseReturnOrder); //查询存货管理档案 -// BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(stockinB, bdCorpEntity.getPkCorp()); - BdInvmandocEntity bdInvmandocEntity = null; + BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(detailsDto, bdCorpEntity.getPkCorp()); +// BdInvmandocEntity bdInvmandocEntity = null; + //存货基础档案 + BdInvbasdocEntity bdInvbasdocEntity = queryStockBasicArchives(bdInvmandocEntity.getPkInvmandoc(), bdCorpEntity.getPkCorp()); + //BOM版本 + //存货对应的BOM + List bomVersion = getBomVersion(bdCalbodyEntity.getPkCalbody(), bdInvbasdocEntity.getPkInvbasdoc(), bdInvbasdocEntity.getInvcode()); //计算含税单价 BigDecimal noriginalcurprice = null; @@ -409,6 +420,7 @@ public class ConsignmachiningInReturn extends PluginBaseEntity { consignmachiningInBodyDto.setVsourcebillcode(scOrderEntity.getVordercode());//来源单据号 // consignmachiningInBodyDto.setWriteofftype("按备料发料核销");//核销方式,和妮姐已经确认,不用传递 consignmachiningInBodyDto.setDbizdate(generateBusinessDate);// 入库日期 + consignmachiningInBodyDto.setVdef16(bomVersion.get(0).getVersion());//BOM version consignmachiningInBodyDtoArrayList.add(consignmachiningInBodyDto); } @@ -1141,4 +1153,50 @@ public class ConsignmachiningInReturn extends PluginBaseEntity { logger.error("记录splitDateAndPush方法抛出的异常", e); } } + + /** + * 查询BOM版本,版本最新的在返回的结果集的最前面 + * + * @param gcbm 工厂主键 + * @param wlbmid 物料编码id,经过测试,这是存货基本档案主键 + */ + private List getBomVersion(String gcbm, String wlbmid, String vbillCode) throws Exception { + Assert.notNull(gcbm, "gcbm工厂主键"); + Assert.notNull(wlbmid, "wlbmid物料编码id不能为空"); + + BdBomEntity bdBomEntity = new BdBomEntity(); + bdBomEntity.setDataSourceCode("lets_u8c"); + bdBomEntity.setWlbmid(wlbmid); + bdBomEntity.setGcbm(gcbm); + List bdBomEntityList = iBdBomDao.query(bdBomEntity); + //2024年9月2日 15:08:30 等待妮姐确认,如果对应的存货没有BOM,是否抛出异常 + //2024年9月2日 15:14:18 已经和妮姐确认,如果存货对应的BOM不存在,则抛出异常 + if (bdBomEntityList == null || bdBomEntityList.size() == 0) { + Assert.state(false, "存货:{}对应的BOM不存在(该存货需要维护BOM)!", vbillCode); + } + return bdBomEntityList; + } + + /** + * 2024年8月7日 10:25:29 + * 查询基础档案,根据公司、管理档案主键查询 + * + * @author liuyang + */ + private BdInvbasdocEntity queryStockBasicArchives(String pkInvmandoc, String pkCorp) throws Exception { + Assert.notNull(pkInvmandoc, "存货管理档案不能为空"); + Assert.notNull(pkCorp, "公司档案不能为空"); + + BdInvbasdocEntity bdInvbasdocEntity = new BdInvbasdocEntity(); + bdInvbasdocEntity.setPk_invmandoc(pkInvmandoc); + bdInvbasdocEntity.setPk_corp(pkCorp); + List bdInvbasdocEntity2 = iBdInvbasdocDao.queryBdInvbasdocByPkInvmandocV2(bdInvbasdocEntity); + if (bdInvbasdocEntity2.size() == 0) { + Assert.state(false, "根据存货管理档案主键{}和公司档案主键{}没有查询到U8C基础档案", pkInvmandoc, pkCorp); + } else if (bdInvbasdocEntity2.size() >= 2) { + Assert.state(false, "根据存货管理档案主键{}和公司档案主键{}没有查询到U8C基础档案", pkInvmandoc, pkCorp); + } + return bdInvbasdocEntity2.get(0); + } + } \ No newline at end of file diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseReturn.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseReturn.java index 8e086049..f2cd0bae 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseReturn.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseReturn.java @@ -184,8 +184,8 @@ public class ProxyPurchaseReturn extends PluginBaseEntity { //OFS采退出库 List returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>(); QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); - queryOfsSoSaleOutVo.setClosedAt_start(startTime); - queryOfsSoSaleOutVo.setClosedAt_end(endTime); + queryOfsSoSaleOutVo.setAuditAt_start(startTime); + queryOfsSoSaleOutVo.setAuditAt_end(endTime); queryOfsSoSaleOutVo.setClientCode("LETS"); queryOfsSoSaleOutVo.setPageNo(1L); queryOfsSoSaleOutVo.setPageSize(50L); @@ -457,6 +457,12 @@ public class ProxyPurchaseReturn extends PluginBaseEntity { Assert.state(false, "计算采退出库单原币含税单价失败 原因:{}", e.getMessage()); } + //是否赠品 + Boolean isBlargess = false; + if ("0".equals(noriginalcurprice.stripTrailingZeros().toPlainString())) { + isBlargess = true; + } + PoOrderChildrenDto poOrderChildrenDto = new PoOrderChildrenDto(); poOrderChildrenDto.setCmangid(bdInvmandocEntity.getPkInvmandoc());//存货管理id poOrderChildrenDto.setNordernum("-" + new BigDecimal(receivedQty).stripTrailingZeros().toPlainString());//订货数量 @@ -468,6 +474,7 @@ public class ProxyPurchaseReturn extends PluginBaseEntity { // poOrderChildrenDto.setIisreplenish(false);//补货标识 * poOrderChildrenDto.setCoperator(OverallConstant.getOverAllValue("u8cApiZdrPK"));//操作员id // poOrderChildrenDto.setBreceiveplan(false);//存在到货计划 + poOrderChildrenDto.setBlargess(isBlargess); poOrderChildrenDtoList.add(poOrderChildrenDto); //2024年8月20日 16:00:03 已经和佳妮总确认,计划到货日期,不用进行传递 @@ -710,7 +717,7 @@ public class ProxyPurchaseReturn extends PluginBaseEntity { private BdBusitypeEntity u8cOperationFlow() throws Exception { //查询业务流程 //2024年8月6日 11:33:07 具体的业务流程名称,还需要实施提供 - String processName = "代理品牌采购"; + String processName = "采购退货"; BdBusitypeEntity bdBusitypeEntity = queryBdBusitypeUtil.queryBdBusitype(processName); Assert.notNull(bdBusitypeEntity, "根据业务流程名称({})没有查询到业务流程", processName); return bdBusitypeEntity; diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseWarehousOrder.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseWarehousOrder.java index 3fec2a36..b1a0910e 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseWarehousOrder.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseWarehousOrder.java @@ -443,6 +443,12 @@ public class ProxyPurchaseWarehousOrder extends PluginBaseEntity { String receivedQty = ofsPoOrderDetails.getRequestQty();//请求数量 String buyPrice = ofsPoOrderDetails.getDiscountPrice();//实际进价 + //是否赠品 + Boolean isBlargess = false; + if ("0".equals(new BigDecimal(buyPrice).stripTrailingZeros().toPlainString())) { + isBlargess = true; + } + PoOrderChildrenDto poOrderChildrenDto = new PoOrderChildrenDto(); poOrderChildrenDto.setCmangid(bdInvmandocEntity.getPkInvmandoc());//存货管理id poOrderChildrenDto.setNordernum(receivedQty);//订货数量 @@ -455,6 +461,7 @@ public class ProxyPurchaseWarehousOrder extends PluginBaseEntity { poOrderChildrenDto.setCoperator(OverallConstant.getOverAllValue("u8cApiZdrPK"));//操作员id // poOrderChildrenDto.setBreceiveplan(false);//存在到货计划 poOrderChildrenDto.setVdef20(ofsPoOrderDetails.getId());//O采购订单明细行 + poOrderChildrenDto.setBlargess(isBlargess); poOrderChildrenDtoList.add(poOrderChildrenDto); //2024年8月20日 16:00:03 已经和佳妮总确认,计划到货日期,不用进行传递 @@ -594,7 +601,7 @@ public class ProxyPurchaseWarehousOrder extends PluginBaseEntity { //客商基本档案(供应商类型) //2024年8月20日 14:47:55 丽知商城、OFS 供应商客商档案、传递到U8C的客商, //其中自定义项1作为原系统编码,因此统一传到自定义项一,已经和大家确认好了,没有关系的,放心大胆传吧,宝贝 - String shipFromCode = header.getVendorName(); + String shipFromCode = header.getVendorCode(); //测试 // shipFromCode = "dy-off"; Assert.notNull(shipFromCode, "O供应商编码不能为空,没有办法完成业务逻辑,请配置供应商编码(采购)"); diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseWarehousWarehouse.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseWarehousWarehouse.java index 056a1086..94c4d206 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseWarehousWarehouse.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseWarehousWarehouse.java @@ -450,7 +450,7 @@ public class ProxyPurchaseWarehousWarehouse extends PluginBaseEntity { } String bsourcelargess = "N"; - if (noriginalcurprice.longValue() == 0) { + if ("0".equals(noriginalcurprice.stripTrailingZeros().toPlainString())) { bsourcelargess = "Y"; } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/ConsignmachiningInBodyDto.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/ConsignmachiningInBodyDto.java index f9576749..9f623754 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/ConsignmachiningInBodyDto.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/ConsignmachiningInBodyDto.java @@ -20,4 +20,5 @@ public class ConsignmachiningInBodyDto { private String vsourcebillcode; private String writeofftype;//核销方式 private String dbizdate; + private String vdef16; } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/PoOrderChildrenDto.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/PoOrderChildrenDto.java index 74327604..f45dc886 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/PoOrderChildrenDto.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/PoOrderChildrenDto.java @@ -12,7 +12,7 @@ import lombok.Data; */ @Data public class PoOrderChildrenDto { - private String blargess; + private Boolean blargess; private String cassistunit; private String cbaseid; private String ccurrencytypeid; diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/SaveOrUpdateBusinessLogUtil.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/SaveOrUpdateBusinessLogUtil.java index fc9b169b..11b8334e 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/SaveOrUpdateBusinessLogUtil.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/SaveOrUpdateBusinessLogUtil.java @@ -31,19 +31,21 @@ public class SaveOrUpdateBusinessLogUtil { private static final String failN = "N"; + private static final Object OBJECT_LOCK = new Object(); + /** * 保存或者更新 * * @param integrationTaskLivingDetailsEntity 提交参数 */ - public synchronized void saveOrUpdate(IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity) { + public void saveOrUpdate(IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity) { Assert.notNull(integrationTaskLivingDetailsEntity, "integrationTaskLivingDetailsEntity不能为空"); Assert.notNull(integrationTaskLivingDetailsEntity.getRootAppPk(), "源系统单号不能为空"); Assert.notNull(integrationTaskLivingDetailsEntity.getPluginId(), "场景id不能为空"); - try { - IntegrationTaskLivingDetailsEntity integrationTaskLivingDetails = null; - synchronized (queryDetailsLock) { + synchronized (OBJECT_LOCK) { + try { + IntegrationTaskLivingDetailsEntity integrationTaskLivingDetails = null; IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity1 = new IntegrationTaskLivingDetailsEntity(); integrationTaskLivingDetailsEntity1.setNewState("N"); integrationTaskLivingDetailsEntity1.setRootAppPk(integrationTaskLivingDetailsEntity.getRootAppPk()); @@ -52,23 +54,22 @@ public class SaveOrUpdateBusinessLogUtil { if (integrationTaskLivingDetailsEntities != null && integrationTaskLivingDetailsEntities.size() > 0) { integrationTaskLivingDetails = integrationTaskLivingDetailsEntities.get(0); } - } - if (integrationTaskLivingDetails != null) { - //存在,则更新,可能是N→Y / N→N - synchronized (insertOrUpdateLock) { + + if (integrationTaskLivingDetails != null) { + //存在,则更新,可能是N→Y / N→N integrationTaskLivingDetailsEntity.setId(integrationTaskLivingDetails.getId()); updateSuccessMessage(integrationTaskLivingDetailsEntity); - } - } else { - //不存在,则新增,可能是→Y / →N - Long uuid = UUIDLong.longUUID(); - integrationTaskLivingDetailsEntity.setId(String.valueOf(uuid)); - saveSuccessMessage(integrationTaskLivingDetailsEntity); + } else { + //不存在,则新增,可能是→Y / →N + Long uuid = UUIDLong.longUUID(); + integrationTaskLivingDetailsEntity.setId(String.valueOf(uuid)); + saveSuccessMessage(integrationTaskLivingDetailsEntity); // logger.info("integration_task_living_details->日志保存成功,主键:{}", save.getId()); + } + } catch (Exception e) { + logger.error("SaveOrUpdateBusinessLogUtil对应的saveOrUpdate方法抛出异常,日志详情保存失败!", e); + //2024年9月3日 10:26:45 如果这里往上抛出异常,没有功能搭配处理 } - } catch (Exception e) { - logger.error("SaveOrUpdateBusinessLogUtil对应的saveOrUpdate方法抛出异常,日志详情保存失败!", e); - //2024年9月3日 10:26:45 如果这里往上抛出异常,没有功能搭配处理 } } diff --git a/buildpackage/src/main/resources/application-letsprod.yml b/buildpackage/src/main/resources/application-letsprod.yml index 5df58e28..cda1c387 100644 --- a/buildpackage/src/main/resources/application-letsprod.yml +++ b/buildpackage/src/main/resources/application-letsprod.yml @@ -12,7 +12,7 @@ spring: dynamic: datasource: master: - url: jdbc:mysql://192.168.14.252:3306/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=3000000000&socketTimeout=3000000000&autoReconnectForPools=true + url: jdbc:mysql://192.168.14.252:3306/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000000000&socketTimeout=30000000000&autoReconnectForPools=true username: root password: 62e4295b615a30dbf3b8ee96f41c820b driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置 diff --git a/buildpackage/src/main/resources/application.yml b/buildpackage/src/main/resources/application.yml index 7bbb6416..5e8187ff 100644 --- a/buildpackage/src/main/resources/application.yml +++ b/buildpackage/src/main/resources/application.yml @@ -53,8 +53,8 @@ spring: strict: true #严格匹配数据源,默认false. true未匹配到指定数据源时抛异常,false使用默认数据源 druid: initial-size: 10 # 初始化时建立物理连接的个数。初始化发生在显示调用init方法,或者第一次getConnection时 - min-idle: 50 # 最小连接池数量 - maxActive: 500 # 最大连接池数量 + min-idle: 100 # 最小连接池数量 + maxActive: 1000 # 最大连接池数量 maxWait: 600000000 # 获取连接时最大等待时间,单位毫秒。配置了maxWait之后,缺省启用公平锁,并发效率会有所下降,如果需要可以通过配置 timeBetweenEvictionRunsMillis: 600000 # 关闭空闲连接的检测时间间隔.Destroy线程会检测连接的间隔时间,如果连接空闲时间大于等于minEvictableIdleTimeMillis则关闭物理连接。 minEvictableIdleTimeMillis: 3000000 # 连接的最小生存时间.连接保持空闲而不被驱逐的最小时间 diff --git a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseReturnTest.java b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseReturnTest.java index 17965fdb..0e022b35 100644 --- a/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseReturnTest.java +++ b/buildpackage/src/test/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseReturnTest.java @@ -25,10 +25,13 @@ public class ProxyPurchaseReturnTest { @Test public void startImplement() { try { - proxyPurchaseReturn.startImplement("LETS-SH2024082700000005"); +// proxyPurchaseReturn.startImplement("LETS-SH2024082700000005"); // proxyPurchaseReturn.startImplement("2024-01-01 00:00:00", "2024-08-07 23:59:59"); + + +// proxyPurchaseReturn.u8cOperationFlow(); } catch (Exception e) { e.printStackTrace(); }