Commit 787327ae by 泽锋 李

修改 oa 系统的接口域名

parent e0811188
......@@ -13,6 +13,8 @@ namespace AutoGeneratePurchaseAdvise
{
Console.WriteLine("采购建议计算任务启动...");
//PurchaseAdviseServices.Generate();
//PurchaseAdviseServices.AutoPushBuySys(1);
//PurchaseAdviseServices.AutoPushBuySys(1);
//PurchaseAdviseServices.AutoPushBuySys(4);
var builder = new HostBuilder().ConfigureServices((hostContext, services) =>
{
......
......@@ -9,5 +9,5 @@
"CdnUrl": "http://imgcache.bailuntec.com"
},
"QiYeJiQiRen": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=5fa4c1d5-ce65-4e8a-9ae9-a0d689a13b65",
"GetSchedulings": "http://www.bailuntec.com/Api/Cq/GetSchedulings?userID=1967"
"GetSchedulings": "http://oa.bailuntec.com/Api/Cq/GetSchedulings?userID=1967"
}
......@@ -9,5 +9,5 @@
"CdnUrl": "http://imgcache.bailuntec.com"
},
"QiYeJiQiRen": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=5fa4c1d5-ce65-4e8a-9ae9-a0d689a13b65",
"GetSchedulings": "http://www.bailuntec.com/Api/Cq/GetSchedulings?userID=1967"
"GetSchedulings": "http://oa.bailuntec.com/Api/Cq/GetSchedulings?userID=1967"
}
......@@ -9,5 +9,5 @@
"CdnUrl": "http://imgcache.bailuntec.com"
},
"QiYeJiQiRen": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=5fa4c1d5-ce65-4e8a-9ae9-a0d689a13b65",
"GetSchedulings": "http://www.bailuntec.com/Api/Cq/GetSchedulings?userID=1967"
"GetSchedulings": "http://oa.bailuntec.com/Api/Cq/GetSchedulings?userID=1967"
}
\ No newline at end of file
......@@ -227,7 +227,7 @@ where t2.`status`=2 and t1.bailun_sku = t2.bailun_sku and quantity_final_advise=
`product_inner_code`,`goods_quantity_init_advise`,`goods_moq`,`good_sku_codes`,`goods_history_fourteenday_sales`,`history_fourteenday_sales`,
`quantity_actual`,`main_id`,
`forecast_formula`,`fit_forecast_formula`,`turnover_days`,`supplier_delivery`,`inspection_delivery`,`transfer_delivery`,`sales_upper_limit`,`ispush`,`type`,
`suppliers_id`,`quantity_out_stock`,`purchase_type_jit`,`quantity_out_stock_aliexpress`)
`suppliers_id`,`quantity_out_stock`,`purchase_type_jit`,`quantity_out_stock_aliexpress`,`quantity_out_stock_amazon`,`quantity_out_stock_other`)
(
select
t1.bailun_sku,
......@@ -254,7 +254,9 @@ where t2.`status`=2 and t1.bailun_sku = t2.bailun_sku and quantity_final_advise=
t6.suppliers_id,
t7.quantity_out_stock,
2 as 'purchase_type_jit',
sum(t7.quantity_out_stock_aliexpress) as 'quantity_out_stock_aliexpress'
sum(t7.quantity_out_stock_aliexpress) as 'quantity_out_stock_aliexpress',
sum(t7.quantity_out_stock_amazon) as 'quantity_out_stock_amazon',
sum(t7.quantity_out_stock_other) as 'quantity_out_stock_other'
from dc_base_stock as t1
left join dc_auto_sales as t2 on t1.bailun_sku = t2.bailun_sku and t1.warehouse_code = t2.warehouse_code
left join dc_auto_config_sku_warehouse as t5 on t1.bailun_sku = t5.bailun_sku and t1.warehouse_code = t5.warehouse_code
......@@ -528,15 +530,22 @@ t7.bailun_order_ids
set session transaction isolation level read uncommitted;
start transaction;
insert into dc_mid_transit(bailun_sku, warehouse_code, quantity_out_stock,gmt_out_stock_modified)
insert into dc_mid_transit(bailun_sku, warehouse_code, quantity_out_stock,gmt_out_stock_modified, quantity_out_stock_aliexpress,quantity_out_stock_amazon,quantity_out_stock_other)
SELECT
t1.bailun_sku as bailunSku,
t1.warehouse_code as warehouseCode,
t1.bailun_sku_quantity_ordered - t1.bailun_sku_quantity_pushed - t2.usable_stock - t2.occupy_stock + ifnull(t3.safe_stock, 0) as quantityOutStock, CURRENT_TIMESTAMP
t1.bailun_sku_quantity_ordered - t1.bailun_sku_quantity_pushed - t2.usable_stock - t2.occupy_stock + ifnull(t3.safe_stock, 0) as quantityOutStock,
now(),
t1.aliexpress_quantity as aliexpressQuantity,
t1.amazon_quantity as amazonQuantity,
t1.other_quantity as other_quantity
FROM
(
SELECT
bailun_sku,warehouse_code,SUM(bailun_sku_quantity_ordered) AS bailun_sku_quantity_ordered,SUM(bailun_sku_quantity_pushed) AS bailun_sku_quantity_pushed
bailun_sku,warehouse_code,SUM(bailun_sku_quantity_ordered) AS bailun_sku_quantity_ordered,SUM(bailun_sku_quantity_pushed) AS bailun_sku_quantity_pushed,
sum(case when platform_type = 'Aliexpress' then bailun_sku_quantity_ordered - bailun_sku_quantity_pushed else 0 end) as aliexpress_quantity,
sum(case when platform_type = 'Amazon' then bailun_sku_quantity_ordered - bailun_sku_quantity_pushed else 0 end) as amazon_quantity,
sum(case when platform_type not in ( 'Amazon','Aliexpress') then bailun_sku_quantity_ordered - bailun_sku_quantity_pushed else 0 end) as other_quantity
FROM
dc_base_oms_sku
WHERE
......@@ -544,6 +553,7 @@ SELECT
and bailun_interception_status in('None','Failed')
and warehouse_code != ''
and platform_type != 'FBA'
and company_id = 1
and has_delete = 0
and has_scalp = 0
and has_buyer_remark = 0
......@@ -556,15 +566,16 @@ SELECT
bailun_sku,
warehouse_code
) t1 INNER JOIN dc_base_stock t2 ON t1.bailun_sku=t2.bailun_sku and t1.warehouse_code=t2.warehouse_code
LEFT JOIN dc_auto_jit_inventory t3 ON t1.bailun_sku=t3.bailun_sku and t1.warehouse_code=t3.warehouse_code
LEFT JOIN dc_auto_jit_inventory t3 ON t1.bailun_sku=t3.bailun_sku and t1.warehouse_code=t3.warehouse_code and t3.status = 1
WHERE (t1.bailun_sku_quantity_ordered - t1.bailun_sku_quantity_pushed - t2.usable_stock - t2.occupy_stock + ifnull(t3.safe_stock, 0)) >= 0
ON DUPLICATE KEY UPDATE quantity_out_stock = values(quantity_out_stock) ,gmt_out_stock_modified = values(gmt_out_stock_modified)
ON DUPLICATE KEY UPDATE quantity_out_stock = values(quantity_out_stock) ,gmt_out_stock_modified = values(gmt_out_stock_modified), quantity_out_stock_amazon = values(quantity_out_stock_amazon),quantity_out_stock_other = VALUES(quantity_out_stock_other)
", commandTimeout: 0);
var time = _connection.QueryFirstOrDefault<DateTime>(" select max(gmt_out_stock_modified) from dc_mid_transit ");
_connection.Execute(@" set session transaction isolation level read uncommitted;
start transaction;
update dc_mid_transit set quantity_out_stock =0 where gmt_out_stock_modified < @time ", new {
update dc_mid_transit set quantity_out_stock =0,quantity_out_stock_aliexpress = 0,quantity_out_stock_other = 0,quantity_out_stock_amazon= 0 where gmt_out_stock_modified < @time ", new {
time= time
});
}
......
......@@ -163,10 +163,20 @@ namespace AutoTurnOver.Models
public string bailun_order_ids { get; set; }
/// <summary>
/// 速卖通的缺货数量
/// 速卖通的实际需求数量
/// </summary>
public decimal? quantity_out_stock_aliexpress { get; set; }
/// <summary>
/// 亚马逊的实际需求数量
/// </summary>
public decimal? quantity_out_stock_amazon { get; set; }
/// <summary>
/// 其他平台的需求
/// </summary>
public decimal? quantity_out_stock_other { get; set; }
}
public enum purchase_type_jit_enum
{
......
......@@ -189,42 +189,58 @@ namespace AutoTurnOver.Services
public static void PushBuySysSplit(List<dc_auto_purchase_advise_detailed_dto> datas, UserData user, bool is_skip_error)
{
if (datas == null || datas.Count <= 0) return;
var amazon_datas = new List<dc_auto_purchase_advise_detailed_dto>();
var ali_datas = new List<dc_auto_purchase_advise_detailed_dto>();
var other_datas = new List<dc_auto_purchase_advise_detailed_dto>();
foreach (var item in datas)
{
if("张莹霞".Equals(item.buyer_name) && item.quantity_out_stock_aliexpress>0)
if("张莹霞".Equals(item.buyer_name))
{
var temp_other_data = item.ToJson().ToObject<dc_auto_purchase_advise_detailed_dto>() ;
temp_other_data.quantity_final_advise = (int)Math.Round( item.quantity_out_stock - item.quantity_out_stock_aliexpress.Value);
if (temp_other_data.quantity_final_advise > 0)
if (item.quantity_out_stock_other > 0)
{
other_datas.Add(temp_other_data);
var temp_other_data = item.ToJson().ToObject<dc_auto_purchase_advise_detailed_dto>();
temp_other_data.quantity_final_advise = Math.Min((int)item.quantity_out_stock_other, item.quantity_final_advise);
if (temp_other_data.quantity_final_advise > 0)
{
other_datas.Add(temp_other_data);
item.quantity_final_advise = Math.Max(0, (int)item.quantity_final_advise - temp_other_data.quantity_final_advise);
}
}
if (item.quantity_final_advise > 0 && item.quantity_out_stock_amazon > 0)
{
var temp_amazon_data = item.ToJson().ToObject<dc_auto_purchase_advise_detailed_dto>();
temp_amazon_data.quantity_final_advise =Math.Min( (int)item.quantity_out_stock_amazon.Value, item.quantity_final_advise);
if (temp_amazon_data.quantity_final_advise > 0)
{
amazon_datas.Add(temp_amazon_data);
item.quantity_final_advise = Math.Max(0, (int)item.quantity_final_advise - temp_amazon_data.quantity_final_advise);
}
}
var temp_ali_data = item.ToJson().ToObject<dc_auto_purchase_advise_detailed_dto>();
temp_ali_data.quantity_final_advise = item.quantity_final_advise - temp_other_data.quantity_final_advise;
if (temp_ali_data.quantity_final_advise > 0)
if (item.quantity_final_advise > 0)
{
ali_datas.Add(temp_ali_data);
ali_datas.Add(item);
}
}
else
{
other_datas.Add(item);
ali_datas.Add(item);
}
}
if(ali_datas!=null && ali_datas.Count > 0)
if (amazon_datas != null && amazon_datas.Count > 0)
{
PushBuySys(amazon_datas, user, is_skip_error, "亚马逊");
}
if (ali_datas!=null && ali_datas.Count > 0)
{
PushBuySys(ali_datas, user, is_skip_error,"速卖通");
}
if (other_datas != null && other_datas.Count > 0)
{
PushBuySys(other_datas, user, is_skip_error,"非速卖通");
PushBuySys(other_datas, user, is_skip_error,"其他");
}
}
......@@ -270,8 +286,16 @@ namespace AutoTurnOver.Services
var total = 0;
datas.AddRange(PurchaseAdviseServices.DetailList(new dc_auto_purchase_advise_detailed_search_dto { main_id = mainID, ispush = false }, 0, int.MaxValue, ref total));
datas.AddRange(PurchaseAdviseServices.DetailList(new dc_auto_purchase_advise_detailed_search_dto { main_id = mainID, ispush = false}, 0, int.MaxValue, ref total));
PurchaseAdviseServices.PushBuySys(datas, new UserData { UserName = "admin" },true);
//datas.AddRange(PurchaseAdviseServices.DetailList(new dc_auto_purchase_advise_detailed_search_dto { main_id = mainID, ispush = false }, 0, int.MaxValue, ref total));
if (false)
{
PurchaseAdviseServices.PushBuySysSplit(datas, new UserData { UserName = "admin" }, true);
}
else
{
PurchaseAdviseServices.PushBuySys(datas, new UserData { UserName = "admin" }, true);
}
}
catch (Exception ex)
{
......
......@@ -9,8 +9,8 @@
},
"AllowedHosts": "*",
"PushBuyPlan": "http://purchase.bailuntec.com/api/CreatePlanToPurchase",
"WebHost_GetUser": "http://www.bailuntec.com/Login/GetUserByBLUserAcct?webcode=aims",
"WebHost_LoginOut": "http://www.bailuntec.com/Login/LoginOut",
"WebHost_GetUser": "http://oa.bailuntec.com/Login/GetUserByBLUserAcct?webcode=aims",
"WebHost_LoginOut": "http://oa.bailuntec.com/Login/LoginOut",
"Pams_GetAccountToken": "http://pams.bailuntec.com/Api/GetAccountToken",
"redis": {
"HostName": "127.0.0.1",
......@@ -34,6 +34,6 @@
"CdnUrl": "http://imgcache.bailuntec.com"
},
"QiYeJiQiRen": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=5fa4c1d5-ce65-4e8a-9ae9-a0d689a13b65",
"GetSchedulings": "http://www.bailuntec.com/Api/Cq/GetSchedulings?userID=2409",
"GetSchedulings": "http://oa.bailuntec.com/Api/Cq/GetSchedulings?userID=2409",
"SkuSys_CategoryList": "http://api.skums.bailuntec.com/api/category/simplecategory/categoriessimplebylevel"
}
......@@ -9,8 +9,8 @@
},
"AllowedHosts": "*",
"PushBuyPlan": "http://purchase.bailuntec.com/api/CreatePlanToPurchase",
"WebHost_GetUser": "http://www.bailuntec.com/Login/GetUserByBLUserAcct?webcode=aims",
"WebHost_LoginOut": "http://www.bailuntec.com/Login/LoginOut",
"WebHost_GetUser": "http://oa.bailuntec.com/Login/GetUserByBLUserAcct?webcode=aims",
"WebHost_LoginOut": "http://oa.bailuntec.com/Login/LoginOut",
"Pams_GetAccountToken": "http://pams.bailuntec.com/Api/GetAccountToken",
"redis": {
"HostName": "10.0.2.11",
......@@ -34,6 +34,6 @@
"CdnUrl": "http://imgcache.bailuntec.com"
},
"QiYeJiQiRen": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=5fa4c1d5-ce65-4e8a-9ae9-a0d689a13b65",
"GetSchedulings": "http://www.bailuntec.com/Api/Cq/GetSchedulings?userID=2409",
"GetSchedulings": "http://oa.bailuntec.com/Api/Cq/GetSchedulings?userID=2409",
"SkuSys_CategoryList": "http://api.skums.bailuntec.com/api/category/simplecategory/categoriessimplebylevel"
}
......@@ -9,8 +9,8 @@
},
"AllowedHosts": "*",
"PushBuyPlan": "http://purchase.bailuntec.com/api/CreatePlanToPurchase",
"WebHost_GetUser": "http://www.bailuntec.com/Login/GetUserByBLUserAcct?webcode=aims",
"WebHost_LoginOut": "http://www.bailuntec.com/Login/LoginOut",
"WebHost_GetUser": "http://oa.bailuntec.com/Login/GetUserByBLUserAcct?webcode=aims",
"WebHost_LoginOut": "http://oa.bailuntec.com/Login/LoginOut",
"Pams_GetAccountToken": "http://pams.bailuntec.com/Api/GetAccountToken",
"redis": {
"HostName": "127.0.0.1",
......@@ -34,6 +34,6 @@
"CdnUrl": "http://imgcache.bailuntec.com"
},
"QiYeJiQiRen": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=5fa4c1d5-ce65-4e8a-9ae9-a0d689a13b65",
"GetSchedulings": "http://www.bailuntec.com/Api/Cq/GetSchedulings?userID=2409",
"GetSchedulings": "http://oa.bailuntec.com/Api/Cq/GetSchedulings?userID=2409",
"SkuSys_CategoryList": "http://api.skums.bailuntec.com/api/category/simplecategory/categoriessimplebylevel"
}
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