diff --git a/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml b/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml
index c0538678..6b6b58c8 100644
--- a/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml
+++ b/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml
@@ -450,6 +450,11 @@
产品数量
+
+
+ 排序
+
+
生成箱唛dto
diff --git a/src/WMS.Web.Core/Dto/BoxMark/BoxMarkQueryResponse.cs b/src/WMS.Web.Core/Dto/BoxMark/BoxMarkQueryResponse.cs
index ab552fa3..c85f3f5d 100644
--- a/src/WMS.Web.Core/Dto/BoxMark/BoxMarkQueryResponse.cs
+++ b/src/WMS.Web.Core/Dto/BoxMark/BoxMarkQueryResponse.cs
@@ -107,5 +107,10 @@ namespace WMS.Web.Core.Dto
/// 产品数量
///
public decimal ProductQty { get; set; }
+
+ ///
+ /// 排序
+ ///
+ public int Sort { get; set; }
}
}
diff --git a/src/WMS.Web.Domain/Services/BoxMarkService.cs b/src/WMS.Web.Domain/Services/BoxMarkService.cs
index d234b04d..6ece8a9c 100644
--- a/src/WMS.Web.Domain/Services/BoxMarkService.cs
+++ b/src/WMS.Web.Domain/Services/BoxMarkService.cs
@@ -1,6 +1,7 @@
using AutoMapper;
using System;
using System.Collections.Generic;
+using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WMS.Web.Core.Dto;
@@ -59,7 +60,44 @@ namespace WMS.Web.Domain.Services
//返回列表-对应刚刚生成的数据和编号集合
var list= await _boxMarkRepositories.GetListInfoBy(model.Id, loginInfo.UserInfo.CompanyId);
- return ResultList.ReSuccess(list);
+
+ //处理-批次生成的排序和总数量
+ var resultList = new List();
+ if (list != null && list.Count != 0)
+ {
+ list.ForEach(x =>
+ {
+ x.BoxSortCount = this.GetSortCount(x.ProductQty, x.CratingQty);
+
+ });
+
+ var ids = list.GroupBy(x => x.Id).Select(x => x.Key).ToList();
+ foreach (var id in ids)
+ {
+
+ var itemDetailId = 0;
+ foreach (var item in list)
+ {
+ if (id == item.Id)
+ {
+
+ var current = resultList.Where(x => x.DetailId == itemDetailId).FirstOrDefault();
+
+ var newItem = item;
+ if (current == null)
+ newItem.Sort = 1;
+ else
+ newItem.Sort = current.Sort + 1;
+ resultList.Add(newItem);
+ itemDetailId = item.DetailId;
+ }
+ }
+ }
+
+
+ }
+
+ return ResultList.ReSuccess(resultList);
}
///
@@ -72,15 +110,43 @@ namespace WMS.Web.Domain.Services
{
var (list, count) = await _boxMarkRepositories.GetPagedList(dto, companyId);
+ var resultList = new List();
+
if (list != null && list.Count != 0)
{
list.ForEach(x =>
{
x.BoxSortCount = this.GetSortCount(x.ProductQty, x.CratingQty);
+
});
+
+ var ids = list.GroupBy(x => x.Id).Select(x => x.Key).ToList();
+ foreach (var id in ids)
+ {
+
+ var itemDetailId = 0;
+ foreach (var item in list)
+ {
+ if (id == item.Id)
+ {
+
+ var current= resultList.Where(x => x.DetailId == itemDetailId).FirstOrDefault();
+
+ var newItem = item;
+ if (current == null)
+ newItem.Sort =1;
+ else
+ newItem.Sort = current.Sort+ 1;
+ resultList.Add(newItem);
+ itemDetailId = item.DetailId;
+ }
+ }
+ }
+
+
}
- return (list, count);
+ return (resultList, count);
}
///
@@ -102,5 +168,7 @@ namespace WMS.Web.Domain.Services
boxCount = Convert.ToInt32(Math.Ceiling(boxCount_tag));
return boxCount;
}
+
+
}
}
diff --git a/src/WMS.Web.Repositories/BoxMarkRepositories.cs b/src/WMS.Web.Repositories/BoxMarkRepositories.cs
index e3a698b7..bc13ed7b 100644
--- a/src/WMS.Web.Repositories/BoxMarkRepositories.cs
+++ b/src/WMS.Web.Repositories/BoxMarkRepositories.cs
@@ -218,6 +218,7 @@ namespace WMS.Web.Repositories
var query = _context.BoxMarkBillNo
.GroupJoin(_context.BoxMark, detail => detail.Fid, order => order.Id, (detail, orders) => new { detail, orders })
.SelectMany(x => x.orders.DefaultIfEmpty(), (p, order) => new { p.detail, order })
+ .OrderByDescending(x => x.detail.Id).ThenByDescending(x => x.detail.FirstBillNo).ThenByDescending(x => x.detail.LastBillNo)
.Where(adv => adv.order.Id == id);
var list = await query.Select(s => new BoxMarkQueryResponse()
{
@@ -229,17 +230,20 @@ namespace WMS.Web.Repositories
MaterialNumber = _erpBasicDataExtendService.GetMaterialNumber(materials, s.order.MaterialId),
Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.order.MaterialId),
BarCode = _erpBasicDataExtendService.GetMaterialBarCode(materials, s.order.MaterialId),
+
CratingQty = s.order.CratingQty,
CratingNetWeightQty = s.order.CratingNetWeightQty,
CratingGrossWeightQty = s.order.CratingGrossWeightQty,
+
TailboxQty = s.order.TailboxQty,
TailboxNetWeightQty = s.order.TailboxNetWeightQty,
TailboxGrossWeightQty = s.order.TailboxGrossWeightQty,
IsTail = s.detail.IsTail,
Creator = _singleDataService.GetSingleData(SingleAction.Staffs, companyId, s.order.CreatorId),
CreateTime = s.order.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"),
- Remark = s.order.Remark
- }).OrderByDescending(x => x.DetailId).ToListAsync();
+ Remark = s.order.Remark,
+ ProductQty = s.order.ProductQty,
+ }).ToListAsync();
return list;
}