任务描述
调整销售成本数据,与158一起验证
需求描述

背景: 现有财务使用 销售成本表 rb_finance_Settlement  数据来源于利润表 RB_Report_OrderSettlement,

但因为店铺数据存在差异,现通过SQL 覆盖方式进行调整。 


问题来源:平台其他费用差异(ordersourceotherdebits),广告费差异(CostOfAdvertising)

select sum(ordersourceotherdebits) from RB_Report_OrderSettlement(NOLOCK) where customerid=1 and OrderSourceType in (1,2)
 and shiptime>'2021-11-01'
 and shiptime<'2021-11-30'
 --and ordersourceID='8596'
 --and ordersourceotherdebits <-5
 union
 select sum(ordersourceotherdebits)  from dbo.rb_finance_Settlement(NOLOCK) where customerid=1 and OrderSourceType in (1,2)
     and shiptime>'2021-11-01'
and shiptime<'2021-11-30'
--and ordersourceID='8596'
--and ordersourceotherdebits <-5



解决方案:


DECLARE @CustomerID INT 
DECLARE @OrderSourceType INT 
DECLARE @BeginTime NVARCHAR(20)
DECLARE @EndTime NVARCHAR(20)

SET @CustomerID=1
SET @OrderSourceType=2
SET @BeginTime='2021-11-01'
SET @EndTime='2021-12-01'
--修改Finance 11月Ebay OrderSourceOtherDebits<>0 数据 商户号为-2

UPDATE dbo.RB_Finance_Settlement SET CustomerID=-2 WHERE
CustomerID=@CustomerID
AND  OrderSourceType=@OrderSourceType
AND ShipTime>=@BeginTime
AND ShipTime<@EndTime
AND OrderSourceOtherDebits<>0;

--插入利润表到财务结算表
INSERT INTO RB_Finance_Settlement
(
    [CustomerID],
    [CheckDate],
    [SettlementDate],
    [OrderSourceID],
    [OrderSourceName],
    [PayTime],
    [ShipTime],
    [WarehouseID],
    [WareHouseName],
    [OrderSourceType],
    [OrderSourceTypeName],
    [Ordercode],
    [ClientOrderCode],
    [TransactionId],
    [SKU],
    [ClientSKU],
    [SellerSKU],
    [ProductNameCN],
    [SaleNum],
    [Currency],
    [ExchangeRMB],
    [USD_ExchangeRMB],
    [Country],
    [Profits],
    [Incomes],
    [SalesPrice],
    [TransportPay],
    [SalesRefunds],
    [PromotionRebates],
    [OtherCredits],
    [CommisionFee],
    [FBATransactionFees],
    [OrderSourceOtherDebits],
    [CostOfAdvertising],
    [BuyPrice],
    [PackageFees],
    [SalesAdminID],
    [SalesAdminName],
    [SalesTeamID],
    [SalesTeamName],
    [remark],
    [AddTime],
    [UpdateTime],
    [AddCommisionFee],
    [TransportID],
    [Transport_API_Class]
)
SELECT CustomerID,SettlementDate,SettlementDate,OrderSourceID,OrderSourceName,
PayTime,ShipTime,
WareHouseID,WareHouseName,OrderSourceType,OrderSourceTypeName,OrderCode,ClientOrderCode,
TransactionId,SKU,ClientSKU,SellerSKU,ProductNameCN,(ProductNum+ProdutNumUpdate) AS SaleNum,
Currency,ExchangeRMB,USD_ExchangeRMB,OrderSourceContry,Profits,Incomes,SalesPrice,TransportPay,
SalesRefunds,PromotionRebates,OtherCredits,CommisionFee,FBATransactionFees,OrderSourceOtherDebits,
CostOfAdvertising,BuyPrice,PackageFees,SalesAdminID,SalesAdminName,SalesTeamID,SalesTeamName,
'利润覆盖20211216' AS remark,
SettlementDate AS AddTime,SettlementDate AS UpdateTime,0 AS AddCommisionFee,TransportID,0 AS Transport_API_Class
FROM dbo.RB_Report_OrderSettlement(NOLOCK)
WHERE 
CustomerID=@CustomerID
AND  OrderSourceType=@OrderSourceType
AND ShipTime>=@BeginTime
AND ShipTime<@EndTime
AND OrderSourceOtherDebits<>0


时间范围: 7 -11 月。


验收标准
暂无
历史记录  
  1. 2021-12-27 15:57:22, 由 韦思成 创建。
  2. 2021-12-27 15:57:46, 由 韦思成 完成。
    修改了 总计消耗,旧值为 "0",新值为 "8"。
    修改了 实际完成,旧值为 "",新值为 "2021-12-27 15:57:36"。
    修改了 任务状态,旧值为 "wait",新值为 "done"。
    修改了 实际开始,旧值为 "0000-00-00 00:00:00",新值为 "2021-12-27 15:57:46"。
    修改了 预计剩余,旧值为 "8",新值为 "0"。
    修改了 由谁完成,旧值为 "",新值为 "weisicheng"。
    已调整
  3. 2022-06-23 14:14:30, 由 韦思成 关闭。
    修改了 任务状态,旧值为 "done",新值为 "closed"。
    修改了 指派给 ,旧值为 "weisicheng",新值为 "closed"。
    修改了 由谁关闭,旧值为 "",新值为 "weisicheng"。
    修改了 关闭时间,旧值为 "0000-00-00 00:00:00",新值为 "2022-06-23 14:14:30"。
    修改了 关闭原因,旧值为 "",新值为 "done"。
所属迭代 【主干】产品中心12月第二个版本(2021年)
所属模块 赛盒科技  赛盒ERP管理系统   数据报表组
相关需求 销售成本表其他费用_调整修复_无发版
指派给 Closed 于 2022-06-23 14:14:30
任务类型 后端
任务标签 初始
开发组
任务状态 已关闭
进度 100%
优先级 P2
关键词
抄送给
由谁创建 韦思成 于 2021-12-27 15:57:22
由谁完成 韦思成 于 2021-12-27 15:57:36
由谁取消 暂无
由谁关闭 韦思成 于 2022-06-23 14:14:30
关闭原因 已完成
最后编辑 韦思成 于 2022-06-23 14:14:30
团队 最初预计 总计消耗 预计剩余
工时信息
最初预计 8工时
总计消耗 8工时
预计剩余 0工时
预计开始 2021-12-23
实际开始 2021-12-27
截止日期 2021-12-27