diff --git a/ZR.Admin.WebApi/Controllers/mes/wms/WmGoodsNowProductionController.cs b/ZR.Admin.WebApi/Controllers/mes/wms/WmGoodsNowProductionController.cs index d8d5d66f..03ba6fc3 100644 --- a/ZR.Admin.WebApi/Controllers/mes/wms/WmGoodsNowProductionController.cs +++ b/ZR.Admin.WebApi/Controllers/mes/wms/WmGoodsNowProductionController.cs @@ -57,10 +57,15 @@ namespace ZR.Admin.WebApi.Controllers /// /// [HttpGet("shortPatchsearch")] - public IActionResult QueryshortPatch(WmGoodsNowProductionQueryDto parm) + public IActionResult QueryshortPatch(CommonQueryDto parm) { - var response = _WmGoodsNowProductionService.QueryshortPatch(parm); - return SUCCESS(response); + List response = _WmGoodsNowProductionService.QueryshortPatch(parm); + var json = new + { + list = response, + total = response.Count + }; + return ToResponse(new ApiResult(200, "ok", json)); } /// /// 移动端 短批次号查询 @@ -84,7 +89,7 @@ namespace ZR.Admin.WebApi.Controllers public IActionResult GetWmGoodsNowProduction(string Id) { var response = _WmGoodsNowProductionService.GetInfo(Id); - + var info = response.Adapt(); return SUCCESS(info); } @@ -144,14 +149,14 @@ namespace ZR.Admin.WebApi.Controllers /// /// [HttpGet("modifyInventoryQuantity")] - public IActionResult ModifyInventoryQuantity(string id,int stack_num) + public IActionResult ModifyInventoryQuantity(string id, int stack_num) { - if(string.IsNullOrEmpty(id)) + if (string.IsNullOrEmpty(id)) { return SUCCESS(null); } - var response= _WmGoodsNowProductionService.ModifyInventoryQuantity(id, stack_num); - return SUCCESS(response); + var response = _WmGoodsNowProductionService.ModifyInventoryQuantity(id, stack_num); + return SUCCESS(response); } diff --git a/ZR.Admin.WebApi/Controllers/mes/wms/WmOutOrderController.cs b/ZR.Admin.WebApi/Controllers/mes/wms/WmOutOrderController.cs index a70ea8c8..0f61eb01 100644 --- a/ZR.Admin.WebApi/Controllers/mes/wms/WmOutOrderController.cs +++ b/ZR.Admin.WebApi/Controllers/mes/wms/WmOutOrderController.cs @@ -155,7 +155,7 @@ namespace ZR.Admin.WebApi.Controllers /// - /// 生成出货单的出货计划 + /// 8.1根据出库单生成出库计划 /// /// /// @@ -167,28 +167,57 @@ namespace ZR.Admin.WebApi.Controllers return SUCCESS(null); } // TODO 1.返回值修改为 对象 返回是否可生成计划,计划结果:{canPlan:true,resultList:[]} + // XXX 无计划返回空即可 List WmOutOrderPlanList = _WmOutOrderService.Generate_outorderplan(shipment_num); - return SUCCESS(WmOutOrderPlanList); } /// - /// 持久化存储出货单的出货计划 + /// 8.2 持久化存储出库单的出库计划 /// /// /// [HttpGet("persistenceOutorderplan")] public IActionResult PersistenceOutorderplan(string shipment_num) { - if (shipment_num == null) { return SUCCESS(null); } int result= _WmOutOrderService.PersistenceOutorderplan(shipment_num); - return SUCCESS(result); + } + /// + /// 8.3 获取出库单的持久化存储出库计划 + /// + /// + /// + [HttpGet("getOutOrderplan")] + public IActionResult getOutOrderplan(string shipment_num) + { + if (shipment_num == null) + { + return SUCCESS(null); + } + int result = _WmOutOrderService.PersistenceOutorderplan(shipment_num); + return SUCCESS(result); + } + + /// + /// 8.4 获取出库单的已出货物 + /// + /// + /// + [HttpGet("getOutOrderOutProduction")] + public IActionResult getOutOrderOutProduction(string shipment_num) + { + if (shipment_num == null) + { + return SUCCESS(null); + } + int result = _WmOutOrderService.PersistenceOutorderplan(shipment_num); + return SUCCESS(result); } /// diff --git a/ZR.Model/MES/wms/Dto/WmGoodsActionDto.cs b/ZR.Model/MES/wms/Dto/WmGoodsActionDto.cs index 9c388900..82d02e0b 100644 --- a/ZR.Model/MES/wms/Dto/WmGoodsActionDto.cs +++ b/ZR.Model/MES/wms/Dto/WmGoodsActionDto.cs @@ -2,6 +2,13 @@ using System.ComponentModel.DataAnnotations; namespace ZR.Model.MES.wms.Dto { + /// + /// 通用查询条件 + /// + public class CommonQueryDto : PagerInfo + { + public string Query { get; set; } + } /// /// 拼箱操作 /// diff --git a/ZR.Model/MES/wms/Dto/WmGoodsNowProductionDto.cs b/ZR.Model/MES/wms/Dto/WmGoodsNowProductionDto.cs index 26b84106..41f846a5 100644 --- a/ZR.Model/MES/wms/Dto/WmGoodsNowProductionDto.cs +++ b/ZR.Model/MES/wms/Dto/WmGoodsNowProductionDto.cs @@ -75,8 +75,6 @@ namespace ZR.Model.MES.wms.Dto public string CreatedBy { get; set; } public DateTime? CreatedTime { get; set; } - - - } + } \ No newline at end of file diff --git a/ZR.Model/MES/wms/Dto/WmGoods_nodeDto.cs b/ZR.Model/MES/wms/Dto/WmGoods_nodeDto.cs index 762492d2..53a4d3a2 100644 --- a/ZR.Model/MES/wms/Dto/WmGoods_nodeDto.cs +++ b/ZR.Model/MES/wms/Dto/WmGoods_nodeDto.cs @@ -55,4 +55,31 @@ namespace ZR.Model.MES.wms.Dto public DateTime? CreatedTime { get; set; } } + + /// + /// 成品库短批次号集合显示 + /// + public class WmGoodShortPackageCodeDto + { + /// + /// 短批次号 + /// + public string ShortPackageCode { get; set; } + /// + /// 短批次总箱数 + /// + public int PackageNumber { get; set; } + /// + /// 短批次总零件数 + /// + public int? PartnumberNumber { get; set; } + /// + /// 短批次零件号 + /// + public string Partnumber { get; set; } + /// + /// 短批次系统入库时间 + /// + public DateTime? EntryWarehouseTime { get; set; } + } } diff --git a/ZR.Service/mes/wms/IService/IWmGoodsNowProductionService.cs b/ZR.Service/mes/wms/IService/IWmGoodsNowProductionService.cs index e94849ce..38473d83 100644 --- a/ZR.Service/mes/wms/IService/IWmGoodsNowProductionService.cs +++ b/ZR.Service/mes/wms/IService/IWmGoodsNowProductionService.cs @@ -23,14 +23,14 @@ namespace ZR.Service.mes.wms.IService (List, int) QuerypatchsearchList(WmGoodsNowProductionQueryDto parm); /// - /// 短批次查询 + /// 移动端 短批次查询 /// /// /// - List QueryshortPatch(WmGoodsNowProductionQueryDto parm); + List QueryshortPatch(CommonQueryDto parm); /// - /// 移动端 查询短批次号 细则 + /// 移动端 查询短批次号 细则详情 /// /// /// diff --git a/ZR.Service/mes/wms/WmGoodsNowProductionService.cs b/ZR.Service/mes/wms/WmGoodsNowProductionService.cs index bcb57b9f..ecb29d61 100644 --- a/ZR.Service/mes/wms/WmGoodsNowProductionService.cs +++ b/ZR.Service/mes/wms/WmGoodsNowProductionService.cs @@ -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(parm); - + return response; } @@ -98,21 +99,53 @@ namespace ZR.Service.mes.wms return (list, total); } /// - /// 移动端 短批次号查询 + /// 移动端 货物查看 根据Query零件号与批次号查看信息 /// /// /// - public List QueryshortPatch(WmGoodsNowProductionQueryDto parm) + public List QueryshortPatch(CommonQueryDto parm) { - - List list = null; - int total = 0; + // 结果集 + List resultList = new(); + // 全数据处理 var predicate = Expressionable.Create() - .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 wmGoodsNowsList = Context.Queryable() + .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 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;*/ } /// /// 移动端 短批次号详情 /// /// /// - public List Patchsearchdetail(WmGoodsNowProductionQueryDto parm) + public List Patchsearchdetail(WmGoodsNowProductionQueryDto parm) { var predicate = Expressionable.Create() .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>(); + 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 /// /// /// - public int ModifyInventoryQuantity(string id, int stack_num) + public int ModifyInventoryQuantity(string id, int stack_num) { - return Context.Updateable() - .SetColumns(it => it.GoodsNumAction == stack_num) - .Where(it => it.Id == id).ExecuteCommand(); + return Context.Updateable() + .SetColumns(it => it.GoodsNumAction == stack_num) + .Where(it => it.Id == id).ExecuteCommand(); } }