仓库-批量查看,出库记录根据批次号批量查看功能实现
This commit is contained in:
@@ -17,13 +17,13 @@ namespace ZR.Service.mes.wms.IService
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
List<WmGoodsBatchTableDto> GetBatchOutRecordByPackageCodeShort(WmGoodsBatchSearchDto parm);
|
||||
PagedInfo<WmGoodsBatchTableDto> GetBatchOutRecordByPackageCodeShort(WmGoodsBatchSearchDto parm);
|
||||
/// <summary>
|
||||
/// 树表子节点懒加载查询
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
List<WmGoodsBatchTableDto> GetBatchOutRecordTreeLazyByPackageCodeShort(WmGoodsBatchSearchDto parm);
|
||||
PagedInfo<WmGoodsBatchTableDto> GetBatchOutRecordTreeLazyByPackageCodeShort(WmGoodsBatchSearchDto parm);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ using MimeKit.Utils;
|
||||
using System.Collections.Generic;
|
||||
using Org.BouncyCastle.Crypto;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
using JinianNet.JNTemplate;
|
||||
|
||||
namespace ZR.Service.Business
|
||||
{
|
||||
@@ -24,25 +25,52 @@ namespace ZR.Service.Business
|
||||
[AppService(ServiceType = typeof(IWmGoodsBatchSearchService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class WmGoodsBatchSearchService : BaseService<WmGoodsBatchSearchDto>, IWmGoodsBatchSearchService
|
||||
{
|
||||
public List<WmGoodsBatchTableDto> GetBatchOutRecordByPackageCodeShort(WmGoodsBatchSearchDto parm)
|
||||
public PagedInfo<WmGoodsBatchTableDto> GetBatchOutRecordByPackageCodeShort(WmGoodsBatchSearchDto parm)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 查询条件
|
||||
var exp = Expressionable.Create<WmGoodsOutRecord>()
|
||||
.AndIF(!string.IsNullOrEmpty(parm.Partnumber), it => it.PackageCodeClient.Contains(parm.Partnumber))
|
||||
.AndIF(!string.IsNullOrEmpty(parm.PackageCode), it => it.PackageCodeClient.Contains(parm.PackageCode))
|
||||
.AndIF(!string.IsNullOrEmpty(parm.Partnumber), it => it.Partnumber.Contains(parm.Partnumber))
|
||||
// 根据sql语句进行切换
|
||||
.AndIF(!string.IsNullOrEmpty(parm.PackageCode), it => it.PackageCode.Contains(parm.PackageCode))
|
||||
.ToExpression();
|
||||
// 出库记录
|
||||
List<WmGoodsOutRecord> outPackageList = Context.Queryable<WmGoodsOutRecord>()
|
||||
.Where(exp)
|
||||
.GroupBy(x => x.PackageCode)
|
||||
|
||||
.ToList();
|
||||
|
||||
|
||||
|
||||
List<WmGoodsBatchTableDto> result = new List<WmGoodsBatchTableDto>();
|
||||
string sql = "SELECT\n" +
|
||||
" MAX( id ) AS ID,\n" +
|
||||
" SUBSTRING_INDEX( package_code_client, '_', 1 ) AS PackageCodeClient_son,\n" +
|
||||
" NULL AS PackageCodeClient_short_parent,\n" +
|
||||
" MAX( partnumber ) AS Partnumber,\n" +
|
||||
" '' AS Description,\n" +
|
||||
" SUBSTRING_INDEX( package_code_client, '_', 1 ) AS PackageCode,\n" +
|
||||
" MAX( location_code ) AS LocationCode,\n" +
|
||||
" COUNT( * ) AS PackageNum,\n" +
|
||||
" SUM( goods_num_logic ) AS GoodsNumLogic,\n" +
|
||||
" SUM( goods_num_action ) AS GoodsNumAction,\n" +
|
||||
" MAX( Remark ) AS Remark,\n" +
|
||||
" MAX( out_time ) AS OutTime,\n" +
|
||||
" TRUE AS HasChild \n" +
|
||||
"FROM\n" +
|
||||
" wm_goods_out_record \n" +
|
||||
"GROUP BY\n" +
|
||||
" PackageCode \n" +
|
||||
"ORDER BY\n" +
|
||||
" OutTime DESC";
|
||||
PagedInfo<WmGoodsBatchTableDto> result = Context.SqlQueryable<WmGoodsOutRecord>(sql)
|
||||
.Where(exp)
|
||||
.Select<WmGoodsBatchTableDto>()
|
||||
.ToPage(parm);
|
||||
foreach(WmGoodsBatchTableDto item in result.Result)
|
||||
{
|
||||
WmMaterial material = Context.Queryable<WmMaterial>()
|
||||
.Where(it => it.Partnumber.Contains(item.Partnumber))
|
||||
.First();
|
||||
if(material == null)
|
||||
{
|
||||
item.Description = "此零件号不在物料清单内!";
|
||||
continue;
|
||||
}
|
||||
item.Description = !string.IsNullOrEmpty(material.Description) ? material.Description : material.ProductName;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
catch
|
||||
@@ -52,9 +80,50 @@ namespace ZR.Service.Business
|
||||
|
||||
}
|
||||
|
||||
public List<WmGoodsBatchTableDto> GetBatchOutRecordTreeLazyByPackageCodeShort(WmGoodsBatchSearchDto parm)
|
||||
public PagedInfo<WmGoodsBatchTableDto> GetBatchOutRecordTreeLazyByPackageCodeShort(WmGoodsBatchSearchDto parm)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
try
|
||||
{
|
||||
PagedInfo<WmGoodsBatchTableDto> result = new PagedInfo<WmGoodsBatchTableDto>();
|
||||
// 出库记录
|
||||
List<WmGoodsBatchTableDto> list = Context.Queryable<WmGoodsOutRecord>()
|
||||
.Where(it => it.PackageCodeClient.Contains(parm.PackageCode))
|
||||
.Select(it => new WmGoodsBatchTableDto
|
||||
{
|
||||
Id = it.Id,
|
||||
PackageCode = it.PackageCodeClient,
|
||||
PackageCodeClient_son = null,
|
||||
PackageCodeClient_short_parent = parm.PackageCode,
|
||||
Partnumber = it.Partnumber,
|
||||
Description = "",
|
||||
LocationCode = it.LocationCode,
|
||||
PackageNum = 1,
|
||||
GoodsNumLogic = (int)it.GoodsNumLogic,
|
||||
GoodsNumAction = (int)it.GoodsNumAction,
|
||||
OutTime = it.OutTime,
|
||||
Remark = it.Remark,
|
||||
HasChild = false
|
||||
})
|
||||
.OrderBy(it => it.Id)
|
||||
.ToList();
|
||||
foreach (WmGoodsBatchTableDto item in list)
|
||||
{
|
||||
WmMaterial material = Context.Queryable<WmMaterial>()
|
||||
.Where(it => it.Partnumber.Contains(item.Partnumber))
|
||||
.First();
|
||||
if (material == null)
|
||||
{
|
||||
item.Description = "此零件号不在物料清单内!";
|
||||
continue;
|
||||
}
|
||||
item.Description = !string.IsNullOrEmpty(material.Description) ? material.Description : material.ProductName;
|
||||
}
|
||||
result.Result = list;
|
||||
return result;
|
||||
}
|
||||
catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user