diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs
index c209a130..cba17e94 100644
--- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs
+++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs
@@ -190,377 +190,6 @@ namespace Myshipping.Application
}
#region 主表和箱信息
- ///
- /// 分页查询订舱主表
- ///
- ///
- ///
- [HttpGet("/BookingOrder/Page")]
- public async Task Page([FromQuery] BookingOrderInput input)
- {
- List userlist = await _right.GetDataScopeList(351064299098181);
- List pidlist = new List();
- if (!string.IsNullOrWhiteSpace(input.SEALNO) || !string.IsNullOrWhiteSpace(input.CNTRNO))
- {
- pidlist = await _repCtn.AsQueryable().WhereIF(!string.IsNullOrWhiteSpace(input.SEALNO), x => x.SEALNO.StartsWith(input.SEALNO)).WhereIF(!string.IsNullOrWhiteSpace(input.CNTRNO), x => x.CNTRNO.StartsWith(input.CNTRNO)).Select(x => x.BILLID).ToListAsync();
- }
- var ftoday = DateTime.Now.AddDays(-15);
- var etoday = DateTime.Now.AddDays(15);
- //List userlist = await DataFilterExtensions.GetDataScopeIdList();
-
- //按部门查询
- List saleUserList = null;
- List opUserList = null;
- if (input.OrgSale.HasValue)
- {
- var tmpList = await _orgService.GetUserIdListInOrg(input.OrgSale.Value);
- saleUserList = tmpList.Select(x => x.ToString()).ToList();
- }
-
- if (input.OrgOp.HasValue)
- {
- var tmpList = await _orgService.GetUserIdListInOrg(input.OrgOp.Value);
- opUserList = tmpList.Select(x => x.ToString()).ToList();
- }
-
- #region
- var entities = await _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID)
- .WhereIF(!input.ISDel, x => x.IsDeleted == false)
- .WhereIF(input.ISDel, x => x.IsDeleted == true)
- .WhereIF(input.firstFlag, x => x.ETD <= etoday && x.ETD >= ftoday || x.ETD == null)
- .Where(x => x.ParentId == 0 || x.ParentId == null) //台账只查询主单!!
- .WhereIF(pidlist != null && pidlist.Count > 0, x => pidlist.Contains(x.Id))
- .WhereIF(!string.IsNullOrWhiteSpace(input.BSNO), u => u.BSNO.Contains(input.BSNO))
- .WhereIF(!string.IsNullOrWhiteSpace(input.BSSTATUS), u => u.BSSTATUS == input.BSSTATUS)
- .WhereIF(input.BBSDATE != null, u => u.BSDATE >= input.BBSDATE)
- .WhereIF(input.EBSDATE != null, u => u.BSDATE <= input.EBSDATE)
- .WhereIF(!string.IsNullOrWhiteSpace(input.MBLNO) && !input.MBLNO.Contains(','), u => u.MBLNO.Contains(input.MBLNO.Trim()))
- .WhereIF(!string.IsNullOrWhiteSpace(input.TMBLNO) && !input.TMBLNO.Contains(','), u => u.TMBLNO.Contains(input.TMBLNO.Trim()))
- .WhereIF(!string.IsNullOrWhiteSpace(input.HBLNO) && !input.HBLNO.Contains(','), u => u.HBLNO.Contains(input.HBLNO.Trim()))
- .WhereIF(!string.IsNullOrWhiteSpace(input.MBLNO) && input.MBLNO.Contains(','), u => input.MBLNO.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).Contains(u.MBLNO.Trim()))
- .WhereIF(!string.IsNullOrWhiteSpace(input.HBLNO) && input.HBLNO.Contains(','), u => input.HBLNO.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).Contains(u.HBLNO.Trim()))
- .WhereIF(!string.IsNullOrWhiteSpace(input.BOOKINGNO), u => u.BOOKINGNO.Contains(input.BOOKINGNO))
- .WhereIF(!string.IsNullOrWhiteSpace(input.CONTRACTNO), u => u.CONTRACTNO.Contains(input.CONTRACTNO))
- .WhereIF(!string.IsNullOrWhiteSpace(input.SERVICECONTRACTNO), u => u.SERVICECONTRACTNO.Contains(input.SERVICECONTRACTNO))
- .WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPER), u => u.SHIPPER.Contains(input.SHIPPER))
- .WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEE), u => u.CONSIGNEE.Contains(input.CONSIGNEE))
- .WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTY), u => u.NOTIFYPARTY.Contains(input.NOTIFYPARTY))
- .WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTY2), u => u.NOTIFYPARTY2.Contains(input.NOTIFYPARTY2))
- .WhereIF(!string.IsNullOrWhiteSpace(input.YARDID), u => u.YARDID == input.YARDID)
- .WhereIF(!string.IsNullOrWhiteSpace(input.VESSELID), u => u.VESSELID.Contains(input.VESSELID))
- .WhereIF(!string.IsNullOrWhiteSpace(input.VESSEL), u => u.VESSEL.ToLower().Contains(input.VESSEL.ToLower()))
- .WhereIF(!string.IsNullOrWhiteSpace(input.VOYNO), u => u.VOYNO.Contains(input.VOYNO))
- .WhereIF(!string.IsNullOrWhiteSpace(input.VOYNOINNER), u => u.VOYNOINNER.Contains(input.VOYNOINNER))
- .WhereIF(input.BETD != null, u => u.ETD >= input.BETD)
- .WhereIF(input.EETD != null, u => u.ETD <= input.EETD)
- .WhereIF(input.BATD != null, u => u.ATD >= input.BATD)
- .WhereIF(input.EATD != null, u => u.ATD <= input.EATD)
- .WhereIF(input.BCLOSINGDATE != null, u => u.CLOSINGDATE >= input.BCLOSINGDATE)
- .WhereIF(input.ECLOSINGDATE != null, u => u.CLOSINGDATE <= input.ECLOSINGDATE)
- .WhereIF(input.BCLOSEDOCDATE != null, u => u.CLOSEDOCDATE >= input.BCLOSEDOCDATE)
- .WhereIF(input.ECLOSEDOCDATE != null, u => u.CLOSEDOCDATE <= input.ECLOSEDOCDATE)
- .WhereIF(input.BCLOSEVGMDATE != null, u => u.CLOSEVGMDATE >= input.BCLOSEVGMDATE)
- .WhereIF(input.ECLOSEVGMDATE != null, u => u.CLOSEVGMDATE <= input.ECLOSEVGMDATE)
- .WhereIF(input.BETA != null, u => u.ETA >= input.BETA)
- .WhereIF(input.EETA != null, u => u.ETA <= input.EETA)
- .WhereIF(!string.IsNullOrWhiteSpace(input.PLACERECEIPT), u => u.PLACERECEIPT.Contains(input.PLACERECEIPT))
- .WhereIF(!string.IsNullOrWhiteSpace(input.PORTLOAD), u => u.PORTLOAD.Contains(input.PORTLOAD))
- .WhereIF(!string.IsNullOrWhiteSpace(input.PORTLOADID), u => u.PORTLOADID == input.PORTLOADID)
- .WhereIF(!string.IsNullOrWhiteSpace(input.PORTDISCHARGEID), u => u.PORTDISCHARGEID == input.PORTDISCHARGEID)
- .WhereIF(!string.IsNullOrWhiteSpace(input.PORTDISCHARGE), u => u.PORTDISCHARGE.Contains(input.PORTDISCHARGE))
- .WhereIF(!string.IsNullOrWhiteSpace(input.PLACEDELIVERY), u => u.PLACEDELIVERY.Contains(input.PLACEDELIVERY))
- .WhereIF(!string.IsNullOrWhiteSpace(input.PLACEDELIVERYID), u => u.PLACEDELIVERYID == input.PLACEDELIVERYID)
- .WhereIF(!string.IsNullOrWhiteSpace(input.DESTINATION), u => u.DESTINATION.Contains(input.DESTINATION))
- .WhereIF(!string.IsNullOrWhiteSpace(input.DESTINATIONID), u => u.DESTINATIONID == input.DESTINATIONID)
- .WhereIF(!string.IsNullOrWhiteSpace(input.NOBILL), u => u.NOBILL == input.NOBILL)
- .WhereIF(!string.IsNullOrWhiteSpace(input.COPYNOBILLL), u => u.COPYNOBILL == input.COPYNOBILLL)
- .WhereIF(!string.IsNullOrWhiteSpace(input.ISSUETYPE), u => u.ISSUETYPE == input.ISSUETYPE)
- .WhereIF(input.BISSUEDATE != null, u => u.ISSUEDATE >= input.BISSUEDATE)
- .WhereIF(input.EISSUEDATE != null, u => u.ISSUEDATE <= input.EISSUEDATE)
- .WhereIF(!string.IsNullOrWhiteSpace(input.ISSUEPLACE), u => u.ISSUEPLACE.Contains(input.ISSUEPLACE))
- .WhereIF(!string.IsNullOrWhiteSpace(input.ISSUEPLACEID), u => u.ISSUEPLACEID == input.ISSUEPLACEID)
- .WhereIF(!string.IsNullOrWhiteSpace(input.BLFRT), u => u.BLFRT == input.BLFRT)
- .WhereIF(!string.IsNullOrWhiteSpace(input.PREPARDATID), u => u.PREPARDATID == input.PREPARDATID)
- .WhereIF(!string.IsNullOrWhiteSpace(input.PREPARDAT), u => u.PREPARDAT == input.PREPARDAT)
- .WhereIF(!string.IsNullOrWhiteSpace(input.PAYABLEAT), u => u.PAYABLEAT.Contains(input.PAYABLEAT))
- .WhereIF(!string.IsNullOrWhiteSpace(input.PAYABLEATID), u => u.PAYABLEATID == input.PAYABLEATID)
- .WhereIF(!string.IsNullOrWhiteSpace(input.SERVICE), u => u.SERVICE.Contains(input.SERVICE))
- .WhereIF(!string.IsNullOrWhiteSpace(input.MARKS), u => u.MARKS.Contains(input.MARKS))
- .WhereIF(!string.IsNullOrWhiteSpace(input.HSCODE), u => u.HSCODE.Contains(input.HSCODE))
- .WhereIF(!string.IsNullOrWhiteSpace(input.DESCRIPTION), u => u.DESCRIPTION.Contains(input.DESCRIPTION))
- .WhereIF(!string.IsNullOrWhiteSpace(input.KINDPKGS), u => u.KINDPKGS == input.KINDPKGS)
- .WhereIF(!string.IsNullOrWhiteSpace(input.CNTRTOTAL), u => u.CNTRTOTAL.StartsWith(input.CNTRTOTAL))
- .WhereIF(!string.IsNullOrWhiteSpace(input.CARRIERID), u => u.CARRIERID == input.CARRIERID)
- .WhereIF(!string.IsNullOrWhiteSpace(input.CARRIER), u => u.CARRIER.Contains(input.CARRIER))
- .WhereIF(!string.IsNullOrWhiteSpace(input.CARGOID), u => u.CARGOID == input.CARGOID)
- .WhereIF(!string.IsNullOrWhiteSpace(input.DCLASS), u => u.DCLASS == input.DCLASS)
- .WhereIF(!string.IsNullOrWhiteSpace(input.DUNNO), u => u.DUNNO == input.DUNNO)
- .WhereIF(!string.IsNullOrWhiteSpace(input.DPAGE), u => u.DPAGE == input.DPAGE)
- .WhereIF(!string.IsNullOrWhiteSpace(input.DLABEL), u => u.DLABEL == input.DLABEL)
- .WhereIF(!string.IsNullOrWhiteSpace(input.LINKMAN), u => u.LINKMAN == input.LINKMAN)
- .WhereIF(!string.IsNullOrWhiteSpace(input.TEMPID), u => u.TEMPID == input.TEMPID)
- .WhereIF(!string.IsNullOrWhiteSpace(input.TEMPSET), u => u.TEMPSET == input.TEMPSET)
- .WhereIF(!string.IsNullOrWhiteSpace(input.REEFERF), u => u.REEFERF == input.REEFERF)
- .WhereIF(!string.IsNullOrWhiteSpace(input.HUMIDITY), u => u.HUMIDITY == input.HUMIDITY)
- .WhereIF(!string.IsNullOrWhiteSpace(input.TEMPMIN), u => u.TEMPMIN == input.TEMPMIN)
- .WhereIF(!string.IsNullOrWhiteSpace(input.TEMPMAX), u => u.TEMPMAX == input.TEMPMAX)
- .WhereIF(input.ISCONTAINERSOC != null, u => u.ISCONTAINERSOC == input.ISCONTAINERSOC)
- .WhereIF(!string.IsNullOrWhiteSpace(input.SOREMARK), u => u.SOREMARK.Contains(input.SOREMARK))
- .WhereIF(!string.IsNullOrWhiteSpace(input.SIREMARK), u => u.SIREMARK.Contains(input.SIREMARK))
- .WhereIF(!string.IsNullOrWhiteSpace(input.YARDREMARK), u => u.YARDREMARK.Contains(input.YARDREMARK))
- .WhereIF(!string.IsNullOrWhiteSpace(input.COMPID), u => u.COMPID == input.COMPID)
- .WhereIF(!string.IsNullOrWhiteSpace(input.COMPNAME), u => u.COMPNAME.Contains(input.COMPNAME))
- .WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERNAME), u => u.SHIPPERNAME.Contains(input.SHIPPERNAME))
- .WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERCITY), u => u.SHIPPERCITY.Contains(input.SHIPPERCITY))
- .WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERPROVINCE), u => u.SHIPPERPROVINCE == input.SHIPPERPROVINCE)
- .WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERPOSTCODE), u => u.SHIPPERPOSTCODE == input.SHIPPERPOSTCODE)
- .WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERCOUNTRY), u => u.SHIPPERCOUNTRY == input.SHIPPERCOUNTRY)
- .WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERATTN), u => u.SHIPPERATTN.Contains(input.SHIPPERATTN))
- .WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERTEL), u => u.SHIPPERTEL == input.SHIPPERTEL)
- .WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEENAME), u => u.CONSIGNEENAME.Contains(input.CONSIGNEENAME))
- .WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEECITY), u => u.CONSIGNEECITY.Contains(input.CONSIGNEECITY))
- .WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEEPROVINCE), u => u.CONSIGNEEPROVINCE == input.CONSIGNEEPROVINCE)
- .WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEEPOSTCODE), u => u.CONSIGNEEPOSTCODE == input.CONSIGNEEPOSTCODE)
- .WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEERCOUNTRY), u => u.CONSIGNEERCOUNTRY == input.CONSIGNEERCOUNTRY)
- .WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEEATTN), u => u.CONSIGNEEATTN.Contains(input.CONSIGNEEATTN))
- .WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEETEL), u => u.CONSIGNEETEL == input.CONSIGNEETEL)
- .WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTYNAME), u => u.NOTIFYPARTYNAME.Contains(input.NOTIFYPARTYNAME))
- .WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTYCITY), u => u.NOTIFYPARTYCITY.Contains(input.NOTIFYPARTYCITY))
- .WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTYPROVINCE), u => u.NOTIFYPARTYPROVINCE == input.NOTIFYPARTYPROVINCE)
- .WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTYPOSTCODE), u => u.NOTIFYPARTYPOSTCODE == input.NOTIFYPARTYPOSTCODE)
- .WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTYCOUNTRY), u => u.NOTIFYPARTYCOUNTRY == input.NOTIFYPARTYCOUNTRY)
- .WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTYATTN), u => u.NOTIFYPARTYATTN.Contains(input.NOTIFYPARTYATTN))
- .WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTYTEL), u => u.NOTIFYPARTYTEL == input.NOTIFYPARTYTEL)
- .WhereIF(!string.IsNullOrWhiteSpace(input.PONO), u => u.PONO.Contains(input.PONO))
- .WhereIF(!string.IsNullOrWhiteSpace(input.OPID), u => u.OPID == input.OPID)
- .WhereIF(!string.IsNullOrWhiteSpace(input.DOCID), u => u.DOCID == input.DOCID)
- .WhereIF(!string.IsNullOrWhiteSpace(input.OP), u => u.OP == input.OP)
- .WhereIF(!string.IsNullOrWhiteSpace(input.DOC), u => u.DOC == input.DOC)
- .WhereIF(!string.IsNullOrWhiteSpace(input.SALEID), u => u.SALEID == input.SALEID)
- .WhereIF(!string.IsNullOrWhiteSpace(input.SALE), u => u.SALE.Contains(input.SALE))
- .WhereIF(!string.IsNullOrWhiteSpace(input.CUSTSERVICEID), u => u.CUSTSERVICEID == input.CUSTSERVICEID)
- .WhereIF(!string.IsNullOrWhiteSpace(input.CUSTSERVICE), u => u.CUSTSERVICE.Contains(input.CUSTSERVICE))
- .WhereIF(!string.IsNullOrWhiteSpace(input.CUSTOMERNAME), u => u.CUSTOMERNAME.Contains(input.CUSTOMERNAME))
- .WhereIF(input.CUSTOMERID != null && input.CUSTOMERID != 0, u => u.CUSTOMERID == input.CUSTOMERID)
- .WhereIF(!string.IsNullOrWhiteSpace(input.FORWARDER), u => u.FORWARDER.Contains(input.FORWARDER))
- .WhereIF(!string.IsNullOrWhiteSpace(input.AGENTID), u => u.AGENTID == input.AGENTID)
- .WhereIF(!string.IsNullOrWhiteSpace(input.FORWARDERID), u => u.FORWARDERID == input.FORWARDERID)
- .WhereIF(!string.IsNullOrWhiteSpace(input.SHIPAGENCY), u => u.SHIPAGENCY.Contains(input.SHIPAGENCY))
- .WhereIF(!string.IsNullOrWhiteSpace(input.SHIPAGENCYID), u => u.SHIPAGENCYID == input.SHIPAGENCYID)
- .WhereIF(!string.IsNullOrWhiteSpace(input.CUSTOMSER), u => u.CUSTOMSER.Contains(input.CUSTOMSER))
- .WhereIF(!string.IsNullOrWhiteSpace(input.CUSTOMSERID), u => u.CUSTOMSERID == input.CUSTOMSERID)
- .WhereIF(!string.IsNullOrWhiteSpace(input.TRUCKER), u => u.TRUCKER.Contains(input.TRUCKER))
- .WhereIF(!string.IsNullOrWhiteSpace(input.TRUCKERID), u => u.TRUCKERID == input.TRUCKERID)
- .WhereIF(!string.IsNullOrWhiteSpace(input.AGENTNAME), u => u.AGENTNAME.Contains(input.AGENTNAME))
- .WhereIF(!string.IsNullOrWhiteSpace(input.WEITUO), u => u.WEITUO.Contains(input.WEITUO))
- .WhereIF(!string.IsNullOrWhiteSpace(input.SCACCODE), u => u.SCACCODE == input.SCACCODE)
- .WhereIF(!string.IsNullOrWhiteSpace(input.ITNCODE), u => u.ITNCODE == input.ITNCODE)
- .WhereIF(!string.IsNullOrWhiteSpace(input.CUSTNO), u => u.CUSTNO.Contains(input.CUSTNO))
- .WhereIF(!string.IsNullOrWhiteSpace(input.TRANSPORTID), u => u.TRANSPORTID == input.TRANSPORTID)
- .WhereIF(!string.IsNullOrWhiteSpace(input.TRANSPORT), u => u.TRANSPORT.Contains(input.TRANSPORT))
- .WhereIF(!string.IsNullOrWhiteSpace(input.YARDCONTRACTTEL), u => u.YARDCONTRACTTEL == input.YARDCONTRACTTEL)
- .WhereIF(!string.IsNullOrWhiteSpace(input.YARDCONTRACTEMAIL), u => u.YARDCONTRACTEMAIL == input.YARDCONTRACTEMAIL)
- .WhereIF(!string.IsNullOrWhiteSpace(input.LANECODE), u => u.LANECODE == input.LANECODE)
- .WhereIF(!string.IsNullOrWhiteSpace(input.LANENAME), u => u.LANENAME.Contains(input.LANENAME))
- .WhereIF(!string.IsNullOrWhiteSpace(input.ROUTEID), u => u.ROUTEID == input.ROUTEID)
- .WhereIF(!string.IsNullOrWhiteSpace(input.ROUTE), u => u.ROUTE.Contains(input.ROUTE))
- .WhereIF(!string.IsNullOrWhiteSpace(input.LineManageID), u => u.LineManageID == input.LineManageID)
- .WhereIF(!string.IsNullOrWhiteSpace(input.LineManage), u => u.LineManage.Contains(input.LineManage))
- .WhereIF(!string.IsNullOrWhiteSpace(input.ShippingMethod), u => u.ShippingMethod.Contains(input.ShippingMethod))
- .WhereIF(!string.IsNullOrWhiteSpace(input.CreatedUserName), u => u.CreatedUserName.Contains(input.CreatedUserName))
- .WhereIF(!string.IsNullOrWhiteSpace(input.FREIGHTPAYER), u => u.FREIGHTPAYER.Contains(input.FREIGHTPAYER))
- .WhereIF(!string.IsNullOrWhiteSpace(input.DZRemark), u => u.DZRemark.Contains(input.DZRemark))
- .WhereIF(!string.IsNullOrWhiteSpace(input.CZRemark), u => u.CZRemark.Contains(input.CZRemark))
- .WhereIF(!string.IsNullOrWhiteSpace(input.ZhanCangFlag), u => u.ZhanCangFlag == input.ZhanCangFlag)
- .WhereIF(saleUserList != null && saleUserList.Count > 0, o => saleUserList.Contains(o.SALEID))
- .WhereIF(opUserList != null && opUserList.Count > 0, o => opUserList.Contains(o.OPID))
- .WhereIF(userlist != null && userlist.Count() > 0, u => userlist.Contains((long)u.CreatedUserId) || UserManager.UserId.ToString() == u.ROUTEID || UserManager.Name.ToString() == u.ROUTE || UserManager.UserId.ToString() == u.SALEID || UserManager.Name.ToString() == u.SALE || UserManager.UserId.ToString() == u.OPID || UserManager.Name.ToString() == u.OP || UserManager.UserId.ToString() == u.DOCID || UserManager.Name.ToString() == u.DOC || UserManager.UserId.ToString() == u.CUSTSERVICEID || UserManager.Name.ToString() == u.CUSTSERVICE)
- .OrderBy(PageInputOrder.OrderBuilder(input.SortField, input.DescSort))
- .ToPagedListAsync(input.PageNo, input.PageSize);
-
- #endregion
- var list = entities.Adapt>();
-
- var itgoodsStatus = _goodsStatus.AsQueryable().LeftJoin(_goodsStatusConfig.AsQueryable(),
- (goods, config) => config.Id == goods.ConfigId).
- OrderBy((goods, config) => config.Sort).
- Select((goods, config) => new
- {
- bookingid = goods.bookingId,
- ConfigId = goods.ConfigId,
- SystemCode = config.SystemCode,
- StatusName = config.StatusName,
- FinishTime = goods.FinishTime,
- ExtData = goods.ExtData,
- Remark = goods.Remark,
- CreatedUserId = config.CreatedUserId,
- Sort = config.Sort
- }).ToList();
-
- var itconfigs = _goodsStatusConfig.AsQueryable().Select(config => new
- {
- bookingid = "",
- ConfigId = config.Id,
- SystemCode = config.SystemCode,
- StatusName = config.StatusName,
- FinishTime = "",
- ExtData = "",
- Remark = "",
- CreatedUserId = config.CreatedUserId,
- Sort = config.Sort
- }).ToList();
- var statusloglist = _repStatuslog.AsQueryable().Filter(null, true).Where(x => (x.Status == "提箱" || x.Status == "返场") && x.IsDeleted == false).ToList();
- var statuslogdetaillist = _statuslogdetail.AsQueryable().ToList();
-
- foreach (var item in list.Items)
- {
- var sta = _repBookingStatus.AsQueryable().Filter(null, true).Where(x => x.BookingId == item.Id).ToList();
- if (sta != null)
- {
-
- item.bookstatus = sta;
- }
- var st = _bookingremark.AsQueryable().Filter(null, true).Where(x => x.PId == item.Id).ToList();
- if (st != null)
- {
- item.bookremark = st;
- }
- if (!string.IsNullOrWhiteSpace(item.ETD))
- {
- item.ETD = Convert.ToDateTime(item.ETD).ToString("yyyy-MM-dd");
- }
- if (!string.IsNullOrWhiteSpace(item.ETA))
- {
- item.ETA = Convert.ToDateTime(item.ETA).ToString("yyyy-MM-dd");
- }
- if (!string.IsNullOrWhiteSpace(item.YgtETD))
- {
- item.YgtETD = Convert.ToDateTime(item.YgtETD).ToString("yyyy-MM-dd");
- }
- if (!string.IsNullOrWhiteSpace(item.ATD))
- {
- item.ATD = Convert.ToDateTime(item.ATD).ToString("yyyy-MM-dd");
- }
- if (!string.IsNullOrWhiteSpace(item.StartETA))
- {
- item.StartETA = Convert.ToDateTime(item.StartETA).ToString("yyyy-MM-dd");
- }
- if (!string.IsNullOrWhiteSpace(item.StartATA))
- {
- item.StartATA = Convert.ToDateTime(item.StartATA).ToString("yyyy-MM-dd");
- }
- if (!string.IsNullOrWhiteSpace(item.MiddleETA))
- {
- item.MiddleETA = Convert.ToDateTime(item.MiddleETA).ToString("yyyy-MM-dd");
- }
- if (!string.IsNullOrWhiteSpace(item.MiddleETD))
- {
- item.MiddleETD = Convert.ToDateTime(item.MiddleETD).ToString("yyyy-MM-dd");
- }
- if (!string.IsNullOrWhiteSpace(item.MiddleATA))
- {
- item.MiddleATA = Convert.ToDateTime(item.MiddleATA).ToString("yyyy-MM-dd");
- }
- if (!string.IsNullOrWhiteSpace(item.MiddleATD))
- {
- item.MiddleATD = Convert.ToDateTime(item.MiddleATD).ToString("yyyy-MM-dd");
- }
- if (!string.IsNullOrWhiteSpace(item.ATA))
- {
- item.ATA = Convert.ToDateTime(item.ATA).ToString("yyyy-MM-dd");
- }
- var itgoods = itgoodsStatus.Where(x => x.CreatedUserId == item.CreatedUserId && x.bookingid == item.Id).OrderBy(x => x.Sort).
- Select(x => new GoodsStatusList
- {
- ConfigId = x.ConfigId,
- StatusName = x.StatusName,
- SystemCode = x.SystemCode,
- FinishTime = x.FinishTime,
- ExtData = x.ExtData,
- Remark = x.Remark,
- Sort = x.Sort
- }).ToList();
-
- var itconfig = itconfigs.Where(x => x.CreatedUserId == item.CreatedUserId).OrderBy(x => x.Sort).
- Select(x => new GoodsStatusList
- {
- ConfigId = x.ConfigId,
- StatusName = x.StatusName,
- SystemCode = x.SystemCode,
- FinishTime = null,
- ExtData = x.ExtData,
- Remark = x.Remark,
- Sort = x.Sort
- }).ToList();
-
- foreach (var ii in itgoods)
- {
- itconfig.RemoveAll(x => x.ConfigId == ii.ConfigId);
- }
- item.IsVGM = itgoods.Where(x => x.SystemCode == "YFVGM").FirstOrDefault() == null ? null : itgoods.Where(x => x.SystemCode == "YFVGM").Select(x => x.FinishTime).FirstOrDefault();
- item.IsCanDan = itgoods.Where(x => x.SystemCode == "YFCD").FirstOrDefault() == null ? null : itgoods.Where(x => x.SystemCode == "YFCD").Select(x => x.FinishTime).FirstOrDefault();
- item.IsZZFX = itgoods.Where(x => x.SystemCode == "ZZFX").FirstOrDefault() == null ? null : itgoods.Where(x => x.SystemCode == "ZZFX").Select(x => x.FinishTime).FirstOrDefault();
- item.GoodsStatusList = itgoods.Union(itconfig).OrderBy(x => x.Sort).ToList();
- ////获取提箱返场状态
- //var statuslog = statusloglist.Where(x => x.BookingId == item.Id).OrderByDescending(x => x.CreatedTime).ToList();
- //var dto = statuslog.Adapt>();
- //foreach (var it in dto)
- //{
- // var detail = statuslogdetaillist.Where(x => x.PId == it.Id).ToList();
- // it.detail = detail.Adapt>();
- //}
- var statusids = statusloglist.Where(x => x.BookingId == item.Id).Select(x => x.Id).ToList();
- var dto = statuslogdetaillist.Where(x => statusids.Contains(x.PId)).ToList();
- List CNTRNODtolist = new List();
- foreach (var d in dto)
- {
- var ctn = CNTRNODtolist.Where(x => x.CNTRNO == d.CNTRNO).FirstOrDefault();
- if (ctn == null)
- {
- if (d.Status == "提箱")
- {
-
- CNTRNODtolist.Add(new CNTRNODto
- {
- BookingId = item.Id,
- CNTRNO = d.CNTRNO,
- TXOPTime = d.OPTime,
- FCOPTime = null
- });
- }
- if (d.Status == "返场")
- {
-
- CNTRNODtolist.Add(new CNTRNODto
- {
- BookingId = item.Id,
- CNTRNO = d.CNTRNO,
- FCOPTime = d.OPTime,
- TXOPTime = null
- });
- }
- }
- else
- {
-
- if (d.Status == "提箱")
- {
- ctn.TXOPTime = d.OPTime;
- }
- if (d.Status == "返场")
- {
- ctn.FCOPTime = d.OPTime;
- }
- }
- }
-
-
- item.statuslogs1 = CNTRNODtolist;
- }
-
- return list;
- }
-
///
/// 分页查询订舱主表
///
@@ -962,17 +591,17 @@ namespace Myshipping.Application
{
throw Oops.Bah(ms);
}
-
+
JsonUtil.PropToUpper(input, "ORDNO", "BSSTATUS", "YARDID", "YardContract", "YardContractTel", "YardContractEmail", "MARKS", "DESCRIPTION", "CONSIGNEENAME", "SHIPPERNAME", "NOTIFYPARTYNAME", "DZRemark", "CZRemark");
-
+
if (input.ctnInputs != null)
{
var groupList = input.ctnInputs.Where(x => x.CTNNUM > 0).GroupBy(c => c.CTNALL).Select(g => $"{g.Key}*{g.Sum(gg => gg.CTNNUM)}");
input.CNTRTOTAL = string.Join(" / ", groupList);
}
-
- if (!string.IsNullOrWhiteSpace(input.MBLNO)&& input.ParentId==0)
+
+ if (!string.IsNullOrWhiteSpace(input.MBLNO) && input.ParentId == 0)
{
var et = await _rep.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.MBLNO == input.MBLNO && x.TenantId == UserManager.TENANT_ID && x.ParentId == 0 && x.Id != input.Id).FirstAsync();
if (et != null)
@@ -980,9 +609,9 @@ namespace Myshipping.Application
throw Oops.Bah("当前主提单号已存在,请勿重复录入!");
}
}
- if (!string.IsNullOrWhiteSpace(input.HBLNO)&& !string.IsNullOrWhiteSpace(input.MBLNO) && input.ParentId != 0)
+ if (!string.IsNullOrWhiteSpace(input.HBLNO) && !string.IsNullOrWhiteSpace(input.MBLNO) && input.ParentId != 0)
{
- var et = await _rep.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false&&x.MBLNO == input.MBLNO && x.HBLNO == input.HBLNO && x.TenantId == UserManager.TENANT_ID && x.ParentId == input.ParentId && x.Id != input.Id).FirstAsync();
+ var et = await _rep.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.MBLNO == input.MBLNO && x.HBLNO == input.HBLNO && x.TenantId == UserManager.TENANT_ID && x.ParentId == input.ParentId && x.Id != input.Id).FirstAsync();
if (et != null)
{
throw Oops.Bah("当前分提单号已存在,请勿重复录入!");
@@ -992,7 +621,7 @@ namespace Myshipping.Application
//陈冠宇提订舱编号不允许重复
if (!string.IsNullOrWhiteSpace(input.CUSTNO))
{
- var et = await _rep.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.CUSTNO == input.CUSTNO && x.TenantId == UserManager.TENANT_ID && x.ParentId == 0&& x.Id != input.Id).FirstAsync();
+ var et = await _rep.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.CUSTNO == input.CUSTNO && x.TenantId == UserManager.TENANT_ID && x.ParentId == 0 && x.Id != input.Id).FirstAsync();
if (et != null)
{
throw Oops.Bah("当前订舱编号已存在,请勿重复录入!");
@@ -1002,16 +631,16 @@ namespace Myshipping.Application
//孙晓飞提PONO不允许重复
if (!string.IsNullOrWhiteSpace(input.PONO))
{
- var et = await _rep.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.PONO == input.PONO && x.TenantId == UserManager.TENANT_ID && x.ParentId == 0 && x.Id != input.Id).FirstAsync();
+ var et = await _rep.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.PONO == input.PONO && x.TenantId == UserManager.TENANT_ID && x.ParentId == 0 && x.Id != input.Id).FirstAsync();
if (et != null)
{
throw Oops.Bah("当前PONO已存在,请勿重复录入!");
}
}
//版本号
- if (!string.IsNullOrWhiteSpace(input.VERSION)&& input.Id!=0)
+ if (!string.IsNullOrWhiteSpace(input.VERSION) && input.Id != 0)
{
- var et = await _rep.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.VERSION == input.VERSION && x.Id == input.Id).FirstAsync();
+ var et = await _rep.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.VERSION == input.VERSION && x.Id == input.Id).FirstAsync();
if (et == null)
{
throw Oops.Bah("当前版本号不一致,请刷新后在保存单据");
@@ -1086,12 +715,13 @@ namespace Myshipping.Application
{
var mlist = await _rep.AsQueryable().Filter(null, true).Where(x => x.Id == input.Id).FirstAsync();
- if (!(mlist.OPID==UserManager.UserId.ToString()|| mlist.DOCID==UserManager.UserId.ToString()||mlist.CUSTSERVICEID==UserManager.UserId.ToString()||mlist.ROUTEID==UserManager.UserId.ToString()||mlist.CreatedUserId.ToString()==UserManager.UserId.ToString())) {
+ if (!(mlist.OPID == UserManager.UserId.ToString() || mlist.DOCID == UserManager.UserId.ToString() || mlist.CUSTSERVICEID == UserManager.UserId.ToString() || mlist.ROUTEID == UserManager.UserId.ToString() || mlist.CreatedUserId.ToString() == UserManager.UserId.ToString()))
+ {
throw Oops.Bah("您没有当前单据的操作权限!");
}
-
+
if (string.IsNullOrEmpty(entity.VOYNO))
{
@@ -1235,312 +865,87 @@ namespace Myshipping.Application
{
#region 插入货运动态
- //配置中所有的货物状态
- var config = _goodsStatusConfig.AsQueryable().Filter(null, true).Where(config => config.CreatedUserId == main.CreatedUserId).ToList().DistinctBy(x => x.StatusName).ToList();
-
- if (config.Count() == 0)
+ if (!string.IsNullOrEmpty(entity.CUSTNO))
{
- _GoodsConfig.InitGoodsStatusConfig((long)main.CreatedUserId, main.CreatedUserName);
- config = _goodsStatusConfig.AsQueryable().Filter(null, true).Where(config => config.CreatedUserId == main.CreatedUserId).ToList().DistinctBy(x => x.StatusName).ToList();
- if (!string.IsNullOrEmpty(entity.CUSTNO))
- {
- var Config = config.Where(x => x.SystemCode == "YDC").FirstOrDefault();
- if (Config != null)
- {
-
- var Status = _goodsStatus.FirstOrDefault(x => x.bookingId == Id && x.ConfigId == Config.Id);
- if (Status == null)
- {
-
- await _goodsStatus.InsertAsync(new BookingGoodsStatus
- {
- bookingId = Id,
- ConfigId = Config.Id,
- FinishTime = DateTime.Now,
- FinishUser = UserManager.Name,
- FinishUserId = UserManager.UserId,
- IsPublic = false
- });
- main.BSSTATUSNAME = Config.StatusName;
-
- await _rep.AsUpdateable(main).IgnoreColumns(it => new
- {
- it.ParentId,
- it.TenantId,
- it.CreatedTime,
- it.CreatedUserId,
- it.CreatedUserName,
- it.TenantName,
- it.IsDeleted,
- it.BOOKINGNO
- }).ExecuteCommandAsync();
- }
- }
- }
- if (!string.IsNullOrEmpty(entity.MBLNO))
- {
- var Config = config.Where(x => x.SystemCode == "YSDBC").FirstOrDefault();
- if (Config != null)
- {
- var Status = _goodsStatus.FirstOrDefault(x => x.bookingId == Id && x.ConfigId == Config.Id);
- if (Status == null)
- {
- await _goodsStatus.InsertAsync(new BookingGoodsStatus
- {
- bookingId = Id,
- ConfigId = Config.Id,
- FinishTime = DateTime.Now,
- FinishUser = UserManager.Name,
- FinishUserId = UserManager.UserId,
- IsPublic = false
- });
- main.BSSTATUSNAME = Config.StatusName;
-
- await _rep.AsUpdateable(main).IgnoreColumns(it => new
- {
- it.ParentId,
- it.TenantId,
- it.CreatedTime,
- it.CreatedUserId,
- it.CreatedUserName,
- it.TenantName,
- it.IsDeleted,
- it.BOOKINGNO
- }).ExecuteCommandAsync();
- }
-
- }
- }
-
+ await SetGoodsStatus("YDC", Id);
}
- else
+ if (!string.IsNullOrEmpty(entity.MBLNO))
{
- if (!string.IsNullOrEmpty(entity.CUSTNO))
- {
- var Config = config.Where(x => x.SystemCode == "YDC").FirstOrDefault();
- if (Config != null)
- {
- var Status = _goodsStatus.FirstOrDefault(x => x.bookingId == Id && x.ConfigId == Config.Id);
- if (Status == null)
- {
-
- await _goodsStatus.InsertAsync(new BookingGoodsStatus
- {
- bookingId = Id,
- ConfigId = Config.Id,
- FinishTime = DateTime.Now,
- FinishUser = UserManager.Name,
- FinishUserId = UserManager.UserId,
- IsPublic = false
- });
- main.BSSTATUSNAME = Config.StatusName;
-
- await _rep.AsUpdateable(main).IgnoreColumns(it => new
- {
- it.ParentId,
- it.TenantId,
- it.CreatedTime,
- it.CreatedUserId,
- it.CreatedUserName,
- it.TenantName,
- it.IsDeleted,
- it.BOOKINGNO
- }).ExecuteCommandAsync();
- }
-
-
- }
- }
- if (!string.IsNullOrEmpty(entity.MBLNO))
- {
- var Config = config.Where(x => x.SystemCode == "YSDBC").FirstOrDefault();
- if (Config != null)
- {
-
- var Status = _goodsStatus.FirstOrDefault(x => x.bookingId == Id && x.ConfigId == Config.Id);
- if (Status == null)
- {
-
- await _goodsStatus.InsertAsync(new BookingGoodsStatus
- {
- bookingId = Id,
- ConfigId = Config.Id,
- FinishTime = DateTime.Now,
- FinishUser = UserManager.Name,
- FinishUserId = UserManager.UserId,
- IsPublic = false
- });
- main.BSSTATUSNAME = Config.StatusName;
-
- await _rep.AsUpdateable(main).IgnoreColumns(it => new
- {
- it.ParentId,
- it.TenantId,
- it.CreatedTime,
- it.CreatedUserId,
- it.CreatedUserName,
- it.TenantName,
- it.IsDeleted,
- it.BOOKINGNO
- }).ExecuteCommandAsync();
- }
-
- }
- }
-
+ await SetGoodsStatus("YSDBC", Id);
}
-
-
-
#endregion
}
if (string.IsNullOrEmpty(entity.MBLNO) || string.IsNullOrEmpty(entity.CUSTNO))
{
-
#region 取消货运动态
//配置中所有的货物状态
- var config = _goodsStatusConfig.AsQueryable().Filter(null, true).Where(config => config.CreatedUserId == main.CreatedUserId).ToList().DistinctBy(x => x.StatusName).ToList();
+ var config = _goodsStatusConfig.AsQueryable().Filter(null, true).Where(config => config.CreatedUserId == main.CreatedUserId).ToList();
+
- if (config.Count() == 0)
+ if (string.IsNullOrEmpty(entity.CUSTNO))
{
- _GoodsConfig.InitGoodsStatusConfig((long)main.CreatedUserId, main.CreatedUserName);
- config = _goodsStatusConfig.AsQueryable().Filter(null, true).Where(config => config.CreatedUserId == main.CreatedUserId).ToList().DistinctBy(x => x.StatusName).ToList();
- if (string.IsNullOrEmpty(entity.CUSTNO))
+ var Config = config.Where(x => x.SystemCode == "YDC").FirstOrDefault();
+ if (Config != null)
{
- var Config = config.Where(x => x.SystemCode == "YDC").FirstOrDefault();
- if (Config != null)
+ _goodsStatus.Delete(x => x.bookingId == Id && x.ConfigId == Config.Id);
+ var ConfigId = _goodsStatus.Where(x => x.FinishTime.HasValue && x.bookingId == Id).OrderByDescending(x => x.FinishTime).Select(x => x.ConfigId).First();
+ string BSSTATUSNAME = String.Empty;
+ if (ConfigId == null)
{
- _goodsStatus.Delete(x => x.bookingId == Id && x.ConfigId == Config.Id);
- var ConfigId = _goodsStatus.Where(x => x.FinishTime.HasValue && x.bookingId == Id).OrderByDescending(x => x.FinishTime).Select(x => x.ConfigId).First();
- string BSSTATUSNAME = String.Empty;
- if (ConfigId == null)
- {
- main.BSSTATUSNAME = "";
- }
- else
- {
- BSSTATUSNAME = config.Where(x => x.Id == ConfigId).Select(x => x.StatusName).FirstOrDefault();
- main.BSSTATUSNAME = BSSTATUSNAME == null ? "" : BSSTATUSNAME;
- }
- await _rep.AsUpdateable(main).IgnoreColumns(it => new
- {
- it.ParentId,
- it.TenantId,
- it.CreatedTime,
- it.CreatedUserId,
- it.CreatedUserName,
- it.TenantName,
- it.IsDeleted,
- it.BOOKINGNO
- }).ExecuteCommandAsync();
+ main.BSSTATUSNAME = "";
}
- }
-
- if (string.IsNullOrEmpty(entity.MBLNO))
- {
- var Config = config.Where(x => x.SystemCode == "YSDBC").FirstOrDefault();
- if (Config != null)
+ else
{
- _goodsStatus.Delete(x => x.bookingId == Id && x.ConfigId == Config.Id);
- var ConfigId = _goodsStatus.Where(x => x.FinishTime.HasValue && x.bookingId == Id).OrderByDescending(x => x.FinishTime).Select(x => x.ConfigId).First();
- string BSSTATUSNAME = String.Empty;
- if (ConfigId == null)
- {
- main.BSSTATUSNAME = "";
- }
- else
- {
- BSSTATUSNAME = config.Where(x => x.Id == ConfigId).Select(x => x.StatusName).FirstOrDefault();
- main.BSSTATUSNAME = BSSTATUSNAME == null ? "" : BSSTATUSNAME;
- }
- await _rep.AsUpdateable(main).IgnoreColumns(it => new
- {
- it.ParentId,
- it.TenantId,
- it.CreatedTime,
- it.CreatedUserId,
- it.CreatedUserName,
- it.TenantName,
- it.IsDeleted,
- it.BOOKINGNO
- }).ExecuteCommandAsync();
+ BSSTATUSNAME = config.Where(x => x.Id == ConfigId).Select(x => x.StatusName).FirstOrDefault();
+ main.BSSTATUSNAME = BSSTATUSNAME == null ? "" : BSSTATUSNAME;
}
+ await _rep.AsUpdateable(main).IgnoreColumns(it => new
+ {
+ it.ParentId,
+ it.TenantId,
+ it.CreatedTime,
+ it.CreatedUserId,
+ it.CreatedUserName,
+ it.TenantName,
+ it.IsDeleted,
+ it.BOOKINGNO
+ }).ExecuteCommandAsync();
}
-
}
- else
+ if (string.IsNullOrEmpty(entity.MBLNO))
{
- if (string.IsNullOrEmpty(entity.CUSTNO))
+ var Config = config.Where(x => x.SystemCode == "YSDBC").FirstOrDefault();
+ if (Config != null)
{
- var Config = config.Where(x => x.SystemCode == "YDC").FirstOrDefault();
- if (Config != null)
+ _goodsStatus.Delete(x => x.bookingId == Id && x.ConfigId == Config.Id);
+ var ConfigId = _goodsStatus.Where(x => x.FinishTime.HasValue && x.bookingId == Id).OrderByDescending(x => x.FinishTime).Select(x => x.ConfigId).First();
+ string BSSTATUSNAME = String.Empty;
+ if (ConfigId == null)
{
- _goodsStatus.Delete(x => x.bookingId == Id && x.ConfigId == Config.Id);
- var ConfigId = _goodsStatus.Where(x => x.FinishTime.HasValue && x.bookingId == Id).OrderByDescending(x => x.FinishTime).Select(x => x.ConfigId).First();
- string BSSTATUSNAME = String.Empty;
- if (ConfigId == null)
- {
- main.BSSTATUSNAME = "";
- }
- else
- {
- BSSTATUSNAME = config.Where(x => x.Id == ConfigId).Select(x => x.StatusName).FirstOrDefault();
- main.BSSTATUSNAME = BSSTATUSNAME == null ? "" : BSSTATUSNAME;
- }
- await _rep.AsUpdateable(main).IgnoreColumns(it => new
- {
- it.ParentId,
- it.TenantId,
- it.CreatedTime,
- it.CreatedUserId,
- it.CreatedUserName,
- it.TenantName,
- it.IsDeleted,
- it.BOOKINGNO
- }).ExecuteCommandAsync();
+ main.BSSTATUSNAME = "";
}
- }
- if (string.IsNullOrEmpty(entity.MBLNO))
- {
- var Config = config.Where(x => x.SystemCode == "YSDBC").FirstOrDefault();
- if (Config != null)
+ else
{
- _goodsStatus.Delete(x => x.bookingId == Id && x.ConfigId == Config.Id);
- var ConfigId = _goodsStatus.Where(x => x.FinishTime.HasValue && x.bookingId == Id).OrderByDescending(x => x.FinishTime).Select(x => x.ConfigId).First();
- string BSSTATUSNAME = String.Empty;
- if (ConfigId == null)
- {
- main.BSSTATUSNAME = "";
- }
- else
- {
- BSSTATUSNAME = config.Where(x => x.Id == ConfigId).Select(x => x.StatusName).FirstOrDefault();
- main.BSSTATUSNAME = BSSTATUSNAME == null ? "" : BSSTATUSNAME;
- }
- await _rep.AsUpdateable(main).IgnoreColumns(it => new
- {
- it.ParentId,
- it.TenantId,
- it.CreatedTime,
- it.CreatedUserId,
- it.CreatedUserName,
- it.TenantName,
- it.IsDeleted,
- it.BOOKINGNO
- }).ExecuteCommandAsync();
+ BSSTATUSNAME = config.Where(x => x.Id == ConfigId).Select(x => x.StatusName).FirstOrDefault();
+ main.BSSTATUSNAME = BSSTATUSNAME == null ? "" : BSSTATUSNAME;
}
+ await _rep.AsUpdateable(main).IgnoreColumns(it => new
+ {
+ it.ParentId,
+ it.TenantId,
+ it.CreatedTime,
+ it.CreatedUserId,
+ it.CreatedUserName,
+ it.TenantName,
+ it.IsDeleted,
+ it.BOOKINGNO
+ }).ExecuteCommandAsync();
}
-
}
-
-
-
#endregion
}
-
-
if (main != null)
{
ordOut = main.Adapt();
@@ -1597,26 +1002,7 @@ namespace Myshipping.Application
{
ordOut.BookingEDIExt = ediExtEntity.Adapt();
}
-
-
-
- List arr = new List();
- if (main.ParentId == 0)
- {
- arr.Add(Id);
- }
- else
- {
- arr.Add((long)main.ParentId);
- }
-
- var itemcode = _cache.GetAllTenantParam().Result.Where(x => x.ParaCode == "BOOKING_DATA_PUSH" && x.TenantId == UserManager.TENANT_ID).Select(x => x.ItemCode).FirstOrDefault();
- if (!string.IsNullOrEmpty(itemcode))
- {
- if (itemcode == "true")
- await SendBookingOrder(arr.ToArray());
- }
-
+ await SendBookingOrder(new long[] { main.ParentId == 0 ? Id : (long)main.ParentId });
//推送订舱数据到客户订舱系统
CustomerBookingSyncHelper.SendCustomerBookingSync(Id);
@@ -1660,7 +1046,7 @@ namespace Myshipping.Application
var stn = await url.SetBody(bookingOrderDelete).PostAsStringAsync();
var jobj = stn.ToJObject();
- _logger.LogInformation(mblno+"删除单据:"+jobj);
+ _logger.LogInformation(mblno + "删除单据:" + jobj);
if (jobj.GetIntValue("Code") == 200)
{
JObject data = jobj.GetValue("Data") as JObject;
@@ -1694,7 +1080,7 @@ namespace Myshipping.Application
string result = re.GetStringValue("Result");
throw Oops.Bah(result);
}
-
+
}
}
else
@@ -1773,15 +1159,10 @@ namespace Myshipping.Application
await _ctndetailrep.UpdateAsync(x => ctnlist.Contains((long)x.CTNID), x => new BookingCtnDetail { IsDeleted = false });
await _rep.UpdateAsync(x => x.Id == Id, x => new BookingOrder { IsDeleted = false });
await _bookingEDIExt.UpdateAsync(x => x.BookingId == Id && x.IsDeleted == true, x => new BookingEDIExt { IsDeleted = false });
- List list = new List();
- list.Add(Id);
- var itemcode = _cache.GetAllTenantParam().Result.Where(x => x.ParaCode == "BOOKING_DATA_PUSH" && x.TenantId == UserManager.TENANT_ID).Select(x => x.ItemCode).FirstOrDefault();
- if (!string.IsNullOrEmpty(itemcode))
- {
- if (itemcode == "true")
- await SendBookingOrder(list.ToArray());
- _logger.LogInformation(Id + "恢复删除成功!");
- }
+
+ await SendBookingOrder(new long[] { Id });
+ _logger.LogInformation(Id + "恢复删除成功!");
+
@@ -2171,7 +1552,6 @@ namespace Myshipping.Application
{
if (input.BookingId == null || input.BookingId == 0)
{
-
throw Oops.Bah("未传入业务id");
}
await _goodsStatus.DeleteAsync(x => x.bookingId == input.BookingId);
@@ -2260,15 +1640,11 @@ namespace Myshipping.Application
}).ExecuteCommandAsync();
}
- List tslist = new List();
- tslist.Add((long)input.BookingId);
- var itemcode = _cache.GetAllTenantParam().Result.Where(x => x.ParaCode == "BOOKING_DATA_PUSH" && x.TenantId == UserManager.TENANT_ID).Select(x => x.ItemCode).FirstOrDefault();
- if (!string.IsNullOrEmpty(itemcode))
- {
- if (itemcode == "true")
- await SendBookingOrder(tslist.ToArray());
- _logger.LogInformation(input.BookingId + "货物状态推送成功!");
- }
+
+
+
+ await SendBookingOrder(new long[] { order.Id });
+
return t;
}
return null;
@@ -2581,6 +1957,8 @@ namespace Myshipping.Application
bookingStatus.StaTime = item.OpTime;
bookingStatus.StaCate = "book_sta_cate_billtrace";
await _repBookingStatus.InsertAsync(bookingStatus);
+ await SetGoodsStatus("BG", item.BookingId);
+ await SendBookingOrder(new long[] { item.BookingId });
}
}
if (item.Status == "装载")
@@ -2594,6 +1972,8 @@ namespace Myshipping.Application
bookingStatus.StaTime = item.OpTime;
bookingStatus.StaCate = "book_sta_cate_billtrace";
await _repBookingStatus.InsertAsync(bookingStatus);
+ await SetGoodsStatus("ZZFX", item.BookingId);
+ await SendBookingOrder(new long[] { item.BookingId });
}
}
if (item.Status == "码放")
@@ -2607,6 +1987,8 @@ namespace Myshipping.Application
bookingStatus.StaTime = item.OpTime;
bookingStatus.StaCate = "book_sta_cate_billtrace";
await _repBookingStatus.InsertAsync(bookingStatus);
+ await SetGoodsStatus("MTFX", item.BookingId);
+ await SendBookingOrder(new long[] { item.BookingId });
}
}
if (item.Status == "装船")
@@ -2635,6 +2017,12 @@ namespace Myshipping.Application
await _repBookingStatus.InsertAsync(bookingStatus);
}
}
+ #region 入港时间
+ if (item.Status == "入港")
+ {
+ await SetGoodsStatus("YRG", item.BookingId);
+ }
+ #endregion
#endregion
#region ATD
@@ -2663,10 +2051,11 @@ namespace Myshipping.Application
OldValue = oldatd == null ? "" : oldatd.ToString(),
NewValue = item.OpTime == null ? "" : item.OpTime.ToString(),
});
+ await SendBookingOrder(new long[] { o.Id });
}
if (!string.IsNullOrEmpty(o.VESSEL) && !string.IsNullOrEmpty(o.VOYNO))
{
- var order = await _rep.AsQueryable().Filter(null, true).Where(x => x.VOYNO == o.VOYNO && x.VESSEL == o.VESSEL && x.TenantId == o.TenantId && x.IsDeleted == false).ToListAsync();
+ var order = await _rep.AsQueryable().Filter(null, true).Where(x => x.VOYNO == o.VOYNO && x.VESSEL == o.VESSEL && x.TenantId == o.TenantId && x.IsDeleted == false && x.Id != item.BookingId).ToListAsync();
foreach (var it in order)
{
var _oldatd = it.ATD;
@@ -2691,6 +2080,7 @@ namespace Myshipping.Application
OldValue = _oldatd == null ? "" : _oldatd.ToString(),
NewValue = item.OpTime == null ? "" : item.OpTime.ToString(),
});
+ await SendBookingOrder(new long[] { o.Id });
}
@@ -2700,51 +2090,7 @@ namespace Myshipping.Application
}
}
- #endregion
-
- #region 入港时间
- if (item.Status == "入港")
- {
- var order = _rep.AsQueryable().Filter(null, true).Where(x => x.Id == item.BookingId).ToList().FirstOrDefault();
- var goodconfig = _goodsStatusConfig.AsQueryable().Filter(null, true).Where(x => x.CreatedUserId == order.CreatedUserId && x.SystemCode == "YRG").ToList().FirstOrDefault();
- if (goodconfig == null)
- {
- _GoodsConfig.InitGoodsStatusConfig((long)order.CreatedUserId, order.CreatedUserName);
- goodconfig = _goodsStatusConfig.AsQueryable().Filter(null, true).Where(x => x.CreatedUserId == order.CreatedUserId && x.SystemCode == "YRG").ToList().FirstOrDefault();
- }
-
- var St = _goodsStatus.AsQueryable().Filter(null, true).Where(x => x.bookingId == item.BookingId && x.ConfigId == goodconfig.Id).ToList().FirstOrDefault();
- if (St == null)
- {
-
- await _goodsStatus.InsertAsync(new BookingGoodsStatus
- {
- bookingId = item.BookingId,
- ConfigId = goodconfig.Id,
- FinishTime = DateTime.Now,
- FinishUser = order.CreatedUserName,
- FinishUserId = order.CreatedUserId,
- IsPublic = false
- });
-
-
- order.BSSTATUSNAME = goodconfig.StatusName;
-
- await _rep.AsUpdateable(order).IgnoreColumns(it => new
- {
- it.ParentId,
- it.TenantId,
- it.CreatedTime,
- it.CreatedUserId,
- it.CreatedUserName,
- it.TenantName,
- it.IsDeleted,
- it.BOOKINGNO
- }).ExecuteCommandAsync();
- }
-
- }
- #endregion
+ #endregion
}
}
catch (Exception ex)
@@ -3083,7 +2429,8 @@ namespace Myshipping.Application
#endregion
//设置货物状态-放舱
- SetGoodsStatus("YFC", bookingId);
+ await SetGoodsStatus("YFC", bookingId);
+ await SendBookingOrder(new long[] { bookingId });
}
///
@@ -3837,7 +3184,8 @@ namespace Myshipping.Application
await SaveBookingStatus(bookingId, "sta_xhz", "下货纸");
//设置货物状态:已发下货纸,并回传东胜
- SetGoodsStatus("YFXHZ", bookingId);
+ await SetGoodsStatus("YFXHZ", bookingId);
+ await SendBookingOrder(new long[] { bookingId });
}
#endregion
@@ -4495,8 +3843,8 @@ namespace Myshipping.Application
}
//设置货物状态:已发VGM,并回传东胜
- SetGoodsStatus("YFVGM", bookingId);
-
+ await SetGoodsStatus("YFVGM", bookingId);
+ await SendBookingOrder(new long[] { bookingId });
}
@@ -6622,6 +5970,7 @@ namespace Myshipping.Application
{
//如果是截单需最后推送货物状态
await SetGoodsStatus("JD", model.Id);
+ await SendBookingOrder(new long[] { model.Id });
}
}
@@ -8447,118 +7796,123 @@ namespace Myshipping.Application
[NonAction]
public async Task SendBookingOrder(long[] ids)
{
- if (ids.Count() == 0)
- {
- throw Oops.Bah("请上传正确数据");
- }
- var order = await _rep.AsQueryable().Filter(null, true).Where(x => ids.Contains(x.Id) && x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync();
-
- var dto = order.Adapt>();
- if (dto.Count() == 0)
- {
- return 0;
- }
- foreach (var item in dto)
+ var itemcode = _cache.GetAllTenantParam().Result.Where(x => x.ParaCode == "BOOKING_DATA_PUSH" && x.TenantId == UserManager.TENANT_ID).Select(x => x.ItemCode).FirstOrDefault();
+ if (!string.IsNullOrEmpty(itemcode) && itemcode == "true")
{
-
- if (!string.IsNullOrEmpty(item.CARRIERID))
+ if (ids.Count() == 0)
{
- var CARRIER = _cache.GetAllCodeCarrier().Result.Where(x => x.Code == item.CARRIERID).Select(x => x.CnName).FirstOrDefault();
- if (CARRIER != null)
- {
-
- item.CARRIER = CARRIER;
- }
+ throw Oops.Bah("请上传正确数据");
}
+ var order = await _rep.AsQueryable().Filter(null, true).Where(x => ids.Contains(x.Id) && x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync();
- var CtnDayNumlist = await GetGoodsStatusList(item.Id);
- if (CtnDayNumlist != null)
+ var dto = order.Adapt>();
+ if (dto.Count() == 0)
{
- item.CtnDayNum = CtnDayNumlist.Where(x => x.StatusName == "申请箱使").Select(x => x.ExtData).FirstOrDefault();
+ return 0;
}
-
- //if (!string.IsNullOrEmpty(item.ISSUETYPE))
- //{
- // var ISSUETYPE = _cache.GetAllMappingIssueType().Result.Where(x => x.Module == "HeChuan" && x.Code == item.ISSUETYPE).Select(x => x.MapName).FirstOrDefault();
- // item.ISSUETYPE = ISSUETYPE;
- //}
-
- var ctn = await _repCtn.AsQueryable().Filter(null, true).Where(x => x.BILLID == item.Id && x.IsDeleted == false).ToListAsync();
- item.ctnInputs = ctn.Adapt>();
- foreach (var it in item.ctnInputs)
+ foreach (var item in dto)
{
- var ctnDetailInputs = await _ctndetailrep.AsQueryable().Filter(null, true).Where(x => x.CTNID == it.Id && x.IsDeleted == false).ToListAsync();
- it.ctnDetailInputs = ctnDetailInputs.Adapt>();
- }
- var BookingEDIExt = await _bookingEDIExt.AsQueryable().Filter(null, true).Where(x => x.BookingId == item.Id && x.IsDeleted == false).FirstAsync();
- if (BookingEDIExt != null)
- {
- item.BookingEDIExt = BookingEDIExt.Adapt();
- }
- item.GoodsStatus = await _goodsStatus.AsQueryable().Filter(null, true).Where(x => x.bookingId == item.Id).InnerJoin((t, d) => t.ConfigId == d.Id).Select((t, d) => new BookingGoodsStatusDto
- {
- StatusName = d.StatusName,
- FinishTime = t.FinishTime,
- Remark = t.Remark,
- ExtData = t.ExtData
- }).Distinct().ToListAsync();
+ if (!string.IsNullOrEmpty(item.CARRIERID))
+ {
+ var CARRIER = _cache.GetAllCodeCarrier().Result.Where(x => x.Code == item.CARRIERID).Select(x => x.CnName).FirstOrDefault();
+ if (CARRIER != null)
+ {
- var childrens = await _rep.AsQueryable().Filter(null, true).Where(x => x.ParentId == item.Id && x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync();
- item.childrens = childrens.Adapt>();
+ item.CARRIER = CARRIER;
+ }
+ }
- foreach (var childitem in item.childrens)
- {
- var ctnInputs = await _repCtn.AsQueryable().Filter(null, true).Where(x => x.BILLID == childitem.Id && x.IsDeleted == false).ToListAsync();
- childitem.ctnInputs = ctnInputs.Adapt>();
+ var CtnDayNumlist = await GetGoodsStatusList(item.Id);
+ if (CtnDayNumlist != null)
+ {
+ item.CtnDayNum = CtnDayNumlist.Where(x => x.StatusName == "申请箱使").Select(x => x.ExtData).FirstOrDefault();
+ }
+
+ if (!string.IsNullOrEmpty(item.ISSUETYPE))
+ {
+ var ISSUETYPE = _cache.GetAllMappingIssueType().Result.Where(x => x.Module == "HeChuan" && x.Code == item.ISSUETYPE).Select(x => x.MapName).FirstOrDefault();
+ item.ISSUETYPE = ISSUETYPE;
+ }
- foreach (var it in childitem.ctnInputs)
+ var ctn = await _repCtn.AsQueryable().Filter(null, true).Where(x => x.BILLID == item.Id && x.IsDeleted == false).ToListAsync();
+ item.ctnInputs = ctn.Adapt>();
+ foreach (var it in item.ctnInputs)
{
var ctnDetailInputs = await _ctndetailrep.AsQueryable().Filter(null, true).Where(x => x.CTNID == it.Id && x.IsDeleted == false).ToListAsync();
it.ctnDetailInputs = ctnDetailInputs.Adapt>();
+ }
+ var BookingEDIExt = await _bookingEDIExt.AsQueryable().Filter(null, true).Where(x => x.BookingId == item.Id && x.IsDeleted == false).FirstAsync();
+ if (BookingEDIExt != null)
+ {
+ item.BookingEDIExt = BookingEDIExt.Adapt();
}
- var childBookingEDIExt = await _bookingEDIExt.AsQueryable().Filter(null, true).Where(x => x.BookingId == childitem.Id && x.IsDeleted == false).FirstAsync();
- if (childBookingEDIExt != null)
+ item.GoodsStatus = await _goodsStatus.AsQueryable().Filter(null, true).Where(x => x.bookingId == item.Id).InnerJoin((t, d) => t.ConfigId == d.Id).Select((t, d) => new BookingGoodsStatusDto
+ {
+ StatusName = d.StatusName,
+ FinishTime = t.FinishTime,
+ Remark = t.Remark,
+ ExtData = t.ExtData
+ }).Distinct().ToListAsync();
+
+ var childrens = await _rep.AsQueryable().Filter(null, true).Where(x => x.ParentId == item.Id && x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync();
+ item.childrens = childrens.Adapt>();
+
+ foreach (var childitem in item.childrens)
{
- childitem.BookingEDIExt = childBookingEDIExt.Adapt();
+ var ctnInputs = await _repCtn.AsQueryable().Filter(null, true).Where(x => x.BILLID == childitem.Id && x.IsDeleted == false).ToListAsync();
+ childitem.ctnInputs = ctnInputs.Adapt>();
+
+ foreach (var it in childitem.ctnInputs)
+ {
+ var ctnDetailInputs = await _ctndetailrep.AsQueryable().Filter(null, true).Where(x => x.CTNID == it.Id && x.IsDeleted == false).ToListAsync();
+ it.ctnDetailInputs = ctnDetailInputs.Adapt>();
+
+ }
+ var childBookingEDIExt = await _bookingEDIExt.AsQueryable().Filter(null, true).Where(x => x.BookingId == childitem.Id && x.IsDeleted == false).FirstAsync();
+ if (childBookingEDIExt != null)
+ {
+ childitem.BookingEDIExt = childBookingEDIExt.Adapt();
+ }
}
- }
- var json = dto.ToJsonString();
- _logger.LogInformation("订舱数据回推:" + json);
+ var json = dto.ToJsonString();
+ _logger.LogInformation("订舱数据回推:" + json);
- try
- {
- const string MqActionExchangeName = "djy.output.dingcang.ds6";
- const string MqActionQueueName = "djy.output.dingcang.ds6";
- ConnectionFactory factory = new ConnectionFactory();
- factory.Uri = new Uri(_cache.GetAllDictData().Result.Where(x => x.Code == "BookingOrderMQUri").Select(x => x.Value).FirstOrDefault());
-
- using (IConnection conn = factory.CreateConnection())
- {
- IModel mqModel = conn.CreateModel();
- mqModel.ExchangeDeclare(MqActionExchangeName, ExchangeType.Direct);
- var queueName = $"{MqActionQueueName}.{UserManager.TENANT_ID}";
- mqModel.QueueDeclare(queueName, false, false, false, null);
- mqModel.QueueBind(queueName, MqActionExchangeName, queueName, null);
- byte[] messageBodyBytes = Encoding.UTF8.GetBytes(json);
- IBasicProperties props = mqModel.CreateBasicProperties();
- props.DeliveryMode = 2;
- mqModel.BasicPublish(MqActionExchangeName,
- queueName, props,
- messageBodyBytes);
- conn.Close();
- _logger.LogInformation($"订舱数据回推,已发送数据到消息队列【{_cache.GetAllDictData().Result.Where(x => x.Code == "BookingOrderMQUri").Select(x => x.Value).FirstOrDefault()}】,数据内容:【{json}】");
+ try
+ {
+ const string MqActionExchangeName = "djy.output.dingcang.ds6";
+ const string MqActionQueueName = "djy.output.dingcang.ds6";
+ ConnectionFactory factory = new ConnectionFactory();
+ factory.Uri = new Uri(_cache.GetAllDictData().Result.Where(x => x.Code == "BookingOrderMQUri").Select(x => x.Value).FirstOrDefault());
+
+ using (IConnection conn = factory.CreateConnection())
+ {
+ IModel mqModel = conn.CreateModel();
+ mqModel.ExchangeDeclare(MqActionExchangeName, ExchangeType.Direct);
+ var queueName = $"{MqActionQueueName}.{UserManager.TENANT_ID}";
+ mqModel.QueueDeclare(queueName, false, false, false, null);
+ mqModel.QueueBind(queueName, MqActionExchangeName, queueName, null);
+ byte[] messageBodyBytes = Encoding.UTF8.GetBytes(json);
+ IBasicProperties props = mqModel.CreateBasicProperties();
+ props.DeliveryMode = 2;
+ mqModel.BasicPublish(MqActionExchangeName,
+ queueName, props,
+ messageBodyBytes);
+ conn.Close();
+ _logger.LogInformation($"订舱数据回推,已发送数据到消息队列【{_cache.GetAllDictData().Result.Where(x => x.Code == "BookingOrderMQUri").Select(x => x.Value).FirstOrDefault()}】,数据内容:【{json}】");
+ }
}
- }
- catch (Exception ex)
- {
- _logger.LogError(ex.Message);
- _logger.LogError(ex.StackTrace);
+ catch (Exception ex)
+ {
+ _logger.LogError(ex.Message);
+ _logger.LogError(ex.StackTrace);
+ }
}
+ return dto;
}
- return dto;
+ return null;
}
@@ -8636,38 +7990,51 @@ namespace Myshipping.Application
var sjdk_time = item.GetDateTimeValue("sjdk_time");//实际到港时间
var sjlg_time = item.GetDateTimeValue("sjlg_time");//实际离港时间
_logger.LogInformation("船期:" + yjdk_time + yjlk_time + sjdk_time + sjlg_time);
- order.StartETA = yjdk_time;
- order.YgtETD = yjlk_time;
- order.StartATA = sjdk_time;
- order.ATD = sjlg_time;
- await _rep.AsUpdateable(order).IgnoreColumns().ExecuteCommandAsync();
+ bool flag = false;
+ if (order.StartETA != yjdk_time)
+ {
- var orderlist = await _rep.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID && x.CARRIERID == order.CARRIERID && x.VESSEL == order.VESSEL && x.VOYNO == order.VOYNO && x.Id != order.Id)
- .WhereIF(!string.IsNullOrEmpty(order.VOYNOINNER), x => x.VOYNOINNER == order.VOYNOINNER).ToListAsync();
- foreach (var i in orderlist)
+ order.StartETA = yjdk_time;
+ flag = true;
+ }
+ if (order.YgtETD != yjlk_time)
{
- i.StartETA = yjdk_time;
- i.YgtETD = yjlk_time;
- i.StartATA = sjdk_time;
- i.ATD = sjlg_time;
- await _rep.AsUpdateable(i).IgnoreColumns().ExecuteCommandAsync();
+
+ order.YgtETD = yjlk_time;
+ flag = true;
}
+ if (order.StartATA != sjdk_time)
+ {
- var itemcode = _cache.GetAllTenantParam().Result.Where(x => x.ParaCode == "BOOKING_DATA_PUSH" && x.TenantId == UserManager.TENANT_ID).Select(x => x.ItemCode).FirstOrDefault();
- if (!string.IsNullOrEmpty(itemcode))
+ order.StartATA = sjdk_time;
+ flag = true;
+ }
+ if (order.ATD != sjlg_time)
{
- if (itemcode == "true")
- {
- List list = new List();
- list = orderlist.Where(x => x.ParentId == 0).Select(x => x.Id).ToList();
- list.Add(order.Id);
- if (list != null && list.Count > 0)
- {
- await SendBookingOrder(list.ToArray());
- }
+ order.ATD = sjlg_time;
+ flag = true;
+ }
+
+ if (flag)
+ {
+ await _rep.AsUpdateable(order).IgnoreColumns().ExecuteCommandAsync();
+ await SendBookingOrder(new long[] { Id });
+ var orderlist = await _rep.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID && x.CARRIERID == order.CARRIERID && x.VESSEL == order.VESSEL && x.VOYNO == order.VOYNO && x.Id != order.Id)
+ .WhereIF(!string.IsNullOrEmpty(order.VOYNOINNER), x => x.VOYNOINNER == order.VOYNOINNER).ToListAsync();
+ foreach (var i in orderlist)
+ {
+ i.StartETA = yjdk_time;
+ i.YgtETD = yjlk_time;
+ i.StartATA = sjdk_time;
+ i.ATD = sjlg_time;
+ await _rep.AsUpdateable(i).IgnoreColumns().ExecuteCommandAsync();
+ await SendBookingOrder(new long[] { i.Id });
}
+
}
+
+
return order;
}
@@ -8679,10 +8046,11 @@ namespace Myshipping.Application
///
public async Task SetGoodsStatus(string code, long bookingId)
{
+
var gsCfg = _goodsStatusConfig.FirstOrDefault(x => x.SystemCode == code && x.CreatedUserId == UserManager.UserId);
if (gsCfg != null)
{
- _logger.LogInformation($"发送VGM检查货物状态:{bookingId}");
+ _logger.LogInformation($"检查{code}货物状态:{bookingId}");
var gs = _goodsStatus.FirstOrDefault(x => x.ConfigId == gsCfg.Id && x.bookingId == bookingId);
if (gs == null)
{
@@ -8694,16 +8062,22 @@ namespace Myshipping.Application
gs.FinishUserId = UserManager.UserId;
await _goodsStatus.InsertAsync(gs);
- _logger.LogInformation($"发送VGM后自动完成货物状态,Id:{bookingId},操作人:{UserManager.Name}");
-
- //推送东胜
- var itemcode = _cache.GetAllTenantParam().Result.Where(x => x.ParaCode == "BOOKING_DATA_PUSH" && x.TenantId == UserManager.TENANT_ID).Select(x => x.ItemCode).FirstOrDefault();
- if (!string.IsNullOrEmpty(itemcode) && itemcode == "true")
+ var order = _rep.AsQueryable().Filter(null, true).First(x => x.Id == bookingId);
+ order.BSSTATUSNAME = gsCfg.StatusName;
+ await _rep.AsUpdateable(order).IgnoreColumns(it => new
{
- await SendBookingOrder(new long[] { bookingId });
+ it.ParentId,
+ it.TenantId,
+ it.CreatedTime,
+ it.CreatedUserId,
+ it.CreatedUserName,
+ it.TenantName,
+ it.IsDeleted,
+ it.BOOKINGNO
+ }).ExecuteCommandAsync();
+ _logger.LogInformation($"发送{code}后自动完成货物状态,Id:{bookingId},操作人:{UserManager.Name}");
+
- _logger.LogInformation($"发送VGM后货物状态推送东胜完成,Id:{bookingId},操作人:{UserManager.Name}");
- }
}
}
}
diff --git a/Myshipping.Application/Service/BookingOrder/IBookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/IBookingOrderService.cs
index fd51b076..ffcc057d 100644
--- a/Myshipping.Application/Service/BookingOrder/IBookingOrderService.cs
+++ b/Myshipping.Application/Service/BookingOrder/IBookingOrderService.cs
@@ -15,7 +15,6 @@ namespace Myshipping.Application
Task Get(long Id);
- Task Page([FromQuery] BookingOrderInput input);
Task> GetLog(long Id);
Task Download(long id);
@@ -70,5 +69,7 @@ namespace Myshipping.Application
///
///
Task SetGoodsStatus(string code, long bookingId);
+
+
}
}
\ No newline at end of file
diff --git a/Myshipping.Application/Service/BookingOrderSF/BookingOrderSFService.cs b/Myshipping.Application/Service/BookingOrderSF/BookingOrderSFService.cs
index 0b762c85..02116bbb 100644
--- a/Myshipping.Application/Service/BookingOrderSF/BookingOrderSFService.cs
+++ b/Myshipping.Application/Service/BookingOrderSF/BookingOrderSFService.cs
@@ -134,31 +134,34 @@ namespace Myshipping.Application
.ToPagedListAsync(input.PageNo, input.PageSize);
var list = entities.Adapt>();
- foreach (var item in list.Items) {
-
-
-
-
-
+ foreach (var item in list.Items) {
+ item.Business = await _business.AsQueryable().Filter(null, true).Where(x => x.PId == item.Id).ToListAsync();
+ item.detail= await _detail.AsQueryable().Filter(null, true).Where(x => x.PId == item.Id).ToListAsync();
}
return list;
}
-
-
-
-
-
-
-
-
///
- /// Test
+ /// 保存并返回数据
///
///
- [HttpGet("/BookingOrderSF/Test")]
- public async Task Test()
+ [HttpGet("/BookingOrderSF/Save")]
+ public async Task Save(BookingOrderSFDto input)
{
- return "1";
+ if (input.Id == 0)
+ {
+
+
+
+
+ }
+ else {
+
+
+
+
+
+ }
+ return null;
}
}
diff --git a/Myshipping.Application/Service/BookingOrderSeaeEdi/BookingOrderSeaeEdiService.cs b/Myshipping.Application/Service/BookingOrderSeaeEdi/BookingOrderSeaeEdiService.cs
index 051cfd44..6dbe5889 100644
--- a/Myshipping.Application/Service/BookingOrderSeaeEdi/BookingOrderSeaeEdiService.cs
+++ b/Myshipping.Application/Service/BookingOrderSeaeEdi/BookingOrderSeaeEdiService.cs
@@ -122,7 +122,8 @@ namespace Myshipping.Application
{
entity.CARRIER = _cache.GetAllCodeCarrier().Result.Where(x => x.Code == entity.CARRIERID).Select(x => x.EdiCode).FirstOrDefault();
}
- if (entity.CARGOID!="D") {
+ if (entity.CARGOID != "D")
+ {
entity.DCLASS = string.Empty;
entity.DUNNO = string.Empty;
@@ -160,6 +161,7 @@ namespace Myshipping.Application
{
entity.CARRIER = _cache.GetAllCodeCarrier().Result.Where(x => x.Code == entity.CARRIERID).Select(x => x.EdiCode).FirstOrDefault();
}
+
if (entity.CARGOID != "D")
{
@@ -329,12 +331,12 @@ namespace Myshipping.Application
var strResp = await dicUrl.Value.SetContentType("multipart/form-data").SetBody(sendObj).PostAsStringAsync();
_logger.LogInformation($"调用舱单接口返回:{strResp}");
-
+
var jobjResp = JObject.Parse(strResp);
bool respCode = jobjResp.GetBooleanValue("Success");
if (respCode == false)
{
- throw Oops.Bah(jobjResp.GetStringValue("Message").Replace("
", "\r\n").Replace("
",""));
+ throw Oops.Bah(jobjResp.GetStringValue("Message").Replace("
", "\r\n").Replace("
", ""));
}
//货运动态
var bsl = new BookingStatusLog();
@@ -367,13 +369,11 @@ namespace Myshipping.Application
{
await _seaeedi.UpdateAsync(x => x.Id == Id, x => new BookingOrderSeaeEdi { State = "已发送", SENDREMARK = SENDREMARK });
}
- if (type == "0")
- {
- await _seaeedi.UpdateAsync(x => x.Id == Id, x => new BookingOrderSeaeEdi { State = "已直发", SENDREMARK = SENDREMARK });
- }
- if (type == "1")
+ if (type == "0" || type == "1")
{
await _seaeedi.UpdateAsync(x => x.Id == Id, x => new BookingOrderSeaeEdi { State = "已直发", SENDREMARK = SENDREMARK });
+ await _rep.SetGoodsStatus("YFCD", Id);
+ await _rep.SendBookingOrder(new long[] { Id });
}
if (type == "2")
{
@@ -387,51 +387,8 @@ namespace Myshipping.Application
}
- if (type == "3"|| type == "0"||type == "1") {
- #region 插入货运动态
- //配置中所有的货物状态
- var config = _goodsStatusConfig.AsQueryable().Where(config => config.CreatedUserId == order.CreatedUserId).ToList().DistinctBy(x => x.StatusName).Select(config => new GoodsStatusQuery
- {
-
- ConfigId = config.Id,
- SystemCode = config.SystemCode,
- StatusName = config.StatusName,
- FinishTime = null,
- FinishUser = null,
- FinishUserId = null,
- IsPublic = false,
- ExtData = null,
- Remark = null,
- Sort = config.Sort
- }).ToList();
-
- var ConfigId = config.Where(x => x.SystemCode == "YFCD").Select(x => x.ConfigId).First();
-
- await _goodsStatus.InsertAsync(new BookingGoodsStatus
- {
- bookingId= Id,
- ConfigId= ConfigId,
- FinishTime=DateTime.Now,
- FinishUser= order.CreatedUserName,
- FinishUserId = order.CreatedUserId,
- IsPublic=false
- });
- List tslist = new List();
- tslist.Add((long)Id);
- var itemcode = _cache.GetAllTenantParam().Result.Where(x => x.ParaCode == "BOOKING_DATA_PUSH" && x.TenantId == UserManager.TENANT_ID).Select(x => x.ItemCode).FirstOrDefault();
- if (!string.IsNullOrEmpty(itemcode))
- {
- if (itemcode == "true")
- await _rep.SendBookingOrder(tslist.ToArray());
- _logger.LogInformation(Id + "自动订舱货物状态推送成功!");
- }
- }
-
-
-
- #endregion
diff --git a/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs b/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs
index 755c7d77..8523e280 100644
--- a/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs
+++ b/Myshipping.Application/Service/BookingTruck/BookingTruckService.cs
@@ -848,7 +848,7 @@ namespace Myshipping.Application
//派车后填写货物状态
await _bookingOrderService.SetGoodsStatus("YPC", model.Id);
-
+ await _bookingOrderService.SendBookingOrder(new long[] { model.Id });
//更新派车订单为已提交
model.Status = BookingTruckStatus.SUBMITED.ToString();
model.UpdatedTime = DateTime.Now;
diff --git a/Myshipping.Application/Service/DataSync/DataSyncService.cs b/Myshipping.Application/Service/DataSync/DataSyncService.cs
index 4dc4af47..9f5f814f 100644
--- a/Myshipping.Application/Service/DataSync/DataSyncService.cs
+++ b/Myshipping.Application/Service/DataSync/DataSyncService.cs
@@ -1746,7 +1746,7 @@ namespace Myshipping.Application
});
it.YgtETD = item.ETD;
}
- if (it.ATD != item.ATD&& it.ATD==null)
+ if (it.ATD != item.ATD && it.ATD == null)
{
flag = true;
////添加booking日志
@@ -1800,21 +1800,7 @@ namespace Myshipping.Application
}
if (issend)
{
-
- var itemcode = _cache.GetAllTenantParam().Result.Where(x => x.ParaCode == "BOOKING_DATA_PUSH" && x.TenantId == UserManager.TENANT_ID).Select(x => x.ItemCode).FirstOrDefault();
- if (!string.IsNullOrEmpty(itemcode))
- {
- if (itemcode == "true")
- {
- List list = new List();
- list = order.Where(x => x.ParentId == 0).Select(x => x.Id).ToList();
- if (list != null && list.Count > 0)
- {
- await _bookingorderservice.SendBookingOrder(list.ToArray());
- }
-
- }
- }
+ await _bookingorderservice.SendBookingOrder(order.Where(x => x.ParentId == 0).Select(x => x.Id).ToArray());
}
}
}
@@ -1993,13 +1979,8 @@ namespace Myshipping.Application
}
if (issend)
{
+ await _bookingorderservice.SendBookingOrder(order.Where(x => x.ParentId == 0).Select(x => x.Id).ToArray());
- var itemcode = _cache.GetAllTenantParam().Result.Where(x => x.ParaCode == "BOOKING_DATA_PUSH" && x.TenantId == UserManager.TENANT_ID).Select(x => x.ItemCode).FirstOrDefault();
- if (!string.IsNullOrEmpty(itemcode))
- {
- if (itemcode == "true")
- await _bookingorderservice.SendBookingOrder(order.Where(x => x.ParentId == 0).Select(x => x.Id).ToArray());
- }
}
}