SELECT
ri.id,
ri.bill_no,
ri.bill_no_ck,
ri.rk_type, st.type_name AS rk_type_name,
ri.wl_type, mt.type_name AS wl_type_name,
ri.cangku, wh.warehouse_name AS cangku_name,
ri.rk_time, ri.lihuo_y, ri.is_chuku, ri.is_borrowed,ri.remark,
ri.ck_lihuo_y, ri.ck_type, sot.type_name AS ck_type_name,
ri.team_code, ct.team_name,
ri.ck_remark,
ri.ly_time,
ri.borrow_time, ri.return_time,
ri.xj, ri.xm_no, ri.xm_ms, ri.wl_no, ri.wl_ms,ri.xm_no_ck, ri.xm_ms_ck,
ri.gys_no, ri.gys_mc, ri.jh_amt, ri.ht_dj, ri.sap_no, ri.xh,
ri.jh_qty, ri.ht_qty, ri.dw, ri.real_qty,
ri.pcode, ri.pcode_id, ri.tray_code, ri.entity_id,
ri.create_by, ri.create_time, ri.update_by, ri.update_time, ri.is_delete,
u.user_name AS lihuo_y_name
FROM rk_info ri
LEFT JOIN stock_in_type st ON ri.rk_type = st.type_code
LEFT JOIN material_type mt ON ri.wl_type = mt.type_code
LEFT JOIN warehouse_info wh ON ri.cangku = wh.warehouse_code
LEFT JOIN stock_out_type sot ON ri.ck_type = sot.type_code
LEFT JOIN construction_team ct ON ri.team_code = ct.team_code
LEFT JOIN sys_user u ON ri.lihuo_y = u.user_id
INSERT INTO rk_info (
bill_no,
rk_type, wl_type, cangku, lihuo_y, rk_time,
wl_no, wl_ms, xm_no, xm_ms,
xm_no_ck, xm_ms_ck, xj, sap_no, gys_no, gys_mc,
jh_qty, ht_qty, jh_amt, ht_dj, dw,
borrow_time, return_time, status,
pcode, pcode_id, tray_code, real_qty, entity_id,
remark, is_chuku, is_borrowed, gys_jh_id,
is_delete, create_by, create_time
)
VALUES
(
#{item.billNo},
#{item.rkType}, #{item.wlType}, #{item.cangku}, #{item.lihuoY}, #{item.rkTime},
#{item.wlNo}, #{item.wlMs}, #{item.xmNo}, #{item.xmMs},
#{item.xmNoCk}, #{item.xmMsCk}, #{item.xj}, #{item.sapNo}, #{item.gysNo}, #{item.gysMc},
#{item.jhQty}, #{item.htQty}, #{item.jhAmt}, #{item.htDj}, #{item.dw},
#{item.borrowTime}, #{item.returnTime}, #{item.status},
#{item.pcode}, #{item.pcodeId}, #{item.trayCode}, #{item.realQty}, #{item.entityId},
#{item.remark}, #{item.isChuku}, #{item.isBorrowed}, #{item.gysJhId},
#{item.isDelete}, #{item.createBy}, #{item.createTime}
)
INSERT INTO rk_info (
rk_type, wl_type, cangku, rk_time, lihuo_y,
is_chuku, remark, bill_no, xj, xm_no, xm_ms,is_borrowed,
wl_no, wl_ms, gys_no, gys_mc, jh_amt, ht_dj,
sap_no, xh, jh_qty, ht_qty, dw, real_qty,
pcode, tray_code, entity_id,
ck_lihuo_y, ck_type, team_code, ck_remark,
ly_time, bill_no_ck, has_moved,
create_by, create_time, update_by, update_time, is_delete
) VALUES (
#{rkType}, #{wlType}, #{cangku}, #{rkTime}, #{lihuoY},
#{isChuku}, #{remark}, #{billNo}, #{xj}, #{xmNo}, #{xmMs},#{isBorrowed},
#{wlNo}, #{wlMs}, #{gysNo}, #{gysMc}, #{jhAmt}, #{htDj},
#{sapNo}, #{xh}, #{jhQty}, #{htQty}, #{dw}, #{realQty},
#{pcode}, #{trayCode}, #{entityId},
#{ckLihuoY}, #{ckType}, #{teamCode}, #{ckRemark},
#{lyTime}, #{billNoCk}, #{hasMoved},
#{createBy}, #{createTime}, #{updateBy}, #{updateTime}, #{isDelete}
)
UPDATE rk_info
SET
is_chuku = '0',
bill_no_ck = NULL,
ck_lihuo_y = NULL,
ck_type = NULL,
team_code = NULL,
ly_time = NULL,
ck_remark = NULL,
is_borrowed = NULL,
update_time = NOW()
WHERE bill_no_ck = #{billNoCk}
DELETE FROM rk_info
WHERE bill_no = #{billNo}
update rk_info
rk_type = #{rkType},
wl_type = #{wlType},
cangku = #{cangku},
rk_time = #{rkTime},
lihuo_y = #{lihuoY},
is_chuku = #{isChuku},
is_borrowed = #{isBorrowed},
bill_no = #{billNo},
remark = #{remark},
xj = #{xj},
xm_no = #{xmNo},
xm_ms = #{xmMs},
xm_no_ck = #{xmNoCk},
xm_ms_ck = #{xmMsCk},
wl_no = #{wlNo},
wl_ms = #{wlMs},
gys_no = #{gysNo},
gys_mc = #{gysMc},
jh_amt = #{jhAmt},
ht_dj = #{htDj},
sap_no = #{sapNo},
xh = #{xh},
jh_qty = #{jhQty},
ht_qty = #{htQty},
dw = #{dw},
real_qty = #{realQty},
pcode = #{pcode},
tray_code = #{trayCode},
entity_id = #{entityId},
ck_lihuo_y = #{ckLihuoY},
ck_type = #{ckType},
ly_time = #{lyTime},
borrow_time = #{borrowTime},
return_time = #{returnTime},
ck_remark = #{ckRemark},
has_moved = #{hasMoved},
update_by = #{updateBy},
update_time = #{updateTime},
is_delete = #{isDelete},
where id = #{id}
update rk_info
is_delete = 1
where id = #{id}
update rk_info
set is_delete = 1
where id in
#{id}
UPDATE rk_info
is_chuku = #{isChuku},
is_borrowed = #{isBorrowed},
bill_no_ck = #{billNoCk},
ck_type = #{ckType},
ck_lihuo_y = #{ckLihuoY},
team_code = #{teamCode},
ck_remark = #{ckRemark},
xm_no_ck = #{xmNoCk},
xm_ms_ck = #{xmMsCk},
update_by = #{updateBy},
update_time = #{updateTime},
ly_time = #{lyTime},
borrow_time = #{borrowTime},
return_time = #{returnTime},
status = #{status},
WHERE id = #{id}
UPDATE rk_info
status = #{status},
is_chuku = #{isChuku},
update_by = #{updateBy},
update_time = #{updateTime},
bill_no = #{billNo}
bill_no_ck = #{billNoCk}
UPDATE rk_info
SET is_delete = #{isDelete},
status = #{status},
update_by = #{updateBy},
update_time = #{updateTime}
WHERE bill_no = #{billNo}
AND status IN ('0', '2')
UPDATE rk_info
SET is_delete = #{isDelete},
status = #{status},
update_by = #{updateBy},
update_time = #{updateTime}
WHERE bill_no_ck = #{billNoCk}
AND status IN ('0', '2')
UPDATE rk_info
SET status = #{status},
is_chuku = #{isChuku},
update_by = #{updateBy},
update_time = #{updateTime}
WHERE bill_no_ck = #{billNoCk}
AND is_delete = '0'
AND bill_no IS NOT NULL