diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarryStockReportH.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarryStockReportH.cs index d3a98f88..62690e32 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarryStockReportH.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarryStockReportH.cs @@ -9,7 +9,7 @@ namespace Tnb.WarehouseMgr.Entities; /// public partial class WmsCarryStockReport { - public int 序号 { get; set; } + public int index { get; set; } ///// ///// 所属组织 ///// @@ -23,22 +23,22 @@ public partial class WmsCarryStockReport /// /// 载具编码 /// - public string? 载具编码 { get; set; } + public string? carry_code { get; set; } /// /// 载具名称 /// - public string? 载具名称 { get; set; } + public string? carry_name { get; set; } /// /// 子载具编码 /// - public string? 子载具编码 { get; set; } + public string? membercarry_code { get; set; } /// /// 子载具名称 /// - public string? 子载具名称 { get; set; } + public string? membercarry_name { get; set; } /// /// 物料ID @@ -48,77 +48,77 @@ public partial class WmsCarryStockReport /// /// 物料编码 /// - public string? 物料编码 { get; set; } + public string? material_code { get; set; } /// /// 物料名称 /// - public string? 物料名称 { get; set; } + public string? material_name { get; set; } /// /// 仓库名称 /// - public string? 仓库名称 { get; set; } + public string? warehouse_name { get; set; } /// /// 库位编码 /// - public string? 库位编码 { get; set; } + public string? location_code { get; set; } /// /// 库位名称 /// - public string? 库位名称 { get; set; } + public string? location_name { get; set; } /// /// 载具状态 /// - public string? 载具状态 { get; set; } + public string? carry_status { get; set; } /// /// 库位状态 /// - public string? 库位状态 { get; set; } + public string? location_status { get; set; } /// /// 载具类型 /// - public string? 载具类型 { get; set; } + public string? carry_type { get; set; } /// /// 入库时间 /// - public string? 入库时间 { get; set; } + public string? instock_time { get; set; } /// /// 条码 /// - public string? 条码 { get; set; } + public string? barcode { get; set; } /// /// 批次 /// - public string? 批次 { get; set; } + public string? code_batch { get; set; } /// /// 数量 /// - public decimal? 数量 { get; set; } + public decimal? qty { get; set; } /// /// 单位 /// - public string? 单位 { get; set; } + public string? unit { get; set; } /// /// 操作用户 /// - public string? 操作用户 { get; set; } + public string? creator { get; set; } /// /// 绑定时间 /// - public string? 绑定时间 { get; set; } + public string? bind_time { get; set; } } @@ -127,7 +127,7 @@ public partial class WmsCarryStockReport /// public partial class WmsCarryStockReportH { - public int 序号 { get; set; } + public int index { get; set; } ///// ///// 所属组织 ///// @@ -141,47 +141,47 @@ public partial class WmsCarryStockReportH /// /// 载具编码 /// - public string? 载具编码 { get; set; } + public string? carry_code { get; set; } /// /// 载具名称 /// - public string? 载具名称 { get; set; } + public string? carry_name { get; set; } /// /// 仓库名称 /// - public string? 仓库名称 { get; set; } + public string? warehouse_name { get; set; } /// /// 库位编码 /// - public string? 库位编码 { get; set; } + public string? location_code { get; set; } /// /// 库位名称 /// - public string? 库位名称 { get; set; } + public string? location_name { get; set; } /// /// 载具状态 /// - public string? 载具状态 { get; set; } + public string? carry_status { get; set; } /// /// 库位状态 /// - public string? 库位状态 { get; set; } + public string? location_status { get; set; } /// /// 载具类型 /// - public string? 载具类型 { get; set; } + public string? carry_type { get; set; } /// /// 入库时间 /// - public string? 入库时间 { get; set; } + public string? instock_time { get; set; } public List Details { get; set; } } @@ -192,7 +192,7 @@ public partial class WmsCarryStockReportH /// public partial class WmsCarryStockReportCode { - public int 序号 { get; set; } + public int index { get; set; } ///// ///// 载具ID ///// @@ -201,12 +201,12 @@ public partial class WmsCarryStockReportCode /// /// 载具编码 /// - public string? 载具编码 { get; set; } + public string? carry_code { get; set; } /// /// 载具名称 /// - public string? 载具名称 { get; set; } + public string? carry_name { get; set; } ///// ///// 物料ID @@ -216,32 +216,32 @@ public partial class WmsCarryStockReportCode /// /// 物料编号 /// - public string? 物料编号 { get; set; } + public string? material_code { get; set; } /// /// 物料名称 /// - public string? 物料名称 { get; set; } + public string? material_name { get; set; } /// /// 条码编号 /// - public string? 条码 { get; set; } + public string? barcode { get; set; } /// /// 批次 /// - public string? 批次 { get; set; } + public string? code_batch { get; set; } /// /// 条码数量 /// - public decimal? 数量 { get; set; } + public decimal? qty { get; set; } /// /// 单位 /// - public string? 单位 { get; set; } + public string? unit { get; set; } ///// ///// 操作用户 @@ -251,7 +251,7 @@ public partial class WmsCarryStockReportCode /// /// 绑定时间 /// - public string? 绑定时间 { get; set; } + public string? bind_time { get; set; } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/ErpToWmsService.cs b/WarehouseMgr/Tnb.WarehouseMgr/ErpToWmsService.cs index 4bd3e117..8cce4593 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/ErpToWmsService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/ErpToWmsService.cs @@ -4,6 +4,7 @@ using JNPF.Common.Enums; using JNPF.DependencyInjection; using JNPF.DynamicApiController; using JNPF.FriendlyException; +using JNPF.Systems.Entitys.System; using JNPF.Systems.Interfaces.System; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Components.Forms; @@ -13,6 +14,7 @@ using Newtonsoft.Json; using NPOI.SS.Formula.Functions; using SqlSugar; using Tnb.BasicData.Entities; +using Tnb.ProductionMgr.Entities.Entity; using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto.ErpInputs; @@ -511,7 +513,6 @@ namespace Tnb.WarehouseMgr WmsMaterialTransferD wmsMaterialTransferD = new WmsMaterialTransferD(); wmsMaterialTransferD.lineno = detail.lineno; wmsMaterialTransferD.material_code = detail.material_code; - wmsMaterialTransferD.unit_code = detail.unit_code; wmsMaterialTransferD.code_batch = detail.code_batch; wmsMaterialTransferD.station_code = detail.station_code; wmsMaterialTransferD.qty = detail.qty; @@ -526,8 +527,20 @@ namespace Tnb.WarehouseMgr { wmsMaterialTransferD.material_id = material.id; wmsMaterialTransferD.material_specification = material.material_specification; - wmsMaterialTransferD.unit_id = detail.unit_code; } + + var erpExtendField = await db.Queryable().InnerJoin((a, b) => a.table_id == b.Id).Where((a, b) => a.cunitid == detail.unit_code).Select((a, b) => b).FirstAsync(); + if (erpExtendField != null) + { + wmsMaterialTransferD.unit_id = erpExtendField.Id; + wmsMaterialTransferD.unit_code = erpExtendField.EnCode; + } + else + { + _LoggerErp2Mes.LogWarning($@"【MaterialTransfer】表体明细中单位{detail.unit_code}在wms系统中未找到!"); + throw new AppFriendlyException($@"表体明细中单位{detail.unit_code}在wms系统中未找到!", 500); + } + wmsMaterialTransferDs.Add(wmsMaterialTransferD); } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index bc958835..18d1fe56 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -669,12 +669,12 @@ namespace Tnb.WarehouseMgr throw new AppFriendlyException("点位" + input.targetName + "不存在", 500); } string data = await _redisData.GetHash(strs[0], strs[1]); - Logger.Information("联核请求CheckPut接口查询X2Server数据:" + data); + Logger.Information("wcs请求CheckPut接口查询X2Server数据:" + data); JObject? res = JsonConvert.DeserializeObject(data); bool result = res != null && res["Value"] != null ? res.Value("Value") : false; if (!result) throw new AppFriendlyException("点位" + input.targetName + "不可放", 500); - Logger.Information("联核请求CheckPut接口结果:CTU可放货" + data); + Logger.Information("wcs请求CheckPut接口结果:CTU可放货" + data); } /// diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryStockReportService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryStockReportService.cs index 25b04da4..ff4e2079 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryStockReportService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryStockReportService.cs @@ -34,10 +34,7 @@ namespace Tnb.WarehouseMgr _userManager = userManager; } - /// - /// 转库单 - /// - [HttpPost, NonUnify, AllowAnonymous] + [HttpPost] public async Task CarryStock(CarryStockInput input) { var warehouse_id = ""; @@ -66,25 +63,25 @@ namespace Tnb.WarehouseMgr .OrderByDescending((a, b, c, d, e, f) => b.carry_code) .Select((a, b, c, d, e, f) => new WmsCarryStockReport { - 仓库名称 = c.whname, + warehouse_name = c.whname, carry_id = b.id, - 载具编码 = string.IsNullOrEmpty(b.carry_code) ? "空托盘堆垛" : b.carry_code, - 载具名称 = string.IsNullOrEmpty(b.carry_code) ? "空托盘堆垛" : b.carry_name, - 载具状态 = b.is_lock == 1 ? "锁定" : "未锁定", - 载具类型 = d.carrystd_name, - 库位编码 = a.location_code, - 库位名称 = a.location_name, - 库位状态 = b.is_lock == 1 ? "锁定" : "未锁定", - 入库时间 = b.instock_time != null ? b.instock_time.Value.ToString("yyyy-MM-dd HH:mm:ss") : "", - 条码 = e.barcode, - 批次 = e.code_batch, - 数量 = e.codeqty, + carry_code = string.IsNullOrEmpty(b.carry_code) ? "空托盘堆垛" : b.carry_code, + carry_name = string.IsNullOrEmpty(b.carry_code) ? "空托盘堆垛" : b.carry_name, + carry_status = b.is_lock == 1 ? "锁定" : "未锁定", + carry_type = d.carrystd_name, + location_code = a.location_code, + location_name = a.location_name, + location_status = b.is_lock == 1 ? "锁定" : "未锁定", + instock_time = b.instock_time != null ? b.instock_time.Value.ToString("yyyy-MM-dd HH:mm:ss") : "", + barcode = e.barcode, + code_batch = e.code_batch, + qty = e.codeqty, material_id = e.material_id, - 物料编码 = e.material_code, - 物料名称 = f.name, - 单位 = e.unit_id, - 操作用户 = e.create_id, - 绑定时间 = e.create_time != null ? e.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss") : "" + material_code = e.material_code, + material_name = f.name, + unit = e.unit_id, + creator = e.create_id, + bind_time = e.create_time != null ? e.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss") : "" }) .ToListAsync(); @@ -104,27 +101,27 @@ namespace Tnb.WarehouseMgr .WhereIF(!string.IsNullOrEmpty(material_id), (a, b, c, d, e, f, g) => g.id == material_id) .Select((a, b, c, d, e, f, g, h) => new WmsCarryStockReport { - 仓库名称 = c.whname, + warehouse_name = c.whname, carry_id = b.id, - 载具编码 = b.carry_code, - 载具名称 = b.carry_name, - 子载具编码 = h.carry_code, - 子载具名称 = h.carry_name, - 载具状态 = b.is_lock == 1 ? "锁定" : "未锁定", - 载具类型 = d.carrystd_name, - 库位编码 = a.location_code, - 库位名称 = a.location_name, - 库位状态 = b.is_lock == 1 ? "锁定" : "未锁定", - 入库时间 = b.instock_time != null ? b.instock_time.Value.ToString("yyyy-MM-dd HH:mm:ss") : "", - 条码 = f.barcode, - 批次 = f.code_batch, - 数量 = f.codeqty, + carry_code = b.carry_code, + carry_name = b.carry_name, + membercarry_code = h.carry_code, + membercarry_name = h.carry_name, + carry_status = b.is_lock == 1 ? "锁定" : "未锁定", + carry_type = d.carrystd_name, + location_code = a.location_code, + location_name = a.location_name, + location_status = b.is_lock == 1 ? "锁定" : "未锁定", + instock_time = b.instock_time != null ? b.instock_time.Value.ToString("yyyy-MM-dd HH:mm:ss") : "", + barcode = f.barcode, + code_batch = f.code_batch, + qty = f.codeqty, material_id = f.material_id, - 物料编码 = f.material_code, - 物料名称 = g.name, - 单位 = f.unit_id, - 操作用户 = f.create_id, - 绑定时间 = f.create_time != null ? f.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss") : "" + material_code = f.material_code, + material_name = g.name, + unit = f.unit_id, + creator = f.create_id, + bind_time = f.create_time != null ? f.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss") : "" }) .ToListAsync(); @@ -138,7 +135,7 @@ namespace Tnb.WarehouseMgr _ = storeMap.TryGetValue(itGroup.Key, out WmsCarryStockReport? report); WmsCarryStockReportH stockReport = report.Adapt(); - if (report.载具编码 != "空托盘堆垛") + if (report.carry_code != "空托盘堆垛") { List curCarryCodes = items.FindAll(x => x.carry_id == itGroup.Key.carry_id); @@ -148,19 +145,19 @@ namespace Tnb.WarehouseMgr { index++; WmsCarryStockReportCode wmsCarryStockReportCode = new(); - wmsCarryStockReportCode.序号 = index; + wmsCarryStockReportCode.index = index; //wmsCarryStockReportCode.carry_id = x.carry_id; - wmsCarryStockReportCode.载具编码 = !string.IsNullOrEmpty(x.子载具编码) ? x.子载具编码 : x.载具编码; - wmsCarryStockReportCode.载具名称 = !string.IsNullOrEmpty(x.子载具名称) ? x.子载具名称 : x.载具名称; + wmsCarryStockReportCode.carry_code = !string.IsNullOrEmpty(x.membercarry_code) ? x.membercarry_code : x.carry_code; + wmsCarryStockReportCode.carry_name = !string.IsNullOrEmpty(x.membercarry_name) ? x.membercarry_name : x.carry_name; //wmsCarryStockReportCode.material_id = x.material_id; - wmsCarryStockReportCode.物料编号 = x.物料编码; - wmsCarryStockReportCode.物料名称 = x.物料编码; - wmsCarryStockReportCode.条码 = x.条码; - wmsCarryStockReportCode.批次 = x.批次; - wmsCarryStockReportCode.数量 = x.数量; - wmsCarryStockReportCode.单位 = x.单位; + wmsCarryStockReportCode.material_code = x.material_code; + wmsCarryStockReportCode.material_name = x.material_name; + wmsCarryStockReportCode.barcode = x.barcode; + wmsCarryStockReportCode.code_batch = x.code_batch; + wmsCarryStockReportCode.qty = x.qty; + wmsCarryStockReportCode.unit = x.unit; //wmsCarryStockReportCode.创建用户 = x.操作用户; - wmsCarryStockReportCode.绑定时间 = x.绑定时间; + wmsCarryStockReportCode.bind_time = x.bind_time; wmsCarryStockReportCodes.Add(wmsCarryStockReportCode); }); @@ -176,7 +173,7 @@ namespace Tnb.WarehouseMgr int rowIndex = 0; List pages = result.Skip((input.currentPage - 1) * input.pageSize).Take(input.pageSize).ToList(); - pages.ForEach(page => { rowIndex++; page.序号 = rowIndex; }); + pages.ForEach(page => { rowIndex++; page.index = rowIndex; }); SqlSugarPagedList pagedList = new() { diff --git a/apihost/Tnb.API.Entry/Configurations/ConnectionStrings.json b/apihost/Tnb.API.Entry/Configurations/ConnectionStrings.json index 5314dd45..30252d9a 100644 --- a/apihost/Tnb.API.Entry/Configurations/ConnectionStrings.json +++ b/apihost/Tnb.API.Entry/Configurations/ConnectionStrings.json @@ -20,8 +20,15 @@ //Oracle //"DefaultConnection": "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST={0})(PORT={1}))(CONNECT_DATA=(SERVER = DEDICATED)(SERVICE_NAME={2})));User Id={3};Password={4}" //PostgreSQL - "DefaultConnection": "server={0};port={1};database={2};uid={3};pwd={4};pooling=true;KeepAlive=60;ConnectionLifetime=300;MaxPoolSize=320;" + "DefaultConnection": "server={0};port={1};database={2};uid={3};pwd={4};pooling=true;KeepAlive=60;ConnectionLifetime=300;MaxPoolSize=320;", //MySql //"DefaultConnection": "server={0};port={1};database={2};uid={3};pwd={4};sslmode=none;pooling=true;charset=utf8mb4;allowLoadLocalInfile=true;allowPublicKeyRetrieval=true" + "ConfigList": [ + { + "ServiceName": "erpdb", + "dbType": "Oracle", + "connectionStr": "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.11)(PORT=1521))(CONNECT_DATA=(SERVER = DEDICATED)(SERVICE_NAME=orcl)));User Id=BIP0201;Password=BIP0201" + } + ] } } \ No newline at end of file