diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/dao/IBdBomDao.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/dao/IBdBomDao.java new file mode 100644 index 00000000..c66b7587 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/dao/IBdBomDao.java @@ -0,0 +1,22 @@ +package com.hzya.frame.plugin.lets.dao; + +import com.hzya.frame.plugin.lets.entity.BdBomEntity; +import com.hzya.frame.basedao.dao.IBaseDao; + +import java.util.List; + +/** + * (BD_BOM: table)表数据库访问层 + * + * @author makejava + * @since 2024-09-02 14:56:24 + */ +public interface IBdBomDao extends IBaseDao { + /** + * 查询BOM版本 + * + * @author liuyang + */ + List queryBomVersion(BdBomEntity bdBomEntity) throws Exception; +} + diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/dao/impl/BdBomDaoImpl.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/dao/impl/BdBomDaoImpl.java new file mode 100644 index 00000000..4cc8c3e3 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/dao/impl/BdBomDaoImpl.java @@ -0,0 +1,22 @@ +package com.hzya.frame.plugin.lets.dao.impl; + +import com.hzya.frame.plugin.lets.entity.BdBomEntity; +import com.hzya.frame.plugin.lets.dao.IBdBomDao; +import org.springframework.stereotype.Repository; +import com.hzya.frame.basedao.dao.MybatisGenericDao; + +import java.util.List; + +/** + * (BdBom)表数据库访问层 + * + * @author makejava + * @since 2024-09-02 14:56:24 + */ +public class BdBomDaoImpl extends MybatisGenericDao implements IBdBomDao { + @Override + public List queryBomVersion(BdBomEntity bdBomEntity) throws Exception { + return query("com.hzya.frame.plugin.lets.dao.impl.BdBomDaoImpl.queryBomVersion", bdBomEntity); + } +} + diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdBomEntity.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdBomEntity.java new file mode 100644 index 00000000..bb62b4e7 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdBomEntity.java @@ -0,0 +1,610 @@ +package com.hzya.frame.plugin.lets.entity; + +import com.hzya.frame.web.entity.BaseEntity; + +/** + * (BdBom)实体类 + * + * @author makejava + * @since 2024-09-02 14:57:03 + */ +public class BdBomEntity extends BaseEntity { + + private String bblx; + private String bomlx; + private String clf; + private String creat; + private String dr; + private String fsl; + private String fslsx; + private String fslxx; + private String gcbm; + private String gdfsl; + private String gdsl; + private String hsl; + private String jldwid; + private String memo; + private String mver; + private String pkBomid; + private String pkCorp; + private String pkProduce; + private String rgf; + private String sfmr; + private String sftpmr; + private String sl; + private String slsx; + private String slxx; + private String ts; + private String version; + private String wlbmid; + private String zdy1; + private String zdy10; + private String zdy11; + private String zdy12; + private String zdy13; + private String zdy14; + private String zdy15; + private String zdy16; + private String zdy17; + private String zdy18; + private String zdy19; + private String zdy2; + private String zdy20; + private String zdy3; + private String zdy4; + private String zdy5; + private String zdy6; + private String zdy7; + private String zdy8; + private String zdy9; + private String zt; + private String zyx1; + private String zyx2; + private String zyx3; + private String zyx4; + private String zyx5; + private String zzf; + private String bomtypeFrom; + private String cjrq; + private String cjsj; + private String createtype; + private String gcbmFrom; + private String modifiedtime; + private String modifier; + private String pkBomidFrom; + private String pkCorpFrom; + private String qrrid; + private String qrrq; + private String qrsj; + + + public String getBblx() { + return bblx; + } + + public void setBblx(String bblx) { + this.bblx = bblx; + } + + public String getBomlx() { + return bomlx; + } + + public void setBomlx(String bomlx) { + this.bomlx = bomlx; + } + + public String getClf() { + return clf; + } + + public void setClf(String clf) { + this.clf = clf; + } + + public String getCreat() { + return creat; + } + + public void setCreat(String creat) { + this.creat = creat; + } + + public String getDr() { + return dr; + } + + public void setDr(String dr) { + this.dr = dr; + } + + public String getFsl() { + return fsl; + } + + public void setFsl(String fsl) { + this.fsl = fsl; + } + + public String getFslsx() { + return fslsx; + } + + public void setFslsx(String fslsx) { + this.fslsx = fslsx; + } + + public String getFslxx() { + return fslxx; + } + + public void setFslxx(String fslxx) { + this.fslxx = fslxx; + } + + public String getGcbm() { + return gcbm; + } + + public void setGcbm(String gcbm) { + this.gcbm = gcbm; + } + + public String getGdfsl() { + return gdfsl; + } + + public void setGdfsl(String gdfsl) { + this.gdfsl = gdfsl; + } + + public String getGdsl() { + return gdsl; + } + + public void setGdsl(String gdsl) { + this.gdsl = gdsl; + } + + public String getHsl() { + return hsl; + } + + public void setHsl(String hsl) { + this.hsl = hsl; + } + + public String getJldwid() { + return jldwid; + } + + public void setJldwid(String jldwid) { + this.jldwid = jldwid; + } + + public String getMemo() { + return memo; + } + + public void setMemo(String memo) { + this.memo = memo; + } + + public String getMver() { + return mver; + } + + public void setMver(String mver) { + this.mver = mver; + } + + public String getPkBomid() { + return pkBomid; + } + + public void setPkBomid(String pkBomid) { + this.pkBomid = pkBomid; + } + + public String getPkCorp() { + return pkCorp; + } + + public void setPkCorp(String pkCorp) { + this.pkCorp = pkCorp; + } + + public String getPkProduce() { + return pkProduce; + } + + public void setPkProduce(String pkProduce) { + this.pkProduce = pkProduce; + } + + public String getRgf() { + return rgf; + } + + public void setRgf(String rgf) { + this.rgf = rgf; + } + + public String getSfmr() { + return sfmr; + } + + public void setSfmr(String sfmr) { + this.sfmr = sfmr; + } + + public String getSftpmr() { + return sftpmr; + } + + public void setSftpmr(String sftpmr) { + this.sftpmr = sftpmr; + } + + public String getSl() { + return sl; + } + + public void setSl(String sl) { + this.sl = sl; + } + + public String getSlsx() { + return slsx; + } + + public void setSlsx(String slsx) { + this.slsx = slsx; + } + + public String getSlxx() { + return slxx; + } + + public void setSlxx(String slxx) { + this.slxx = slxx; + } + + public String getTs() { + return ts; + } + + public void setTs(String ts) { + this.ts = ts; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getWlbmid() { + return wlbmid; + } + + public void setWlbmid(String wlbmid) { + this.wlbmid = wlbmid; + } + + public String getZdy1() { + return zdy1; + } + + public void setZdy1(String zdy1) { + this.zdy1 = zdy1; + } + + public String getZdy10() { + return zdy10; + } + + public void setZdy10(String zdy10) { + this.zdy10 = zdy10; + } + + public String getZdy11() { + return zdy11; + } + + public void setZdy11(String zdy11) { + this.zdy11 = zdy11; + } + + public String getZdy12() { + return zdy12; + } + + public void setZdy12(String zdy12) { + this.zdy12 = zdy12; + } + + public String getZdy13() { + return zdy13; + } + + public void setZdy13(String zdy13) { + this.zdy13 = zdy13; + } + + public String getZdy14() { + return zdy14; + } + + public void setZdy14(String zdy14) { + this.zdy14 = zdy14; + } + + public String getZdy15() { + return zdy15; + } + + public void setZdy15(String zdy15) { + this.zdy15 = zdy15; + } + + public String getZdy16() { + return zdy16; + } + + public void setZdy16(String zdy16) { + this.zdy16 = zdy16; + } + + public String getZdy17() { + return zdy17; + } + + public void setZdy17(String zdy17) { + this.zdy17 = zdy17; + } + + public String getZdy18() { + return zdy18; + } + + public void setZdy18(String zdy18) { + this.zdy18 = zdy18; + } + + public String getZdy19() { + return zdy19; + } + + public void setZdy19(String zdy19) { + this.zdy19 = zdy19; + } + + public String getZdy2() { + return zdy2; + } + + public void setZdy2(String zdy2) { + this.zdy2 = zdy2; + } + + public String getZdy20() { + return zdy20; + } + + public void setZdy20(String zdy20) { + this.zdy20 = zdy20; + } + + public String getZdy3() { + return zdy3; + } + + public void setZdy3(String zdy3) { + this.zdy3 = zdy3; + } + + public String getZdy4() { + return zdy4; + } + + public void setZdy4(String zdy4) { + this.zdy4 = zdy4; + } + + public String getZdy5() { + return zdy5; + } + + public void setZdy5(String zdy5) { + this.zdy5 = zdy5; + } + + public String getZdy6() { + return zdy6; + } + + public void setZdy6(String zdy6) { + this.zdy6 = zdy6; + } + + public String getZdy7() { + return zdy7; + } + + public void setZdy7(String zdy7) { + this.zdy7 = zdy7; + } + + public String getZdy8() { + return zdy8; + } + + public void setZdy8(String zdy8) { + this.zdy8 = zdy8; + } + + public String getZdy9() { + return zdy9; + } + + public void setZdy9(String zdy9) { + this.zdy9 = zdy9; + } + + public String getZt() { + return zt; + } + + public void setZt(String zt) { + this.zt = zt; + } + + public String getZyx1() { + return zyx1; + } + + public void setZyx1(String zyx1) { + this.zyx1 = zyx1; + } + + public String getZyx2() { + return zyx2; + } + + public void setZyx2(String zyx2) { + this.zyx2 = zyx2; + } + + public String getZyx3() { + return zyx3; + } + + public void setZyx3(String zyx3) { + this.zyx3 = zyx3; + } + + public String getZyx4() { + return zyx4; + } + + public void setZyx4(String zyx4) { + this.zyx4 = zyx4; + } + + public String getZyx5() { + return zyx5; + } + + public void setZyx5(String zyx5) { + this.zyx5 = zyx5; + } + + public String getZzf() { + return zzf; + } + + public void setZzf(String zzf) { + this.zzf = zzf; + } + + public String getBomtypeFrom() { + return bomtypeFrom; + } + + public void setBomtypeFrom(String bomtypeFrom) { + this.bomtypeFrom = bomtypeFrom; + } + + public String getCjrq() { + return cjrq; + } + + public void setCjrq(String cjrq) { + this.cjrq = cjrq; + } + + public String getCjsj() { + return cjsj; + } + + public void setCjsj(String cjsj) { + this.cjsj = cjsj; + } + + public String getCreatetype() { + return createtype; + } + + public void setCreatetype(String createtype) { + this.createtype = createtype; + } + + public String getGcbmFrom() { + return gcbmFrom; + } + + public void setGcbmFrom(String gcbmFrom) { + this.gcbmFrom = gcbmFrom; + } + + public String getModifiedtime() { + return modifiedtime; + } + + public void setModifiedtime(String modifiedtime) { + this.modifiedtime = modifiedtime; + } + + public String getModifier() { + return modifier; + } + + public void setModifier(String modifier) { + this.modifier = modifier; + } + + public String getPkBomidFrom() { + return pkBomidFrom; + } + + public void setPkBomidFrom(String pkBomidFrom) { + this.pkBomidFrom = pkBomidFrom; + } + + public String getPkCorpFrom() { + return pkCorpFrom; + } + + public void setPkCorpFrom(String pkCorpFrom) { + this.pkCorpFrom = pkCorpFrom; + } + + public String getQrrid() { + return qrrid; + } + + public void setQrrid(String qrrid) { + this.qrrid = qrrid; + } + + public String getQrrq() { + return qrrq; + } + + public void setQrrq(String qrrq) { + this.qrrq = qrrq; + } + + public String getQrsj() { + return qrsj; + } + + public void setQrsj(String qrsj) { + this.qrsj = qrsj; + } + +} + diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdBomEntity.xml b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdBomEntity.xml new file mode 100644 index 00000000..feecdf0b --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/entity/BdBomEntity.xml @@ -0,0 +1,927 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + BBLX + ,BOMLX + ,CLF + ,CREAT + ,DR + ,FSL + ,FSLSX + ,FSLXX + ,GCBM + ,GDFSL + ,GDSL + ,HSL + ,JLDWID + ,MEMO + ,MVER + ,PK_BOMID + ,PK_CORP + ,PK_PRODUCE + ,RGF + ,SFMR + ,SFTPMR + ,SL + ,SLSX + ,SLXX + ,TS + ,VERSION + ,WLBMID + ,ZDY1 + ,ZDY10 + ,ZDY11 + ,ZDY12 + ,ZDY13 + ,ZDY14 + ,ZDY15 + ,ZDY16 + ,ZDY17 + ,ZDY18 + ,ZDY19 + ,ZDY2 + ,ZDY20 + ,ZDY3 + ,ZDY4 + ,ZDY5 + ,ZDY6 + ,ZDY7 + ,ZDY8 + ,ZDY9 + ,ZT + ,ZYX1 + ,ZYX2 + ,ZYX3 + ,ZYX4 + ,ZYX5 + ,ZZF + ,BOMTYPE_FROM + ,CJRQ + ,CJSJ + ,CREATETYPE + ,GCBM_FROM + ,MODIFIEDTIME + ,MODIFIER + ,PK_BOMID_FROM + ,PK_CORP_FROM + ,QRRID + ,QRRQ + ,QRSJ + + + + + + + + + + + + + + + + insert into BD_BOM( + + BBLX , + BOMLX , + CLF , + CREAT , + DR , + FSL , + FSLSX , + FSLXX , + GCBM , + GDFSL , + GDSL , + HSL , + JLDWID , + MEMO , + MVER , + PK_BOMID , + PK_CORP , + PK_PRODUCE , + RGF , + SFMR , + SFTPMR , + SL , + SLSX , + SLXX , + TS , + VERSION , + WLBMID , + ZDY1 , + ZDY10 , + ZDY11 , + ZDY12 , + ZDY13 , + ZDY14 , + ZDY15 , + ZDY16 , + ZDY17 , + ZDY18 , + ZDY19 , + ZDY2 , + ZDY20 , + ZDY3 , + ZDY4 , + ZDY5 , + ZDY6 , + ZDY7 , + ZDY8 , + ZDY9 , + ZT , + ZYX1 , + ZYX2 , + ZYX3 , + ZYX4 , + ZYX5 , + ZZF , + BOMTYPE_FROM , + CJRQ , + CJSJ , + CREATETYPE , + GCBM_FROM , + MODIFIEDTIME , + MODIFIER , + PK_BOMID_FROM , + PK_CORP_FROM , + QRRID , + QRRQ , + QRSJ , + sorts, + sts, + + )values( + + #{bblx} , + #{bomlx} , + #{clf} , + #{creat} , + #{dr} , + #{fsl} , + #{fslsx} , + #{fslxx} , + #{gcbm} , + #{gdfsl} , + #{gdsl} , + #{hsl} , + #{jldwid} , + #{memo} , + #{mver} , + #{pkBomid} , + #{pkCorp} , + #{pkProduce} , + #{rgf} , + #{sfmr} , + #{sftpmr} , + #{sl} , + #{slsx} , + #{slxx} , + #{ts} , + #{version} , + #{wlbmid} , + #{zdy1} , + #{zdy10} , + #{zdy11} , + #{zdy12} , + #{zdy13} , + #{zdy14} , + #{zdy15} , + #{zdy16} , + #{zdy17} , + #{zdy18} , + #{zdy19} , + #{zdy2} , + #{zdy20} , + #{zdy3} , + #{zdy4} , + #{zdy5} , + #{zdy6} , + #{zdy7} , + #{zdy8} , + #{zdy9} , + #{zt} , + #{zyx1} , + #{zyx2} , + #{zyx3} , + #{zyx4} , + #{zyx5} , + #{zzf} , + #{bomtypeFrom} , + #{cjrq} , + #{cjsj} , + #{createtype} , + #{gcbmFrom} , + #{modifiedtime} , + #{modifier} , + #{pkBomidFrom} , + #{pkCorpFrom} , + #{qrrid} , + #{qrrq} , + #{qrsj} , + (select (max(IFNULL( a.sorts, 0 )) + 1) as sort from BD_BOM a WHERE a.sts = 'Y' ), + 'Y', + + ) + + + + insert into BD_BOM(BBLX, BOMLX, CLF, CREAT, DR, FSL, FSLSX, FSLXX, GCBM, GDFSL, GDSL, HSL, JLDWID, MEMO, MVER, PK_CORP, PK_PRODUCE, RGF, SFMR, SFTPMR, SL, SLSX, SLXX, TS, VERSION, WLBMID, ZDY1, ZDY10, ZDY11, ZDY12, ZDY13, ZDY14, ZDY15, ZDY16, ZDY17, ZDY18, ZDY19, ZDY2, ZDY20, ZDY3, ZDY4, ZDY5, ZDY6, ZDY7, ZDY8, ZDY9, ZT, ZYX1, ZYX2, ZYX3, ZYX4, ZYX5, ZZF, BOMTYPE_FROM, CJRQ, CJSJ, CREATETYPE, GCBM_FROM, MODIFIEDTIME, MODIFIER, PK_BOMID_FROM, PK_CORP_FROM, QRRID, QRRQ, QRSJ, sts) + values + + (#{entity.bblx},#{entity.bomlx},#{entity.clf},#{entity.creat},#{entity.dr},#{entity.fsl},#{entity.fslsx},#{entity.fslxx},#{entity.gcbm},#{entity.gdfsl},#{entity.gdsl},#{entity.hsl},#{entity.jldwid},#{entity.memo},#{entity.mver},#{entity.pkCorp},#{entity.pkProduce},#{entity.rgf},#{entity.sfmr},#{entity.sftpmr},#{entity.sl},#{entity.slsx},#{entity.slxx},#{entity.ts},#{entity.version},#{entity.wlbmid},#{entity.zdy1},#{entity.zdy10},#{entity.zdy11},#{entity.zdy12},#{entity.zdy13},#{entity.zdy14},#{entity.zdy15},#{entity.zdy16},#{entity.zdy17},#{entity.zdy18},#{entity.zdy19},#{entity.zdy2},#{entity.zdy20},#{entity.zdy3},#{entity.zdy4},#{entity.zdy5},#{entity.zdy6},#{entity.zdy7},#{entity.zdy8},#{entity.zdy9},#{entity.zt},#{entity.zyx1},#{entity.zyx2},#{entity.zyx3},#{entity.zyx4},#{entity.zyx5},#{entity.zzf},#{entity.bomtypeFrom},#{entity.cjrq},#{entity.cjsj},#{entity.createtype},#{entity.gcbmFrom},#{entity.modifiedtime},#{entity.modifier},#{entity.pkBomidFrom},#{entity.pkCorpFrom},#{entity.qrrid},#{entity.qrrq},#{entity.qrsj}, 'Y') + + + + + insert into BD_BOM(BBLX, BOMLX, CLF, CREAT, DR, FSL, FSLSX, FSLXX, GCBM, GDFSL, GDSL, HSL, JLDWID, MEMO, MVER, PK_CORP, PK_PRODUCE, RGF, SFMR, SFTPMR, SL, SLSX, SLXX, TS, VERSION, WLBMID, ZDY1, ZDY10, ZDY11, ZDY12, ZDY13, ZDY14, ZDY15, ZDY16, ZDY17, ZDY18, ZDY19, ZDY2, ZDY20, ZDY3, ZDY4, ZDY5, ZDY6, ZDY7, ZDY8, ZDY9, ZT, ZYX1, ZYX2, ZYX3, ZYX4, ZYX5, ZZF, BOMTYPE_FROM, CJRQ, CJSJ, CREATETYPE, GCBM_FROM, MODIFIEDTIME, MODIFIER, PK_BOMID_FROM, PK_CORP_FROM, QRRID, QRRQ, QRSJ) + values + + (#{entity.bblx},#{entity.bomlx},#{entity.clf},#{entity.creat},#{entity.dr},#{entity.fsl},#{entity.fslsx},#{entity.fslxx},#{entity.gcbm},#{entity.gdfsl},#{entity.gdsl},#{entity.hsl},#{entity.jldwid},#{entity.memo},#{entity.mver},#{entity.pkCorp},#{entity.pkProduce},#{entity.rgf},#{entity.sfmr},#{entity.sftpmr},#{entity.sl},#{entity.slsx},#{entity.slxx},#{entity.ts},#{entity.version},#{entity.wlbmid},#{entity.zdy1},#{entity.zdy10},#{entity.zdy11},#{entity.zdy12},#{entity.zdy13},#{entity.zdy14},#{entity.zdy15},#{entity.zdy16},#{entity.zdy17},#{entity.zdy18},#{entity.zdy19},#{entity.zdy2},#{entity.zdy20},#{entity.zdy3},#{entity.zdy4},#{entity.zdy5},#{entity.zdy6},#{entity.zdy7},#{entity.zdy8},#{entity.zdy9},#{entity.zt},#{entity.zyx1},#{entity.zyx2},#{entity.zyx3},#{entity.zyx4},#{entity.zyx5},#{entity.zzf},#{entity.bomtypeFrom},#{entity.cjrq},#{entity.cjsj},#{entity.createtype},#{entity.gcbmFrom},#{entity.modifiedtime},#{entity.modifier},#{entity.pkBomidFrom},#{entity.pkCorpFrom},#{entity.qrrid},#{entity.qrrq},#{entity.qrsj}) + + on duplicate key update + BBLX = values(BBLX), + BOMLX = values(BOMLX), + CLF = values(CLF), + CREAT = values(CREAT), + DR = values(DR), + FSL = values(FSL), + FSLSX = values(FSLSX), + FSLXX = values(FSLXX), + GCBM = values(GCBM), + GDFSL = values(GDFSL), + GDSL = values(GDSL), + HSL = values(HSL), + JLDWID = values(JLDWID), + MEMO = values(MEMO), + MVER = values(MVER), + PK_CORP = values(PK_CORP), + PK_PRODUCE = values(PK_PRODUCE), + RGF = values(RGF), + SFMR = values(SFMR), + SFTPMR = values(SFTPMR), + SL = values(SL), + SLSX = values(SLSX), + SLXX = values(SLXX), + TS = values(TS), + VERSION = values(VERSION), + WLBMID = values(WLBMID), + ZDY1 = values(ZDY1), + ZDY10 = values(ZDY10), + ZDY11 = values(ZDY11), + ZDY12 = values(ZDY12), + ZDY13 = values(ZDY13), + ZDY14 = values(ZDY14), + ZDY15 = values(ZDY15), + ZDY16 = values(ZDY16), + ZDY17 = values(ZDY17), + ZDY18 = values(ZDY18), + ZDY19 = values(ZDY19), + ZDY2 = values(ZDY2), + ZDY20 = values(ZDY20), + ZDY3 = values(ZDY3), + ZDY4 = values(ZDY4), + ZDY5 = values(ZDY5), + ZDY6 = values(ZDY6), + ZDY7 = values(ZDY7), + ZDY8 = values(ZDY8), + ZDY9 = values(ZDY9), + ZT = values(ZT), + ZYX1 = values(ZYX1), + ZYX2 = values(ZYX2), + ZYX3 = values(ZYX3), + ZYX4 = values(ZYX4), + ZYX5 = values(ZYX5), + ZZF = values(ZZF), + BOMTYPE_FROM = values(BOMTYPE_FROM), + CJRQ = values(CJRQ), + CJSJ = values(CJSJ), + CREATETYPE = values(CREATETYPE), + GCBM_FROM = values(GCBM_FROM), + MODIFIEDTIME = values(MODIFIEDTIME), + MODIFIER = values(MODIFIER), + PK_BOMID_FROM = values(PK_BOMID_FROM), + PK_CORP_FROM = values(PK_CORP_FROM), + QRRID = values(QRRID), + QRRQ = values(QRRQ), + QRSJ = values(QRSJ) + + +update BD_BOM set + + BBLX = #{bblx}, + BOMLX = #{bomlx}, + CLF = #{clf}, + CREAT = #{creat}, + DR = #{dr}, + FSL = #{fsl}, + FSLSX = #{fslsx}, + FSLXX = #{fslxx}, + GCBM = #{gcbm}, + GDFSL = #{gdfsl}, + GDSL = #{gdsl}, + HSL = #{hsl}, + JLDWID = #{jldwid}, + MEMO = #{memo}, + MVER = #{mver}, + PK_CORP = #{pkCorp}, + PK_PRODUCE = #{pkProduce}, + RGF = #{rgf}, + SFMR = #{sfmr}, + SFTPMR = #{sftpmr}, + SL = #{sl}, + SLSX = #{slsx}, + SLXX = #{slxx}, + TS = #{ts}, + VERSION = #{version}, + WLBMID = #{wlbmid}, + ZDY1 = #{zdy1}, + ZDY10 = #{zdy10}, + ZDY11 = #{zdy11}, + ZDY12 = #{zdy12}, + ZDY13 = #{zdy13}, + ZDY14 = #{zdy14}, + ZDY15 = #{zdy15}, + ZDY16 = #{zdy16}, + ZDY17 = #{zdy17}, + ZDY18 = #{zdy18}, + ZDY19 = #{zdy19}, + ZDY2 = #{zdy2}, + ZDY20 = #{zdy20}, + ZDY3 = #{zdy3}, + ZDY4 = #{zdy4}, + ZDY5 = #{zdy5}, + ZDY6 = #{zdy6}, + ZDY7 = #{zdy7}, + ZDY8 = #{zdy8}, + ZDY9 = #{zdy9}, + ZT = #{zt}, + ZYX1 = #{zyx1}, + ZYX2 = #{zyx2}, + ZYX3 = #{zyx3}, + ZYX4 = #{zyx4}, + ZYX5 = #{zyx5}, + ZZF = #{zzf}, + BOMTYPE_FROM = #{bomtypeFrom}, + CJRQ = #{cjrq}, + CJSJ = #{cjsj}, + CREATETYPE = #{createtype}, + GCBM_FROM = #{gcbmFrom}, + MODIFIEDTIME = #{modifiedtime}, + MODIFIER = #{modifier}, + PK_BOMID_FROM = #{pkBomidFrom}, + PK_CORP_FROM = #{pkCorpFrom}, + QRRID = #{qrrid}, + QRRQ = #{qrrq}, + QRSJ = #{qrsj}, + +where PK_BOMID = #{pkBomid} + + + +update BD_BOM set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} +where PK_BOMID = #{pkBomid} + + + +update BD_BOM set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id} + + and BBLX = #{bblx} + and BOMLX = #{bomlx} + and CLF = #{clf} + and CREAT = #{creat} + and DR = #{dr} + and FSL = #{fsl} + and FSLSX = #{fslsx} + and FSLXX = #{fslxx} + and GCBM = #{gcbm} + and GDFSL = #{gdfsl} + and GDSL = #{gdsl} + and HSL = #{hsl} + and JLDWID = #{jldwid} + and MEMO = #{memo} + and MVER = #{mver} + and PK_BOMID = #{pkBomid} + and PK_CORP = #{pkCorp} + and PK_PRODUCE = #{pkProduce} + and RGF = #{rgf} + and SFMR = #{sfmr} + and SFTPMR = #{sftpmr} + and SL = #{sl} + and SLSX = #{slsx} + and SLXX = #{slxx} + and TS = #{ts} + and VERSION = #{version} + and WLBMID = #{wlbmid} + and ZDY1 = #{zdy1} + and ZDY10 = #{zdy10} + and ZDY11 = #{zdy11} + and ZDY12 = #{zdy12} + and ZDY13 = #{zdy13} + and ZDY14 = #{zdy14} + and ZDY15 = #{zdy15} + and ZDY16 = #{zdy16} + and ZDY17 = #{zdy17} + and ZDY18 = #{zdy18} + and ZDY19 = #{zdy19} + and ZDY2 = #{zdy2} + and ZDY20 = #{zdy20} + and ZDY3 = #{zdy3} + and ZDY4 = #{zdy4} + and ZDY5 = #{zdy5} + and ZDY6 = #{zdy6} + and ZDY7 = #{zdy7} + and ZDY8 = #{zdy8} + and ZDY9 = #{zdy9} + and ZT = #{zt} + and ZYX1 = #{zyx1} + and ZYX2 = #{zyx2} + and ZYX3 = #{zyx3} + and ZYX4 = #{zyx4} + and ZYX5 = #{zyx5} + and ZZF = #{zzf} + and BOMTYPE_FROM = #{bomtypeFrom} + and CJRQ = #{cjrq} + and CJSJ = #{cjsj} + and CREATETYPE = #{createtype} + and GCBM_FROM = #{gcbmFrom} + and MODIFIEDTIME = #{modifiedtime} + and MODIFIER = #{modifier} + and PK_BOMID_FROM = #{pkBomidFrom} + and PK_CORP_FROM = #{pkCorpFrom} + and QRRID = #{qrrid} + and QRRQ = #{qrrq} + and QRSJ = #{qrsj} + and sts='Y' + + + + + delete from BD_BOM where PK_BOMID = #{pkBomid} + + + + + + diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/adjust/AdjustInPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/adjust/AdjustInPluginInitializer.java index 48576c18..969e1401 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/adjust/AdjustInPluginInitializer.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/adjust/AdjustInPluginInitializer.java @@ -56,7 +56,7 @@ public class AdjustInPluginInitializer extends PluginBaseEntity { @Override public String getPluginId() { - return "com.hzya.frame.plugin.lets.plugin.adjust.AdjustInPluginInitializer"; + return "adjust.AdjustInPluginInitializer"; } @Override @@ -295,8 +295,8 @@ public class AdjustInPluginInitializer extends PluginBaseEntity { //cdispatcherid--收发类别 List ofsAdjustOrders = queryOfsAdjustOrders(ofsHeader.getRefOrderCode()); - if(ofsAdjustOrders.size()!=1){ - Assert.state(false,"根据调整入库单号:{},查询调整单:{},失败。不存在或不唯一。",ofsCode,ofsHeader.getRefOrderCode()); + if (ofsAdjustOrders.size() != 1) { + Assert.state(false, "根据调整入库单号:{},查询调整单:{},失败。不存在或不唯一。", ofsCode, ofsHeader.getRefOrderCode()); } String u8ReceiptType = ofsAdjustOrders.get(0).getHeader().getU8ReceiptType(); // BdRdclEntity bdRdclEntity = new BdRdclEntity(); @@ -341,7 +341,7 @@ public class AdjustInPluginInitializer extends PluginBaseEntity { //两层判断,一层中台转发,一层u8c返回 if ("false".equals(ztResult.getFlag())) { //转发失败 - response=JSONUtil.toJsonStr(ztResult.getAttribute()); + response = JSONUtil.toJsonStr(ztResult.getAttribute()); Assert.state(false, "丽知:OFS调整入库--->U8C其它入库.中台转发失败,失败原因:{}", ztResult.getAttribute()); } Attribute attribute = ztResult.getAttribute(); @@ -426,7 +426,7 @@ public class AdjustInPluginInitializer extends PluginBaseEntity { all.addAll(stockinOrderSearchResponse1.getData()); - count=stockinOrderSearchResponse1.getData().size(); + count = stockinOrderSearchResponse1.getData().size(); } return all; } @@ -462,7 +462,7 @@ public class AdjustInPluginInitializer extends PluginBaseEntity { InterfaceParamDto interfaceParamDto = new InterfaceParamDto(); interfaceParamDto.setApi("ofs.adjustOrder.search"); interfaceParamDto.setData(JSON.toJSONString(queryOfsAdjustOrderRequestVO)); - OFSAdjustOrderSearchResponse ofsAdjustOrderSearchResponse =(OFSAdjustOrderSearchResponse) ofsUnifiedService.unified(interfaceParamDto); + OFSAdjustOrderSearchResponse ofsAdjustOrderSearchResponse = (OFSAdjustOrderSearchResponse) ofsUnifiedService.unified(interfaceParamDto); System.out.println(ofsAdjustOrderSearchResponse); List data = ofsAdjustOrderSearchResponse.getData(); return data; diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/adjust/AdjustOutPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/adjust/AdjustOutPluginInitializer.java index 4d5be92b..6a57018f 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/adjust/AdjustOutPluginInitializer.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/adjust/AdjustOutPluginInitializer.java @@ -64,7 +64,7 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity { @Override public String getPluginId() { - return "com.hzya.frame.plugin.lets.plugin.adjust.AdjustOutPluginInitializer"; + return "adjust.AdjustOutPluginInitializer"; } @Override @@ -298,8 +298,8 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity { //cdispatcherid--收发类别 List ofsAdjustOrders = queryOfsAdjustOrders(ofsHeader.getRefOrderCode()); - if(ofsAdjustOrders.size()!=1){ - Assert.state(false,"根据调整出库单号:{},查询调整单:{},失败。不存在或不唯一。",ofsCode,ofsHeader.getRefOrderCode()); + if (ofsAdjustOrders.size() != 1) { + Assert.state(false, "根据调整出库单号:{},查询调整单:{},失败。不存在或不唯一。", ofsCode, ofsHeader.getRefOrderCode()); } String u8ShipmentType = ofsAdjustOrders.get(0).getHeader().getU8ShipmentType();//出库类型 @@ -350,7 +350,7 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity { //两层判断,一层中台转发,一层u8c返回 if ("false".equals(ztResult.getFlag())) { //转发失败 - response=JSONUtil.toJsonStr(ztResult.getAttribute()); + response = JSONUtil.toJsonStr(ztResult.getAttribute()); Assert.state(false, "丽知:OFS调整出库--->U8C其它出库.中台转发失败,失败原因:{}", ztResult.getAttribute()); } Attribute attribute = ztResult.getAttribute(); @@ -407,7 +407,7 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity { public List queryOfsStockoutOrder(QueryOfsStockoutOrderRequestVO queryOfsStockoutOrderRequestVO) throws Exception { Long pageNo = 1L; - List all=new ArrayList<>(); + List all = new ArrayList<>(); InterfaceParamDto interfaceParamDto = new InterfaceParamDto(); interfaceParamDto.setApi("ofs.shipment.search"); @@ -433,7 +433,7 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity { SaleOutReturnMessageDto saleOutReturnMessageDto1 = (SaleOutReturnMessageDto) ofsUnifiedService.unified(interfaceParamDto); StockoutOrderSearchResponse stockoutOrderSearchResponse1 = SaleOutReturnMessageDto2StockoutOrderSearchResponse(saleOutReturnMessageDto1); all.addAll(stockoutOrderSearchResponse1.getData()); - count=stockoutOrderSearchResponse1.getData().size(); + count = stockoutOrderSearchResponse1.getData().size(); } return all; @@ -507,7 +507,7 @@ public class AdjustOutPluginInitializer extends PluginBaseEntity { InterfaceParamDto interfaceParamDto = new InterfaceParamDto(); interfaceParamDto.setApi("ofs.adjustOrder.search"); interfaceParamDto.setData(JSON.toJSONString(queryOfsAdjustOrderRequestVO)); - OFSAdjustOrderSearchResponse ofsAdjustOrderSearchResponse =(OFSAdjustOrderSearchResponse) ofsUnifiedService.unified(interfaceParamDto); + OFSAdjustOrderSearchResponse ofsAdjustOrderSearchResponse = (OFSAdjustOrderSearchResponse) ofsUnifiedService.unified(interfaceParamDto); System.out.println(ofsAdjustOrderSearchResponse); List data = ofsAdjustOrderSearchResponse.getData(); return data; diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/CustdocAutoAllotPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/CustdocAutoAllotPluginInitializer.java index ee38af78..0c2d759d 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/CustdocAutoAllotPluginInitializer.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/CustdocAutoAllotPluginInitializer.java @@ -50,7 +50,7 @@ public class CustdocAutoAllotPluginInitializer extends PluginBaseEntity { @Override public String getPluginId() { - return "com.hzya.frame.plugin.lets.plugin.base.CustdocAutoAllotPluginInitializer"; + return "base.CustdocAutoAllotPluginInitializer"; } @Override @@ -99,14 +99,13 @@ public class CustdocAutoAllotPluginInitializer extends PluginBaseEntity { } - - /** * 查询客商基本档案 + * * @return */ private List queryCustDoc() { - List custdocRequestVos=null; + List custdocRequestVos = null; try { String data = pushDataByU8cUtil.pushU8CByCode(OverallConstant.getOverAllValue("custdocQuery"), "{}"); CbdocResultVo cbdocResultVo = JSONObject.parseObject(data, CbdocResultVo.class); @@ -123,11 +122,11 @@ public class CustdocAutoAllotPluginInitializer extends PluginBaseEntity { return custdocRequestVos; } - private List filterData(List list) { + private List filterData(List list) { List filterlist = new ArrayList<>(); for (CustdocRequestVo requestVo : list) { - //o转为 - if("N".equals(requestVo.getParentvo().getDef10())){ + //o转为 + if ("N".equals(requestVo.getParentvo().getDef10())) { filterlist.add(requestVo); } } @@ -175,12 +174,12 @@ public class CustdocAutoAllotPluginInitializer extends PluginBaseEntity { try { ArrayList assginvolist = new ArrayList<>(); - List bdCorpEntities=null; + List bdCorpEntities = null; //查询公司档案 try { String corpresponse = pushDataByU8cUtil.pushU8CByCode(OverallConstant.getOverAllValue("bdcorpQuery"), "{}"); CbdocResultVo cbdocResultVo = JSONObject.parseObject(corpresponse, CbdocResultVo.class); - if(!"success".equals(cbdocResultVo.getStatus())){ + if (!"success".equals(cbdocResultVo.getStatus())) { Assert.state(false, "查询公司档案失败"); } String datastring = cbdocResultVo.getData(); @@ -193,7 +192,7 @@ public class CustdocAutoAllotPluginInitializer extends PluginBaseEntity { throw new RuntimeException(e); } - for(BdCorpEntity bdCorpEntity:bdCorpEntities){ + for (BdCorpEntity bdCorpEntity : bdCorpEntities) { CustDocAssginVo custDocAssginVo = new CustDocAssginVo(); custDocAssginVo.setPk_cubasdoc(custcode); //TODO diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/GoodsAutoAllotPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/GoodsAutoAllotPluginInitializer.java index 00de6d4b..55653a56 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/GoodsAutoAllotPluginInitializer.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/GoodsAutoAllotPluginInitializer.java @@ -51,7 +51,7 @@ public class GoodsAutoAllotPluginInitializer extends PluginBaseEntity { @Override public String getPluginId() { - return "com.hzya.frame.plugin.lets.plugin.base.GoodsAutoAllotPluginInitializer"; + return "base.GoodsAutoAllotPluginInitializer"; } @Override @@ -163,12 +163,12 @@ public class GoodsAutoAllotPluginInitializer extends PluginBaseEntity { bdInvbasdocEntity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE); List bdInvbasdocEntityList = bdInvbasdocDao.query(bdInvbasdocEntity); if (bdInvbasdocEntityList.size() == 0) { - Assert.state(false, "U8C->存货基本档案自动分配全公司,按日期:{} - {},未查到存货基本档案。", startTime,endTime); + Assert.state(false, "U8C->存货基本档案自动分配全公司,按日期:{} - {},未查到存货基本档案。", startTime, endTime); } //过滤日志 List filterInvbasdocList = filter(bdInvbasdocEntityList); if (filterInvbasdocList.size() == 0 || filterInvbasdocList == null) { - Assert.state(false, "U8C->存货基本档案自动分配全公司,按日期:{} - {},已被分配,请检查。", startTime,endTime); + Assert.state(false, "U8C->存货基本档案自动分配全公司,按日期:{} - {},已被分配,请检查。", startTime, endTime); } //推送:自动分配 implement(filterInvbasdocList); diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/SKUClassPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/SKUClassPluginInitializer.java index 1f0b72da..96047318 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/SKUClassPluginInitializer.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/SKUClassPluginInitializer.java @@ -72,7 +72,7 @@ public class SKUClassPluginInitializer extends PluginBaseEntity { @Override public String getPluginId() { - return "com.hzya.frame.plugin.lets.plugin.base.SKUClassPluginInitializer"; + return "base.SKUClassPluginInitializer"; } @Override diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/SKUPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/SKUPluginInitializer.java index 8842f3c6..bd6a4a1c 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/SKUPluginInitializer.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/SKUPluginInitializer.java @@ -63,7 +63,7 @@ public class SKUPluginInitializer extends PluginBaseEntity { @Override public String getPluginId() { - return "com.hzya.frame.plugin.lets.plugin.base.GoodsPluginInitializer"; + return "base.GoodsPluginInitializer"; } @Override @@ -150,15 +150,15 @@ public class SKUPluginInitializer extends PluginBaseEntity { queryOfsSKURequestVO.setLastUpdated_start(startTimeStr); queryOfsSKURequestVO.setLastUpdated_end(endTimeStr); List ofsskuList = queryOfsSKUs(queryOfsSKURequestVO); - if(ofsskuList.size()==0){ - return; + if (ofsskuList.size() == 0) { + return; } //分组排序, List sortSkuList = groupAndSort(ofsskuList); //过滤日志 List filterSkus = filterData(sortSkuList); - if(filterSkus.size()==0){ + if (filterSkus.size() == 0) { return; } //具体实现 @@ -182,7 +182,7 @@ public class SKUPluginInitializer extends PluginBaseEntity { QueryOfsSKURequestVO queryOfsSKURequestVO = new QueryOfsSKURequestVO(); queryOfsSKURequestVO.setCode(split[0]); List ofsskuList = queryOfsSKUs(queryOfsSKURequestVO); - if(ofsskuList.size()==0){ + if (ofsskuList.size() == 0) { Assert.state(false, "根据OFS SKU主档编码:{},未查询到SKU主档,请检查入参或者OFS SKU主档。", split[0]); } //分组排序, @@ -190,7 +190,7 @@ public class SKUPluginInitializer extends PluginBaseEntity { //过滤日志 List filterSkus = filterData(sortSkuList); - if(filterSkus.size()==0){ + if (filterSkus.size() == 0) { Assert.state(false, "根据OFS SKU主档编码:{},已被推送成功,请勿重新推送。", split[0]); } //具体实现 @@ -216,16 +216,16 @@ public class SKUPluginInitializer extends PluginBaseEntity { queryOfsSKURequestVO.setLastUpdated_start(start); queryOfsSKURequestVO.setLastUpdated_end(end); List ofsskuList = queryOfsSKUs(queryOfsSKURequestVO); - if(ofsskuList.size()==0){ - Assert.state(false,"根据期间:{} - {} 内,未查询到OFS系统中SKU主档信息,请检查。"); + if (ofsskuList.size() == 0) { + Assert.state(false, "根据期间:{} - {} 内,未查询到OFS系统中SKU主档信息,请检查。"); } //分组排序, List sortSkuList = groupAndSort(ofsskuList); //过滤日志 List filterSkus = filterData(sortSkuList); - if(filterSkus.size()==0){ - Assert.state(false,"根据期间:{} - {} 内询到OFS系统中SKU主档信息已全部推送,请勿重新推送。"); + if (filterSkus.size() == 0) { + Assert.state(false, "根据期间:{} - {} 内询到OFS系统中SKU主档信息已全部推送,请勿重新推送。"); } //具体实现 implement(filterSkus); @@ -239,13 +239,14 @@ public class SKUPluginInitializer extends PluginBaseEntity { * 过滤成功日志 * rootAppPk * [code]_[lastUpdated] + * * @param ofsskuList * @return */ - public List filterData(List ofsskuList){ + public List filterData(List ofsskuList) { List filterSkus = new ArrayList<>(); for (OFSSKUSearchResponse.OFSSKU ofssku : ofsskuList) { - String rootAppPk = ofssku.getCode()+"_"+ofssku.getLastUpdated(); + String rootAppPk = ofssku.getCode() + "_" + ofssku.getLastUpdated(); boolean isExis = true; IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); integrationTaskLivingDetailsEntity.setRootAppPk(rootAppPk); @@ -268,10 +269,10 @@ public class SKUPluginInitializer extends PluginBaseEntity { * 注意: * 可能一家公司封存则,则取消分配这家公司的存货管理档案 */ - public void implement(List filterSkus){ + public void implement(List filterSkus) { for (OFSSKUSearchResponse.OFSSKU sku : filterSkus) { - String PkInvbasdoc= ""; + String PkInvbasdoc = ""; String url = ""; String mapStr = ""; String format = sku.getLastUpdated(); @@ -284,14 +285,14 @@ public class SKUPluginInitializer extends PluginBaseEntity { //查询是否存在,返回pkInvbasdoc,如果有则是修改,null则为新增 //查询该id再u8c是否有数据,没有则是新增,有则是修改 存货基本档案:def2-》ofs主键 - PkInvbasdoc=queryInvbasDocIsExist(sku); + PkInvbasdoc = queryInvbasDocIsExist(sku); if (PkInvbasdoc != null) { //修改 parentvo.setPk_invbasdoc(PkInvbasdoc); - url=OverallConstant.getOverAllValue("bdinvclUpdateCode"); + url = OverallConstant.getOverAllValue("bdinvclUpdateCode"); } else if (PkInvbasdoc == null) { //新增 - url=OverallConstant.getOverAllValue("bdinvclSaveCode"); + url = OverallConstant.getOverAllValue("bdinvclSaveCode"); } //def2 ofs id @@ -325,14 +326,14 @@ public class SKUPluginInitializer extends PluginBaseEntity { invbasdoc.setParentvo(parentvo); //子表,暂时没有要传的值 String jsonStr = JSONUtil.toJsonStr(invbasdoc); - mapStr= "{\"invbasdoc\":" + jsonStr + "}"; + mapStr = "{\"invbasdoc\":" + jsonStr + "}"; ZTResult ztResult = pushU8CByApiCode.pushByCode(url, mapStr); //两层判断,一层中台转发,一层u8c返回 Attribute attribute = ztResult.getAttribute(); if ("false".equals(ztResult.getFlag())) { //转发失败 - response=JSONUtil.toJsonStr(ztResult.getAttribute()); + response = JSONUtil.toJsonStr(ztResult.getAttribute()); Assert.state(false, "丽知:OFS货品档案--->U8C货品档案,中台转发失败,失败原因:{}", ztResult.getAttribute()); } boolean isSuccess = false; @@ -354,13 +355,13 @@ public class SKUPluginInitializer extends PluginBaseEntity { integrationTaskLivingDetailsEntity.setNewTransmitInfo(attribute.getData()); integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); integrationTaskLivingDetailsEntity.setBusinessDate(format); - integrationTaskLivingDetailsEntity.setRootAppPk(sku.getCode()+"_"+sku.getLastUpdated()); + integrationTaskLivingDetailsEntity.setRootAppPk(sku.getCode() + "_" + sku.getLastUpdated()); integrationTaskLivingDetailsEntity.setRootAppBill(sku.getCode()); integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); integrationTaskLivingDetailsEntity.setDef1(sku.getId()); saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); logger.error("推送U8C,丽知:OFS货品档案--->U8C货品档案失败,失败原因:" + e); //失败 @@ -373,7 +374,7 @@ public class SKUPluginInitializer extends PluginBaseEntity { integrationTaskLivingDetailsEntity.setNewTransmitInfo(ErrMessage); integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); integrationTaskLivingDetailsEntity.setBusinessDate(format); - integrationTaskLivingDetailsEntity.setRootAppPk(sku.getCode()+"_"+sku.getLastUpdated()); + integrationTaskLivingDetailsEntity.setRootAppPk(sku.getCode() + "_" + sku.getLastUpdated()); integrationTaskLivingDetailsEntity.setRootAppBill(sku.getCode()); integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); integrationTaskLivingDetailsEntity.setDef1(sku.getId()); @@ -384,65 +385,64 @@ public class SKUPluginInitializer extends PluginBaseEntity { } } - public String queryInvbasDocIsExist(OFSSKUSearchResponse.OFSSKU sku){ - String PkInvbasdoc=""; + public String queryInvbasDocIsExist(OFSSKUSearchResponse.OFSSKU sku) { + String PkInvbasdoc = ""; BdInvbasdocEntity bdInvbasdocEntity = new BdInvbasdocEntity(); bdInvbasdocEntity.setDr(0L); bdInvbasdocEntity.setDef2(sku.getId()); bdInvbasdocEntity.setDataSourceCode(ProfilesActiveConstant.LETS_DATE_SOURCE); List bdInvbasdocEntityList = bdInvbasdocDao.query(bdInvbasdocEntity);//根据ofs id - if(bdInvbasdocEntityList.size()==0){ + if (bdInvbasdocEntityList.size() == 0) { bdInvbasdocEntity.setDef2(null); bdInvbasdocEntity.setInvcode(sku.getCode()); bdInvbasdocEntity.setInvname(sku.getName()); List bdInvbasdocEntityList1 = bdInvbasdocDao.query(bdInvbasdocEntity);//根据编码+名称 - if(bdInvbasdocEntityList1.size()==0){ + if (bdInvbasdocEntityList1.size() == 0) { bdInvbasdocEntity.setInvname(null); List bdInvbasdocEntityList2 = bdInvbasdocDao.query(bdInvbasdocEntity);//进查询编码 if (bdInvbasdocEntityList2.size() == 0) {//编码不存在 return null; } else if (bdInvbasdocEntityList2.size() == 1) {//编码存在 - PkInvbasdoc=bdInvbasdocEntityList2.get(0).getPkInvbasdoc();//主键 + PkInvbasdoc = bdInvbasdocEntityList2.get(0).getPkInvbasdoc();//主键 } - }else if(bdInvbasdocEntityList1.size()==1){ + } else if (bdInvbasdocEntityList1.size() == 1) { //修改 - PkInvbasdoc=bdInvbasdocEntityList1.get(0).getPkInvbasdoc();//主键 + PkInvbasdoc = bdInvbasdocEntityList1.get(0).getPkInvbasdoc();//主键 } - }else if(bdInvbasdocEntityList.size()==1){ + } else if (bdInvbasdocEntityList.size() == 1) { //修改 - PkInvbasdoc=bdInvbasdocEntityList.get(0).getPkInvbasdoc();//主键 - }else { + PkInvbasdoc = bdInvbasdocEntityList.get(0).getPkInvbasdoc();//主键 + } else { //异常,存在多个 - Assert.state(false,"SKU主档编码:{},id:{}。U8C存货基本档案def2(OFS中SKU主档id)存在多个,请检查。",sku.getCode(),sku.getId()); + Assert.state(false, "SKU主档编码:{},id:{}。U8C存货基本档案def2(OFS中SKU主档id)存在多个,请检查。", sku.getCode(), sku.getId()); } - return PkInvbasdoc; + return PkInvbasdoc; } /** * 按code分组,并按lastUpdated排序 + * * @param ofsskuList * @return */ - public List groupAndSort(List ofsskuList){ - List sortSkus=new ArrayList<>(); + public List groupAndSort(List ofsskuList) { + List sortSkus = new ArrayList<>(); //根据code进行分组 - Map> collectMapByCode = - ofsskuList.stream().collect(Collectors.groupingBy(OFSSKUSearchResponse.OFSSKU::getCode)); + Map> collectMapByCode = ofsskuList.stream().collect(Collectors.groupingBy(OFSSKUSearchResponse.OFSSKU::getCode)); - collectMapByCode.forEach((k,v)->{ + collectMapByCode.forEach((k, v) -> { //降序排序 (从新到旧),根据最后修改时间倒排 - List sorted = - v.stream().sorted(Comparator.comparing(OFSSKUSearchResponse.OFSSKU::getLastUpdated).reversed()).collect(Collectors.toList()); + List sorted = v.stream().sorted(Comparator.comparing(OFSSKUSearchResponse.OFSSKU::getLastUpdated).reversed()).collect(Collectors.toList()); //排除status==0的 for (int i = 0; i < sorted.size(); i++) { - if("0".equals(sorted.get(i).getStatus())){ + if ("0".equals(sorted.get(i).getStatus())) { sorted.remove(i); } } - if(sorted.size()!=0){ + if (sorted.size() != 0) { sortSkus.add(sorted.get(0));//只取最后修改的一个 } }); @@ -452,7 +452,7 @@ public class SKUPluginInitializer extends PluginBaseEntity { /** * 封存存货基本档案 */ - public void sealImplement(String code){ + public void sealImplement(String code) { } @@ -493,6 +493,7 @@ public class SKUPluginInitializer extends PluginBaseEntity { } return all; } + private InvBasDocVO resultDataHandle(String resultData) { try { if (resultData != null && !"".equals(resultData)) { diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/ShopPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/ShopPluginInitializer.java index 92b59d43..7767c673 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/ShopPluginInitializer.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/ShopPluginInitializer.java @@ -58,7 +58,7 @@ public class ShopPluginInitializer extends PluginBaseEntity { @Override public String getPluginId() { - return "ShopPluginInitializer"; + return "base.ShopPluginInitializer"; } @Override diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/SupplierPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/SupplierPluginInitializer.java index 62754efe..ef43721a 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/SupplierPluginInitializer.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/base/SupplierPluginInitializer.java @@ -63,7 +63,7 @@ public class SupplierPluginInitializer extends PluginBaseEntity { @Override public String getPluginId() { - return "SupplierPluginInitializer"; + return "base.SupplierPluginInitializer"; } @Override diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningIn.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningIn.java index b4dca5b0..d5cbe627 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningIn.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningIn.java @@ -13,10 +13,8 @@ import com.hzya.frame.plugin.lets.dao.*; import com.hzya.frame.plugin.lets.entity.*; import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo; import com.hzya.frame.plugin.lets.u8cdto.*; -import com.hzya.frame.plugin.lets.util.OfsStandardUtil; -import com.hzya.frame.plugin.lets.util.OnlyImplementProxyOrderUtil; -import com.hzya.frame.plugin.lets.util.QueryBdBusitypeUtil; -import com.hzya.frame.plugin.lets.util.RdclUtil; +import com.hzya.frame.plugin.lets.util.*; +import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity; import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderData; import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderDetails; import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderHeader; @@ -70,9 +68,27 @@ public class ConsignmachiningIn extends PluginBaseEntity { @Autowired private IScOrderBDao iScOrderBDao; + @Autowired + private IBdPurorgDao iBdPurorgDao; + + @Autowired + private IBdCubasdocDao iBdCubasdocDao; + + @Autowired + private IBdCumandocDao iBdCumandocDao; + + @Autowired + private IBdInvbasdocDao iBdInvbasdocDao; + @Autowired private OnlyImplementProxyOrderUtil onlyImplementProxyOrder; + @Autowired + private IBdBomDao iBdBomDao; + + @Autowired + private SaveOrUpdateBusinessLogUtil saveOrUpdateBusinessLogUtil; + @Override public void initialize() { logger.info(getPluginLabel() + "執行初始化方法initialize()"); @@ -85,17 +101,17 @@ public class ConsignmachiningIn extends PluginBaseEntity { @Override public String getPluginId() { - return "com.hzya.frame.plugin.lets.plugin.outsourc.ConsignmachiningIn"; + return "outsourc.ConsignmachiningIn"; } @Override public String getPluginName() { - return "OFS采购入库单生成U8C委外加工入库(委外采购入库)"; + return "OFS采购入库单生成U8C委外订单(委外采购入库)"; } @Override public String getPluginLabel() { - return "OFS采购入库单生成U8C委外加工入库(委外采购入库)"; + return "OFS采购入库单生成U8C委外订单(委外采购入库)"; } @Override @@ -114,6 +130,7 @@ public class ConsignmachiningIn extends PluginBaseEntity { * @author liuyang */ public void startImplement(String startTime, String endTime) { + long startMillis = System.currentTimeMillis(); String threadNameStrStart = StrUtil.format("开始(委外采购)OFS采购入库单生成U8C委外加工入库 开始时间:{} 结束时间:{}", startTime, endTime); logger.info(threadNameStrStart); @@ -148,7 +165,8 @@ public class ConsignmachiningIn extends PluginBaseEntity { } catch (Exception e) { logger.error("thread.join()异常", e); } - String threadNameStrEnd = StrUtil.format("结束(委外采购)OFS采购入库单生成U8C委外加工入库 开始时间:{} 结束时间:{}", startTime, endTime); + long endMillis = System.currentTimeMillis(); + String threadNameStrEnd = StrUtil.format("结束(委外采购)OFS采购入库单生成U8C委外加工入库 开始时间:{} 结束时间:{} 耗时:{}", startTime, endTime, (endMillis - startMillis)); logger.info(threadNameStrEnd); } @@ -158,6 +176,7 @@ public class ConsignmachiningIn extends PluginBaseEntity { * @author liuyang */ public void startImplement(String code) { + long startMillis = System.currentTimeMillis(); String threadNameStrStart = StrUtil.format("开始(委外采购)OFS采购入库单生成U8C委外加工入库 OFS采购入库单号:{}", code); logger.info(threadNameStrStart); @@ -191,7 +210,8 @@ public class ConsignmachiningIn extends PluginBaseEntity { } catch (Exception e) { logger.error("thread.join()异常", e); } - String threadNameStrEnd = StrUtil.format("结束(委外采购)OFS采购入库单生成U8C委外加工入库 OFS采购入库单号:{}", code); + long endMillis = System.currentTimeMillis(); + String threadNameStrEnd = StrUtil.format("结束(委外采购)OFS采购入库单生成U8C委外加工入库 OFS采购入库单号:{}", code, (endMillis - startMillis)); logger.info(threadNameStrEnd); } @@ -234,98 +254,139 @@ public class ConsignmachiningIn extends PluginBaseEntity { List consignmachiningInSonDtos = queryBasicArchives(returnGoodHeaderDetailsDataDtoList); // 查询采购收发类别 BdRdclEntity bdRdclEntity = rdclUtil.queryRdClObject("105"); + //代理委外入库业务流程 + BdBusitypeEntity bdBusitypeEntity = u8cOperationFlow(); if (consignmachiningInSonDtos != null && consignmachiningInSonDtos.size() > 0) { for (int i = 0; i < consignmachiningInSonDtos.size(); i++) { ConsignmachiningInSonDto consignmachiningInSonDto = consignmachiningInSonDtos.get(i); -// StockinOrderSearchResponse.StockinOrder.StockinH header = consignmachiningInSonDto.getHeader(); - List details = consignmachiningInSonDto.getDetails(); - String generateBusinessDate = createGenerateBusinessDate(consignmachiningInSonDto); //生成业务日期 - OfsPoOrderData ofsPoOrderData = consignmachiningInSonDto.getOfsPoOrderData();//OFS采购订单 - ScOrderEntity scOrderEntity = consignmachiningInSonDto.getScOrderEntity();//U8C委外订单 - BdCorpEntity bdCorpEntity = consignmachiningInSonDto.getBdCorpEntity();//公司 - BdCalbodyEntity bdCalbodyEntity = consignmachiningInSonDto.getBdCalbodyEntity();//库存组织 - BdStordocEntity bdStordocEntity = consignmachiningInSonDto.getBdStordocEntity();//仓库 + String generateBusinessDate = null; + try { + // StockinOrderSearchResponse.StockinOrder.StockinH header = consignmachiningInSonDto.getHeader(); + List details = consignmachiningInSonDto.getDetails(); + + generateBusinessDate = createGenerateBusinessDate(consignmachiningInSonDto); //生成业务日期 + OfsPoOrderData ofsPoOrderData = consignmachiningInSonDto.getOfsPoOrderData();//OFS采购订单 + OfsPoOrderHeader ofsPoOrderDataHeader = ofsPoOrderData.getHeader(); + List ofsPoOrderDataDetails = ofsPoOrderData.getDetails(); + +// ScOrderEntity scOrderEntity = consignmachiningInSonDto.getScOrderEntity();//U8C委外订单 + BdCorpEntity bdCorpEntity = consignmachiningInSonDto.getBdCorpEntity();//公司 + BdCalbodyEntity bdCalbodyEntity = consignmachiningInSonDto.getBdCalbodyEntity();//库存组织 + BdPurorgEntity bdPurorgEntity = consignmachiningInSonDto.getBdPurorgEntity();//采购组织 +// BdStordocEntity bdStordocEntity = consignmachiningInSonDto.getBdStordocEntity();//仓库 // StockinOrderSearchResponse.StockinOrder.StockinH header1 = consignmachiningInSonDto.getHeader(); - List details1 = consignmachiningInSonDto.getDetails();//OFS采购入库单 - List scOrderBEntityList = consignmachiningInSonDto.getScOrderBEntityList();//U8C委外订单明细行主键 + List details1 = consignmachiningInSonDto.getDetails();//OFS采购入库单明细行 +// List scOrderBEntityList = consignmachiningInSonDto.getScOrderBEntityList();//U8C委外订单明细行主键 + BdCubasdocEntity bdCubasdocEntity = consignmachiningInSonDto.getBdCubasdocEntity();//客商基本档案 + BdCumandocEntity bdCumandocEntity = consignmachiningInSonDto.getBdCumandocEntity();//客商管理档案 + BdStordocEntity bdStordocEntity = consignmachiningInSonDto.getBdStordocEntity();//表体仓库 - OfsPoOrderHeader ofsPoOrderDataHeader = ofsPoOrderData.getHeader(); - List ofsPoOrderDataDetails = ofsPoOrderData.getDetails(); + //委外订单表头 + ScorderHeadDto poOrderParentDto = new ScorderHeadDto(); + poOrderParentDto.setPk_corp(bdCorpEntity.getPkCorp()); + poOrderParentDto.setCbiztype(bdBusitypeEntity.getPkBusitype()); + poOrderParentDto.setCoperator("0001A110000000000U3D"); + poOrderParentDto.setCpurorganization(bdPurorgEntity.getPkPurorg()); + poOrderParentDto.setCgiveinvoicevendor(bdCumandocEntity.getPkCumandoc()); + poOrderParentDto.setCvendormangid(bdCumandocEntity.getPkCumandoc()); + poOrderParentDto.setDorderdate(generateBusinessDate); - // 代理委外入库业务流程 - BdBusitypeEntity bdBusitypeEntity = u8cOperationFlow(bdCorpEntity.getPkCorp()); + poOrderParentDto.setPk_defdoc3(bdRdclEntity.getPkRdcl());//收发类别 + poOrderParentDto.setVdef3(bdRdclEntity.getRdname()); + poOrderParentDto.setVdef17(ProfilesActiveConstant.sourceSystem1);//来源系统 + poOrderParentDto.setVdef19(consignmachiningInSonDto.getCode());//原单单号 + poOrderParentDto.setVdef20(consignmachiningInSonDto.getId());//原单主键 - //委外入库表头 - ConsignmachiningInHeadDto poOrderParentDto = new ConsignmachiningInHeadDto(); - poOrderParentDto.setPk_corp(bdCorpEntity.getPkCorp()); - poOrderParentDto.setCoperatorid("0001A110000000000U3D"); - poOrderParentDto.setCwarehouseid(bdStordocEntity.getPkStordoc()); - poOrderParentDto.setPk_calbody(bdCalbodyEntity.getPkCalbody()); - poOrderParentDto.setCbiztype(bdBusitypeEntity.getPkBusitype()); - poOrderParentDto.setCdispatcherid(bdRdclEntity.getPkRdcl());//收发类别 - poOrderParentDto.setDbilldate(generateBusinessDate);//入库日期 + //委外入库表头明细行 + List scorderBodyDtoArrayList = new ArrayList<>(); + for (int j = 0; j < details.size(); j++) { + StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details.get(j); + //匹配U8C采购订单明细行 +// ScOrderBEntity u8cPoOrderDetail = findOfsPoOrderDetailAndU8cPoOrderDetail(stockinB, ofsPoOrderData, scOrderBEntityList); + //通过O采购订单入库单明细行,联查OFS采购订单明细行 + OfsPoOrderDetails ofsPoOrderDetailRowTraget = findOfsPoOrderDetailRowTraget(stockinB, ofsPoOrderData); + //查询存货管理档案 + BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(stockinB, bdCorpEntity.getPkCorp()); + //存货基础档案 + BdInvbasdocEntity bdInvbasdocEntity = queryStockBasicArchives(bdInvmandocEntity.getPkInvmandoc(), bdCorpEntity.getPkCorp()); + //存货对应的BOM + List bomVersion = getBomVersion(bdCalbodyEntity.getPkCalbody(), bdInvbasdocEntity.getPkInvbasdoc()); - //委外入库表头明细行 - List consignmachiningInBodyDtoArrayList = new ArrayList<>(); - for (int j = 0; j < details.size(); j++) { - StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details.get(j); - //匹配U8C采购订单明细行 - ScOrderBEntity u8cPoOrderDetail = findOfsPoOrderDetailAndU8cPoOrderDetail(stockinB, ofsPoOrderData, scOrderBEntityList); - //通过O采购订单入库单明细行,联查OFS采购订单明细行 - OfsPoOrderDetails ofsPoOrderDetailRowTraget = findOfsPoOrderDetailRowTraget(stockinB, ofsPoOrderData); - //查询存货管理档案 - BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(stockinB, bdCorpEntity.getPkCorp()); + //计算含税单价 + BigDecimal noriginalcurprice = null; + String receivedQty = stockinB.getReceivedQty();//实收数量 + String fulfillAmount = ofsPoOrderDetailRowTraget.getFulfillAmount();//实收累计总金额 + try { + noriginalcurprice = new BigDecimal(fulfillAmount).divide(new BigDecimal(receivedQty), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP); + } catch (Exception e) { + logger.error("计算委外订单原币含税单价失败", e); + Assert.state(false, "计算采购入库单原币含税单价失败 原因:{}", e.getMessage()); + } - //计算含税单价 - BigDecimal noriginalcurprice = null; - String receivedQty = stockinB.getReceivedQty();//实收数量 - String fulfillAmount = ofsPoOrderDetailRowTraget.getFulfillAmount();//实收累计总金额 - try { - noriginalcurprice = new BigDecimal(fulfillAmount).divide(new BigDecimal(receivedQty), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP); - } catch (Exception e) { - logger.error("计算采购入库单原币含税单价失败", e); - Assert.state(false, "计算采购入库单原币含税单价失败 原因:{}", e.getMessage()); + ScorderBodyDto scorderBodyDto = new ScorderBodyDto(); + scorderBodyDto.setCmangid(bdInvmandocEntity.getPkInvmandoc());//存货 + scorderBodyDto.setNordernum(stockinB.getReceivedQty());//数量 + scorderBodyDto.setNoriginalnetprice(noriginalcurprice.stripTrailingZeros().toPlainString());//净单价 + scorderBodyDto.setCwarehouseid(bdStordocEntity.getPkStordoc());//仓库 + scorderBodyDto.setBomversion(bomVersion.get(0).getVersion());//BOM版本 + scorderBodyDto.setDplanarrvdate(generateBusinessDate);//计划到货日期 + scorderBodyDtoArrayList.add(scorderBodyDto); } - ConsignmachiningInBodyDto consignmachiningInBodyDto = new ConsignmachiningInBodyDto(); - consignmachiningInBodyDto.setCinventoryid(bdInvmandocEntity.getPkInvmandoc());//存货 - //TODO 测试 - consignmachiningInBodyDto.setNinnum("1"); -// consignmachiningInBodyDto.setNinnum(new BigDecimal(stockinB.getReceivedQty()).stripTrailingZeros().toPlainString());//实收数量 - consignmachiningInBodyDto.setNprice(noriginalcurprice.stripTrailingZeros().toPlainString());//单价(含税单价) - consignmachiningInBodyDto.setCsourcetype("61");//来源单据类型 - consignmachiningInBodyDto.setVsourcerowno(u8cPoOrderDetail.getCrowno());//来源单据行号 - consignmachiningInBodyDto.setVsourcebillcode(scOrderEntity.getVordercode());//来源单据号 - consignmachiningInBodyDto.setWriteofftype("按备料发料核销");//核销方式 - consignmachiningInBodyDtoArrayList.add(consignmachiningInBodyDto); + List scorderDtoArrayList = new ArrayList<>(); + ScorderDto scorderDto = new ScorderDto(); + scorderDto.setParentvo(poOrderParentDto); + scorderDto.setChildrenvo(scorderBodyDtoArrayList); + scorderDtoArrayList.add(scorderDto); + + Map> stringStringMap = new HashMap<>(); + stringStringMap.put("OrderVO", scorderDtoArrayList); + IcGeneralHResultDto icGeneralHResultDto = sendU8cScorder(JSON.toJSONString(stringStringMap)); + + String cgeneralhid = null; + String vbillcode = null; + IcGeneralHResultHeadDto parentvo = icGeneralHResultDto.getParentvo(); + List childrenvo = icGeneralHResultDto.getChildrenvo(); + if (parentvo != null) { + cgeneralhid = parentvo.getCgeneralhid(); + } + if (childrenvo != null) { + vbillcode = parentvo.getVbillcode(); + } + logger.info("推送U8C委外入库成功!委外入库单主键:{} 委外入库单编码:{}", cgeneralhid, vbillcode); + + // 成功记录日志 + IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); + integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y); + integrationTaskLivingDetailsEntity.setRootAppNewData(JSON.toJSONString(consignmachiningInSonDto));//原始数据json + integrationTaskLivingDetailsEntity.setNewTransmitInfo(JSON.toJSONString(icGeneralHResultDto));//返回结果 + integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); + integrationTaskLivingDetailsEntity.setBusinessDate(generateBusinessDate); + integrationTaskLivingDetailsEntity.setRootAppPk(consignmachiningInSonDto.getId()); + integrationTaskLivingDetailsEntity.setRootAppBill(consignmachiningInSonDto.getCode()); + integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); + saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); + } catch (Exception e) { + logger.error("推送U8C委外订单失败", e); + + String message = e.getMessage(); + if (message == null) { + message = "未知错误"; + } + // 失败记录日志 + IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); + integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_N); + integrationTaskLivingDetailsEntity.setRootAppNewData(JSON.toJSONString(consignmachiningInSonDto));//原始数据json + integrationTaskLivingDetailsEntity.setNewTransmitInfo(JSON.toJSONString(message));//返回结果 + integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); + integrationTaskLivingDetailsEntity.setBusinessDate(generateBusinessDate); + integrationTaskLivingDetailsEntity.setRootAppPk(consignmachiningInSonDto.getId()); + integrationTaskLivingDetailsEntity.setRootAppBill(consignmachiningInSonDto.getCode()); + integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); + saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); } - - List consignmachiningInHeadBodyDtoArrayList = new ArrayList<>(); - - ConsignmachiningInHeadBodyDto consignmachiningInHeadBodyDto = new ConsignmachiningInHeadBodyDto(); - consignmachiningInHeadBodyDto.setParentvo(poOrderParentDto); - consignmachiningInHeadBodyDto.setChildrenvo(consignmachiningInBodyDtoArrayList); - consignmachiningInHeadBodyDtoArrayList.add(consignmachiningInHeadBodyDto); - - Map> stringStringMap = new HashMap<>(); - stringStringMap.put("GeneralBillVO", consignmachiningInHeadBodyDtoArrayList); - //TODO 2024年8月26日 14:41:46 委外入库核销方式传不了!已经提交总部 - //TODO 2024年8月26日 14:42:19 无法超委外订单数量入库!已经提交给总部 - IcGeneralHResultDto icGeneralHResultDto = sendU8cConsignmachiningIn(JSON.toJSONString(stringStringMap)); - - String cgeneralhid = null; - String vbillcode = null; - IcGeneralHResultHeadDto parentvo = icGeneralHResultDto.getParentvo(); - List childrenvo = icGeneralHResultDto.getChildrenvo(); - if (parentvo != null) { - cgeneralhid = parentvo.getCgeneralhid(); - } - if (childrenvo != null) { - vbillcode = parentvo.getVbillcode(); - } - logger.info("推送U8C委外入库成功!委外入库单主键:{} 委外入库单编码:{}", cgeneralhid, vbillcode); } } else { logger.info("poOrderSonDto.size为0!"); @@ -365,27 +426,84 @@ public class ConsignmachiningIn extends PluginBaseEntity { } //2024年8月25日 09:42:58 查询委外订单,如果这一步报错,后续的逻辑就没有必要执行了 - String ofsId = ofsPoOrderDataHeader.getId(); - Assert.notNull(ofsId, "通过接口查询到OFS采购订单,但是没有采购订单主键,业务逻辑无法完成"); - ScOrderEntity scOrderEntity = queryScOrder(ofsId); +// String ofsId = ofsPoOrderDataHeader.getId(); +// Assert.notNull(ofsId, "通过接口查询到OFS采购订单,但是没有采购订单主键,业务逻辑无法完成"); +// ScOrderEntity scOrderEntity = queryScOrder(ofsId); //2024年8月25日 14:15:45 根据委外订单id,查询委外订单表体明细行 - List scOrderBEntityList = queryScOrderDetail(scOrderEntity.getCorderid()); +// List scOrderBEntityList = queryScOrderDetail(scOrderEntity.getCorderid()); - //2024年8月25日 10:09:20 委外入库公司,取委外订单上的公司,已经和妮姐确认,没有必要通过O的公司转换,因为不存在跨组织的问题 - Assert.notNull(scOrderEntity.getPkCorp(), "O表头公司不能为空"); + //委外订单表头公司 + String companyCode = header.getCompanyCode(); + Assert.notNull(companyCode, "O表头公司不能为空(物理货主)"); BdCorpEntity bdCorpEntity = new BdCorpEntity(); bdCorpEntity.setDr(0); bdCorpEntity.setDataSourceCode("lets_u8c"); - bdCorpEntity.setPkCorp(scOrderEntity.getPkCorp()); + bdCorpEntity.setUnitcode(companyCode); List bdCorpEntityList = iBdCorpDao.query(bdCorpEntity); if (bdCorpEntityList.size() == 0) { - Assert.state(false, "根据委外订单公司主键:{},无法匹配到委外入库单", scOrderEntity.getPkCorp()); + Assert.state(false, "根据O货主编码{},无法匹配到U8C委外订单公司", companyCode); } else if (bdCorpEntityList.size() >= 2) { - Assert.state(false, "根据委外订单公司主键:{},匹配到{}个委外入库单", scOrderEntity.getPkCorp(), bdCorpEntityList.size()); + Assert.state(false, "根据O货主编码{},匹配到U8C委外订单公司{}个", companyCode, bdCorpEntityList.size()); } - // 2024年8月20日 23:51:56 收货库存组织,应该是通过收货公司查询得出收货库存组织,目前收货公司和采购公司保持一致,那么就以采购公司带出!这个逻辑已经和佳妮确认 + //采购组织 + BdPurorgEntity bdPurorgEntity = new BdPurorgEntity(); + bdPurorgEntity.setDr("0"); + bdPurorgEntity.setDataSourceCode("lets_u8c"); + bdPurorgEntity.setOwnercorp(bdCorpEntityList.get(0).getPkCorp()); + List bdPurorgEntityList = iBdPurorgDao.query(bdPurorgEntity); + if (bdPurorgEntityList.size() == 0) { + Assert.state(false, "根据委外订单公司主键:{} 无法匹配到采购组织", bdCorpEntityList.get(0).getPkCorp()); + } else if (bdPurorgEntityList.size() >= 2) { + Assert.state(false, "根据委外订单公司主键:{} 匹配到多个采购组织", bdCorpEntityList.get(0).getPkCorp()); + } + + //客商基本档案(供应商类型) + //2024年8月20日 14:47:55 丽知商城、OFS 供应商客商档案、传递到U8C的客商, + //其中自定义项1作为原系统编码,因此统一传到自定义项一,已经和大家确认好了,没有关系的,放心大胆传吧,宝贝 + String shipFromCode = header.getShipFromCode(); + Assert.notNull(shipFromCode, "O供应商编码不能为空,没有办法完成业务逻辑,请配置供应商编码(采退)"); + Assert.state(!"".equals(shipFromCode.trim()), "O供应商编码不能为空,没有办法完成业务逻辑,请配置供应商编码!"); + BdCubasdocEntity bdCubasdocEntity = new BdCubasdocEntity(); + bdCubasdocEntity.setDataSourceCode("lets_u8c"); + bdCubasdocEntity.setDr(0L); + bdCubasdocEntity.setDef1(shipFromCode); + List bdCubasdocEntityList = iBdCubasdocDao.query(bdCubasdocEntity); + if (bdCubasdocEntityList == null || bdCubasdocEntityList.size() == 0) { + Assert.state(false, "根据OFS供应商业务编码{},无法查询到U8C客商档案信息(供应商)", shipFromCode); + } else if (bdCubasdocEntityList.size() >= 2) { + Assert.state(false, "根据OFS供应商业务编码{},查询到多个U8C客商档案信息(供应商)", shipFromCode); + } + + //客商管理档案 + BdCumandocEntity bdCumandocEntity1 = new BdCumandocEntity(); + bdCumandocEntity1.setDataSourceCode("lets_u8c"); + bdCumandocEntity1.setDr(0L); + bdCumandocEntity1.setPkCorp(bdCorpEntityList.get(0).getPkCorp()); + bdCumandocEntity1.setCustflags(ProfilesActiveConstant.SUPPLIER); + bdCumandocEntity1.setPkCubasdoc(bdCubasdocEntityList.get(0).getPkCubasdoc()); + List bdCumandocEntityList = iBdCumandocDao.query(bdCumandocEntity1); + if (bdCumandocEntityList == null || bdCumandocEntityList.size() == 0) { + Assert.state(false, "根据客商基本档案主键{},无法匹配到客商管理档案", bdCubasdocEntityList.get(0).getPkCubasdoc()); + } else if (bdCumandocEntityList.size() >= 2) { + Assert.state(false, "根据客商基本档案主键{},匹配到多个客商管理档案", bdCubasdocEntityList.get(0).getPkCubasdoc()); + } + + //2024年8月25日 10:09:20 委外入库公司,取委外订单上的公司,已经和妮姐确认,没有必要通过O的公司转换,因为不存在跨组织的问题 +// Assert.notNull(scOrderEntity.getPkCorp(), "O表头公司不能为空"); +// BdCorpEntity bdCorpEntity = new BdCorpEntity(); +// bdCorpEntity.setDr(0); +// bdCorpEntity.setDataSourceCode("lets_u8c"); +// bdCorpEntity.setPkCorp(scOrderEntity.getPkCorp()); +// List bdCorpEntityList = iBdCorpDao.query(bdCorpEntity); +// if (bdCorpEntityList.size() == 0) { +// Assert.state(false, "根据委外订单公司主键:{},无法匹配到委外入库单", scOrderEntity.getPkCorp()); +// } else if (bdCorpEntityList.size() >= 2) { +// Assert.state(false, "根据委外订单公司主键:{},匹配到{}个委外入库单", scOrderEntity.getPkCorp(), bdCorpEntityList.size()); +// } + + // 库存组织 BdCalbodyEntity bdCalbodyEntity = new BdCalbodyEntity(); bdCalbodyEntity.setDr(0); bdCalbodyEntity.setDataSourceCode("lets_u8c"); @@ -397,7 +515,7 @@ public class ConsignmachiningIn extends PluginBaseEntity { Assert.state(false, "根据U8C采购公司{},匹配到U8C发货库存组织{}个", bdCorpEntityList.get(0).getPkCorp(), bdCalbodyEntities.size()); } - //入库仓库 + //表体仓库 String facilityCode = header.getFacilityCode(); Assert.notNull(facilityCode, "O售后入库单仓库facilityCode字段不能为空"); BdStordocEntity bdStordocEntity = new BdStordocEntity(); @@ -414,20 +532,24 @@ public class ConsignmachiningIn extends PluginBaseEntity { ConsignmachiningInSonDto consignmachiningInSonDto = new ConsignmachiningInSonDto(); consignmachiningInSonDto.setOfsPoOrderData(ofsPoOrderData); - consignmachiningInSonDto.setScOrderEntity(scOrderEntity); +// consignmachiningInSonDto.setScOrderEntity(scOrderEntity); consignmachiningInSonDto.setBdCorpEntity(bdCorpEntityList.get(0)); consignmachiningInSonDto.setBdCalbodyEntity(bdCalbodyEntities.get(0)); - consignmachiningInSonDto.setBdStordocEntity(bdStordocEntityList.get(0)); +// consignmachiningInSonDto.setBdStordocEntity(bdStordocEntityList.get(0)); + consignmachiningInSonDto.setBdPurorgEntity(bdPurorgEntityList.get(0)); + consignmachiningInSonDto.setBdCubasdocEntity(bdCubasdocEntityList.get(0)); + consignmachiningInSonDto.setBdCumandocEntity(bdCumandocEntityList.get(0)); // consignmachiningInSonDto.setHeader(header); - consignmachiningInSonDto.setScOrderBEntityList(scOrderBEntityList); +// consignmachiningInSonDto.setScOrderBEntityList(scOrderBEntityList); consignmachiningInSonDto.setDetails(details); + consignmachiningInSonDto.setBdStordocEntity(bdStordocEntityList.get(0)); BeanUtil.copyPropertiesV2(header, consignmachiningInSonDto); consignmachiningInSonDtoArrayList.add(consignmachiningInSonDto); } //成功 } catch (Exception e) { - logger.error("委外入库OFS档案转换", e); + logger.error("委外入库单OFS档案转换错误", e); //失败 } } else { @@ -441,22 +563,22 @@ public class ConsignmachiningIn extends PluginBaseEntity { * * @author liuyang */ - private ScOrderEntity queryScOrder(String ofsPoOrderId) { - Assert.notNull(ofsPoOrderId, "ofsPoOrderId不能为空!"); - Assert.state(!"".equals(ofsPoOrderId.trim()), "ofsPoOrderId不能为空"); - - ScOrderEntity scOrderEntity = new ScOrderEntity(); - scOrderEntity.setVdef20(ofsPoOrderId); - scOrderEntity.setDr("0"); - scOrderEntity.setDataSourceCode("lets_u8c"); - List scOrderEntityList = iScOrderDao.query(scOrderEntity); - if (scOrderEntityList == null || scOrderEntityList.size() == 0) { - Assert.state(false, "根据O采购订单主键:{}(u委外订单自定义项20存储O采购订单主键),无法匹配到U8C委外订单", ofsPoOrderId); - } else if (scOrderEntityList.size() >= 2) { - Assert.state(false, "根据O采购订单主键:{}(u委外订单自定义项20存储O采购订单主键),匹配到{}个U8C委外订单", ofsPoOrderId, scOrderEntityList.size()); - } - return scOrderEntityList.get(0); - } +// private ScOrderEntity queryScOrder(String ofsPoOrderId) { +// Assert.notNull(ofsPoOrderId, "ofsPoOrderId不能为空!"); +// Assert.state(!"".equals(ofsPoOrderId.trim()), "ofsPoOrderId不能为空"); +// +// ScOrderEntity scOrderEntity = new ScOrderEntity(); +// scOrderEntity.setVdef20(ofsPoOrderId); +// scOrderEntity.setDr("0"); +// scOrderEntity.setDataSourceCode("lets_u8c"); +// List scOrderEntityList = iScOrderDao.query(scOrderEntity); +// if (scOrderEntityList == null || scOrderEntityList.size() == 0) { +// Assert.state(false, "根据O采购订单主键:{}(u委外订单自定义项20存储O采购订单主键),无法匹配到U8C委外订单", ofsPoOrderId); +// } else if (scOrderEntityList.size() >= 2) { +// Assert.state(false, "根据O采购订单主键:{}(u委外订单自定义项20存储O采购订单主键),匹配到{}个U8C委外订单", ofsPoOrderId, scOrderEntityList.size()); +// } +// return scOrderEntityList.get(0); +// } /** * 2024年8月25日 14:11:31 查询U8C委外订单明细 @@ -464,31 +586,30 @@ public class ConsignmachiningIn extends PluginBaseEntity { * @param corderid 委外订单表头主键 * @author liuyang */ - private List queryScOrderDetail(String corderid) throws Exception { - Assert.notNull(corderid, "委外订单表头主键不能为空!"); - Assert.state(!"".equals(corderid), "委外订单表头主键不能为空!"); - - ScOrderBEntity scOrderBEntity = new ScOrderBEntity(); - scOrderBEntity.setCorderid(corderid); - scOrderBEntity.setDr("0"); - scOrderBEntity.setDataSourceCode("lets_u8c"); - List scOrderBEntityList = iScOrderBDao.query(scOrderBEntity); - if (scOrderBEntityList == null || scOrderBEntityList.size() == 0) { - //2024年8月25日 14:16:31 这个验证非常要必要,单据如果没有表体没有行,是很可疑的 - Assert.state(false, "根据U8C委外订单主键({})无法查询到委外订单表体明细行!", corderid); - } - return scOrderBEntityList; - } +// private List queryScOrderDetail(String corderid) throws Exception { +// Assert.notNull(corderid, "委外订单表头主键不能为空!"); +// Assert.state(!"".equals(corderid), "委外订单表头主键不能为空!"); +// +// ScOrderBEntity scOrderBEntity = new ScOrderBEntity(); +// scOrderBEntity.setCorderid(corderid); +// scOrderBEntity.setDr("0"); +// scOrderBEntity.setDataSourceCode("lets_u8c"); +// List scOrderBEntityList = iScOrderBDao.query(scOrderBEntity); +// if (scOrderBEntityList == null || scOrderBEntityList.size() == 0) { +// //2024年8月25日 14:16:31 这个验证非常要必要,单据如果没有表体没有行,是很可疑的 +// Assert.state(false, "根据U8C委外订单主键({})无法查询到委外订单表体明细行!", corderid); +// } +// return scOrderBEntityList; +// } /** * 2024年8月6日 10:59:03 查询U8C业务流程 * - * @param pkCorp 公司主键 * @author liuyang */ - private BdBusitypeEntity u8cOperationFlow(String pkCorp) throws Exception { - Assert.notNull(pkCorp, "公司主键不能为空!"); - Assert.state(!"".equals(pkCorp.trim()), "公司主键不能为空!"); + private BdBusitypeEntity u8cOperationFlow() throws Exception { +// Assert.notNull(pkCorp, "公司主键不能为空!"); +// Assert.state(!"".equals(pkCorp.trim()), "公司主键不能为空!"); //查询业务流程 //2024年8月6日 11:33:07 具体的业务流程名称,还需要实施提供 String processName = "委外加工"; @@ -532,36 +653,36 @@ public class ConsignmachiningIn extends PluginBaseEntity { * @param scOrderBEntityList U8C委外订单明细行 * @author liuyang */ - private ScOrderBEntity findOfsPoOrderDetailAndU8cPoOrderDetail(StockinOrderSearchResponse.StockinOrder.StockinB stockinB, OfsPoOrderData ofsPoOrderData, List scOrderBEntityList) { - Assert.notNull(stockinB, "stockinB不能为空"); - Assert.notNull(ofsPoOrderData, "ofsPoOrderData不能为空"); - Assert.notNull(scOrderBEntityList, "scOrderBEntityList删除不能为空"); - -// OfsPoOrderHeader header = ofsPoOrderData.getHeader(); - List details = ofsPoOrderData.getDetails(); - - //查找采购订单明细行 - OfsPoOrderDetails tarGetOfsPoOrderDetails = null; - for (int i = 0; i < details.size(); i++) { - OfsPoOrderDetails ofsPoOrderDetails = details.get(i); - if (ofsPoOrderDetails.getId().equals(stockinB.getRefOrderDetailId())) { - tarGetOfsPoOrderDetails = ofsPoOrderDetails; - } - } - Assert.notNull(tarGetOfsPoOrderDetails, "无法匹配到采购订单明细行! 目标主键:{}", stockinB.getRefOrderDetailId()); - - //根据采购订单明细行主键,查找U8C采购订单明细行 - for (int i = 0; i < scOrderBEntityList.size(); i++) { - ScOrderBEntity scOrderBEntity = scOrderBEntityList.get(i); - Assert.notNull(scOrderBEntity.getVdef20(), "委外订单明细行v20不能为空(明细行v20存储O采购订单明细行主键)!"); - Assert.state(!"".equals(scOrderBEntity.getVdef20()), "委外订单明细行v20不能为空(明细行v20存储O采购订单明细行主键)!"); - if (tarGetOfsPoOrderDetails.getId().equals(scOrderBEntity.getVdef20())) { - return scOrderBEntity; - } - } - Assert.state(false, "通过U8C采购订单明细行主键层层匹配到U8C采购明细失败!"); - return null; - } +// private ScOrderBEntity findOfsPoOrderDetailAndU8cPoOrderDetail(StockinOrderSearchResponse.StockinOrder.StockinB stockinB, OfsPoOrderData ofsPoOrderData, List scOrderBEntityList) { +// Assert.notNull(stockinB, "stockinB不能为空"); +// Assert.notNull(ofsPoOrderData, "ofsPoOrderData不能为空"); +// Assert.notNull(scOrderBEntityList, "scOrderBEntityList删除不能为空"); +// +//// OfsPoOrderHeader header = ofsPoOrderData.getHeader(); +// List details = ofsPoOrderData.getDetails(); +// +// //查找采购订单明细行 +// OfsPoOrderDetails tarGetOfsPoOrderDetails = null; +// for (int i = 0; i < details.size(); i++) { +// OfsPoOrderDetails ofsPoOrderDetails = details.get(i); +// if (ofsPoOrderDetails.getId().equals(stockinB.getRefOrderDetailId())) { +// tarGetOfsPoOrderDetails = ofsPoOrderDetails; +// } +// } +// Assert.notNull(tarGetOfsPoOrderDetails, "无法匹配到采购订单明细行! 目标主键:{}", stockinB.getRefOrderDetailId()); +// +// //根据采购订单明细行主键,查找U8C采购订单明细行 +// for (int i = 0; i < scOrderBEntityList.size(); i++) { +// ScOrderBEntity scOrderBEntity = scOrderBEntityList.get(i); +// Assert.notNull(scOrderBEntity.getVdef20(), "委外订单明细行v20不能为空(明细行v20存储O采购订单明细行主键)!"); +// Assert.state(!"".equals(scOrderBEntity.getVdef20()), "委外订单明细行v20不能为空(明细行v20存储O采购订单明细行主键)!"); +// if (tarGetOfsPoOrderDetails.getId().equals(scOrderBEntity.getVdef20())) { +// return scOrderBEntity; +// } +// } +// Assert.state(false, "通过U8C采购订单明细行主键层层匹配到U8C采购明细失败!"); +// return null; +// } /** * 匹配U8C采购订单明细行 @@ -617,19 +738,19 @@ public class ConsignmachiningIn extends PluginBaseEntity { * @param param 原数据json * @author liuyang */ - public IcGeneralHResultDto sendU8cConsignmachiningIn(String param) throws Exception { + public IcGeneralHResultDto sendU8cScorder(String param) throws Exception { long startLong = System.currentTimeMillis(); - logger.info("U8C委外入库推送开始,推送参数:" + param + ",U8C_URL:" + ProfilesActiveConstant.U8C_URL); + logger.info("U8C委外订单推送开始,推送参数:" + param + ",U8C_URL:" + ProfilesActiveConstant.U8C_URL); String result = HttpRequest.post(ProfilesActiveConstant.U8C_URL).header("appId", "800037")//头信息,多个头信息多次调用此方法即可 - .header("usercode", "admin").header("password", "21232f297a57a5a743894a0e4a801fc3").header("system", "lz").header("trantype", "PK").header("apiCode", "8000370056")//头信息,多个头信息多次调用此方法即可 + .header("usercode", "admin").header("password", "21232f297a57a5a743894a0e4a801fc3").header("system", "lz").header("trantype", "PK").header("apiCode", "8000370037")//头信息,多个头信息多次调用此方法即可 .header("publicKey", "ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj")//头信息,多个头信息多次调用此方法即可 .header("secretKey", "fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//头信息,多个头信息多次调用此方法即可 .body(param)//表单内容 .timeout(20000)//超时,毫秒 .execute().body(); - logger.info("U8C委外入库推送结束,返回参数:" + result); + logger.info("U8C委外订单推送结束,返回参数:" + result); long endLong = System.currentTimeMillis(); - logger.info("U8C委外入库推送耗时:" + (endLong - startLong)); + logger.info("U8C委外订单推送耗时:" + (endLong - startLong)); if (result == null) { result = ""; @@ -672,4 +793,49 @@ public class ConsignmachiningIn extends PluginBaseEntity { } return null; } + + /** + * 查询BOM版本,版本最新的在返回的结果集的最前面 + * + * @param gcbm 工厂主键 + * @param wlbmid 物料编码id,经过测试,这是存货基本档案主键 + */ + private List getBomVersion(String gcbm, String wlbmid) throws Exception { + Assert.notNull(gcbm, "gcbm工厂主键"); + Assert.notNull(wlbmid, "wlbmid物料编码id不能为空"); + + BdBomEntity bdBomEntity = new BdBomEntity(); + bdBomEntity.setDataSourceCode("lets_u8c"); + bdBomEntity.setWlbmid(wlbmid); + bdBomEntity.setGcbm(gcbm); + List bdBomEntityList = iBdBomDao.query(bdBomEntity); + //2024年9月2日 15:08:30 等待妮姐确认,如果对应的存货没有BOM,是否抛出异常 + //2024年9月2日 15:14:18 已经和妮姐确认,如果存货对应的BOM不存在,则抛出异常 + if (bdBomEntityList == null || bdBomEntityList.size() == 0) { + Assert.state(false, "存货:{} 工厂(库存足足):{}对应的BOM不存在(该存货需要维护BOM)!"); + } + return bdBomEntityList; + } + + /** + * 2024年8月7日 10:25:29 + * 查询基础档案,根据公司、管理档案主键查询 + * + * @author liuyang + */ + private BdInvbasdocEntity queryStockBasicArchives(String pkInvmandoc, String pkCorp) throws Exception { + Assert.notNull(pkInvmandoc, "存货管理档案不能为空"); + Assert.notNull(pkCorp, "公司档案不能为空"); + + BdInvbasdocEntity bdInvbasdocEntity = new BdInvbasdocEntity(); + bdInvbasdocEntity.setPk_invmandoc(pkInvmandoc); + bdInvbasdocEntity.setPk_corp(pkCorp); + List bdInvbasdocEntity2 = iBdInvbasdocDao.queryBdInvbasdocByPkInvmandocV2(bdInvbasdocEntity); + if (bdInvbasdocEntity2.size() == 0) { + Assert.state(false, "根据存货管理档案主键{}和公司档案主键{}没有查询到U8C基础档案", pkInvmandoc, pkCorp); + } else if (bdInvbasdocEntity2.size() >= 2) { + Assert.state(false, "根据存货管理档案主键{}和公司档案主键{}没有查询到U8C基础档案", pkInvmandoc, pkCorp); + } + return bdInvbasdocEntity2.get(0); + } } \ No newline at end of file diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningIn.txt b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningIn.txt new file mode 100644 index 00000000..b4dca5b0 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningIn.txt @@ -0,0 +1,675 @@ +package com.hzya.frame.plugin.lets.plugin.outsourc; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.lang.Assert; +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpRequest; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.base.PluginBaseEntity; +import com.hzya.frame.beanutil.BeanUtil; +import com.hzya.frame.plugin.lets.constant.ProfilesActiveConstant; +import com.hzya.frame.plugin.lets.dao.*; +import com.hzya.frame.plugin.lets.entity.*; +import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo; +import com.hzya.frame.plugin.lets.u8cdto.*; +import com.hzya.frame.plugin.lets.util.OfsStandardUtil; +import com.hzya.frame.plugin.lets.util.OnlyImplementProxyOrderUtil; +import com.hzya.frame.plugin.lets.util.QueryBdBusitypeUtil; +import com.hzya.frame.plugin.lets.util.RdclUtil; +import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderData; +import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderDetails; +import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderHeader; +import com.hzya.frame.ttxofs.dto.stock.StockinOrderSearchResponse; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; + +import java.math.BigDecimal; +import java.util.*; + +/** + * O采购入库 -> U8C委外加工入库 + * + * @Author:liuyang + * @Package:com.hzya.frame.plugin.lets.plugin.outsourc + * @Project:kangarooDataCenterV3 + * @name:ConsignmachiningIn + * @Date:2024年8月26日 10:23:20 + * @Filename:ConsignmachiningIn + */ +public class ConsignmachiningIn extends PluginBaseEntity { + + Logger logger = LoggerFactory.getLogger(ConsignmachiningIn.class); + + @Autowired + private QueryBdBusitypeUtil queryBdBusitypeUtil; + + @Autowired + private IBdCorpDao iBdCorpDao; + + @Autowired + private IBdInvmandocDao iBdInvmandocDao; + + @Autowired + private IBdCalbodyDao iBdCalbodyDao; + + @Autowired + private IBdStordocDao iBdStordocDao; + + @Autowired + private RdclUtil rdclUtil; + + @Autowired + private OfsStandardUtil ofsStandardUtil; + + @Autowired + private IScOrderDao iScOrderDao; + + @Autowired + private IScOrderBDao iScOrderBDao; + + @Autowired + private OnlyImplementProxyOrderUtil onlyImplementProxyOrder; + + @Override + public void initialize() { + logger.info(getPluginLabel() + "執行初始化方法initialize()"); + } + + @Override + public void destroy() { + logger.info(getPluginLabel() + "執行銷毀方法destroy()"); + } + + @Override + public String getPluginId() { + return "com.hzya.frame.plugin.lets.plugin.outsourc.ConsignmachiningIn"; + } + + @Override + public String getPluginName() { + return "OFS采购入库单生成U8C委外加工入库(委外采购入库)"; + } + + @Override + public String getPluginLabel() { + return "OFS采购入库单生成U8C委外加工入库(委外采购入库)"; + } + + @Override + public String getPluginType() { + return "3"; + } + + @Override + public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { + return null; + } + + /** + * 根据单号查询 + * + * @author liuyang + */ + public void startImplement(String startTime, String endTime) { + String threadNameStrStart = StrUtil.format("开始(委外采购)OFS采购入库单生成U8C委外加工入库 开始时间:{} 结束时间:{}", startTime, endTime); + logger.info(threadNameStrStart); + + Thread thread = new Thread(new Runnable() { + @Override + public void run() { + try { + List returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>(); + QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); + queryOfsSoSaleOutVo.setClosedAt_start(startTime); + queryOfsSoSaleOutVo.setClosedAt_end(endTime); + queryOfsSoSaleOutVo.setClientCode("LETS"); + queryOfsSoSaleOutVo.setPageNo(1L); + queryOfsSoSaleOutVo.setPageSize(50L); + queryOfsSoSaleOutVo.setInternalInstructionType("PURCHASE"); + queryOfsSoSaleOutVo.setStatus(900L); + ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search"); + logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size()); + if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { + getSet(returnGoodHeaderDetailsDataDtoArrayList); + } else { + logger.info("没有查询到任何数据!不需要同步"); + } + } catch (Exception e) { + logger.error("startImplement方法抛出异常", e); + } + } + }, threadNameStrStart); + thread.start(); + try { + thread.join(); + } catch (Exception e) { + logger.error("thread.join()异常", e); + } + String threadNameStrEnd = StrUtil.format("结束(委外采购)OFS采购入库单生成U8C委外加工入库 开始时间:{} 结束时间:{}", startTime, endTime); + logger.info(threadNameStrEnd); + } + + /** + * 根据单号查询 + * + * @author liuyang + */ + public void startImplement(String code) { + String threadNameStrStart = StrUtil.format("开始(委外采购)OFS采购入库单生成U8C委外加工入库 OFS采购入库单号:{}", code); + logger.info(threadNameStrStart); + + Thread thread = new Thread(new Runnable() { + @Override + public void run() { + try { + List returnGoodHeaderDetailsDataDtoArrayList = new ArrayList<>(); + QueryOfsSoSaleOutVo queryOfsSoSaleOutVo = new QueryOfsSoSaleOutVo(); + queryOfsSoSaleOutVo.setClientCode("LETS"); + queryOfsSoSaleOutVo.setPageNo(1L); + queryOfsSoSaleOutVo.setPageSize(50L); + queryOfsSoSaleOutVo.setCode(code); + queryOfsSoSaleOutVo.setInternalInstructionType("PURCHASE"); + queryOfsSoSaleOutVo.setStatus(900L); + ofsStandardUtil.queryOfsReturnGoods(queryOfsSoSaleOutVo, returnGoodHeaderDetailsDataDtoArrayList, 1L, "ofs.receipt.search"); + logger.info("数据返回行数:{}", returnGoodHeaderDetailsDataDtoArrayList.size()); + if (returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { + getSet(returnGoodHeaderDetailsDataDtoArrayList); + } else { + logger.info("没有查询到任何数据!不需要同步"); + } + } catch (Exception e) { + logger.error("startImplement方法抛出异常", e); + } + } + }, threadNameStrStart); + thread.start(); + try { + thread.join(); + } catch (Exception e) { + logger.error("thread.join()异常", e); + } + String threadNameStrEnd = StrUtil.format("结束(委外采购)OFS采购入库单生成U8C委外加工入库 OFS采购入库单号:{}", code); + logger.info(threadNameStrEnd); + } + + /** + * 环境预配置 + * + * @param returnGoodHeaderDetailsDataDtoArrayList 采购入库单 + * @author liuyang + */ + private void getSet(List returnGoodHeaderDetailsDataDtoArrayList) throws Exception { + //过滤成功的数据 + List stockinOrderList = filterData(returnGoodHeaderDetailsDataDtoArrayList); + //执行推送主逻辑 + implement(stockinOrderList); + } + + /** + * 过滤掉成功的数据 + * + * @author liuyang + */ + private List filterData(List returnGoodHeaderDetailsDataDtoArrayList) { + List headerDetailsDtoList1 = new ArrayList<>(); + if (returnGoodHeaderDetailsDataDtoArrayList != null && returnGoodHeaderDetailsDataDtoArrayList.size() > 0) { + //TODO 出库单明细主键,需要O返回,目前没有,已经提需求 + headerDetailsDtoList1.addAll(returnGoodHeaderDetailsDataDtoArrayList); + } + return headerDetailsDtoList1; + } + + /** + * 执行主逻辑 + * + * @author liuyang + */ + private void implement(List returnGoodHeaderDetailsDataDtoList) throws Exception { + if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) { + try { + // 查询基本档案 + List consignmachiningInSonDtos = queryBasicArchives(returnGoodHeaderDetailsDataDtoList); + // 查询采购收发类别 + BdRdclEntity bdRdclEntity = rdclUtil.queryRdClObject("105"); + + if (consignmachiningInSonDtos != null && consignmachiningInSonDtos.size() > 0) { + for (int i = 0; i < consignmachiningInSonDtos.size(); i++) { + ConsignmachiningInSonDto consignmachiningInSonDto = consignmachiningInSonDtos.get(i); +// StockinOrderSearchResponse.StockinOrder.StockinH header = consignmachiningInSonDto.getHeader(); + List details = consignmachiningInSonDto.getDetails(); + + String generateBusinessDate = createGenerateBusinessDate(consignmachiningInSonDto); //生成业务日期 + OfsPoOrderData ofsPoOrderData = consignmachiningInSonDto.getOfsPoOrderData();//OFS采购订单 + ScOrderEntity scOrderEntity = consignmachiningInSonDto.getScOrderEntity();//U8C委外订单 + BdCorpEntity bdCorpEntity = consignmachiningInSonDto.getBdCorpEntity();//公司 + BdCalbodyEntity bdCalbodyEntity = consignmachiningInSonDto.getBdCalbodyEntity();//库存组织 + BdStordocEntity bdStordocEntity = consignmachiningInSonDto.getBdStordocEntity();//仓库 +// StockinOrderSearchResponse.StockinOrder.StockinH header1 = consignmachiningInSonDto.getHeader(); + List details1 = consignmachiningInSonDto.getDetails();//OFS采购入库单 + List scOrderBEntityList = consignmachiningInSonDto.getScOrderBEntityList();//U8C委外订单明细行主键 + + OfsPoOrderHeader ofsPoOrderDataHeader = ofsPoOrderData.getHeader(); + List ofsPoOrderDataDetails = ofsPoOrderData.getDetails(); + + // 代理委外入库业务流程 + BdBusitypeEntity bdBusitypeEntity = u8cOperationFlow(bdCorpEntity.getPkCorp()); + + //委外入库表头 + ConsignmachiningInHeadDto poOrderParentDto = new ConsignmachiningInHeadDto(); + poOrderParentDto.setPk_corp(bdCorpEntity.getPkCorp()); + poOrderParentDto.setCoperatorid("0001A110000000000U3D"); + poOrderParentDto.setCwarehouseid(bdStordocEntity.getPkStordoc()); + poOrderParentDto.setPk_calbody(bdCalbodyEntity.getPkCalbody()); + poOrderParentDto.setCbiztype(bdBusitypeEntity.getPkBusitype()); + poOrderParentDto.setCdispatcherid(bdRdclEntity.getPkRdcl());//收发类别 + poOrderParentDto.setDbilldate(generateBusinessDate);//入库日期 + + //委外入库表头明细行 + List consignmachiningInBodyDtoArrayList = new ArrayList<>(); + for (int j = 0; j < details.size(); j++) { + StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details.get(j); + //匹配U8C采购订单明细行 + ScOrderBEntity u8cPoOrderDetail = findOfsPoOrderDetailAndU8cPoOrderDetail(stockinB, ofsPoOrderData, scOrderBEntityList); + //通过O采购订单入库单明细行,联查OFS采购订单明细行 + OfsPoOrderDetails ofsPoOrderDetailRowTraget = findOfsPoOrderDetailRowTraget(stockinB, ofsPoOrderData); + //查询存货管理档案 + BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(stockinB, bdCorpEntity.getPkCorp()); + + //计算含税单价 + BigDecimal noriginalcurprice = null; + String receivedQty = stockinB.getReceivedQty();//实收数量 + String fulfillAmount = ofsPoOrderDetailRowTraget.getFulfillAmount();//实收累计总金额 + try { + noriginalcurprice = new BigDecimal(fulfillAmount).divide(new BigDecimal(receivedQty), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP); + } catch (Exception e) { + logger.error("计算采购入库单原币含税单价失败", e); + Assert.state(false, "计算采购入库单原币含税单价失败 原因:{}", e.getMessage()); + } + + ConsignmachiningInBodyDto consignmachiningInBodyDto = new ConsignmachiningInBodyDto(); + consignmachiningInBodyDto.setCinventoryid(bdInvmandocEntity.getPkInvmandoc());//存货 + //TODO 测试 + consignmachiningInBodyDto.setNinnum("1"); +// consignmachiningInBodyDto.setNinnum(new BigDecimal(stockinB.getReceivedQty()).stripTrailingZeros().toPlainString());//实收数量 + consignmachiningInBodyDto.setNprice(noriginalcurprice.stripTrailingZeros().toPlainString());//单价(含税单价) + consignmachiningInBodyDto.setCsourcetype("61");//来源单据类型 + consignmachiningInBodyDto.setVsourcerowno(u8cPoOrderDetail.getCrowno());//来源单据行号 + consignmachiningInBodyDto.setVsourcebillcode(scOrderEntity.getVordercode());//来源单据号 + consignmachiningInBodyDto.setWriteofftype("按备料发料核销");//核销方式 + consignmachiningInBodyDtoArrayList.add(consignmachiningInBodyDto); + } + + List consignmachiningInHeadBodyDtoArrayList = new ArrayList<>(); + + ConsignmachiningInHeadBodyDto consignmachiningInHeadBodyDto = new ConsignmachiningInHeadBodyDto(); + consignmachiningInHeadBodyDto.setParentvo(poOrderParentDto); + consignmachiningInHeadBodyDto.setChildrenvo(consignmachiningInBodyDtoArrayList); + consignmachiningInHeadBodyDtoArrayList.add(consignmachiningInHeadBodyDto); + + Map> stringStringMap = new HashMap<>(); + stringStringMap.put("GeneralBillVO", consignmachiningInHeadBodyDtoArrayList); + //TODO 2024年8月26日 14:41:46 委外入库核销方式传不了!已经提交总部 + //TODO 2024年8月26日 14:42:19 无法超委外订单数量入库!已经提交给总部 + IcGeneralHResultDto icGeneralHResultDto = sendU8cConsignmachiningIn(JSON.toJSONString(stringStringMap)); + + String cgeneralhid = null; + String vbillcode = null; + IcGeneralHResultHeadDto parentvo = icGeneralHResultDto.getParentvo(); + List childrenvo = icGeneralHResultDto.getChildrenvo(); + if (parentvo != null) { + cgeneralhid = parentvo.getCgeneralhid(); + } + if (childrenvo != null) { + vbillcode = parentvo.getVbillcode(); + } + logger.info("推送U8C委外入库成功!委外入库单主键:{} 委外入库单编码:{}", cgeneralhid, vbillcode); + } + } else { + logger.info("poOrderSonDto.size为0!"); + } + } catch (Exception e) { + logger.error("implement方法抛出异常", e); + } + } + } + + /** + * 档案转换(OFS->U8C) + * 2024年8月23日 12:02:47 和妮姐沟通,单据流程U8C成品委外订单 -> 备料计划 -> U8C委外发料(核销) + * + * @author liuyang + */ + private List queryBasicArchives(List returnGoodHeaderDetailsDataDtoList) { + List consignmachiningInSonDtoArrayList = new ArrayList<>(); + + if (returnGoodHeaderDetailsDataDtoList != null && returnGoodHeaderDetailsDataDtoList.size() > 0) { + try { + for (int i = 0; i < returnGoodHeaderDetailsDataDtoList.size(); i++) { + StockinOrderSearchResponse.StockinOrder stockinOrder = returnGoodHeaderDetailsDataDtoList.get(i); + StockinOrderSearchResponse.StockinOrder.StockinH header = stockinOrder.getHeader(); + List details = stockinOrder.getDetails(); + + //2024年8月25日 09:54:31 查询OFS采购订单 + OfsPoOrderData ofsPoOrderData = ofsStandardUtil.queryOfsPoOrder(header.getRefOrderCode()); + Assert.notNull(ofsPoOrderData, "无法查询到委外订单(OFS采购入库单->OSF采购订单->OFS采购订单主键->U8C委外订单自定义项20)"); + OfsPoOrderHeader ofsPoOrderDataHeader = ofsPoOrderData.getHeader(); + List ofsPoOrderDataDetails = ofsPoOrderData.getDetails(); + + //如果该O采购订单对应的类型为:委外加工,则继续代码逻辑,否则就跳过代码逻辑 + boolean checkResult = onlyImplementProxyOrder.onlyImplementProxyOrder(ofsPoOrderData, "WWJG"); + if (!checkResult) { + continue; + } + + //2024年8月25日 09:42:58 查询委外订单,如果这一步报错,后续的逻辑就没有必要执行了 + String ofsId = ofsPoOrderDataHeader.getId(); + Assert.notNull(ofsId, "通过接口查询到OFS采购订单,但是没有采购订单主键,业务逻辑无法完成"); + ScOrderEntity scOrderEntity = queryScOrder(ofsId); + + //2024年8月25日 14:15:45 根据委外订单id,查询委外订单表体明细行 + List scOrderBEntityList = queryScOrderDetail(scOrderEntity.getCorderid()); + + //2024年8月25日 10:09:20 委外入库公司,取委外订单上的公司,已经和妮姐确认,没有必要通过O的公司转换,因为不存在跨组织的问题 + Assert.notNull(scOrderEntity.getPkCorp(), "O表头公司不能为空"); + BdCorpEntity bdCorpEntity = new BdCorpEntity(); + bdCorpEntity.setDr(0); + bdCorpEntity.setDataSourceCode("lets_u8c"); + bdCorpEntity.setPkCorp(scOrderEntity.getPkCorp()); + List bdCorpEntityList = iBdCorpDao.query(bdCorpEntity); + if (bdCorpEntityList.size() == 0) { + Assert.state(false, "根据委外订单公司主键:{},无法匹配到委外入库单", scOrderEntity.getPkCorp()); + } else if (bdCorpEntityList.size() >= 2) { + Assert.state(false, "根据委外订单公司主键:{},匹配到{}个委外入库单", scOrderEntity.getPkCorp(), bdCorpEntityList.size()); + } + + // 2024年8月20日 23:51:56 收货库存组织,应该是通过收货公司查询得出收货库存组织,目前收货公司和采购公司保持一致,那么就以采购公司带出!这个逻辑已经和佳妮确认 + BdCalbodyEntity bdCalbodyEntity = new BdCalbodyEntity(); + bdCalbodyEntity.setDr(0); + bdCalbodyEntity.setDataSourceCode("lets_u8c"); + bdCalbodyEntity.setPkCorp(bdCorpEntityList.get(0).getPkCorp()); + List bdCalbodyEntities = iBdCalbodyDao.query(bdCalbodyEntity); + if (bdCalbodyEntities.size() == 0) { + Assert.state(false, "根据U8C采购公司{},无法匹配到U8C发货库存组织", bdCorpEntityList.get(0).getPkCorp()); + } else if (bdCalbodyEntities.size() >= 2) { + Assert.state(false, "根据U8C采购公司{},匹配到U8C发货库存组织{}个", bdCorpEntityList.get(0).getPkCorp(), bdCalbodyEntities.size()); + } + + //入库仓库 + String facilityCode = header.getFacilityCode(); + Assert.notNull(facilityCode, "O售后入库单仓库facilityCode字段不能为空"); + BdStordocEntity bdStordocEntity = new BdStordocEntity(); + bdStordocEntity.setDr(0L); + bdStordocEntity.setDataSourceCode("lets_u8c"); + bdStordocEntity.setPkCalbody(bdCalbodyEntities.get(0).getPkCalbody()); + bdStordocEntity.setStorcode(facilityCode); + List bdStordocEntityList = iBdStordocDao.query(bdStordocEntity); + if (bdStordocEntityList.size() == 0) { + Assert.state(false, "根据O仓库编码+U8C收货库存组织主键,无法匹配到U8C仓库", facilityCode, bdCalbodyEntities.get(0).getPkCalbody()); + } else if (bdStordocEntityList.size() >= 2) { + Assert.state(false, "根据O仓库编码+U8C收货库存组织主键,匹配到U8C仓库多个", facilityCode, bdCalbodyEntities.get(0).getPkCalbody()); + } + + ConsignmachiningInSonDto consignmachiningInSonDto = new ConsignmachiningInSonDto(); + consignmachiningInSonDto.setOfsPoOrderData(ofsPoOrderData); + consignmachiningInSonDto.setScOrderEntity(scOrderEntity); + consignmachiningInSonDto.setBdCorpEntity(bdCorpEntityList.get(0)); + consignmachiningInSonDto.setBdCalbodyEntity(bdCalbodyEntities.get(0)); + consignmachiningInSonDto.setBdStordocEntity(bdStordocEntityList.get(0)); +// consignmachiningInSonDto.setHeader(header); + consignmachiningInSonDto.setScOrderBEntityList(scOrderBEntityList); + consignmachiningInSonDto.setDetails(details); + + BeanUtil.copyPropertiesV2(header, consignmachiningInSonDto); + consignmachiningInSonDtoArrayList.add(consignmachiningInSonDto); + } + //成功 + } catch (Exception e) { + logger.error("委外入库OFS档案转换", e); + //失败 + } + } else { + logger.info("queryBasicArchives对应returnGoodHeaderDetailsDataDtoList.size为0"); + } + return consignmachiningInSonDtoArrayList; + } + + /** + * 查询委外订单表头对象 + * + * @author liuyang + */ + private ScOrderEntity queryScOrder(String ofsPoOrderId) { + Assert.notNull(ofsPoOrderId, "ofsPoOrderId不能为空!"); + Assert.state(!"".equals(ofsPoOrderId.trim()), "ofsPoOrderId不能为空"); + + ScOrderEntity scOrderEntity = new ScOrderEntity(); + scOrderEntity.setVdef20(ofsPoOrderId); + scOrderEntity.setDr("0"); + scOrderEntity.setDataSourceCode("lets_u8c"); + List scOrderEntityList = iScOrderDao.query(scOrderEntity); + if (scOrderEntityList == null || scOrderEntityList.size() == 0) { + Assert.state(false, "根据O采购订单主键:{}(u委外订单自定义项20存储O采购订单主键),无法匹配到U8C委外订单", ofsPoOrderId); + } else if (scOrderEntityList.size() >= 2) { + Assert.state(false, "根据O采购订单主键:{}(u委外订单自定义项20存储O采购订单主键),匹配到{}个U8C委外订单", ofsPoOrderId, scOrderEntityList.size()); + } + return scOrderEntityList.get(0); + } + + /** + * 2024年8月25日 14:11:31 查询U8C委外订单明细 + * + * @param corderid 委外订单表头主键 + * @author liuyang + */ + private List queryScOrderDetail(String corderid) throws Exception { + Assert.notNull(corderid, "委外订单表头主键不能为空!"); + Assert.state(!"".equals(corderid), "委外订单表头主键不能为空!"); + + ScOrderBEntity scOrderBEntity = new ScOrderBEntity(); + scOrderBEntity.setCorderid(corderid); + scOrderBEntity.setDr("0"); + scOrderBEntity.setDataSourceCode("lets_u8c"); + List scOrderBEntityList = iScOrderBDao.query(scOrderBEntity); + if (scOrderBEntityList == null || scOrderBEntityList.size() == 0) { + //2024年8月25日 14:16:31 这个验证非常要必要,单据如果没有表体没有行,是很可疑的 + Assert.state(false, "根据U8C委外订单主键({})无法查询到委外订单表体明细行!", corderid); + } + return scOrderBEntityList; + } + + /** + * 2024年8月6日 10:59:03 查询U8C业务流程 + * + * @param pkCorp 公司主键 + * @author liuyang + */ + private BdBusitypeEntity u8cOperationFlow(String pkCorp) throws Exception { + Assert.notNull(pkCorp, "公司主键不能为空!"); + Assert.state(!"".equals(pkCorp.trim()), "公司主键不能为空!"); + //查询业务流程 + //2024年8月6日 11:33:07 具体的业务流程名称,还需要实施提供 + String processName = "委外加工"; + BdBusitypeEntity bdBusitypeEntity = queryBdBusitypeUtil.queryBdBusitype(processName); + Assert.notNull(bdBusitypeEntity, "根据业务流程名称({})没有查询到业务流程", processName); + return bdBusitypeEntity; + } + + /** + * 2024年8月20日 15:46:10 + * 生成业务日期,以发货时间作为业务日期 + * + * @author liuyang + */ + private String createGenerateBusinessDate(ConsignmachiningInSonDto consignmachiningInSonDto) { + //TODO 测试 + consignmachiningInSonDto.setShipAt("2024-08-19"); + if (consignmachiningInSonDto != null && consignmachiningInSonDto.getShipAt() != null) { + String shipAt = consignmachiningInSonDto.getShipAt(); + String businessFormat = null; + try { + Date dbill = DateUtil.parse(shipAt); + businessFormat = DateUtil.format(dbill, "yyyy-MM-dd"); + } catch (Exception e) { + logger.error("业务日期生成失败", e); + } + return businessFormat; + } else { + logger.error("生成采购订单入库日期失败,或者shipAt为空! json:{}", JSON.toJSON(consignmachiningInSonDto)); + Assert.state(false, "生成采购订单入库日期失败,或者shipAt为空! json:{}", JSON.toJSON(consignmachiningInSonDto)); + return null; + } + } + + /** + * 匹配U8C采购订单明细行 + * 通过O采购入库单明细行,得到采购订单明细行,最后查找到U8C采购订单明细行 + * + * @param stockinB OFS采购入库单明细行 + * @param ofsPoOrderData OFS采购订单 + * @param scOrderBEntityList U8C委外订单明细行 + * @author liuyang + */ + private ScOrderBEntity findOfsPoOrderDetailAndU8cPoOrderDetail(StockinOrderSearchResponse.StockinOrder.StockinB stockinB, OfsPoOrderData ofsPoOrderData, List scOrderBEntityList) { + Assert.notNull(stockinB, "stockinB不能为空"); + Assert.notNull(ofsPoOrderData, "ofsPoOrderData不能为空"); + Assert.notNull(scOrderBEntityList, "scOrderBEntityList删除不能为空"); + +// OfsPoOrderHeader header = ofsPoOrderData.getHeader(); + List details = ofsPoOrderData.getDetails(); + + //查找采购订单明细行 + OfsPoOrderDetails tarGetOfsPoOrderDetails = null; + for (int i = 0; i < details.size(); i++) { + OfsPoOrderDetails ofsPoOrderDetails = details.get(i); + if (ofsPoOrderDetails.getId().equals(stockinB.getRefOrderDetailId())) { + tarGetOfsPoOrderDetails = ofsPoOrderDetails; + } + } + Assert.notNull(tarGetOfsPoOrderDetails, "无法匹配到采购订单明细行! 目标主键:{}", stockinB.getRefOrderDetailId()); + + //根据采购订单明细行主键,查找U8C采购订单明细行 + for (int i = 0; i < scOrderBEntityList.size(); i++) { + ScOrderBEntity scOrderBEntity = scOrderBEntityList.get(i); + Assert.notNull(scOrderBEntity.getVdef20(), "委外订单明细行v20不能为空(明细行v20存储O采购订单明细行主键)!"); + Assert.state(!"".equals(scOrderBEntity.getVdef20()), "委外订单明细行v20不能为空(明细行v20存储O采购订单明细行主键)!"); + if (tarGetOfsPoOrderDetails.getId().equals(scOrderBEntity.getVdef20())) { + return scOrderBEntity; + } + } + Assert.state(false, "通过U8C采购订单明细行主键层层匹配到U8C采购明细失败!"); + return null; + } + + /** + * 匹配U8C采购订单明细行 + * 通过O采购入库单明细行,得到采购订单明细行,最后查找到U8C采购订单明细行 + * + * @param stockinB OFS采购入库单明细行 + * @param ofsPoOrderData OFS采购订单 + * @author liuyang + */ + private OfsPoOrderDetails findOfsPoOrderDetailRowTraget(StockinOrderSearchResponse.StockinOrder.StockinB stockinB, OfsPoOrderData ofsPoOrderData) { + Assert.notNull(stockinB, "stockinB不能为空"); + Assert.notNull(ofsPoOrderData, "ofsPoOrderData不能为空"); + + List details = ofsPoOrderData.getDetails(); + for (int i = 0; i < details.size(); i++) { + OfsPoOrderDetails ofsPoOrderDetails = details.get(i); + if (ofsPoOrderDetails.getId().equals(stockinB.getRefOrderDetailId())) { + return ofsPoOrderDetails; + } + } + Assert.state(false, "通过OFS采购入库单,无法匹配到OFS采购订单明细行! 目标主键:{}", stockinB.getRefOrderDetailId()); + return null; + } + + /** + * 查询存货管理档案 + * + * @param pkCorp 发货公司主键 + * @param stockinB 采购入库单明细行 + * @author liuyang + */ + private BdInvmandocEntity queryInventoryMan(StockinOrderSearchResponse.StockinOrder.StockinB stockinB, String pkCorp) throws Exception { + Assert.notNull(stockinB, "sonDetailsDto不能为空"); + Assert.notNull(stockinB.getSkuCode(), "O存货商家编码不能为空"); + Assert.notNull(pkCorp, "发货公司主键不能为空"); + + BdInvmandocEntity bdInvmandocEntity = new BdInvmandocEntity(); + bdInvmandocEntity.setInvcode(stockinB.getSkuCode()); + bdInvmandocEntity.setPkCorp(pkCorp); + List bdInvmandocEntity2 = iBdInvmandocDao.queryBdInvmandocByInvcodeList(bdInvmandocEntity); + if (bdInvmandocEntity2.size() == 0) { + Assert.state(false, "根据O商家编码:{} U8C发货公司主键:{}没有查询到存货管理档案", stockinB.getSkuCode(), pkCorp); + } else if (bdInvmandocEntity2.size() >= 2) { + Assert.state(false, "根据O商家编码:{} U8C发货公司主键:{}没有查询到存货管理档案", stockinB.getSkuCode(), pkCorp); + } + return bdInvmandocEntity2.get(0); + } + + /** + * 2024年8月25日 15:12:22 + * 推送U8C委外入库单 + * + * @param param 原数据json + * @author liuyang + */ + public IcGeneralHResultDto sendU8cConsignmachiningIn(String param) throws Exception { + long startLong = System.currentTimeMillis(); + logger.info("U8C委外入库推送开始,推送参数:" + param + ",U8C_URL:" + ProfilesActiveConstant.U8C_URL); + String result = HttpRequest.post(ProfilesActiveConstant.U8C_URL).header("appId", "800037")//头信息,多个头信息多次调用此方法即可 + .header("usercode", "admin").header("password", "21232f297a57a5a743894a0e4a801fc3").header("system", "lz").header("trantype", "PK").header("apiCode", "8000370056")//头信息,多个头信息多次调用此方法即可 + .header("publicKey", "ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj")//头信息,多个头信息多次调用此方法即可 + .header("secretKey", "fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//头信息,多个头信息多次调用此方法即可 + .body(param)//表单内容 + .timeout(20000)//超时,毫秒 + .execute().body(); + logger.info("U8C委外入库推送结束,返回参数:" + result); + long endLong = System.currentTimeMillis(); + logger.info("U8C委外入库推送耗时:" + (endLong - startLong)); + + if (result == null) { + result = ""; + } + + JSONObject jsonObject = JSON.parseObject(result); + result = String.valueOf(jsonObject.get("attribute")); + + boolean isSuccess = false; + IcGeneralHResultDto icGeneralHResultDto = null; + if (result != null && !"".equals(result)) { + ReusltStrDto reusltStrDto = JSON.parseObject(result, ReusltStrDto.class); + if ("success".equals(reusltStrDto.getStatus())) { + icGeneralHResultDto = resultDataHandle(reusltStrDto.getData()); + isSuccess = true; + } + } + if (!isSuccess) { + Assert.state(false, "O采购入库业务推送U8C委外入库失败 接口返回结果:{}", result); + } + return icGeneralHResultDto; + } + + /** + * 返回结果解析处理,在确认了success后调用 + * + * @author liuyang + */ + private IcGeneralHResultDto resultDataHandle(String resultData) { + try { + if (resultData != null && !"".equals(resultData)) { + if (resultData.contains("[")) { + resultData = resultData.substring(1, resultData.length() - 1); + } + return JSON.parseObject(resultData, IcGeneralHResultDto.class); + } + } catch (Exception e) { + logger.error("resultDataHandle方法解析返回参数失败的错误", e); + //如果解析失败,记录原因,但是不能影响结果的记录 + } + return null; + } +} \ No newline at end of file diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningInOrderReturn.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningInOrderReturn.txt similarity index 100% rename from buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningInOrderReturn.java rename to buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningInOrderReturn.txt diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningInReturn.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningInReturn.java index b5306313..7d4dc1b4 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningInReturn.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/outsourc/ConsignmachiningInReturn.java @@ -14,6 +14,7 @@ import com.hzya.frame.plugin.lets.entity.*; import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo; import com.hzya.frame.plugin.lets.u8cdto.*; import com.hzya.frame.plugin.lets.util.*; +import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity; import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderData; import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderDetails; import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderHeader; @@ -85,6 +86,9 @@ public class ConsignmachiningInReturn extends PluginBaseEntity { @Autowired private IBdStordocDao iBdStordocDao; + @Autowired + private SaveOrUpdateBusinessLogUtil saveOrUpdateBusinessLogUtil; + @Override public void initialize() { logger.info(getPluginLabel() + "執行初始化方法initialize()"); @@ -97,7 +101,7 @@ public class ConsignmachiningInReturn extends PluginBaseEntity { @Override public String getPluginId() { - return "com.hzya.frame.plugin.lets.plugin.outsourc.ConsignmachiningInReturn"; + return "outsourc.ConsignmachiningInReturn"; } @Override @@ -262,82 +266,114 @@ public class ConsignmachiningInReturn extends PluginBaseEntity { ReturnOrderHeaderDto returnOrderHeaderDto = returnOrderHeaderDtos.get(i); List details = returnOrderHeaderDto.getDetails(); - String generateBusinessDate = createGenerateBusinessDate(returnOrderHeaderDto); //生成业务日期 - PurchaseReturnOrder purchaseReturnOrder = returnOrderHeaderDto.getPurchaseReturnOrder();//OFS采退订单 - ScOrderEntity scOrderEntity = returnOrderHeaderDto.getScOrderEntity();//U8C委外订单 - List scOrderBEntityList = returnOrderHeaderDto.getScOrderBEntityList();//U8C委外订单明细行 - BdCorpEntity bdCorpEntity = returnOrderHeaderDto.getBdCorpEntity();//公司 - BdCalbodyEntity bdCalbodyEntity = returnOrderHeaderDto.getBdCalbodyEntity();//库存组织 - BdStordocEntity bdStordocEntity = returnOrderHeaderDto.getBdStordocEntity();//仓库 - OfsPoOrderData ofsPoOrder = returnOrderHeaderDto.getOfsPoOrder();//OFS原正向的采购订单 + String generateBusinessDate = null; + try { + generateBusinessDate = createGenerateBusinessDate(returnOrderHeaderDto); //生成业务日期 + PurchaseReturnOrder purchaseReturnOrder = returnOrderHeaderDto.getPurchaseReturnOrder();//OFS采退订单 + ScOrderEntity scOrderEntity = returnOrderHeaderDto.getScOrderEntity();//U8C委外订单 + List scOrderBEntityList = returnOrderHeaderDto.getScOrderBEntityList();//U8C委外订单明细行 + BdCorpEntity bdCorpEntity = returnOrderHeaderDto.getBdCorpEntity();//公司 + BdCalbodyEntity bdCalbodyEntity = returnOrderHeaderDto.getBdCalbodyEntity();//库存组织 + BdStordocEntity bdStordocEntity = returnOrderHeaderDto.getBdStordocEntity();//仓库 + OfsPoOrderData ofsPoOrder = returnOrderHeaderDto.getOfsPoOrder();//OFS原正向的采购订单 - //委外入库表头 - ConsignmachiningInHeadDto poOrderParentDto = new ConsignmachiningInHeadDto(); - poOrderParentDto.setPk_corp(bdCorpEntity.getPkCorp()); - poOrderParentDto.setCoperatorid("0001A110000000000U3D"); - poOrderParentDto.setCwarehouseid(bdStordocEntity.getPkStordoc()); - poOrderParentDto.setPk_calbody(bdCalbodyEntity.getPkCalbody()); - poOrderParentDto.setCbiztype(bdBusitypeEntity.getPkBusitype()); - poOrderParentDto.setCdispatcherid(bdRdclEntity.getPkRdcl());//收发类别 - poOrderParentDto.setDbilldate(generateBusinessDate);//入库日期 - poOrderParentDto.setFreplenishflag(true);//是否退货 + //委外入库表头 + ConsignmachiningInHeadDto poOrderParentDto = new ConsignmachiningInHeadDto(); + poOrderParentDto.setPk_corp(bdCorpEntity.getPkCorp()); + poOrderParentDto.setCoperatorid("0001A110000000000U3D"); + poOrderParentDto.setCwarehouseid(bdStordocEntity.getPkStordoc()); + poOrderParentDto.setPk_calbody(bdCalbodyEntity.getPkCalbody()); + poOrderParentDto.setCbiztype(bdBusitypeEntity.getPkBusitype()); + poOrderParentDto.setCdispatcherid(bdRdclEntity.getPkRdcl());//收发类别 + poOrderParentDto.setDbilldate(generateBusinessDate);//入库日期 + poOrderParentDto.setFreplenishflag(true);//是否退货 - //委外入库表头明细行 - List consignmachiningInBodyDtoArrayList = new ArrayList<>(); - for (int j = 0; j < details.size(); j++) { - DetailsDto detailsDto = details.get(j); - //匹配U8C采购订单明细行 - ScOrderBEntity u8cPoOrderDetail = findOfsPoOrderDetailAndU8cPoOrderDetail(detailsDto, purchaseReturnOrder, ofsPoOrder, scOrderBEntityList); - //通过O采退出库库单明细行,联查OFS采退订单明细行 - PurchaseReturnOrderDetails ofsPoOrderDetailRowTraget = findOfsPoOrderDetailRowTraget(detailsDto, purchaseReturnOrder); - //查询存货管理档案 + //委外入库表头明细行 + List consignmachiningInBodyDtoArrayList = new ArrayList<>(); + for (int j = 0; j < details.size(); j++) { + DetailsDto detailsDto = details.get(j); + //匹配U8C采购订单明细行 + ScOrderBEntity u8cPoOrderDetail = findOfsPoOrderDetailAndU8cPoOrderDetail(detailsDto, purchaseReturnOrder, ofsPoOrder, scOrderBEntityList); + //通过O采退出库库单明细行,联查OFS采退订单明细行 + PurchaseReturnOrderDetails ofsPoOrderDetailRowTraget = findOfsPoOrderDetailRowTraget(detailsDto, purchaseReturnOrder); + //查询存货管理档案 // BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(stockinB, bdCorpEntity.getPkCorp()); - BdInvmandocEntity bdInvmandocEntity = null; + BdInvmandocEntity bdInvmandocEntity = null; - //计算含税单价 - BigDecimal noriginalcurprice = null; - String receivedQty = detailsDto.getShipQty();//实收数量 - String fulfillAmount = ofsPoOrderDetailRowTraget.getFulfillAmount();//实收累计总金额 - try { - noriginalcurprice = new BigDecimal(fulfillAmount).divide(new BigDecimal(receivedQty), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP); - } catch (Exception e) { - logger.error("计算采退出库单原币含税单价失败", e); - Assert.state(false, "计算采退出库单原币含税单价失败 原因:{}", e.getMessage()); + //计算含税单价 + BigDecimal noriginalcurprice = null; + String receivedQty = detailsDto.getShipQty();//实收数量 + String fulfillAmount = ofsPoOrderDetailRowTraget.getFulfillAmount();//实收累计总金额 + try { + noriginalcurprice = new BigDecimal(fulfillAmount).divide(new BigDecimal(receivedQty), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP); + } catch (Exception e) { + logger.error("计算采退出库单原币含税单价失败", e); + Assert.state(false, "计算采退出库单原币含税单价失败 原因:{}", e.getMessage()); + } + + ConsignmachiningInBodyDto consignmachiningInBodyDto = new ConsignmachiningInBodyDto(); + consignmachiningInBodyDto.setCinventoryid(bdInvmandocEntity.getPkInvmandoc());//存货主键 + consignmachiningInBodyDto.setNinnum("-" + new BigDecimal(receivedQty).stripTrailingZeros().toPlainString());//实收数量 + consignmachiningInBodyDto.setNprice(noriginalcurprice.stripTrailingZeros().toPlainString());//单价(含税单价) + consignmachiningInBodyDto.setCsourcetype("61");//来源单据类型 + consignmachiningInBodyDto.setVsourcerowno(u8cPoOrderDetail.getCrowno());//来源单据行号 + consignmachiningInBodyDto.setVsourcebillcode(scOrderEntity.getVordercode());//来源单据号 +// consignmachiningInBodyDto.setWriteofftype("按备料发料核销");//核销方式,和妮姐已经确认,不用传递 + consignmachiningInBodyDto.setDbizdate(generateBusinessDate);// 入库日期 + consignmachiningInBodyDtoArrayList.add(consignmachiningInBodyDto); } - ConsignmachiningInBodyDto consignmachiningInBodyDto = new ConsignmachiningInBodyDto(); - consignmachiningInBodyDto.setCinventoryid(bdInvmandocEntity.getPkInvmandoc());//存货主键 - consignmachiningInBodyDto.setNinnum("-" + new BigDecimal(receivedQty).stripTrailingZeros().toPlainString());//实收数量 - consignmachiningInBodyDto.setNprice(noriginalcurprice.stripTrailingZeros().toPlainString());//单价(含税单价) - consignmachiningInBodyDto.setCsourcetype("61");//来源单据类型 - consignmachiningInBodyDto.setVsourcerowno(u8cPoOrderDetail.getCrowno());//来源单据行号 - consignmachiningInBodyDto.setVsourcebillcode(scOrderEntity.getVordercode());//来源单据号 -// consignmachiningInBodyDto.setWriteofftype("按备料发料核销");//核销方式,和妮姐已经确认,不用传递 - consignmachiningInBodyDto.setDbizdate(generateBusinessDate);// 入库日期 - consignmachiningInBodyDtoArrayList.add(consignmachiningInBodyDto); + List consignmachiningInHeadBodyDtoArrayList = new ArrayList<>(); + ConsignmachiningInHeadBodyDto consignmachiningInHeadBodyDto = new ConsignmachiningInHeadBodyDto(); + consignmachiningInHeadBodyDto.setParentvo(poOrderParentDto); + consignmachiningInHeadBodyDto.setChildrenvo(consignmachiningInBodyDtoArrayList); + consignmachiningInHeadBodyDtoArrayList.add(consignmachiningInHeadBodyDto); + + Map> stringStringMap = new HashMap<>(); + stringStringMap.put("GeneralBillVO", consignmachiningInHeadBodyDtoArrayList); + //2024年8月26日 14:41:46 委外入库核销方式传不了!已经提交总部,2024年8月30日 14:05:25 已经解决,和妮姐确认不用填写 + //TODO 2024年8月26日 14:42:19 无法超委外订单数量入库!已经提交给总部 + IcGeneralHResultDto icGeneralHResultDto = sendU8cConsignmachiningIn(JSON.toJSONString(stringStringMap)); + + String cgeneralhid = null; + String vbillcode = null; + IcGeneralHResultHeadDto parentvo = icGeneralHResultDto.getParentvo(); + List childrenvo = icGeneralHResultDto.getChildrenvo(); + if (parentvo != null) { + cgeneralhid = parentvo.getCgeneralhid(); + vbillcode = parentvo.getVbillcode(); + } + logger.info("推送U8C红字委外入库成功!委外入库单主键:{} 委外入库单编码:{} 公司名称:{}", cgeneralhid, vbillcode, bdCorpEntity.getUnitname()); + // 成功记录日志 + IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); + integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y); + integrationTaskLivingDetailsEntity.setRootAppNewData(JSON.toJSONString(returnOrderHeaderDto));//原始数据json + integrationTaskLivingDetailsEntity.setNewTransmitInfo(JSON.toJSONString(icGeneralHResultDto));//返回结果 + integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); + integrationTaskLivingDetailsEntity.setBusinessDate(generateBusinessDate); + integrationTaskLivingDetailsEntity.setRootAppPk(returnOrderHeaderDto.getId()); + integrationTaskLivingDetailsEntity.setRootAppBill(returnOrderHeaderDto.getCode()); + integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); + saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); + } catch (Exception e) { + logger.error("推送U8C红字委外入库单失败", e); + + String message = e.getMessage(); + if (message == null) { + message = "未知错误"; + } + // 失败记录日志 + IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); + integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_N); + integrationTaskLivingDetailsEntity.setRootAppNewData(JSON.toJSONString(returnOrderHeaderDto));//原始数据json + integrationTaskLivingDetailsEntity.setNewTransmitInfo(JSON.toJSONString(message));//返回结果 + integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); + integrationTaskLivingDetailsEntity.setBusinessDate(generateBusinessDate); + integrationTaskLivingDetailsEntity.setRootAppPk(returnOrderHeaderDto.getId()); + integrationTaskLivingDetailsEntity.setRootAppBill(returnOrderHeaderDto.getCode()); + integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); + saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); } - - List consignmachiningInHeadBodyDtoArrayList = new ArrayList<>(); - ConsignmachiningInHeadBodyDto consignmachiningInHeadBodyDto = new ConsignmachiningInHeadBodyDto(); - consignmachiningInHeadBodyDto.setParentvo(poOrderParentDto); - consignmachiningInHeadBodyDto.setChildrenvo(consignmachiningInBodyDtoArrayList); - consignmachiningInHeadBodyDtoArrayList.add(consignmachiningInHeadBodyDto); - - Map> stringStringMap = new HashMap<>(); - stringStringMap.put("GeneralBillVO", consignmachiningInHeadBodyDtoArrayList); - //2024年8月26日 14:41:46 委外入库核销方式传不了!已经提交总部,2024年8月30日 14:05:25 已经解决,和妮姐确认不用填写 - //TODO 2024年8月26日 14:42:19 无法超委外订单数量入库!已经提交给总部 - IcGeneralHResultDto icGeneralHResultDto = sendU8cConsignmachiningIn(JSON.toJSONString(stringStringMap)); - - String cgeneralhid = null; - String vbillcode = null; - IcGeneralHResultHeadDto parentvo = icGeneralHResultDto.getParentvo(); - List childrenvo = icGeneralHResultDto.getChildrenvo(); - if (parentvo != null) { - cgeneralhid = parentvo.getCgeneralhid(); - vbillcode = parentvo.getVbillcode(); - } - logger.info("推送U8C红字委外入库成功!委外入库单主键:{} 委外入库单编码:{} 公司名称:{}", cgeneralhid, vbillcode, bdCorpEntity.getUnitname()); } } else { logger.info("poOrderSonDto.size为0!"); diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseReturn.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseReturn.java index eeb7a1c5..3554232d 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseReturn.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseReturn.java @@ -13,10 +13,8 @@ import com.hzya.frame.plugin.lets.dao.*; import com.hzya.frame.plugin.lets.entity.*; import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo; import com.hzya.frame.plugin.lets.u8cdto.*; -import com.hzya.frame.plugin.lets.util.OfsStandardUtil; -import com.hzya.frame.plugin.lets.util.OnlyImplementProxyOrderUtil; -import com.hzya.frame.plugin.lets.util.QueryBdBusitypeUtil; -import com.hzya.frame.plugin.lets.util.RdclUtil; +import com.hzya.frame.plugin.lets.util.*; +import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity; import com.hzya.frame.ttxofs.dto.InterfaceParamDto; import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderBean; import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderData; @@ -85,6 +83,9 @@ public class ProxyPurchaseReturn extends PluginBaseEntity { @Autowired private OfsStandardUtil ofsStandardUtil; + @Autowired + private SaveOrUpdateBusinessLogUtil saveOrUpdateBusinessLogUtil; + @Autowired private OnlyImplementProxyOrderUtil onlyImplementProxyOrder; @@ -100,7 +101,7 @@ public class ProxyPurchaseReturn extends PluginBaseEntity { @Override public String getPluginId() { - return "com.hzya.frame.plugin.lets.plugin.purchase.ProxyPurchaseReturn"; + return "purchase.ProxyPurchaseReturn"; } @Override @@ -290,109 +291,142 @@ public class ProxyPurchaseReturn extends PluginBaseEntity { PoOrderRerturnSonDto poOrderSonDto = poOrderRerturnSonDtos.get(i); List details = poOrderSonDto.getDetails(); - //生成业务日期 - String generateBusinessDate = createGenerateBusinessDate(poOrderSonDto); + String generateBusinessDate = null; + try { + //生成业务日期 + generateBusinessDate = createGenerateBusinessDate(poOrderSonDto); - BdCorpEntity bdCorpEntity = poOrderSonDto.getBdCorpEntity();//采购公司、收货公司 - BdDeptdocEntity bdDeptdocEntity = poOrderSonDto.getBdDeptdocEntity();//采购部门 - BdPurorgEntity bdPurorgEntity = poOrderSonDto.getBdPurorgEntity();//采购组织 - BdCubasdocEntity bdCubasdocEntity = poOrderSonDto.getBdCubasdocEntity();//客商基本档案-供应商 - BdCumandocEntity bdCumandocEntity = poOrderSonDto.getBdCumandocEntity();//客商管理档案-供应商 - BdCalbodyEntity bdCalbodyEntity = poOrderSonDto.getBdCalbodyEntity();//收货库存组织 - BdStordocEntity bdStordocEntity = poOrderSonDto.getBdStordocEntity();//收货仓库 + BdCorpEntity bdCorpEntity = poOrderSonDto.getBdCorpEntity();//采购公司、收货公司 + BdDeptdocEntity bdDeptdocEntity = poOrderSonDto.getBdDeptdocEntity();//采购部门 + BdPurorgEntity bdPurorgEntity = poOrderSonDto.getBdPurorgEntity();//采购组织 + BdCubasdocEntity bdCubasdocEntity = poOrderSonDto.getBdCubasdocEntity();//客商基本档案-供应商 + BdCumandocEntity bdCumandocEntity = poOrderSonDto.getBdCumandocEntity();//客商管理档案-供应商 + BdCalbodyEntity bdCalbodyEntity = poOrderSonDto.getBdCalbodyEntity();//收货库存组织 + BdStordocEntity bdStordocEntity = poOrderSonDto.getBdStordocEntity();//收货仓库 - PurchaseReturnOrder purchaseReturnOrder = poOrderSonDto.getPurchaseReturnOrder();//OFS采退订单 - PurchaseReturnOrderHeader header = purchaseReturnOrder.getHeader(); - List details1 = purchaseReturnOrder.getDetails(); + PurchaseReturnOrder purchaseReturnOrder = poOrderSonDto.getPurchaseReturnOrder();//OFS采退订单 + PurchaseReturnOrderHeader header = purchaseReturnOrder.getHeader(); + List details1 = purchaseReturnOrder.getDetails(); - //采购订单表头 - PoOrderParentDto poOrderParentDto = new PoOrderParentDto(); - poOrderParentDto.setBreturn(true);//确认退货 - poOrderParentDto.setCbiztype(bdBusitypeEntity.getPkBusitype());//业务流程 - poOrderParentDto.setCdeptid(bdDeptdocEntity.getPkDeptdoc());//采购部门 - poOrderParentDto.setCoperator("0001A110000000000U3D");//制单人 - poOrderParentDto.setCpurorganization(bdPurorgEntity.getPkPurorg());//采购组织 - poOrderParentDto.setPk_corp(bdCorpEntity.getPkCorp());//采购公司 - poOrderParentDto.setCvendormangid(bdCumandocEntity.getPkCumandoc());//供应商管理档案 - poOrderParentDto.setDauditdate(generateBusinessDate);//审批日期 - poOrderParentDto.setDorderdate(generateBusinessDate);//订单日期 - poOrderParentDto.setDrevisiondate(generateBusinessDate);//修改日期 - //2024年8月21日 13:34:07 对比了手工建单和接口传单,发现接口传单少了这个:是否由销售订单协同生成、补货标志、是否已协同生成销售订单 默认为N - poOrderParentDto.setBsocooptome(false);//是否由销售订单协同生成 - poOrderParentDto.setBisreplenish(false);//补货标志 - poOrderParentDto.setBcooptoso(false);//是否已协同生成销售订单 - poOrderParentDto.setCgiveinvoicevendor(bdCumandocEntity.getPkCumandoc());//发票方id + //采购订单表头 + PoOrderParentDto poOrderParentDto = new PoOrderParentDto(); + poOrderParentDto.setBreturn(true);//确认退货 + poOrderParentDto.setCbiztype(bdBusitypeEntity.getPkBusitype());//业务流程 + poOrderParentDto.setCdeptid(bdDeptdocEntity.getPkDeptdoc());//采购部门 + poOrderParentDto.setCoperator("0001A110000000000U3D");//制单人 + poOrderParentDto.setCpurorganization(bdPurorgEntity.getPkPurorg());//采购组织 + poOrderParentDto.setPk_corp(bdCorpEntity.getPkCorp());//采购公司 + poOrderParentDto.setCvendormangid(bdCumandocEntity.getPkCumandoc());//供应商管理档案 + poOrderParentDto.setDauditdate(generateBusinessDate);//审批日期 + poOrderParentDto.setDorderdate(generateBusinessDate);//订单日期 + poOrderParentDto.setDrevisiondate(generateBusinessDate);//修改日期 + //2024年8月21日 13:34:07 对比了手工建单和接口传单,发现接口传单少了这个:是否由销售订单协同生成、补货标志、是否已协同生成销售订单 默认为N + poOrderParentDto.setBsocooptome(false);//是否由销售订单协同生成 + poOrderParentDto.setBisreplenish(false);//补货标志 + poOrderParentDto.setBcooptoso(false);//是否已协同生成销售订单 + poOrderParentDto.setCgiveinvoicevendor(bdCumandocEntity.getPkCumandoc());//发票方id - poOrderParentDto.setVdef17(ProfilesActiveConstant.sourceSystem1);//来源系统 - poOrderParentDto.setVdef19(poOrderSonDto.getCode());//原单单号 - poOrderParentDto.setVdef20(poOrderSonDto.getId());//原单主键 + poOrderParentDto.setVdef17(ProfilesActiveConstant.sourceSystem1);//来源系统 + poOrderParentDto.setVdef19(poOrderSonDto.getCode());//原单单号 + poOrderParentDto.setVdef20(poOrderSonDto.getId());//原单主键 - //收发类别 - poOrderParentDto.setPk_defdoc3(bdRdclEntity.getPkRdcl()); - poOrderParentDto.setVdef3(bdRdclEntity.getRdname()); + //收发类别 + poOrderParentDto.setPk_defdoc3(bdRdclEntity.getPkRdcl()); + poOrderParentDto.setVdef3(bdRdclEntity.getRdname()); - //采购订单明细行 - List poOrderChildrenDtoList = new ArrayList<>(); + //采购订单明细行 + List poOrderChildrenDtoList = new ArrayList<>(); - for (int j = 0; j < details.size(); j++) { - DetailsDto detailsDto = details.get(j); - PurchaseReturnOrderDetails ofsPoOrderDetail = findOfsPoOrderDetail(details1, detailsDto); + for (int j = 0; j < details.size(); j++) { + DetailsDto detailsDto = details.get(j); + PurchaseReturnOrderDetails ofsPoOrderDetail = findOfsPoOrderDetail(details1, detailsDto); - //TODO 测试 - detailsDto.setShipQty("1"); - ofsPoOrderDetail.setFulfillAmount("10"); + //TODO 测试 + detailsDto.setShipQty("1"); + ofsPoOrderDetail.setFulfillAmount("10"); - //2024年8月20日 16:02:21 已经和妮姐、万万确认,采购公司和收货公司目前是一致的,暂时不用区分取数逻辑 - BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(detailsDto, bdCorpEntity.getPkCorp()); - String receivedQty = detailsDto.getShipQty();//实发数量 - String fulfillAmount = ofsPoOrderDetail.getDiscountPrice();//实际进价 + //2024年8月20日 16:02:21 已经和妮姐、万万确认,采购公司和收货公司目前是一致的,暂时不用区分取数逻辑 + BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(detailsDto, bdCorpEntity.getPkCorp()); + String receivedQty = detailsDto.getShipQty();//实发数量 + String fulfillAmount = ofsPoOrderDetail.getDiscountPrice();//实际进价 - //原币含税单价 - BigDecimal noriginalcurprice = null; - try { - noriginalcurprice = new BigDecimal(fulfillAmount).divide(new BigDecimal(receivedQty), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP); - } catch (Exception e) { - logger.error("计算采退出库单原币含税单价失败", e); - Assert.state(false, "计算采退出库单原币含税单价失败 原因:{}", e.getMessage()); + //原币含税单价 + BigDecimal noriginalcurprice = null; + try { + noriginalcurprice = new BigDecimal(fulfillAmount).divide(new BigDecimal(receivedQty), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP); + } catch (Exception e) { + logger.error("计算采退出库单原币含税单价失败", e); + Assert.state(false, "计算采退出库单原币含税单价失败 原因:{}", e.getMessage()); + } + + PoOrderChildrenDto poOrderChildrenDto = new PoOrderChildrenDto(); + poOrderChildrenDto.setCmangid(bdInvmandocEntity.getPkInvmandoc());//存货管理id + poOrderChildrenDto.setNordernum("-" + new BigDecimal(receivedQty).stripTrailingZeros().toPlainString());//订货数量 + poOrderChildrenDto.setNorgtaxprice(noriginalcurprice.stripTrailingZeros().toPlainString());//原币含税单价 + poOrderChildrenDto.setPk_arrvcorp(bdCorpEntity.getPkCorp());//收货公司 + poOrderChildrenDto.setPk_arrvstoorg(bdCalbodyEntity.getPkCalbody());//收货库存组织 + poOrderChildrenDto.setCwarehouseid(bdStordocEntity.getPkStordoc());//收货仓库 + poOrderChildrenDto.setPk_reqcorp(bdCorpEntity.getPkCorp());//需求公司 * +// poOrderChildrenDto.setIisreplenish(false);//补货标识 * + poOrderChildrenDto.setCoperator("0001A110000000000U3D");//操作员id +// poOrderChildrenDto.setBreceiveplan(false);//存在到货计划 + poOrderChildrenDtoList.add(poOrderChildrenDto); + + //2024年8月20日 16:00:03 已经和佳妮总确认,计划到货日期,不用进行传递 } - PoOrderChildrenDto poOrderChildrenDto = new PoOrderChildrenDto(); - poOrderChildrenDto.setCmangid(bdInvmandocEntity.getPkInvmandoc());//存货管理id - poOrderChildrenDto.setNordernum("-" + new BigDecimal(receivedQty).stripTrailingZeros().toPlainString());//订货数量 - poOrderChildrenDto.setNorgtaxprice(noriginalcurprice.stripTrailingZeros().toPlainString());//原币含税单价 - poOrderChildrenDto.setPk_arrvcorp(bdCorpEntity.getPkCorp());//收货公司 - poOrderChildrenDto.setPk_arrvstoorg(bdCalbodyEntity.getPkCalbody());//收货库存组织 - poOrderChildrenDto.setCwarehouseid(bdStordocEntity.getPkStordoc());//收货仓库 - poOrderChildrenDto.setPk_reqcorp(bdCorpEntity.getPkCorp());//需求公司 * -// poOrderChildrenDto.setIisreplenish(false);//补货标识 * - poOrderChildrenDto.setCoperator("0001A110000000000U3D");//操作员id -// poOrderChildrenDto.setBreceiveplan(false);//存在到货计划 - poOrderChildrenDtoList.add(poOrderChildrenDto); + List poOrderParentChildrenDtoList = new ArrayList<>(); + PoOrderParentChildrenDto poOrderParentChildrenDto = new PoOrderParentChildrenDto(); + poOrderParentChildrenDto.setParentvo(poOrderParentDto); + poOrderParentChildrenDto.setChildrenvo(poOrderChildrenDtoList); + poOrderParentChildrenDtoList.add(poOrderParentChildrenDto); - //2024年8月20日 16:00:03 已经和佳妮总确认,计划到货日期,不用进行传递 + Map> stringStringMap = new HashMap<>(); + stringStringMap.put("puordervo", poOrderParentChildrenDtoList); + PoOrderHeadBodyDto poOrderHeadBodyDto = sendU8CPoOrder(JSON.toJSONString(stringStringMap)); + + String corderid = null; + String vordercode = null; + PoOrderHeadDto parentvo = poOrderHeadBodyDto.getParentvo(); + List childrenvo = poOrderHeadBodyDto.getChildrenvo(); + if (parentvo != null) { + corderid = parentvo.getCorderid(); + } + if (childrenvo != null) { + vordercode = parentvo.getVordercode(); + } + logger.info("推送U8C代理品牌采购订单采购!U8C采购订单主键:{} U8C采购订单编码:{}", corderid, vordercode); + + // 成功记录日志 + IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); + integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y); + integrationTaskLivingDetailsEntity.setRootAppNewData(JSON.toJSONString(poOrderSonDto));//原始数据json + integrationTaskLivingDetailsEntity.setNewTransmitInfo(JSON.toJSONString(poOrderHeadBodyDto));//返回结果 + integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); + integrationTaskLivingDetailsEntity.setBusinessDate(generateBusinessDate); + integrationTaskLivingDetailsEntity.setRootAppPk(poOrderSonDto.getId()); + integrationTaskLivingDetailsEntity.setRootAppBill(poOrderSonDto.getCode()); + integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); + saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); + } catch (Exception e) { + logger.error("推送U8C代理品牌红字采购订单采购失败!", e); + + // 失败记录日志 + String message = e.getMessage(); + if (message == null) { + message = "未知错误"; + } + IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); + integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_N); + integrationTaskLivingDetailsEntity.setRootAppNewData(JSON.toJSONString(poOrderSonDto));//原始数据json + integrationTaskLivingDetailsEntity.setNewTransmitInfo(JSON.toJSONString(message));//返回结果 + integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); + integrationTaskLivingDetailsEntity.setBusinessDate(generateBusinessDate); + integrationTaskLivingDetailsEntity.setRootAppPk(poOrderSonDto.getId()); + integrationTaskLivingDetailsEntity.setRootAppBill(poOrderSonDto.getCode()); + integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); + saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); } - - List poOrderParentChildrenDtoList = new ArrayList<>(); - PoOrderParentChildrenDto poOrderParentChildrenDto = new PoOrderParentChildrenDto(); - poOrderParentChildrenDto.setParentvo(poOrderParentDto); - poOrderParentChildrenDto.setChildrenvo(poOrderChildrenDtoList); - poOrderParentChildrenDtoList.add(poOrderParentChildrenDto); - - Map> stringStringMap = new HashMap<>(); - stringStringMap.put("puordervo", poOrderParentChildrenDtoList); - PoOrderHeadBodyDto poOrderHeadBodyDto = sendU8CPoOrder(JSON.toJSONString(stringStringMap)); - - String corderid = null; - String vordercode = null; - PoOrderHeadDto parentvo = poOrderHeadBodyDto.getParentvo(); - List childrenvo = poOrderHeadBodyDto.getChildrenvo(); - if (parentvo != null) { - corderid = parentvo.getCorderid(); - } - if (childrenvo != null) { - vordercode = parentvo.getVordercode(); - } - logger.info("推送U8C代理品牌采购订单采购!U8C采购订单主键:{} U8C采购订单编码:{}", corderid, vordercode); } } else { logger.info("poOrderSonDto.size为0!"); diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseWarehous.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseWarehous.java index 3ca19558..c7220b0c 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseWarehous.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/purchase/ProxyPurchaseWarehous.java @@ -13,10 +13,8 @@ import com.hzya.frame.plugin.lets.dao.*; import com.hzya.frame.plugin.lets.entity.*; import com.hzya.frame.plugin.lets.ofsvo.QueryOfsSoSaleOutVo; import com.hzya.frame.plugin.lets.u8cdto.*; -import com.hzya.frame.plugin.lets.util.OfsStandardUtil; -import com.hzya.frame.plugin.lets.util.OnlyImplementProxyOrderUtil; -import com.hzya.frame.plugin.lets.util.QueryBdBusitypeUtil; -import com.hzya.frame.plugin.lets.util.RdclUtil; +import com.hzya.frame.plugin.lets.util.*; +import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity; import com.hzya.frame.ttxofs.dto.InterfaceParamDto; import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderBean; import com.hzya.frame.ttxofs.dto.ofspoorder.OfsPoOrderData; @@ -85,6 +83,9 @@ public class ProxyPurchaseWarehous extends PluginBaseEntity { @Autowired private OnlyImplementProxyOrderUtil onlyImplementProxyOrder; + @Autowired + private SaveOrUpdateBusinessLogUtil saveOrUpdateBusinessLogUtil; + @Override public void initialize() { logger.info(getPluginLabel() + "執行初始化方法initialize()"); @@ -97,7 +98,7 @@ public class ProxyPurchaseWarehous extends PluginBaseEntity { @Override public String getPluginId() { - return "com.hzya.frame.plugin.lets.plugin.purchase.ProxyPurchaseWarehous"; + return "purchase.ProxyPurchaseWarehous"; } @Override @@ -284,108 +285,141 @@ public class ProxyPurchaseWarehous extends PluginBaseEntity { PoOrderSonDto poOrderSonDto = poOrderSonDtos.get(i); List details = poOrderSonDto.getDetails(); - //生成业务日期 - String generateBusinessDate = createGenerateBusinessDate(poOrderSonDto); + String generateBusinessDate = null; + try { + //生成业务日期 + generateBusinessDate = createGenerateBusinessDate(poOrderSonDto); - BdCorpEntity bdCorpEntity = poOrderSonDto.getBdCorpEntity();//采购公司、收货公司 - BdDeptdocEntity bdDeptdocEntity = poOrderSonDto.getBdDeptdocEntity();//采购部门 - BdPurorgEntity bdPurorgEntity = poOrderSonDto.getBdPurorgEntity();//采购组织 - BdCubasdocEntity bdCubasdocEntity = poOrderSonDto.getBdCubasdocEntity();//客商基本档案-供应商 - BdCumandocEntity bdCumandocEntity = poOrderSonDto.getBdCumandocEntity();//客商管理档案-供应商 - BdCalbodyEntity bdCalbodyEntity = poOrderSonDto.getBdCalbodyEntity();//收货库存组织 - BdStordocEntity bdStordocEntity = poOrderSonDto.getBdStordocEntity();//收货仓库 + BdCorpEntity bdCorpEntity = poOrderSonDto.getBdCorpEntity();//采购公司、收货公司 + BdDeptdocEntity bdDeptdocEntity = poOrderSonDto.getBdDeptdocEntity();//采购部门 + BdPurorgEntity bdPurorgEntity = poOrderSonDto.getBdPurorgEntity();//采购组织 + BdCubasdocEntity bdCubasdocEntity = poOrderSonDto.getBdCubasdocEntity();//客商基本档案-供应商 + BdCumandocEntity bdCumandocEntity = poOrderSonDto.getBdCumandocEntity();//客商管理档案-供应商 + BdCalbodyEntity bdCalbodyEntity = poOrderSonDto.getBdCalbodyEntity();//收货库存组织 + BdStordocEntity bdStordocEntity = poOrderSonDto.getBdStordocEntity();//收货仓库 - OfsPoOrderData ofsPoOrderData = poOrderSonDto.getOfsPoOrderData();//OFS采购订单 - OfsPoOrderHeader ofsPoOrderDataHeader = ofsPoOrderData.getHeader(); - List ofsPoOrderDataDetails = ofsPoOrderData.getDetails(); + OfsPoOrderData ofsPoOrderData = poOrderSonDto.getOfsPoOrderData();//OFS采购订单 + OfsPoOrderHeader ofsPoOrderDataHeader = ofsPoOrderData.getHeader(); + List ofsPoOrderDataDetails = ofsPoOrderData.getDetails(); - //采购订单表头 - PoOrderParentDto poOrderParentDto = new PoOrderParentDto(); - poOrderParentDto.setCbiztype(bdBusitypeEntity.getPkBusitype());//业务流程 - poOrderParentDto.setCdeptid(bdDeptdocEntity.getPkDeptdoc());//采购部门 - poOrderParentDto.setCoperator("0001A110000000000U3D");//制单人 - poOrderParentDto.setCpurorganization(bdPurorgEntity.getPkPurorg());//采购组织 - poOrderParentDto.setPk_corp(bdCorpEntity.getPkCorp());//采购公司 - poOrderParentDto.setCvendormangid(bdCumandocEntity.getPkCumandoc());//供应商管理档案 - poOrderParentDto.setDauditdate(generateBusinessDate);//审批日期 - poOrderParentDto.setDorderdate(generateBusinessDate);//订单日期 - poOrderParentDto.setDrevisiondate(generateBusinessDate);//修改日期 - //2024年8月21日 13:34:07 对比了手工建单和接口传单,发现接口传单少了这个:是否由销售订单协同生成、补货标志、是否已协同生成销售订单 默认为N - poOrderParentDto.setBsocooptome(false);//是否由销售订单协同生成 - poOrderParentDto.setBisreplenish(false);//补货标志 - poOrderParentDto.setBcooptoso(false);//是否已协同生成销售订单 - poOrderParentDto.setCgiveinvoicevendor(bdCumandocEntity.getPkCumandoc());//发票方id + //采购订单表头 + PoOrderParentDto poOrderParentDto = new PoOrderParentDto(); + poOrderParentDto.setCbiztype(bdBusitypeEntity.getPkBusitype());//业务流程 + poOrderParentDto.setCdeptid(bdDeptdocEntity.getPkDeptdoc());//采购部门 + poOrderParentDto.setCoperator("0001A110000000000U3D");//制单人 + poOrderParentDto.setCpurorganization(bdPurorgEntity.getPkPurorg());//采购组织 + poOrderParentDto.setPk_corp(bdCorpEntity.getPkCorp());//采购公司 + poOrderParentDto.setCvendormangid(bdCumandocEntity.getPkCumandoc());//供应商管理档案 + poOrderParentDto.setDauditdate(generateBusinessDate);//审批日期 + poOrderParentDto.setDorderdate(generateBusinessDate);//订单日期 + poOrderParentDto.setDrevisiondate(generateBusinessDate);//修改日期 + //2024年8月21日 13:34:07 对比了手工建单和接口传单,发现接口传单少了这个:是否由销售订单协同生成、补货标志、是否已协同生成销售订单 默认为N + poOrderParentDto.setBsocooptome(false);//是否由销售订单协同生成 + poOrderParentDto.setBisreplenish(false);//补货标志 + poOrderParentDto.setBcooptoso(false);//是否已协同生成销售订单 + poOrderParentDto.setCgiveinvoicevendor(bdCumandocEntity.getPkCumandoc());//发票方id - poOrderParentDto.setVdef17(ProfilesActiveConstant.sourceSystem1);//来源系统 - poOrderParentDto.setVdef19(poOrderSonDto.getCode());//原单单号 - poOrderParentDto.setVdef20(poOrderSonDto.getId());//原单主键 + poOrderParentDto.setVdef17(ProfilesActiveConstant.sourceSystem1);//来源系统 + poOrderParentDto.setVdef19(poOrderSonDto.getCode());//原单单号 + poOrderParentDto.setVdef20(poOrderSonDto.getId());//原单主键 - //收发类别 - poOrderParentDto.setPk_defdoc3(bdRdclEntity.getPkRdcl()); - poOrderParentDto.setVdef3(bdRdclEntity.getRdname()); + //收发类别 + poOrderParentDto.setPk_defdoc3(bdRdclEntity.getPkRdcl()); + poOrderParentDto.setVdef3(bdRdclEntity.getRdname()); - //采购订单明细行 - List poOrderChildrenDtoList = new ArrayList<>(); + //采购订单明细行 + List poOrderChildrenDtoList = new ArrayList<>(); - for (int j = 0; j < details.size(); j++) { - StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details.get(j); - OfsPoOrderDetails ofsPoOrderDetail = findOfsPoOrderDetail(ofsPoOrderDataDetails, stockinB); + for (int j = 0; j < details.size(); j++) { + StockinOrderSearchResponse.StockinOrder.StockinB stockinB = details.get(j); + OfsPoOrderDetails ofsPoOrderDetail = findOfsPoOrderDetail(ofsPoOrderDataDetails, stockinB); - //TODO 测试 - stockinB.setReceivedQty("1"); - ofsPoOrderDetail.setFulfillAmount("10"); + //TODO 测试 + stockinB.setReceivedQty("1"); + ofsPoOrderDetail.setFulfillAmount("10"); - //2024年8月20日 16:02:21 已经和妮姐、万万确认,采购公司和收货公司目前是一致的,暂时不用区分取数逻辑 - BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(stockinB, bdCorpEntity.getPkCorp()); - String receivedQty = stockinB.getReceivedQty();//实收数量 - String fulfillAmount = ofsPoOrderDetail.getFulfillAmount();//实收累计总金额 + //2024年8月20日 16:02:21 已经和妮姐、万万确认,采购公司和收货公司目前是一致的,暂时不用区分取数逻辑 + BdInvmandocEntity bdInvmandocEntity = queryInventoryMan(stockinB, bdCorpEntity.getPkCorp()); + String receivedQty = stockinB.getReceivedQty();//实收数量 + String fulfillAmount = ofsPoOrderDetail.getFulfillAmount();//实收累计总金额 - //原币含税单价 - BigDecimal noriginalcurprice = null; - try { - noriginalcurprice = new BigDecimal(fulfillAmount).divide(new BigDecimal(receivedQty), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP); - } catch (Exception e) { - logger.error("计算采购入库单原币含税单价失败", e); - Assert.state(false, "计算采购入库单原币含税单价失败 原因:{}", e.getMessage()); + //原币含税单价 + BigDecimal noriginalcurprice = null; + try { + noriginalcurprice = new BigDecimal(fulfillAmount).divide(new BigDecimal(receivedQty), 20, BigDecimal.ROUND_HALF_UP).setScale(4, BigDecimal.ROUND_HALF_UP); + } catch (Exception e) { + logger.error("计算采购入库单原币含税单价失败", e); + Assert.state(false, "计算采购入库单原币含税单价失败 原因:{}", e.getMessage()); + } + + PoOrderChildrenDto poOrderChildrenDto = new PoOrderChildrenDto(); + poOrderChildrenDto.setCmangid(bdInvmandocEntity.getPkInvmandoc());//存货管理id + poOrderChildrenDto.setNordernum(receivedQty);//订货数量 + poOrderChildrenDto.setNorgtaxprice(noriginalcurprice.stripTrailingZeros().toPlainString());//原币含税单价 + poOrderChildrenDto.setPk_arrvcorp(bdCorpEntity.getPkCorp());//收货公司 + poOrderChildrenDto.setPk_arrvstoorg(bdCalbodyEntity.getPkCalbody());//收货库存组织 + poOrderChildrenDto.setCwarehouseid(bdStordocEntity.getPkStordoc());//收货仓库 + poOrderChildrenDto.setPk_reqcorp(bdCorpEntity.getPkCorp());//需求公司 * +// poOrderChildrenDto.setIisreplenish(false);//补货标识 * + poOrderChildrenDto.setCoperator("0001A110000000000U3D");//操作员id +// poOrderChildrenDto.setBreceiveplan(false);//存在到货计划 + poOrderChildrenDtoList.add(poOrderChildrenDto); + + //2024年8月20日 16:00:03 已经和佳妮总确认,计划到货日期,不用进行传递 } - PoOrderChildrenDto poOrderChildrenDto = new PoOrderChildrenDto(); - poOrderChildrenDto.setCmangid(bdInvmandocEntity.getPkInvmandoc());//存货管理id - poOrderChildrenDto.setNordernum(receivedQty);//订货数量 - poOrderChildrenDto.setNorgtaxprice(noriginalcurprice.stripTrailingZeros().toPlainString());//原币含税单价 - poOrderChildrenDto.setPk_arrvcorp(bdCorpEntity.getPkCorp());//收货公司 - poOrderChildrenDto.setPk_arrvstoorg(bdCalbodyEntity.getPkCalbody());//收货库存组织 - poOrderChildrenDto.setCwarehouseid(bdStordocEntity.getPkStordoc());//收货仓库 - poOrderChildrenDto.setPk_reqcorp(bdCorpEntity.getPkCorp());//需求公司 * -// poOrderChildrenDto.setIisreplenish(false);//补货标识 * - poOrderChildrenDto.setCoperator("0001A110000000000U3D");//操作员id -// poOrderChildrenDto.setBreceiveplan(false);//存在到货计划 - poOrderChildrenDtoList.add(poOrderChildrenDto); + List poOrderParentChildrenDtoList = new ArrayList<>(); + PoOrderParentChildrenDto poOrderParentChildrenDto = new PoOrderParentChildrenDto(); + poOrderParentChildrenDto.setParentvo(poOrderParentDto); + poOrderParentChildrenDto.setChildrenvo(poOrderChildrenDtoList); + poOrderParentChildrenDtoList.add(poOrderParentChildrenDto); - //2024年8月20日 16:00:03 已经和佳妮总确认,计划到货日期,不用进行传递 + Map> stringStringMap = new HashMap<>(); + stringStringMap.put("puordervo", poOrderParentChildrenDtoList); + PoOrderHeadBodyDto poOrderHeadBodyDto = sendU8CPoOrder(JSON.toJSONString(stringStringMap)); + + String corderid = null; + String vordercode = null; + PoOrderHeadDto parentvo = poOrderHeadBodyDto.getParentvo(); + List childrenvo = poOrderHeadBodyDto.getChildrenvo(); + if (parentvo != null) { + corderid = parentvo.getCorderid(); + } + if (childrenvo != null) { + vordercode = parentvo.getVordercode(); + } + logger.info("推送U8C代理品牌采购订单采购!U8C采购订单主键:{} U8C采购订单编码:{}", corderid, vordercode); + + // 成功记录日志 + IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); + integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_Y); + integrationTaskLivingDetailsEntity.setRootAppNewData(JSON.toJSONString(poOrderSonDto));//原始数据json + integrationTaskLivingDetailsEntity.setNewTransmitInfo(JSON.toJSONString(poOrderHeadBodyDto));//返回结果 + integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); + integrationTaskLivingDetailsEntity.setBusinessDate(generateBusinessDate); + integrationTaskLivingDetailsEntity.setRootAppPk(poOrderSonDto.getId()); + integrationTaskLivingDetailsEntity.setRootAppBill(poOrderSonDto.getCode()); + integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); + saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); + } catch (Exception e) { + logger.error("推送U8C代理品牌采购订单采购失败", e); + + // 失败记录日志 + String message = e.getMessage(); + if (message == null) { + message = "未知错误"; + } + IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); + integrationTaskLivingDetailsEntity.setNewState(ProfilesActiveConstant.LOG_STATUS_N); + integrationTaskLivingDetailsEntity.setRootAppNewData(JSON.toJSONString(poOrderSonDto));//原始数据json + integrationTaskLivingDetailsEntity.setNewTransmitInfo(JSON.toJSONString(message));//返回结果 + integrationTaskLivingDetailsEntity.setNewPushDate(new Date()); + integrationTaskLivingDetailsEntity.setBusinessDate(generateBusinessDate); + integrationTaskLivingDetailsEntity.setRootAppPk(poOrderSonDto.getId()); + integrationTaskLivingDetailsEntity.setRootAppBill(poOrderSonDto.getCode()); + integrationTaskLivingDetailsEntity.setPluginId(getPluginId()); + saveOrUpdateBusinessLogUtil.saveOrUpdate(integrationTaskLivingDetailsEntity); } - - List poOrderParentChildrenDtoList = new ArrayList<>(); - PoOrderParentChildrenDto poOrderParentChildrenDto = new PoOrderParentChildrenDto(); - poOrderParentChildrenDto.setParentvo(poOrderParentDto); - poOrderParentChildrenDto.setChildrenvo(poOrderChildrenDtoList); - poOrderParentChildrenDtoList.add(poOrderParentChildrenDto); - - Map> stringStringMap = new HashMap<>(); - stringStringMap.put("puordervo", poOrderParentChildrenDtoList); - PoOrderHeadBodyDto poOrderHeadBodyDto = sendU8CPoOrder(JSON.toJSONString(stringStringMap)); - - String corderid = null; - String vordercode = null; - PoOrderHeadDto parentvo = poOrderHeadBodyDto.getParentvo(); - List childrenvo = poOrderHeadBodyDto.getChildrenvo(); - if (parentvo != null) { - corderid = parentvo.getCorderid(); - } - if (childrenvo != null) { - vordercode = parentvo.getVordercode(); - } - logger.info("推送U8C代理品牌采购订单采购!U8C采购订单主键:{} U8C采购订单编码:{}", corderid, vordercode); } } else { logger.info("poOrderSonDto.size为0!"); diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java index 6b035f03..b7b3626c 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleOutPluginInitializerToB.java @@ -69,7 +69,7 @@ public class SoSaleOutPluginInitializerToB extends PluginBaseEntity { @Override public String getPluginId() { - return "com.hzya.frame.plugin.lets.plugin.sales.SoSaleOutPluginInitializerToB"; + return "sales.SoSaleOutPluginInitializerToB"; } @Override 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 f55292a3..deaf06c1 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 @@ -60,7 +60,7 @@ public class SoSaleOutPluginInitializerToC extends PluginBaseEntity { @Override public String getPluginId() { - return "com.hzya.frame.plugin.sowow.plugin.sales.SoSaleOutPluginInitializerToC"; + return "sales.SoSaleOutPluginInitializerToC"; } @Override diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToB.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToB.java index 783385a6..f2981a07 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToB.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToB.java @@ -70,7 +70,7 @@ public class SoSaleReturnPluginInitializerToB extends PluginBaseEntity { @Override public String getPluginId() { - return "com.hzya.frame.plugin.lets.plugin.sales.SoSaleReturnPluginInitializerToB"; + return "sales.SoSaleReturnPluginInitializerToB"; } @Override diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java index 27752ab1..829ca9a6 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/sales/SoSaleReturnPluginInitializerToC.java @@ -55,7 +55,7 @@ public class SoSaleReturnPluginInitializerToC extends PluginBaseEntity { @Override public String getPluginId() { - return "com.hzya.frame.plugin.lets.plugin.sales.SoSaleReturnPluginInitializerToC"; + return "sales.SoSaleReturnPluginInitializerToC"; } @Override diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/transfer/TransferInPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/transfer/TransferInPluginInitializer.java index 76b80e79..71ab7f9e 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/transfer/TransferInPluginInitializer.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/transfer/TransferInPluginInitializer.java @@ -64,7 +64,7 @@ public class TransferInPluginInitializer extends PluginBaseEntity { @Override public String getPluginId() { - return "com.hzya.frame.plugin.lets.plugin.transfer.TransferInPluginInitializer"; + return "transfer.TransferInPluginInitializer"; } @Override @@ -360,7 +360,7 @@ public class TransferInPluginInitializer extends PluginBaseEntity { //两层判断,一层中台转发,一层u8c返回 if ("false".equals(ztResult.getFlag())) { //转发失败 - response=JSONUtil.toJsonStr(ztResult.getAttribute()); + response = JSONUtil.toJsonStr(ztResult.getAttribute()); Assert.state(false, "丽知:OFS调拨入库订单--->U8C调拨入库订单.中台转发失败,失败原因:{}", response); } Attribute attribute = ztResult.getAttribute(); @@ -469,7 +469,7 @@ public class TransferInPluginInitializer extends PluginBaseEntity { all.addAll(stockinOrderSearchResponse1.getData()); - count=stockinOrderSearchResponse1.getData().size(); + count = stockinOrderSearchResponse1.getData().size(); } return all; diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/transfer/TransferOutPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/transfer/TransferOutPluginInitializer.java index 7f3e412e..5b9afd21 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/transfer/TransferOutPluginInitializer.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/plugin/transfer/TransferOutPluginInitializer.java @@ -64,7 +64,7 @@ public class TransferOutPluginInitializer extends PluginBaseEntity { @Override public String getPluginId() { - return "com.hzya.frame.plugin.lets.plugin.transfer.TransferOutPluginInitializer"; + return "transfer.TransferOutPluginInitializer"; } @Override @@ -149,12 +149,12 @@ public class TransferOutPluginInitializer extends PluginBaseEntity { queryOfsStockoutOrderRequestVO.setClosedAt_end(endTimeStr); queryOfsStockoutOrderRequestVO.setStatus("900");//状态 500待同步 510已同步 700收货中 900入库完成 911作废 100订单池 200暂挂 400待合单 410待出库单出库 List transferOutOrder = queryOfsStockoutOrder(queryOfsStockoutOrderRequestVO); - if(transferOutOrder.size()==0){ + if (transferOutOrder.size() == 0) { return; } //过滤成功日志 List filterTransferOutOrders = filterData(transferOutOrder); - if(filterTransferOutOrders.size()==0){ + if (filterTransferOutOrders.size() == 0) { return; } //推送U8C @@ -173,12 +173,12 @@ public class TransferOutPluginInitializer extends PluginBaseEntity { queryOfsStockoutOrderRequestVO.setCode(stockoutNo); queryOfsStockoutOrderRequestVO.setStatus("900");//状态 500待同步 510已同步 700收货中 900入库完成 911作废 100订单池 200暂挂 400待合单 410待出库单出库 List transferOutOrder = queryOfsStockoutOrder(queryOfsStockoutOrderRequestVO); - if(transferOutOrder.size()==0){ + if (transferOutOrder.size() == 0) { Assert.state(false, "丽知:OFS调拨出库订单[出库完成]--->U8C调拨订单,自动生成调拨出库单(保存签字),未查询到调拨出库单:{}", stockoutNo); } //过滤成功日志 List filterTransferOutOrders = filterData(transferOutOrder); - if(filterTransferOutOrders.size()==0){ + if (filterTransferOutOrders.size() == 0) { Assert.state(false, "丽知:OFS调拨出库订单[出库完成]--->U8C调拨订单,自动生成调拨出库单(保存签字),该调拨出库单:{},已被推送成功,请勿重新推送", stockoutNo); } //推送U8C @@ -205,12 +205,12 @@ public class TransferOutPluginInitializer extends PluginBaseEntity { queryOfsStockoutOrderRequestVO.setStatus("900");//状态 500待同步 510已同步 700收货中 900入库完成 911作废 100订单池 200暂挂 400待合单 410待出库单出库 List transferOutOrder = queryOfsStockoutOrder(queryOfsStockoutOrderRequestVO); - if(transferOutOrder.size()==0){ + if (transferOutOrder.size() == 0) { Assert.state(false, "丽知:OFS调拨出库订单--->U8C调拨订单,自动生成调拨出库单(保存签字)根据日期期间[开始时间]-[结束时间]:{}-{},未查询到调拨出库单[出库完成]", startTime, endTime); } //过滤成功日志 List filterTransferOutOrders = filterData(transferOutOrder); - if(filterTransferOutOrders.size()==0){ + if (filterTransferOutOrders.size() == 0) { Assert.state(false, "丽知:OFS调拨出库订单--->U8C调拨订单,自动生成调拨出库单(保存签字)根据日期期间[开始时间]-[结束时间]:{}-{},该调期调拨出库单[出库完成]已被推送成功,请勿重新推送", startTime, endTime); } //推送U8C @@ -342,7 +342,7 @@ public class TransferOutPluginInitializer extends PluginBaseEntity { //两层判断,一层中台转发,一层u8c返回 if ("false".equals(ztResult.getFlag())) { //转发失败 - response=JSONUtil.toJsonStr(ztResult.getAttribute()); + response = JSONUtil.toJsonStr(ztResult.getAttribute()); Assert.state(false, "丽知:OFS调拨出库订单--->U8C调拨订单,自动生成调拨出库单(保存签字).中台转发失败,失败原因:{}", ztResult.getAttribute()); } Attribute attribute = ztResult.getAttribute(); @@ -379,11 +379,11 @@ public class TransferOutPluginInitializer extends PluginBaseEntity { //失败 ReusltStrDto reusltStrDto = JSON.parseObject(response, ReusltStrDto.class); - String ErrMessage=null; + String ErrMessage = null; if (reusltStrDto != null) { ErrMessage = "推送U8C,丽知:OFS调整出库--->U8C其它出库失败,失败原因:" + reusltStrDto.getErrormsg(); - }else { - ErrMessage=e.getMessage(); + } else { + ErrMessage = e.getMessage(); } IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity = new IntegrationTaskLivingDetailsEntity(); @@ -439,7 +439,7 @@ public class TransferOutPluginInitializer extends PluginBaseEntity { StockoutOrderSearchResponse stockoutOrderSearchResponse1 = SaleOutReturnMessageDto2StockoutOrderSearchResponse(saleOutReturnMessageDto1); all.addAll(stockoutOrderSearchResponse1.getData()); - count=stockoutOrderSearchResponse1.getData().size(); + count = stockoutOrderSearchResponse1.getData().size(); } return all; diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/ConsignmachiningInSonDto.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/ConsignmachiningInSonDto.java index 267ca0a3..7dcbb4f2 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/ConsignmachiningInSonDto.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/u8cdto/ConsignmachiningInSonDto.java @@ -57,4 +57,19 @@ public class ConsignmachiningInSonDto extends StockinOrderSearchResponse.Stockin * U8C委外订单明细行 */ private List scOrderBEntityList; + + /** + * 采购组织 + */ + private BdPurorgEntity bdPurorgEntity; + + /** + * 客商基本档案 + */ + private BdCubasdocEntity bdCubasdocEntity; + + /** + * 客商管理档案 + */ + private BdCumandocEntity bdCumandocEntity; } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/SaveOrUpdateBusinessLogUtil.java b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/SaveOrUpdateBusinessLogUtil.java index 3f300269..78032bc2 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/SaveOrUpdateBusinessLogUtil.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/lets/util/SaveOrUpdateBusinessLogUtil.java @@ -5,20 +5,32 @@ import cn.hutool.core.lang.Assert; import com.hzya.frame.sysnew.integtationTaskLivingDetails.dao.IIntegrationTaskLivingDetailsDao; import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity; import com.hzya.frame.uuid.UUIDLong; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.List; -//保存或者更新业务日志 - +/** + * 保存或者更新业务日志 + */ @Component public class SaveOrUpdateBusinessLogUtil { + Logger logger = LoggerFactory.getLogger(SaveOrUpdateBusinessLogUtil.class); + @Autowired private IIntegrationTaskLivingDetailsDao iIntegrationTaskLivingDetailsDao; + private static final Object insertOrUpdateLock = new Object(); + private static final Object queryDetailsLock = new Object(); + + private static final String successY = "Y"; + + private static final String failN = "N"; + /** * 保存或者更新 * @@ -29,29 +41,37 @@ public class SaveOrUpdateBusinessLogUtil { Assert.notNull(integrationTaskLivingDetailsEntity.getRootAppPk(), "源系统单号不能为空"); Assert.notNull(integrationTaskLivingDetailsEntity.getPluginId(), "场景id不能为空"); - IntegrationTaskLivingDetailsEntity integrationTaskLivingDetails = null; - IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity1 = new IntegrationTaskLivingDetailsEntity(); - integrationTaskLivingDetailsEntity1.setRootAppPk(integrationTaskLivingDetailsEntity.getRootAppPk()); - integrationTaskLivingDetailsEntity1.setPluginId(integrationTaskLivingDetailsEntity.getPluginId()); - List integrationTaskLivingDetailsEntities = iIntegrationTaskLivingDetailsDao.query(integrationTaskLivingDetailsEntity1); - if (integrationTaskLivingDetailsEntities != null && integrationTaskLivingDetailsEntities.size() > 0) { - integrationTaskLivingDetails = integrationTaskLivingDetailsEntities.get(0); - } - if (integrationTaskLivingDetails != null) { - //存在 - synchronized (insertOrUpdateLock) { - integrationTaskLivingDetailsEntity.setId(integrationTaskLivingDetails.getId()); - updateSuccessMessage(integrationTaskLivingDetailsEntity); -// iIntegrationTaskLivingDetailsDao.update("com.hzya.frame.sysnew.integtationTaskLivingDetails.dao.impl.IntegrationTaskLivingDetailsDaoImpl.entity_updatebyid", integrationTaskLivingDetailsEntity); - iIntegrationTaskLivingDetailsDao.update(integrationTaskLivingDetailsEntity); + try { + IntegrationTaskLivingDetailsEntity integrationTaskLivingDetails = null; + synchronized (queryDetailsLock) { + IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity1 = new IntegrationTaskLivingDetailsEntity(); + integrationTaskLivingDetailsEntity1.setRootAppPk(integrationTaskLivingDetailsEntity.getRootAppPk()); + integrationTaskLivingDetailsEntity1.setPluginId(integrationTaskLivingDetailsEntity.getPluginId()); + List integrationTaskLivingDetailsEntities = iIntegrationTaskLivingDetailsDao.query(integrationTaskLivingDetailsEntity1); + if (integrationTaskLivingDetailsEntities != null && integrationTaskLivingDetailsEntities.size() > 0) { + integrationTaskLivingDetails = integrationTaskLivingDetailsEntities.get(0); + } } - } else { - //不存在 - Long uuid = UUIDLong.longUUID(); - integrationTaskLivingDetailsEntity.setId(String.valueOf(uuid)); - updateSuccessMessage(integrationTaskLivingDetailsEntity); - IntegrationTaskLivingDetailsEntity save = iIntegrationTaskLivingDetailsDao.save(integrationTaskLivingDetailsEntity); - System.out.println("save = " + save); + if (integrationTaskLivingDetails != null) { + //存在 + synchronized (insertOrUpdateLock) { + integrationTaskLivingDetailsEntity.setId(integrationTaskLivingDetails.getId()); + updateSuccessMessage(integrationTaskLivingDetailsEntity); +// iIntegrationTaskLivingDetailsDao.update("com.hzya.frame.sysnew.integtationTaskLivingDetails.dao.impl.IntegrationTaskLivingDetailsDaoImpl.entity_updatebyid", integrationTaskLivingDetailsEntity); + iIntegrationTaskLivingDetailsDao.update(integrationTaskLivingDetailsEntity); + } + } else { + //不存在 + Long uuid = UUIDLong.longUUID(); + integrationTaskLivingDetailsEntity.setId(String.valueOf(uuid)); + updateSuccessMessage(integrationTaskLivingDetailsEntity); + IntegrationTaskLivingDetailsEntity save = iIntegrationTaskLivingDetailsDao.save(integrationTaskLivingDetailsEntity); +// System.out.println("save = " + save); + logger.info("integration_task_living_details->日志保存成功,主键:{}", save.getId()); + } + } catch (Exception e) { + logger.error("SaveOrUpdateBusinessLogUtil对应的saveOrUpdate方法抛出异常,日志详情保存失败!", e); + //2024年9月3日 10:26:45 如果这里往上抛出异常,没有功能搭配处理 } } @@ -62,14 +82,30 @@ public class SaveOrUpdateBusinessLogUtil { */ private void updateSuccessMessage(IntegrationTaskLivingDetailsEntity integrationTaskLivingDetailsEntity) { if (integrationTaskLivingDetailsEntity != null) { - if ("Y".equals(integrationTaskLivingDetailsEntity.getNewState())) { + if (successY.equals(integrationTaskLivingDetailsEntity.getNewState())) { //成功 - integrationTaskLivingDetailsEntity.setRootAppNewData("success"); - integrationTaskLivingDetailsEntity.setNewTransmitInfo("success"); + String successIdentification = "success"; + integrationTaskLivingDetailsEntity.setRootAppNewData(successIdentification); + integrationTaskLivingDetailsEntity.setNewTransmitInfo(successIdentification); /** * integrationTaskLivingDetailsEntity.setRoot_app_new_data(JSON.toJSONString(searchPurchaseReceiptOrder)); * integrationTaskLivingDetailsEntity.setNew_transmit_info(cgrkApi); */ + } else if (failN.equals(integrationTaskLivingDetailsEntity.getNewState())) { + //2024年9月2日 17:09:07 如果失败,仅保留500个字符,用于平衡数据库性能 + //2024年9月2日 17:15:19 如果该单据判断为失败,则integration_task_living_details表的root_app_new_data、new_transmit_info字段,仅保留500个长度的字符,用于平衡性能,速网、珍视名项目这一块性能很差 + String rootAppNewData = null; + if (integrationTaskLivingDetailsEntity.getRootAppNewData() != null) { + rootAppNewData = integrationTaskLivingDetailsEntity.getRootAppNewData().substring(0, 500); + } + String newTransmitInfo = null; + if (integrationTaskLivingDetailsEntity.getNewTransmitInfo() != null) { + newTransmitInfo = integrationTaskLivingDetailsEntity.getNewTransmitInfo().substring(0, 500); + } + integrationTaskLivingDetailsEntity.setRootAppNewData(rootAppNewData); + integrationTaskLivingDetailsEntity.setNewTransmitInfo(newTransmitInfo); + } else { + Assert.state(false, "不合法的newState,不能为空请传递Y或者N!"); } } } diff --git a/buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-lets-dao.xml b/buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-lets-dao.xml index 66571184..9811a987 100644 --- a/buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-lets-dao.xml +++ b/buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-lets-dao.xml @@ -51,4 +51,6 @@ + + \ No newline at end of file diff --git a/buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-lets-plugin.xml b/buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-lets-plugin.xml index f2ca1556..9aa0f6d4 100644 --- a/buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-lets-plugin.xml +++ b/buildpackage/src/main/resources/cfgHome/plugin/lets/spring/spring-lets-plugin.xml @@ -27,7 +27,7 @@ - +