insert into business_purchase_apply
(operate, res_order_type, description, apply_order_id, state, store_id, user_id, user_name, b_id, end_user_name,
end_user_tel, community_id)
values (#{operate}, #{resOrderType}, #{description}, #{applyOrderId}, #{state}, #{storeId}, #{userId},
#{userName}, #{bId}, #{endUserName}, #{endUserTel}, #{communityId})
insert into business_purchase_apply_detail (apply_order_id,res_id,quantity,remark,b_id,operate,status_cd)
values
(
#{item.applyOrderId},
#{item.resId},
#{item.quantity},
#{item.remark},
#{item.bId},
#{item.operate},
#{item.statusCd}
)
INSERT INTO purchase_apply_detail (
id, rs_id, apply_order_id, res_id, quantity, remark, b_id, operate, status_cd, price,
purchase_quantity, purchase_remark, original_stock, times_id, consult_price,
purchase_date2, purchase_quantity2, purchase_date3, purchase_quantity3,
first_cumulative_purchase_quantity, purchase_date, purchase_amount, purchaser,
contract_no, supplier, first_cumulative_delivery_quantity, delivery_order_no,
delivery_quantity, delivery_date, signer
)
VALUES
(
#{item.id},
#{item.rsId},
#{item.applyOrderId},
#{item.resId},
#{item.quantity},
#{item.remark},
'-1',
'ADD',
'0',
#{item.price},
#{item.purchaseQuantity},
#{item.purchaseRemark},
#{item.originalStock},
#{item.timesId},
#{item.consultPrice},
#{item.purchaseDate2},
#{item.purchaseQuantity2},
#{item.purchaseDate3},
#{item.purchaseQuantity3},
#{item.firstCumulativePurchaseQuantity},
#{item.purchaseDate},
#{item.purchaseAmount},
#{item.purchaser},
#{item.contractNo},
#{item.supplier},
#{item.firstCumulativeDeliveryQuantity},
#{item.deliveryOrderNo},
#{item.deliveryQuantity},
#{item.deliveryDate},
#{item.signer}
)
;
insert into purchase_apply
(res_order_type,description,apply_order_id,status_cd,state,store_id,user_name,b_id,user_id,end_user_name,end_user_tel,community_id)
select
t.res_order_type,t.description,t.apply_order_id,'0',t.state,t.store_id,t.user_name,t.b_id,t.user_id,t.end_user_name,t.end_user_tel,
t.community_id
from business_purchase_apply t where 1=1
and t.operate= 'ADD'
and t.res_order_type= #{resOrderType}
and t.description= #{description}
and t.apply_order_id= #{applyOrderId}
and t.state= #{state}
and t.store_id= #{storeId}
and t.b_id= #{bId}
and t.user_id= #{userId}
and t.community_id= #{communityId}
update purchase_apply t set t.status_cd = #{statusCd}
,t.b_id = #{newBId}
, t.apply_detail_id= #{applyDetailId}
, t.res_order_type= #{resOrderType}
, t.description= #{description}
, t.state= #{state}
, t.store_id= #{storeId}
, t.user_id= #{userId}
, t.end_user_name= #{endUserName}
, t.end_user_tel= #{endUserTel}
, t.community_id= #{communityId}
where 1=1
and t.apply_order_id= #{applyOrderId}
and t.b_id= #{bId}
INSERT INTO purchase_apply (
status_cd, res_order_type, description, apply_order_id, state, store_id, user_id, user_name, b_id,
end_user_name, end_user_tel,
create_time, create_user_id, create_user_name, warehousing_way, community_id,
apply_no, apply_date, approver, apply_quantity
)
VALUES (
'0', #{resOrderType}, #{description}, #{applyOrderId}, #{state}, #{storeId}, #{userId}, #{userName}, '-1',
#{endUserName}, #{endUserTel}, #{createTime}, #{createUserId}, #{createUserName}, #{warehousingWay}, #{communityId},
#{applyNo}, #{applyDate}, #{approver}, #{applyQuantity}
);
update ACT_RU_TASK t set SUSPENSION_STATE_=1
,t.ASSIGNEE_ = #{assigneeUser}
where 1=1
and t.ID_= #{actRuTaskId}