|
|
@@ -361,32 +361,81 @@
|
|
|
<update id="batchUpdate" parameterType="com.usoftchina.saas.purchase.po.PurchaseDetail" >
|
|
|
<foreach collection="list" item="item" index="index" open="" close="" separator=";">
|
|
|
update purchasedetail <set>
|
|
|
- PD_PUID = #{item.pd_puid},
|
|
|
- PD_CODE = #{item.pd_code},
|
|
|
- PD_DETNO = #{item.pd_detno},
|
|
|
- PD_PRODID = #{item.pd_prodid},
|
|
|
- PD_PRODCODE = #{item.pd_prodcode},
|
|
|
- PD_UNIT = #{item.pd_unit},
|
|
|
- PD_QTY = #{item.pd_qty},
|
|
|
- PD_PRICE = #{item.pd_price},
|
|
|
- PD_TAXPRICE = #{item.pd_taxprice},
|
|
|
- PD_TOTAL = #{item.pd_total},
|
|
|
- PD_TAXRATE = #{item.pd_taxrate},
|
|
|
- PD_TAXTOTAL = #{item.pd_taxtotal},
|
|
|
- PD_ACCEPTQTY = #{item.pd_acceptqty},
|
|
|
- PD_DELIVERY = #{item.pd_delivery},
|
|
|
- PD_SALECODE = #{item.pd_salecode},
|
|
|
- PD_SALEDETNO = #{item.pd_saledetno},
|
|
|
- PD_SDID = #{item.pd_sdid},
|
|
|
- companyId = #{item.companyId},
|
|
|
- updaterId = #{item.updaterId},
|
|
|
- updateTime = #{item.updateTime},
|
|
|
- pd_text1 = #{item.pd_text1},
|
|
|
- pd_text2 = #{item.pd_text2},
|
|
|
- pd_text3 = #{item.pd_text3},
|
|
|
- pd_text4 = #{item.pd_text4},
|
|
|
- pd_text5 = #{item.pd_text5},
|
|
|
- pd_yqty = #{item.pd_yqty}
|
|
|
+ <if test="item.pd_puid != null" >
|
|
|
+ PD_PUID = #{item.pd_puid,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_code != null" >
|
|
|
+ PD_CODE = #{item.pd_code,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_detno != null" >
|
|
|
+ PD_DETNO = #{item.pd_detno,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_prodid != null" >
|
|
|
+ PD_PRODID = #{item.pd_prodid,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_prodcode != null" >
|
|
|
+ PD_PRODCODE = #{item.pd_prodcode,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_unit != null" >
|
|
|
+ PD_UNIT = #{item.pd_unit,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_qty != null" >
|
|
|
+ PD_QTY = #{item.pd_qty,jdbcType=DOUBLE},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_price != null" >
|
|
|
+ PD_PRICE = #{item.pd_price,jdbcType=DOUBLE},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_total != null" >
|
|
|
+ PD_TOTAL = #{item.pd_total,jdbcType=DOUBLE},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_taxrate != null" >
|
|
|
+ PD_TAXRATE = #{item.pd_taxrate,jdbcType=DOUBLE},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_taxtotal != null" >
|
|
|
+ PD_TAXTOTAL = #{item.pd_taxtotal,jdbcType=DOUBLE},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_acceptqty != null" >
|
|
|
+ PD_ACCEPTQTY = #{item.pd_acceptqty,jdbcType=DOUBLE},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_delivery != null" >
|
|
|
+ PD_DELIVERY = #{item.pd_delivery,jdbcType=DOUBLE},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_salecode != null" >
|
|
|
+ PD_SALECODE = #{item.pd_salecode,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_saledetno != null" >
|
|
|
+ PD_SALEDETNO = #{item.pd_saledetno,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_sdid != null" >
|
|
|
+ PD_SDID = #{item.pd_sdid,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="item.companyId != null" >
|
|
|
+ companyId = #{item.companyId,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="item.updaterId != null" >
|
|
|
+ updaterId = #{item.updaterId,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="item.updateTime != null" >
|
|
|
+ updateTime = #{item.updateTime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_text1 != null" >
|
|
|
+ pd_text1 = #{item.pd_text1,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_text2 != null" >
|
|
|
+ pd_text2 = #{item.pd_text2,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_text3 != null" >
|
|
|
+ pd_text3 = #{item.pd_text3,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_text4 != null" >
|
|
|
+ pd_text4 = #{item.pd_text4,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_text5 != null" >
|
|
|
+ pd_text5 = #{item.pd_text5,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_yqty != null" >
|
|
|
+ pd_yqty = #{item.pd_yqty,jdbcType=DOUBLE},
|
|
|
+ </if>
|
|
|
</set>
|
|
|
where PD_ID = #{item.id,jdbcType=INTEGER}
|
|
|
</foreach>
|
|
|
@@ -410,9 +459,9 @@
|
|
|
|
|
|
<update id="calcPurchase" parameterType="long" >
|
|
|
update purchasedetail set pd_taxprice = ifnull(PD_PRICE,0)/(1+ifnull(pd_taxrate,0)/100) where pd_puid = #{pu_id,jdbcType=INTEGER};
|
|
|
- update purchasedetail set pd_total = ifnull(PD_PRICE,0)*ifnull(pd_qty,0),pd_taxtotal = pd_taxprice*ifnull(pd_qty,0) where pd_puid = #{pu_id,jdbcType=INTEGER};
|
|
|
- update purchase set pu_total = (select sum(pd_total) from purchasedetail where pd_puid = #{pi_id,jdbcType=INTEGER} ) where pu_id = #{pu_id,jdbcType=INTEGER};
|
|
|
- update purchase set PU_TAXTOTAL = (select sum(pd_taxtotal) from purchasedetail where pd_puid = #{pi_id,jdbcType=INTEGER} ) where pu_id = #{pu_id,jdbcType=INTEGER};
|
|
|
+ update purchasedetail set pd_total = round(ifnull(PD_PRICE,0)*ifnull(pd_qty,0),2),pd_taxtotal = round(pd_taxprice*ifnull(pd_qty,0),2) where pd_puid = #{pu_id,jdbcType=INTEGER};
|
|
|
+ update purchase set pu_total = round((select sum(pd_total) from purchasedetail where pd_puid = #{pi_id,jdbcType=INTEGER} ),2) where pu_id = #{pu_id,jdbcType=INTEGER};
|
|
|
+ update purchase set PU_TAXTOTAL = round((select sum(pd_taxtotal) from purchasedetail where pd_puid = #{pi_id,jdbcType=INTEGER} ),2) where pu_id = #{pu_id,jdbcType=INTEGER};
|
|
|
</update>
|
|
|
|
|
|
|