Commit 952a4669 by lizefeng

关闭程序重启会直接跑一遍算法的处理逻辑

parent 25908b0e
using AutoTurnOver.Models.ApiDto;
using AutoTurnOver.Utility;
using System;
using System.Collections.Generic;
using System.Text;
namespace AutoTurnOver.DB
{
public class ApiUtility
{
/// <summary>
/// 批量修改sku默认发货仓
/// </summary>
public static void SaveDefaultWares(List<SaveDefaultWaresRequestDto> datas)
{
try
{
//查询采购建议明细
string url = ConfigHelper.GetValue("SaveDefaultWares");
string resultStr = HttpHelper.Request(url, RequestType.POST, datas.ToJson(), "application/json", timeout: 1000 * 60 * 60 * 24);
}
catch (Exception ex)
{
throw new Exception("skums 系统异常: " + ex.Message);
}
return;
}
}
}
using AutoTurnOver.Models; using AutoTurnOver.Models;
using AutoTurnOver.Models.ApiDto;
using Dapper; using Dapper;
using MySql.Data.MySqlClient; using MySql.Data.MySqlClient;
using System; using System;
...@@ -220,9 +221,6 @@ where t1.sku = t2.bailun_sku and t2.product_inner_code in @product_inner_codes a ...@@ -220,9 +221,6 @@ where t1.sku = t2.bailun_sku and t2.product_inner_code in @product_inner_codes a
IDbTransaction transaction = conn.BeginTransaction(); IDbTransaction transaction = conn.BeginTransaction();
try try
{ {
// 修改发货仓库
throw new Exception("业务待完善");
// 数据仓转移分组 // 数据仓转移分组
_connection.Execute(@" _connection.Execute(@"
update dc_sku_monitor as t1 , update dc_sku_monitor as t1 ,
...@@ -231,11 +229,20 @@ set t1.groupname='无库分组',groupupdatetime=now() ...@@ -231,11 +229,20 @@ set t1.groupname='无库分组',groupupdatetime=now()
where t1.sku = t2.bailun_sku and t2.product_inner_code in @product_inner_codes and t1.warehousecode='BLGZ03' where t1.sku = t2.bailun_sku and t2.product_inner_code in @product_inner_codes and t1.warehousecode='BLGZ03'
", new { product_inner_codes = product_inner_codes.Split(',') }, transaction: transaction); ", new { product_inner_codes = product_inner_codes.Split(',') }, transaction: transaction);
//修改默认发货仓
List<SaveDefaultWaresRequestDto> requests = _connection.Query<SaveDefaultWaresRequestDto>(" select t1.bailun_sku as 'sku','GZBLWH' as 'wareCode',18 as 'areaId' from dc_base_sku as t1 where t1.product_inner_code in @product_inner_codes ", new { product_inner_codes = product_inner_codes.Split(',') }).AsList();
if (requests != null && requests.Count>=1)
{
ApiUtility.SaveDefaultWares(requests);
}
transaction.Commit(); transaction.Commit();
} }
catch (Exception ex) catch (Exception ex)
{ {
transaction.Rollback(); transaction.Rollback();
throw;
} }
} }
} }
......
using System;
using System.Collections.Generic;
using System.Text;
namespace AutoTurnOver.Models.ApiDto
{
/// <summary>
/// 修改sku 的默认发货仓库
/// </summary>
public class SaveDefaultWaresRequestDto
{
public string sku { get; set; }
public string wareCode { get; set; }
public int areaId { get; set; }
}
}
...@@ -200,5 +200,7 @@ namespace AutoTurnOver.Services ...@@ -200,5 +200,7 @@ namespace AutoTurnOver.Services
} }
} }
} }
...@@ -17,5 +17,6 @@ ...@@ -17,5 +17,6 @@
"Port": "6379", "Port": "6379",
"Password": "SpaceHorse1", "Password": "SpaceHorse1",
"Defaultdatabase": 0 "Defaultdatabase": 0
} },
"SaveDefaultWares": "http://api.skums.bailuntec.com/api/sku/productsku/gmtproductskus"
} }
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