From 346784ddfca8f762dbdef18d5562f0ba60e547f2 Mon Sep 17 00:00:00 2001 From: majian <780924089@qq.com> Date: Mon, 19 Aug 2024 15:42:00 +0800 Subject: [PATCH] =?UTF-8?q?erp=E4=BB=93=E5=BA=93=E6=98=A0=E5=B0=84?= =?UTF-8?q?=E5=85=B3=E7=B3=BB=E3=80=81erp=E5=90=8C=E6=AD=A5=E5=AE=8C?= =?UTF-8?q?=E5=96=84=E3=80=81=E5=BA=93=E5=AD=98=E6=8A=A5=E8=A1=A8=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E7=AE=B1=E5=8F=B7=20=E6=89=B9=E6=AC=A1=E5=8F=B7?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=EF=BC=9B=E8=BD=BD=E5=85=B7=E5=BA=93=E5=AD=98?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E6=B7=BB=E5=8A=A0=E7=AE=B1=E5=8F=B7=20?= =?UTF-8?q?=E6=89=B9=E6=AC=A1=E5=8F=B7=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tnb.ProductionMgr/RedisBackGround.cs | 2 +- .../Consts/WmsWareHouseConst.cs | 26 +-- .../Dto/ErpInputs/PurchaseOrderInput.cs | 5 + .../Dto/ErpInputs/TransferOrderInput.cs | 165 +++++++++--------- .../Dto/ErpInputs/TransferOutstockInput.cs | 5 + .../Entity/WmsErpWarehouserelaH.cs | 52 ++++++ .../Entity/WmsMaterialSignH.cs | 5 + .../Entity/WmsPurchaseH.cs | 5 - .../Entity/WmsPurchaseOrderH.cs | 4 + .../Entity/WmsRawmatTransferinstockH.cs | 4 + .../Entity/WmsRawmatTransferoutstockH.cs | 5 + .../Entity/WmsTransferOrderH.cs | 4 + .../Entity/WmsTransferOutstockH.cs | 5 + .../Tnb.WarehouseMgr/ErpToWmsService.cs | 26 ++- .../Tnb.WarehouseMgr/WareHouseService.cs | 14 +- .../Tnb.WarehouseMgr/WmsCarryService.cs | 2 +- .../WmsCarryStockReportService.cs | 8 + .../WmsMaterialSignHService.cs | 25 ++- .../WmsRawmatTransferoutstockService.cs | 16 +- .../Tnb.WarehouseMgr/WmsStockReportService.cs | 4 + 20 files changed, 255 insertions(+), 127 deletions(-) create mode 100644 WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsErpWarehouserelaH.cs diff --git a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs index 1979fdef..8c48664c 100644 --- a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs +++ b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs @@ -722,7 +722,7 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA { _wareHouseService.s_taskExecuteSemaphore_YCLInstock.Release(); _wareHouseService.s_taskExecuteSemaphore_YCLOutstock.Release(); - + stopwatch.Stop(); Console.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 结束执行YCLInternalTransfer {stopwatch.ElapsedMilliseconds} ms"); LoggerTimer.LogInformation($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 结束执行YCLInternalTransfer {stopwatch.ElapsedMilliseconds} ms"); diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs index a308d713..c5b2f37c 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs @@ -258,17 +258,17 @@ /// public const string BIZTYPE_WMSEMPTYINSTOCK_ID = "26121986416677"; /// - /// 预任务生成业务类型-签收回库 todo + /// 预任务生成业务类型-签收回库 /// - public const string BIZTYPE_WmsMaterialSign_ID = "BIZTYPE_WmsMaterialSign_ID"; + public const string BIZTYPE_WmsMaterialSign_ID = "36318841764117"; /// /// 预任务生成业务类型-载具移入 /// public const string BIZTYPE_CARRYMOVEINSTOCK_ID = "26121988909861"; /// - /// 预任务生成业务类型-成品调拨出库 todo + /// 预任务生成业务类型-成品调拨出库 /// - public const string BIZTYPE_WmsTransferOutstock_ID = "BIZTYPE_WmsTransferOutstock_ID"; + public const string BIZTYPE_WmsTransferOutstock_ID = "36318847981589"; /// /// 预任务生成业务类型-库内转移 /// @@ -320,19 +320,19 @@ /// /// 预任务生成业务类型-调拨出库单(原材料) /// - public const string BIZTYPE_WmsRawmatTransferoutstock_ID = "BIZTYPE_WmsRawmatTransferoutstock_ID"; + public const string BIZTYPE_WmsRawmatTransferoutstock_ID = "36318854044437"; /// - /// 预任务生成业务类型-生产退料单 todo + /// 预任务生成业务类型-生产退料单 /// - public const string BIZTYPE_PRDRETURN_ID = "BIZTYPE_PRDRETURN_ID"; + public const string BIZTYPE_PRDRETURN_ID = "36318858573333"; /// - /// 预任务生成业务类型-包材入库 todo + /// 预任务生成业务类型-包材入库 /// - public const string BIZTYPE_WMSPACKINSTOCK_ID = "BIZTYPE_WMSPACKINSTOCK_ID"; + public const string BIZTYPE_WMSPACKINSTOCK_ID = "36318862414357"; /// - /// 预任务生成业务类型-包材出库 todo + /// 预任务生成业务类型-包材出库 /// - public const string BIZTYPE_WMSPACKOUTSTOCK_ID = "BIZTYPE_WMSPACKOUTSTOCK_ID"; + public const string BIZTYPE_WMSPACKOUTSTOCK_ID = "36318866547989"; /// /// 预任务生成业务类型-载具绑定 /// @@ -353,9 +353,9 @@ public const string BIZTYPE_WMSPRDINSTOCK_ID = "34840264160277"; /// - /// 灭菌入库 todo + /// 灭菌入库 /// - public const string BIZTYPE_WMSSTERILIZATIONINSTOCKCH_ID = "BIZTYPE_WMSSTERILIZATIONINSTOCKCH_ID"; + public const string BIZTYPE_WMSSTERILIZATIONINSTOCKCH_ID = "36318871067413"; /// /// 条码打印状态-已完成 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/ErpInputs/PurchaseOrderInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/ErpInputs/PurchaseOrderInput.cs index f63298b3..efa8589a 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/ErpInputs/PurchaseOrderInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/ErpInputs/PurchaseOrderInput.cs @@ -43,6 +43,11 @@ namespace Tnb.WarehouseMgr.Entities.Dto.ErpInputs /// public string? erp_pk { get; set; } + /// + /// erp仓库类型 + /// + public string erp_wh_type { get; set; } + public List details { get; set; } } public class PurchaseOrderDetail diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/ErpInputs/TransferOrderInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/ErpInputs/TransferOrderInput.cs index 2414ff3b..cd28e4b8 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/ErpInputs/TransferOrderInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/ErpInputs/TransferOrderInput.cs @@ -1,92 +1,93 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Transactions; - -namespace Tnb.WarehouseMgr.Entities.Dto.ErpInputs -{ - public class TransferOrderInput - { - /// - /// 单号 - /// - public string? transfer_order { get; set; } - - /// - /// 部门编码 - /// - public string? dept_code { get; set; } - - /// - /// 业务员编码 - /// +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Transactions; + +namespace Tnb.WarehouseMgr.Entities.Dto.ErpInputs +{ + public class TransferOrderInput + { + /// + /// 单号 + /// + public string? transfer_order { get; set; } + + /// + /// 部门编码 + /// + public string? dept_code { get; set; } + + /// + /// 业务员编码 + /// public string? biller { get; set; } - /// - /// 出库仓库 - /// + /// + /// 出库仓库 + /// public string? warehouse_outstock { get; set; } - /// - /// 入库组织编号 - /// - public string? instockorg_code { get; set; } - - /// - /// 供货日期 - /// + /// + /// 入库组织编号 + /// + public string? instockorg_code { get; set; } + + /// + /// 供货日期 + /// public DateTime? ship_date { get; set; } - - /// - /// 主表pk - /// + + /// + /// 主表pk + /// public string? erp_pk { get; set; } - - /// - /// 交易类型 - /// + + /// + /// 交易类型 + /// public string? transaction_type { get; set; } - - public List details { get; set; } - } - public class TransferOrderInputDetail - { - /// - /// 行号 - /// - public string? lineno { get; set; } + /// /// erp仓库类型 /// public string erp_wh_type { get; set; } - /// - /// 物品代码 - /// - public string? material_code { get; set; } - - /// - /// 单位代码 - /// - public string? unit_code { get; set; } - - /// - /// 采购数量 - /// + public List details { get; set; } + } + public class TransferOrderInputDetail + { + /// + /// 行号 + /// + public string? lineno { get; set; } + + /// + /// 物品代码 + /// + public string? material_code { get; set; } + + /// + /// 单位代码 + /// + public string? unit_code { get; set; } + + /// + /// 采购数量 + /// public decimal? qty { get; set; } - - /// - /// 批次 - /// - public string? code_batch { get; set; } - - /// - /// 交货日期 - /// - public DateTime? delivery_date { get; set; } - - /// - /// 子表主键 - /// - public string erp_line_pk { get; set; } - } -} + + /// + /// 批次 + /// + public string? code_batch { get; set; } + + /// + /// 交货日期 + /// + public DateTime? delivery_date { get; set; } + + /// + /// 子表主键 + /// + public string erp_line_pk { get; set; } + } +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/ErpInputs/TransferOutstockInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/ErpInputs/TransferOutstockInput.cs index 4eea13b3..ea37f9a5 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/ErpInputs/TransferOutstockInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/ErpInputs/TransferOutstockInput.cs @@ -58,6 +58,11 @@ namespace Tnb.WarehouseMgr.Entities.Dto.ErpInputs /// public string? erp_pk { get; set; } + /// + /// erp仓库类型 + /// + public string? erp_wh_type { get; set; } + public List details { get; set; } } public class RawMatTransferInstockDetail diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsErpWarehouserelaH.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsErpWarehouserelaH.cs new file mode 100644 index 00000000..3a6d8455 --- /dev/null +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsErpWarehouserelaH.cs @@ -0,0 +1,52 @@ +using JNPF.Common.Contracts; +using JNPF.Common.Security; +using SqlSugar; + +namespace Tnb.WarehouseMgr.Entities.Entity; + +/// +/// ERP仓库映射关系表 +/// +[SugarTable("wms_erp_warehouserela_h")] +public partial class WmsErpWarehouserelaH : BaseEntity +{ + public WmsErpWarehouserelaH() + { + id = SnowflakeIdHelper.NextId(); + } + /// + /// 创建用户 + /// + public string? create_id { get; set; } + + /// + /// 创建时间 + /// + public DateTime? create_time { get; set; } + + /// + /// 修改用户 + /// + public string? modify_id { get; set; } + + /// + /// 修改时间 + /// + public DateTime? modify_time { get; set; } + + /// + /// 所属组织 + /// + public string? org_id { get; set; } + + /// + /// erp仓库编码 + /// + public string? erp_warehousecode { get; set; } + + /// + /// wms仓库编码 + /// + public string? wms_warehousecode { get; set; } + +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsMaterialSignH.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsMaterialSignH.cs index fa0a4b4d..fbff4487 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsMaterialSignH.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsMaterialSignH.cs @@ -54,4 +54,9 @@ public partial class WmsMaterialSignH : BaseEntity /// public string? warehouse_instock_id { get; set; } + /// + /// 业务类型 + /// + public string? biz_type { get; set; } + } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsPurchaseH.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsPurchaseH.cs index 0b8ccf38..f9304917 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsPurchaseH.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsPurchaseH.cs @@ -159,9 +159,4 @@ public partial class WmsPurchaseH : BaseEntity, IPurchaseAndSaleAuitEnti /// erp到货单主表pk /// public string erp_arriveorder_pk { get;set; } - - /// - /// 来源 - /// - public string create_origin { get; set; } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsPurchaseOrderH.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsPurchaseOrderH.cs index 2b2e7892..adf3ae59 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsPurchaseOrderH.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsPurchaseOrderH.cs @@ -119,4 +119,8 @@ public partial class WmsPurchaseOrderH : BaseEntity /// public DateTime? ship_date { get; set; } + /// + /// erp仓库类型 + /// + public string erp_wh_type { get; set; } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsRawmatTransferinstockH.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsRawmatTransferinstockH.cs index c5c735cd..1ad0d656 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsRawmatTransferinstockH.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsRawmatTransferinstockH.cs @@ -119,4 +119,8 @@ public partial class WmsRawmatTransferinstockH : BaseEntity /// public string? biller { get; set; } + /// + /// erp仓库类型 + /// + public string? erp_wh_type { get; set; } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsRawmatTransferoutstockH.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsRawmatTransferoutstockH.cs index 1e996233..3dfdcd42 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsRawmatTransferoutstockH.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsRawmatTransferoutstockH.cs @@ -124,4 +124,9 @@ public partial class WmsRawmatTransferoutstockH : BaseEntity /// public string? transfer_order_id { get; set; } + /// + /// erp仓库类型 + /// + public string erp_wh_type { get; set; } + } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsTransferOrderH.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsTransferOrderH.cs index 42db65e5..df4c9d95 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsTransferOrderH.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsTransferOrderH.cs @@ -84,4 +84,8 @@ public partial class WmsTransferOrderH : BaseEntity /// public string? transaction_type { get; set; } + /// + /// erp仓库类型 + /// + public string erp_wh_type { get; set; } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsTransferOutstockH.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsTransferOutstockH.cs index 6ff16bf7..dc4195c8 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsTransferOutstockH.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsTransferOutstockH.cs @@ -108,4 +108,9 @@ public partial class WmsTransferOutstockH : BaseEntity /// 调拨订单id /// public string? transfer_order_id { get; set; } + + /// + /// erp仓库类型 + /// + public string erp_wh_type { get; set; } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/ErpToWmsService.cs b/WarehouseMgr/Tnb.WarehouseMgr/ErpToWmsService.cs index c9816d06..028c39f2 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/ErpToWmsService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/ErpToWmsService.cs @@ -12,6 +12,7 @@ using Microsoft.AspNetCore.Components.Forms; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Newtonsoft.Json; +using NPOI.OpenXmlFormats; using NPOI.SS.Formula.Functions; using SqlSugar; using Tnb.BasicData.Entities; @@ -295,7 +296,6 @@ namespace Tnb.WarehouseMgr await db.Insertable(WmsInstockDs).ExecuteCommandAsync(); } - /// /// 采购订单 /// @@ -345,6 +345,7 @@ namespace Tnb.WarehouseMgr wmsPurchaseOrderH.erp_pk = input.erp_pk; wmsPurchaseOrderH.create_id = WmsWareHouseConst.ErpUserId; wmsPurchaseOrderH.create_time = DateTime.Now; + wmsPurchaseOrderH.erp_wh_type = input.erp_wh_type; var supplier = await db.Queryable().Where(p => p.supplier_code == input.supplier_code).FirstAsync(); if (supplier != null) { @@ -354,7 +355,6 @@ namespace Tnb.WarehouseMgr await db.Insertable(wmsPurchaseOrderH).ExecuteCommandAsync(); - List wmsPurchaseOrderDs = new List(); foreach (var detail in input.details) { @@ -374,7 +374,6 @@ namespace Tnb.WarehouseMgr throw new AppFriendlyException($@"表体明细中单位{detail.unit_code}在wms系统中未找到!", 500); } - wmsPurchaseOrderD.purchase_quantity = detail.purchase_quantity; wmsPurchaseOrderD.stock_location = detail.stock_location; wmsPurchaseOrderD.code_batch = detail.code_batch; @@ -882,7 +881,7 @@ namespace Tnb.WarehouseMgr wmsRawmatTransferinstockH.create_time = DateTime.Now; wmsRawmatTransferinstockH.dept_code = input.dept_code; wmsRawmatTransferinstockH.biller = input.biller; - + wmsRawmatTransferinstockH.erp_wh_type = input.erp_wh_type; await db.Insertable(wmsRawmatTransferinstockH).ExecuteCommandAsync(); List wmsRawmatTransferinstockDs = new List(); @@ -980,11 +979,20 @@ namespace Tnb.WarehouseMgr throw new AppFriendlyException($@"表体存在物料和批号重复的明细!", 500); } - BasWarehouse warehouse_outstock = await db.Queryable().Where(r => r.whcode == input.warehouse_outstock).FirstAsync(); + WmsErpWarehouserelaH wmsErpWarehouserelaH = await db.Queryable().Where(r => r.erp_warehousecode == input.erp_wh_type).FirstAsync(); + if (wmsErpWarehouserelaH == null) + { + _LoggerErp2Mes.LogWarning($@"【TransferOrder】不存在erp仓库类型{input.erp_wh_type}对应wms系统的映射关系!"); + throw new AppFriendlyException($@"不存在erp仓库类型{input.erp_wh_type}对应wms系统的映射关系!", 500); + } + + string warehouse_outstock_code = wmsErpWarehouserelaH.wms_warehousecode; + + BasWarehouse warehouse_outstock = await db.Queryable().Where(r => r.whcode == warehouse_outstock_code).FirstAsync(); if (warehouse_outstock == null) { - _LoggerErp2Mes.LogWarning($"【MaterialTransfer】无法查询到出库仓库{input.warehouse_outstock}的档案记录!"); - return await ToApiResult(HttpStatusCode.InternalServerError, $"无法查询到出库仓库{input.warehouse_outstock}的档案记录!"); + _LoggerErp2Mes.LogWarning($"【MaterialTransfer】无法查询到出库仓库{warehouse_outstock_code}的档案记录!"); + return await ToApiResult(HttpStatusCode.InternalServerError, $"无法查询到出库仓库{warehouse_outstock_code}的档案记录!"); } try @@ -1001,6 +1009,7 @@ namespace Tnb.WarehouseMgr wmsTransferOrderH.create_id = WmsWareHouseConst.ErpUserId; wmsTransferOrderH.create_time = DateTime.Now; wmsTransferOrderH.org_id = WmsWareHouseConst.AdministratorOrgId; + wmsTransferOrderH.erp_wh_type = input.erp_wh_type; var _erpExtendField = await db.Queryable().InnerJoin((a, b) => a.table_id == b.Id) .Where((a, b) => a.transaction_type_id == input.transaction_type).Select((a, b) => b).FirstAsync(); @@ -1033,7 +1042,6 @@ namespace Tnb.WarehouseMgr throw new AppFriendlyException($@"表体明细中单位{detail.unit_code}在wms系统中未找到!", 500); } - wmsTransferOrderD.qty = detail.qty; wmsTransferOrderD.batchno = detail.code_batch; wmsTransferOrderD.erp_line_pk = detail.erp_line_pk; @@ -1070,6 +1078,7 @@ namespace Tnb.WarehouseMgr wmsRawmatTransferoutstockH.issuance_status = "0"; wmsRawmatTransferoutstockH.transaction_type = _erpExtendField.EnCode; wmsRawmatTransferoutstockH.org_id = WmsWareHouseConst.AdministratorOrgId; + wmsRawmatTransferoutstockH.erp_wh_type = input.erp_wh_type; List wmsRawmatTransferoutstockDs = new List (); foreach (var detail in input.details) { @@ -1122,6 +1131,7 @@ namespace Tnb.WarehouseMgr wmsTransferOutstockH.issuance_status = "0"; wmsTransferOutstockH.transaction_type = _erpExtendField.EnCode; wmsTransferOutstockH.org_id = WmsWareHouseConst.AdministratorOrgId; + wmsTransferOutstockH.erp_wh_type = input.erp_wh_type; List wmsTransferOutstockDs = new List(); foreach (var detail in input.details) { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index 2b48123e..743501b0 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -1672,13 +1672,13 @@ namespace Tnb.WarehouseMgr } else { - Logger.Information($"【GenTaskExecute】判断为非三四号梯任务"); - if (e != null) - { - wmsDistaskHs[0].device_id = e.device_id; - } - Logger.Information($"【GenTaskExecute】呼叫电梯"); - _ = ExecuteTargetFloorTask(wmsDistaskHs); + //Logger.Information($"【GenTaskExecute】判断为非三四号梯任务"); + //if (e != null) + //{ + // wmsDistaskHs[0].device_id = e.device_id; + //} + //Logger.Information($"【GenTaskExecute】呼叫电梯"); + //_ = ExecuteTargetFloorTask(wmsDistaskHs); } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs index e5b67f20..1fb64888 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs @@ -379,7 +379,7 @@ namespace Tnb.WarehouseMgr throw new AppFriendlyException($"【MaterialByCarry】托盘{input.carry_code}不存在", 500); } - List wmsCarryCodes = _db.Queryable().Where(r => r.carry_id == wmsCarryH.id).ToList(); + List wmsCarryCodes = _db.Queryable().Where(r => r.carry_id == wmsCarryH.id && r.codeqty > 0).ToList(); return await ToApiResult(HttpStatusCode.OK, "成功", wmsCarryCodes); } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryStockReportService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryStockReportService.cs index e2645526..5572056a 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryStockReportService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryStockReportService.cs @@ -40,11 +40,15 @@ namespace Tnb.WarehouseMgr var warehouse_id = ""; var carry_code = ""; var material_code = ""; + var container_no = ""; + var code_batch = ""; if (!input.queryJson.IsNullOrWhiteSpace()) { warehouse_id = JObject.Parse(input.queryJson).Value(nameof(WmsCarryCode.warehouse_id)); carry_code = JObject.Parse(input.queryJson).Value(nameof(WmsCarryCode.carry_code)); material_code = JObject.Parse(input.queryJson).Value(nameof(WmsCarryCode.material_code)); + code_batch = JObject.Parse(input.queryJson).Value(nameof(WmsCarryCode.code_batch)); + container_no = JObject.Parse(input.queryJson).Value(nameof(WmsCarryCode.container_no)); } @@ -60,6 +64,8 @@ namespace Tnb.WarehouseMgr .WhereIF(!string.IsNullOrEmpty(warehouse_id), (a, b, c, d) => c.id == warehouse_id) .WhereIF(!string.IsNullOrEmpty(carry_code), (a, b, c, d) => b.carry_code.Contains(carry_code)) .WhereIF(!string.IsNullOrEmpty(material_code), (a, b, c, d, e, f) => e.material_code.Contains(material_code)) + .WhereIF(!string.IsNullOrEmpty(code_batch), (a, b, c, d, e, f) => e.code_batch.Contains(code_batch)) + .WhereIF(!string.IsNullOrEmpty(container_no), (a, b, c, d, e, f) => f.container_no.Contains(container_no)) .OrderByDescending((a, b, c, d, e, f) => b.carry_code) .Select((a, b, c, d, e, f) => new WmsCarryStockReport { @@ -99,6 +105,8 @@ namespace Tnb.WarehouseMgr .WhereIF(!string.IsNullOrEmpty(warehouse_id), (a, b, c, d) => c.id == warehouse_id) .WhereIF(!string.IsNullOrEmpty(carry_code), (a, b, c, d, e, f, g, h) => b.carry_code.Contains(carry_code)|| h.carry_code.Contains(carry_code)) .WhereIF(!string.IsNullOrEmpty(material_code), (a, b, c, d, e, f, g) => g.code.Contains(material_code)) + .WhereIF(!string.IsNullOrEmpty(code_batch), (a, b, c, d, e, f, g) => f.code_batch.Contains(code_batch)) + .WhereIF(!string.IsNullOrEmpty(container_no), (a, b, c, d, e, f, g) => g.container_no.Contains(container_no)) .Select((a, b, c, d, e, f, g, h) => new WmsCarryStockReport { warehouse_name = c.whname, diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialSignHService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialSignHService.cs index ba9297ba..14436abc 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialSignHService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsMaterialSignHService.cs @@ -96,6 +96,12 @@ namespace Tnb.WarehouseMgr throw new AppFriendlyException($"【MaterialSign】载具{input.carry_code}当前库位为空,无法签收", 500); } + BasLocation carryLoc = await _db.Queryable().Where(r => r.id == wmsCarryH.location_id).FirstAsync(); + if (carryLoc != null && carryLoc.is_type == "0") + { + throw new Exception($"托盘{wmsCarryH.carry_code}在存储库位中,不能签收!"); + } + List wmsCarryCodes = _db.Queryable().Where(r => r.carry_id == wmsCarryH.id).ToList(); WmsMaterialSignH wmsMaterialSignH = new WmsMaterialSignH(); @@ -103,6 +109,16 @@ namespace Tnb.WarehouseMgr wmsMaterialSignH.create_time = DateTime.Now; wmsMaterialSignH.carry_id = wmsCarryH.id; wmsMaterialSignH.carry_code = wmsCarryH.carry_code; + WmsDistaskH wmsDistaskH = await _db.Queryable().Where(r => r.carry_id == wmsCarryH.id).OrderByDescending(r => r.id).FirstAsync(); + if (wmsDistaskH == null) + { + throw new AppFriendlyException($"【MaterialSign】无法找到载具{input.carry_code}的执行任务", 500); + } + if (string.IsNullOrEmpty(wmsDistaskH.biz_type)) + { + throw new AppFriendlyException($"【MaterialSign】载具{input.carry_code}任务{wmsDistaskH.bill_code}的业务类型异常", 500); + } + wmsMaterialSignH.biz_type = wmsDistaskH.biz_type; List wmsMaterialSignDs = new List(); await _db.Ado.BeginTranAsync(); foreach (var item in input.details) @@ -147,15 +163,10 @@ namespace Tnb.WarehouseMgr CarryCodeUnbindCodeInput carryCodeUnbindCodeInput = new CarryCodeUnbindCodeInput(); await _wmsCarryUnbindService.CarryCodeUnbindCode(carryCodeUnbindCodeInput, _db); } - await _db.Updateable().SetColumns(r => r.codeqty == wmsCarryCode.codeqty) - .Where(r => r.barcode == wmsCarryCode.barcode).ExecuteCommandAsync(); + //await _db.Updateable().SetColumns(r => r.codeqty == wmsCarryCode.codeqty) + // .Where(r => r.barcode == wmsCarryCode.barcode).ExecuteCommandAsync(); } - BasLocation carryLoc = await _db.Queryable().Where(r => r.id == wmsCarryH.location_id).FirstAsync(); - if (carryLoc != null && carryLoc.is_type == "0") - { - throw new Exception($"托盘{wmsCarryH.carry_code}在存储库位中,不能签收!"); - } switch (carryLoc.wh_id) { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsRawmatTransferoutstockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsRawmatTransferoutstockService.cs index a65b5c12..f4a155ea 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsRawmatTransferoutstockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsRawmatTransferoutstockService.cs @@ -16,6 +16,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Newtonsoft.Json.Linq; +using NPOI.HPSF; using Senparc.Weixin.Work.AdvancedAPIs.OaDataOpen; using SqlSugar; using Tnb.BasicData.Entities; @@ -96,10 +97,19 @@ namespace Tnb.WarehouseMgr WmsRawmatTransferoutstockH wmsRawmatTransferoutstockH = await _db.Queryable().FirstAsync(it => it.id == wmsRawmatTransferoutstockD.bill_id); List items = await _db.Queryable().Where(r => input.carrys.Contains(r.carry_code)).ToListAsync(); - - - + foreach (var item in items) + { + if (item.is_lock == 1) + { + throw new AppFriendlyException($"载具{item.carry_code}已锁定", 500); + } + BasLocation carrryLoc = await _db.Queryable().Where(r => r.id == item.location_id).FirstAsync(); + if (carrryLoc == null || carrryLoc.is_type != "0") + { + throw new Exception($"托盘{item.carry_code}已经不在存储库位中,不能出库!"); + } + } List wmsCarryCodes = await _db.Queryable().Where(r => items.Select(c => c.id).Contains(r.carry_id) && r.material_id == wmsRawmatTransferoutstockD.matcode_id && r.code_batch == wmsRawmatTransferoutstockD.code_batch).ToListAsync(); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsStockReportService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsStockReportService.cs index 540761f6..71f02e74 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsStockReportService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsStockReportService.cs @@ -39,11 +39,13 @@ namespace Tnb.WarehouseMgr var supplier_code = ""; var code_batch = ""; var material_specification = ""; + var container_no = ""; if (!input.queryJson.IsNullOrWhiteSpace()) { supplier_code = JObject.Parse(input.queryJson).Value("supplier_code"); code_batch = JObject.Parse(input.queryJson).Value(nameof(WmsCarryCode.code_batch)); material_specification = JObject.Parse(input.queryJson).Value(nameof(WmsCarryCode.material_specification)); + container_no = JObject.Parse(input.queryJson).Value(nameof(WmsCarryCode.container_no)); } List result = new List(); @@ -57,6 +59,7 @@ namespace Tnb.WarehouseMgr .LeftJoin((a, b, c, d, e, f, g, h) => h.id == g.bill_id) .WhereIF(!string.IsNullOrEmpty(material_specification), (a, b, c, d, e, f) => f.material_specification.Contains(material_specification)) .WhereIF(!string.IsNullOrEmpty(code_batch), (a, b, c, d, e, f) => a.code_batch.Contains(code_batch)) + .WhereIF(!string.IsNullOrEmpty(container_no), (a, b, c, d, e, f) => f.container_no.Contains(container_no)) .Select((a, b, c, d, e, f, g, h) => new WmsStockReportH { org_id = e.org_id, @@ -119,6 +122,7 @@ namespace Tnb.WarehouseMgr .WhereIF(!string.IsNullOrEmpty(material_specification), (a, b, c, d, e, f) => f.material_specification.Contains(material_specification)) .WhereIF(!string.IsNullOrEmpty(code_batch), (a, b, c, d, e, f) => a.code_batch.Contains(code_batch)) .WhereIF(!string.IsNullOrEmpty(supplier_code), (a, b, c, d, e, f, g, h) => h.supplier_code.Contains(supplier_code)) + .WhereIF(!string.IsNullOrEmpty(container_no), (a, b, c, d, e, f, g, h) => f.container_no.Contains(container_no)) .Select((a, b, c, d, e, f, g, h) => new WmsStockReportH { org_id = e.org_id,