优化TOB销售发票的业务流程

This commit is contained in:
liuy 2024-08-29 18:19:04 +08:00
parent 130bacee77
commit e89ce86954
19 changed files with 836 additions and 398 deletions

View File

@ -16,6 +16,7 @@ public interface IIcGeneralBDao extends IBaseDao<IcGeneralBEntity, String> {
* 根据cgeneralhid表头主键查询
*/
public List<IcGeneralBEntity> queryByCgeneralhid(String cgeneralhid);
public List<IcGeneralBEntity> queryAndCinvbasCode(String cgeneralhid);
}

View File

@ -2,6 +2,7 @@ package com.hzya.frame.plugin.lets.dao;
import com.hzya.frame.basedao.dao.IBaseDao;
import com.hzya.frame.plugin.lets.entity.SoSaleorderBEntity;
import com.hzya.frame.plugin.lets.queryvo.ExtIntegrationTaskLivingDetailsQueryVo;
import java.util.List;
@ -25,5 +26,5 @@ public interface ISoSaleorderBDao extends IBaseDao<SoSaleorderBEntity, String> {
*
* @author liuyang
*/
List queryErrorDetailsId(SoSaleorderBEntity soSaleorderBEntity) throws Exception;
List<ExtIntegrationTaskLivingDetailsQueryVo> queryErrorDetailsId(SoSaleorderBEntity soSaleorderBEntity) throws Exception;
}

View File

