a.shelf_order_id, a.organization_id, a.organization_name, a.top_organization_id,
a.in_order_number, a.receipt_order_number,a.receipt_task_number, a.shelf_order_number,a.status, a.receipt_quantity, a.shelves_quantity, a.material_quantity,
a.shelves_material_quantity, a.abnormal,a.task_distribution, a.task_distribution_time, a.operators_by, a.remark, a.create_time, a.create_by,
a.create_by_name, a.update_time, a.update_by, a.update_by_name, a.del_flag
,a.push_status,a.push_time,a.push_by,a.push_by_name,
(SELECT m.goods_type FROM shelf_material_detail d
JOIN material_base_info m ON d.material_base_info_id = m.material_base_info_id
WHERE d.shelf_order_number = a.shelf_order_number AND d.level = 1
LIMIT 1) AS goods_type
and a.shelf_order_id = #{shelfOrderId}
and a.organization_id = #{organizationId}
and a.organization_name like concat('%', #{organizationName}, '%')
and a.top_organization_id = #{topOrganizationId}
and a.in_order_number = #{inOrderNumber}
and a.receipt_order_number like concat('%', #{receiptOrderNumber}, '%')
and a.receipt_task_number = #{receiptTaskNumber}
and a.shelf_order_number like concat('%', #{shelfOrderNumber}, '%')
and a.status = #{status}
and a.status < #{ltStatus}
and a.status > #{gtStatus}
and a.shelves_quantity = #{shelvesQuantity}
and a.abnormal = #{abnormal}
and a.task_distribution = #{taskDistribution}
and a.operators_by = #{operatorsBy}
and a.create_by_name like concat('%', #{createByName}, '%')
and a.update_by_name like concat('%', #{updateByName}, '%')
and a.shelf_order_id in
#{item}
and date_format(a.create_time,'%Y-%m-%d') >= #{createTimeStart}
and date_format(a.create_time,'%Y-%m-%d') <= #{createTimeEnd}
and a.create_time =]]> #{createTimeFrom}
and a.create_time #{createTimeTo}
and a.PUSH_TIME =]]> #{pushTimeFrom}
and a.PUSH_TIME #{pushTimeTo}
and a.PUSH_STATUS = #{pushStatus}
and a.del_flag = #{delFlag} and a.del_flag = 1
and c.receipt_order_number like concat('%', #{receiptOrderNumber}, '%')
update "NGWL_TEST_OMS".RESERVATION_STOCK_IN_ORDER set ISSUE_STATUS = #{status},in_quantity = #{shelvesQuantity},STORAGE_TIME = CURRENT_TIMESTAMP where IN_ORDER_NUMBER = #{orderNumber} and DELETE_FLAG = 1
update "NGWL_TEST_OMS".EXECUTION_STOCK_IN_ORDER set ISSUE_STATUS = #{status},in_quantity = #{shelvesQuantity},STORAGE_TIME = CURRENT_TIMESTAMP where IN_ORDER_NUMBER = #{orderNumber} and DELETE_FLAG = 1
update "NGWL_TEST_OMS".RESERVE_STOCK_IN_ORDER set in_quantity = #{shelvesQuantity},STORAGE_TIME = CURRENT_TIMESTAMP where IN_ORDER_NUMBER = #{orderNumber} and DELETE_FLAG = 1
update "NGWL_TEST_OMS".RESERVATION_IN_MATERIAL_DETAIL set INBOUND_ITEMS = #{shelvesQuantity}, TOTAL_NET_WEIGHT= #{totalNetWeight},STORAGE_TIME = CURRENT_TIMESTAMP where MATERIAL_DETAIL_ID = #{omsInMaterialDetail} and DELETE_FLAG = 1
update "NGWL_TEST_OMS".RESERVATION_OUT_MATERIAL_DETAIL set INBOUND_ITEMS = #{checkQuantity},
TOTAL_NET_WEIGHT= #{totalNetWeight}
,STORAGE_TIME = CURRENT_TIMESTAMP
where OUT_ORDER_NUMBER = #{outOrderNumber} and UNIQUE_ID = #{uniqueId} and DELETE_FLAG = 1
update "NGWL_TEST_OMS".RESERVATION_IN_MATERIAL_DETAIL set INBOUND_ITEMS = #{shelvesQuantity}, TOTAL_NET_WEIGHT= #{totalNetWeight},STORAGE_TIME = CURRENT_TIMESTAMP
where LOT_NO = #{lotNumber} and DELETE_FLAG = 1
update "NGWL_TEST_OMS".RESERVATION_MATERIAL_INVENTORY set INVENTORY_QUANTITY = #{quantity},
ALLOCATION_QUANTITY= #{quantity}
where IN_ORDER_NUMBER = #{inOrderNumber} and LOT_NUMBER = #{lotNumber} and DELETE_FLAG = 1
update "NGWL_TEST_OMS".RESERVATION_MATERIAL_INVENTORY set INVENTORY_QUANTITY = INVENTORY_QUANTITY - #{checkQuantity},
ALLOCATION_QUANTITY= ALLOCATION_QUANTITY - #{checkQuantity}
where IN_ORDER_NUMBER = #{inOrderNumber} and LOT_NUMBER = #{lotNo} and DELETE_FLAG = 1