1
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
namespace Tnb.BasicData.Entities.Dto
|
||||
{
|
||||
public class MaterialQueryInput
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 查询条件
|
||||
/// </summary>
|
||||
public string queryJson { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 物料类型
|
||||
/// </summary>
|
||||
public string types { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 当前页码:pageIndex.
|
||||
/// </summary>
|
||||
public virtual int currentPage { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// 每页行数.
|
||||
/// </summary>
|
||||
public virtual int pageSize { get; set; } = 50;
|
||||
}
|
||||
}
|
||||
@@ -25,5 +25,12 @@ namespace Tnb.BasicData.Interfaces
|
||||
/// <param name="dic"></param>
|
||||
/// <returns></returns>
|
||||
public Task<dynamic> GetMaterialByType(Dictionary<string, string> dic);
|
||||
|
||||
/// <summary>
|
||||
/// 根据物料类型获取物料列表
|
||||
/// </summary>
|
||||
/// <param name="dic"></param>
|
||||
/// <returns></returns>
|
||||
public Task<dynamic> GetMaterialByQueryJson(MaterialQueryInput input);
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ using JNPF.FriendlyException;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.BasicData.Entities.Dto;
|
||||
@@ -174,6 +175,48 @@ namespace Tnb.BasicData
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetMaterialByQueryJson(MaterialQueryInput input)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
Dictionary<string, string>? queryJson = new Dictionary<string, string>();
|
||||
if (input!=null && !string.IsNullOrEmpty(input.queryJson))
|
||||
{
|
||||
queryJson = JsonConvert.DeserializeObject<Dictionary<string, string>>(input?.queryJson ?? "");
|
||||
}
|
||||
|
||||
List<string> typeList = new List<string>();
|
||||
if(!string.IsNullOrEmpty(input.types))
|
||||
{
|
||||
typeList = JsonConvert.DeserializeObject<List<string>>(input.types);
|
||||
}
|
||||
var query = db.Queryable<BasMaterial>()
|
||||
.Where(x => x.state == "1")
|
||||
.WhereIF(queryJson != null && queryJson.ContainsKey("name"), a => a.name.Contains(queryJson["name"]))
|
||||
.WhereIF(queryJson != null && queryJson.ContainsKey("code"), a => a.code.Contains(queryJson["code"]))
|
||||
.WhereIF(queryJson != null && queryJson.ContainsKey("material_standard"),
|
||||
a => a.material_standard.Contains(queryJson["material_standard"]))
|
||||
.Select(x => x);
|
||||
|
||||
var list = new List<ISugarQueryable<BasMaterial>>();
|
||||
foreach (var type in typeList)
|
||||
{
|
||||
list.Add(query.Clone().Where(x=>x.category_id.Contains(type)));
|
||||
}
|
||||
|
||||
if (list.Count <= 0)
|
||||
{
|
||||
var result = await query.ToPagedListAsync((input?.currentPage??1), (input?.pageSize??50));
|
||||
return PageResult<BasMaterial>.SqlSugarPageResult(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
var result = await db.UnionAll(list).Select<BasMaterial>().ToPagedListAsync((input?.currentPage??1), (input?.pageSize??50));
|
||||
return PageResult<BasMaterial>.SqlSugarPageResult(result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取物料清单下所子集物料id
|
||||
|
||||
@@ -192,6 +192,40 @@ namespace Tnb.WarehouseMgr.Entities.Consts
|
||||
/// 载具规格-料架
|
||||
/// </summary>
|
||||
public const string CARRY_LJSTD_ID = "26037267399717";
|
||||
/// <summary>
|
||||
/// 打印状态-未打印
|
||||
/// </summary>
|
||||
public const string PRINT_STATUS_NOTPRINTED = "26191366982437";
|
||||
/// <summary>
|
||||
/// 打印状态-打印中
|
||||
/// </summary>
|
||||
public const string PRINT_STATUS_PRINTING = "26191369755173";
|
||||
/// <summary>
|
||||
/// 打印状态-打印完成
|
||||
/// </summary>
|
||||
public const string PRINT_STATUS_PRINTCOMPLETE= "26191372853541";
|
||||
/// <summary>
|
||||
/// 同步状态-无需同步
|
||||
/// </summary>
|
||||
public const string SYNC_STATUS_NONEEDSYNC = "26191359047461";
|
||||
/// <summary>
|
||||
/// 同步状态-未同步
|
||||
/// </summary>
|
||||
public const string SYNC_STATUS__NOTSYNC = "26191345740069";
|
||||
/// <summary>
|
||||
/// 同步状态-同步中
|
||||
/// </summary>
|
||||
public const string SYNC_STATUS__SYNCING = "26191348846117";
|
||||
/// <summary>
|
||||
/// 同步状态-同步完成
|
||||
/// </summary>
|
||||
public const string SYNC_STATUS__SYNCCOMPLETE = "26191351559205";
|
||||
/// <summary>
|
||||
/// 同步状态-同步失败
|
||||
/// </summary>
|
||||
public const string SYNC_STATUS__SYNCFAILED = "26191354152229";
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,24 +242,21 @@ namespace Tnb.WarehouseMgr
|
||||
List<WmsInstockD> instockds = new();
|
||||
List<WmsInstockCode> instockcodes = new();
|
||||
//入库申请主表
|
||||
if (input.data.ContainsKey("wmsInStock"))
|
||||
{
|
||||
instock = input.data.ContainsKey("wmsInStock").ToObject<WmsInstockH>();
|
||||
if (input.data.ContainsKey("wmsInStockH")) {
|
||||
instock = input.data.ContainsKey("wmsInStockH").ToObject<WmsInstockH>();
|
||||
}
|
||||
//入库申请物料明细表
|
||||
if (input.data.ContainsKey("instockds"))
|
||||
if (input.data.ContainsKey("wmsInStockds"))
|
||||
{
|
||||
if (input.data["instockds"] != null && input.data["instockds"].IsNotEmptyOrNull())
|
||||
if (input.data["wmsInStockds"] != null && input.data["wmsInStockds"].IsNotEmptyOrNull())
|
||||
{
|
||||
instockds = input.data["instockds"].ToObject<List<WmsInstockD>>();
|
||||
instockds = input.data["wmsInStockds"].ToObject<List<WmsInstockD>>();
|
||||
}
|
||||
}
|
||||
//入库申请条码明细表
|
||||
if (input.data.ContainsKey("instockcodes"))
|
||||
{
|
||||
if (input.data["instockcodes"] != null && input.data["instockcodes"].IsNotEmptyOrNull())
|
||||
{
|
||||
instockcodes = input.data["instockcodes"].ToObject<List<WmsInstockCode>>();
|
||||
if (input.data.ContainsKey("wmsInStockCodes")) {
|
||||
if (input.data["wmsInStockCodes"] != null && input.data["wmsInStockCodes"].IsNotEmptyOrNull()) {
|
||||
instockcodes = input.data["wmsInStockCodes"].ToObject<List<WmsInstockCode>>();
|
||||
}
|
||||
}
|
||||
//如果数据不全,
|
||||
@@ -272,12 +269,21 @@ namespace Tnb.WarehouseMgr
|
||||
instock.id = SnowflakeIdHelper.NextId();
|
||||
instock.biz_type = WmsWareHouseConst.BIZTYPE_WMSINSTOCK_ID;
|
||||
instock.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_INSTOCK_ENCODE).GetAwaiter().GetResult();
|
||||
instock.generate_type = "1";// 自动
|
||||
instock.sync_status =WmsWareHouseConst.SYNC_STATUS__NOTSYNC;//未同步
|
||||
instock.print_status = WmsWareHouseConst.PRINT_STATUS_PRINTCOMPLETE;//已打印
|
||||
instock.status = WmsWareHouseConst.BILLSTATUS_ADD_ID;// 新增
|
||||
instock.create_time = DateTime.Now;
|
||||
await _db.Insertable(instock).ExecuteCommandAsync();
|
||||
//明细表
|
||||
foreach (var instockd in instockds)
|
||||
{
|
||||
instockd.id = SnowflakeIdHelper.NextId();
|
||||
instockd.bill_id = instock.id;
|
||||
instockd.line_status = WmsWareHouseConst.BILLSTATUS_ADD_ID;
|
||||
instockd.qty = 0;
|
||||
instock.create_time = instock.create_time;
|
||||
instock.create_id = instock.create_id;
|
||||
}
|
||||
await _db.Insertable(instockds).ExecuteCommandAsync();
|
||||
var items = instockds.Adapt<List<WmsInstockCode>>();
|
||||
@@ -297,6 +303,9 @@ namespace Tnb.WarehouseMgr
|
||||
c.bill_d_id = instockcodes.Find(x => x.material_code == materialCode && x.code_batch == codeBatch)?.id!;
|
||||
c.barcode = instockcode.barcode;
|
||||
c.codeqty = instockcode.codeqty;
|
||||
c.is_end = 0;// 未结束
|
||||
c.create_time = instock.create_time;
|
||||
c.create_id = instock.create_id;
|
||||
instockCOdes.Add(c);
|
||||
}
|
||||
}
|
||||
@@ -387,7 +396,7 @@ namespace Tnb.WarehouseMgr
|
||||
preTaskUpInput.CarryStartLocationId = points.FirstOrDefault()!.location_id!;
|
||||
preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault()!.location_code!;
|
||||
preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList()!;
|
||||
if (input.data.ContainsKey("wmsInStock"))
|
||||
if (input.data.ContainsKey("wmsInStockH"))
|
||||
{
|
||||
//创建预任务操作记录
|
||||
var operBillId = string.Empty;
|
||||
|
||||
Reference in New Issue
Block a user