任务描述
暂无
需求描述
需求描述

背景:现有财务销售成本表为每日取 订单利润表数据 ,作为更新逻辑,但店铺费用存在无关联ID  , 导致更新可能出错;



调整:销售成本表( rb_Finance_Settlement) 利润表(RB_Report_OrderSettlement)

    现状:  在销售成本表中, 店铺类别数据无ID 维度,导致更新覆盖可能存在重复。

    调整1:在销售成本表中,每日汇总 利润表 每行店铺费用 + ID ---->  插入 销售成本表 + ID ,

    调整2:按销售成本表原逻辑,每天判断 前一天发货时间,校验机制 为 销售成本表 ID 对比 利润表,进行差额 新增。 



需求上线后1周内,处理修复数据。

    调整3:删除  关帐时间(checkdate)  2021 年 10 月 1   ----- 至 现在 所有  销售成本表内容; 再调整 SYN 时间为 9 月1 号 ,数据重跑。

               调整3.1:数据重跑后,checkdate = 1 月,并且 发货时间  = 10 月  范围, 则 调整checkdate = 发货时间 

               调整3.2:数据重跑后,checkdate = 1 月,并且 发货时间  = 11 月  范围 ,则 调整checkdate = 发货时间     

               调整3.3:数据重跑后,checkdate = 1 月,并且 发货时间  = 12 月  范围 ,则 调整checkdate = 发货时间  

               调整3.4:数据重跑后,checkdate = 1 月,并且 发货时间  = 8-9 月  范围 ,则 调整checkdate = 10 月 20 号000000  

                     



重新覆盖后,线上跟踪 1周 作为校验。


--------------------------------------------------------------------------------------------------------------------------------

参考如下修复订单逻辑但没有效果:


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

验收标准
暂无
历史记录  
  1. 2022-01-20 08:45:21, 由 夏秋生 创建。
  2. 2022-01-20 15:23:01, 由 夏秋生 确认需求变动,最新版本为#6。
  3. 2022-01-20 15:26:32, 由 夏秋生 启动。
    修改了 实际开始,旧值为 "0000-00-00 00:00:00",新值为 "2022-01-20 15:26:28"。
    修改了 总计消耗,旧值为 "0",新值为 "0.2"。
    修改了 任务状态,旧值为 "wait",新值为 "doing"。
  4. 2022-01-20 16:04:05, 由 夏秋生 完成。
    修改了 总计消耗,旧值为 "0.2",新值为 "0.3"。
    修改了 实际完成,旧值为 "",新值为 "2022-01-20 15:31:29"。
    修改了 任务状态,旧值为 "doing",新值为 "done"。
    修改了 预计剩余,旧值为 "4",新值为 "0"。
    修改了 由谁完成,旧值为 "",新值为 "xiaqiusheng"。


    清空销售成本数据


    1、修改上一次服务运行后的SnyID和SnyTime到需要的时间节点。

    UPDATE RB_Warehouse_Record_SynTime SET SynTime='2021-11-18 20:47:14.557',SynID=1 WHERE SynType=10


    2、准备利润数据


    3、同步利润到销售成本


    1. 插入589,其他费用为0,590有其他费用,验证是否会重复

    590其他费用为0

    最后一条为590

  5. 2022-01-20 16:07:02, 由 夏秋生 添加备注。
    测试通过预计上线时间2022/1/20
  6. 2022-01-20 16:07:18, 由 夏秋生 关闭。
    修改了 任务状态,旧值为 "done",新值为 "closed"。
    修改了 指派给 ,旧值为 "xiaqiusheng",新值为 "closed"。
    修改了 由谁关闭,旧值为 "",新值为 "xiaqiusheng"。
    修改了 关闭时间,旧值为 "0000-00-00 00:00:00",新值为 "2022-01-20 16:07:18"。
    修改了 关闭原因,旧值为 "",新值为 "done"。
所属迭代 【分支】产品中心1月非正常更新版本(2022年)
所属模块 赛盒科技  赛盒ERP管理系统   数据报表组
相关需求 销售成本表店铺费用_优化
指派给 Closed 于 2022-01-20 16:07:18
任务类型 测试
任务标签 初始
开发组
任务状态 已关闭
进度 100%
优先级 P2
关键词
抄送给
由谁创建 夏秋生 于 2022-01-20 08:45:21
由谁完成 夏秋生 于 2022-01-20 15:31:29
由谁取消 暂无
由谁关闭 夏秋生 于 2022-01-20 16:07:18
关闭原因 已完成
最后编辑 夏秋生 于 2022-01-20 16:07:18
团队 最初预计 总计消耗 预计剩余
工时信息
最初预计 4工时
总计消耗 0.3工时
预计剩余 0工时
预计开始 0000-00-00
实际开始 2022-01-20
截止日期 0000-00-00