a.picking_order_id, a.organization_id, a.organization_name, a.top_organization_id, a.order_number, a.picking_order_number,
a.status, a.type, a.warehouse_id, a.warehouse_code, a.warehouse_name, a.shipper_id, a.shipper_name, a.quantity, a.weight_limit, a.volume_limit, a.material_quantity,
IFNULL((SELECT SUM(b.picking_quantity) FROM picking_material_detail b WHERE b.picking_order_number = a.picking_order_number AND b.del_flag = 1), 0) AS picking_quantity,
a.picking_material_quantity, a.abnormal, a.task_distribution, a.remark, a.create_time, a.create_by, a.create_by_name, a.update_time,b.out_order_id,
a.update_by, a.update_by_name, a.del_flag, a.reverse_flag, a.out_order_number, a.business_order_no, a.order_type_code, a.order_type_name, a.priority_level_code, a.priority_level_name
,a.push_status,a.push_time,a.push_by,a.push_by_name,
(SELECT m.goods_type FROM PICKING_MATERIAL_DETAIL d
JOIN material_base_info m ON d.material_base_info_id = m.material_base_info_id
WHERE d.PICKING_ORDER_NUMBER = a.PICKING_ORDER_NUMBER and d.del_flag = 1
LIMIT 1) AS goods_type
and a.picking_order_id = #{pickingOrderId}
and a.shipper_id = #{shipperId}
and a.organization_id = #{organizationId}
and a.organization_name like concat('%', #{organizationName}, '%')
and a.top_organization_id = #{topOrganizationId}
and a.warehouse_id = #{warehouseId}
and a.warehouse_code = #{warehouseCode}
and a.warehouse_name like concat('%', #{warehouseName}, '%')
and a.order_number like concat('%', #{orderNumber}, '%')
and a.picking_order_number like concat('%', #{pickingOrderNumber}, '%')
and a.status = #{status}
and a.type = #{type}
and a.quantity = #{quantity}
and a.picking_quantity = #{pickingQuantity}
and a.abnormal = #{abnormal}
and a.task_distribution = #{taskDistribution}
and a.create_by_name like concat('%', #{createByName}, '%')
and a.update_by_name like concat('%', #{updateByName}, '%')
and a.picking_order_id in
#{item}
and a.del_flag = #{delFlag} and a.del_flag = 1 and a.reverse_flag = #{reverseFlag}
and b.need_declare_flag = #{needDeclareFlag}
and a.PUSH_TIME =]]> #{pushTimeFrom}
and a.PUSH_TIME #{pushTimeTo}
and a.create_time =]]> #{createTimeFrom}
and a.create_time #{createTimeTo}
and a.PUSH_STATUS = #{pushStatus}
UPDATE picking_order
picking_quantity = LEAST(picking_quantity + #{pickingQuantity}, quantity),
picking_material_quantity = picking_material_quantity + #{pickingMaterialQuantity},
status = #{status},
update_by = #{updateBy},
update_by_name = #{updateByName},
update_time = #{updateTime}
WHERE
picking_order_number = #{pickingOrderNumber}
AND del_flag = 1