Commit c6271fbb by guanzhenshan

逻辑仓库调整

parent 3da44ad4
......@@ -20,19 +20,22 @@ namespace Bailun.DC.LogicWareHouse
//static void Main(string[] args)
//{
// new Services().Save();
// //new Services().Save();
// //半成品库存
// //new Services().SemiStock();
// //半成品销量
// //new Services().UpdateSemiSale();
// new Services().UpdateSemiSale();
// // 更新缺货数和待发货数据
// //new Services().UpdateOutStockAndNoShipping();
// //更新30天现金流
// //new Services().UpdateCash30Days();
// new Services().UpdateLogicWareHouseSemiSale();
//}
}
}
......@@ -111,6 +111,9 @@ namespace Bailun.DC.LogicWareHouse
//半成品销量
UpdateSemiSale();
//更新半成品销量和现金流
UpdateLogicWareHouseSemiSale();
// 更新缺货数和待发货数据
UpdateOutStockAndNoShipping();
......@@ -237,6 +240,8 @@ namespace Bailun.DC.LogicWareHouse
//保存数据
foreach (var item in json.data.Items)
{
try
{
var m = new dc_semi_stock_sales_shipping()
{
material_id = item.material_id,
......@@ -269,6 +274,11 @@ namespace Bailun.DC.LogicWareHouse
cn.Insert<dc_semi_stock_sales_shipping>(m);
}
catch (Exception ex)
{
Console.WriteLine("保存半成品销量数据"+item.warehouse_name+"&"+item.sku+" 出现异常:"+ex.Message);
}
}
}
......@@ -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
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;";
......@@ -299,15 +324,14 @@ namespace Bailun.DC.LogicWareHouse
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)
{
Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "重跑UpdateSemiSale,异常信息:" + ex.Message);
UpdateSemiSale();
Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "重跑UpdateLogicWareHouseSemiSale,异常信息:" + ex.Message);
UpdateLogicWareHouseSemiSale();
}
}
/// <summary>
......@@ -370,7 +394,7 @@ namespace Bailun.DC.LogicWareHouse
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
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);
}
......@@ -380,6 +404,7 @@ namespace Bailun.DC.LogicWareHouse
catch (Exception ex)
{
Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "重跑UpdateCash30Days,异常信息:" + ex.Message);
UpdateCash30Days();
}
}
......@@ -521,5 +546,6 @@ namespace Bailun.DC.LogicWareHouse
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