From 62e1cd910aca54583e23b038200ae865b21475d4 Mon Sep 17 00:00:00 2001 From: alex Date: Wed, 23 Aug 2023 14:58:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=89=A9=E6=96=99=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dto/Outputs/MaterailLabelOutput.cs | 76 +++++++++++++++++++ .../Dto/Queries/MaterialLabelQuery.cs | 25 ++++++ .../Tnb.WarehouseMgr/WmsCarryQueryService.cs | 1 - .../Tnb.WarehouseMgr/WmsInStockService.cs | 29 +++++++ apihost/Tnb.API.Entry/Startup.cs | 4 +- 5 files changed, 132 insertions(+), 3 deletions(-) create mode 100644 WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/MaterailLabelOutput.cs create mode 100644 WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Queries/MaterialLabelQuery.cs diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/MaterailLabelOutput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/MaterailLabelOutput.cs new file mode 100644 index 00000000..556560e8 --- /dev/null +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/MaterailLabelOutput.cs @@ -0,0 +1,76 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tnb.WarehouseMgr.Entities.Dto.Outputs +{ + /// + /// 物料标签查询返回结果 + /// + public class MaterailLabelOutput + { + /// + /// 物料ID + /// + public string material_id { get; set; } + /// + /// 物料编号 + /// + public string material_code { get; set; } + /// + /// 批次 + /// + public string code_batch { get; set;} + /// + /// 采购单号 + /// + public string purchase_code { get; set; } + /// + /// 供应商 + /// + public string supplier_id { get; set; } + /// + /// 条码数量 + /// + public decimal barcode_qty { get; set; } + /// + /// 单位ID + /// + public string unit_id { get; set; } + /// + /// 入库单号 + /// + public string in_bill_code { get; set; } + /// + /// 入库时间 + /// + public DateTime instock_time { get; set; } + /// + /// 出库单号 + /// + public string out_bill_code { get; set; } + /// + /// 出库时间 + /// + public DateTime? outstock_time { get; set; } + /// + /// 仓库ID + /// + public string warehouse_id { get; set; } + /// + /// 仓库名称 + /// + public string warehouse_name { get; set; } + /// + /// 库位ID + /// + public string location_id { get; set; } + /// + /// 库位编号 + /// + public string location_code { get; set; } + + } +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Queries/MaterialLabelQuery.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Queries/MaterialLabelQuery.cs new file mode 100644 index 00000000..96cc6a27 --- /dev/null +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Queries/MaterialLabelQuery.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using JNPF.Common.Filter; +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace Tnb.WarehouseMgr.Entities.Dto.Queries +{ + /// + /// 物料标签查询输入参数 + /// + public class MaterialLabelQuery : PageInputBase + { + /// + /// 所属组织Id + /// + public string org_id { get; set; } + /// + /// 条码编号 + /// + public List barcode { get; set; } + } +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryQueryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryQueryService.cs index d02387a1..352e4b5f 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryQueryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryQueryService.cs @@ -72,7 +72,6 @@ namespace Tnb.WarehouseMgr var carry = await _db.Queryable().FirstAsync(a => a.carry_code == input.carry_code && a.status == 1); if (carry.IsNull()) throw new AppFriendlyException($"编号{input.carry_code},对应载具不存在或被禁用", 500); var mCarryIdDic = await _db.Queryable().Where(it => it.carry_id == carry.id).ToDictionaryAsync(x => x.membercarry_id, x => x.membercarry_code); - //var mCarryIdDic = carryDsLst.ToDictionary(x => x.membercarry_id, x => x.membercarry_code); Expression> whereExp = carry.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID && mCarryIdDic.Keys?.Count > 0 ? a => mCarryIdDic.Keys.Contains(a.carry_id) : a => a.carry_id == carry.id; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs index 040507a4..90ac7754 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs @@ -7,6 +7,7 @@ using Aop.Api.Domain; using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Extension; +using JNPF.Common.Filter; using JNPF.Common.Security; using JNPF.FriendlyException; using JNPF.Logging; @@ -26,6 +27,8 @@ using Tnb.WarehouseMgr.Entities.Attributes; using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto; using Tnb.WarehouseMgr.Entities.Dto.Inputs; +using Tnb.WarehouseMgr.Entities.Dto.Outputs; +using Tnb.WarehouseMgr.Entities.Dto.Queries; using Tnb.WarehouseMgr.Entities.Enums; using Tnb.WarehouseMgr.Interfaces; @@ -481,5 +484,31 @@ namespace Tnb.WarehouseMgr } return isSuccessFul; } + /// + /// 物料标签查询 + /// + /// + /// + [HttpPost] + public async Task MesFetchInOutStockInfoByBarCode(MaterialLabelQuery input) + { + var pagedList = await _db.Queryable().InnerJoin((a, b) => a.id == b.bill_id) + .LeftJoin((a, b, c) => b.barcode == c.barcode) + .WhereIF(!string.IsNullOrEmpty(input.org_id), (a, b, c) => a.org_id == input.org_id) + .Where((a, b, c) => input.barcode.Contains(b.barcode)) + .Select((a, b, c) => new MaterailLabelOutput + { + barcode_qty = b.codeqty, + in_bill_code = a.bill_code, + out_bill_code = SqlFunc.Subqueryable().Where(it => it.id == c.bill_id).Select(it => it.bill_code), + instock_time = a.create_time, + outstock_time = SqlFunc.Subqueryable().Where(it => it.id == c.bill_id).Select(it => it.create_time), + }, true) + .ToPagedListAsync(input.currentPage, input.pageSize); + + return PageResult.SqlSugarPageResult(pagedList); ; + + + } } } diff --git a/apihost/Tnb.API.Entry/Startup.cs b/apihost/Tnb.API.Entry/Startup.cs index 2d5ed531..d050ad18 100644 --- a/apihost/Tnb.API.Entry/Startup.cs +++ b/apihost/Tnb.API.Entry/Startup.cs @@ -116,7 +116,7 @@ public class Startup : AppStartup SnowflakeIdHelper.InitYitIdWorker(); bool isStartTimeJob = App.GetConfig("IsStartTimeJob"); - if (isStartTimeJob) - serviceProvider.GetRequiredService().StartTimerJob(); + //if (isStartTimeJob) + // serviceProvider.GetRequiredService().StartTimerJob(); } } \ No newline at end of file