|
|
@@ -74,7 +74,7 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="getProdUnit" resultType="com.usoftchina.saas.commons.dto.ComboDTO">
|
|
|
- SELECT PR_UNIT as display, pr_unit as value FROM PRODUCT
|
|
|
+ SELECT PR_UNIT as display, pr_unit as value FROM PRODUCT where companyId=#{companyId}
|
|
|
</select>
|
|
|
<update id="updateLatestPurchasePrice" parameterType="long">
|
|
|
update product a set pr_purcprice=(select pd_price from purchasedetail WHERE
|
|
|
@@ -506,5 +506,413 @@
|
|
|
<select id="getCountFromProdIO" resultType="int">
|
|
|
SELECT COUNT(*) FROM PRODIODETAIL WHERE PD_PRODID=#{id} AND COMPANYID=#{companyId}
|
|
|
</select>
|
|
|
+
|
|
|
+ <insert id="saveProdInOut" parameterType="com.usoftchina.saas.document.entities.ProdInOut">
|
|
|
+ <selectKey resultType="java.lang.Long" keyProperty="id">
|
|
|
+ SELECT LAST_INSERT_ID() AS ID
|
|
|
+ </selectKey>
|
|
|
+ insert into prodinout
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+
|
|
|
+ <if test="pi_inoutno != null">
|
|
|
+ pi_inoutno,
|
|
|
+ </if>
|
|
|
+ <if test="pi_class != null">
|
|
|
+ pi_class,
|
|
|
+ </if>
|
|
|
+ <if test="pi_date != null">
|
|
|
+ pi_date,
|
|
|
+ </if>
|
|
|
+ <if test="pi_vendid != null">
|
|
|
+ pi_vendid,
|
|
|
+ </if>
|
|
|
+ <if test="pi_vendcode != null">
|
|
|
+ pi_vendcode,
|
|
|
+ </if>
|
|
|
+ <if test="pi_vendname != null">
|
|
|
+ pi_vendname,
|
|
|
+ </if>
|
|
|
+ <if test="pi_custid != null">
|
|
|
+ pi_custid,
|
|
|
+ </if>
|
|
|
+ <if test="pi_custcode != null">
|
|
|
+ pi_custcode,
|
|
|
+ </if>
|
|
|
+ <if test="pi_custname != null">
|
|
|
+ pi_custname,
|
|
|
+ </if>
|
|
|
+ <if test="pi_puid != null">
|
|
|
+ pi_puid,
|
|
|
+ </if>
|
|
|
+ <if test="pi_pucode != null">
|
|
|
+ pi_pucode,
|
|
|
+ </if>
|
|
|
+ <if test="pi_said != null">
|
|
|
+ pi_said,
|
|
|
+ </if>
|
|
|
+ <if test="pi_sacode != null">
|
|
|
+ pi_sacode,
|
|
|
+ </if>
|
|
|
+ <if test="pi_total != null">
|
|
|
+ pi_total,
|
|
|
+ </if>
|
|
|
+ <if test="pi_recordmanid != null">
|
|
|
+ pi_recordmanid,
|
|
|
+ </if>
|
|
|
+ <if test="pi_recordman != null">
|
|
|
+ pi_recordman,
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">
|
|
|
+ pi_recorddate,
|
|
|
+ </if>
|
|
|
+ <if test="pi_status != null">
|
|
|
+ pi_status,
|
|
|
+ </if>
|
|
|
+ <if test="pi_statuscode != null">
|
|
|
+ pi_statuscode,
|
|
|
+ </if>
|
|
|
+ <if test="pi_printstatus != null">
|
|
|
+ pi_printstatus,
|
|
|
+ </if>
|
|
|
+ <if test="pi_printstatuscode != null">
|
|
|
+ pi_printstatuscode,
|
|
|
+ </if>
|
|
|
+ <if test="companyId != null">
|
|
|
+ companyid,
|
|
|
+ </if>
|
|
|
+ <if test="updaterId != null">
|
|
|
+ updaterid,
|
|
|
+ </if>
|
|
|
+ <if test="updateTime != null">
|
|
|
+ updatetime,
|
|
|
+ </if>
|
|
|
+ <if test="pi_text1 != null">
|
|
|
+ pi_text1,
|
|
|
+ </if>
|
|
|
+ <if test="pi_text2 != null">
|
|
|
+ pi_text2,
|
|
|
+ </if>
|
|
|
+ <if test="pi_text3 != null">
|
|
|
+ pi_text3,
|
|
|
+ </if>
|
|
|
+ <if test="pi_text4 != null">
|
|
|
+ pi_text4,
|
|
|
+ </if>
|
|
|
+ <if test="pi_text5 != null">
|
|
|
+ pi_text5,
|
|
|
+ </if>
|
|
|
+ <if test="pi_address != null">
|
|
|
+ pi_address,
|
|
|
+ </if>
|
|
|
+ <if test="pi_auditdate != null">
|
|
|
+ pi_auditdate,
|
|
|
+ </if>
|
|
|
+ <if test="pi_auditman != null">
|
|
|
+ pi_auditman,
|
|
|
+ </if>
|
|
|
+ <if test="pi_remark != null">
|
|
|
+ pi_remark,
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+
|
|
|
+ <if test="pi_inoutno != null">
|
|
|
+ #{pi_inoutno,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="pi_class != null">
|
|
|
+ #{pi_class,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="pi_date != null">
|
|
|
+ #{pi_date,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="pi_vendid != null">
|
|
|
+ #{pi_vendid,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="pi_vendcode != null">
|
|
|
+ #{pi_vendcode,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="pi_vendname != null">
|
|
|
+ #{pi_vendname,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="pi_custid != null">
|
|
|
+ #{pi_custid,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="pi_custcode != null">
|
|
|
+ #{pi_custcode,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="pi_custname != null">
|
|
|
+ #{pi_custname,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="pi_puid != null">
|
|
|
+ #{pi_puid,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="pi_pucode != null">
|
|
|
+ #{pi_pucode,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="pi_said != null">
|
|
|
+ #{pi_said,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="pi_sacode != null">
|
|
|
+ #{pi_sacode,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="pi_total != null">
|
|
|
+ #{pi_total,jdbcType=DOUBLE},
|
|
|
+ </if>
|
|
|
+ <if test="pi_recordmanid != null">
|
|
|
+ #{pi_recordmanid,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="pi_recordman != null">
|
|
|
+ #{pi_recordman,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">
|
|
|
+ #{createTime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="pi_status != null">
|
|
|
+ #{pi_status,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="pi_statuscode != null">
|
|
|
+ #{pi_statuscode,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="pi_printstatus != null">
|
|
|
+ #{pi_printstatus,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="pi_printstatuscode != null">
|
|
|
+ #{pi_printstatuscode,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="companyId != null">
|
|
|
+ #{companyId,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="updaterId != null">
|
|
|
+ #{updaterId,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="updateTime != null">
|
|
|
+ #{updateTime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="pi_text1 != null">
|
|
|
+ #{pi_text1,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="pi_text2 != null">
|
|
|
+ #{pi_text2,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="pi_text3 != null">
|
|
|
+ #{pi_text3,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="pi_text4 != null">
|
|
|
+ #{pi_text4,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="pi_text5 != null">
|
|
|
+ #{pi_text5,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="pi_address != null">
|
|
|
+ #{pi_address,jdbcType=LONGVARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="pi_auditdate != null">
|
|
|
+ #{pi_auditdate,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="pi_auditman != null">
|
|
|
+ #{pi_auditman,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="pi_remark != null">
|
|
|
+ #{pi_remark,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <insert id="batchInsertDetail" parameterType="java.util.List" >
|
|
|
+ insert into prodiodetail (pd_piid, pd_inoutno,
|
|
|
+ pd_piclass, pd_pdno, pd_ordercode,
|
|
|
+ pd_orderdetno, pd_prodid, pd_prodcode,
|
|
|
+ pd_unit, pd_inqty, pd_outqty,
|
|
|
+ pd_orderprice, pd_sendprice, pd_price,
|
|
|
+ pd_total, pd_taxrate, pd_netprice,
|
|
|
+ pd_nettotal, pd_whid, pd_whcode,
|
|
|
+ pd_whname, pd_inwhid, pd_inwhcode,
|
|
|
+ pd_inwhname, pd_orderid, pd_sdid,
|
|
|
+ pd_status, companyid, updaterid,
|
|
|
+ updatetime, pd_text1, pd_text2,
|
|
|
+ pd_text3, pd_text4, pd_text5,
|
|
|
+ pd_ym, pd_yqty, pd_ioid,
|
|
|
+ pd_remark) VALUES
|
|
|
+ <foreach collection="list" item="item" index="index" open="" close="" separator=",">
|
|
|
+ (
|
|
|
+ #{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=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=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_ym,jdbcType=INTEGER},
|
|
|
+ #{item.pd_yqty,jdbcType=DOUBLE},
|
|
|
+ #{item.pd_remark,jdbcType=LONGVARCHAR},
|
|
|
+ #{item.pd_ioid,jdbcType=INTEGER})
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="batchUpdateDetail" parameterType="com.usoftchina.saas.document.entities.ProdIODetail" >
|
|
|
+ <foreach collection="list" item="item" index="index" open="" close="" separator=";">
|
|
|
+ update prodiodetail <set>
|
|
|
+ <if test="item.pd_piid !=null">
|
|
|
+ pd_piid = #{item.pd_piid},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_inoutno !=null">
|
|
|
+ pd_inoutno = #{item.pd_inoutno},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_piclass !=null">
|
|
|
+ pd_piclass = #{item.pd_piclass},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_pdno !=null">
|
|
|
+ pd_pdno = #{item.pd_pdno},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_ordercode !=null">
|
|
|
+ pd_ordercode = #{item.pd_ordercode},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_orderdetno !=null">
|
|
|
+ pd_orderdetno = #{item.pd_orderdetno},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_prodid !=null">
|
|
|
+ pd_prodid = #{item.pd_prodid},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_prodcode !=null">
|
|
|
+ pd_prodcode = #{item.pd_prodcode},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_unit !=null">
|
|
|
+ pd_unit = #{item.pd_unit},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_inqty !=null">
|
|
|
+ pd_inqty = #{item.pd_inqty},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_outqty !=null">
|
|
|
+ pd_outqty = #{item.pd_outqty},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_orderprice !=null">
|
|
|
+ pd_orderprice = #{item.pd_orderprice},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_sendprice !=null">
|
|
|
+ pd_sendprice = #{item.pd_sendprice},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_price !=null">
|
|
|
+ pd_price = #{item.pd_price},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_total !=null">
|
|
|
+ pd_total = #{item.pd_total},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_taxrate !=null">
|
|
|
+ pd_taxrate = #{item.pd_taxrate},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_netprice !=null">
|
|
|
+ pd_netprice = #{item.pd_netprice},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_nettotal !=null">
|
|
|
+ pd_nettotal = #{item.pd_nettotal},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_whid !=null">
|
|
|
+ pd_whid = #{item.pd_whid},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_whcode !=null">
|
|
|
+ pd_whcode = #{item.pd_whcode},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_whname !=null">
|
|
|
+ pd_whname = #{item.pd_whname},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_inwhid !=null">
|
|
|
+ pd_inwhid = #{item.pd_inwhid},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_inwhcode !=null">
|
|
|
+ pd_inwhcode = #{item.pd_inwhcode},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_inwhname !=null">
|
|
|
+ pd_inwhname = #{item.pd_inwhname},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_orderid !=null">
|
|
|
+ pd_orderid = #{item.pd_orderid},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_sdid !=null">
|
|
|
+ pd_sdid = #{item.pd_sdid},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_status !=null">
|
|
|
+ pd_status = #{item.pd_status},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_remark !=null">
|
|
|
+ pd_remark = #{item.pd_remark},
|
|
|
+ </if>
|
|
|
+ <if test="item.companyId!=null">
|
|
|
+ companyId = #{item.companyId},
|
|
|
+ </if>
|
|
|
+ <if test="item.updaterId!=null">
|
|
|
+ updaterId = #{item.updaterId},
|
|
|
+ </if>
|
|
|
+ <if test="item.updateTime!=null">
|
|
|
+ updateTime = #{item.updateTime},
|
|
|
+ </if>
|
|
|
+ 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},
|
|
|
+ <if test="item.pd_ym!=null">
|
|
|
+ pd_ym = #{item.pd_ym},
|
|
|
+ </if>
|
|
|
+ <if test="item.pd_yqty!=null">
|
|
|
+ pd_yqty = #{item.pd_yqty},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where PD_ID = #{item.id,jdbcType=BIGINT}
|
|
|
+ </foreach>
|
|
|
+ </update>
|
|
|
+ <select id="selectProdIOCode" resultType="java.lang.String">
|
|
|
+ SELECT PI_INOUTNO FROM PRODINOUT
|
|
|
+ <where>
|
|
|
+ <if test="code!=null">
|
|
|
+ AND PI_TEXT1 = #{code}
|
|
|
+ </if>
|
|
|
+ <if test="type!=null">
|
|
|
+ AND PI_CLASS = #{type}
|
|
|
+ </if>
|
|
|
+ <if test="companyId!=null">
|
|
|
+ AND COMPANYID = #{companyId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectOrderCountByProdCode" resultType="java.lang.Long">
|
|
|
+ SELECT COUNT(*) FROM PRODINOUT LEFT JOIN PRODIODETAIL ON PI_ID=PD_PIID AND PRODINOUT.COMPANYID=PRODIODETAIL.COMPANYID
|
|
|
+ WHERE COMPANYID = #{companyId} AND PD_PRODID = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <delete id="deleteProdIOByCode" >
|
|
|
+ DELETE FROM PRODINOUT WHERE PI_TEXT1=#{code} AND COMPANYID = #{companyId}
|
|
|
+ </delete>
|
|
|
+ <delete id="deleteProdIODetailByCode">
|
|
|
+ DELETE FROM PRODIODETAIL WHERE PD_PIID IN (SELECT PI_ID FROM PRODINOUT WHERE PI_TEXT1=#{code} AND PRODINOUT.COMPANYID = #{companyId}) AND PRODIODETAIL.COMPANYID = #{companyId}
|
|
|
+ </delete>
|
|
|
</mapper>
|
|
|
|