From c5324bdf51c2a0a6dbaee0cacf179a01765fd4e9 Mon Sep 17 00:00:00 2001 From: dengyu Date: Mon, 23 Sep 2024 15:39:10 +0800 Subject: [PATCH] 20240923 --- .../DS.Module.ExcelModule/EPPlusService.cs | 6 +- .../Method/CM_RentOutService.cs | 5 +- .../Method/CM_State_ChangeService.cs | 2 +- .../CM_State_Change_TemplatImportService.cs | 93 +++++++++++++++++-- 4 files changed, 94 insertions(+), 12 deletions(-) diff --git a/ds-wms-service/DS.Module.ExcelModule/EPPlusService.cs b/ds-wms-service/DS.Module.ExcelModule/EPPlusService.cs index 3b6f852d..d87a18c0 100644 --- a/ds-wms-service/DS.Module.ExcelModule/EPPlusService.cs +++ b/ds-wms-service/DS.Module.ExcelModule/EPPlusService.cs @@ -45,7 +45,7 @@ namespace DS.Module.ExcelModule { try { - string[] PathNames = fullFielPath.Split(new string[] { @"/" }, StringSplitOptions.RemoveEmptyEntries); + string[] PathNames = fullFielPath.Split(new string[] { @"/",@"\\", @"\" }, StringSplitOptions.RemoveEmptyEntries); var ExcelFileName = PathNames[PathNames.Length - 1]; if (ExcelFileName.EndsWith(".xls")) @@ -53,7 +53,9 @@ namespace DS.Module.ExcelModule var newExcelFileName = PathNames[PathNames.Length - 1].Replace(".xls", ".xlsx"); - var _newFileFullname = Path.GetDirectoryName(fullFielPath) + "/" + newExcelFileName; + var pathhead = Path.GetDirectoryName(fullFielPath); + + var _newFileFullname = pathhead + "/" + newExcelFileName; Workbook book = new Workbook(); book.LoadFromFile(fullFielPath); diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentOutService.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentOutService.cs index f9992254..3354d6c7 100644 --- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentOutService.cs +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_RentOutService.cs @@ -883,7 +883,8 @@ public class CM_RentOutService : CMServiceBase, ICM_RentOutService newrec.Pid = id; newrec.RentDirectId = CMRentDirectEnum.租出; newrec.DropoffDate = head.Bsdate; - newrec.RentDetailId = addrec.Id;// + //newrec.RentDetailId = addrec.Id;// + newrec.RentDetailId = 0; newrec.RentCustomerId = head.RentCustomerId; newrec.RentCustomerName = head.RentCustomerName; newrec.RentTypeId = head.RentTypeId; @@ -982,6 +983,8 @@ public class CM_RentOutService : CMServiceBase, ICM_RentOutService { var addList = req.BodyList.Adapt>(); + await TenantDb.Insertable(addList).ExecuteCommandAsync(); + var _body = await TenantDb.Queryable().Where(a => a.Pid == id).ToListAsync(); var ch = new CtnTotalHelper2>(_body); diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_State_ChangeService.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_State_ChangeService.cs index 32fe990b..7d5dabc9 100644 --- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_State_ChangeService.cs +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_State_ChangeService.cs @@ -314,7 +314,7 @@ public class CM_State_ChangeService : CMServiceBase, ICM_State_ChangeService newBaseinfo.ProductionDate = change.ProductionDate; - newBaseinfo.CtnWeight = change.CtnWeight == null ? 0 : change.CtnValue_Base; + newBaseinfo.CtnWeight = change.CtnWeight == null ? 0 : change.CtnWeight; newBaseinfo.CtnValue_Base = change.CtnValue_Base == null ? 0 : change.CtnValue_Base; newBaseinfo.CtnValue_BuyingPrice = change.CtnValue_BuyingPrice == null ? 0 : change.CtnValue_BuyingPrice; diff --git a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_State_Change_TemplatImportService.cs b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_State_Change_TemplatImportService.cs index 805ff399..8be1cd4b 100644 --- a/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_State_Change_TemplatImportService.cs +++ b/ds-wms-service/DS.WMS.Core/ContainerManagement/Method/CM_State_Change_TemplatImportService.cs @@ -576,9 +576,29 @@ public class CM_State_Change_TemplatImportService : CMServiceBase, ICM_State_Cha { var reqtype = new CM_BuyCtn_DetailReq(); var detail = new CM_BuyCtn_Detail(); - _r = await 通过模板导入子表明细(reqtype, detail, req); + //_r = await 通过模板导入子表明细(reqtype, detail, req); + + + var _head = tenantDb.Queryable().Where(x => x.Id == req.Id).First(); + var head = _head.Adapt(); + + + _r = await 通过模板生成请求子表明细(reqtype, req); + + if (!_r.Succeeded) + { + return _r; + } + + if (_r.Data != null) + { + head.BodyList = _r.Data as List; + + _CM_BuyCtn.EditCM_BuyCtn(head); + } return _r; + } //卖箱 处理 @@ -709,9 +729,30 @@ public class CM_State_Change_TemplatImportService : CMServiceBase, ICM_State_Cha { var reqtype = new CM_RentOneWay_DetailReq(); var detail = new CM_RentOneWay_Detail(); - _r = await 通过模板导入子表明细(reqtype, detail, req); + //_r = await 通过模板导入子表明细(reqtype, detail, req); + + + var _head = tenantDb.Queryable().Where(x => x.Id == req.Id).First(); + var head = _head.Adapt(); + + + _r = await 通过模板生成请求子表明细(reqtype, req); + + if (!_r.Succeeded) + { + return _r; + } + + if (_r.Data != null) + { + head.BodyList = _r.Data as List; + + _CM_RentOneWay_In.EditCM_RentOneWay_In(head); + } return _r; + + //return _r; } //报废处理 @@ -793,10 +834,15 @@ public class CM_State_Change_TemplatImportService : CMServiceBase, ICM_State_Cha var 状态变动表head = await db.Queryable().FirstAsync(x => x.Code == "CM_StateChange_Field"); var 字段列表 = await db.Queryable().Where(x => x.TypeId == 状态变动表head.Id).ToListAsync(); - //1834834297505320960 var excel文件info = tenantDb.Queryable().FirstAsync(x => x.Id == req.FileId).Result; - //var filePath = Path.Combine(_environment.WebRootPath, excel文件info.FilePath); + //正式地址 + //var pathhead = _environment.WebRootPath.Replace("containermanagement-api", "main-api") + "\\LinkAttach"; + //var filePath = Path.Combine(pathhead, excel文件info.FilePath); + + //调试地址 + //var filePath = Path.Combine("D:\\ds8-solution-pro\\ds-wms-service\\DS.WMS.MainApi\\wwwroot\\LinkAttach", excel文件info.FilePath); + var pathhead = "D:\\ds8-solution-pro\\ds-wms-service\\DS.WMS.MainApi\\wwwroot"; @@ -804,11 +850,28 @@ public class CM_State_Change_TemplatImportService : CMServiceBase, ICM_State_Cha { pathhead = _environment.WebRootPath.Replace("containermanagement-api", "main-api"); } - catch (Exception e) { - + catch (Exception e) + { + } var filePath = Path.Combine(pathhead + "\\LinkAttach", excel文件info.FilePath); + + //////////////// + + ////var filePath = Path.Combine(_environment.WebRootPath, excel文件info.FilePath); + + //var pathhead = "D:\\ds8-solution-pro\\ds-wms-service\\DS.WMS.MainApi\\wwwroot"; + + //try + //{ + // pathhead = _environment.WebRootPath.Replace("containermanagement-api", "main-api"); + //} + //catch (Exception e) { + + //} + + //var filePath = Path.Combine(pathhead + "\\LinkAttach", excel文件info.FilePath); //var filePath = Path.Combine("D:\\ds8-solution-pro\\ds-wms-service\\DS.WMS.MainApi\\wwwroot\\LinkAttach", excel文件info.FilePath); //var basePath = AppSetting.app(new string[] { "FileSettings", "BasePath" }); @@ -1074,12 +1137,26 @@ public class CM_State_Change_TemplatImportService : CMServiceBase, ICM_State_Cha //var filePath = Path.Combine(dirAbs, excel文件info.FilePath); //正式地址 - var pathhead = _environment.WebRootPath.Replace("containermanagement-api", "main-api") + "\\LinkAttach"; - var filePath = Path.Combine(pathhead, excel文件info.FilePath); + //var pathhead = _environment.WebRootPath.Replace("containermanagement-api", "main-api") + "\\LinkAttach"; + //var filePath = Path.Combine(pathhead, excel文件info.FilePath); //调试地址 //var filePath = Path.Combine("D:\\ds8-solution-pro\\ds-wms-service\\DS.WMS.MainApi\\wwwroot\\LinkAttach", excel文件info.FilePath); + var pathhead = "D:\\ds8-solution-pro\\ds-wms-service\\DS.WMS.MainApi\\wwwroot"; + + try + { + pathhead = _environment.WebRootPath.Replace("containermanagement-api", "main-api"); + } + catch (Exception e) + { + + } + + var filePath = Path.Combine(pathhead + "\\LinkAttach", excel文件info.FilePath); + + if (!File.Exists(filePath)) { var _r0 = DataResult.Successed("添加失败", filePath, MultiLanguageConst.CM_Templat_没有找到模板);