@ -4,6 +4,7 @@ import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import com.hzya.frame.plugin.lets.dao.ISoSaleorderBDao;
import com.hzya.frame.plugin.lets.entity.SoSaleorderBEntity;
import com.hzya.frame.plugin.lets.queryvo.ExtIntegrationTaskLivingDetailsQueryVo;
import java.util.List;
@ -16,15 +17,15 @@ import java.util.List;
//@Repository("SoSaleorderBDaoImpl")
public class SoSaleorderBDaoImpl extends MybatisGenericDao<SoSaleorderBEntity, String> implements ISoSaleorderBDao {
@DS("sowow_sqlserver_test")
@DS("lets_u8c")
@Override
public List<SoSaleorderBEntity> querySoSaleBEntity(SoSaleorderBEntity soSaleorderBEntity) throws Exception {
return query("com.hzya.frame.plugin.lets.dao.impl.SoSaleorderBDaoImpl.querySoSaleBEntity", soSaleorderBEntity);
}
@DS("sowow_sqlserver_test")
@DS("lets_u8c")
@Override
public List queryErrorDetailsId(SoSaleorderBEntity soSaleorderBEntity) throws Exception {
return super.selectList(getSqlIdPrifx() + "queryErrorDetailsId", soSaleorderBEntity);
public List<ExtIntegrationTaskLivingDetailsQueryVo> queryErrorDetailsId(SoSaleorderBEntity soSaleorderBEntity) throws Exception {
return (List<ExtIntegrationTaskLivingDetailsQueryVo>) super.selectList(getSqlIdPrifx() + "queryErrorDetailsId", soSaleorderBEntity);
}
}

View File

@ -12,225 +12,226 @@ import lombok.Data;
@Data
public class IcGeneralBEntity extends BaseEntity {
private Double alrconfincomny;
private Double alrconfinconum;
private String bbarcodeclose;
private String bomversion;
private String bonroadflag;
private String breturnprofit;
private String bsafeprice;
private String bsourcelargess;
private String bsupplyflag;
private String btoinzgflag;
private String btoouttoiaflag;
private String btooutzgflag;
private String btou8rm;
private String btransasset;
private String bzgflag;
private String bzgyfflag;
private String castunitid;
private String cbodybilltypecode;
private String cbodywarehouseid;
private String ccheckstateid;
private String ccorrespondbid;
private String ccorrespondcode;
private String ccorrespondhid;
private String ccorrespondtype;
private String ccostobject;
private String ccurrencytypeid;
private String cfirstbillbid;
private String cfirstbillhid;
private String cfirsttype;
private String cfreezeid;
private String cgeneralbid;
private String cgeneralhid;
/** 存货档案code */
private String cinvbascode;
private String cinvbasid;
private String cinventoryid;
private String corderBb1id;
private String cparentid;
private String cprojectid;
private String cprojectphaseid;
private String cquotecurrency;
private String cquoteunitid;
private String creceieveid;
private String creceiveareaid;
private String creceivepointid;
private String crowno;
private String cselastunitid;
private String csignwastbid;
private String csignwasthid;
private String csignwasttype;
private String csourcebillbid;
private String csourcebillhid;
private String csourcetype;
private String csourcewastbid;
private String csourcewasthid;
private String csourcewasttype;
private String csrc2billbid;
private String csrc2billhid;
private String csrc2billtype;
private String csumid;
private String cvendorid;
private String cworkcenterid;
private String cworksiteid;
private String cwp;
private String dbizdate;
private String ddeliverdate;
private String dfirstbilldate;
private Integer dr;
private String drequiredate;
private String drequiretime;
private String dstandbydate;
private String dvalidate;
private String dzgdate;
private String fassertcardflag;
private Integer fbillrowflag;
private Integer fchecked;
private String flargess;
private String ftoouttransflag;
private Double hsl;
private Integer idesatype;
private String inccontimepoint;
private String inccontimepointname;
private String isok;
private Double materialcost;
private Double naccumtonum;
private Double naccumwastnum;
private Double nbarcodenum;
private Double ncorrespondastnum;
private Double ncorrespondgrsnum;
private Double ncorrespondnum;
private Double ncountnum;
private Integer nfeesettletimes;
private Double ninassistnum;
private Double ningrossnum;
private Double ninnum;
private Double nkdnum;
private Double nmny;
private Double nneedinassistnum;
private Double noutassistnum;
private Double noutgrossnum;
private Double noutnum;
private Double nplannedmny;
private Double nplannedprice;
private Double nprice;
private Integer npricesettlebill;
private Double nquotemny;
private Double nquotentmny;
private Double nquotentprice;
private Double nquoteprice;
private Double nquoteunitnum;
private Double nquoteunitrate;
private Double nreplenishedastnum;
private Double nreplenishednum;
private Double nretastnum;
private Double nretgrossnum;
private Double nretnum;
private Double nsalemny;
private Double nsaleprice;
private Double nshouldinnum;
private Double nshouldoutassistnum;
private Double nshouldoutnum;
private Double ntarenum;
private Double ntaxmny;
private Double ntaxprice;
private Double ntotalmatchnum;
private Double ntotalreasonwastenum;
private Double ntranoutastnum;
private Double ntranoutnum;
private String pkBodycalbody;
private String pkCorp;
private String pkCreqwareid;
private String pkCubasdoc;
private String pkDefdoc1;
private String pkDefdoc10;
private String pkDefdoc11;
private String pkDefdoc12;
private String pkDefdoc13;
private String pkDefdoc14;
private String pkDefdoc15;
private String pkDefdoc16;
private String pkDefdoc17;
private String pkDefdoc18;
private String pkDefdoc19;
private String pkDefdoc2;
private String pkDefdoc20;
private String pkDefdoc3;
private String pkDefdoc4;
private String pkDefdoc5;
private String pkDefdoc6;
private String pkDefdoc7;
private String pkDefdoc8;
private String pkDefdoc9;
private String pkInvoicecorp;
private String pkMeasware;
private String pkPacksort;
private String pkReqcorp;
private String pkReqstoorg;
private String pkReturnreason;
private String process1;
private String process2;
private String process3;
private String process4;
private String process5;
private Double processcost;
private String processmanid;
private Integer serialnum;
private String ts;
private String vbatchcode;
private String vbilltypeu8rm;
private String vbodynote2;
private String vcorrespondrowno;
private String vfirstbillcode;
private String vfirstrowno;
private String vfree1;
private String vfree10;
private String vfree2;
private String vfree3;
private String vfree4;
private String vfree5;
private String vfree6;
private String vfree7;
private String vfree8;
private String vfree9;
private String vnotebody;
private String vproductbatch;
private String vreceiveaddress;
private String vsignwastcode;
private String vsignwastrowno;
private String vsourcebillcode;
private String vsourcerowno;
private String vsourcewastcode;
private String vsourcewastrowno;
private String vsrc2billcode;
private String vsrc2billrowno;
private String vtransfercode;
private String vuserdef1;
private String vuserdef10;
private String vuserdef11;
private String vuserdef12;
private String vuserdef13;
private String vuserdef14;
private String vuserdef15;
private String vuserdef16;
private String vuserdef17;
private String vuserdef18;
private String vuserdef19;
private String vuserdef2;
private String vuserdef20;
private String vuserdef3;
private String vuserdef4;
private String vuserdef5;
private String vuserdef6;
private String vuserdef7;
private String vuserdef8;
private String vuserdef9;
private String vvehiclecode;
private String writeofftype;
private Double alrconfincomny;
private Double alrconfinconum;
private String bbarcodeclose;
private String bomversion;
private String bonroadflag;
private String breturnprofit;
private String bsafeprice;
private String bsourcelargess;
private String bsupplyflag;
private String btoinzgflag;
private String btoouttoiaflag;
private String btooutzgflag;
private String btou8rm;
private String btransasset;
private String bzgflag;
private String bzgyfflag;
private String castunitid;
private String cbodybilltypecode;
private String cbodywarehouseid;
private String ccheckstateid;
private String ccorrespondbid;
private String ccorrespondcode;
private String ccorrespondhid;
private String ccorrespondtype;
private String ccostobject;
private String ccurrencytypeid;
private String cfirstbillbid;
private String cfirstbillhid;
private String cfirsttype;
private String cfreezeid;
private String cgeneralbid;
private String cgeneralhid;
/**
* 存货档案code
*/
private String cinvbascode;
private String cinvbasid;
private String cinventoryid;
private String corderBb1id;
private String cparentid;
private String cprojectid;
private String cprojectphaseid;
private String cquotecurrency;
private String cquoteunitid;
private String creceieveid;
private String creceiveareaid;
private String creceivepointid;
private String crowno;
private String cselastunitid;
private String csignwastbid;
private String csignwasthid;
private String csignwasttype;
private String csourcebillbid;
private String csourcebillhid;
private String csourcetype;
private String csourcewastbid;
private String csourcewasthid;
private String csourcewasttype;
private String csrc2billbid;
private String csrc2billhid;
private String csrc2billtype;
private String csumid;
private String cvendorid;
private String cworkcenterid;
private String cworksiteid;
private String cwp;
private String dbizdate;
private String ddeliverdate;
private String dfirstbilldate;
private Integer dr;
private String drequiredate;
private String drequiretime;
private String dstandbydate;
private String dvalidate;
private String dzgdate;
private String fassertcardflag;
private Integer fbillrowflag;
private Integer fchecked;
private String flargess;
private String ftoouttransflag;
private Double hsl;
private Integer idesatype;
private String inccontimepoint;
private String inccontimepointname;
private String isok;
private Double materialcost;
private Double naccumtonum;
private Double naccumwastnum;
private Double nbarcodenum;
private Double ncorrespondastnum;
private Double ncorrespondgrsnum;
private Double ncorrespondnum;
private Double ncountnum;
private Integer nfeesettletimes;
private Double ninassistnum;
private Double ningrossnum;
private Double ninnum;
private Double nkdnum;
private Double nmny;
private Double nneedinassistnum;
private Double noutassistnum;
private Double noutgrossnum;
private Double noutnum;
private Double nplannedmny;
private Double nplannedprice;
private Double nprice;
private Integer npricesettlebill;
private Double nquotemny;
private Double nquotentmny;
private Double nquotentprice;
private Double nquoteprice;
private Double nquoteunitnum;
private Double nquoteunitrate;
private Double nreplenishedastnum;
private Double nreplenishednum;
private Double nretastnum;
private Double nretgrossnum;
private Double nretnum;
private Double nsalemny;
private Double nsaleprice;
private Double nshouldinnum;
private Double nshouldoutassistnum;
private Double nshouldoutnum;
private Double ntarenum;
private Double ntaxmny;
private Double ntaxprice;
private Double ntotalmatchnum;
private Double ntotalreasonwastenum;
private Double ntranoutastnum;
private Double ntranoutnum;
private String pkBodycalbody;
private String pkCorp;
private String pkCreqwareid;
private String pkCubasdoc;
private String pkDefdoc1;
private String pkDefdoc10;
private String pkDefdoc11;
private String pkDefdoc12;
private String pkDefdoc13;
private String pkDefdoc14;
private String pkDefdoc15;
private String pkDefdoc16;
private String pkDefdoc17;
private String pkDefdoc18;
private String pkDefdoc19;
private String pkDefdoc2;
private String pkDefdoc20;
private String pkDefdoc3;
private String pkDefdoc4;
private String pkDefdoc5;
private String pkDefdoc6;
private String pkDefdoc7;
private String pkDefdoc8;
private String pkDefdoc9;
private String pkInvoicecorp;
private String pkMeasware;
private String pkPacksort;
private String pkReqcorp;
private String pkReqstoorg;
private String pkReturnreason;
private String process1;
private String process2;
private String process3;
private String process4;
private String process5;
private Double processcost;
private String processmanid;
private Integer serialnum;
private String ts;
private String vbatchcode;
private String vbilltypeu8rm;
private String vbodynote2;
private String vcorrespondrowno;
private String vfirstbillcode;
private String vfirstrowno;
private String vfree1;
private String vfree10;
private String vfree2;
private String vfree3;
private String vfree4;
private String vfree5;
private String vfree6;
private String vfree7;
private String vfree8;
private String vfree9;
private String vnotebody;
private String vproductbatch;
private String vreceiveaddress;
private String vsignwastcode;
private String vsignwastrowno;
private String vsourcebillcode;
private String vsourcerowno;
private String vsourcewastcode;
private String vsourcewastrowno;
private String vsrc2billcode;
private String vsrc2billrowno;
private String vtransfercode;
private String vuserdef1;
private String vuserdef10;
private String vuserdef11;
private String vuserdef12;
private String vuserdef13;
private String vuserdef14;
private String vuserdef15;
private String vuserdef16;
private String vuserdef17;
private String vuserdef18;
private String vuserdef19;
private String vuserdef2;
private String vuserdef20;
private String vuserdef3;
private String vuserdef4;
private String vuserdef5;
private String vuserdef6;
private String vuserdef7;
private String vuserdef8;
private String vuserdef9;
private String vvehiclecode;
private String writeofftype;
private String cupsourcebillbodyid;
}

View File

@ -1,6 +1,7 @@
package com.hzya.frame.plugin.lets.entity;
import com.hzya.frame.web.entity.BaseEntity;
/**
* (IcGeneralH)实体类
*
@ -9,110 +10,127 @@ import com.hzya.frame.web.entity.BaseEntity;
*/
public class IcGeneralHEntity extends BaseEntity {
private String bassetcard;
private String bdelivedtorm;
private String bdirecttranflag;
private String boutretflag;
private String bsalecooppur;
private String cauditorid;
private String cbilltypecode;
private String cbizid;
private String cbiztype;
private String ccustomerid;
private String cdilivertypeid;
private String cdispatcherid;
private String cdptid;
private String cendreportid;
private String cgeneralhid;
private String cinventoryid;
private String clastmodiid;
private String coperatorid;
private String cothercalbodyid;
private String cothercorpid;
private String cotherwhid;
private String coutcalbodyid;
private String coutcorpid;
private String cproviderid;
private String cregister;
private String csettlepathid;
private String ctrancustid;
private String cwarehouseid;
private String cwastewarehouseid;
private String cwhsmanagerid;
private String daccountdate;
private String dauditdate;
private String dbilldate;
private Integer dr;
private Integer fallocflag;
private Integer fbillflag;
private String freplenishflag;
private Integer fspecialflag;
private Integer iprintcount;
private Double ndiscountmny;
private Double nnetmny;
private Double ntotalmny;
private Double ntotalnum;
private String outsourcewarehouseid;
private String pkCalbody;
private String pkCorp;
private String pkCubasdoc;
private String pkCubasdocc;
private String pkDefdoc1;
private String pkDefdoc10;
private String pkDefdoc11;
private String pkDefdoc12;
private String pkDefdoc13;
private String pkDefdoc14;
private String pkDefdoc15;
private String pkDefdoc16;
private String pkDefdoc17;
private String pkDefdoc18;
private String pkDefdoc19;
private String pkDefdoc2;
private String pkDefdoc20;
private String pkDefdoc3;
private String pkDefdoc4;
private String pkDefdoc5;
private String pkDefdoc6;
private String pkDefdoc7;
private String pkDefdoc8;
private String pkDefdoc9;
private String pkMeasware;
private String pkPurcorp;
private String taccounttime;
private String tlastmoditime;
private String tmaketime;
private String ts;
private String vbillcode;
private String vdiliveraddress;
private String vheadnote2;
private String vnote;
private String vuserdef1;
private String vuserdef10;
private String vuserdef11;
private String vuserdef12;
private String vuserdef13;
private String vuserdef14;
private String vuserdef15;
private String vuserdef16;
private String vuserdef17;
private String vuserdef18;
private String vuserdef19;
private String vuserdef2;
private String vuserdef20;
private String vuserdef3;
private String vuserdef4;
private String vuserdef5;
private String vuserdef6;
private String vuserdef7;
private String vuserdef8;
private String vuserdef9;
private String bassetcard;
private String bdelivedtorm;
private String bdirecttranflag;
private String boutretflag;
private String bsalecooppur;
private String cauditorid;
private String cbilltypecode;
private String cbizid;
private String cbiztype;
private String ccustomerid;
private String cdilivertypeid;
private String cdispatcherid;
private String cdptid;
private String cendreportid;
private String cgeneralhid;
private String cinventoryid;
private String clastmodiid;
private String coperatorid;
private String cothercalbodyid;
private String cothercorpid;
private String cotherwhid;
private String coutcalbodyid;
private String coutcorpid;
private String cproviderid;
private String cregister;
private String csettlepathid;
private String ctrancustid;
private String cwarehouseid;
private String cwastewarehouseid;
private String cwhsmanagerid;
private String daccountdate;
private String dauditdate;
private String dbilldate;
private Integer dr;
private Integer fallocflag;
private Integer fbillflag;
private String freplenishflag;
private Integer fspecialflag;
private Integer iprintcount;
private Double ndiscountmny;
private Double nnetmny;
private Double ntotalmny;
private Double ntotalnum;
private String outsourcewarehouseid;
private String pkCalbody;
private String pkCorp;
private String pkCubasdoc;
private String pkCubasdocc;
private String pkDefdoc1;
private String pkDefdoc10;
private String pkDefdoc11;
private String pkDefdoc12;
private String pkDefdoc13;
private String pkDefdoc14;
private String pkDefdoc15;
private String pkDefdoc16;
private String pkDefdoc17;
private String pkDefdoc18;
private String pkDefdoc19;
private String pkDefdoc2;
private String pkDefdoc20;
private String pkDefdoc3;
private String pkDefdoc4;
private String pkDefdoc5;
private String pkDefdoc6;
private String pkDefdoc7;
private String pkDefdoc8;
private String pkDefdoc9;
private String pkMeasware;
private String pkPurcorp;
private String taccounttime;
private String tlastmoditime;
private String tmaketime;
private String ts;
private String vbillcode;
private String vdiliveraddress;
private String vheadnote2;
private String vnote;
private String vuserdef1;
private String vuserdef10;
private String vuserdef11;
private String vuserdef12;
private String vuserdef13;
private String vuserdef14;
private String vuserdef15;
private String vuserdef16;
private String vuserdef17;
private String vuserdef18;
private String vuserdef19;
private String vuserdef2;
private String vuserdef20;
private String vuserdef3;
private String vuserdef4;
private String vuserdef5;
private String vuserdef6;
private String vuserdef7;
private String vuserdef8;
private String vuserdef9;
/** 签字开始时间*/
private String start_signatureTime;
/**
* 签字开始时间
*/
private String start_signatureTime;
/** 签字结束时间*/
private String end_signatureTime;
/**
* 签字结束时间
*/
private String end_signatureTime;
/**
* 来源表头id
*/
private String csourcebillhid;
public String getCsourcebillhid() {
return csourcebillhid;
}
public void setCsourcebillhid(String csourcebillhid) {
this.csourcebillhid = csourcebillhid;
}
public String getStart_signatureTime() {
return start_signatureTime;

View File

@ -340,6 +340,9 @@
<if test="vuserdef7 != null and vuserdef7 != ''">and vuserdef7 = #{vuserdef7}</if>
<if test="vuserdef8 != null and vuserdef8 != ''">and vuserdef8 = #{vuserdef8}</if>
<if test="vuserdef9 != null and vuserdef9 != ''">and vuserdef9 = #{vuserdef9}</if>
<if test="csourcebillhid!=null and csourcebillhid!=''">
and cgeneralhid IN ( SELECT cgeneralhid FROM ic_general_b WHERE dr = 0 AND csourcebillhid = #{csourcebillhid} )
</if>
and dr=0
</trim>
</select>

View File

@ -141,6 +141,16 @@ public class SoSaleorderBEntity extends BaseEntity {
*/
private String vdef19ByIn;
private String vdef20;
public String getVdef20() {
return vdef20;
}
public void setVdef20(String vdef20) {
this.vdef20 = vdef20;
}
public String getCsaleids() {
return csaleids;
}

View File

@ -1268,13 +1268,16 @@ update so_saleorder_b set sts= 'N'
</select>
<resultMap id="queryErrorDetailsIdResultMap" type="com.hzya.frame.plugin.lets.queryvo.ExtIntegrationTaskLivingDetailsQueryVo">
<!--错误id -->
<result property="errorId" column="errorId" />
<result property="vdef19" column="vdef19" />
<result property="vdef20" column="vdef20" />
<result property="csale_bid" column="csale_bid" />
</resultMap>
<select id="queryErrorDetailsId" parameterType="com.hzya.frame.plugin.lets.entity.SoSaleorderBEntity" resultMap="queryErrorDetailsIdResultMap">
select
d.vdef19 errorId
d.vdef19,
d.vdef20,
d.csale_bid
from so_saleorder_b a
left join bd_invmandoc b on a.cinventoryid = b.pk_invmandoc and b.dr = 0
left join bd_invbasdoc c on c.pk_invbasdoc = b.pk_invbasdoc
@ -1290,6 +1293,9 @@ update so_saleorder_b set sts= 'N'
<if test="cbiztype!=null and cbiztype!=''">
and cbiztype = #{cbiztype}
</if>
<if test="csaleid!=null and csaleid!=''">
and csaleid = #{csaleid}
</if>
)
<if test="vdef19!=null and vdef19!=''">
and d.vdef19 = #{vdef19}

View File

@ -16,17 +16,14 @@ import com.hzya.frame.plugin.lets.ofs.dao.ITocofsSaleoutDao;
import com.hzya.frame.plugin.lets.ofs.dao.ITocofsSaleoutDetailedDao;
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.resultvo.CalculateDateVo;
import com.hzya.frame.plugin.lets.queryvo.ExtIntegrationTaskLivingDetailsQueryVo;
import com.hzya.frame.plugin.lets.u8cdto.*;
import com.hzya.frame.plugin.lets.util.*;
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.SaleOrderMessageDto;
import com.hzya.frame.ttxofs.service.OfsUnifiedService;
import com.hzya.frame.web.entity.JsonResultEntity;
@ -36,13 +33,12 @@ 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销售出库单(TOB)生成U8C销售订单
*
* @author makejava
* @see com.hzya.frame.plugin.lets.plugin.sales.SoSaleReturnPluginInitializerToB TOB退货
* @since 2024年8月12日 15:03:51
*/
public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
@ -58,6 +54,9 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
@Autowired
private ISoSaleDao iSoSaleDao;
@Autowired
private ISoSaleorderBDao iSoSaleorderBDao;
@Override
public void initialize() {
logger.info(getPluginLabel() + "執行初始化方法initialize()");
@ -116,10 +115,10 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
@Autowired
private IBdSalestruDao iBdSalestruDao;
@Autowired
private IBdCumandocDao iBdCumandocDao;
@Autowired
private IBdDeptdocDao iBdDeptdocDao;
@ -144,6 +143,12 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
@Autowired
private RdclUtil rdclUtil;
@Autowired
private IIcGeneralHDao iIcGeneralHDao;
@Autowired
private IIcGeneralBDao iIcGeneralBDao;
/**
* 库存同步按指定时间拉取
*
@ -562,6 +567,8 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
// saleorderRequestChildrenDto.setNoriginalcurtaxnetprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税净价
saleorderRequestChildrenDto.setNoriginalcurtaxprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税单价
saleorderRequestChildrenDto.setNtaxrate(new BigDecimal(bdTaxitemsEntity1.getTaxratio()).stripTrailingZeros().toPlainString());//税率
// saleorderRequestChildrenDto.setVdef19(header.getCode());//原单单号
saleorderRequestChildrenDto.setVdef20(detailsDto.getId());//原单明细主键
saleorderRequestChildrenDtoList.add(saleorderRequestChildrenDto);
}
//记录成功
@ -617,7 +624,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
*
* @author liuyang
*/
private String createSuccessFulTradeDate(OrderOutTobHeaderDto orderOutTobHeaderDto) {
private String createSuccessFulTradeDate(OrderOutTobHeaderDto orderOutTobHeaderDto) throws Exception {
if (orderOutTobHeaderDto != null && orderOutTobHeaderDto.getHeader() != null && orderOutTobHeaderDto.getHeader().getTradeSuccessAt() != null) {
HeaderDto header = orderOutTobHeaderDto.getHeader();
String shipAt = header.getTradeSuccessAt();
@ -630,8 +637,8 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
}
return businessFormat;
} else {
logger.error("生成出库日期失败或者tradeSuccessAt为空! json{}", JSON.toJSON(orderOutTobHeaderDto));
Assert.state(false, "生成出库日期失败或者tradeSuccessAt为空! json{}", JSON.toJSON(orderOutTobHeaderDto));
logger.error("生成发票业务日期失败或者tradeSuccessAt为空! json{}", JSON.toJSON(orderOutTobHeaderDto));
Assert.state(false, "生成发票业务日期失败或者tradeSuccessAt为空! json{}", JSON.toJSON(orderOutTobHeaderDto));
return null;
}
}
@ -651,7 +658,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
HeaderDto header = headerDetailsDto.getHeader();
List<DetailsDto> details = headerDetailsDto.getDetails();
//根据销售出库单查询得到销售订单
//根据OFS销售出库单查询得到OFS销售订单
SaleOrderMessageDto saleOrderMessageDto = null;
try {
saleOrderMessageDto = afterSalesOrderUtil.getOfsOrder(header.getRefOrderCode());
@ -970,18 +977,18 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
result = String.valueOf(jsonObject.get("attribute"));
boolean isSuccess = false;
SoSaleResultRootDto soSaleResultRootDto = null;
SoSaleResultRootDto saleinvoiceDto = null;
if (result != null && !"".equals(result)) {
ReusltStrDto reusltStrDto = JSON.parseObject(result, ReusltStrDto.class);
if ("success".equals(reusltStrDto.getStatus())) {
soSaleResultRootDto = resultDataHandle(reusltStrDto.getData());
saleinvoiceDto = resultDataHandleV2(reusltStrDto.getData());
isSuccess = true;
}
}
if (!isSuccess) {
Assert.state(false, "TOB业务O出库单推送U8C销售订单失败 接口返回结果:{}", result);
}
return soSaleResultRootDto;
return saleinvoiceDto;
}
/**
@ -989,7 +996,27 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
*
* @author liuyang
*/
private SoSaleResultRootDto resultDataHandle(String resultData) {
private SaleinvoiceDto resultDataHandle(String resultData) {
try {
if (resultData != null && !"".equals(resultData)) {
if (resultData.contains("[")) {
resultData = resultData.substring(1, resultData.length() - 1);
}
return JSON.parseObject(resultData, SaleinvoiceDto.class);
}
} catch (Exception e) {
logger.error("解析返回参数失败的错误", e);
//如果解析失败记录原因但是不能影响结果的记录
}
return null;
}
/**
* 返回结果解析处理在确认了success后调用
*
* @author liuyang
*/
private SoSaleResultRootDto resultDataHandleV2(String resultData) {
try {
if (resultData != null && !"".equals(resultData)) {
if (resultData.contains("[")) {
@ -1078,8 +1105,52 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
List<SoSaleEntity> soSaleEntityList = iSoSaleDao.query(soSaleEntity);
if (soSaleEntityList == null || soSaleEntityList.size() == 0) {
Assert.state(false, "根据O出库单主键{} 单号:{} 无法匹配到U8C销售订单(传到U8C可能失败了)", header.getId(), header.getCode());
} else if (soSaleEntityList.size() >= 2) {
Assert.state(false, "根据O出库单主键{} 单号:{} 匹配到{}个U8C销售订单", header.getId(), header.getCode(), soSaleEntityList.size());
}
//TODO 测试
// else if (soSaleEntityList.size() >= 2) {
// Assert.state(false, "根据O出库单主键{} 单号:{} 匹配到{}个U8C销售订单", header.getId(), header.getCode(), soSaleEntityList.size());
// }
//查询销售订单明细行表体
SoSaleorderBEntity soSaleorderBEntity = new SoSaleorderBEntity();
soSaleorderBEntity.setDr(0L);
soSaleorderBEntity.setCsaleid(soSaleEntityList.get(soSaleEntityList.size() - 1).getCsaleid());
soSaleorderBEntity.setDataSourceCode("lets_u8c");
List<SoSaleorderBEntity> soSaleorderBEntityList = iSoSaleorderBDao.query(soSaleorderBEntity);
if (soSaleorderBEntityList == null || soSaleorderBEntityList.size() == 0) {
Assert.state(false, "根据O销售订单主键{}无法匹配到U8C销售订单明细行(传到U8C可能失败了)", soSaleEntityList.get(soSaleEntityList.size() - 1).getCsaleid());
} else if (soSaleorderBEntityList.size() >= 2) {
Assert.state(false, "根据O销售订单主键{}无法匹配到U8C销售订单明细行(传到U8C可能失败了)", soSaleEntityList.get(soSaleEntityList.size() - 1).getCsaleid());
}
//查询U8C销售订单对应的销售出库单表头
IcGeneralHEntity icGeneralHEntity = new IcGeneralHEntity();
icGeneralHEntity.setCsourcebillhid(soSaleEntityList.get(soSaleEntityList.size() - 1).getCsaleid());
icGeneralHEntity.setDr(0);
icGeneralHEntity.setDataSourceCode("lets_u8c");
List<IcGeneralHEntity> icGeneralHEntityList = iIcGeneralHDao.query(icGeneralHEntity);
if (icGeneralHEntityList == null || icGeneralHEntityList.size() == 0) {
Assert.state(false, "根据U8C销售订单表头id:{},无法查询到销售出库单", soSaleEntityList.get(soSaleEntityList.size() - 1).getCsaleid());
} else if (icGeneralHEntityList.size() >= 2) {
Assert.state(false, "根据U8C销售订单表头id:{},查询到{}个销售出库单", soSaleEntityList.get(soSaleEntityList.size() - 1).getCsaleid(), icGeneralHEntityList.size());
}
//查询U8C销售订单对应的销售出库单表体
IcGeneralBEntity icGeneralBEntity = new IcGeneralBEntity();
icGeneralBEntity.setCsourcebillhid(soSaleEntityList.get(soSaleEntityList.size() - 1).getCsaleid());
icGeneralBEntity.setDr(0);
icGeneralBEntity.setDataSourceCode("lets_u8c");
List<IcGeneralBEntity> icGeneralBEntityList = iIcGeneralBDao.query(icGeneralBEntity);
if (icGeneralBEntityList == null || icGeneralBEntityList.size() == 0) {
Assert.state(false, "根据U8C销售订单表头id:{},无法查询到销售出库单明细行", soSaleEntityList.get(soSaleEntityList.size() - 1).getCsaleid());
}
//查询U8C销售订单执行情况明细表
SoSaleorderBEntity soSaleorderBEntity1 = new SoSaleorderBEntity();
soSaleorderBEntity1.setCsaleid(soSaleEntityList.get(soSaleEntityList.size() - 1).getCsaleid());
List<ExtIntegrationTaskLivingDetailsQueryVo> extIntegrationTaskLivingDetailsQueryVos = iSoSaleorderBDao.queryErrorDetailsId(soSaleorderBEntity1);
if (extIntegrationTaskLivingDetailsQueryVos == null || extIntegrationTaskLivingDetailsQueryVos.size() == 0) {
Assert.state(false, "根据销售订单主键:{},无法匹配到销售订单执行情况明细");
}
// 销售公司发货公司
@ -1179,40 +1250,40 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
bdCumandocEntity1.setPkCubasdoc(bdCubasdocEntityList.get(0).getPkCubasdoc());
List<BdCumandocEntity> bdCumandocEntityList = iBdCumandocDao.query(bdCumandocEntity1);
if (bdCumandocEntityList == null || bdCumandocEntityList.size() == 0) {
Assert.state(false, "根据客商基本档案主键{},没有办法查询到客商管理档案", bdCubasdocEntityList.get(0).getPkCubasdoc());
Assert.state(false, "根据客商基本档案主键{},无法匹配到客商管理档案", bdCubasdocEntityList.get(0).getPkCubasdoc());
} else if (bdCumandocEntityList.size() >= 2) {
Assert.state(false, "根据客商基本档案主键{},匹配到{}哥客商管理档案", bdCubasdocEntityList.get(0).getPkCubasdoc(), bdCumandocEntityList.size());
}
//查找平台
// String platformZdyId = "0001A210000000000JUD";
// String sourcePlatformCode = header.getSourcePlatformCode();
// BdDefdocEntity bdDefdocEntity = new BdDefdocEntity();
// bdDefdocEntity.setPkDefdoclist(platformZdyId);
// bdDefdocEntity.setDr(0);
// bdDefdocEntity.setDataSourceCode("lets_u8c");
// bdDefdocEntity.setDoccode(sourcePlatformCode);
// List<BdDefdocEntity> bdDefdocEntityList = iBdDefdocDao.query(bdDefdocEntity);
// if (bdDefdocEntityList.size() == 0) {
// Assert.state(false, "根据O平台编码{}无法匹配到U8C平台自定义档案 自定义档案主键:{}", sourcePlatformCode, platformZdyId);
// } else if (bdDefdocEntityList.size() >= 2) {
// Assert.state(false, "根据O平台编码{}无法匹配到U8C平台自定义档案 自定义档案主键:{}", sourcePlatformCode, platformZdyId);
// }
String platformZdyId = "0001A210000000000JUD";
String sourcePlatformCode = header.getSourcePlatformCode();
BdDefdocEntity bdDefdocEntity = new BdDefdocEntity();
bdDefdocEntity.setPkDefdoclist(platformZdyId);
bdDefdocEntity.setDr(0);
bdDefdocEntity.setDataSourceCode("lets_u8c");
bdDefdocEntity.setDoccode(sourcePlatformCode);
List<BdDefdocEntity> bdDefdocEntityList = iBdDefdocDao.query(bdDefdocEntity);
if (bdDefdocEntityList.size() == 0) {
Assert.state(false, "根据O平台编码{}无法匹配到U8C平台自定义档案 自定义档案主键:{}", sourcePlatformCode, platformZdyId);
} else if (bdDefdocEntityList.size() >= 2) {
Assert.state(false, "根据O平台编码{}无法匹配到U8C平台自定义档案 自定义档案主键:{}", sourcePlatformCode, platformZdyId);
}
//查询U8C店铺档案
// String platformZdyId2 = "0001A210000000000XZX";
// String ofsStoreCode = header.getStoreCode();
// BdDefdocEntity bdDefdocEntity2 = new BdDefdocEntity();
// bdDefdocEntity2.setPkDefdoclist(platformZdyId2);
// bdDefdocEntity2.setDr(0);
// bdDefdocEntity2.setDataSourceCode("lets_u8c");
// bdDefdocEntity2.setDoccode(ofsStoreCode);
// List<BdDefdocEntity> bdDefdocEntityList2 = iBdDefdocDao.query(bdDefdocEntity2);
// if (bdDefdocEntityList2.size() == 0) {
// Assert.state(false, "根据O店铺编码{}无法匹配到U8C店铺自定义档案 自定义档案主键:{}", ofsStoreCode, platformZdyId);
// } else if (bdDefdocEntityList2.size() >= 2) {
// Assert.state(false, "根据O店铺编码{}无法匹配到U8C店铺自定义档案 自定义档案主键:{}", ofsStoreCode, platformZdyId);
// }
//业务流程
String platformZdyId2 = "0001A210000000000XZX";
String ofsStoreCode = header.getStoreCode();
BdDefdocEntity bdDefdocEntity2 = new BdDefdocEntity();
bdDefdocEntity2.setPkDefdoclist(platformZdyId2);
bdDefdocEntity2.setDr(0);
bdDefdocEntity2.setDataSourceCode("lets_u8c");
bdDefdocEntity2.setDoccode(ofsStoreCode);
List<BdDefdocEntity> bdDefdocEntityList2 = iBdDefdocDao.query(bdDefdocEntity2);
if (bdDefdocEntityList2.size() == 0) {
Assert.state(false, "根据O店铺编码{}无法匹配到U8C店铺自定义档案 自定义档案主键:{}", ofsStoreCode, platformZdyId);
} else if (bdDefdocEntityList2.size() >= 2) {
Assert.state(false, "根据O店铺编码{}无法匹配到U8C店铺自定义档案 自定义档案主键:{}", ofsStoreCode, platformZdyId);
}
OrderOutTobHeaderDto orderOutTobHeaderDto = new OrderOutTobHeaderDto();
orderOutTobHeaderDto.setBdCorpEntity(bdCorpEntityList.get(0));
@ -1223,10 +1294,14 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
orderOutTobHeaderDto.setBdCumandocEntity(bdCumandocEntityList.get(0));
orderOutTobHeaderDto.setBdCubasdocEntity(bdCubasdocEntityList.get(0));
orderOutTobHeaderDto.setDeliverGoodsCorp(bdCorpEntityList.get(0));
// orderOutTobHeaderDto.setPlatformArchives(bdDefdocEntityList.get(0));
// orderOutTobHeaderDto.setShopArchives(bdDefdocEntityList2.get(0));
orderOutTobHeaderDto.setPlatformArchives(bdDefdocEntityList.get(0));
orderOutTobHeaderDto.setShopArchives(bdDefdocEntityList2.get(0));
orderOutTobHeaderDto.setSaleOrderMessageDto(saleOrderMessageDto);
orderOutTobHeaderDto.setSoSaleEntity(soSaleEntityList.get(0));
orderOutTobHeaderDto.setSoSaleEntity(soSaleEntityList.get(soSaleEntityList.size() - 1));
orderOutTobHeaderDto.setIcGeneralHEntity(icGeneralHEntityList.get(0));
orderOutTobHeaderDto.setIcGeneralBEntityList(icGeneralBEntityList);
orderOutTobHeaderDto.setSoSaleorderBEntityList(soSaleorderBEntityList);
orderOutTobHeaderDto.setExtIntegrationTaskLivingDetailsQueryVos(extIntegrationTaskLivingDetailsQueryVos);
orderOutTobHeaderDto.setHeader(header);
orderOutTobHeaderDto.setDetails(details);
@ -1259,6 +1334,8 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
List<OrderOutTobHeaderDto> orderOutTobHeaderDtos = queryBasicArchivesSaleinvoice(headerDetailsDtoList);
//查询U8C业务流程
BdBusitypeEntity bdBusitypeEntity = u8cOperationFlow();
// 查询销售收发类别
BdRdclEntity bdRdclEntity = rdclUtil.queryRdClObject("201");
logger.info("TOB销售业务交易成功同步档案转换成功对应的数量{}行需要进行数据转换", orderOutTobHeaderDtos.size());
logger.info("TOB销售发票业务流程编码{}", bdBusitypeEntity.getBusicode());
@ -1272,7 +1349,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
BdCorpEntity bdCorpEntity = orderOutTobHeaderDto.getBdCorpEntity();
//发货库存组织
BdCalbodyEntity bdCalbodyEntity = orderOutTobHeaderDto.getBdCalbodyEntity();
//入库参数
//入库仓库
BdStordocEntity bdStordocEntity = orderOutTobHeaderDto.getBdStordocEntity();
//销售组织
BdSalestruEntity bdSalestruEntity = orderOutTobHeaderDto.getBdSalestruEntity();
@ -1292,6 +1369,14 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
BdDefdocEntity shopArchives = orderOutTobHeaderDto.getShopArchives();
//U8C销售订单
SoSaleEntity soSaleEntity = orderOutTobHeaderDto.getSoSaleEntity();
//U8C销售订单明细行
List<SoSaleorderBEntity> soSaleorderBEntityList = orderOutTobHeaderDto.getSoSaleorderBEntityList();
//U8C销售出库单
IcGeneralHEntity icGeneralHEntity = orderOutTobHeaderDto.getIcGeneralHEntity();
//U8C销售出库单明细行
List<IcGeneralBEntity> icGeneralBEntityList = orderOutTobHeaderDto.getIcGeneralBEntityList();
//U8C销售订单执行情况明细表
List<ExtIntegrationTaskLivingDetailsQueryVo> extIntegrationTaskLivingDetailsQueryVos = orderOutTobHeaderDto.getExtIntegrationTaskLivingDetailsQueryVos();
SalesInvoiceHeadDto salesInvoiceHeadDto = new SalesInvoiceHeadDto();
salesInvoiceHeadDto.setCbiztype(bdBusitypeEntity.getPkBusitype());
@ -1302,9 +1387,23 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
salesInvoiceHeadDto.setPk_corp(bdCorpEntity.getPkCorp());
salesInvoiceHeadDto.setDbilldate(successfulTradeDate);
salesInvoiceHeadDto.setFinvoicetype("1");//不传默认为1
salesInvoiceHeadDto.setCdeptid(bdDeptdocEntity.getPkDeptdoc());//部门
salesInvoiceHeadDto.setCwarehouseid(bdStordocEntity.getPkStordoc());//仓库
salesInvoiceHeadDto.setCdispatcherid(bdRdclEntity.getPkRdcl());//收发类别
salesInvoiceHeadDto.setCreceiptcustomerid(bdCumandocEntity.getPkCumandoc());//收货单位
salesInvoiceHeadDto.setCreceipttype("32");//单据类型
salesInvoiceHeadDto.setDmakedate(successfulTradeDate);//制单日期
salesInvoiceHeadDto.setNdiscountrate("100");
salesInvoiceHeadDto.setDapprovedate(successfulTradeDate);//审批日期
salesInvoiceHeadDto.setVdef17(ProfilesActiveConstant.sourceSystem1);
salesInvoiceHeadDto.setVdef19(header.getCode());
salesInvoiceHeadDto.setVdef20(header.getId());
//平台
salesInvoiceHeadDto.setPk_defdoc2(platformArchives.getPkDefdoc());
salesInvoiceHeadDto.setVdef2(platformArchives.getDocname());
//店铺
salesInvoiceHeadDto.setPk_defdoc1(shopArchives.getPkDefdoc());
salesInvoiceHeadDto.setVdef1(shopArchives.getDocname());
List<SalesInvoiceBodyDto> salesInvoiceBodyDtoList = new ArrayList<>();
for (int j = 0; j < details.size(); j++) {
@ -1315,6 +1414,10 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
BdInvbasdocEntity bdInvbasdocEntity = queryStockBasicArchives(bdInvmandocEntity.getPkInvmandoc(), deliverGoodsCorp.getPkCorp());
//根据存货基础档案编码查询当前存货的税率
BdTaxitemsEntity bdTaxitemsEntity1 = queryBdTaxitems(bdInvbasdocEntity.getInvcode());
//查找来源单据销售发票的来源单据为销售出库单
IcGeneralBEntity sourceDocuments = findSourceDocuments(header, detailsDto, soSaleorderBEntityList, icGeneralBEntityList, extIntegrationTaskLivingDetailsQueryVos);
//查找来源销售订单明细行
SoSaleorderBEntity sourceDocumentsV2 = findSourceDocumentsV2(header, detailsDto, soSaleorderBEntityList, extIntegrationTaskLivingDetailsQueryVos);
BigDecimal noriginalcurtaxprice = null;//含税单价
try {
@ -1327,15 +1430,33 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
if (noriginalcurtaxprice == null) {
isblargessflag = true;
}
//TODO 测试
detailsDto.setShipQty("1");
SalesInvoiceBodyDto salesInvoiceBodyDto = new SalesInvoiceBodyDto();
salesInvoiceBodyDto.setCinventoryid(bdInvmandocEntity.getPkInvmandoc());
salesInvoiceBodyDto.setCupreceipttype("4C");
salesInvoiceBodyDto.setCupsourcebillcode(soSaleEntity.getVreceiptcode());
salesInvoiceBodyDto.setCupreceipttype("4C");//来源单据类型
salesInvoiceBodyDto.setCupsourcebillcode(icGeneralHEntity.getVbillcode());//来源单据号
salesInvoiceBodyDto.setNnumber(detailsDto.getShipQty());
salesInvoiceBodyDto.setNoriginalcurtaxprice(noriginalcurtaxprice.stripTrailingZeros().toPlainString());//含税单价
salesInvoiceBodyDto.setNtaxrate(new BigDecimal(bdTaxitemsEntity1.getTaxratio()).stripTrailingZeros().toPlainString());//税率
salesInvoiceBodyDto.setBlargessflag(isblargessflag);
salesInvoiceBodyDto.setCoriginalbillcode(soSaleEntity.getVreceiptcode());//源头单据号
salesInvoiceBodyDto.setCsourcebillbodyid(sourceDocumentsV2.getCorderBid());//源头单据明细行主键 (数据字典上是来源单据明细行主键实际上是源头)
salesInvoiceBodyDto.setCsourcebillid(soSaleEntity.getCsaleid());//源头单据主表主键数据字典上是来源单据主表主键实际上是源头
salesInvoiceBodyDto.setCupsourcebillbodyid(sourceDocuments.getCgeneralbid());//上层来源明细行主键
salesInvoiceBodyDto.setCupsourcebillcode(icGeneralHEntity.getVbillcode());//直接来源单据号
salesInvoiceBodyDto.setCupsourcebillid(icGeneralHEntity.getCgeneralhid());//来源主表主键
// salesInvoiceBodyDto.setCbodywarehouseid("1009A2100000000002BV");//附表仓库
// salesInvoiceBodyDto.setCcurrencytypeid("00010000000000000001");//原币
// salesInvoiceBodyDto.setCcustomerid("0001A210000000002Q1E");//订单客户
// salesInvoiceBodyDto.setCinvbasdocid("0001A210000000001GF0");//存货档案主键
// salesInvoiceBodyDto.setCquoteunitid("0001A210000000000EYM");//报价计量单位
// salesInvoiceBodyDto.setCreceiptcorpid("0001A210000000002Q1E");//收货单位
// salesInvoiceBodyDto.setCreceipttype("30");//来源单据类型
// salesInvoiceBodyDto.setCsaleid("1009A2100000000004WK");//销售主表id
// salesInvoiceBodyDto.setCunitid("0001A210000000000EYM");//主计量单位
// salesInvoiceBodyDto.setCupsourcebillbodyid("1009A2100000000004R3");//上层来源单据行
salesInvoiceBodyDtoList.add(salesInvoiceBodyDto);
}
SalesInvoiceDto salesInvoiceDto = new SalesInvoiceDto();
@ -1349,8 +1470,13 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
stringListMap.put("billvos", salesInvoiceDtoList);
//推送到U8C
SoSaleResultRootDto soSaleResultRootDto = sendU8CTOCSoSaleinvoiceB(JSON.toJSONString(stringListMap));
SaleinvoiceDto saleinvoiceDto = sendU8CTOCSoSaleinvoiceB(JSON.toJSONString(stringListMap));
//成功
if (saleinvoiceDto != null && saleinvoiceDto.getParentvo() != null && saleinvoiceDto.getChildrenvo() != null) {
SaleinvoiceHeadDto parentvo = saleinvoiceDto.getParentvo();
List<SaleinvoiceBodyDto> childrenvo = saleinvoiceDto.getChildrenvo();
logger.info("TOB销售发票生成成功 编码:{} 发票公司:{}", parentvo.getVreceiptcode(), parentvo.getPk_corp());
}
} catch (Exception e) {
logger.error("OTOB的销售发票传输失败抛出异常", e);
//失败
@ -1365,7 +1491,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
*
* @author liuyang
*/
public SoSaleResultRootDto sendU8CTOCSoSaleinvoiceB(String param) throws Exception {
public SaleinvoiceDto sendU8CTOCSoSaleinvoiceB(String param) throws Exception {
long startLong = System.currentTimeMillis();
logger.info("TOB销售发票推送开始推送参数" + param + ",U8C_URL:" + ProfilesActiveConstant.U8C_URL);
String result = HttpRequest.post(ProfilesActiveConstant.U8C_URL).header("appId", "800037")//头信息多个头信息多次调用此方法即可
@ -1375,7 +1501,8 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
.body(param)//表单内容
.timeout(20000)//超时毫秒
.execute().body();
logger.info("TOB销售发票结束返回参数" + result);
//2024年8月29日 17:56:50 如果http请求超时则会抛给上层方法上层方法会完成异常的捕捉
logger.info("TOB销售发票推送结束返回参数" + result);
long endLong = System.currentTimeMillis();
logger.info("TOB销售发票接口请求耗时" + (endLong - startLong));
@ -1383,7 +1510,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
result = String.valueOf(jsonObject.get("attribute"));
boolean isSuccess = false;
SoSaleResultRootDto soSaleResultRootDto = null;
SaleinvoiceDto soSaleResultRootDto = null;
if (result != null && !"".equals(result)) {
ReusltStrDto reusltStrDto = JSON.parseObject(result, ReusltStrDto.class);
if ("success".equals(reusltStrDto.getStatus())) {
@ -1396,4 +1523,84 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity {
}
return soSaleResultRootDto;
}
/**
* 查找来源单据,销售发票的来源单据为销售出库单生成TOB销售订单时明细行传O的明细行主键查找逻辑
* O明细行主键 -> 定位到U8C销售订单明细行 -> 销售出库单明细行
*
* @param header O表头明细行
* @param detailsDto O明细行
* @param soSaleorderBEntityList U8C销售订单明细集合
* @param icGeneralBEntityList U8C销售出库单明细集合
* @param extIntegrationTaskLivingDetailsQueryVos U8C销售订单执行情况明细表
* @author liuyang
*/
private IcGeneralBEntity findSourceDocuments(HeaderDto header, DetailsDto detailsDto, List<SoSaleorderBEntity> soSaleorderBEntityList, List<IcGeneralBEntity> icGeneralBEntityList, List<ExtIntegrationTaskLivingDetailsQueryVo> extIntegrationTaskLivingDetailsQueryVos) {
Assert.notNull(header, "header不能为空");
Assert.notNull(detailsDto, "detailsDto不能为空");
Assert.notNull(soSaleorderBEntityList, "soSaleorderBEntityList不能为空");
Assert.notNull(icGeneralBEntityList, "icGeneralBEntityList不能为空");
Assert.notNull(extIntegrationTaskLivingDetailsQueryVos, "extIntegrationTaskLivingDetailsQueryVos不能为空");
ExtIntegrationTaskLivingDetailsQueryVo targetExtIntegrationTaskLivingDetailsQueryVo = null;
for (int i = 0; i < extIntegrationTaskLivingDetailsQueryVos.size(); i++) {
ExtIntegrationTaskLivingDetailsQueryVo extIntegrationTaskLivingDetailsQueryVo = extIntegrationTaskLivingDetailsQueryVos.get(i);
if (extIntegrationTaskLivingDetailsQueryVo.getVdef20().equals(detailsDto.getId())) {
targetExtIntegrationTaskLivingDetailsQueryVo = extIntegrationTaskLivingDetailsQueryVo;
}
}
Assert.notNull(targetExtIntegrationTaskLivingDetailsQueryVo, "无法匹配到销售订单执行情况明细行O明细行主键", detailsDto.getId());
SoSaleorderBEntity targetSoSaleorderBEntity = null;
for (int i = 0; i < soSaleorderBEntityList.size(); i++) {
SoSaleorderBEntity soSaleorderBEntity = soSaleorderBEntityList.get(i);
if (targetExtIntegrationTaskLivingDetailsQueryVo.getCsale_bid().equals(soSaleorderBEntity.getCorderBid())) {
targetSoSaleorderBEntity = soSaleorderBEntity;
}
}
Assert.notNull(targetSoSaleorderBEntity, "根据O出库单明细主键:{}无法匹配到U8C销售订单明细行");
for (int i = 0; i < icGeneralBEntityList.size(); i++) {
IcGeneralBEntity icGeneralBEntity = icGeneralBEntityList.get(i);
if (icGeneralBEntity.getCsourcebillbid().equals(targetSoSaleorderBEntity.getCorderBid())) {
return icGeneralBEntity;
}
}
Assert.state(false, "根据销售订单明细行主键:{} 无法匹配到销售出库单明细行", targetSoSaleorderBEntity.getCorderBid());
return null;
}
/**
* 查找销售订单明细行
*
* @param header O表头明细行
* @param detailsDto O明细行
* @param soSaleorderBEntityList U8C销售订单明细集合
* @author liuyang
*/
private SoSaleorderBEntity findSourceDocumentsV2(HeaderDto header, DetailsDto detailsDto, List<SoSaleorderBEntity> soSaleorderBEntityList, List<ExtIntegrationTaskLivingDetailsQueryVo> extIntegrationTaskLivingDetailsQueryVos) {
Assert.notNull(header, "header不能为空");
Assert.notNull(detailsDto, "detailsDto不能为空");
Assert.notNull(soSaleorderBEntityList, "soSaleorderBEntityList不能为空");
Assert.notNull(extIntegrationTaskLivingDetailsQueryVos, "extIntegrationTaskLivingDetailsQueryVos不能为空!");
ExtIntegrationTaskLivingDetailsQueryVo targetExtIntegrationTaskLivingDetailsQueryVo = null;
for (int i = 0; i < extIntegrationTaskLivingDetailsQueryVos.size(); i++) {
ExtIntegrationTaskLivingDetailsQueryVo extIntegrationTaskLivingDetailsQueryVo = extIntegrationTaskLivingDetailsQueryVos.get(i);
if (extIntegrationTaskLivingDetailsQueryVo.getVdef20().equals(detailsDto.getId())) {
targetExtIntegrationTaskLivingDetailsQueryVo = extIntegrationTaskLivingDetailsQueryVo;
}
}
Assert.notNull(targetExtIntegrationTaskLivingDetailsQueryVo, "无法匹配到销售订单执行情况明细行O明细行主键", detailsDto.getId());
SoSaleorderBEntity targetSoSaleorderBEntity = null;
for (int i = 0; i < soSaleorderBEntityList.size(); i++) {
SoSaleorderBEntity soSaleorderBEntity = soSaleorderBEntityList.get(i);
if (targetExtIntegrationTaskLivingDetailsQueryVo.getCsale_bid().equals(soSaleorderBEntity.getCorderBid())) {
targetSoSaleorderBEntity = soSaleorderBEntity;
}
}
Assert.notNull(targetSoSaleorderBEntity, "根据O出库单明细主键:{}无法匹配到U8C销售订单明细行");
return targetSoSaleorderBEntity;
}
}

View File

@ -41,6 +41,7 @@ import java.util.*;
* OFS售后入库单(TOB)生成U8C红字销售订单
*
* @author makejava
* @see SoSaleOutPluginInitializerToB TOB销售
* @since 2024年8月12日 15:03:51
*/
public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity {

View File

@ -1,5 +1,7 @@
package com.hzya.frame.plugin.lets.queryvo;
import lombok.Data;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.plugin.lets.queryvo
@ -8,15 +10,9 @@ package com.hzya.frame.plugin.lets.queryvo;
* @Date2024/2/20 11:34
* @FilenameExtIntegrationTaskLivingDetailsQueryVo
*/
@Data
public class ExtIntegrationTaskLivingDetailsQueryVo {
private String errorId;
public String getErrorId() {
return errorId;
}
public void setErrorId(String errorId) {
this.errorId = errorId;
}
private String vdef19;
private String vdef20;
private String csale_bid;
}

View File

@ -1,10 +1,13 @@
package com.hzya.frame.plugin.lets.u8cdto;
import com.hzya.frame.plugin.lets.entity.*;
import com.hzya.frame.plugin.lets.queryvo.ExtIntegrationTaskLivingDetailsQueryVo;
import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto;
import com.hzya.frame.ttxofs.dto.ofssalesordersearch.SaleOrderMessageDto;
import lombok.Data;
import java.util.List;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.plugin.lets.u8cdto
@ -86,4 +89,24 @@ public class OrderOutTobHeaderDto extends HeaderDetailsDto {
* U8C销售订单
*/
private SoSaleEntity soSaleEntity;
/**
* U8C销售出库单表头
*/
private IcGeneralHEntity icGeneralHEntity;
/**
* U8C销售出库单明细行
*/
private List<IcGeneralBEntity> icGeneralBEntityList;
/**
* U8C销售订单明细行
*/
private List<SoSaleorderBEntity> soSaleorderBEntityList;
/**
* 执行情况自定义项
*/
private List<ExtIntegrationTaskLivingDetailsQueryVo> extIntegrationTaskLivingDetailsQueryVos;
}

View File

@ -0,0 +1,54 @@
package com.hzya.frame.plugin.lets.u8cdto;
import lombok.Data;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.plugin.lets.u8cdto
* @ProjectkangarooDataCenterV3
* @nameSaleinvoiceHead
* @Date2024/8/29 17:38
* @FilenameSaleinvoiceHead
*/
@Data
public class SaleinvoiceBodyDto {
private String cinventoryid;
private String inventory_code;
private String inventory_name;
private String nnumber;
private String noriginalcursummny;
private String cunitid;
private String unit_code;
private String unit_name;
private String csaleid;
private String creceiptcorpid;
private String ccalbodyid;
private String advisecalbody_code;
private String advisecalbody_name;
private String cbodywarehouseid;
private String warehouse_code;
private String warehouse_name;
private String cquoteunitid;
private String quoteunit_code;
private String quoteunit_name;
private String blargessflag;
private String noriginalcurprice;
private String crowno;
private String ntaxrate;
private String noriginalcurtaxprice;
private String noriginalcurmny;
private String noriginalcurtaxmny;
private String ndiscountrate;
private String nitemdiscountrate;
private String noriginalcurnetprice;
private String noriginalcurtaxnetprice;
private String noriginalcurdiscountmny;
private String ccustomerid;
private String ddeliverdate;
private String cupreceipttype;
private String cupsourcebillcode;
private String nexchangeotobrate;
private String coriginalbillcode;
private String csourcebillbodyid;
private String csourcebillid;
}

View File

@ -0,0 +1,19 @@
package com.hzya.frame.plugin.lets.u8cdto;
import lombok.Data;
import java.util.List;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.plugin.lets.u8cdto
* @ProjectkangarooDataCenterV3
* @nameSaleinvoiceHead
* @Date2024/8/29 17:38
* @FilenameSaleinvoiceHead
*/
@Data
public class SaleinvoiceDto {
private SaleinvoiceHeadDto parentvo;
private List<SaleinvoiceBodyDto> childrenvo;
}

View File

@ -0,0 +1,75 @@
package com.hzya.frame.plugin.lets.u8cdto;
import lombok.Data;
/**
* @Authorliuyang
* @Packagecom.hzya.frame.plugin.lets.u8cdto
* @ProjectkangarooDataCenterV3
* @nameSaleinvoiceHead
* @Date2024/8/29 17:38
* @FilenameSaleinvoiceHead
*/
@Data
public class SaleinvoiceHeadDto {
private String pk_corp;
private String corp_code;
private String corp_name;
private String cbiztype;
private String biztype_code;
private String biztype_name;
private String creceiptcorpid;
private String creceiptcorpid_code;
private String creceiptcorpid_name;
private String csalecorpid;
private String salecorp_code;
private String salecorp_name;
private String ccalbodyid;
private String calbody_code;
private String calbody_name;
private String coperatorid;
private String operator_code;
private String operator_name;
private String cdeptid;
private String dept_code;
private String dept_name;
private String vreceiptcode;
private String dbilldate;
private String dmakedate;
private String dbilltime;
private String dapprovedate;
private String daudittime;
private String dmoditime;
private String capproveid;
private String approver_code;
private String approver_name;
private String creceiptcustomerid;
private String receiptcustomer_code;
private String receiptcustomer_name;
private String fstatus;
private String ndiscountrate;
private String cwarehouseid;
private String warehouse_code;
private String warehouse_name;
private String csaleid;
private String pk_defdoc1;
private String vdef1;
private String pk_defdoc2;
private String vdef2;
private String vdef17;
private String vdef19;
private String vdef20;
private String cdispatcherid;
private String cdispatcherid_code;
private String cdispatcherid_name;
private String nexchangeotobrate;
private String ccurrencyid;
private String ccurrencyid_code;
private String ccurrencyid_name;
private String ntotalsummny;
private String nstrikemny;
private String nnetmny;
private String ntotalnum;
private String finvoicetype;
private String feinvstatus;
}

View File

@ -36,4 +36,17 @@ public class SalesInvoiceBodyDto {
private String vdef1;
private String vfree1;
private String vsourcerowno;
private String coriginalbillcode;
private String csourcebillbodyid;
private String csourcebillid;
private String cupsourcebillbodyid;
private String cupsourcebillid;
private String cbodywarehouseid;
private String ccurrencytypeid;
private String ccustomerid;
private String cinvbasdocid;
private String creceiptcorpid;
private String creceipttype;
private String csaleid;
private String cunitid;
}

View File

@ -32,4 +32,11 @@ public class SalesInvoiceHeadDto {
private String vdef20;
private String vnote;
private String vreceiptcode;
private String pk_defdoc2;
private String vdef2;
private String cdispatcherid;
private String creceiptcustomerid;
private String creceipttype;
private String dmakedate;
private String dapprovedate;
}

View File

@ -5,6 +5,7 @@ import lombok.Data;
@Data
public class DetailsDto {
private String id;
private String clientCode;
private String companyCode;
private String facilityCode;

View File

@ -66,6 +66,7 @@ public class HeaderDto {
private String shipToCityName;
private String shipToDistrictName;
private String tradeSuccessAt;
private String sourceOrderStatus;
/**
* 发货日期