Commit c6271fbb by guanzhenshan

逻辑仓库调整

parent 3da44ad4
...@@ -20,19 +20,22 @@ namespace Bailun.DC.LogicWareHouse ...@@ -20,19 +20,22 @@ namespace Bailun.DC.LogicWareHouse
//static void Main(string[] args) //static void Main(string[] args)
//{ //{
// new Services().Save(); // //new Services().Save();
// //半成品库存 // //半成品库存
// //new Services().SemiStock(); // //new Services().SemiStock();
// //半成品销量 // //半成品销量
// //new Services().UpdateSemiSale(); // new Services().UpdateSemiSale();
// // 更新缺货数和待发货数据 // // 更新缺货数和待发货数据
// //new Services().UpdateOutStockAndNoShipping(); // //new Services().UpdateOutStockAndNoShipping();
// //更新30天现金流 // //更新30天现金流
// //new Services().UpdateCash30Days(); // //new Services().UpdateCash30Days();
// new Services().UpdateLogicWareHouseSemiSale();
//} //}
} }
} }
...@@ -111,6 +111,9 @@ namespace Bailun.DC.LogicWareHouse ...@@ -111,6 +111,9 @@ namespace Bailun.DC.LogicWareHouse
//半成品销量 //半成品销量
UpdateSemiSale(); UpdateSemiSale();
//更新半成品销量和现金流
UpdateLogicWareHouseSemiSale();
// 更新缺货数和待发货数据 // 更新缺货数和待发货数据
UpdateOutStockAndNoShipping(); UpdateOutStockAndNoShipping();
...@@ -237,37 +240,44 @@ namespace Bailun.DC.LogicWareHouse ...@@ -237,37 +240,44 @@ namespace Bailun.DC.LogicWareHouse
//保存数据 //保存数据
foreach (var item in json.data.Items) foreach (var item in json.data.Items)
{ {
var m = new dc_semi_stock_sales_shipping() try
{
var m = new dc_semi_stock_sales_shipping()
{
material_id = item.material_id,
available_days = item.available_days,
buyer_price = item.buyer_price,
material_data_center = item.material_data_center,
need_quantity = item.need_quantity,
on_the_way_amount = item.on_the_way_amount,
on_the_way_count = item.on_the_way_count,
out_of_stock = item.out_of_stock,
out_stock_30 = item.out_stock_30,
put_stock_30 = item.put_stock_30,
redundancy_stock = item.redundancy_stock,
sales_1 = item.sales_1,
sales_14 = item.sales_14,
sales_30 = item.sales_30,
sales_7 = item.sales_7,
sku = item.sku,
sku_name = item.sku_name,
stock = item.stock,
stock_amount = item.stock_amount,
stock_amount_1 = item.stock_amount_1,
warehouse_id = item.warehouse_id,
warehouse_name = item.warehouse_name
};
cn.Insert<dc_semi_stock_sales_shipping>(m);
}
catch (Exception ex)
{ {
material_id = item.material_id, Console.WriteLine("保存半成品销量数据"+item.warehouse_name+"&"+item.sku+" 出现异常:"+ex.Message);
available_days = item.available_days, }
buyer_price = item.buyer_price,
material_data_center = item.material_data_center,
need_quantity = item.need_quantity,
on_the_way_amount = item.on_the_way_amount,
on_the_way_count = item.on_the_way_count,
out_of_stock = item.out_of_stock,
out_stock_30 = item.out_stock_30,
put_stock_30 = item.put_stock_30,
redundancy_stock = item.redundancy_stock,
sales_1 = item.sales_1,
sales_14 = item.sales_14,
sales_30 = item.sales_30,
sales_7 = item.sales_7,
sku = item.sku,
sku_name = item.sku_name,
stock = item.stock,
stock_amount = item.stock_amount,
stock_amount_1 = item.stock_amount_1,
warehouse_id = item.warehouse_id,
warehouse_name = item.warehouse_name
};
cn.Insert<dc_semi_stock_sales_shipping>(m);
} }
} }
...@@ -282,7 +292,22 @@ namespace Bailun.DC.LogicWareHouse ...@@ -282,7 +292,22 @@ namespace Bailun.DC.LogicWareHouse
} }
} }
}
catch (Exception ex)
{
Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "重跑UpdateSemiSale,异常信息:" + ex.Message);
UpdateSemiSale();
}
}
/// <summary>
/// 更新半成品销量和现金流
/// </summary>
public void UpdateLogicWareHouseSemiSale()
{
try
{
Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " 启动更新半成品销量和现金流任务");
var sql = @"update dc_skuwarehouse_stock_sales t1 var sql = @"update dc_skuwarehouse_stock_sales t1
join dc_semi_stock_sales_shipping t2 on t2.warehouse_name=t1.warehouse_name and t1.bailun_sku=t2.sku join dc_semi_stock_sales_shipping t2 on t2.warehouse_name=t1.warehouse_name and t1.bailun_sku=t2.sku
set t1.quantity_purchase=t2.on_the_way_count,t1.purchase_amount=t2.on_the_way_amount,t1.oneday_total_sales=t2.sales_1,t1.amount_onedaysale=t2.stock_amount_1,t1.sevenday_total_sales=t2.sales_7,t1.fourteenday_total_sales=t2.sales_14,t1.thirtyday_total_sales=t2.sales_30,t1.nostockcount=t2.out_of_stock,t1.noshippingcount=t2.need_quantity,t1.quantity_tuneout_30days=t2.out_stock_30,t1.quantity_tunein_30days=t2.put_stock_30;"; set t1.quantity_purchase=t2.on_the_way_count,t1.purchase_amount=t2.on_the_way_amount,t1.oneday_total_sales=t2.sales_1,t1.amount_onedaysale=t2.stock_amount_1,t1.sevenday_total_sales=t2.sales_7,t1.fourteenday_total_sales=t2.sales_14,t1.thirtyday_total_sales=t2.sales_30,t1.nostockcount=t2.out_of_stock,t1.noshippingcount=t2.need_quantity,t1.quantity_tuneout_30days=t2.out_stock_30,t1.quantity_tunein_30days=t2.put_stock_30;";
...@@ -299,14 +324,13 @@ namespace Bailun.DC.LogicWareHouse ...@@ -299,14 +324,13 @@ namespace Bailun.DC.LogicWareHouse
Console.WriteLine("更新逻辑仓库半成品销量成功,受影响行数:" + result); Console.WriteLine("更新逻辑仓库半成品销量成功,受影响行数:" + result);
} }
Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " 结束同步半成品销量任务"); Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " 结束更新半成品销量和现金流任务");
} }
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "重跑UpdateSemiSale,异常信息:" + ex.Message); Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "重跑UpdateLogicWareHouseSemiSale,异常信息:" + ex.Message);
UpdateSemiSale(); UpdateLogicWareHouseSemiSale();
} }
} }
...@@ -370,7 +394,7 @@ namespace Bailun.DC.LogicWareHouse ...@@ -370,7 +394,7 @@ namespace Bailun.DC.LogicWareHouse
var result = cn.Execute(@"update dc_skuwarehouse_stock_sales t1 var result = cn.Execute(@"update dc_skuwarehouse_stock_sales t1
join dc_base_stock_cash t2 on t1.bailun_sku = t2.bailun_sku and t1.warehouse_code = t2.warehouse_code join dc_base_stock_cash t2 on t1.bailun_sku = t2.bailun_sku and t1.warehouse_code = t2.warehouse_code
set t1.cash_in_30days = t2.income_amount_30,t1.cash_out_30days = t2.pay_amount_30,t1.cash_net = (t2.income_amount_30 - t2.pay_amount_30);"); set t1.cash_in_30days = t2.income_amount_30,t1.cash_out_30days = t2.pay_amount_30,t1.cash_net = (t2.income_amount_30 - t2.pay_amount_30);",null,null,6*60);
Console.WriteLine("更新30天现金流的记录数有:" + result); Console.WriteLine("更新30天现金流的记录数有:" + result);
} }
...@@ -380,6 +404,7 @@ namespace Bailun.DC.LogicWareHouse ...@@ -380,6 +404,7 @@ namespace Bailun.DC.LogicWareHouse
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "重跑UpdateCash30Days,异常信息:" + ex.Message); Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "重跑UpdateCash30Days,异常信息:" + ex.Message);
UpdateCash30Days();
} }
} }
...@@ -521,5 +546,6 @@ namespace Bailun.DC.LogicWareHouse ...@@ -521,5 +546,6 @@ namespace Bailun.DC.LogicWareHouse
Console.WriteLine("结束 保存逻辑仓库的每日快照信息 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); Console.WriteLine("结束 保存逻辑仓库的每日快照信息 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment