Commit 198d72e4 by lizefeng

采购员为赵美聪的sku 全部按缺货数下建议单

parent 75a32e95
......@@ -90,6 +90,14 @@ select
)
", new { main_id = mainID }, commandTimeout: 0);
// 采购员为 赵美聪 的商品 按缺货数量下单
_connection.Execute(@" update dc_auto_purchase_advise_detailed as t1,
dc_base_sku as t2,
dc_auto_turnover as t3
set t1.quantity_final_advise=t3.quantity_out_stock
where t1.bailun_sku= t2.bailun_sku
and t1.bailun_sku = t3.bailun_sku and t1.warehouse_code = t3.warehouse_code
and t2.buyer_name='赵美聪' and main_id=@main_id ", new { main_id = mainID }, commandTimeout: 0);
// 凑单sku(初始建议数没有) 如果下单数只有一个,改为2
_connection.Execute(" update dc_auto_purchase_advise_detailed set quantity_final_advise=2 where quantity_final_advise=1 and quantity_init_advise<=0 and main_id=@main_id ", new { main_id = mainID });
......@@ -118,7 +126,7 @@ select
}
}
}
/// <summary>
......@@ -223,7 +231,8 @@ left join dc_auto_purchase_advise as t4 on t1.main_id = t4.id
left join dc_auto_turnover as t5 on t1.warehouse_code = t5.warehouse_code and t1.bailun_sku = t5.bailun_sku
where 1=1 ";
}
else {
else
{
sql = @"
select
t1.*,t2.warehouse_name,t3.sku_title_cn as 'sku_name',t4.create_time,t3.buyer_name,
......@@ -242,7 +251,7 @@ left join dc_auto_turnover as t5 on t1.warehouse_code = t5.warehouse_code and t1
where 1=1 ";
}
if (!string.IsNullOrWhiteSpace(m.product_inner_code))
{
sql += " and t3.product_inner_code=@product_inner_code ";
......@@ -325,7 +334,7 @@ select * from view_purchase_advise_supplier_price as t_price where t_price.main_
) ";
parameters.Add("quantity_final_advise_price_min", m.quantity_final_advise_price_min);
}
}
}
if (m.is_multiple_warehouse)
{
......@@ -390,7 +399,7 @@ and EXISTS (
/// <returns></returns>
public static IEnumerable<dc_auto_purchase_advise_detailed_buy_dto> BuyDetailList(List<int> ids, bool? ispush = null)
{
if(ids==null || ids.Count <= 0)
if (ids == null || ids.Count <= 0)
{
return new List<dc_auto_purchase_advise_detailed_buy_dto>();
}
......@@ -436,7 +445,7 @@ left join dc_auto_purchase_advise as t2 on t1.main_id = t2.id where t1.bailun_sk
if (oldData == null) throw new Exception("数据异常");
if (oldData.ispush ==1 ) throw new Exception($"【{oldData.bailun_sku}】该数据已推送,不可修改");
if (oldData.ispush == 1) throw new Exception($"【{oldData.bailun_sku}】该数据已推送,不可修改");
_connection.Execute(" update dc_auto_purchase_advise_detailed set quantity_actual=@quantity_actual where id=@id ", new { quantity_actual = quantity_actual, id = id });
}
......
......@@ -142,6 +142,8 @@ namespace AutoTurnOver.Models
public int suppliers_id { get; set; }
public string push_user_name { get; set; }
}
public enum purchase_advise_type_enum
......
......@@ -131,15 +131,15 @@ namespace AutoTurnOver.Services
{
//查询采购建议明细
string url = ConfigHelper.GetValue("PushBuyPlan");
string resultStr = HttpHelper.Request(url, RequestType.POST, "obj=" + WebUtility.UrlDecode(data.ToJson()));
string resultStr = HttpHelper.Request(url, RequestType.POST, "obj=" + WebUtility.UrlDecode(data.ToJson()), timeout: 0);
var result = resultStr.ToObj<BuyOutputResult>();
if (result == null)
{
throw new Exception("推送失败");
throw new Exception("采购系统异常: 推送失败");
}
if (!result.IsSuccessed)
{
throw new Exception(result.Message);
throw new Exception("采购系统异常: " + result.Message);
}
return result;
}
......
......@@ -130,7 +130,7 @@ namespace AutoTurnOver.Services
/// 把最新一批的采购单推送到采购系统
/// </summary>
/// <param name="mainId"></param>
public static void PushBuySys(List<dc_auto_purchase_advise_detailed_dto> datas)
public static void PushBuySys(List<dc_auto_purchase_advise_detailed_dto> datas,UserData user)
{
MySqlConnection conn = connectionHelper._connection;
conn.Open();
......@@ -171,7 +171,7 @@ namespace AutoTurnOver.Services
if (result.IsSuccessed)
{
// 把相关的采购明细都标记成已推送
conn.Execute(" update dc_auto_purchase_advise_detailed set ispush=1,plan_nos=@plan_nos where id in @ids ", new { ids = item.Select(s => s.id).ToArray(), plan_nos = result.planNo });
conn.Execute(" update dc_auto_purchase_advise_detailed set ispush=1,plan_nos=@plan_nos,push_user_name=@push_user_name where id in @ids ", new { ids = item.Select(s => s.id).ToArray(), plan_nos = result.planNo, push_user_name = user.UserName });
}
planNos.Add(result.planNo);
......
......@@ -16,7 +16,7 @@ namespace AutoTurnOver.Utility
public static string Request(string url, RequestType type, string data = "", string entype = null, int timeout = 0)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
if (timeout <= 0)
if (timeout < 0)
{
request.Timeout = 0x927c0;
}
......
......@@ -309,7 +309,7 @@ namespace AutoTurnOver.Controllers
var total = 0;
var list = PurchaseAdviseServices.DetailList(m, 0, int.MaxValue, ref total);
PurchaseAdviseServices.PushBuySys(list);
PurchaseAdviseServices.PushBuySys(list,AutoUtility.GetUser());
return new JsonResult(new
......
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