From 6c118d52a1889cc74bd9e7a2111a6d8c2efcdb78 Mon Sep 17 00:00:00 2001 From: zhangxiaofeng <1939543722@qq.com> Date: Fri, 20 Sep 2024 09:58:33 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=A7=E7=89=A9=E7=8A=B6=E6=80=81=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=97=B6=E4=BF=9D=E5=AD=98=E7=BC=96=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Op/Method/SeaExportCommonService.cs | 82 ++++++++++--------- 1 file changed, 45 insertions(+), 37 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportCommonService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportCommonService.cs index 396cbf28..06f8a080 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportCommonService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportCommonService.cs @@ -81,7 +81,7 @@ namespace DS.WMS.Core.Op.Method { var diff = req.NewOrder.Diff(req.OldOrder); - + var log = new OpBusinessLog() { BusinessId = req.NewOrder.Id, @@ -162,7 +162,7 @@ namespace DS.WMS.Core.Op.Method } } #endregion - + #region 获取客户结算方式及结算日期 public DataResult GetCustomerStlInfo(CustomerStlReq req) @@ -183,14 +183,15 @@ namespace DS.WMS.Core.Op.Method { return DataResult.Failed("开船日期格式不正确!"); } - var accDate = tenantDb.Queryable().First(x=>x.ClientId == req.CustomerId && etd >= x.BeginDate && etd <= x.EndDate); + var accDate = tenantDb.Queryable().First(x => x.ClientId == req.CustomerId && etd >= x.BeginDate && etd <= x.EndDate); if (accDate.IsNull()) { - return DataResult.Success(new CustomerStlRes() { - StlName ="票结", - StlDate = req.ETD, - AccountDate = Convert.ToDateTime(req.ETD).ToString("yyyy-MM") + return DataResult.Success(new CustomerStlRes() + { + StlName = "票结", + StlDate = req.ETD, + AccountDate = Convert.ToDateTime(req.ETD).ToString("yyyy-MM") }); } if (accDate.AccountType == "月结") @@ -262,7 +263,7 @@ namespace DS.WMS.Core.Op.Method }); } else if (accDate.AccountType == "半月结") - { + { var tmpYear = etd.Year; var tmpMonth = etd.Month; var tmpDay = etd.Day; @@ -277,11 +278,12 @@ namespace DS.WMS.Core.Op.Method if (tmpDay2 < (int)accDate.AccountDays) { tmpDay = tmpDay2; - } + } } stlDate = DateTime.Parse(tmpYear.ToString() + "-" + tmpMonth.ToString() + "-" + tmpDay.ToString()); } - else { + else + { tmpDay = (int)accDate.AccountMonth; if ((int)accDate.AccountMonth > 28) @@ -292,11 +294,11 @@ namespace DS.WMS.Core.Op.Method if (tmpDay2 < (int)accDate.AccountMonth) { tmpDay = tmpDay2; - } - } + } + } stlDate = DateTime.Parse(tmpYear.ToString() + "-" + tmpMonth.ToString() + "-" + accDate.AccountMonth.ToString()).AddMonths(1); } - + return DataResult.Success(new CustomerStlRes() { StlName = accDate.AccountType, @@ -305,8 +307,8 @@ namespace DS.WMS.Core.Op.Method }); } else if (accDate.AccountType == "季结") - { - stlDate = etd.AddDays((int)accDate.AccountMonth*90); + { + stlDate = etd.AddDays((int)accDate.AccountMonth * 90); return DataResult.Success(new CustomerStlRes() { StlName = accDate.AccountType, @@ -351,7 +353,7 @@ namespace DS.WMS.Core.Op.Method /// /// public List GetAllEdiSet() - { + { var data = db.Queryable().Where(x => x.Status == StatusEnum.Enable).ToList(); return data; } @@ -381,14 +383,14 @@ namespace DS.WMS.Core.Op.Method /// /// /// - public CodeThirdParty GetCodeThirdParty(string type,string userId, SqlSugarScopeProvider tenantDb,long customerId =0) + public CodeThirdParty GetCodeThirdParty(string type, string userId, SqlSugarScopeProvider tenantDb, long customerId = 0) { //var account = new CodeThirdParty(); - + if (userId.IsNull()) { - return tenantDb.Queryable().First(x => x.AccountType == type) ; + return tenantDb.Queryable().First(x => x.AccountType == type); } var uId = long.Parse(userId); if (customerId == 0) @@ -408,7 +410,7 @@ namespace DS.WMS.Core.Op.Method { return tenantDb.Queryable().Where(x => x.AccountType == type && x.CreateBy == uId && x.CustomerId == customerId).First(); } - else if(tenantDb.Queryable().Where(x => x.AccountType == type && x.CreateBy == uId).Any()) + else if (tenantDb.Queryable().Where(x => x.AccountType == type && x.CreateBy == uId).Any()) { return tenantDb.Queryable().First(x => x.AccountType == type && x.CreateBy == uId); } @@ -417,7 +419,7 @@ namespace DS.WMS.Core.Op.Method return tenantDb.Queryable().First(x => x.AccountType == type); } } - + //return account; } /// @@ -447,7 +449,7 @@ namespace DS.WMS.Core.Op.Method } } - + /// /// 获取场站代码 /// @@ -473,7 +475,7 @@ namespace DS.WMS.Core.Op.Method /// /// public EDIMapperInfo GetYardMapper(long Id, SqlSugarScopeProvider tenantDb) - { + { var yard = tenantDb.Queryable().First(v => v.Id == Id && v.Status == StatusEnum.Enable.ToEnumInt()); if (yard.IsNull()) @@ -482,7 +484,7 @@ namespace DS.WMS.Core.Op.Method } var code = yard.EDICode.IsNull() ? yard.CodeName : yard.EDICode; - var map= tenantDb.Queryable().Where(v => v.Code == code).Select().First(); + var map = tenantDb.Queryable().Where(v => v.Code == code).Select().First(); if (map.IsNull()) { @@ -539,7 +541,7 @@ namespace DS.WMS.Core.Op.Method /// /// public string GetPortCode(long Id, SqlSugarScopeProvider tenantDb) - { + { if (Id == 0) return ""; var port = tenantDb.Queryable().First(v => v.Id == Id && v.Status == StatusEnum.Enable); @@ -951,7 +953,7 @@ namespace DS.WMS.Core.Op.Method //更新货物状态 await SetBookingOrderGoodsStatus(bookingId, tenantDb); } - } + } } /// @@ -959,14 +961,14 @@ namespace DS.WMS.Core.Op.Method /// /// /// - public async Task SetBookingOrderGoodsStatus(long bookingId,SqlSugarScopeProvider tenantDb) + public async Task SetBookingOrderGoodsStatus(long bookingId, SqlSugarScopeProvider tenantDb) { //var tenantDb = saasService.GetBizDbScopeById(user.TenantId); var order = tenantDb.Queryable().Filter(null, true).First(x => x.Id == bookingId); - + //获取当前用户已经录入的货物状态 var list = await tenantDb.Queryable().LeftJoin(tenantDb.Queryable(), - (goods, config) => config.Id == goods.ConfigId).Where((goods, config) => goods.BusinessId == bookingId). + (goods, config) => config.Id == goods.ConfigId).Where((goods, config) => goods.BusinessId == bookingId). OrderBy((goods, config) => config.OrderNo). Select((goods, config) => new { @@ -984,15 +986,20 @@ namespace DS.WMS.Core.Op.Method if (list != null) { //回写主单状态 - var StatusName = list.Where(x => x.FinishTime.HasValue).OrderByDescending(x => x.OrderNo).Select(x => x.StatusName).FirstOrDefault(); - if (StatusName == null) + var status = list.Where(x => x.FinishTime.HasValue).OrderByDescending(x => x.OrderNo).Select(x => new { x.SystemCode, x.StatusName }).FirstOrDefault(); + if (status == null) { - StatusName = ""; + status = new + { + SystemCode = "", + StatusName = "" + }; } var oldOrder = order.Adapt(); - order.BusinessStatusName = StatusName; + order.BusinessStatusName = status.StatusName; + order.BusinessStatus = status.SystemCode; //order.Note = "更新主单货物状态"; - await tenantDb.Updateable(order).EnableDiffLogEvent().ExecuteCommandAsync(); + await tenantDb.Updateable(order).UpdateColumns(x => new { x.BusinessStatusName, x.BusinessStatus }).EnableDiffLogEvent().ExecuteCommandAsync(); // 记录日志 await SaveSeaExportLogAsync(new SeaExportSaveLog() { @@ -2055,13 +2062,14 @@ namespace DS.WMS.Core.Op.Method /// /// /// - public async Task SeaExportOpenEdit(SeaExportOpenEditReq req) + public async Task SeaExportOpenEdit(SeaExportOpenEditReq req) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - + var order = tenantDb.Queryable().Where(x => x.Id == req.Id).First(); - if (order.IsNull()) { + if (order.IsNull()) + { return await Task.FromResult(DataResult.Failed("海运出口信息不存在!", MultiLanguageConst.SeaExportNotExist)); }