Commit d5579168 by lizefeng

周转表的分类修改为百伦新分类

库存新增百伦分类的筛选
parent 5757e9ea
......@@ -2,7 +2,8 @@
using Dapper;
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using AutoTurnOver.Models.ApiDto;
namespace AutoTurnOver.DB
{
......@@ -199,7 +200,7 @@ WHERE
/// <param name="sku">sku</param>
/// <param name="warehouse_code">仓库编码</param>
/// <returns></returns>
public static List<dc_base_stock_dto> RealtimeList(string sku,string bailun_sku, string warehouse_code, string product_inner_code, string sku_title_cn,string supplier_name, int offset, int limit, ref int total, string warehousetype, int? warehousearea, bool isSum = false, string order = null, string sort = null,int? has_tort = null)
public static List<dc_base_stock_dto> RealtimeList(string sku,string bailun_sku, string warehouse_code, string product_inner_code, string sku_title_cn,string supplier_name, int offset, int limit, ref int total, string warehousetype, int? warehousearea, bool isSum = false, string order = null, string sort = null,int? has_tort = null, List<bailun_category_new_dto> categoryModels = null)
{
var sql = "";
if (isSum)
......@@ -290,6 +291,11 @@ left join dc_base_warehouse as dbw on t1.warehouse_code = dbw.warehouse_code
DynamicParameters parameters = new DynamicParameters();
parameters.Add("time", DateTime.Now.ToString("yyyy-MM-dd 00:00:00"));
if (categoryModels != null && categoryModels.Count>=1)
{
sql += " and t3.category_simple_id in ( " + string.Join(",", categoryModels.Select(s => s.id).Distinct()) + ")";
countSql += " and t3.category_simple_id in ( " + string.Join(",", categoryModels.Select(s => s.id).Distinct()) + ")";
}
if (has_tort != null)
{
......
......@@ -104,9 +104,8 @@ from dc_auto_turnover as dat
if (m.categoryModels != null)
{
sql += " and dat.bailun_category_id in ( " + string.Join(",", m.categoryModels.Select(s => s.C_ID).Distinct()) + ")";
sqlCount += " and dat.bailun_category_id in ( " + string.Join(",", m.categoryModels.Select(s => s.C_ID).Distinct()) + ")";
sql += " and dat.category_simple_id in ( " + string.Join(",", m.categoryModels.Select(s => s.id).Distinct()) + ")";
sqlCount += " and dat.category_simple_id in ( " + string.Join(",", m.categoryModels.Select(s => s.id).Distinct()) + ")";
}
if (!string.IsNullOrWhiteSpace(m.buyer_name))
{
......
using System;
using System.Collections.Generic;
using System.Text;
namespace AutoTurnOver.Models.ApiDto
{
public class bailun_category_new_dto
{
public int parentId { get; set; }
public string name { get; set; }
public string fullName { get; set; }
public int level { get; set; }
public int id { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace AutoTurnOver.Models.ApiDto
{
public class saas_api_result<T>
{
public T result { get; set; }
public int statusCode { get; set; }
public string message { get; set; }
}
}
......@@ -330,7 +330,7 @@ namespace AutoTurnOver.Models
/// </summary>
public string categoryIds { get; set; }
public List<CategoryDto> categoryModels { get; set; }
public List<bailun_category_new_dto> categoryModels { get; set; }
}
public class dc_auto_turnover_Extend : dc_auto_turnover
......
......@@ -587,5 +587,111 @@ namespace AutoTurnOver.Services
}
/// <summary>
/// 获取一二级新百伦分类
/// </summary>
/// <returns></returns>
public static List<bailun_category_new_dto> GetNewCategoryAll()
{
return GetNewCategoryList(0);
}
/// <summary>
/// 根据基本查询分类
/// </summary>
/// <param name="level"></param>
/// <returns></returns>
public static List<bailun_category_new_dto> GetNewCategoryList(int level = 1)
{
string url = ConfigHelper.GetValue("SkuSys_CategoryList");
string resultStr = HttpHelper.Request(url + $"?level={level}",RequestType.GET, timeout: 1000 * 60 * 60 * 24);
var result = resultStr.ToObj<saas_api_result<List<bailun_category_new_dto>>>();
if (result == null)
{
throw new Exception("skums 系统 新百伦分类接口异常: 未获取到新百伦分类数据");
}
if (result.statusCode != 200)
{
throw new Exception("wms系统 新百伦分类接口 异常: " + result.message);
}
return result.result;
}
/// <summary>
/// 根据ID查询分类
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public static bailun_category_new_dto GetNewCategoryById(int id)
{
var all = GetNewCategoryAll();
return all.SingleOrDefault(s => s.id == id);
}
/// <summary>
/// 获取顶层分类
/// </summary>
/// <param name="category_id"></param>
/// <returns></returns>
public static bailun_category_new_dto GetTopNewCategory(List<bailun_category_new_dto> datas, int category_id)
{
if (datas == null) datas = GetNewCategoryAll();
var c_data = datas.SingleOrDefault(s => s.id == category_id);
if (c_data == null) throw new Exception($" 分类id {category_id} 不存在 ");
if (c_data.parentId == 0) return c_data;
return GetTopNewCategory(datas, c_data.parentId);
}
/// <summary>
/// 查询相关的子节点
/// </summary>
/// <param name="all"></param>
/// <param name="id"></param>
/// <returns></returns>
public static List<bailun_category_new_dto> GetNewClientNodesByIds(List<int> ids)
{
if (ids == null || ids.Count <= 0)
{
return new List<bailun_category_new_dto>();
}
List<bailun_category_new_dto> datas = new List<bailun_category_new_dto>();
var all = GetNewCategoryList(0);
foreach (var item in ids)
{
datas.AddRange(GetNewClientNodesById(all, item));
}
return datas;
}
/// <summary>
/// 查询相关的子节点
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
public static List<bailun_category_new_dto> GetNewClientNodesById(List<bailun_category_new_dto> all, int id)
{
// 查询所有数据
if (all == null)
{
all = GetNewCategoryList(0);
}
List<bailun_category_new_dto> clients = all.Where(s => s.id == id).ToList();
var cNodes = all.Where(s => s.parentId == id).ToList();
if (cNodes != null || cNodes.Count >= 1)
{
foreach (var item in cNodes)
{
clients.AddRange(GetNewClientNodesById(all, item.id));
}
}
return clients;
}
}
}
using AutoTurnOver.Models;
using AutoTurnOver.Models.ApiDto;
using AutoTurnOver.Utility;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Text;
using System.Linq;
namespace AutoTurnOver.Services
{
......@@ -38,9 +39,14 @@ namespace AutoTurnOver.Services
}
public List<dc_base_stock_dto> RealtimeList(string sku,string bailun_sku, string warehouse_code, string product_inner_code, string sku_title_cn,string supplier_name, int offset, int limit, ref int total, string warehousetype, int? warehousearea,bool isSum = false,string order = null,string sort = null,int? has_tort = null)
public List<dc_base_stock_dto> RealtimeList(string sku,string bailun_sku, string warehouse_code, string product_inner_code, string sku_title_cn,string supplier_name, int offset, int limit, ref int total, string warehousetype, int? warehousearea,bool isSum = false,string order = null,string sort = null,int? has_tort = null,string categoryIds = null)
{
return DB.daily.RealtimeList(sku, bailun_sku, warehouse_code,product_inner_code,sku_title_cn, supplier_name, offset, limit, ref total,warehousetype,warehousearea, isSum, order, sort, has_tort:has_tort);
List<bailun_category_new_dto> categoryModels = null;
if (!string.IsNullOrWhiteSpace(categoryIds))
{
categoryModels = ApiServices.GetNewClientNodesByIds(categoryIds.Split(',').Select(s => int.Parse(s)).ToList());
}
return DB.daily.RealtimeList(sku, bailun_sku, warehouse_code,product_inner_code,sku_title_cn, supplier_name, offset, limit, ref total,warehousetype,warehousearea, isSum, order, sort, has_tort:has_tort, categoryModels: categoryModels);
}
......
......@@ -449,7 +449,7 @@ namespace AutoTurnOver.Services
public void ShortagePush(bool is_all = false)
{
var datas = report.ShortagePush(is_all);
var err_datas = ApiServices.ShortagePush(datas);
var err_datas = ApiServices.ShortagePush(datas);
// 记录推送状态
report.AddShortagePush(datas.Where(s=> !err_datas.Any(e=>e.warehouseCode==s.warehouse_code && s.bailun_sku==e.sku )));
......
......@@ -28,7 +28,7 @@ namespace AutoTurnOver.Services
{
if (!string.IsNullOrWhiteSpace(m.categoryIds))
{
m.categoryModels = ApiServices.GetClientNodesByIds(m.categoryIds.Split(',').Select(s=>int.Parse(s)).ToList());
m.categoryModels = ApiServices.GetNewClientNodesByIds(m.categoryIds.Split(',').Select(s=>int.Parse(s)).ToList());
}
return DB.dc_auto_turnover.List(m,offset, limit, ref total,order,sort, isSum);
}
......
......@@ -170,7 +170,33 @@ namespace AutoTurnOver.Controllers
}
}
public JsonResult GetNewCategoryAll()
{
try
{
var datas = ApiServices.GetNewCategoryAll().Select(s => new {
id = s.id,
pId = s.parentId,
name = s.name,
open = false
});
return new JsonResult(new
{
data = datas,
success = true
});
}
catch (Exception ex)
{
return new JsonResult(new
{
message = ex.Message,
success = false
});
}
}
}
}
\ No newline at end of file
......@@ -62,12 +62,12 @@ namespace AutoTurnOver.Controllers
/// <param name="offset"></param>
/// <param name="limit"></param>
/// <returns></returns>
public JsonResult RealtimeList(string sku,string bailun_sku, string warehousecode, string product_inner_code, string sku_title_cn,string supplier_name, int offset, int limit, string order, string sort, string warehousetype, int? warehousearea,int? has_tort = null)
public JsonResult RealtimeList(string sku,string bailun_sku, string warehousecode, string product_inner_code, string sku_title_cn,string supplier_name, int offset, int limit, string order, string sort, string warehousetype, int? warehousearea,int? has_tort = null, string categoryIds = null)
{
var services = new DailyServices();
var total = 0;
var list = services.RealtimeList(sku, bailun_sku, warehousecode,product_inner_code, sku_title_cn, supplier_name, offset, limit, ref total,warehousetype,warehousearea,order: order, sort: sort, has_tort : has_tort);
var list = services.RealtimeList(sku, bailun_sku, warehousecode,product_inner_code, sku_title_cn, supplier_name, offset, limit, ref total,warehousetype,warehousearea,order: order, sort: sort, has_tort : has_tort,categoryIds: categoryIds);
return new JsonResult(new
{
......@@ -76,12 +76,12 @@ namespace AutoTurnOver.Controllers
});
}
public JsonResult RealtimeListSumFooter(string sku, string bailun_sku, string warehousecode, string product_inner_code, string sku_title_cn,string supplier_name, int offset, int limit, string order, string sort, string warehousetype, int? warehousearea,int? has_tort = null)
public JsonResult RealtimeListSumFooter(string sku, string bailun_sku, string warehousecode, string product_inner_code, string sku_title_cn,string supplier_name, int offset, int limit, string order, string sort, string warehousetype, int? warehousearea,int? has_tort = null, string categoryIds = null)
{
var services = new DailyServices();
var total = 0;
var list = services.RealtimeList(sku, bailun_sku, warehousecode, product_inner_code, sku_title_cn, supplier_name, offset, limit, ref total, warehousetype, warehousearea,true, has_tort: has_tort);
var list = services.RealtimeList(sku, bailun_sku, warehousecode, product_inner_code, sku_title_cn, supplier_name, offset, limit, ref total, warehousetype, warehousearea,true, has_tort: has_tort, categoryIds: categoryIds);
return new JsonResult(list == null || list.Count <= 0 ? new dc_base_stock_dto() : list[0]);
}
......
......@@ -34,5 +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://www.bailuntec.com/Api/Cq/GetSchedulings?userID=2409",
"SkuSys_CategoryList": "http://api.skums.bailuntec.com/api/category/simplecategory/categoriessimplebylevel"
}
......@@ -34,5 +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://www.bailuntec.com/Api/Cq/GetSchedulings?userID=2409",
"SkuSys_CategoryList": "http://api.skums.bailuntec.com/api/category/simplecategory/categoriessimplebylevel"
}
......@@ -34,5 +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://www.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