|
|
@@ -421,4 +421,246 @@
|
|
|
<update id="updateCreator">
|
|
|
update sale set creatorId = #{userId} , creatorName=#{userName} where sa_id=#{id}
|
|
|
</update>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <!-- 销售订单转采购单-->
|
|
|
+ <insert id="turnPurchase" parameterType="com.usoftchina.saas.sale.dto.PurchaseDTO" >
|
|
|
+ <selectKey resultType="java.lang.Long" keyProperty="id">
|
|
|
+ SELECT LAST_INSERT_ID() AS ID
|
|
|
+ </selectKey>
|
|
|
+ insert into purchase
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides="," >
|
|
|
+ <if test="pu_code != null" >
|
|
|
+ pu_code,
|
|
|
+ </if>
|
|
|
+ <if test="pu_date != null" >
|
|
|
+ pu_date,
|
|
|
+ </if>
|
|
|
+ <if test="pu_vendid != null" >
|
|
|
+ pu_vendid,
|
|
|
+ </if>
|
|
|
+ <if test="pu_vendcode != null" >
|
|
|
+ PU_VENDCODE,
|
|
|
+ </if>
|
|
|
+ <if test="pu_vendname != null" >
|
|
|
+ PU_VENDNAME,
|
|
|
+ </if>
|
|
|
+ <if test="pu_buyerid != null" >
|
|
|
+ PU_BUYERID,
|
|
|
+ </if>
|
|
|
+ <if test="pu_buyercode != null" >
|
|
|
+ PU_BUYERCODE,
|
|
|
+ </if>
|
|
|
+ <if test="pu_buyername != null" >
|
|
|
+ PU_BUYERNAME,
|
|
|
+ </if>
|
|
|
+ <if test="pu_delivery != null" >
|
|
|
+ PU_DELIVERY,
|
|
|
+ </if>
|
|
|
+ <if test="pu_taxtotal != null" >
|
|
|
+ PU_TAXTOTAL,
|
|
|
+ </if>
|
|
|
+ <if test="pu_total != null" >
|
|
|
+ PU_TOTAL,
|
|
|
+ </if>
|
|
|
+ <if test="pu_remark != null" >
|
|
|
+ PU_REMARK,
|
|
|
+ </if>
|
|
|
+ <if test="pu_totalupper != null" >
|
|
|
+ PU_TOTALUPPER,
|
|
|
+ </if>
|
|
|
+ <if test="pu_printstatus != null" >
|
|
|
+ PU_PRINTSTATUS,
|
|
|
+ </if>
|
|
|
+ <if test="pu_printstatuscode != null" >
|
|
|
+ PU_PRINTSTATUSCODE,
|
|
|
+ </if>
|
|
|
+ <if test="pu_acceptstatuscode != null" >
|
|
|
+ PU_ACCEPTSTATUSCODE,
|
|
|
+ </if>
|
|
|
+ <if test="pu_acceptstatus != null" >
|
|
|
+ PU_ACCEPTSTATUS,
|
|
|
+ </if>
|
|
|
+ <if test="pu_statuscode != null" >
|
|
|
+ PU_STATUSCODE,
|
|
|
+ </if>
|
|
|
+ <if test="pu_status != null" >
|
|
|
+ PU_STATUS,
|
|
|
+ </if>
|
|
|
+ <if test="companyId != null" >
|
|
|
+ companyid,
|
|
|
+ </if>
|
|
|
+ <if test="updaterId != null" >
|
|
|
+ updaterId,
|
|
|
+ </if>
|
|
|
+ <if test="updaterName != null" >
|
|
|
+ updaterName,
|
|
|
+ </if>
|
|
|
+ <if test="updateTime != null" >
|
|
|
+ updateTime,
|
|
|
+ </if>
|
|
|
+ <if test="creatorId != null" >
|
|
|
+ creatorId,
|
|
|
+ </if>
|
|
|
+ <if test="creatorName != null" >
|
|
|
+ creatorName,
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null" >
|
|
|
+ createTime,
|
|
|
+ </if>
|
|
|
+ <if test="pu_text1 != null" >
|
|
|
+ pu_text1,
|
|
|
+ </if>
|
|
|
+ <if test="pu_text2 != null" >
|
|
|
+ pu_text2,
|
|
|
+ </if>
|
|
|
+ <if test="pu_text3 != null" >
|
|
|
+ pu_text3,
|
|
|
+ </if>
|
|
|
+ <if test="pu_text4 != null" >
|
|
|
+ pu_text4,
|
|
|
+ </if>
|
|
|
+ <if test="pu_text5 != null" >
|
|
|
+ pu_text5,
|
|
|
+ </if>
|
|
|
+ <if test="pu_shipaddresscode != null" >
|
|
|
+ PU_SHIPADDRESSCODE,
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides="," >
|
|
|
+ <if test="pu_code != null" >
|
|
|
+ #{pu_code,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="pu_date != null" >
|
|
|
+ #{pu_date,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="pu_vendid != null" >
|
|
|
+ #{pu_vendid,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="pu_vendcode != null" >
|
|
|
+ #{pu_vendcode,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="pu_vendname != null" >
|
|
|
+ #{pu_vendname,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="pu_buyerid != null" >
|
|
|
+ #{pu_buyerid,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="pu_buyercode != null" >
|
|
|
+ #{pu_buyercode,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="pu_buyername != null" >
|
|
|
+ #{pu_buyername,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="pu_delivery != null" >
|
|
|
+ #{pu_delivery,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="pu_taxtotal != null" >
|
|
|
+ #{pu_taxtotal,jdbcType=DOUBLE},
|
|
|
+ </if>
|
|
|
+ <if test="pu_total != null" >
|
|
|
+ #{pu_total,jdbcType=DOUBLE},
|
|
|
+ </if>
|
|
|
+ <if test="pu_remark != null" >
|
|
|
+ #{pu_remark,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="pu_totalupper != null" >
|
|
|
+ #{pu_totalupper,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="pu_printstatus != null" >
|
|
|
+ #{pu_printstatus,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="pu_printstatuscode != null" >
|
|
|
+ #{pu_printstatuscode,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="pu_acceptstatuscode != null" >
|
|
|
+ #{pu_acceptstatuscode,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="pu_acceptstatus != null" >
|
|
|
+ #{pu_acceptstatus,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="pu_statuscode != null" >
|
|
|
+ #{pu_statuscode,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="pu_status != null" >
|
|
|
+ #{pu_status,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="companyId != null" >
|
|
|
+ #{companyId,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="updaterId != null" >
|
|
|
+ #{updaterId,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="updaterName != null" >
|
|
|
+ #{updaterName,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="updateTime != null" >
|
|
|
+ #{updateTime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="creatorId != null" >
|
|
|
+ #{creatorId,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="creatorName != null" >
|
|
|
+ #{creatorName,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null" >
|
|
|
+ #{createTime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="pu_text1 != null" >
|
|
|
+ #{pu_text1,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="pu_text2 != null" >
|
|
|
+ #{pu_text2,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="pu_text3 != null" >
|
|
|
+ #{pu_text3,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="pu_text4 != null" >
|
|
|
+ #{pu_text4,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="pu_text5 != null" >
|
|
|
+ #{pu_text5,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="pu_shipaddresscode != null" >
|
|
|
+ #{pu_shipaddresscode,jdbcType=LONGVARCHAR},
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <insert id="turnPurchaseDetail" parameterType="java.util.List" >
|
|
|
+ insert into purchasedetail ( PD_PUID, PD_CODE,
|
|
|
+ PD_DETNO, PD_PRODID, PD_PRODCODE,
|
|
|
+ PD_UNIT, PD_QTY, PD_PRICE,PD_TAXPRICE,
|
|
|
+ PD_TOTAL,PD_TAXRATE, PD_TAXTOTAL, PD_ACCEPTQTY,
|
|
|
+ PD_DELIVERY, PD_SALECODE, PD_SALEDETNO,
|
|
|
+ PD_SDID, companyId, updaterId,
|
|
|
+ updateTime, pd_text1, pd_text2,
|
|
|
+ pd_text3, pd_text4, pd_text5,
|
|
|
+ pd_yqty,pd_remark)
|
|
|
+ values
|
|
|
+ <foreach collection="list" item="item" index="index" open="" close="" separator=",">
|
|
|
+ (
|
|
|
+ #{item.pd_puid,jdbcType=INTEGER}, #{item.pd_code,jdbcType=VARCHAR},
|
|
|
+ #{item.pd_detno,jdbcType=INTEGER}, #{item.pd_prodid,jdbcType=INTEGER}, #{item.pd_prodcode,jdbcType=VARCHAR},
|
|
|
+ #{item.pd_unit,jdbcType=VARCHAR}, #{item.pd_qty,jdbcType=DOUBLE}, #{item.pd_price,jdbcType=DOUBLE},#{item.pd_taxprice,jdbcType=DOUBLE},
|
|
|
+ #{item.pd_total,jdbcType=DOUBLE},#{item.pd_taxrate,jdbcType=DOUBLE}, #{item.pd_taxtotal,jdbcType=DOUBLE}, #{item.pd_acceptqty,jdbcType=DOUBLE},
|
|
|
+ #{item.pd_delivery,jdbcType=DOUBLE}, #{item.pd_salecode,jdbcType=VARCHAR}, #{item.pd_saledetno,jdbcType=INTEGER},
|
|
|
+ #{item.pd_sdid,jdbcType=INTEGER}, #{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_yqty,jdbcType=DOUBLE}, #{item.pd_remark,jdbcType=VARCHAR}
|
|
|
+ )
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+ <select id="selectPurchaseId" resultType="int">
|
|
|
+ select pu_id from purchase where
|
|
|
+ <if test="code !=null">
|
|
|
+ pu_code=#{code}
|
|
|
+ </if> and
|
|
|
+ <if test="companyid !=null">
|
|
|
+ companyid=#{companyid}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </select>
|
|
|
</mapper>
|