|
|
@@ -40,6 +40,7 @@
|
|
|
<result column="pd_text5" jdbcType="VARCHAR" property="pd_text5" />
|
|
|
<result column="pd_ym" jdbcType="INTEGER" property="pd_ym" />
|
|
|
<result column="pd_yqty" jdbcType="INTEGER" property="pd_yqty" />
|
|
|
+ <result column="pd_ioid" jdbcType="INTEGER" property="pd_ioid" />
|
|
|
</resultMap>
|
|
|
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.usoftchina.saas.purchase.po.ProdIODetail">
|
|
|
<result column="pd_remark" jdbcType="LONGVARCHAR" property="pd_remark" />
|
|
|
@@ -107,7 +108,7 @@
|
|
|
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_text1, pd_text2, pd_text3, pd_text4, pd_text5, pd_ym, pd_yqty,pd_ioid
|
|
|
</sql>
|
|
|
<sql id="Blob_Column_List">
|
|
|
pd_remark
|
|
|
@@ -173,7 +174,7 @@
|
|
|
pd_status, companyid, updaterid,
|
|
|
updatetime, pd_text1, pd_text2,
|
|
|
pd_text3, pd_text4, pd_text5,
|
|
|
- pd_ym, pd_yqty, pd_remark
|
|
|
+ pd_ym, pd_yqty, pd_remark,pd_ioid
|
|
|
)
|
|
|
values (#{pd_id,jdbcType=INTEGER}, #{pd_piid,jdbcType=INTEGER}, #{pd_inoutno,jdbcType=VARCHAR},
|
|
|
#{pd_piclass,jdbcType=VARCHAR}, #{pd_pdno,jdbcType=INTEGER}, #{pd_ordercode,jdbcType=VARCHAR},
|
|
|
@@ -187,7 +188,8 @@
|
|
|
#{pd_status,jdbcType=INTEGER}, #{companyid,jdbcType=INTEGER}, #{updaterid,jdbcType=INTEGER},
|
|
|
#{updatetime,jdbcType=TIMESTAMP}, #{pd_text1,jdbcType=VARCHAR}, #{pd_text2,jdbcType=VARCHAR},
|
|
|
#{pd_text3,jdbcType=VARCHAR}, #{pd_text4,jdbcType=VARCHAR}, #{pd_text5,jdbcType=VARCHAR},
|
|
|
- #{pd_ym,jdbcType=INTEGER}, #{pd_yqty,jdbcType=INTEGER}, #{pd_remark,jdbcType=LONGVARCHAR}
|
|
|
+ #{pd_ym,jdbcType=INTEGER}, #{pd_yqty,jdbcType=INTEGER}, #{pd_remark,jdbcType=LONGVARCHAR},
|
|
|
+ #{pd_ioid,jdbcType=INTEGER}
|
|
|
)
|
|
|
</insert>
|
|
|
<insert id="insertSelective" parameterType="com.usoftchina.saas.purchase.po.ProdIODetail">
|
|
|
@@ -311,6 +313,11 @@
|
|
|
<if test="pd_remark != null">
|
|
|
pd_remark,
|
|
|
</if>
|
|
|
+ <if test="pd_ioid != null">
|
|
|
+ pd_ioid,
|
|
|
+ </if>
|
|
|
+
|
|
|
+
|
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
|
@@ -428,6 +435,9 @@
|
|
|
<if test="pd_remark != null">
|
|
|
#{pd_remark,jdbcType=LONGVARCHAR},
|
|
|
</if>
|
|
|
+ <if test="pd_ioid != null">
|
|
|
+ #{pd_ioid,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
</trim>
|
|
|
</insert>
|
|
|
<select id="countByExample" parameterType="com.usoftchina.saas.purchase.po.ProdIODetailExample" resultType="java.lang.Long">
|
|
|
@@ -556,6 +566,10 @@
|
|
|
<if test="record.pd_remark != null">
|
|
|
pd_remark = #{record.pd_remark,jdbcType=LONGVARCHAR},
|
|
|
</if>
|
|
|
+ <if test="record.pd_ioid != null">
|
|
|
+ pd_ioid = #{record.pd_ioid,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+
|
|
|
</set>
|
|
|
<if test="_parameter != null">
|
|
|
<include refid="Update_By_Example_Where_Clause" />
|
|
|
@@ -601,7 +615,8 @@
|
|
|
pd_text5 = #{record.pd_text5,jdbcType=VARCHAR},
|
|
|
pd_ym = #{record.pd_ym,jdbcType=INTEGER},
|
|
|
pd_yqty = #{record.pd_yqty,jdbcType=INTEGER},
|
|
|
- pd_remark = #{record.pd_remark,jdbcType=LONGVARCHAR}
|
|
|
+ pd_remark = #{record.pd_remark,jdbcType=LONGVARCHAR},
|
|
|
+ pd_ioid = #{record.pd_ioid,jdbcType=INTEGER}
|
|
|
<if test="_parameter != null">
|
|
|
<include refid="Update_By_Example_Where_Clause" />
|
|
|
</if>
|
|
|
@@ -645,7 +660,8 @@
|
|
|
pd_text4 = #{record.pd_text4,jdbcType=VARCHAR},
|
|
|
pd_text5 = #{record.pd_text5,jdbcType=VARCHAR},
|
|
|
pd_ym = #{record.pd_ym,jdbcType=INTEGER},
|
|
|
- pd_yqty = #{record.pd_yqty,jdbcType=INTEGER}
|
|
|
+ pd_yqty = #{record.pd_yqty,jdbcType=INTEGER},
|
|
|
+ pd_ioid = #{record.pd_ioid,jdbcType=INTEGER}
|
|
|
<if test="_parameter != null">
|
|
|
<include refid="Update_By_Example_Where_Clause" />
|
|
|
</if>
|
|
|
@@ -734,14 +750,14 @@
|
|
|
<if test="pd_status != null">
|
|
|
pd_status = #{pd_status,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
- <if test="companyid != null">
|
|
|
- companyid = #{companyid,jdbcType=INTEGER},
|
|
|
+ <if test="companyId != null">
|
|
|
+ companyid = #{companyId,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
- <if test="updaterid != null">
|
|
|
- updaterid = #{updaterid,jdbcType=INTEGER},
|
|
|
+ <if test="updaterId != null">
|
|
|
+ updaterid = #{updaterId,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
- <if test="updatetime != null">
|
|
|
- updatetime = #{updatetime,jdbcType=TIMESTAMP},
|
|
|
+ <if test="updateTime != null">
|
|
|
+ updatetime = #{updateTime,jdbcType=TIMESTAMP},
|
|
|
</if>
|
|
|
<if test="pd_text1 != null">
|
|
|
pd_text1 = #{pd_text1,jdbcType=VARCHAR},
|
|
|
@@ -767,8 +783,11 @@
|
|
|
<if test="pd_remark != null">
|
|
|
pd_remark = #{pd_remark,jdbcType=LONGVARCHAR},
|
|
|
</if>
|
|
|
+ <if test="pd_ioid != null">
|
|
|
+ pd_ioid = #{pd_ioid,jdbcType=LONGVARCHAR},
|
|
|
+ </if>
|
|
|
</set>
|
|
|
- where pd_id = #{pd_id,jdbcType=INTEGER}
|
|
|
+ where pd_id = #{id,jdbcType=INTEGER}
|
|
|
</update>
|
|
|
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.usoftchina.saas.purchase.po.ProdIODetail">
|
|
|
update prodiodetail
|
|
|
@@ -809,7 +828,8 @@
|
|
|
pd_text5 = #{pd_text5,jdbcType=VARCHAR},
|
|
|
pd_ym = #{pd_ym,jdbcType=INTEGER},
|
|
|
pd_yqty = #{pd_yqty,jdbcType=INTEGER},
|
|
|
- pd_remark = #{pd_remark,jdbcType=LONGVARCHAR}
|
|
|
+ pd_remark = #{pd_remark,jdbcType=LONGVARCHAR},
|
|
|
+ pd_ioid = #{pd_ioid,jdbcType=INTEGER}
|
|
|
where pd_id = #{pd_id,jdbcType=INTEGER}
|
|
|
</update>
|
|
|
<update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.purchase.po.ProdIODetail">
|
|
|
@@ -850,7 +870,8 @@
|
|
|
pd_text4 = #{pd_text4,jdbcType=VARCHAR},
|
|
|
pd_text5 = #{pd_text5,jdbcType=VARCHAR},
|
|
|
pd_ym = #{pd_ym,jdbcType=INTEGER},
|
|
|
- pd_yqty = #{pd_yqty,jdbcType=INTEGER}
|
|
|
+ pd_yqty = #{pd_yqty,jdbcType=INTEGER},
|
|
|
+ pd_ioid = #{pd_ioid,jdbcType=INTEGER}
|
|
|
where pd_id = #{pd_id,jdbcType=INTEGER}
|
|
|
</update>
|
|
|
|
|
|
@@ -927,15 +948,10 @@
|
|
|
</update>
|
|
|
|
|
|
<update id="updatePurchaseYqty" parameterType="java.lang.Long">
|
|
|
- update purchasedetail
|
|
|
- join
|
|
|
- (select b.yqty,b.pd_orderid FROM
|
|
|
- (select pd_orderid from prodiodetail where pd_piid = #{id,jdbcType=INTEGER}) a
|
|
|
- left join
|
|
|
- (select sum(pd_inqty)-sum(pd_outqty) yqty,pd_orderid from prodiodetail left join prodinout on pd_piid = pi_id where pi_statuscode='AUDITED'
|
|
|
- GROUP BY pd_orderid) b on a.pd_orderid = b.pd_orderid) c
|
|
|
- on pd_id = c.pd_orderid
|
|
|
- set PD_YQTY = c.yqty
|
|
|
+
|
|
|
+update prodiodetail a
|
|
|
+set a.pd_yqty =ifnull((select b.pd_outqty from (select pd_outqty,pd_ioid from prodiodetail where pd_piclass='采购验退单') b where ifnull(b.pd_ioid ,0)= a.pd_id ),0)
|
|
|
+where a.pd_piid = #{id,jdbcType=INTEGER}
|
|
|
</update>
|
|
|
|
|
|
|