PDA-库存查询功能更新

This commit is contained in:
2024-04-25 12:49:18 +08:00
parent 263f30822e
commit f88c6826c1
7 changed files with 147 additions and 41 deletions

View File

@@ -23,14 +23,14 @@ namespace ZR.Service.mes.wms.IService
(List<WmGoods_nodeDto>, int) QuerypatchsearchList(WmGoodsNowProductionQueryDto parm);
/// <summary>
/// 短批次查询
/// 移动端 短批次查询
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
List<WmGoods_nodeDto> QueryshortPatch(WmGoodsNowProductionQueryDto parm);
List<WmGoodShortPackageCodeDto> QueryshortPatch(CommonQueryDto parm);
/// <summary>
/// 移动端 查询短批次号 细则
/// 移动端 查询短批次号 细则详情
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>

View File

@@ -11,6 +11,7 @@ using ZR.Model.MES.wms.Dto;
using ZR.Service.mes.wms.IService;
using System.Collections.Generic;
using Mapster;
using System.Reflection;
namespace ZR.Service.mes.wms
{
@@ -36,7 +37,7 @@ namespace ZR.Service.mes.wms
var response = Queryable()
.Where(predicate.ToExpression())
.ToPage<WmGoodsNowProduction, WmGoodsNowProductionDto>(parm);
return response;
}
@@ -98,21 +99,53 @@ namespace ZR.Service.mes.wms
return (list, total);
}
/// <summary>
/// 移动端 批次号查
/// 移动端 货物查看 根据Query零件号与批次号查看信息
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public List<WmGoods_nodeDto> QueryshortPatch(WmGoodsNowProductionQueryDto parm)
public List<WmGoodShortPackageCodeDto> QueryshortPatch(CommonQueryDto parm)
{
List<WmGoods_nodeDto> list = null;
int total = 0;
// 结果集
List<WmGoodShortPackageCodeDto> resultList = new();
// 全数据处理
var predicate = Expressionable.Create<WmGoodsNowProduction>()
.AndIF(!string.IsNullOrEmpty(parm.Partnumber), it => it.Partnumber.Contains(parm.Partnumber))
.AndIF(!string.IsNullOrEmpty(parm.PackageCodeClient), it => it.PackageCodeClient.Contains(parm.PackageCodeClient));
.OrIF(!string.IsNullOrEmpty(parm.Query), it => it.Partnumber.Contains(parm.Query))
.OrIF(!string.IsNullOrEmpty(parm.Query), it => it.PackageCodeClient.Contains(parm.Query));
List<WmGoodsNowProduction> wmGoodsNowsList = Context.Queryable<WmGoodsNowProduction>()
.Where(predicate.ToExpression())
.OrderByDescending(it => it.PackageCodeClient)
.ToList();
// 聚合数据
resultList = wmGoodsNowsList.GroupBy(it => it.PackageCodeClient.Split('_')[0])
.Select(group => new WmGoodShortPackageCodeDto
{
ShortPackageCode = group.Key,
Partnumber = group.Max(item => item.Partnumber),
EntryWarehouseTime = group.Max(item => item.EntryWarehouseTime),
PackageNumber = group.Count(),
PartnumberNumber = group.Sum(item=>item.GoodsNumAction)
}).ToList();
// 结果数据处理
//每页多少条
int rows = parm.PageSize;
//第几页
int page = parm.PageNum;
//每一页开始下标
int startIndex = (page - 1) * rows;
//数据总数
int sum = resultList.Count;
List<WmGoodsNowProduction> rawdatas = Queryable().Where(predicate.ToExpression()).ToList();
if (rawdatas != null && rawdatas.Count > 0)
if (startIndex + rows > sum)
{
resultList = resultList.Skip(startIndex).Take(sum).ToList();
}
else
{
resultList = resultList.Skip(startIndex).Take(startIndex + rows).ToList();
}
return resultList;
/*if (rawdatas != null && rawdatas.Count > 0)
{
//todo 对字段进行拆分
@@ -149,25 +182,32 @@ namespace ZR.Service.mes.wms
return WmGoods_nodeDto_list_parent.OrderByDescending(it => it.PackageCodeClient_son).ToList();
}
return null;
return null;*/
}
/// <summary>
/// 移动端 短批次号详情
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public List<WmGoodsNowProductionDto> Patchsearchdetail(WmGoodsNowProductionQueryDto parm)
public List<WmGoodsNowProductionDto> Patchsearchdetail(WmGoodsNowProductionQueryDto parm)
{
var predicate = Expressionable.Create<WmGoodsNowProduction>()
.AndIF(!string.IsNullOrEmpty(parm.PackageCodeClient), it => it.PackageCodeClient.Contains(parm.PackageCodeClient));
var response = Queryable()
.Where(predicate.ToExpression())
.OrderBy(it=>it.PackageCodeClient)
.OrderBy(it => it.PackageCodeClient)
.Select(it => new WmGoodsNowProductionDto
{
PackageCodeClient = it.PackageCodeClient,
LocationCode = it.LocationCode,
Partnumber = it.Partnumber,
GoodsNumAction = it.GoodsNumAction,
EntryWarehouseTime = it.EntryWarehouseTime,
Remark = (!string.IsNullOrEmpty(it.Remark)? it.Remark:"无备注"),
})
.ToList();
return response.Adapt<List<WmGoodsNowProductionDto>>();
return response;
}
@@ -197,9 +237,9 @@ namespace ZR.Service.mes.wms
{
model.Id = SnowFlakeSingle.Instance.NextId().ToString();//也可以在程序中直接获取ID
}
if(string.IsNullOrEmpty(model.PackageCode))
if (string.IsNullOrEmpty(model.PackageCode))
{
model.PackageCode=model.PackageCodeClient;
model.PackageCode = model.PackageCodeClient;
}
if (string.IsNullOrEmpty(model.PackageCodeOriginal))
{
@@ -241,11 +281,11 @@ namespace ZR.Service.mes.wms
/// <param name="id"></param>
/// <param name="stack_num"></param>
/// <returns></returns>
public int ModifyInventoryQuantity(string id, int stack_num)
public int ModifyInventoryQuantity(string id, int stack_num)
{
return Context.Updateable<WmGoodsNowProduction>()
.SetColumns(it => it.GoodsNumAction == stack_num)
.Where(it => it.Id == id).ExecuteCommand();
return Context.Updateable<WmGoodsNowProduction>()
.SetColumns(it => it.GoodsNumAction == stack_num)
.Where(it => it.Id == id).ExecuteCommand();
}
}