From 913889998ec1b7478784c97bca851a0e9f4633de Mon Sep 17 00:00:00 2001 From: liuy <37787198+LiuyCodes@users.noreply.github.com> Date: Thu, 8 Aug 2024 09:52:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4TOC=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=88=B0=E6=9C=AC=E5=9C=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin/lets/dao/IBdInvbasdocDao.java | 8 + .../plugin/lets/dao/IBdInvmandocDao.java | 9 + .../frame/plugin/lets/dao/IBdTaxitemsDao.java | 9 + .../lets/dao/impl/BdInvbasdocDaoImpl.java | 12 + .../lets/dao/impl/BdInvmandocDaoImpl.java | 11 +- .../lets/dao/impl/BdTaxitemsDaoImpl.java | 9 +- .../plugin/lets/entity/BdCalbodyEntity.java | 45 +- .../plugin/lets/entity/BdInvmandocEntity.xml | 105 +++- .../plugin/lets/entity/BdTaxitemsEntity.java | 13 + .../plugin/lets/entity/BdTaxitemsEntity.xml | 17 +- .../entity/TocofsSaleoutDetailedEntity.java | 60 +++ .../entity/TocofsSaleoutDetailedEntity.xml | 254 ++++++---- .../lets/ofs/entity/TocofsSaleoutEntity.java | 12 + .../lets/ofs/entity/TocofsSaleoutEntity.xml | 45 +- .../lets/ofsvo/QueryOfsSoSaleOutVo.java | 10 + .../sales/SoSaleOutPluginInitializerToC.java | 478 ++++++++++++++++-- .../plugin/lets/u8cdto/SonDetailsDto.java | 187 +++++++ .../lets/util/BasicArchivesCacheUtil.java | 103 +++- .../plugin/lets/util/QueryBdBusitypeUtil.java | 41 ++ .../dto/ofssaleorderoutsearch/HeaderDto.java | 26 + .../aop/AopDynamicRoutingDataSourceInit.java | 3 +- 21 files changed, 1245 insertions(+), 212 deletions(-) create mode 100644 buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/SonDetailsDto.java create mode 100644 buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/QueryBdBusitypeUtil.java diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/dao/IBdInvbasdocDao.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/dao/IBdInvbasdocDao.java index cb65fb4b..2fb6e1eb 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/dao/IBdInvbasdocDao.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/dao/IBdInvbasdocDao.java @@ -3,6 +3,8 @@ package com.hzya.frame.plugin.lets.dao; import com.hzya.frame.basedao.dao.IBaseDao; import com.hzya.frame.plugin.lets.entity.BdInvbasdocEntity; +import java.util.List; + /** * (bd_invbasdoc: table)表数据库访问层 * @@ -18,5 +20,11 @@ public interface IBdInvbasdocDao extends IBaseDao { */ BdInvbasdocEntity queryBdInvbasdocByPkInvmandoc(BdInvbasdocEntity bdInvbasdocEntity) throws Exception; + /** + * 查询存货基础档案 + * + * @author liuyang + */ + List queryBdInvbasdocByPkInvmandocV2(BdInvbasdocEntity bdInvbasdocEntity) throws Exception; } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/dao/IBdInvmandocDao.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/dao/IBdInvmandocDao.java index c4e3247f..009520b4 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/dao/IBdInvmandocDao.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/dao/IBdInvmandocDao.java @@ -3,6 +3,8 @@ package com.hzya.frame.plugin.lets.dao; import com.hzya.frame.basedao.dao.IBaseDao; import com.hzya.frame.plugin.lets.entity.BdInvmandocEntity; +import java.util.List; + /** * (bd_invmandoc: table)表数据库访问层 * @@ -17,4 +19,11 @@ public interface IBdInvmandocDao extends IBaseDao { * @author liuyang */ BdInvmandocEntity queryBdInvmandocByInvcode(BdInvmandocEntity bdInvmandocEntity) throws Exception; + + /** + * 根据存货编码查询存货管理档案 + * + * @author liuyang + */ + List queryBdInvmandocByInvcodeList(BdInvmandocEntity bdInvmandocEntity) throws Exception; } \ No newline at end of file diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/dao/IBdTaxitemsDao.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/dao/IBdTaxitemsDao.java index 801486b1..04d44b1d 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/dao/IBdTaxitemsDao.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/dao/IBdTaxitemsDao.java @@ -3,6 +3,8 @@ package com.hzya.frame.plugin.lets.dao; import com.hzya.frame.basedao.dao.IBaseDao; import com.hzya.frame.plugin.lets.entity.BdTaxitemsEntity; +import java.util.List; + /** * (bd_taxitems: table)表数据库访问层 * @@ -17,4 +19,11 @@ public interface IBdTaxitemsDao extends IBaseDao { * @author liuyang */ BdTaxitemsEntity queryBdInvbasdocByInvcode(BdTaxitemsEntity bdTaxitemsEntity) throws Exception; + + /** + * 根据存货编码查询税率 + * + * @author liuyang + */ + List queryBdInvbasdocByInvcodeV2(BdTaxitemsEntity bdTaxitemsEntity) throws Exception; } \ No newline at end of file diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/dao/impl/BdInvbasdocDaoImpl.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/dao/impl/BdInvbasdocDaoImpl.java index f78535be..5069486e 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/dao/impl/BdInvbasdocDaoImpl.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/dao/impl/BdInvbasdocDaoImpl.java @@ -6,6 +6,8 @@ import com.hzya.frame.basedao.dao.MybatisGenericDao; import com.hzya.frame.plugin.lets.dao.IBdInvbasdocDao; import com.hzya.frame.plugin.lets.entity.BdInvbasdocEntity; +import java.util.List; + /** * (BdInvbasdoc)表数据库访问层 * @@ -24,4 +26,14 @@ public class BdInvbasdocDaoImpl extends MybatisGenericDao queryBdInvbasdocByPkInvmandocV2(BdInvbasdocEntity bdInvbasdocEntity) throws Exception { + Assert.notNull(bdInvbasdocEntity, "BdInvmandocEntity不可为空!"); +// Assert.notNull(bdInvbasdocEntity.getPk_invmandoc(), "pkInvmandoc不可为空!"); +// Assert.notNull(bdInvbasdocEntity.getPk_corp(), "存货管理档案公司主键不能为空"); + + List bdInvbasdocEntities = queryList(bdInvbasdocEntity, "com.hzya.frame.plugin.lets.dao.impl.BdInvbasdocDaoImpl.queryBdInvbasdocByPkInvmandoc"); + return bdInvbasdocEntities; + } } \ No newline at end of file diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/dao/impl/BdInvmandocDaoImpl.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/dao/impl/BdInvmandocDaoImpl.java index 83cba808..1247f857 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/dao/impl/BdInvmandocDaoImpl.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/dao/impl/BdInvmandocDaoImpl.java @@ -16,12 +16,12 @@ import java.util.List; */ //@Repository("BdInvmandocDaoImpl") public class BdInvmandocDaoImpl extends MybatisGenericDao implements IBdInvmandocDao { - @DS("sowow_sqlserver_test") + @DS("lets_u8c") @Override public BdInvmandocEntity queryBdInvmandocByInvcode(BdInvmandocEntity bdInvmandocEntity) throws Exception { Assert.notNull(bdInvmandocEntity, "bdInvmandocEntity must not be null"); // Assert.notNull(bdInvmandocEntity.getInvcode(), "存货档案编码不能为空"); - Assert.notNull(bdInvmandocEntity.getPkCorp(), "存货档案所属企业id不能为空"); +// Assert.notNull(bdInvmandocEntity.getPkCorp(), "存货档案所属企业id不能为空"); List bdInvmandocEntityList = query("com.hzya.frame.plugin.lets.dao.impl.BdInvmandocDaoImpl.queryBdInvmandocByInvcode", bdInvmandocEntity); if (bdInvmandocEntityList != null && bdInvmandocEntityList.size() > 0) { @@ -29,4 +29,11 @@ public class BdInvmandocDaoImpl extends MybatisGenericDao queryBdInvmandocByInvcodeList(BdInvmandocEntity bdInvmandocEntity) throws Exception { + Assert.notNull(bdInvmandocEntity, "bdInvmandocEntity must not be null!"); + return query("com.hzya.frame.plugin.lets.dao.impl.BdInvmandocDaoImpl.queryBdInvmandocByInvcode", bdInvmandocEntity); + } } \ No newline at end of file diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/dao/impl/BdTaxitemsDaoImpl.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/dao/impl/BdTaxitemsDaoImpl.java index 4f57801f..efc749f7 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/dao/impl/BdTaxitemsDaoImpl.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/dao/impl/BdTaxitemsDaoImpl.java @@ -15,7 +15,7 @@ import java.util.List; * @since 2023-08-30 18:32:17 */ public class BdTaxitemsDaoImpl extends MybatisGenericDao implements IBdTaxitemsDao { - @DS("sowow_sqlserver_test") + @DS("lets_u8c") @Override public BdTaxitemsEntity queryBdInvbasdocByInvcode(BdTaxitemsEntity bdTaxitemsEntity) throws Exception { Assert.notNull(bdTaxitemsEntity, "bdTaxitemsEntity不能为空"); @@ -27,4 +27,11 @@ public class BdTaxitemsDaoImpl extends MybatisGenericDao queryBdInvbasdocByInvcodeV2(BdTaxitemsEntity bdTaxitemsEntity) throws Exception { + List bdTaxitemsEntityList = query("com.hzya.frame.plugin.lets.dao.impl.BdTaxitemsDaoImpl.queryBdInvbasdocByInvcodeV2", bdTaxitemsEntity); + return bdTaxitemsEntityList; + } } \ No newline at end of file diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdCalbodyEntity.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdCalbodyEntity.java index ed1846cf..fec31c52 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdCalbodyEntity.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdCalbodyEntity.java @@ -1,6 +1,7 @@ package com.hzya.frame.plugin.lets.entity; import com.hzya.frame.web.entity.BaseEntity; + /** * (BdCalbody)实体类 * @@ -8,28 +9,28 @@ import com.hzya.frame.web.entity.BaseEntity; * @since 2023-09-06 17:31:08 */ public class BdCalbodyEntity extends BaseEntity { - - private Integer aheaddays; - private String area; - private String bodycode; - private String bodyname; - private String createdate; - private String def1; - private String def2; - private String def3; - private String def4; - private String def5; - private Integer dr; - private String isuseretail; - private String pkAddress; - private String pkAreacl; - private String pkCalbody; - private String pkCorp; - private Integer property; - private Double rationmny; - private String sealflag; - private String ts; - private String vnote; + + private Integer aheaddays; + private String area; + private String bodycode; + private String bodyname; + private String createdate; + private String def1; + private String def2; + private String def3; + private String def4; + private String def5; + private Integer dr; + private String isuseretail; + private String pkAddress; + private String pkAreacl; + private String pkCalbody; + private String pkCorp; + private Integer property; + private Double rationmny; + private String sealflag; + private String ts; + private String vnote; public Integer getAheaddays() { diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdInvmandocEntity.xml b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdInvmandocEntity.xml index 11809469..9af380e8 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdInvmandocEntity.xml +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdInvmandocEntity.xml @@ -96,6 +96,8 @@ + + @@ -1128,7 +1130,103 @@ update bd_invmandoc set sts= 'N' diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdTaxitemsEntity.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdTaxitemsEntity.java index dfd34d21..396b7ef4 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdTaxitemsEntity.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdTaxitemsEntity.java @@ -22,6 +22,19 @@ public class BdTaxitemsEntity extends BaseEntity { */ private String invcode; + /** + * 存货档案主键 + */ + private String pk_invbasdoc; + + public String getPk_invbasdoc() { + return pk_invbasdoc; + } + + public void setPk_invbasdoc(String pk_invbasdoc) { + this.pk_invbasdoc = pk_invbasdoc; + } + public String getInvcode() { return invcode; } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdTaxitemsEntity.xml b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdTaxitemsEntity.xml index dc63c9d7..3bcc29d9 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdTaxitemsEntity.xml +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdTaxitemsEntity.xml @@ -9,6 +9,8 @@ + + @@ -189,5 +191,18 @@ ) and dr = 0 - + + + \ No newline at end of file diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutDetailedEntity.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutDetailedEntity.java index a11c6eba..4011c752 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutDetailedEntity.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutDetailedEntity.java @@ -134,6 +134,66 @@ public class TocofsSaleoutDetailedEntity extends BaseEntity { // this.rootid = rootid; // } + private String newTransmitInfo; + + private String newPushDate; + + private String newState; + + private String newSystemNumber; + + private String newSystemPrimary; + + private String primaryKey; + + public String getNewTransmitInfo() { + return newTransmitInfo; + } + + public void setNewTransmitInfo(String newTransmitInfo) { + this.newTransmitInfo = newTransmitInfo; + } + + public String getNewPushDate() { + return newPushDate; + } + + public void setNewPushDate(String newPushDate) { + this.newPushDate = newPushDate; + } + + public String getNewState() { + return newState; + } + + public void setNewState(String newState) { + this.newState = newState; + } + + public String getNewSystemNumber() { + return newSystemNumber; + } + + public void setNewSystemNumber(String newSystemNumber) { + this.newSystemNumber = newSystemNumber; + } + + public String getNewSystemPrimary() { + return newSystemPrimary; + } + + public void setNewSystemPrimary(String newSystemPrimary) { + this.newSystemPrimary = newSystemPrimary; + } + + public String getPrimaryKey() { + return primaryKey; + } + + public void setPrimaryKey(String primaryKey) { + this.primaryKey = primaryKey; + } + public String getClientcode() { return clientcode; } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutDetailedEntity.xml b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutDetailedEntity.xml index 5971c618..b0903b31 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutDetailedEntity.xml +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutDetailedEntity.xml @@ -32,6 +32,14 @@ + + + + + + + + @@ -62,7 +70,13 @@ ,created ,createdBy ,lastUpdated - ,lastUpdatedBy + ,lastUpdatedBy + ,newTransmitInfo + ,newPushDate + ,newState + ,newSystemNumber + ,newSystemPrimary + ,primaryKey @@ -138,10 +158,16 @@ and createdBy = #{createdby} and lastUpdated = #{lastupdated} and lastUpdatedBy = #{lastupdatedby} - and sts='Y' +-- and sts='Y' + and newTransmitInfo = #{newTransmitInfo} + and newPushDate = #{newPushDate} + and newState = #{newState} + and newSystemNumber = #{newSystemNumber} + and newSystemPrimary = #{newSystemPrimary} + and primaryKey = #{primaryKey} - order by sorts asc - order by ${sort} ${order} + + @@ -179,10 +205,16 @@ and createdBy like concat('%',#{createdby},'%') and lastUpdated like concat('%',#{lastupdated},'%') and lastUpdatedBy like concat('%',#{lastupdatedby},'%') - and sts='Y' +-- and sts='Y' + and newTransmitInfo like concat('%',#{newTransmitInfo},'%') + and newPushDate like concat('%',#{newPushDate},'%') + and newState like concat('%',#{newState},'%') + and newSystemNumber like concat('%',#{newSystemNumber},'%') + and newSystemPrimary like concat('%',#{newSystemPrimary},'%') + and primaryKey like concat('%',#{primaryKey},'%') - order by sorts asc - order by ${sort} ${order} + + @@ -220,108 +252,115 @@ or createdBy = #{createdby} or lastUpdated = #{lastupdated} or lastUpdatedBy = #{lastupdatedby} - and sts='Y' +-- and sts='Y' + or newTransmitInfo = #{newTransmitInfo} + or newPushDate = #{newPushDate} + or newState = #{newState} + or newSystemNumber = #{newSystemNumber} + or newSystemPrimary = #{newSystemPrimary} + or primaryKey = #{primaryKey} - order by sorts asc - order by ${sort} ${order} + + - - insert into tocofs_saleout_detailed( - --- rootId , - clientCode , - companyCode , - facilityCode , - shipmentCode , - refOrderId , - refOrderDetailId , - refOrderCode , - allocInvId , - skuCode , - skuName , - sourceOrderCode , - inventorySts , - isGift , - requestQty , - shipQty , - quantityUM , - listPrice , - itemTotalAmount , - totalPayAmount , - totalWeight , - totalVolume , - totalVolumeWeight , - weightUM , - volumeUM , - created , - createdBy , - lastUpdated , - lastUpdatedBy , - sorts, - sts, - - )values( - --- #{rootid} , - #{clientcode} , - #{companycode} , - #{facilitycode} , - #{shipmentcode} , - #{reforderid} , - #{reforderdetailid} , - #{refordercode} , - #{allocinvid} , - #{skucode} , - #{skuname} , - #{sourceordercode} , - #{inventorysts} , - #{isgift} , - #{requestqty} , - #{shipqty} , - #{quantityum} , - #{listprice} , - #{itemtotalamount} , - #{totalpayamount} , - #{totalweight} , - #{totalvolume} , - #{totalvolumeweight} , - #{weightum} , - #{volumeum} , - #{created} , - #{createdby} , - #{lastupdated} , - #{lastupdatedby} , - (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from tocofs_saleout_detailed a WHERE a.sts = 'Y' ), - 'Y', - - ) - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - insert into tocofs_saleout_detailed(clientCode, companyCode, facilityCode, shipmentCode, refOrderId, refOrderDetailId, refOrderCode, allocInvId, skuCode, skuName, sourceOrderCode, inventorySts, isGift, requestQty, shipQty, quantityUM, listPrice, itemTotalAmount, totalPayAmount, totalWeight, totalVolume, totalVolumeWeight, weightUM, volumeUM, created, createdBy, lastUpdated, lastUpdatedBy, sts) - values - - (#{entity.clientcode},#{entity.companycode},#{entity.facilitycode},#{entity.shipmentcode},#{entity.reforderid},#{entity.reforderdetailid},#{entity.refordercode},#{entity.allocinvid},#{entity.skucode},#{entity.skuname},#{entity.sourceordercode},#{entity.inventorysts},#{entity.isgift},#{entity.requestqty},#{entity.shipqty},#{entity.quantityum},#{entity.listprice},#{entity.itemtotalamount},#{entity.totalpayamount},#{entity.totalweight},#{entity.totalvolume},#{entity.totalvolumeweight},#{entity.weightum},#{entity.volumeum},#{entity.created},#{entity.createdby},#{entity.lastupdated},#{entity.lastupdatedby}, 'Y') - - + + + + + + + - insert IGNORE into tocofs_saleout_detailed(clientCode, companyCode, facilityCode, shipmentCode, refOrderId, refOrderDetailId, refOrderCode, allocInvId, skuCode, skuName, sourceOrderCode, inventorySts, isGift, requestQty, shipQty, quantityUM, listPrice, itemTotalAmount, totalPayAmount, totalWeight, totalVolume, totalVolumeWeight, weightUM, volumeUM, created, createdBy, lastUpdated, lastUpdatedBy) + insert IGNORE into tocofs_saleout_detailed(clientCode, companyCode, facilityCode, shipmentCode, refOrderId, refOrderDetailId, refOrderCode, allocInvId, skuCode, skuName, sourceOrderCode, inventorySts, isGift, requestQty, shipQty, quantityUM, listPrice, itemTotalAmount, totalPayAmount, totalWeight, totalVolume, totalVolumeWeight, weightUM, volumeUM, created, createdBy, lastUpdated, lastUpdatedBy,newTransmitInfo,newPushDate,newState,newSystemNumber,newSystemPrimary,primaryKey) values - (#{entity.clientcode},#{entity.companycode},#{entity.facilitycode},#{entity.shipmentcode},#{entity.reforderid},#{entity.reforderdetailid},#{entity.refordercode},#{entity.allocinvid},#{entity.skucode},#{entity.skuname},#{entity.sourceordercode},#{entity.inventorysts},#{entity.isgift},#{entity.requestqty},#{entity.shipqty},#{entity.quantityum},#{entity.listprice},#{entity.itemtotalamount},#{entity.totalpayamount},#{entity.totalweight},#{entity.totalvolume},#{entity.totalvolumeweight},#{entity.weightum},#{entity.volumeum},#{entity.created},#{entity.createdby},#{entity.lastupdated},#{entity.lastupdatedby}) + (#{entity.clientcode},#{entity.companycode},#{entity.facilitycode},#{entity.shipmentcode},#{entity.reforderid},#{entity.reforderdetailid},#{entity.refordercode},#{entity.allocinvid},#{entity.skucode},#{entity.skuname},#{entity.sourceordercode},#{entity.inventorysts},#{entity.isgift},#{entity.requestqty},#{entity.shipqty},#{entity.quantityum},#{entity.listprice},#{entity.itemtotalamount},#{entity.totalpayamount},#{entity.totalweight},#{entity.totalvolume},#{entity.totalvolumeweight},#{entity.weightum},#{entity.volumeum},#{entity.created},#{entity.createdby},#{entity.lastupdated},#{entity.lastupdatedby},#{entity.newTransmitInfo},#{entity.newPushDate},#{entity.newState},#{entity.newSystemNumber},#{entity.newSystemPrimary},#{entity.primaryKey}) - insert into tocofs_saleout_detailed(clientCode, companyCode, facilityCode, shipmentCode, refOrderId, refOrderDetailId, refOrderCode, allocInvId, skuCode, skuName, sourceOrderCode, inventorySts, isGift, requestQty, shipQty, quantityUM, listPrice, itemTotalAmount, totalPayAmount, totalWeight, totalVolume, totalVolumeWeight, weightUM, volumeUM, created, createdBy, lastUpdated, lastUpdatedBy) + insert into tocofs_saleout_detailed(clientCode, companyCode, facilityCode, shipmentCode, refOrderId, refOrderDetailId, refOrderCode, allocInvId, skuCode, skuName, sourceOrderCode, inventorySts, isGift, requestQty, shipQty, quantityUM, listPrice, itemTotalAmount, totalPayAmount, totalWeight, totalVolume, totalVolumeWeight, weightUM, volumeUM, created, createdBy, lastUpdated, lastUpdatedBy,newTransmitInfo,newPushDate,newState,newSystemNumber,newSystemPrimary,primaryKey) values - (#{entity.clientcode},#{entity.companycode},#{entity.facilitycode},#{entity.shipmentcode},#{entity.reforderid},#{entity.reforderdetailid},#{entity.refordercode},#{entity.allocinvid},#{entity.skucode},#{entity.skuname},#{entity.sourceordercode},#{entity.inventorysts},#{entity.isgift},#{entity.requestqty},#{entity.shipqty},#{entity.quantityum},#{entity.listprice},#{entity.itemtotalamount},#{entity.totalpayamount},#{entity.totalweight},#{entity.totalvolume},#{entity.totalvolumeweight},#{entity.weightum},#{entity.volumeum},#{entity.created},#{entity.createdby},#{entity.lastupdated},#{entity.lastupdatedby}) + (#{entity.clientcode},#{entity.companycode},#{entity.facilitycode},#{entity.shipmentcode},#{entity.reforderid},#{entity.reforderdetailid},#{entity.refordercode},#{entity.allocinvid},#{entity.skucode},#{entity.skuname},#{entity.sourceordercode},#{entity.inventorysts},#{entity.isgift},#{entity.requestqty},#{entity.shipqty},#{entity.quantityum},#{entity.listprice},#{entity.itemtotalamount},#{entity.totalpayamount},#{entity.totalweight},#{entity.totalvolume},#{entity.totalvolumeweight},#{entity.weightum},#{entity.volumeum},#{entity.created},#{entity.createdby},#{entity.lastupdatedby},#{entity.lastupdated},#{entity.newTransmitInfo},#{entity.newPushDate},#{entity.newState},#{entity.newSystemNumber},#{entity.newSystemPrimary},#{entity.primaryKey}) on duplicate key update clientCode = values(clientCode), @@ -351,7 +390,14 @@ created = values(created), createdBy = values(createdBy), lastUpdated = values(lastUpdated), - lastUpdatedBy = values(lastUpdatedBy) + lastUpdatedBy = values(lastUpdatedBy), + newTransmitInfo = values(newTransmitInfo), + newPushDate = values(newPushDate), + newState = values(newState), + newSystemNumber = values(newSystemNumber), + newSystemPrimary = values(newSystemPrimary), + primaryKey = values(primaryKey) + update tocofs_saleout_detailed set @@ -384,6 +430,12 @@ update tocofs_saleout_detailed set createdBy = #{createdby}, lastUpdated = #{lastupdated}, lastUpdatedBy = #{lastupdatedby}, + newTransmitInfo = #{newTransmitInfo}, + newPushDate = #{newPushDate}, + newState = #{newState}, + newSystemNumber = #{newSystemNumber}, + newSystemPrimary = #{newSystemPrimary}, + primaryKey = #{primaryKey}, where rootId = #{rootid} @@ -425,8 +477,14 @@ update tocofs_saleout_detailed set sts= 'N' ,modify_time = #{modify_time},modif and createdBy = #{createdby} and lastUpdated = #{lastupdated} and lastUpdatedBy = #{lastupdatedby} - and sts='Y' - +-- and sts='Y' + and newTransmitInfo = #{newTransmitInfo} + and newPushDate = #{newPushDate} + and newState = #{newState} + and newSystemNumber = #{newSystemNumber} + and newSystemPrimary = #{newSystemPrimary} + and primaryKey = #{primaryKey} + diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutEntity.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutEntity.java index 758a0180..8e6f0c54 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutEntity.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutEntity.java @@ -225,6 +225,18 @@ public class TocofsSaleoutEntity extends BaseEntity { */ private String shiptodistrictname; + /** + * 发货时间 + */ + private String shipAt; + + public String getShipAt() { + return shipAt; + } + + public void setShipAt(String shipAt) { + this.shipAt = shipAt; + } public String getClientcode() { return clientcode; diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutEntity.xml b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutEntity.xml index a943af39..e9d778e7 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutEntity.xml +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofs/entity/TocofsSaleoutEntity.xml @@ -63,6 +63,8 @@ + + @@ -126,7 +128,8 @@ ,taxPaid ,shipToStateName ,shipToCityName - ,shipToDistrictName + ,shipToDistrictName + ,shipAt @@ -195,10 +198,11 @@ and shipToStateName = #{shiptostatename} and shipToCityName = #{shiptocityname} and shipToDistrictName = #{shiptodistrictname} - and sts='Y' +-- and sts='Y' + and shipAt = #{shipAt} - order by sorts asc - order by ${sort} ${order} + + @@ -265,10 +269,11 @@ and shipToStateName = #{shiptostatename} and shipToCityName = #{shiptocityname} and shipToDistrictName = #{shiptodistrictname} - and sts='Y' +-- and sts='Y' + and shipAt = #{shipAt} - order by sorts asc - order by ${sort} ${order} + + @@ -337,10 +342,11 @@ and shipToStateName like concat('%',#{shiptostatename},'%') and shipToCityName like concat('%',#{shiptocityname},'%') and shipToDistrictName like concat('%',#{shiptodistrictname},'%') - and sts='Y' +-- and sts='Y' + and shipAt like concat('%',#{shipAt},'%') - order by sorts asc - order by ${sort} ${order} + + @@ -409,10 +415,11 @@ or shipToStateName = #{shiptostatename} or shipToCityName = #{shiptocityname} or shipToDistrictName = #{shiptodistrictname} - and sts='Y' +-- and sts='Y' + or shipAt = #{shipAt} - order by sorts asc - order by ${sort} ${order} + + @@ -561,19 +568,19 @@ - insert IGNORE into tocofs_saleout(id,clientCode, companyCode, storeCode, facilityCode, code, refOrderId, refOrderCode, refOrderType, status, consolidated, internalInstructionType, bizChannel, sourcePlatformCode, processType, sourceOrderId, sourceOrderCode, sourceUserAccount, shipToAttentionTo, shipToAddress, shipToCountry, shipToState, shipToCity, shipToDistrict, shipToMobile, totalLines, totalQty, totalContainers, totalCases, totalWeight, totalVolume, totalVolumeWeight, weightUM, volumeUM, totalAmount, totalPayAmount, postageAmount, itemTotalAmount, carrierCode, paymentStatus, codRequired, invoiceRequired, paidAt, shipFromAttentionTo, shipFromAddress, shipFromDistrict, shipFromCity, shipFromState, shipFromCountry, shipFromPostalCode, shipFromPhone, shipFromMobile, shipFromFax, shipFromEmail, codAmount, tax, taxPaid, shipToStateName, shipToCityName, shipToDistrictName) + insert IGNORE into tocofs_saleout(id,clientCode, companyCode, storeCode, facilityCode, code, refOrderId, refOrderCode, refOrderType, status, consolidated, internalInstructionType, bizChannel, sourcePlatformCode, processType, sourceOrderId, sourceOrderCode, sourceUserAccount, shipToAttentionTo, shipToAddress, shipToCountry, shipToState, shipToCity, shipToDistrict, shipToMobile, totalLines, totalQty, totalContainers, totalCases, totalWeight, totalVolume, totalVolumeWeight, weightUM, volumeUM, totalAmount, totalPayAmount, postageAmount, itemTotalAmount, carrierCode, paymentStatus, codRequired, invoiceRequired, paidAt, shipFromAttentionTo, shipFromAddress, shipFromDistrict, shipFromCity, shipFromState, shipFromCountry, shipFromPostalCode, shipFromPhone, shipFromMobile, shipFromFax, shipFromEmail, codAmount, tax, taxPaid, shipToStateName, shipToCityName, shipToDistrictName,shipAt) values - (#{entity.id},#{entity.clientcode},#{entity.companycode},#{entity.storecode},#{entity.facilitycode},#{entity.code},#{entity.reforderid},#{entity.refordercode},#{entity.refordertype},#{entity.status},#{entity.consolidated},#{entity.internalinstructiontype},#{entity.bizchannel},#{entity.sourceplatformcode},#{entity.processtype},#{entity.sourceorderid},#{entity.sourceordercode},#{entity.sourceuseraccount},#{entity.shiptoattentionto},#{entity.shiptoaddress},#{entity.shiptocountry},#{entity.shiptostate},#{entity.shiptocity},#{entity.shiptodistrict},#{entity.shiptomobile},#{entity.totallines},#{entity.totalqty},#{entity.totalcontainers},#{entity.totalcases},#{entity.totalweight},#{entity.totalvolume},#{entity.totalvolumeweight},#{entity.weightum},#{entity.volumeum},#{entity.totalamount},#{entity.totalpayamount},#{entity.postageamount},#{entity.itemtotalamount},#{entity.carriercode},#{entity.paymentstatus},#{entity.codrequired},#{entity.invoicerequired},#{entity.paidat},#{entity.shipfromattentionto},#{entity.shipfromaddress},#{entity.shipfromdistrict},#{entity.shipfromcity},#{entity.shipfromstate},#{entity.shipfromcountry},#{entity.shipfrompostalcode},#{entity.shipfromphone},#{entity.shipfrommobile},#{entity.shipfromfax},#{entity.shipfromemail},#{entity.codamount},#{entity.tax},#{entity.taxpaid},#{entity.shiptostatename},#{entity.shiptocityname},#{entity.shiptodistrictname}) + (#{entity.id},#{entity.clientcode},#{entity.companycode},#{entity.storecode},#{entity.facilitycode},#{entity.code},#{entity.reforderid},#{entity.refordercode},#{entity.refordertype},#{entity.status},#{entity.consolidated},#{entity.internalinstructiontype},#{entity.bizchannel},#{entity.sourceplatformcode},#{entity.processtype},#{entity.sourceorderid},#{entity.sourceordercode},#{entity.sourceuseraccount},#{entity.shiptoattentionto},#{entity.shiptoaddress},#{entity.shiptocountry},#{entity.shiptostate},#{entity.shiptocity},#{entity.shiptodistrict},#{entity.shiptomobile},#{entity.totallines},#{entity.totalqty},#{entity.totalcontainers},#{entity.totalcases},#{entity.totalweight},#{entity.totalvolume},#{entity.totalvolumeweight},#{entity.weightum},#{entity.volumeum},#{entity.totalamount},#{entity.totalpayamount},#{entity.postageamount},#{entity.itemtotalamount},#{entity.carriercode},#{entity.paymentstatus},#{entity.codrequired},#{entity.invoicerequired},#{entity.paidat},#{entity.shipfromattentionto},#{entity.shipfromaddress},#{entity.shipfromdistrict},#{entity.shipfromcity},#{entity.shipfromstate},#{entity.shipfromcountry},#{entity.shipfrompostalcode},#{entity.shipfromphone},#{entity.shipfrommobile},#{entity.shipfromfax},#{entity.shipfromemail},#{entity.codamount},#{entity.tax},#{entity.taxpaid},#{entity.shiptostatename},#{entity.shiptocityname},#{entity.shiptodistrictname},#{entity.shipAt}) - insert into tocofs_saleout(clientCode, companyCode, storeCode, facilityCode, code, refOrderId, refOrderCode, refOrderType, status, consolidated, internalInstructionType, bizChannel, sourcePlatformCode, processType, sourceOrderId, sourceOrderCode, sourceUserAccount, shipToAttentionTo, shipToAddress, shipToCountry, shipToState, shipToCity, shipToDistrict, shipToMobile, totalLines, totalQty, totalContainers, totalCases, totalWeight, totalVolume, totalVolumeWeight, weightUM, volumeUM, totalAmount, totalPayAmount, postageAmount, itemTotalAmount, carrierCode, paymentStatus, codRequired, invoiceRequired, paidAt, shipFromAttentionTo, shipFromAddress, shipFromDistrict, shipFromCity, shipFromState, shipFromCountry, shipFromPostalCode, shipFromPhone, shipFromMobile, shipFromFax, shipFromEmail, codAmount, tax, taxPaid, shipToStateName, shipToCityName, shipToDistrictName) + insert into tocofs_saleout(clientCode, companyCode, storeCode, facilityCode, code, refOrderId, refOrderCode, refOrderType, status, consolidated, internalInstructionType, bizChannel, sourcePlatformCode, processType, sourceOrderId, sourceOrderCode, sourceUserAccount, shipToAttentionTo, shipToAddress, shipToCountry, shipToState, shipToCity, shipToDistrict, shipToMobile, totalLines, totalQty, totalContainers, totalCases, totalWeight, totalVolume, totalVolumeWeight, weightUM, volumeUM, totalAmount, totalPayAmount, postageAmount, itemTotalAmount, carrierCode, paymentStatus, codRequired, invoiceRequired, paidAt, shipFromAttentionTo, shipFromAddress, shipFromDistrict, shipFromCity, shipFromState, shipFromCountry, shipFromPostalCode, shipFromPhone, shipFromMobile, shipFromFax, shipFromEmail, codAmount, tax, taxPaid, shipToStateName, shipToCityName, shipToDistrictName,shipAt) values - (#{entity.clientcode},#{entity.companycode},#{entity.storecode},#{entity.facilitycode},#{entity.code},#{entity.reforderid},#{entity.refordercode},#{entity.refordertype},#{entity.status},#{entity.consolidated},#{entity.internalinstructiontype},#{entity.bizchannel},#{entity.sourceplatformcode},#{entity.processtype},#{entity.sourceorderid},#{entity.sourceordercode},#{entity.sourceuseraccount},#{entity.shiptoattentionto},#{entity.shiptoaddress},#{entity.shiptocountry},#{entity.shiptostate},#{entity.shiptocity},#{entity.shiptodistrict},#{entity.shiptomobile},#{entity.totallines},#{entity.totalqty},#{entity.totalcontainers},#{entity.totalcases},#{entity.totalweight},#{entity.totalvolume},#{entity.totalvolumeweight},#{entity.weightum},#{entity.volumeum},#{entity.totalamount},#{entity.totalpayamount},#{entity.postageamount},#{entity.itemtotalamount},#{entity.carriercode},#{entity.paymentstatus},#{entity.codrequired},#{entity.invoicerequired},#{entity.paidat},#{entity.shipfromattentionto},#{entity.shipfromaddress},#{entity.shipfromdistrict},#{entity.shipfromcity},#{entity.shipfromstate},#{entity.shipfromcountry},#{entity.shipfrompostalcode},#{entity.shipfromphone},#{entity.shipfrommobile},#{entity.shipfromfax},#{entity.shipfromemail},#{entity.codamount},#{entity.tax},#{entity.taxpaid},#{entity.shiptostatename},#{entity.shiptocityname},#{entity.shiptodistrictname}) + (#{entity.clientcode},#{entity.companycode},#{entity.storecode},#{entity.facilitycode},#{entity.code},#{entity.reforderid},#{entity.refordercode},#{entity.refordertype},#{entity.status},#{entity.consolidated},#{entity.internalinstructiontype},#{entity.bizchannel},#{entity.sourceplatformcode},#{entity.processtype},#{entity.sourceorderid},#{entity.sourceordercode},#{entity.sourceuseraccount},#{entity.shiptoattentionto},#{entity.shiptoaddress},#{entity.shiptocountry},#{entity.shiptostate},#{entity.shiptocity},#{entity.shiptodistrict},#{entity.shiptomobile},#{entity.totallines},#{entity.totalqty},#{entity.totalcontainers},#{entity.totalcases},#{entity.totalweight},#{entity.totalvolume},#{entity.totalvolumeweight},#{entity.weightum},#{entity.volumeum},#{entity.totalamount},#{entity.totalpayamount},#{entity.postageamount},#{entity.itemtotalamount},#{entity.carriercode},#{entity.paymentstatus},#{entity.codrequired},#{entity.invoicerequired},#{entity.paidat},#{entity.shipfromattentionto},#{entity.shipfromaddress},#{entity.shipfromdistrict},#{entity.shipfromcity},#{entity.shipfromstate},#{entity.shipfromcountry},#{entity.shipfrompostalcode},#{entity.shipfromphone},#{entity.shipfrommobile},#{entity.shipfromfax},#{entity.shipfromemail},#{entity.codamount},#{entity.tax},#{entity.taxpaid},#{entity.shiptostatename},#{entity.shiptocityname},#{entity.shiptodistrictname},#{entity.shipAt}) on duplicate key update clientCode = values(clientCode), @@ -634,7 +641,9 @@ taxPaid = values(taxPaid), shipToStateName = values(shipToStateName), shipToCityName = values(shipToCityName), - shipToDistrictName = values(shipToDistrictName) + shipToDistrictName = values(shipToDistrictName), + shipAt = values(shipAt) + diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofsvo/QueryOfsSoSaleOutVo.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofsvo/QueryOfsSoSaleOutVo.java index ffc03246..cf505678 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofsvo/QueryOfsSoSaleOutVo.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/ofsvo/QueryOfsSoSaleOutVo.java @@ -26,6 +26,16 @@ public class QueryOfsSoSaleOutVo { private Long pageSize; + private String code; + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + public String getInternalInstructionType() { return internalInstructionType; } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToC.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToC.java index c4325660..1bd0856a 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToC.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToC.java @@ -14,26 +14,30 @@ import com.hzya.frame.plugin.lets.ofs.entity.TocofsSaleoutDetailedEntity; import com.hzya.frame.plugin.lets.ofs.entity.TocofsSaleoutEntity; import com.hzya.frame.plugin.lets.ofs.service.ITocofsSaleoutService; import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo; -import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleVo; import com.hzya.frame.plugin.lets.resultvo.CalculateDateVo; +import com.hzya.frame.plugin.lets.u8cdto.SaleorderRequestChildrenDto; +import com.hzya.frame.plugin.lets.u8cdto.SaleorderRequestDto; +import com.hzya.frame.plugin.lets.u8cdto.SaleorderRequestParentDto; +import com.hzya.frame.plugin.lets.u8cdto.SonDetailsDto; import com.hzya.frame.plugin.lets.util.BasicArchivesCacheUtil; import com.hzya.frame.plugin.lets.util.DateStrUtil; +import com.hzya.frame.plugin.lets.util.QueryBdBusitypeUtil; import com.hzya.frame.split.SplitListByCountUtil; import com.hzya.frame.ttxofs.dto.InterfaceParamDto; +import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.DetailsDto; +import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto; +import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDto; import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.SaleOutReturnMessageDto; -import com.hzya.frame.ttxofs.dto.ofssalesordersearch.DetailsDto; -import com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDetailsDto; -import com.hzya.frame.ttxofs.dto.ofssalesordersearch.HeaderDto; -import com.hzya.frame.ttxofs.dto.ofssalesordersearch.SaleReturnMessageDto; import com.hzya.frame.ttxofs.service.OfsUnifiedService; import com.hzya.frame.web.entity.JsonResultEntity; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; +import java.math.BigDecimal; import java.util.*; import java.util.concurrent.locks.ReentrantLock; +import java.util.stream.Collectors; /** * OFS销售出库单(TOC)生成U8C销售订单 @@ -97,6 +101,13 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { @Autowired private ITocofsSaleoutDetailedDao iTocofsSaleoutDetailedDao; + @Autowired + private QueryBdBusitypeUtil queryBdBusitypeUtil; + + private static final String NOTHING = "无"; + + private static final String ADD = "+"; + /** * 按指定时间拉取 * @@ -116,21 +127,24 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { List headerDetailsDtoList = new ArrayList<>(); QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); - queryOfsSoSaleOutVo.setCreated_start("2024-03-27 12:03:30"); - queryOfsSoSaleOutVo.setCreated_end("2024-03-27 12:04:00"); + queryOfsSoSaleOutVo.setCreated_start("2024-07-05 16:38:00"); + queryOfsSoSaleOutVo.setCreated_end("2024-07-05 16:40:30"); queryOfsSoSaleOutVo.setClientCode("LETS"); // queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); - queryOfsSoSaleOutVo.setCompanyCode("LETS"); + queryOfsSoSaleOutVo.setCompanyCode("SHLZ"); // queryOfsSoSaleOutVo.setStatus(900L); queryOfsSoSaleOutVo.setPageNo(1L); queryOfsSoSaleOutVo.setPageSize(50L); + queryOfsSoSaleOutVo.setCode("LETS-SH2024070500000003"); queryOfsSaleOrder(queryOfsSoSaleOutVo, headerDetailsDtoList, 1L); logger.info("数据返回行数:{}", headerDetailsDtoList.size()); if (headerDetailsDtoList.size() > 0) { //保存到mysql batchInsert(headerDetailsDtoList); //过滤成功的数据 + List headerDetailsDtos = filterData(headerDetailsDtoList); //执行推送主逻辑 + implement(headerDetailsDtos); } else { logger.info("没有查询到任何数据!不需要同步"); } @@ -150,7 +164,21 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { } /** - * 保存抓取到的数据到mysql底表 + * 过滤掉成功的数据 + * + * @author liuyang + */ + private List filterData(List headerDetailsDtoList) { + List headerDetailsDtoList1 = new ArrayList<>(); + if (headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) { + //TODO 出库单明细主键,需要O返回,目前没有,已经提需求 + headerDetailsDtoList1.addAll(headerDetailsDtoList); + } + return headerDetailsDtoList1; + } + + /** + * 保存抓取到的数据到mysql底表,如果底表里已经存在,则会忽略 * * @param headerDetailsDtoList 数据行 */ @@ -223,41 +251,165 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { } } - public void queryOfsSaleOrder() throws Exception { - QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); - queryOfsSoSaleOutVo.setCreated_start("2024-03-27 12:03:30"); - queryOfsSoSaleOutVo.setCreated_end("2024-03-27 12:04:00"); - queryOfsSoSaleOutVo.setClientCode("LETS"); -// queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); - queryOfsSoSaleOutVo.setCompanyCode("LETS"); -// queryOfsSoSaleOutVo.setStatus(900L); - queryOfsSoSaleOutVo.setPageNo(1L); - queryOfsSoSaleOutVo.setPageSize(50L); - - InterfaceParamDto interfaceParamDto = new InterfaceParamDto(); - interfaceParamDto.setApi("ofs.shipment.search"); - interfaceParamDto.setData(JSON.toJSONString(queryOfsSoSaleOutVo)); - SaleOutReturnMessageDto saleOutReturnMessageDto = (SaleOutReturnMessageDto) ofsUnifiedService.unified(interfaceParamDto); - System.out.println(saleOutReturnMessageDto); - } +// public void queryOfsSaleOrder() throws Exception { +// QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); +// queryOfsSoSaleOutVo.setCreated_start("2024-07-05 16:38:00"); +// queryOfsSoSaleOutVo.setCreated_end("2024-07-05 16:40:30"); +// queryOfsSoSaleOutVo.setClientCode("LETS"); +//// queryOfsSoSaleOutVo.setInternalInstructionType("SALES"); +// queryOfsSoSaleOutVo.setCompanyCode("SHLZ"); +//// queryOfsSoSaleOutVo.setStatus(900L); +// queryOfsSoSaleOutVo.setPageNo(1L); +// queryOfsSoSaleOutVo.setPageSize(50L); +// queryOfsSoSaleOutVo.setCode("LETS-SH2024070500000003"); +// +// InterfaceParamDto interfaceParamDto = new InterfaceParamDto(); +// interfaceParamDto.setApi("ofs.shipment.search"); +// interfaceParamDto.setData(JSON.toJSONString(queryOfsSoSaleOutVo)); +// SaleOutReturnMessageDto saleOutReturnMessageDto = (SaleOutReturnMessageDto) ofsUnifiedService.unified(interfaceParamDto); +// System.out.println(saleOutReturnMessageDto); +// } /** * 代码同步逻辑 + * + * @param headerDetailsDtos 查询得到的O出库单对象 + * @author liuyang */ - private void implement(List headerDetailsDtoList) { - if (headerDetailsDtoList.size() > 0) { - for (HeaderDetailsDto headerDetailsDto : headerDetailsDtoList) { - HeaderDto header = headerDetailsDto.getHeader(); - List details = headerDetailsDto.getDetails(); + private void implement(List headerDetailsDtos) throws Exception { + if (headerDetailsDtos != null && headerDetailsDtos.size() > 0) { + try { + // 查询基本档案 + List sonDetailsDtoList = queryBasicArchives(headerDetailsDtos); + // 分组汇总 + Map> summaryDimensionMap = groupSummary(sonDetailsDtoList); + // 查询U8C业务流程 + BdBusitypeEntity bdBusitypeEntity = u8cOperationFlow(); - //生成业务日期 - String generateBusinessDate = createGenerateBusinessDate(header); + if (bdBusitypeEntity != null && summaryDimensionMap != null) { + Iterator>> iterator = summaryDimensionMap.entrySet().iterator(); + while (iterator.hasNext()) { + Map.Entry> entry = iterator.next(); + String keyGroup = entry.getKey(); + List oldValue = entry.getValue(); + HeaderDto header = oldValue.get(0).getHeader(); + BdCorpEntity bdCorpEntity = oldValue.get(0).getBdCorpEntity();//表头销售公司 + BdCorpEntity deliverGoodsCorp = oldValue.get(0).getDeliverGoodsCorp();//发货公司 + BdCalbodyEntity bdCalbodyEntity = oldValue.get(0).getBdCalbodyEntity();//发货仓库组织 + BdStordocEntity bdStordocEntity = oldValue.get(0).getBdStordocEntity();//发货仓库 + BdCalbodyEntity bdCalbodyEntity1 = oldValue.get(0).getBdCalbodyEntity1();//收货库存组织 + BdStordocEntity bdStordocEntity1 = oldValue.get(0).getBdStordocEntity1();//收货仓库 + BdSalestruEntity bdSalestruEntity = oldValue.get(0).getBdSalestruEntity();//销售组织 + BdDeptdocEntity bdDeptdocEntity = oldValue.get(0).getBdDeptdocEntity();//业务部门 + BdCumandocEntity bdCumandocEntity = oldValue.get(0).getBdCumandocEntity();//客商档案 - try { + try { + checkArchives(oldValue.get(0)); + //生成业务日期 + String generateBusinessDate = createGenerateBusinessDate(header); - } catch (Exception e) { - logger.error("数据转换过程中抛出异常:{}", e); + SaleorderRequestDto saleorderRequestDto = new SaleorderRequestDto(); + SaleorderRequestParentDto saleorderRequestParentDto = new SaleorderRequestParentDto(); + saleorderRequestParentDto.setDbilldate(generateBusinessDate);//单据日期 + saleorderRequestParentDto.setBretinvflag("N");//退货标记 + saleorderRequestParentDto.setCbiztype(bdBusitypeEntity.getPkBusitype());//业务流程 + saleorderRequestParentDto.setCcalbodyid(bdCalbodyEntity.getPkCalbody());//库存组织 + saleorderRequestParentDto.setCcustomerid(bdCumandocEntity.getPkCumandoc());//客户=开票单位=收货单位=表体收货单位=收货单位 + saleorderRequestParentDto.setCdeptid(bdDeptdocEntity.getPkDeptdoc());//部门 + saleorderRequestParentDto.setCemployeeid(null);//业务员 + saleorderRequestParentDto.setCoperatorid("0001A110000000000U3D");//制单人 + saleorderRequestParentDto.setCreceiptcorpid(bdCumandocEntity.getPkCumandoc());//开票单位 + saleorderRequestParentDto.setCreceiptcustomerid(bdCumandocEntity.getPkCumandoc());//收货单位 + saleorderRequestParentDto.setCsalecorpid(bdSalestruEntity.getCsalestruid());//销售组织 + saleorderRequestParentDto.setCwarehouseid(bdStordocEntity.getPkStordoc());//仓库 + saleorderRequestParentDto.setDapprovedate(generateBusinessDate);//审核日期 + saleorderRequestParentDto.setNdiscountrate("100.000000");//整单折扣 + saleorderRequestParentDto.setPk_corp(bdCorpEntity.getPkCorp());//公司id + saleorderRequestParentDto.setVdef18(keyGroup);//汇总单号=汇总维度 + saleorderRequestDto.setParentvo(saleorderRequestParentDto); + + List saleorderRequestChildrenDtoList = new ArrayList<>(); + saleorderRequestDto.setChildrenvo(saleorderRequestChildrenDtoList); + + //把汇总好的出库单明细行合并成一行 + SonDetailsDto sonDetailsDto = groupMergeDetailedRows(oldValue); + + //存货管理档案:取发货公司的存货管理档案 + BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(sonDetailsDto, bdCalbodyEntity.getPkCorp()); + + //存货基础档案 + BdInvbasdocEntity bdInvbasdocEntity = queryStockBasicArchives(bdInvmandocEntity.getPkInvmandoc(), deliverGoodsCorp.getPkCorp()); + + //根据存货基础档案编码,查询当前存货的税率 + BdTaxitemsEntity bdTaxitemsEntity1 = queryBdTaxitems(bdInvbasdocEntity.getInvcode()); + + String tax = "0." + new BigDecimal(bdTaxitemsEntity1.getTaxratio()).stripTrailingZeros().toPlainString(); + BigDecimal noriginalcurprice = null;//无税单价 + BigDecimal noriginalcurmny = null;//无税金额 + BigDecimal noriginalcurtaxprice = null;//含税单价 + BigDecimal noriginalcursummny = null;//价税合计 + BigDecimal noriginalcurtaxmny = null;//税额 + try { + noriginalcurtaxprice = sonDetailsDto.getGroupTotalPayAmount().divide(sonDetailsDto.getGroupShipQty(), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP); + noriginalcurprice = noriginalcurtaxprice.divide(new BigDecimal(1).add(new BigDecimal(tax)), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP); + noriginalcurmny = noriginalcurprice.multiply(sonDetailsDto.getGroupShipQty()).setScale(2, BigDecimal.ROUND_HALF_UP); + noriginalcursummny = noriginalcurtaxprice.multiply(sonDetailsDto.getGroupShipQty()).setScale(2, BigDecimal.ROUND_HALF_UP); + noriginalcurtaxmny = noriginalcursummny.subtract(noriginalcurmny).setScale(2, BigDecimal.ROUND_HALF_UP); + } catch (Exception e) { + logger.error("TOC金额计算错误", e); + Assert.state(false, "金额计算错误,原因:{}" + e.getMessage()); + } + + //判断是否为赠品 + String isblargessflag = "N"; + if (noriginalcursummny.longValue() == 0) { + isblargessflag = "Y"; + } + + SaleorderRequestChildrenDto saleorderRequestChildrenDto = new SaleorderRequestChildrenDto(); + saleorderRequestChildrenDto.setBlargessflag(isblargessflag);//是否赠品 + saleorderRequestChildrenDto.setCadvisecalbodyid(bdCalbodyEntity.getPkCalbody());//发货库存组织 + saleorderRequestChildrenDto.setCbodywarehouseid(bdStordocEntity.getPkStordoc());//发货仓库 + saleorderRequestChildrenDto.setCbodywarehousecode(bdStordocEntity.getStorcode());//发货仓库编码:这个字段不需要给openapi接口,而是提供给下游方法使用 + saleorderRequestChildrenDto.setCconsigncorpid(deliverGoodsCorp.getPkCorp());//发货公司 + saleorderRequestChildrenDto.setCcurrencytypeid("00010000000000000001");//币种 + saleorderRequestChildrenDto.setCinventoryid(bdInvmandocEntity.getPkInvmandoc());//存货id + saleorderRequestChildrenDto.setCinventorycode(bdInvbasdocEntity.getInvcode());//存货编码 + saleorderRequestChildrenDto.setCreceiptcorpid(bdCumandocEntity.getPkCumandoc());//收货单位 + saleorderRequestChildrenDto.setDconsigndate(generateBusinessDate);//计划发货日期 + saleorderRequestChildrenDto.setDdeliverdate(generateBusinessDate);//要求收货日期 + saleorderRequestChildrenDto.setNexchangeotobrate("1.00000000");//折本汇率 + saleorderRequestChildrenDto.setNitemdiscountrate("100.000000");//单品折扣 + saleorderRequestChildrenDto.setNnumber(String.valueOf(sonDetailsDto.getGroupShipQty()));//数量 + saleorderRequestChildrenDto.setNoriginalcurdiscountmny("0");//折扣额 + saleorderRequestChildrenDto.setNoriginalcurmny(noriginalcurmny.stripTrailingZeros().toPlainString());//无税金额 + saleorderRequestChildrenDto.setNoriginalcurnetprice(noriginalcurprice.stripTrailingZeros().toPlainString());//无税净价 + saleorderRequestChildrenDto.setNoriginalcurprice(noriginalcurprice.stripTrailingZeros().toPlainString());//无税单价 + saleorderRequestChildrenDto.setNoriginalcursummny(noriginalcursummny.stripTrailingZeros().toPlainString());//价税合计 + saleorderRequestChildrenDto.setNoriginalcurtaxmny(noriginalcurtaxmny.stripTrailingZeros().toPlainString());//税额 + saleorderRequestChildrenDto.setNoriginalcurtaxnetprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税净价 + saleorderRequestChildrenDto.setNoriginalcurtaxprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税单价 + saleorderRequestChildrenDto.setNtaxrate(new BigDecimal(bdTaxitemsEntity1.getTaxratio()).stripTrailingZeros().toPlainString());//税率 +// saleorderRequestChildrenDto.setCreccalbodyid(bdCalbodyEntity1.getPkCalbody());//收货库存组织:2024年8月7日 16:21:48 和佳妮、道品一起测试,收货库存组织、收货仓库 是不需要传递的 +// saleorderRequestChildrenDto.setCrecwareid(bdStordocEntity1.getPkStordoc());//收货仓库 + saleorderRequestChildrenDtoList.add(saleorderRequestChildrenDto); + + //推送到U8C接口 + + + //记录成功 + } catch (Exception e) { + logger.error("TOC业务转换成U8C对象过程中、或者单据推送到U8C出现异常!", e); + //记录失败 + } + } + } else { + //2024年8月6日 11:28:54此处不记录失败,不认为是错误 + logger.info("summaryDimensionMap变量或者bdBusitypeEntity变量为空,因此主要的推送逻辑不会被执行!"); } + } catch (Exception e) { + logger.error("外层转换逻辑抛出异常", e); + // 记录失败 } } } @@ -268,10 +420,10 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { * * @author liuyang */ - private String createGenerateBusinessDate(HeaderDto headerDto) { - if (headerDto != null && headerDto.getShipAt() != null) { + private String createGenerateBusinessDate(com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDto header) { + if (header != null && header.getShipAt() != null) { //TOC以出库日期作为业务日期 - String shipAt = headerDto.getShipAt(); + String shipAt = header.getShipAt(); String businessFormat = null; try { Date dbill = DateUtil.parse(shipAt); @@ -282,8 +434,8 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { } return businessFormat; } else { - logger.error("生成出库日期失败,或者shipAt为空! json:{}", JSON.toJSON(headerDto)); - Assert.state(false, "生成出库日期失败,或者shipAt为空! json:{}", JSON.toJSON(headerDto)); + logger.error("生成出库日期失败,或者shipAt为空! json:{}", JSON.toJSON(header)); + Assert.state(false, "生成出库日期失败,或者shipAt为空! json:{}", JSON.toJSON(header)); return null; } } @@ -293,34 +445,79 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { * * @author liuyang */ - private void queryBasicArchives(List headerDetailsDtoList) { - if (headerDetailsDtoList.size() > 0) { + private List queryBasicArchives(List headerDetailsDtoList) { + List sonDetailsDtoList = new ArrayList<>(); + + if (headerDetailsDtoList != null && headerDetailsDtoList.size() > 0) { try { //初始化档案缓存 basicArchivesCacheUtil.initCache(); for (int i = 0; i < headerDetailsDtoList.size(); i++) { HeaderDetailsDto headerDetailsDto = headerDetailsDtoList.get(i); + HeaderDto header = headerDetailsDto.getHeader(); + List details = headerDetailsDto.getDetails(); //表头公司:通过名称匹配U8C公司 - BdCorpEntity bdCorpEntity = BasicArchivesCacheUtil.stringBdCorpEntityMap.get("上海娜美诺丝化妆品有限公司"); + BdCorpEntity bdCorpEntity = BasicArchivesCacheUtil.stringBdCorpEntityMap.get("上海丽知品牌管理有限公司管理员"); //发货库存组织 BdCalbodyEntity bdCalbodyEntity = BasicArchivesCacheUtil.stringBdCalbodyEntityMap.get(bdCorpEntity.getPkCorp()); Assert.notNull(bdCalbodyEntity, "根据公司主键没有查询到发货库存组织 公司主键:{}", bdCorpEntity.getPkCorp()); + //发货公司,暂时把O表头公司作为发货公司,正常情况下需要把O库存地点对于的公司作为发货公司 + //发货仓库 - //发货公司 + //2024年8月5日 15:06:38 仓库O与U两边仓库编码是一致的,和妮姐确认过了 + String facilityCode = header.getFacilityCode(); + Assert.notNull(facilityCode, "O仓库编码不能为空"); + BdStordocEntity bdStordocEntity = BasicArchivesCacheUtil.stringBdStordocEntityMap.get(facilityCode + bdCalbodyEntity.getPkCalbody()); + Assert.notNull(bdStordocEntity, "没有匹配到发货仓库 发货库存组织主键:{} O库存地点编码:{}", facilityCode, bdCalbodyEntity.getPkCalbody()); - //收货库存组织 - //收货仓库 + //2024年8月5日 15:25:07 收货库存组织、收货仓库、默认和发货库存组织、发货仓库一致,已经和佳妮确认 + //收货库存组织:速网来看收货库存组织对应表头工具 + //收货仓库:通过收货库存组织+仓库编码,确定收货仓库 - //销售组织 - //业务部门 - //客商档案 + //销售组织2024年8月5日 15:33:40 和妮姐确认,销售组织和表头公司,作为一对一的关系, + BdSalestruEntity bdSalestruEntity = BasicArchivesCacheUtil.stringBdSalestruEntityMap.get(bdCorpEntity.getPkCorp()); + Assert.notNull(bdSalestruEntity, "无匹配到销售组织 公司名称:{}", bdCorpEntity.getPkCorp()); + + //业务部门:暂定的部门名称:其他,2024年8月5日 15:39:42 已经和妮姐确认 + BdDeptdocEntity bdDeptdocEntity = BasicArchivesCacheUtil.stringBdDeptdocEntityMap.get(bdCorpEntity.getPkCorp()); + Assert.notNull(bdDeptdocEntity, "无法匹配到业务部门 部门名称:其他 对应公司名称:{}", bdCorpEntity.getPkCorp()); + + //客商档案:2024年8月5日 15:41:54 TOC店铺名称查询U8C客商档案,已经和妮姐确认 + //2024年8月5日 15:49:49 先根据O店铺编码,得到店铺档案信息,取到名称,通过U8C接口查询出来 + //目前O店铺信息查询接口还没有,等待开发,所以我这里先写所一个名字 + BdCumandocEntity bdCumandocEntity = BasicArchivesCacheUtil.stringBdCumandocEntityMap.get("天猫intoyou旗舰店-自营"); + Assert.notNull(bdCumandocEntity, "无法匹配到客商档案 店铺名称:{}", "天猫intoyou旗舰店-自营"); + + //字段拷贝 + for (int j = 0; j < details.size(); j++) { + DetailsDto detailsDto = details.get(j); + + //2024年8月6日 10:16:22 通过O出库单的表头,查询得出U8C档案,放在表体的原因是方便分组汇总 + //下一个步骤的分组汇总,是通过表体明细完成的 + SonDetailsDto sonDetailsDto = new SonDetailsDto(); + sonDetailsDto.setHeader(header); + sonDetailsDto.setBdCorpEntity(bdCorpEntity); + sonDetailsDto.setDeliverGoodsCorp(bdCorpEntity); + sonDetailsDto.setBdCalbodyEntity(bdCalbodyEntity); + sonDetailsDto.setBdStordocEntity(bdStordocEntity); + sonDetailsDto.setBdCalbodyEntity1(bdCalbodyEntity); + sonDetailsDto.setBdStordocEntity1(bdStordocEntity); + sonDetailsDto.setBdSalestruEntity(bdSalestruEntity); + sonDetailsDto.setBdDeptdocEntity(bdDeptdocEntity); + sonDetailsDto.setBdCumandocEntity(bdCumandocEntity); + + BeanUtil.copyPropertiesV2(detailsDto, sonDetailsDto); + sonDetailsDtoList.add(sonDetailsDto); + } } + //成功 } catch (Exception e) { logger.error("OFS销售出库单关联查询U8C档案失败", e); + //失败 } finally { try { basicArchivesCacheUtil.clearCache(); @@ -331,6 +528,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { } else { logger.info("queryBasicArchives方法headerDetailsDtoList.size为0"); } + return sonDetailsDtoList; } /** @@ -368,4 +566,182 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { } return tocofsSaleoutDetailedEntityArrayList; } + + /** + * 分组汇总:公司+店铺+仓库+SKU+出库类型,数量合并相加 + * + * @author liuyang + */ + private Map> groupSummary(List sonDetailsDtoList) { + if (sonDetailsDtoList != null && sonDetailsDtoList.size() > 0) { + for (int i = 0; i < sonDetailsDtoList.size(); i++) { + SonDetailsDto sonDetailsDto = sonDetailsDtoList.get(i); + //2024年8月6日 10:35:25表头对象用于带出表头相关的分组汇总信息 + HeaderDto header = sonDetailsDto.getHeader(); + + //公司 + BdCorpEntity bdCorpEntity = sonDetailsDto.getBdCorpEntity(); + //店铺(主要是店铺编码) + String storeCode = header.getStoreCode(); + //仓库 + String facilityCode = header.getFacilityCode(); + //SKU + String skuCode = sonDetailsDto.getSkuCode(); + //出库类型 + String shipmentType = header.getShipmentType(); + + StringBuffer summaryDimensionStr = new StringBuffer(); + if (bdCorpEntity != null && bdCorpEntity.getPkCorp() != null) { + summaryDimensionStr.append(bdCorpEntity.getPkCorp()); + } else { + summaryDimensionStr.append(NOTHING); + } + summaryDimensionStr.append(ADD); + + if (storeCode != null && !"".equals(storeCode)) { + summaryDimensionStr.append(storeCode); + } else { + summaryDimensionStr.append(NOTHING); + } + summaryDimensionStr.append(ADD); + + if (facilityCode != null && !"".equals(facilityCode)) { + summaryDimensionStr.append(facilityCode); + } else { + summaryDimensionStr.append(NOTHING); + } + summaryDimensionStr.append(ADD); + + if (skuCode != null && !"".equals(skuCode)) { + summaryDimensionStr.append(skuCode); + } else { + summaryDimensionStr.append(NOTHING); + } + summaryDimensionStr.append(ADD); + + if (shipmentType != null && !"".equals(shipmentType)) { + summaryDimensionStr.append(shipmentType); + } else { + summaryDimensionStr.append(NOTHING); + } + + sonDetailsDto.setSummaryDimensionStr(summaryDimensionStr.toString()); + } + logger.info("TOC:{}个出库单对象需要汇总", sonDetailsDtoList.size()); + return sonDetailsDtoList.stream().collect(Collectors.groupingBy(SonDetailsDto::getSummaryDimensionStr)); + } + logger.info("TOC:0个对象需要汇总"); + return null; + } + + /** + * 2024年8月6日 10:59:03 查询U8C业务流程 + * + * @author liuyang + */ + private BdBusitypeEntity u8cOperationFlow() throws Exception { + //查询业务流程 + //2024年8月6日 11:33:07 具体的业务流程名称,还需要实施提供 + String processName = "TOC分销"; + BdBusitypeEntity bdBusitypeEntity = queryBdBusitypeUtil.queryBdBusitype(processName); + Assert.notNull(bdBusitypeEntity, "根据业务流程名称({})没有查询到业务流程", processName); + return bdBusitypeEntity; + } + + /** + * 检查参数是否为空 + * 2024年8月6日 11:40:19 保险的做法,最好还是验证一下 + * + * @author liuyang + */ + private void checkArchives(SonDetailsDto sonDetailsDto) { + Assert.notNull(sonDetailsDto, "sonDetailsDto不能为空 对象json:{}", JSON.toJSONString(sonDetailsDto)); + Assert.notNull(sonDetailsDto.getHeader(), "header对象不能为空 对象json:{}", JSON.toJSONString(sonDetailsDto)); + Assert.notNull(sonDetailsDto.getBdCorpEntity(), "表头公司不能为空 对象json:{}", JSON.toJSONString(sonDetailsDto)); + Assert.notNull(sonDetailsDto.getBdCalbodyEntity(), "发货库存组织不能为空 对象json:{}", JSON.toJSONString(sonDetailsDto)); + Assert.notNull(sonDetailsDto.getBdStordocEntity(), "发货仓库不能为空 对象json:{}", JSON.toJSONString(sonDetailsDto)); + Assert.notNull(sonDetailsDto.getBdCalbodyEntity1(), "收货库存组织不能为空 对象json:{}", JSON.toJSONString(sonDetailsDto)); + Assert.notNull(sonDetailsDto.getBdStordocEntity1(), "收货库存不能为空 对象json:{}", JSON.toJSONString(sonDetailsDto)); + Assert.notNull(sonDetailsDto.getBdSalestruEntity(), "销售组织不能为空 对象json:{}", JSON.toJSONString(sonDetailsDto)); + Assert.notNull(sonDetailsDto.getBdDeptdocEntity(), "业务部门不能为空 对象json:{}", JSON.toJSONString(sonDetailsDto)); + Assert.notNull(sonDetailsDto.getBdCumandocEntity(), "客商档案不能为空 对象json:{}", JSON.toJSONString(sonDetailsDto)); + } + + /** + * 查询存货管理档案 + * + * @param pkCorp 发货公司主键 + * @param sonDetailsDto 出库单存货明细行 + * @author liuyang + */ + private BdInvmandocEntity queryInventoryMan(SonDetailsDto sonDetailsDto, String pkCorp) { + Assert.notNull(sonDetailsDto, "sonDetailsDto不能为空"); + Assert.notNull(sonDetailsDto.getSkuCode(), "O存货商家编码不能为空"); + Assert.notNull(pkCorp, "发货公司主键不能为空"); + + BdInvmandocEntity bdInvmandocEntity = BasicArchivesCacheUtil.stringBdInvmandocEntityMap.get(sonDetailsDto.getSkuCode() + pkCorp); + Assert.notNull(bdInvmandocEntity, "无法匹配到存货管理档案 存货商家编码:{} 存货发货公司:{}", sonDetailsDto.getSkuCode(), pkCorp); + return bdInvmandocEntity; + } + + /** + * 合并明细行 + * 单价计算公式:sum(实付金额/实发数量) 最后除以条数 + * + * @author liuyang + */ + private SonDetailsDto groupMergeDetailedRows(List sonDetailsDtoList) throws Exception { + if (sonDetailsDtoList != null && sonDetailsDtoList.size() > 0) { + BigDecimal groupTotalPayAmount = new BigDecimal("0"); + BigDecimal groupShipQty = new BigDecimal("0"); + + for (int i = 0; i < sonDetailsDtoList.size(); i++) { + SonDetailsDto sonDetailsDto = sonDetailsDtoList.get(i); + + //实付金额/实发数量 + Assert.notNull(sonDetailsDto.getTotalPayAmount(), "实付金额不能为空 明细行对象:{}", JSON.toJSONString(sonDetailsDto)); + Assert.notNull(sonDetailsDto.getShipQty(), "实发数量不能为空 明细行对象:{}", JSON.toJSONString(sonDetailsDto)); + BigDecimal totalPayAmountBigDecimal = new BigDecimal(sonDetailsDto.getTotalPayAmount()); + BigDecimal shipQtyBigDecimal = new BigDecimal(sonDetailsDto.getShipQty()); + + groupTotalPayAmount = groupTotalPayAmount.add(totalPayAmountBigDecimal); + groupShipQty = groupShipQty.add(shipQtyBigDecimal); + } + SonDetailsDto sonDetailsDto = sonDetailsDtoList.get(0); + sonDetailsDto.setGroupShipQty(groupShipQty); + sonDetailsDto.setGroupTotalPayAmount(groupTotalPayAmount); + logger.info("{}个明细行发生了合并!", sonDetailsDtoList.size()); + return sonDetailsDto; + } else { + logger.info("sonDetailsDtoList集合是空的!"); + } + return null; + } + + /** + * 2024年8月7日 10:25:29 + * 查询基础档案,根据公司、管理档案主键查询 + * + * @author liuyang + */ + private BdInvbasdocEntity queryStockBasicArchives(String pkInvmandoc, String pkCorp) { + Assert.notNull(pkInvmandoc, "存货管理档案不能为空"); + Assert.notNull(pkCorp, "公司档案不能为空"); + BdInvbasdocEntity bdInvbasdocEntity = BasicArchivesCacheUtil.stringBdInvbasdocEntityHashMap.get(pkInvmandoc + pkCorp); + Assert.notNull(bdInvbasdocEntity, "根据公司主键:{} 和存货管理档案主键:{} 没有查询到存货基本档案", pkCorp, pkInvmandoc); + return bdInvbasdocEntity; + } + + /** + * 2024年8月7日 14:58:34 + * 查询税目档案 + * + * @author liuyang + */ + private BdTaxitemsEntity queryBdTaxitems(String invcode) { + Assert.notNull(invcode, "存货编码不能为空"); + BdTaxitemsEntity bdTaxitemsEntity = BasicArchivesCacheUtil.stringBdTaxitemsEntityHashMap.get(invcode); + Assert.notNull(bdTaxitemsEntity, "根据存货编码({}),无法匹配到税率!", invcode); + return bdTaxitemsEntity; + } } \ No newline at end of file diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/SonDetailsDto.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/SonDetailsDto.java new file mode 100644 index 00000000..10672426 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/SonDetailsDto.java @@ -0,0 +1,187 @@ +package com.hzya.frame.plugin.lets.u8cdto; + +import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.DetailsDto; +import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDto; +import com.hzya.frame.plugin.lets.entity.*; + +import java.math.BigDecimal; + +/** + * @Author:liuyang + * @Package:com.hzya.frame.ttxofs.dto.u8cson + * @Project:kangarooDataCenterV3 + * @name:SonDetailsDto + * @Date:2024/8/5 16:07 + * @Filename:SonDetailsDto + */ +public class SonDetailsDto extends DetailsDto { + + /** + * 表头对象 + */ + private HeaderDto header; + + /** + * 表头公司(销售公司) + */ + private BdCorpEntity bdCorpEntity; + + /** + * 发货库存组织 + */ + private BdCalbodyEntity bdCalbodyEntity; + + /** + * 发货仓库 + */ + private BdStordocEntity bdStordocEntity; + + /** + * 收货库存组织 + */ + private BdCalbodyEntity bdCalbodyEntity1; + + /** + * 收货仓库 + */ + private BdStordocEntity bdStordocEntity1; + + /** + * 销售组织 + */ + private BdSalestruEntity bdSalestruEntity; + + /** + * 业务部门 + */ + private BdDeptdocEntity bdDeptdocEntity; + + /** + * 客商档案 + */ + private BdCumandocEntity bdCumandocEntity; + + /** + * 生成汇总维度字符串 + */ + private String summaryDimensionStr; + + /** + * 汇总总金额 + */ + private BigDecimal groupTotalPayAmount; + + /** + * 汇总实发数量 + */ + private BigDecimal groupShipQty; + + /** + * 发货公司 + */ + private BdCorpEntity deliverGoodsCorp; + + public BdCorpEntity getDeliverGoodsCorp() { + return deliverGoodsCorp; + } + + public void setDeliverGoodsCorp(BdCorpEntity deliverGoodsCorp) { + this.deliverGoodsCorp = deliverGoodsCorp; + } + + public BigDecimal getGroupShipQty() { + return groupShipQty; + } + + public void setGroupShipQty(BigDecimal groupShipQty) { + this.groupShipQty = groupShipQty; + } + + public BigDecimal getGroupTotalPayAmount() { + return groupTotalPayAmount; + } + + public void setGroupTotalPayAmount(BigDecimal groupTotalPayAmount) { + this.groupTotalPayAmount = groupTotalPayAmount; + } + + public String getSummaryDimensionStr() { + return summaryDimensionStr; + } + + public void setSummaryDimensionStr(String summaryDimensionStr) { + this.summaryDimensionStr = summaryDimensionStr; + } + + public BdCorpEntity getBdCorpEntity() { + return bdCorpEntity; + } + + public void setBdCorpEntity(BdCorpEntity bdCorpEntity) { + this.bdCorpEntity = bdCorpEntity; + } + + public BdCalbodyEntity getBdCalbodyEntity() { + return bdCalbodyEntity; + } + + public void setBdCalbodyEntity(BdCalbodyEntity bdCalbodyEntity) { + this.bdCalbodyEntity = bdCalbodyEntity; + } + + public BdStordocEntity getBdStordocEntity() { + return bdStordocEntity; + } + + public void setBdStordocEntity(BdStordocEntity bdStordocEntity) { + this.bdStordocEntity = bdStordocEntity; + } + + public BdCalbodyEntity getBdCalbodyEntity1() { + return bdCalbodyEntity1; + } + + public void setBdCalbodyEntity1(BdCalbodyEntity bdCalbodyEntity1) { + this.bdCalbodyEntity1 = bdCalbodyEntity1; + } + + public BdStordocEntity getBdStordocEntity1() { + return bdStordocEntity1; + } + + public void setBdStordocEntity1(BdStordocEntity bdStordocEntity1) { + this.bdStordocEntity1 = bdStordocEntity1; + } + + public BdSalestruEntity getBdSalestruEntity() { + return bdSalestruEntity; + } + + public void setBdSalestruEntity(BdSalestruEntity bdSalestruEntity) { + this.bdSalestruEntity = bdSalestruEntity; + } + + public BdDeptdocEntity getBdDeptdocEntity() { + return bdDeptdocEntity; + } + + public void setBdDeptdocEntity(BdDeptdocEntity bdDeptdocEntity) { + this.bdDeptdocEntity = bdDeptdocEntity; + } + + public BdCumandocEntity getBdCumandocEntity() { + return bdCumandocEntity; + } + + public void setBdCumandocEntity(BdCumandocEntity bdCumandocEntity) { + this.bdCumandocEntity = bdCumandocEntity; + } + + public HeaderDto getHeader() { + return header; + } + + public void setHeader(HeaderDto header) { + this.header = header; + } +} \ No newline at end of file diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/BasicArchivesCacheUtil.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/BasicArchivesCacheUtil.java index 2e2d3355..ceab37f8 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/BasicArchivesCacheUtil.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/BasicArchivesCacheUtil.java @@ -40,16 +40,25 @@ public class BasicArchivesCacheUtil { @Autowired private IBdCumandocDao iBdCumandocDao; + @Autowired + private IBdInvmandocDao iBdInvmandocDao; + + @Autowired + private IBdInvbasdocDao iBdInvbasdocDao; + + @Autowired + private IBdTaxitemsDao iBdTaxitemsDao; + /** * 初始化公司档案-表头公司 * 2024年7月31日 11:16:23 */ public static Map stringBdCorpEntityMap = new HashMap<>(); - public void initShop() throws Exception { + private void initShop() throws Exception { BdCorpEntity bdCorpEntity = new BdCorpEntity(); bdCorpEntity.setDr(0); - bdCorpEntity.setDataSourceCode("sowow_sqlserver_test"); + bdCorpEntity.setDataSourceCode("lets_u8c"); List bdCorpEntityList = iBdCorpDao.query(bdCorpEntity); if (bdCorpEntityList != null && bdCorpEntityList.size() > 0) { for (int i = 0; i < bdCorpEntityList.size(); i++) { @@ -66,10 +75,10 @@ public class BasicArchivesCacheUtil { */ public static Map stringBdStordocEntityMap = new HashMap<>(); - public void initBdStordoc() throws Exception { + private void initBdStordoc() throws Exception { BdStordocEntity bdStordocEntity = new BdStordocEntity(); bdStordocEntity.setDr(0L); - bdStordocEntity.setDataSourceCode("sowow_sqlserver_test"); + bdStordocEntity.setDataSourceCode("lets_u8c"); List bdStordocEntityList = iBdStordocDao.query(bdStordocEntity); if (bdStordocEntityList != null && bdStordocEntityList.size() > 0) { for (int i = 0; i < bdStordocEntityList.size(); i++) { @@ -84,10 +93,10 @@ public class BasicArchivesCacheUtil { */ public static Map stringBdCalbodyEntityMap = new HashMap<>(); - public void initBdCalbody() throws Exception { + private void initBdCalbody() throws Exception { BdCalbodyEntity bdCalbodyEntity = new BdCalbodyEntity(); bdCalbodyEntity.setDr(0); - bdCalbodyEntity.setDataSourceCode("sowow_sqlserver_test"); + bdCalbodyEntity.setDataSourceCode("lets_u8c"); List bdCalbodyEntities = iBdCalbodyDao.query(bdCalbodyEntity); if (bdCalbodyEntities != null && bdCalbodyEntities.size() > 0) { for (int i = 0; i < bdCalbodyEntities.size(); i++) { @@ -102,15 +111,15 @@ public class BasicArchivesCacheUtil { */ public static Map stringBdSalestruEntityMap = new HashMap<>(); - public void initBdSalestru() throws Exception { + private void initBdSalestru() throws Exception { BdSalestruEntity bdSalestruEntity = new BdSalestruEntity(); bdSalestruEntity.setDr(0); - bdSalestruEntity.setDataSourceCode("sowow_sqlserver_test"); + bdSalestruEntity.setDataSourceCode("lets_u8c"); List bdSalestruEntityList = iBdSalestruDao.query(bdSalestruEntity); if (bdSalestruEntityList != null && bdSalestruEntityList.size() > 0) { for (int i = 0; i < bdSalestruEntityList.size(); i++) { BdSalestruEntity bdSalestruEntity1 = bdSalestruEntityList.get(i); - stringBdSalestruEntityMap.put(bdSalestruEntity1.getBelongcorp(), bdSalestruEntity1); + stringBdSalestruEntityMap.put(bdSalestruEntity1.getPkCorp(), bdSalestruEntity1); } } } @@ -122,11 +131,11 @@ public class BasicArchivesCacheUtil { */ public static Map stringBdDeptdocEntityMap = new HashMap<>(); - public void initDept() { + private void initDept() { BdDeptdocEntity bdDeptdocEntity = new BdDeptdocEntity(); - bdDeptdocEntity.setDataSourceCode("sowow_sqlserver_test"); + bdDeptdocEntity.setDataSourceCode("lets_u8c"); bdDeptdocEntity.setDr(0); - bdDeptdocEntity.setDeptname("业务部门"); + bdDeptdocEntity.setDeptname("其他"); List bdDeptdocEntityList = iBdDeptdocDao.query(bdDeptdocEntity); if (bdDeptdocEntityList != null && bdDeptdocEntityList.size() > 0) { for (int i = 0; i < bdDeptdocEntityList.size(); i++) { @@ -143,9 +152,9 @@ public class BasicArchivesCacheUtil { */ public static Map stringBdCumandocEntityMap = new HashMap<>(); - public void initBdCumandoc() { + private void initBdCumandoc() { BdCumandocEntity bdCumandocEntity1 = new BdCumandocEntity(); - bdCumandocEntity1.setDataSourceCode("sowow_sqlserver_test"); + bdCumandocEntity1.setDataSourceCode("lets_u8c"); bdCumandocEntity1.setDr(0L); // bdCumandocEntity1.setCustflags(ProfilesActiveConstant.CUSTOMER);//客商:2客户 List bdCumandocEntityList = iBdCumandocDao.query(bdCumandocEntity1); @@ -157,6 +166,63 @@ public class BasicArchivesCacheUtil { } } + /** + * 初始化存货管理档案 + */ + public static Map stringBdInvmandocEntityMap = new HashMap<>(); + + private void initInventoryFile() throws Exception { + BdInvmandocEntity bdInvmandocEntity = new BdInvmandocEntity(); +// bdInvmandocEntity.setInvcode(copyRowDetailsListVo.getSpec_no()); +// bdInvmandocEntity.setPkCorp(shippingCompanyBdCorpEntity.getPkCorp()); + List bdInvmandocEntity2 = iBdInvmandocDao.queryBdInvmandocByInvcodeList(bdInvmandocEntity); + if (bdInvmandocEntity2 != null && bdInvmandocEntity2.size() > 0) { + for (int i = 0; i < bdInvmandocEntity2.size(); i++) { + BdInvmandocEntity bdInvmandocEntity1 = bdInvmandocEntity2.get(i); + //2024年8月6日 14:27:45 通过存货编码+公司缓存 + stringBdInvmandocEntityMap.put(bdInvmandocEntity1.getInvcode() + bdInvmandocEntity1.getPkCorp(), bdInvmandocEntity1); + } + } + } + + /** + * 初始化存货基本档案 + * 2024年8月7日 10:57:55 + */ + public static Map stringBdInvbasdocEntityHashMap = new HashMap<>(); + + private void initBasicInventoryFile() throws Exception { + BdInvbasdocEntity bdInvbasdocEntity = new BdInvbasdocEntity(); +// bdInvbasdocEntity.setPk_invmandoc(bdInvmandocEntity1.getPkInvmandoc()); +// bdInvbasdocEntity.setPk_corp(shippingCompanyBdCorpEntity.getPkCorp()); + List bdInvbasdocEntity2 = iBdInvbasdocDao.queryBdInvbasdocByPkInvmandocV2(bdInvbasdocEntity); + if (bdInvbasdocEntity2 != null && bdInvbasdocEntity2.size() > 0) { + for (int i = 0; i < bdInvbasdocEntity2.size(); i++) { + BdInvbasdocEntity bdInvbasdocEntity1 = bdInvbasdocEntity2.get(i); + stringBdInvbasdocEntityHashMap.put(bdInvbasdocEntity1.getPk_invmandoc() + bdInvbasdocEntity1.getPkCorp(), bdInvbasdocEntity1); + } + } + } + + /** + * 2024年8月7日 10:59:30 + * 初始化存货税率 + * + * @author liuyang + */ + public static Map stringBdTaxitemsEntityHashMap = new HashMap<>(); + + private void initBdTaxitemsEntity() throws Exception { + BdTaxitemsEntity bdTaxitemsEntity = new BdTaxitemsEntity(); + List bdTaxitemsEntityList = iBdTaxitemsDao.queryBdInvbasdocByInvcodeV2(bdTaxitemsEntity); + if (bdTaxitemsEntityList != null && bdTaxitemsEntityList.size() > 0) { + for (int i = 0; i < bdTaxitemsEntityList.size(); i++) { + BdTaxitemsEntity bdTaxitemsEntity1 = bdTaxitemsEntityList.get(i); + stringBdTaxitemsEntityHashMap.put(bdTaxitemsEntity1.getInvcode(), bdTaxitemsEntity1); + } + } + } + /** * 清理缓存 * @@ -169,6 +235,9 @@ public class BasicArchivesCacheUtil { stringBdSalestruEntityMap.clear(); stringBdDeptdocEntityMap.clear(); stringBdCumandocEntityMap.clear(); + stringBdInvmandocEntityMap.clear(); + stringBdInvbasdocEntityHashMap.clear(); + stringBdTaxitemsEntityHashMap.clear(); } /** @@ -185,5 +254,9 @@ public class BasicArchivesCacheUtil { initBdSalestru(); initDept(); initBdCumandoc(); + initInventoryFile(); + initBasicInventoryFile(); + initBdTaxitemsEntity(); } -} + +} \ No newline at end of file diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/QueryBdBusitypeUtil.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/QueryBdBusitypeUtil.java new file mode 100644 index 00000000..328dcb8a --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/QueryBdBusitypeUtil.java @@ -0,0 +1,41 @@ +package com.hzya.frame.plugin.lets.util; + +import cn.hutool.core.lang.Assert; +import com.hzya.frame.plugin.lets.dao.IBdBusitypeDao; +import com.hzya.frame.plugin.lets.entity.BdBusitypeEntity; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * 业务流程查询 + * + * @Author:liuyang + * @Package:com.hzya.frame.plugin.sowow.util + * @Project:kangarooDataCenter + * @name:QueryBdBusitypeUtil + * @Date:2023/11/22 20:11 + * @Filename:QueryBdBusitypeUtil + */ +@Component +public class QueryBdBusitypeUtil { + + @Autowired + private IBdBusitypeDao iBdBusitypeDao; + + public BdBusitypeEntity queryBdBusitype(String businame) { + //查询业务流程 + BdBusitypeEntity bdBusitypeEntity = new BdBusitypeEntity(); + bdBusitypeEntity.setDataSourceCode("lets_u8c"); + bdBusitypeEntity.setBusiname(businame); + bdBusitypeEntity.setDr(0); + List bdBusitypeEntityList = iBdBusitypeDao.query(bdBusitypeEntity); + if (bdBusitypeEntityList.size() == 0) { + Assert.state(false, "没有查询到业务流程,业务流程名称:{}", bdBusitypeEntity.getBusiname()); + } else if (bdBusitypeEntityList.size() > 1) { + Assert.state(false, "查询到多个业务流程,业务流程名称:{}", bdBusitypeEntity.getBusiname()); + } + return bdBusitypeEntityList.get(0); + } +} diff --git a/service/src/main/java/com/hzya/frame/ttxofs/dto/ofssaleorderoutsearch/HeaderDto.java b/service/src/main/java/com/hzya/frame/ttxofs/dto/ofssaleorderoutsearch/HeaderDto.java index 54731f2c..461dbd04 100755 --- a/service/src/main/java/com/hzya/frame/ttxofs/dto/ofssaleorderoutsearch/HeaderDto.java +++ b/service/src/main/java/com/hzya/frame/ttxofs/dto/ofssaleorderoutsearch/HeaderDto.java @@ -63,6 +63,32 @@ public class HeaderDto { private String shipToCityName; private String shipToDistrictName; + /** + * 发货日期 + */ + private String shipAt; + + /** + * 出库类型 + */ + private String shipmentType; + + public String getShipmentType() { + return shipmentType; + } + + public void setShipmentType(String shipmentType) { + this.shipmentType = shipmentType; + } + + public String getShipAt() { + return shipAt; + } + + public void setShipAt(String shipAt) { + this.shipAt = shipAt; + } + public String getId() { return id; } diff --git a/webapp/src/main/java/com/hzya/frame/webapp/web/aop/AopDynamicRoutingDataSourceInit.java b/webapp/src/main/java/com/hzya/frame/webapp/web/aop/AopDynamicRoutingDataSourceInit.java index e4d9c3f1..3dd51825 100644 --- a/webapp/src/main/java/com/hzya/frame/webapp/web/aop/AopDynamicRoutingDataSourceInit.java +++ b/webapp/src/main/java/com/hzya/frame/webapp/web/aop/AopDynamicRoutingDataSourceInit.java @@ -115,8 +115,7 @@ public class AopDynamicRoutingDataSourceInit { driveClass = DataSourceUtilProperties.SQL2000DRIVER; } else if ("sqlServer".equalsIgnoreCase(source_type)) { driveClass = DataSourceUtilProperties.SQL2005DRIVER; - } - else if ("dm".equalsIgnoreCase(source_type)) { + } else if ("dm".equalsIgnoreCase(source_type)) { driveClass = DataSourceUtilProperties.dm; } try {