|
@@ -1346,12 +1346,12 @@
|
|
|
|
|
|
|
|
<select id="queryTradeSum" parameterType="com.muchinfo.mtp3pojos.vo.query.tradesum.TradeSumQueryParam"
|
|
<select id="queryTradeSum" parameterType="com.muchinfo.mtp3pojos.vo.query.tradesum.TradeSumQueryParam"
|
|
|
resultType="com.muchinfo.mtp3pojos.vo.query.tradesum.TradeSumQueryResult">
|
|
resultType="com.muchinfo.mtp3pojos.vo.query.tradesum.TradeSumQueryResult">
|
|
|
- SELECT T.tradedate,
|
|
|
|
|
- T.ACCOUNTID,
|
|
|
|
|
|
|
+ SELECT t.tradedate,
|
|
|
|
|
+ t.ACCOUNTID,
|
|
|
t.tradetype,
|
|
t.tradetype,
|
|
|
ua.userid,
|
|
ua.userid,
|
|
|
vlo.LOGINIDS as loginid,
|
|
vlo.LOGINIDS as loginid,
|
|
|
- T.GOODSID,
|
|
|
|
|
|
|
+ t.GOODSID,
|
|
|
t.buyorsell,
|
|
t.buyorsell,
|
|
|
sum(t.tradeqty) as tradeqty,
|
|
sum(t.tradeqty) as tradeqty,
|
|
|
sum(t.tradeamount) as tradeamount,
|
|
sum(t.tradeamount) as tradeamount,
|
|
@@ -1367,7 +1367,7 @@
|
|
|
g.goodscode,
|
|
g.goodscode,
|
|
|
g.goodsname,
|
|
g.goodsname,
|
|
|
en.enumdicname as buyorselldisplay
|
|
en.enumdicname as buyorselldisplay
|
|
|
- FROM his_trade_tradedetail T
|
|
|
|
|
|
|
+ FROM his_trade_tradedetail t
|
|
|
left join goods g
|
|
left join goods g
|
|
|
on g.goodsid = t.goodsid
|
|
on g.goodsid = t.goodsid
|
|
|
left join taaccount ta
|
|
left join taaccount ta
|
|
@@ -1399,9 +1399,9 @@
|
|
|
and vlo.LOGINIDS = #{vo.loginid}
|
|
and vlo.LOGINIDS = #{vo.loginid}
|
|
|
</if>
|
|
</if>
|
|
|
</where>
|
|
</where>
|
|
|
- group by T.tradedate,
|
|
|
|
|
- T.ACCOUNTID,
|
|
|
|
|
- T.GOODSID,
|
|
|
|
|
|
|
+ group by t.tradedate,
|
|
|
|
|
+ t.ACCOUNTID,
|
|
|
|
|
+ t.GOODSID,
|
|
|
t.tradetype,
|
|
t.tradetype,
|
|
|
ua.userid,
|
|
ua.userid,
|
|
|
t.buyorsell,
|
|
t.buyorsell,
|
|
@@ -1423,21 +1423,20 @@
|
|
|
d.histradedate,
|
|
d.histradedate,
|
|
|
</when>
|
|
</when>
|
|
|
</choose>
|
|
</choose>
|
|
|
- d.deliveryorderid, d.deliveryticket, d.accountid,u.accountname,d.matchaccountid,
|
|
|
|
|
|
|
+ d.deliveryorderid, d.deliveryticket, d.accountid,d.matchaccountid,
|
|
|
d.xgoodsid, d.xdeliveryqty, d.pgoodsid,
|
|
d.xgoodsid, d.xdeliveryqty, d.pgoodsid,
|
|
|
d.pdeliveryqty, d.deliverygoodsid, d.deliveryqty,
|
|
d.pdeliveryqty, d.deliverygoodsid, d.deliveryqty,
|
|
|
d.deliveryorderstatus, d.ordertime,
|
|
d.deliveryorderstatus, d.ordertime,
|
|
|
g1.goodsname as xgoodsname,
|
|
g1.goodsname as xgoodsname,
|
|
|
g2.goodsname as pgoodsname,
|
|
g2.goodsname as pgoodsname,
|
|
|
- dg.deliverygoodsname,
|
|
|
|
|
- wr.wrstandardid, wr.wrstandardcode, wr.wrstandardname, dic.enumdicname unitname,
|
|
|
|
|
- lo.loginids as loginid
|
|
|
|
|
|
|
+ wr.wrstandardid, wr.wrstandardcode+'/' + wr.wrstandardname as deliverygoodsname, dic.enumdicname unitname,
|
|
|
|
|
+ lo.loginids + '/'+ u.accountname as accountidname
|
|
|
<choose>
|
|
<choose>
|
|
|
<when test="vo.ishis == null or vo.ishis == 0">
|
|
<when test="vo.ishis == null or vo.ishis == 0">
|
|
|
- from HIS_DELIVERYORDER t
|
|
|
|
|
|
|
+ from HIS_DELIVERYORDER d
|
|
|
</when>
|
|
</when>
|
|
|
<when test="vo.ishis == 1">
|
|
<when test="vo.ishis == 1">
|
|
|
- from Deliveryorder t
|
|
|
|
|
|
|
+ from Deliveryorder d
|
|
|
</when>
|
|
</when>
|
|
|
</choose>
|
|
</choose>
|
|
|
left join goods g1
|
|
left join goods g1
|
|
@@ -1521,10 +1520,10 @@
|
|
|
dgp5.pricemovedesc as deliverymonthname
|
|
dgp5.pricemovedesc as deliverymonthname
|
|
|
<choose>
|
|
<choose>
|
|
|
<when test="histradedate != null and histradedate != ''">
|
|
<when test="histradedate != null and histradedate != ''">
|
|
|
- from HIS_DELIVERYORDER t
|
|
|
|
|
|
|
+ from HIS_DELIVERYORDER d
|
|
|
</when>
|
|
</when>
|
|
|
<otherwise>
|
|
<otherwise>
|
|
|
- from Deliveryorder t
|
|
|
|
|
|
|
+ from Deliveryorder d
|
|
|
</otherwise>
|
|
</otherwise>
|
|
|
</choose>
|
|
</choose>
|
|
|
left join goods g1
|
|
left join goods g1
|
|
@@ -1564,4 +1563,434 @@
|
|
|
</if>
|
|
</if>
|
|
|
</where>
|
|
</where>
|
|
|
</select>
|
|
</select>
|
|
|
|
|
+
|
|
|
|
|
+ <select id="querySettlementDeal"
|
|
|
|
|
+ parameterType="com.muchinfo.mtp3pojos.vo.query.deliveryorder.SettlementDealParam"
|
|
|
|
|
+ resultType="com.muchinfo.mtp3pojos.vo.query.deliveryorder.SettlementDealResult">
|
|
|
|
|
+ select
|
|
|
|
|
+ <choose>
|
|
|
|
|
+ <when test="vo.ishis == 1">
|
|
|
|
|
+ a.histradedate,
|
|
|
|
|
+ </when>
|
|
|
|
|
+ </choose>
|
|
|
|
|
+ a.deliveryid,a.buyorsell,
|
|
|
|
|
+ to_char(to_date(a.tradedate,'yyyy-MM-dd'),'yyyy-MM-dd') as tradedate,
|
|
|
|
|
+ a.deliveryorderid,a.accountid,
|
|
|
|
|
+ a.matchaccountid,a.xgoodsid,b.goodsname as x_goodsname,a.pgoodsid,
|
|
|
|
|
+ c.goodsname as p_goodsname,a.deliverygoodsid,
|
|
|
|
|
+ a.deliveryqty,a.deliveryprice,a.deliveryamount,a.deliverypricemove,
|
|
|
|
|
+ a.deliverycharge,a.buydeliveryapplyorderid,a.selldeliveryapplyorderid,
|
|
|
|
|
+ wr.wrstandardid, wr.wrstandardcode + '/' + wr.wrstandardname as deliverygoodsname, dic.enumdicname unitname,
|
|
|
|
|
+ lo1.loginids as loginid, lo2.loginids as matchloginid
|
|
|
|
|
+ <choose>
|
|
|
|
|
+ <when test="vo.ishis == 1">
|
|
|
|
|
+ from HIS_Deliverydetail a
|
|
|
|
|
+ </when>
|
|
|
|
|
+ <otherwise>
|
|
|
|
|
+ from Deliverydetail a
|
|
|
|
|
+ </otherwise>
|
|
|
|
|
+ </choose>
|
|
|
|
|
+ left join goods b on a.xgoodsid =b.goodsid
|
|
|
|
|
+ left join goods c on a.pgoodsid =c.goodsid
|
|
|
|
|
+ left join deliverygoods d on a.deliverygoodsid = d.deliverygoodsid
|
|
|
|
|
+ left join wrfactortype wft on a.wrfactortypeid = wft.wrfactortypeid
|
|
|
|
|
+ left join wrstandard wr on wft.wrstandardid = wr.wrstandardid
|
|
|
|
|
+ left join enumdicitem dic on wr.unitid=dic.enumitemname and dic.enumdiccode = 'goodsunit'
|
|
|
|
|
+ left join taaccount ta1 on ta1.accountid = a.accountid
|
|
|
|
|
+ left join VIEW_USER_LOGINIDS lo1 on ta1.userid = lo1.userid
|
|
|
|
|
+ left join taaccount ta2 on ta2.accountid = a.matchaccountid
|
|
|
|
|
+ left join VIEW_USER_LOGINIDS lo2 on ta2.userid = lo2.userid
|
|
|
|
|
+ <where>
|
|
|
|
|
+ a.deliverystatus in (2,4) and a.isvaliddata = 1
|
|
|
|
|
+ <choose>
|
|
|
|
|
+ <when test="vo.ishis == 1">
|
|
|
|
|
+ and a.mainorderflag = 1
|
|
|
|
|
+ </when>
|
|
|
|
|
+ <otherwise>
|
|
|
|
|
+ <if test="vo.mainorderflag != null">
|
|
|
|
|
+ and a.mainorderflag = #{vo.mainorderflag}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </otherwise>
|
|
|
|
|
+ </choose>
|
|
|
|
|
+ <if test="vo.deliveryid != null and vo.deliveryid != '' ">
|
|
|
|
|
+ and a.deliveryid like '%'||#{vo.deliveryid}||'%'
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.xgoodsid != null and vo.xgoodsid != '' ">
|
|
|
|
|
+ and a.xgoodsid = #{vo.xgoodsid}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.tradedate != null and vo.tradedate != '' ">
|
|
|
|
|
+ and a.tradedate= #{vo.tradedate}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.deliveryorderid != null and vo.deliveryorderid != '' ">
|
|
|
|
|
+ and (a.deliveryorderid like '%'||#{vo.deliveryorderid}||'%'
|
|
|
|
|
+ or a.buydeliveryapplyorderid like '%'||#{vo.deliveryorderid}||'%'
|
|
|
|
|
+ or a.selldeliveryapplyorderid like '%'||#{vo.deliveryorderid}||'%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.wrstandardid != null">
|
|
|
|
|
+ and wr.wrstandardid = #{vo.wrstandardid}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.accountid != null and vo.accountid != '' ">
|
|
|
|
|
+ and (a.accountid = #{vo.accountid} or a.matchaccountid = #{vo.accountid})
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.startdate != null and vo.startdate != '' and vo.enddate != null and vo.enddate != '' ">
|
|
|
|
|
+ and to_date(a.histradedate,'yyyyMMdd') between to_date(#{vo.startdate},'yyyy-MM-dd')
|
|
|
|
|
+ and to_date(#{vo.enddate},'yyyy-MM-dd')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.userid != null">
|
|
|
|
|
+ and ((a.accountid in (select ab.accountid from taaccount ab where ab.userid=#{vo.userid}))
|
|
|
|
|
+ or(a.matchaccountid in (select ab.accountid from taaccount ab where ab.userid=#{vo.userid})))
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="vo.buyorsell != null">
|
|
|
|
|
+ and a.buyorsell = #{vo.buyorsell,jdbcType=DECIMAL}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </where>
|
|
|
|
|
+ order by a.histradedate desc, a.deliveryid desc
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ <select id="settlementDealDetail" resultType="com.muchinfo.mtp3pojos.vo.query.deliveryorder.SettlementDealDetailResult"
|
|
|
|
|
+ parameterType="com.muchinfo.mtp3pojos.vo.query.deliveryorder.SettlementDealDetailParam">
|
|
|
|
|
+ select
|
|
|
|
|
+ a.deliveryid,
|
|
|
|
|
+ a.buyorsell,
|
|
|
|
|
+ <choose>
|
|
|
|
|
+ <when test="histradedate != null and histradedate != ''">
|
|
|
|
|
+ to_char(to_date(a.histradedate,'yyyy-MM-dd'),'yyyy-MM-dd') as histradedate,
|
|
|
|
|
+ </when>
|
|
|
|
|
+ </choose>
|
|
|
|
|
+ to_char(to_date(a.tradedate,'yyyy-MM-dd'),'yyyy-MM-dd') as tradedate,
|
|
|
|
|
+ a.deliveryorderid,
|
|
|
|
|
+ a.accountid,
|
|
|
|
|
+ a.matchaccountid,
|
|
|
|
|
+ a.xgoodsid, g1.goodsname as x_goodsname,a.xdeliverycloseqty,a.xdeliveryprice,
|
|
|
|
|
+ a.pgoodsid, a.ppricemode, g2.goodsname as p_goodsname,a.pdeliverycloseqty,a.pdeliveryprice,
|
|
|
|
|
+ a.p2goodsid, a.p2pricemode, g3.goodsname as p2goodsname,a.p2deliverycloseqty,a.p2deliveryprice,
|
|
|
|
|
+ a.deliverygoodsid,d.deliverygoodsname,
|
|
|
|
|
+ a.deliverytime,
|
|
|
|
|
+ a.deliveryqty,
|
|
|
|
|
+ a.deliveryrtradeqty,
|
|
|
|
|
+ a.deliveryamount,
|
|
|
|
|
+ a.deliverypricemove,
|
|
|
|
|
+ a.deliverytotalamount,
|
|
|
|
|
+ a.deliveryprice,
|
|
|
|
|
+ a.deliverycharge,
|
|
|
|
|
+ a.remaintotalamount,
|
|
|
|
|
+ a.closeflag,
|
|
|
|
|
+ a.deliverystatus,
|
|
|
|
|
+ a.handlestatus,
|
|
|
|
|
+ a.mainorderflag,
|
|
|
|
|
+ a.relatedwrid,
|
|
|
|
|
+ a.feealgorithm,
|
|
|
|
|
+ a.memberchargevalue,
|
|
|
|
|
+ a.exchchargevalue,
|
|
|
|
|
+ a.buydeliveryapplyorderid,
|
|
|
|
|
+ a.selldeliveryapplyorderid,
|
|
|
|
|
+ a.marginalgorithm,
|
|
|
|
|
+ a.marginvalue,
|
|
|
|
|
+ a.freezemargin,
|
|
|
|
|
+ a.takemode,
|
|
|
|
|
+ a.receiveraddress,
|
|
|
|
|
+ e.enumdicname as deliverygoodsunitname
|
|
|
|
|
+ <choose>
|
|
|
|
|
+ <when test="histradedate != null and histradedate != ''">
|
|
|
|
|
+ dgp1.pricemovedesc as brandname ,
|
|
|
|
|
+ dgp2.pricemovedesc as specname ,
|
|
|
|
|
+ dgp3.pricemovedesc as qualityname ,
|
|
|
|
|
+ dgp4.pricemovedesc as warehousename ,
|
|
|
|
|
+ dgp5.pricemovedesc as deliverymonthname,
|
|
|
|
|
+ a.wrfactortypeid
|
|
|
|
|
+ from his_Deliverydetail a
|
|
|
|
|
+ left join goods g1 on a.xgoodsid =g1.goodsid
|
|
|
|
|
+ left join goods g2 on a.pgoodsid =g2.goodsid
|
|
|
|
|
+ left join goods g3 on a.p2goodsid =g3.goodsid
|
|
|
|
|
+ left join deliverygoods d on a.deliverygoodsid = d.deliverygoodsid
|
|
|
|
|
+ left join ENUMDICITEM e on e.enumdiccode = 'goodsunit' and e.enumitemname = d.goodsunitid
|
|
|
|
|
+ left join deliverygoodspricemove dgp1 on dgp1.autoid = a.brandid
|
|
|
|
|
+ left join deliverygoodspricemove dgp2 on dgp2.autoid = a.specid
|
|
|
|
|
+ left join deliverygoodspricemove dgp3 on dgp3.autoid = a.qualityid
|
|
|
|
|
+ left join deliverygoodspricemove dgp4 on dgp4.autoid = a.warehouseid
|
|
|
|
|
+ left join deliverygoodspricemove dgp5 on dgp5.autoid = a.deliverymonthid
|
|
|
|
|
+ </when>
|
|
|
|
|
+ <otherwise>
|
|
|
|
|
+ wft.warehouseid,
|
|
|
|
|
+ wi.warehousename as warehousename,
|
|
|
|
|
+ a.wrfactortypeid,
|
|
|
|
|
+ wr.wrstandardcode,
|
|
|
|
|
+ wr.wrstandardname
|
|
|
|
|
+ from Deliverydetail a
|
|
|
|
|
+ left join goods g1 on a.xgoodsid =g1.goodsid
|
|
|
|
|
+ left join goods g2 on a.pgoodsid =g2.goodsid
|
|
|
|
|
+ left join goods g3 on a.p2goodsid =g3.goodsid
|
|
|
|
|
+ left join deliverygoods d on a.deliverygoodsid = d.deliverygoodsid
|
|
|
|
|
+ left join ENUMDICITEM e on e.enumdiccode = 'goodsunit' and e.enumitemname = d.goodsunitid
|
|
|
|
|
+ left join wrfactortype wft on a.wrfactortypeid = wft.wrfactortypeid
|
|
|
|
|
+ left join wrstandard wr on wr.wrstandardid = wft.wrstandardid
|
|
|
|
|
+ left join warehouseinfo wi on wft.warehouseid = wi.autoid
|
|
|
|
|
+ </otherwise>
|
|
|
|
|
+ </choose>
|
|
|
|
|
+ <where>
|
|
|
|
|
+ a.deliveryid = #{deliveryid, jdbcType=DECIMAL}
|
|
|
|
|
+ and a.buyorsell=#{buyorsell, jdbcType=INTEGER}
|
|
|
|
|
+ <if test="vo.histradedate != null">
|
|
|
|
|
+ and a.histradedate = #{histradedate}
|
|
|
|
|
+ and a.isvaliddata = 1
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </where>
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <select id="applyOrderDetailHis" resultType="com.muchinfo.mtp3pojos.vo.query.deliveryorder.ApplyOrderDetailResult">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ d.deliveryapplyorderid,
|
|
|
|
|
+ d.histradedate,
|
|
|
|
|
+ d.tradedate,
|
|
|
|
|
+ d.accountid,
|
|
|
|
|
+ d.buyorsell,
|
|
|
|
|
+ d.xgoodsid, d.xdeliveryqty, d.xdeliveryprice,
|
|
|
|
|
+ d.pgoodsid, d.pdeliveryqty, d.pdeliveryprice,d.ppricemode,
|
|
|
|
|
+ d.p2goodsid, d.p2deliveryqty, d.p2deliveryprice,d.p2pricemode,
|
|
|
|
|
+ d.deliverygoodsid, d.deliveryqty,
|
|
|
|
|
+ d.applyorderstatus,
|
|
|
|
|
+ d.operatetype,d.ordersrc,
|
|
|
|
|
+ d.operatorid,d.counterorderid,
|
|
|
|
|
+ d.brandid ,
|
|
|
|
|
+ d.qualityid ,
|
|
|
|
|
+ d.specid ,
|
|
|
|
|
+ d.warehouseid ,
|
|
|
|
|
+ d.deliverymonthid ,
|
|
|
|
|
+ d.isstandard ,
|
|
|
|
|
+ d.retcode,
|
|
|
|
|
+ d.freezeamount, d.xdeliverytradeqty, d.xdeliverycancelqty,
|
|
|
|
|
+ d.validtype, d.validtime,
|
|
|
|
|
+ d.pricemove, d.ordertime,
|
|
|
|
|
+ g1.goodunitid,
|
|
|
|
|
+ g1.goodsname as xgoodsname,
|
|
|
|
|
+ g2.goodsname as pgoodsname,
|
|
|
|
|
+ g3.goodsname as p2goodsname,
|
|
|
|
|
+ dg.deliverygoodsname,
|
|
|
|
|
+ dgp1.pricemovedesc as brandname ,
|
|
|
|
|
+ dgp2.pricemovedesc as specname ,
|
|
|
|
|
+ dgp3.pricemovedesc as qualityname ,
|
|
|
|
|
+ dgp4.pricemovedesc as warehousename ,
|
|
|
|
|
+ dgp5.pricemovedesc as deliverymonthname,
|
|
|
|
|
+ e.enumdicname as deliverygoodsunitname,
|
|
|
|
|
+ e2.enumdicname as xgoodsUnitName
|
|
|
|
|
+ from HIS_DELIVERYAPPLYORDER d
|
|
|
|
|
+ left join goods g1
|
|
|
|
|
+ on d.xgoodsid = g1.goodsid
|
|
|
|
|
+ left join goods g2
|
|
|
|
|
+ on d.pgoodsid = g2.goodsid
|
|
|
|
|
+ left join goods g3
|
|
|
|
|
+ on d.p2goodsid = g3.goodsid
|
|
|
|
|
+ left join deliverygoods dg
|
|
|
|
|
+ on d.deliverygoodsid = dg.deliverygoodsid
|
|
|
|
|
+ left join ENUMDICITEM e on e.enumdiccode = 'goodsunit' and e.enumitemname = dg.goodsunitid
|
|
|
|
|
+ left join ENUMDICITEM e2 on e.enumdiccode = 'goodsunit' and e.enumitemname = g1.goodunitid
|
|
|
|
|
+ left join deliverygoodspricemove dgp1 on dgp1.autoid = d.brandid
|
|
|
|
|
+ left join deliverygoodspricemove dgp2 on dgp2.autoid = d.specid
|
|
|
|
|
+ left join deliverygoodspricemove dgp3 on dgp3.autoid = d.qualityid
|
|
|
|
|
+ left join deliverygoodspricemove dgp4 on dgp4.autoid = d.warehouseid
|
|
|
|
|
+ left join deliverygoodspricemove dgp5 on dgp5.autoid = d.deliverymonthid
|
|
|
|
|
+ <where>
|
|
|
|
|
+ d.deliveryapplyorderid = #{deliveryorderid} and d.isvaliddata = 1
|
|
|
|
|
+ and d.histradedate = (select max(t1.histradedate) from HIS_DELIVERYAPPLYORDER t1 where t1.deliveryapplyorderid = #{deliveryorderid} and t1.isvaliddata = 1)
|
|
|
|
|
+ </where>
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <select id="applyOrderDetail" resultType="com.muchinfo.mtp3pojos.vo.query.deliveryorder.ApplyOrderDetailResult">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ d.deliveryapplyorderid,
|
|
|
|
|
+ d.tradedate,
|
|
|
|
|
+ d.accountid,
|
|
|
|
|
+ d.buyorsell,
|
|
|
|
|
+ d.xgoodsid, d.xdeliveryqty, d.xdeliveryprice,
|
|
|
|
|
+ d.pgoodsid, d.pdeliveryqty, d.pdeliveryprice,d.ppricemode,
|
|
|
|
|
+ d.p2goodsid, d.p2deliveryqty, d.p2deliveryprice,d.p2pricemode,
|
|
|
|
|
+ d.deliverygoodsid, d.deliveryqty,
|
|
|
|
|
+ d.applyorderstatus,
|
|
|
|
|
+ d.operatetype,d.ordersrc,
|
|
|
|
|
+ d.operatorid,d.counterorderid,
|
|
|
|
|
+ d.brandid ,
|
|
|
|
|
+ d.qualityid ,
|
|
|
|
|
+ d.specid ,
|
|
|
|
|
+ d.warehouseid ,
|
|
|
|
|
+ d.deliverymonthid ,
|
|
|
|
|
+ d.isstandard ,
|
|
|
|
|
+ d.retcode,
|
|
|
|
|
+ d.freezeamount, d.xdeliverytradeqty, d.xdeliverycancelqty,
|
|
|
|
|
+ d.validtype, d.validtime,
|
|
|
|
|
+ d.pricemove, d.ordertime,
|
|
|
|
|
+ g1.goodunitid,
|
|
|
|
|
+ g1.goodsname as xgoodsname,
|
|
|
|
|
+ g2.goodsname as pgoodsname,
|
|
|
|
|
+ g3.goodsname as p2goodsname,
|
|
|
|
|
+ dg.deliverygoodsname,
|
|
|
|
|
+ dgp1.pricemovedesc as brandname ,
|
|
|
|
|
+ dgp2.pricemovedesc as specname ,
|
|
|
|
|
+ dgp3.pricemovedesc as qualityname ,
|
|
|
|
|
+ dgp4.pricemovedesc as warehousename ,
|
|
|
|
|
+ dgp5.pricemovedesc as deliverymonthname,
|
|
|
|
|
+ e.enumdicname as deliverygoodsunitname,
|
|
|
|
|
+ e2.enumdicname as xgoodsUnitName
|
|
|
|
|
+ from Deliveryapplyorder d
|
|
|
|
|
+ left join goods g1
|
|
|
|
|
+ on d.xgoodsid = g1.goodsid
|
|
|
|
|
+ left join goods g2
|
|
|
|
|
+ on d.pgoodsid = g2.goodsid
|
|
|
|
|
+ left join goods g3
|
|
|
|
|
+ on d.p2goodsid = g3.goodsid
|
|
|
|
|
+ left join deliverygoods dg on d.deliverygoodsid = dg.deliverygoodsid
|
|
|
|
|
+ left join ENUMDICITEM e on e.enumdiccode = 'goodsunit' and e.enumitemname = dg.goodsunitid
|
|
|
|
|
+ left join ENUMDICITEM e2 on e.enumdiccode = 'goodsunit' and e.enumitemname = g1.goodunitid
|
|
|
|
|
+ left join deliverygoodspricemove dgp1 on dgp1.autoid = d.brandid
|
|
|
|
|
+ left join deliverygoodspricemove dgp2 on dgp2.autoid = d.specid
|
|
|
|
|
+ left join deliverygoodspricemove dgp3 on dgp3.autoid = d.qualityid
|
|
|
|
|
+ left join deliverygoodspricemove dgp4 on dgp4.autoid = d.warehouseid
|
|
|
|
|
+ left join deliverygoodspricemove dgp5 on dgp5.autoid = d.deliverymonthid
|
|
|
|
|
+ left join TAACCOUNT ta on d.accountid = ta.accountid
|
|
|
|
|
+ <where>
|
|
|
|
|
+ d.deliveryapplyorderid = #{deliveryorderid}
|
|
|
|
|
+ </where>
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <select id="getHisDeliveryDetailByBuyOrSellOrderId" resultType="com.muchinfo.mtp3pojos.vo.query.deliveryorder.DeliveryDetailResult">
|
|
|
|
|
+ select
|
|
|
|
|
+ a.deliveryid,
|
|
|
|
|
+ a.buyorsell,
|
|
|
|
|
+ to_char(to_date(a.histradedate,'yyyy-MM-dd'),'yyyy-MM-dd') as histradedate,
|
|
|
|
|
+ to_char(to_date(a.tradedate,'yyyy-MM-dd'),'yyyy-MM-dd') as tradedate,
|
|
|
|
|
+ a.deliveryorderid,
|
|
|
|
|
+ a.accountid,
|
|
|
|
|
+ a.matchaccountid,
|
|
|
|
|
+ a.xgoodsid, g1.goodsname as x_goodsname,a.xdeliverycloseqty,a.xdeliveryprice,
|
|
|
|
|
+ a.pgoodsid, a.ppricemode, g2.goodsname as p_goodsname,a.pdeliverycloseqty,a.pdeliveryprice,
|
|
|
|
|
+ a.p2goodsid, a.p2pricemode, g3.goodsname as p2goodsname,a.p2deliverycloseqty,a.p2deliveryprice,
|
|
|
|
|
+ a.deliverygoodsid,d.deliverygoodsname,
|
|
|
|
|
+ a.deliverytime,
|
|
|
|
|
+ a.deliveryqty,
|
|
|
|
|
+ a.deliveryrtradeqty,
|
|
|
|
|
+ a.deliveryamount,
|
|
|
|
|
+ a.deliverypricemove,
|
|
|
|
|
+ a.deliverytotalamount,
|
|
|
|
|
+ a.deliveryprice,
|
|
|
|
|
+ a.deliverycharge,
|
|
|
|
|
+ a.remaintotalamount,
|
|
|
|
|
+ a.closeflag,
|
|
|
|
|
+ a.deliverystatus,
|
|
|
|
|
+ a.handlestatus,
|
|
|
|
|
+ a.mainorderflag,
|
|
|
|
|
+ a.relatedwrid,
|
|
|
|
|
+ a.feealgorithm,
|
|
|
|
|
+ a.memberchargevalue,
|
|
|
|
|
+ a.exchchargevalue,
|
|
|
|
|
+ a.buydeliveryapplyorderid,
|
|
|
|
|
+ a.selldeliveryapplyorderid,
|
|
|
|
|
+ a.marginalgorithm,
|
|
|
|
|
+ a.marginvalue,
|
|
|
|
|
+ a.freezemargin,
|
|
|
|
|
+ a.takemode,
|
|
|
|
|
+ a.receiveraddress,
|
|
|
|
|
+ dgp1.pricemovedesc as brandname ,
|
|
|
|
|
+ dgp2.pricemovedesc as specname ,
|
|
|
|
|
+ dgp3.pricemovedesc as qualityname ,
|
|
|
|
|
+ dgp4.pricemovedesc as warehousename ,
|
|
|
|
|
+ dgp5.pricemovedesc as deliverymonthname
|
|
|
|
|
+ from his_Deliverydetail a
|
|
|
|
|
+ left join goods g1 on a.xgoodsid =g1.goodsid
|
|
|
|
|
+ left join goods g2 on a.pgoodsid =g2.goodsid
|
|
|
|
|
+ left join goods g3 on a.p2goodsid =g3.goodsid
|
|
|
|
|
+ left join deliverygoods d on a.deliverygoodsid = d.deliverygoodsid
|
|
|
|
|
+ left join deliverygoodspricemove dgp1 on dgp1.autoid = a.brandid
|
|
|
|
|
+ left join deliverygoodspricemove dgp2 on dgp2.autoid = a.specid
|
|
|
|
|
+ left join deliverygoodspricemove dgp3 on dgp3.autoid = a.qualityid
|
|
|
|
|
+ left join deliverygoodspricemove dgp4 on dgp4.autoid = a.warehouseid
|
|
|
|
|
+ left join deliverygoodspricemove dgp5 on dgp5.autoid = a.deliverymonthid
|
|
|
|
|
+ where a.isvaliddata = 1 and
|
|
|
|
|
+ a.histradedate=(
|
|
|
|
|
+ select max(histradedate) from his_Deliverydetail
|
|
|
|
|
+ <where>
|
|
|
|
|
+ <if test="buyId != null">
|
|
|
|
|
+ and buydeliveryapplyorderid = #{buyId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ and isvaliddata = 1
|
|
|
|
|
+ <if test="sellId != null">
|
|
|
|
|
+ and selldeliveryapplyorderid = #{sellId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </where>
|
|
|
|
|
+ )
|
|
|
|
|
+ <if test="buyorsell != null">
|
|
|
|
|
+ and a.buyorsell= #{buyorsell}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="buyId != null">
|
|
|
|
|
+ and a.buydeliveryapplyorderid = #{buyId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="sellId != null">
|
|
|
|
|
+ and a.selldeliveryapplyorderid = #{sellId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <select id="getDeliveryDetailByBuyOrSellOrderId" resultType="com.muchinfo.mtp3pojos.vo.query.deliveryorder.DeliveryDetailResult">
|
|
|
|
|
+ select
|
|
|
|
|
+ a.deliveryid,
|
|
|
|
|
+ a.buyorsell,
|
|
|
|
|
+ to_char(to_date(a.tradedate,'yyyy-MM-dd'),'yyyy-MM-dd') as tradedate,
|
|
|
|
|
+ a.deliveryorderid,
|
|
|
|
|
+ a.accountid,
|
|
|
|
|
+ a.matchaccountid,
|
|
|
|
|
+ a.xgoodsid, g1.goodsname as x_goodsname,a.xdeliverycloseqty,a.xdeliveryprice,
|
|
|
|
|
+ a.pgoodsid, a.ppricemode, g2.goodsname as p_goodsname,a.pdeliverycloseqty,a.pdeliveryprice,
|
|
|
|
|
+ a.p2goodsid, a.p2pricemode, g3.goodsname as p2goodsname,a.p2deliverycloseqty,a.p2deliveryprice,
|
|
|
|
|
+ a.deliverygoodsid,d.deliverygoodsname,
|
|
|
|
|
+ a.deliverytime,
|
|
|
|
|
+ a.deliveryqty,
|
|
|
|
|
+ a.deliveryrtradeqty,
|
|
|
|
|
+ a.deliveryamount,
|
|
|
|
|
+ a.deliverypricemove,
|
|
|
|
|
+ a.deliverytotalamount,
|
|
|
|
|
+ a.deliveryprice,
|
|
|
|
|
+ a.deliverycharge,
|
|
|
|
|
+ a.remaintotalamount,
|
|
|
|
|
+ a.closeflag,
|
|
|
|
|
+ a.deliverystatus,
|
|
|
|
|
+ a.handlestatus,
|
|
|
|
|
+ a.mainorderflag,
|
|
|
|
|
+ a.relatedwrid,
|
|
|
|
|
+ a.deliverycharge,
|
|
|
|
|
+ a.feealgorithm,
|
|
|
|
|
+ a.memberchargevalue,
|
|
|
|
|
+ a.exchchargevalue,
|
|
|
|
|
+ a.buydeliveryapplyorderid,
|
|
|
|
|
+ a.selldeliveryapplyorderid,
|
|
|
|
|
+ a.marginalgorithm,
|
|
|
|
|
+ a.marginvalue,
|
|
|
|
|
+ a.freezemargin,
|
|
|
|
|
+ a.takemode,
|
|
|
|
|
+ a.receiveraddress,
|
|
|
|
|
+ dgp1.pricemovedesc as brandname ,
|
|
|
|
|
+ dgp2.pricemovedesc as specname ,
|
|
|
|
|
+ dgp3.pricemovedesc as qualityname ,
|
|
|
|
|
+ dgp4.pricemovedesc as warehousename ,
|
|
|
|
|
+ dgp5.pricemovedesc as deliverymonthname
|
|
|
|
|
+ from Deliverydetail a
|
|
|
|
|
+ left join goods g1 on a.xgoodsid =g1.goodsid
|
|
|
|
|
+ left join goods g2 on a.pgoodsid =g2.goodsid
|
|
|
|
|
+ left join goods g3 on a.p2goodsid =g3.goodsid
|
|
|
|
|
+ left join deliverygoods d on a.deliverygoodsid = d.deliverygoodsid
|
|
|
|
|
+ left join deliverygoodspricemove dgp1 on dgp1.autoid = a.brandid
|
|
|
|
|
+ left join deliverygoodspricemove dgp2 on dgp2.autoid = a.specid
|
|
|
|
|
+ left join deliverygoodspricemove dgp3 on dgp3.autoid = a.qualityid
|
|
|
|
|
+ left join deliverygoodspricemove dgp4 on dgp4.autoid = a.warehouseid
|
|
|
|
|
+ left join deliverygoodspricemove dgp5 on dgp5.autoid = a.deliverymonthid
|
|
|
|
|
+ <where>
|
|
|
|
|
+ <if test="buyorsell != null">
|
|
|
|
|
+ and a.buyorsell= #{buyorsell}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="buyId != null">
|
|
|
|
|
+ and a.buydeliveryapplyorderid = #{buyId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="sellId != null">
|
|
|
|
|
+ and a.selldeliveryapplyorderid = #{sellId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </where>
|
|
|
|
|
+ </select>
|
|
|
</mapper>
|
|
</mapper>
|