diff --git a/Myshipping.Application/Entity/Booking_AutoYardImport.cs b/Myshipping.Application/Entity/BookingAutoYardImport.cs similarity index 75% rename from Myshipping.Application/Entity/Booking_AutoYardImport.cs rename to Myshipping.Application/Entity/BookingAutoYardImport.cs index df376573..57b1bc3b 100644 --- a/Myshipping.Application/Entity/Booking_AutoYardImport.cs +++ b/Myshipping.Application/Entity/BookingAutoYardImport.cs @@ -13,7 +13,7 @@ namespace Myshipping.Application.Entity /// [SugarTable("booking_auto_yard_import")] [Description("场站自动引入信息")] - public class Booking_AutoYardImport + public class BookingAutoYardImport { /// /// 主键 @@ -40,5 +40,21 @@ namespace Myshipping.Application.Entity /// 比对数据时填写的箱信息JSON /// public string CtnJson { get; set; } + + /// + /// 只读标志 + /// + public bool IsRead { get; set; } + + /// + /// 读取时间 + /// + public DateTime? ReadTime { get; set; } + + /// + /// 读取人 + /// + public string ReadUser { get; set; } + } } diff --git a/Myshipping.Application/Entity/BookingExtendState.cs b/Myshipping.Application/Entity/BookingExtendState.cs index e3eec2da..38a5d6e5 100644 --- a/Myshipping.Application/Entity/BookingExtendState.cs +++ b/Myshipping.Application/Entity/BookingExtendState.cs @@ -42,5 +42,9 @@ namespace Myshipping.Application.Entity public int print { get; set; } + /// + /// 是否封账 + /// + public bool IsLockBooking { get; set; } } } diff --git a/Myshipping.Application/Enum/BookingErrorCode.cs b/Myshipping.Application/Enum/BookingErrorCode.cs index f308728e..2db39cb4 100644 --- a/Myshipping.Application/Enum/BookingErrorCode.cs +++ b/Myshipping.Application/Enum/BookingErrorCode.cs @@ -144,6 +144,12 @@ namespace Myshipping.Application.Enum /// [ErrorCodeItemMetadata("附件不存在")] BOOK200, + + /// + /// 请上传正确数据 + /// + [ErrorCodeItemMetadata("请上传正确数据")] + BOOK201, #endregion } } diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index 72b7cb17..afcae904 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -129,7 +129,7 @@ namespace Myshipping.Application private readonly IBookingGoodsStatusConfigService _GoodsConfig; private readonly SqlSugarRepository _repLineOpMgrConfig; private readonly SqlSugarRepository _repSysEmp; - private readonly SqlSugarRepository _repAutoYard; + private readonly SqlSugarRepository _repAutoYard; private readonly SqlSugarRepository _repextendstate; @@ -156,7 +156,7 @@ namespace Myshipping.Application SqlSugarRepository excelrep, SqlSugarRepository repUserMail, SqlSugarRepository goodsStatus, SqlSugarRepository goodsStatusConfig, SqlSugarRepository repTenant, SqlSugarRepository repBookingStatus, SqlSugarRepository bookingEDIExt, SqlSugarRepository serviceItem, SqlSugarRepository paraContractNoInfoRepository, IHttpContextAccessor httpContextAccessor, IBookingGoodsStatusConfigService GoodsConfig, SqlSugarRepository djyWebsiteAccountConfigRepository, - ISysOrgService orgService, SqlSugarRepository repLineOpMgrConfig, SqlSugarRepository repSysEmp, SqlSugarRepository repAutoYard, + ISysOrgService orgService, SqlSugarRepository repLineOpMgrConfig, SqlSugarRepository repSysEmp, SqlSugarRepository repAutoYard, IServiceWorkFlowManageService serviceWorkFlowManageService) { this._logger = logger; @@ -453,7 +453,7 @@ namespace Myshipping.Application var itgoodsStatus = new List(); var itconfigs = new List(); - List statusList = new List(); + List statusList = new List(); if (App.Configuration["ServiceStatusOpenAuto"] == "1") { QueryServiceProjectWithStatusBatch batchQuery = new QueryServiceProjectWithStatusBatch @@ -520,7 +520,7 @@ namespace Myshipping.Application var statuslogId = statusloglist.Select(x => x.Id).ToList(); //运踪状态 var statuslogdetaillist = _statuslogdetail.AsQueryable().Where(x => statuslogId.Contains(x.PId)).ToList(); - + var BookingStatusList = _repBookingStatus.AsQueryable().Filter(null, true).Where(x => bookingidlist.Contains((long)x.BookingId)).ToList(); var bookingremarkList = _bookingremark.AsQueryable().Filter(null, true).Where(x => bookingidlist.Contains(x.PId)).ToList(); @@ -596,9 +596,9 @@ namespace Myshipping.Application { var currStatusList = statusList.Where(a => long.Parse(a.BusiId) == item.Id).ToList(); - if(currStatusList.Count > 0) + if (currStatusList.Count > 0) { - if(currStatusList.Any(a=>a.StatusSKUCode.Equals("YFVGM",StringComparison.OrdinalIgnoreCase) && a.IsYield)) + if (currStatusList.Any(a => a.StatusSKUCode.Equals("YFVGM", StringComparison.OrdinalIgnoreCase) && a.IsYield)) { item.IsVGM = currStatusList.FirstOrDefault(a => a.StatusSKUCode.Equals("YFVGM", StringComparison.OrdinalIgnoreCase) && a.IsYield).ActDate.Value; @@ -616,15 +616,15 @@ namespace Myshipping.Application item.GoodsStatusList = currStatusList.OrderBy(a => a.CalcSortNo) .Select(a => new GoodsStatusList - { + { FinishTime = a.ActDate, IsLast = a.IsEnd, Sort = a.ActSortNo, StatusName = a.ShowName, SystemCode = a.StatusSKUCode, - ExtData = !string.IsNullOrWhiteSpace(a.ActVal)? a.ActVal:string.Empty, - Remark = !string.IsNullOrWhiteSpace(a.ActRemark)? a.ActRemark:string.Empty - }).ToList(); + ExtData = !string.IsNullOrWhiteSpace(a.ActVal) ? a.ActVal : string.Empty, + Remark = !string.IsNullOrWhiteSpace(a.ActRemark) ? a.ActRemark : string.Empty + }).ToList(); } else { @@ -906,9 +906,9 @@ namespace Myshipping.Application var mlist = await _rep.AsQueryable().Filter(null, true).Where(x => x.Id == input.Id).FirstAsync(); var rightlist = await _right.GetDataScopeList(MenuConst.MenuBookingOrder, true); - _logger.LogInformation("保存权限范围:"+rightlist.ToJsonString()); + _logger.LogInformation("保存权限范围:" + rightlist.ToJsonString()); //除现有配置权限外 操作和本人具有编辑权限 - if (rightlist!=null&&!( + if (rightlist != null && !( mlist.OPID == UserManager.UserId.ToString() || mlist.OP == UserManager.Name.ToString() || mlist.DOCID == UserManager.UserId.ToString() || mlist.DOC == UserManager.Name.ToString() || mlist.CUSTSERVICEID == UserManager.UserId.ToString() || mlist.CUSTSERVICE == UserManager.Name.ToString() || @@ -926,7 +926,7 @@ namespace Myshipping.Application entity.VOYNO = entity.VOYNOINNER; } entity.VERSION = Guid.NewGuid().ToString(); - + //判断如果船名航次船公司变动 同步更新船期字段 if (entity.CARRIERID != mlist.CARRIERID || entity.VOYNO != mlist.VOYNO || entity.VESSEL != mlist.VESSEL) { var vess = await _vesselInfo.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID && x.CARRIERID == entity.CARRIERID && @@ -978,6 +978,7 @@ namespace Myshipping.Application it.ATA }).ExecuteCommandAsync(); var ctnlist = await _repCtn.AsQueryable().Filter(null, true).Where(x => x.BILLID == input.Id && x.IsDeleted == false).Select(x => x.Id).ToListAsync(); + //删除箱信息 重新插入 await _repCtn.DeleteAsync(x => x.BILLID == input.Id); await _ctndetailrep.DeleteAsync(x => ctnlist.Contains((long)x.CTNID)); if (input.ctnInputs != null) @@ -7928,12 +7929,15 @@ HLCUTA12307DPXJ3 以这票为例 6个柜 } _logger.LogInformation($"{bookId}({order.MBLNO})的箱封号自动引入完成"); - } - - - //写入提示 - await SaveAutoYardData(bookId, true, $"已自动引入", ctns.ToJson(), rtn.ToJson()); + //写入提示 + await SaveAutoYardData(bookId, true, $"已自动引入", ctns.ToJson(), rtn.ToJson()); + } + else + { + //写入提示 + await SaveAutoYardData(bookId, true, $"已自动引入", ctns.ToJson(), rtn.ToJson(), read: true); + } } } @@ -7942,17 +7946,23 @@ HLCUTA12307DPXJ3 以这票为例 6个柜 /// /// [NonAction] - private async Task SaveAutoYardData(long bookId, bool success, string content, string ctnJson, string yardJson) + private async Task SaveAutoYardData(long bookId, bool success, string content, string ctnJson, string yardJson, bool read = false) { await _repAutoYard.DeleteAsync(x => x.Id == bookId); //写入提示 - var autoYard = new Booking_AutoYardImport(); + var autoYard = new BookingAutoYardImport(); autoYard.Id = bookId; autoYard.Status = success ? "已导入" : "未导入"; autoYard.Content = content; autoYard.CtnJson = ctnJson; autoYard.YardJson = yardJson; + if (read) //未开启自动写入的用户,自动已读 + { + autoYard.IsRead = true; + autoYard.ReadTime = DateTime.Now; + autoYard.ReadUser = "系统"; + } await _repAutoYard.InsertAsync(autoYard); } @@ -9235,6 +9245,7 @@ HLCUTA12307DPXJ3 以这票为例 6个柜 extends.noApply = noApply; extends.applyNoPrint = applyNoPrint; extends.print = print; + extends.IsLockBooking = false; await _repextendstate.InsertAsync(extends); } else diff --git a/Myshipping.Application/Service/DataSync/DataSyncService.cs b/Myshipping.Application/Service/DataSync/DataSyncService.cs index bf707322..61ff6bf4 100644 --- a/Myshipping.Application/Service/DataSync/DataSyncService.cs +++ b/Myshipping.Application/Service/DataSync/DataSyncService.cs @@ -75,6 +75,7 @@ namespace Myshipping.Application private readonly SqlSugarRepository _statuslogdetail; private readonly SqlSugarRepository _repBookingStatus; private readonly IBookingOrderService _bookingorderservice; + private readonly SqlSugarRepository _bookingextstate; public DataSyncService(ILogger logger, ISysCacheService cache, SqlSugarRepository rep, SqlSugarRepository repCtn, @@ -83,7 +84,7 @@ namespace Myshipping.Application SqlSugarRepository djycustomercontact, SqlSugarRepository vesselinfo, SqlSugarRepository ctndetailrep , SqlSugarRepository bookingEDIExt, SqlSugarRepository bookinglog, SqlSugarRepository bookinglogdetail, SqlSugarRepository goodsStatus, SqlSugarRepository goodsStatusConfig, SqlSugarRepository repline, - SqlSugarRepository bookingremark, SqlSugarRepository mapcarrier, SqlSugarRepository codeForwarder, + SqlSugarRepository bookingremark, SqlSugarRepository mapcarrier, SqlSugarRepository codeForwarder, SqlSugarRepository bookingextstate, SqlSugarRepository codePortRep, SqlSugarRepository codeLaneRep, ICommonDBService commonDBService, SqlSugarRepository relaPortLane, SqlSugarRepository accountconfig, SqlSugarRepository bookingfile, IBookingOrderService bookingorderservice) { @@ -116,6 +117,7 @@ namespace Myshipping.Application this._repStatuslog = statuslog; this._statuslogdetail = statuslogdetail; this._repBookingStatus = repBookingStatus; + this._bookingextstate = bookingextstate; } @@ -2585,6 +2587,45 @@ namespace Myshipping.Application } } + + + /// + /// 东胜封账 + /// + /// + /// + [SqlSugarUnitOfWork] + [HttpPost("/DataSync/SaveBookingOrderLock"), ApiUser(ApiCode = "SaveBookingOrderLock")] + public async Task SaveBookingOrderLock(List dto) { + if (dto==null) { + throw Oops.Bah(BookingErrorCode.BOOK201); + + } + foreach (var item in dto) + { + + var extends = _bookingextstate.FirstOrDefault(x => x.bookingId == item.BookingId); + + if (extends == null) + { + extends.bookingId = item.BookingId; + extends.IsLockBooking = item.LockStatus; + await _bookingextstate.InsertAsync(extends); + } + else + { + extends.IsLockBooking = item.LockStatus; + await _bookingextstate.AsUpdateable(extends).IgnoreColumns().ExecuteCommandAsync(); + } + } + } + + + + + + + #endregion } } diff --git a/Myshipping.Application/Service/DataSync/Dto/BookingOrderLock.cs b/Myshipping.Application/Service/DataSync/Dto/BookingOrderLock.cs new file mode 100644 index 00000000..f7fe0865 --- /dev/null +++ b/Myshipping.Application/Service/DataSync/Dto/BookingOrderLock.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Myshipping.Application.Service.DataSync.Dto +{ + public class BookingOrderLock + { + ///// + ///// 主键 + ///// + public long BookingId { get; set; } + + + + /// + /// 锁定状态 false 解锁 true 锁定 + /// + public bool LockStatus { get; set; } + } +}