|
|
@@ -615,12 +615,12 @@
|
|
|
(
|
|
|
#{item.pd_piid,jdbcType=INTEGER},#{item.pd_inoutno,jdbcType=VARCHAR},#{item.pd_piclass,jdbcType=VARCHAR},#{item.pd_pdno,jdbcType=INTEGER},#{item.pd_ordercode,jdbcType=VARCHAR},
|
|
|
#{item.pd_orderdetno,jdbcType=INTEGER},#{item.pd_prodid,jdbcType=INTEGER},#{item.pd_prodcode,jdbcType=VARCHAR},#{item.pd_unit,jdbcType=VARCHAR},
|
|
|
- #{item.pd_inqty,jdbcType=INTEGER},#{item.pd_outqty,jdbcType=INTEGER},#{item.pd_orderprice,jdbcType=DOUBLE},#{item.pd_sendprice,jdbcType=DOUBLE},#{item.pd_price,jdbcType=DOUBLE},
|
|
|
+ #{item.pd_inqty,jdbcType=DOUBLE},#{item.pd_outqty,jdbcType=DOUBLE},#{item.pd_orderprice,jdbcType=DOUBLE},#{item.pd_sendprice,jdbcType=DOUBLE},#{item.pd_price,jdbcType=DOUBLE},
|
|
|
#{item.pd_total,jdbcType=DOUBLE},#{item.pd_taxrate,jdbcType=DOUBLE},#{item.pd_netprice,jdbcType=DOUBLE},#{item.pd_nettotal,jdbcType=DOUBLE},
|
|
|
- #{item.pd_whid,jdbcType=INTEGER},#{item.pd_whcode,jdbcType=VARCHAR},#{item.pd_whname,jdbcType=VARCHAR},#{item.pd_inwhid,jdbcType=INTEGER},#{item.pd_inwhcode,jdbcType=VARCHAR},
|
|
|
- #{item.pd_inwhname,jdbcType=VARCHAR},#{item.pd_orderid,jdbcType=INTEGER},#{item.pd_sdid,jdbcType=INTEGER},#{item.pd_status,jdbcType=VARCHAR},#{item.pd_remark,jdbcType=VARCHAR},
|
|
|
+ #{item.pd_whid},#{item.pd_whcode,jdbcType=VARCHAR},#{item.pd_whname,jdbcType=VARCHAR},#{item.pd_inwhid},#{item.pd_inwhcode,jdbcType=VARCHAR},
|
|
|
+ #{item.pd_inwhname,jdbcType=VARCHAR},#{item.pd_orderid},#{item.pd_sdid},#{item.pd_status,jdbcType=VARCHAR},#{item.pd_remark,jdbcType=VARCHAR},
|
|
|
#{item.companyId,jdbcType=INTEGER},#{item.updaterId,jdbcType=INTEGER},#{item.updateTime,jdbcType=TIMESTAMP},#{item.pd_text1,jdbcType=VARCHAR},#{item.pd_text2,jdbcType=VARCHAR},
|
|
|
- #{item.pd_text3,jdbcType=VARCHAR},#{item.pd_text4,jdbcType=VARCHAR},#{item.pd_text5,jdbcType=VARCHAR},#{item.pd_ym,jdbcType=INTEGER},#{item.pd_yqty,jdbcType=INTEGER}
|
|
|
+ #{item.pd_text3,jdbcType=VARCHAR},#{item.pd_text4,jdbcType=VARCHAR},#{item.pd_text5,jdbcType=VARCHAR},#{item.pd_ym,jdbcType=INTEGER},#{item.pd_yqty,jdbcType=DOUBLE}
|
|
|
)
|
|
|
</foreach>
|
|
|
</insert>
|
|
|
@@ -738,19 +738,22 @@
|
|
|
</update>
|
|
|
|
|
|
<update id="updateSaleOutYqty" parameterType="long">
|
|
|
-update prodiodetail
|
|
|
- set a.pd_yqty =IFNULL((select b.pd_inqty from (select pi_said,sum(pd_inqty) pd_inqty from prodiodetail left join prodinout on pd_piid = pi_id where pd_piclass='销售退货单'
|
|
|
-and pi_said=#{id} GROUP BY pd_ioid) b where IFNULL(b.pd_ioid ,0)= a.pd_id ),0)
|
|
|
-where a.pd_piid = (select pi_id from prodinout where pi_said=#{id} and pi_class='销售出货单')
|
|
|
+update prodiodetail a
|
|
|
+ set a.pd_yqty =IFNULL(
|
|
|
+ (
|
|
|
+ select b.pd_inqty from
|
|
|
+ (select pd_ioid,sum(pd_inqty) pd_inqty from prodiodetail where pd_piclass='销售退货单'
|
|
|
+ and pd_piid=#{id} GROUP BY pd_ioid ) b
|
|
|
+ where IFNULL(b.pd_ioid ,0)= a.pd_id
|
|
|
+ ),0)
|
|
|
+where a.pd_id in (select pd_ioid from prodiodetail where pd_piid=#{id} and pi_class='销售出货单')
|
|
|
</update>
|
|
|
<update id="updateSaleYqty" parameterType="long">
|
|
|
- update saledetail
|
|
|
- set a.sd_yqty =IFNULL((
|
|
|
- select b.pd_ounqty from (select pi_said,sum(pd_outqty) pd_outqty
|
|
|
- from prodiodetail left join prodinout on pd_piid = pi_id where pd_piclass='销售出货单'
|
|
|
- and pi_said=#{id} GROUP BY pi_said) b where IFNULL(b.pd_ioid ,0)= a.pd_id
|
|
|
- ),0)
|
|
|
- where a.sd_said = #{id}
|
|
|
+
|
|
|
+ update saledetail a set a.sd_yqty =IFNULL( ( select b.pd_outqty from (
|
|
|
+ select pd_sdid,sum(pd_outqty) pd_outqty from prodiodetail left join
|
|
|
+ prodinout on pd_piid = pi_id where pd_piclass='销售出货单' and pi_said=#{id}
|
|
|
+ GROUP BY pd_sdid) b where IFNULL(b.pd_sdid ,0) = a.sd_id ),0) where a.sd_said =#{id}
|
|
|
</update>
|
|
|
|
|
|
<select id="selectByFK" parameterType="long" resultMap="BaseResultMap">
|
|
|
@@ -760,14 +763,14 @@ where a.pd_piid = (select pi_id from prodinout where pi_said=#{id} and pi_class=
|
|
|
|
|
|
<update id="updatePDSaleIN" parameterType="long">
|
|
|
update prodiodetail set
|
|
|
- pd_total=IFNULL(pd_inqty,0)*IFNULL(pd_orderprice,0),
|
|
|
+ pd_total=IFNULL(pd_inqty,0)*IFNULL(pd_sendprice,0),
|
|
|
pd_netprice = IFNULL(pd_sendprice,0)/(1+IFNULL(pd_taxrate,0)/100),
|
|
|
pd_nettotal = (IFNULL(pd_sendprice,0)/(1+IFNULL(pd_taxrate,0)/100))*IFNULL(pd_inqty,0)
|
|
|
where pd_piid=#{id}
|
|
|
</update>
|
|
|
<update id="updatePDSaleOut" parameterType="long">
|
|
|
update prodiodetail set
|
|
|
- pd_total=IFNULL(pd_outqty,0)*IFNULL(pd_orderprice,0),
|
|
|
+ pd_total=IFNULL(pd_outqty,0)*IFNULL(pd_sendprice,0),
|
|
|
pd_netprice = IFNULL(pd_sendprice,0)/(1+IFNULL(pd_taxrate,0)/100),
|
|
|
pd_nettotal = (IFNULL(pd_sendprice,0)/(1+IFNULL(pd_taxrate,0)/100))*IFNULL(pd_outqty,0)
|
|
|
where pd_piid=#{id}
|