字段拼接 装换

USE [Ecom]
GO
/****** Object:  StoredProcedure [dbo].[R_Merchant_PreOrder_ChargesData]    Script Date: 03/15/2016 13:43:10 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [dbo].[R_Merchant_PreOrder_ChargesData]
    @Type Nvarchar(400),  
    @MerchantID Nvarchar(400),
    @EffectiveDate Nvarchar(400),
    @NarmalSelling Nvarchar(400)
AS
BEGIN
    if(@Type = 'Without')
    begin
        if(@NarmalSelling = '' or @MerchantID = '')
        begin
            select 'Please Enter NarmalSelling'
            select 'Please Enter NarmalSelling'
        end
        else
        begin
        select * into #a from(
        select d.ID,
               d.MerchantID,
               d.State,
               d.EffectiveDate,
               d.ChargesType,
               d.ChargesName,
               d.ChargesCode,
               d.InvoiceCol,
               d.ValueType,
               d.Value,
               @NarmalSelling as NarmalSelling,
               Tax= Case
                    WHEN c.ValueType = 'Rate' THEN @NarmalSelling*abs(cast(c.Value as decimal(18,2)))
                    WHEN c.ValueType = 'Number' THEN @NarmalSelling-abs(cast(c.Value as decimal(18,2)))
                    ELSE '0' END,
               Comments = (select REPLACE(case when ValueType = 'Rate' then
                                   CAST(CAST(Value * 100 AS float) as nvarchar(20)) + '% ' else '$' +
                               CAST(CAST(Value as Float) as nvarchar(20)) + ' ' end, '-', '') + ChargesCode
                               from Config_Order_Charges b where d.ID = b.ID FOR xml path(''))
        from Config_Order_Charges d
        left join
        (select *
        from Config_Order_Charges
        where ID in(
            select MAX(ID) as ID
            from Config_Order_Charges a
                inner join
                (select ChargesName,
                        MAX(EffectiveDate) EffectiveDate
                from Config_Order_Charges  
                group by ChargesName,MerchantID
                having MerchantID = @MerchantID) b
                on a.ChargesName=b.ChargesName and a.EffectiveDate=b.EffectiveDate
                where a.MerchantID = @MerchantID
                group by a.ChargesName)) c
        on c.ID = d.ID
        where d.MerchantID = @MerchantID) g
        select * from #a order by ChargesName,EffectiveDate desc,ID desc
        select * into #c from(select MerchantID,InvoiceCol,
                                     SUM(Tax) as TotalTaxValue
                                     from #a group by InvoiceCol,MerchantID having MerchantID=@MerchantID) h
        select a.InvoiceCol,
               a.TotalTaxValue,
               stuff((SELECT ' and ' + c.Comments FROM #a AS c Where c.MerchantID = a.MerchantID and a.InvoiceCol=c.InvoiceCol and c.Tax != 0 FOR xml path('')), 1, 5, '') AS Comments    
               from #c a
        drop table #a
        drop table #c
        end
    end
    else if(@Type = 'Indoor')
    begin
        if(@NarmalSelling = '' or @MerchantID = '')
        begin
            select 'Please Enter NarmalSelling'
            select 'Please Enter NarmalSelling'
        end
        else
        begin
        select * into #b from(
        select d.ID,
               d.MerchantID,
               d.State,
               d.EffectiveDate,
               d.ChargesType,
               d.ChargesName,
               d.ChargesCode,
               d.InvoiceCol,
               d.ValueType,
               d.Value,
               @NarmalSelling as NarmalSelling,
               Tax= Case
                    WHEN c.ValueType = 'Rate' THEN @NarmalSelling*abs(cast(c.Value as decimal(18,2)))
                    WHEN c.ValueType = 'Number' THEN @NarmalSelling-abs(cast(c.Value as decimal(18,2)))
                    ELSE '0' END,
                Comments = (select REPLACE(case when ValueType = 'Rate' then
                            CAST(CAST(Value * 100 AS float) as nvarchar(20)) + '% ' else '$' +
                            CAST(CAST(Value as Float) as nvarchar(20)) + ' ' end, '-', '') + ChargesCode
                            from Config_Order_ChargesToPreView b where d.ID = b.ID FOR xml path(''))
        from Config_Order_ChargesToPreView d
        left join
        (select *
        from Config_Order_ChargesToPreView
        where ID in(
            select MAX(ID) as ID
            from Config_Order_ChargesToPreView a
                inner join
                (select ChargesName,
                        MAX(EffectiveDate) EffectiveDate
                from Config_Order_ChargesToPreView  
                group by ChargesName,MerchantID
                having MerchantID = @MerchantID) b
                on a.ChargesName=b.ChargesName and a.EffectiveDate=b.EffectiveDate
                where a.MerchantID = @MerchantID
                group by a.ChargesName)) c
        on c.ID = d.ID
        where d.MerchantID = @MerchantID) h
        select * from #b order by ChargesName,EffectiveDate desc,ID desc
        select * into #d from (select MerchantID,InvoiceCol,
                                      SUM(Tax) as TotalTaxValue
                                      from #b
                                      group by InvoiceCol,MerchantID
                                      having MerchantID=@MerchantID) k
        select a.InvoiceCol,
               a.TotalTaxValue,
               stuff((SELECT ' and ' + c.Comments FROM #b AS c Where c.MerchantID = a.MerchantID and a.InvoiceCol=c.InvoiceCol and c.Tax != 0 FOR xml path('')), 1, 5, '') AS Comments    
               from #d a                              
        drop table #b
        drop table #d
        end
    end
END






转载于:https://www.cnblogs.com/dwuge/p/5280415.html

一、数据采集层:多源人脸数据获取 该层负责从不同设备 / 渠道采集人脸原始数据,为后续模型训练与识别提供基础样本,核心功能包括: 1. 多设备适配采集 实摄像头采集: 调用计算机内置摄像头(或外接 USB 摄像头),通过OpenCV的VideoCapture接口实捕获视频流,支持手动触发 “拍照”(按指定快捷键如Space)或自动定采集(如每 2 秒采集 1 张),采集自动框选人脸区域(通过Haar级联分类器初步定位),确保样本聚焦人脸。 支持采集参数配置:可设置采集分辨率(如 640×480、1280×720)、图像格式(JPG/PNG)、单用户采集数量(如默认采集 20 张,确保样本多样性),采集过程中实显示 “已采集数量 / 目标数量”,避免样本不足。 本地图像 / 视频导入: 支持批量导入本地人脸图像文件(支持 JPG、PNG、BMP 格式),自动过滤非图像文件;导入视频文件(MP4、AVI 格式),可按 “固定帧间隔”(如每 10 帧提取 1 张图像)或 “手动选择帧” 提取人脸样本,适用于无实摄像头场景。 数据集对接: 支持接入公开人脸数据集(如 LFW、ORL),通过预设脚本自动读取数据集目录结构(按 “用户 ID - 样本图像” 分类),快速构建训练样本库,无需手动采集,降低系统开发与测试成本。 2. 采集过程辅助功能 人脸有效性校验:采集通过OpenCV的Haar级联分类器(或MTCNN轻量级模型)实检测图像中是否包含人脸,若未检测到人脸(如遮挡、侧脸角度过大),则弹窗提示 “未识别到人脸,请调整姿态”,避免无效样本存入。 样本标签管理:采集需为每个样本绑定 “用户标签”(如姓名、ID 号),支持手动输入标签或从 Excel 名单批量导入标签(按 “标签 - 采集数量” 对应),采集完成后自动按 “标签 - 序号” 命名文件(如 “张三
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值