完善关联请购单中的数量计算逻辑

This commit is contained in:
jishenghua
2024-04-23 00:44:25 +08:00
parent eeec934787
commit 6fad68f20c
8 changed files with 180 additions and 38 deletions

View File

@@ -31,6 +31,7 @@
<result column="purchase_status" jdbcType="VARCHAR" property="purchaseStatus" />
<result column="source" jdbcType="VARCHAR" property="source" />
<result column="link_number" jdbcType="VARCHAR" property="linkNumber" />
<result column="link_apply" jdbcType="VARCHAR" property="linkApply" />
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
<result column="delete_flag" jdbcType="VARCHAR" property="deleteFlag" />
</resultMap>
@@ -97,7 +98,7 @@
account_id, change_amount, back_amount, total_price, pay_type, bill_type, remark,
file_name, sales_man, account_id_list, account_money_list, discount, discount_money,
discount_last_money, other_money, deposit, status, purchase_status, source, link_number,
tenant_id, delete_flag
link_apply, tenant_id, delete_flag
</sql>
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.DepotHeadExample" resultMap="BaseResultMap">
select
@@ -139,8 +140,8 @@
account_id_list, account_money_list, discount,
discount_money, discount_last_money, other_money,
deposit, status, purchase_status,
source, link_number, tenant_id,
delete_flag)
source, link_number, link_apply,
tenant_id, delete_flag)
values (#{id,jdbcType=BIGINT}, #{type,jdbcType=VARCHAR}, #{subType,jdbcType=VARCHAR},
#{defaultNumber,jdbcType=VARCHAR}, #{number,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{operTime,jdbcType=TIMESTAMP}, #{organId,jdbcType=BIGINT}, #{creator,jdbcType=BIGINT},
@@ -150,8 +151,8 @@
#{accountIdList,jdbcType=VARCHAR}, #{accountMoneyList,jdbcType=VARCHAR}, #{discount,jdbcType=DECIMAL},
#{discountMoney,jdbcType=DECIMAL}, #{discountLastMoney,jdbcType=DECIMAL}, #{otherMoney,jdbcType=DECIMAL},
#{deposit,jdbcType=DECIMAL}, #{status,jdbcType=VARCHAR}, #{purchaseStatus,jdbcType=VARCHAR},
#{source,jdbcType=VARCHAR}, #{linkNumber,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT},
#{deleteFlag,jdbcType=VARCHAR})
#{source,jdbcType=VARCHAR}, #{linkNumber,jdbcType=VARCHAR}, #{linkApply,jdbcType=VARCHAR},
#{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.DepotHead">
insert into jsh_depot_head
@@ -243,6 +244,9 @@
<if test="linkNumber != null">
link_number,
</if>
<if test="linkApply != null">
link_apply,
</if>
<if test="tenantId != null">
tenant_id,
</if>
@@ -338,6 +342,9 @@
<if test="linkNumber != null">
#{linkNumber,jdbcType=VARCHAR},
</if>
<if test="linkApply != null">
#{linkApply,jdbcType=VARCHAR},
</if>
<if test="tenantId != null">
#{tenantId,jdbcType=BIGINT},
</if>
@@ -442,6 +449,9 @@
<if test="record.linkNumber != null">
link_number = #{record.linkNumber,jdbcType=VARCHAR},
</if>
<if test="record.linkApply != null">
link_apply = #{record.linkApply,jdbcType=VARCHAR},
</if>
<if test="record.tenantId != null">
tenant_id = #{record.tenantId,jdbcType=BIGINT},
</if>
@@ -484,6 +494,7 @@
purchase_status = #{record.purchaseStatus,jdbcType=VARCHAR},
source = #{record.source,jdbcType=VARCHAR},
link_number = #{record.linkNumber,jdbcType=VARCHAR},
link_apply = #{record.linkApply,jdbcType=VARCHAR},
tenant_id = #{record.tenantId,jdbcType=BIGINT},
delete_flag = #{record.deleteFlag,jdbcType=VARCHAR}
<if test="_parameter != null">
@@ -577,6 +588,9 @@
<if test="linkNumber != null">
link_number = #{linkNumber,jdbcType=VARCHAR},
</if>
<if test="linkApply != null">
link_apply = #{linkApply,jdbcType=VARCHAR},
</if>
<if test="tenantId != null">
tenant_id = #{tenantId,jdbcType=BIGINT},
</if>
@@ -616,6 +630,7 @@
purchase_status = #{purchaseStatus,jdbcType=VARCHAR},
source = #{source,jdbcType=VARCHAR},
link_number = #{linkNumber,jdbcType=VARCHAR},
link_apply = #{linkApply,jdbcType=VARCHAR},
tenant_id = #{tenantId,jdbcType=BIGINT},
delete_flag = #{deleteFlag,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}

View File

@@ -944,8 +944,13 @@
in
(
select dh.id from jsh_depot_head dh
where
dh.link_number=#{linkNumber}
where 1=1
<if test="noType == 'normal'">
and dh.link_number=#{linkStr}
</if>
<if test="noType == 'apply'">
and dh.link_apply=#{linkStr}
</if>
and ifnull(dh.delete_flag,'0') !='1'
<if test="goToType != null and goToType !=''">
and dh.sub_type=#{goToType}
@@ -963,8 +968,13 @@
(
select dh.id from jsh_depot_head dh
where
dh.link_number=#{linkNumber}
and dh.id!=#{currentHeaderId}
dh.id!=#{currentHeaderId}
<if test="linkType == 'normal'">
and dh.link_number=#{linkStr}
</if>
<if test="linkType == 'apply'">
and dh.link_apply=#{linkStr}
</if>
and ifnull(dh.delete_flag,'0') !='1'
<if test="goToType != null and goToType !=''">
and dh.sub_type=#{goToType}
@@ -1017,7 +1027,7 @@
<select id="getLinkBillDetailMaterialSum" resultMap="materialSumMap">
select di.material_extend_id, sum(di.oper_number) oper_number from jsh_depot_head dh
left join jsh_depot_item di on dh.id=di.header_id and ifnull(di.delete_flag,'0') !='1'
where dh.number=#{linkNumber}
where dh.number=#{linkStr}
and ifnull(dh.delete_flag,'0') !='1'
group by di.material_extend_id
</select>
@@ -1025,8 +1035,14 @@
<select id="getBatchBillDetailMaterialSum" resultMap="materialSumMap">
select di.material_extend_id, sum(di.oper_number) oper_number from jsh_depot_head dh
left join jsh_depot_item di on dh.id=di.header_id and ifnull(di.delete_flag,'0') !='1'
where dh.link_number=#{linkNumber} and dh.type=#{type}
and ifnull(dh.delete_flag,'0') !='1'
where dh.type=#{type}
<if test="linkType == 'normal'">
and dh.link_number=#{linkStr}
</if>
<if test="linkType == 'apply'">
and dh.link_apply=#{linkStr}
</if>
and ifnull(dh.delete_flag,'0') !='1'
group by di.material_extend_id
</select>