a.contract_fee , a.monthly_warehouse_fee , a.half_month_wh_fee , a.discount_rate , a.single_volume , a.single_gross_weight , a.lot_no , a.stock_quantity , a.stock_unit ,a.in_order_number , a.material_detail_id, a.organization_id, a.organization_name, a.top_organization_id, a.unique_id, a.out_order_number, a.material_base_info_id, a.line_number, a.material_code, a.material_name, a.bar_code, a.weight_limit, a.volume_limit, a.quantity, a.already_allocation_quantity, a.allocation_quantity, a.picking_quantity, a.check_quantity, ROUND(GREATEST(0, IFNULL(a.quantity, 0) - IFNULL(a.check_quantity, 0), IFNULL(a.picking_quantity, 0) - IFNULL(a.check_quantity, 0)), 2) AS wait_check_quantity, a.pack_id, a.pack_code, a.pack_name, a.pack_detail_id, a.unit_code, a.unit_name, a.material_warehouse_control_id, a.serial_number_manage, a.warehouse_id, a.warehouse_code, a.warehouse_name, a.storage_section_id, a.storage_code, a.storage_name, a.storage_location_id, a.storage_location_code, a.storage_location_name, a.level, a.parent_unique_id, a.allow_modify, a.material_inventory_id, a.batch_number, a.container_id, a.container_code, a.container_type, a.container_type_name, a.material_status_code, a.material_status_name, a.remark, a.create_time, a.create_by,gen_picking_order, a.create_by_name, a.update_time, a.update_by, a.update_by_name, a.del_flag, a.over_stock_id, a.over_stock_status, a.over_stock_type, a.COMMODITY_NAME, a.COMMODITY_NO, a.MATERIAL_NO , a.SPECIFICATION_MODEL, a.SKUCODE , a.INVOICE_NO, a.LITER, a.SIZE, a.DECLARE_UNIT, a.BATCH_REF_NO, a.SHEET_REF_NO, a.COUNTRY_OF_ORIGIN, a.BOX_PALLET_NO, a.CURRENCY, a.DECLARE_QUANTITY, a.CASE_COUNT, a.PIECE_COUNT, a.OUTBOUND_QUANTITY, a.TOTAL_NET_WEIGHT, a.TOTAL_GROSS_WEIGHT, a.TOTAL_VOLUME, a.TOTAL_AREA, a.TOTAL_AMOUNT, a.UNIT, a.EXT_ATTR_1, a.EXT_ATTR_2, a.PRODUCTION_DATE, a.EXPIRY_DATE, a.INVENTORY_DATE, a.EXT_ATTR_3, a.EXT_ATTR_4, a.COPY_TOTAL_WEIGHT, a.INVENTORY_QUANTITY and a.organization_id = #{organizationId} and a.organization_name like concat('%', #{organizationName}, '%') and a.top_organization_id = #{topOrganizationId} and a.out_order_number = #{outOrderNumber} and a.material_base_info_id = #{materialBaseInfoId} and a.material_code = #{materialCode} and a.material_name like concat('%', #{materialName}, '%') and a.bar_code = #{barCode} and a.quantity = #{quantity} and a.allocation_quantity = #{allocationQuantity} and a.picking_quantity = #{pickingQuantity} and a.check_quantity = #{checkQuantity} and a.pack_id = #{packId} and a.pack_code = #{packCode} and a.pack_name like concat('%', #{packName}, '%') and a.pack_detail_id = #{packDetailId} and a.unit_code = #{unitCode} and a.unit_name like concat('%', #{unitName}, '%') and a.material_warehouse_control_id = #{materialWarehouseControlId} and a.serial_number_manage = #{serialNumberManage} and a.warehouse_id = #{warehouseId} and a.warehouse_code = #{warehouseCode} and a.warehouse_name like concat('%', #{warehouseName}, '%') and a.storage_section_id = #{storageSectionId} and a.storage_code = #{storageCode} and a.storage_name like concat('%', #{storageName}, '%') and a.storage_location_id = #{storageLocationId} and a.storage_location_code = #{storageLocationCode} and a.storage_location_name like concat('%', #{storageLocationName}, '%') and a.level = #{level} and a.gen_picking_order = #{genPickingOrder} and a.parent_unique_id = #{parentUniqueId} and a.create_by_name like concat('%', #{createByName}, '%') and a.update_by_name like concat('%', #{updateByName}, '%') and a.out_order_number in #{item} and a.del_flag = #{delFlag} and a.del_flag = 1 and a.organization_id = #{organizationId} and a.organization_name like concat('%', #{organizationName}, '%') and a.top_organization_id = #{topOrganizationId} and a.over_stock_status = #{overStockStatus} and a.material_base_info_id = #{materialBaseInfoId} and a.material_base_info_id in #{item} and a.del_flag = #{delFlag} and a.del_flag = 1 and b.out_order_number = #{outOrderNumber} and b.warehouse_id = #{warehouseId} and b.shipper_id = #{shipperId} and b.shipper_id in #{item} and date_format(b.expect_time,'%y%m%d') >= date_format(#{outOrderExpectStartTime},'%y%m%d') and date_format(b.expect_time,'%y%m%d') <= date_format(#{outOrderExpectEndTime},'%y%m%d') and b.order_type_code = #{outOrderTypeCode} and b.status = #{outStatus} and b.del_flag = #{delFlag} and b.del_flag = 1 UPDATE out_material_detail allocation_quantity = CASE material_detail_id WHEN #{item.materialDetailId} THEN allocation_quantity + #{item.allocationQuantity} END, update_by = #{item.updateBy}, update_by_name = #{item.updateByName}, update_time = now() WHERE material_detail_id IN #{item.materialDetailId} UPDATE out_material_detail picking_quantity = CASE material_detail_id WHEN #{item.materialDetailId} THEN picking_quantity + #{item.pickingQuantity} END, update_by = #{updateBy}, update_by_name = #{updateByName}, update_time = now() WHERE material_detail_id IN #{item.materialDetailId} UPDATE out_material_detail picking_quantity = CASE unique_id WHEN #{item.uniqueId} THEN picking_quantity + #{item.pickingQuantity} END, WHEN #{item.uniqueId} THEN picking_quantity + #{item.pickingQuantity} update_by = #{updateBy}, update_by_name = #{updateByName}, update_time = now() WHERE unique_id IN #{item.uniqueId}