booking_auth_dev
wanghaomei 2 years ago
commit 4466296ba3

@ -1,5 +1,6 @@
using Myshipping.Core;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace Myshipping.Application
@ -121,6 +122,8 @@ namespace Myshipping.Application
/// </summary>
public class AddBookingCtnInput : BookingCtnInput
{
public List<AddBookingCtnDetailInput> ctnDetailInputs { get; set; }
}
/// <summary>

@ -18,7 +18,9 @@ using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Identity;
using Furion.FriendlyException;
using Furion.Logging;
using System;
using Microsoft.Extensions.Logging;
namespace Myshipping.Application
{
/// <summary>
@ -28,12 +30,16 @@ namespace Myshipping.Application
public class BookingOrderService : IBookingOrderService, IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<BookingOrder> _rep;
private readonly SqlSugarRepository<BookingCtn> _repCtn;
public BookingOrderService(SqlSugarRepository<BookingOrder> rep, SqlSugarRepository<BookingCtn> repCtn)
private readonly SqlSugarRepository<BookingCtn> _repCtn;
private readonly SqlSugarRepository<BookingCtnDetail> _ctndetailrep;
private readonly ILogger<BookingOrderService> _logger;
public BookingOrderService(SqlSugarRepository<BookingOrder> rep, SqlSugarRepository<BookingCtn> repCtn, SqlSugarRepository<BookingCtnDetail> ctndetailrep, ILogger<BookingOrderService> logger)
{
_rep = rep;
_repCtn = repCtn;
this._logger = logger;
this._rep = rep;
this._repCtn = repCtn;
this._ctndetailrep = ctndetailrep;
}
/// <summary>
@ -46,41 +52,47 @@ namespace Myshipping.Application
{
var entities = await _rep.AsQueryable()
.WhereIF(!string.IsNullOrWhiteSpace(input.BSSTATUS), u => u.BSSTATUS == input.BSSTATUS)
.WhereIF(!string.IsNullOrWhiteSpace(input.MBLNO), u => u.MBLNO == input.MBLNO)
.WhereIF(!string.IsNullOrWhiteSpace(input.HBLNO), u => u.HBLNO == input.HBLNO)
.WhereIF(!string.IsNullOrWhiteSpace(input.BOOKINGNO), u => u.BOOKINGNO == input.BOOKINGNO)
.WhereIF(!string.IsNullOrWhiteSpace(input.CONTRACTNO), u => u.CONTRACTNO == input.CONTRACTNO)
.WhereIF(!string.IsNullOrWhiteSpace(input.SERVICECONTRACTNO), u => u.SERVICECONTRACTNO == input.SERVICECONTRACTNO)
.WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPER), u => u.SHIPPER == input.SHIPPER)
.WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEE), u => u.CONSIGNEE == input.CONSIGNEE)
.WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTY), u => u.NOTIFYPARTY == input.NOTIFYPARTY)
.WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTY2), u => u.NOTIFYPARTY2 == input.NOTIFYPARTY2)
.WhereIF(!string.IsNullOrWhiteSpace(input.MBLNO), u => input.MBLNO.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).Contains(u.MBLNO))
.WhereIF(!string.IsNullOrWhiteSpace(input.HBLNO), u => input.HBLNO.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).Contains(u.HBLNO))
.WhereIF(!string.IsNullOrWhiteSpace(input.BOOKINGNO), u => u.BOOKINGNO.IndexOf(input.BOOKINGNO) > -1)
.WhereIF(!string.IsNullOrWhiteSpace(input.CONTRACTNO), u => u.CONTRACTNO.IndexOf(input.CONTRACTNO) > -1)
.WhereIF(!string.IsNullOrWhiteSpace(input.SERVICECONTRACTNO), u => u.SERVICECONTRACTNO.IndexOf(input.SERVICECONTRACTNO) > -1)
.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.YARD), u => u.YARD == input.YARD)
.WhereIF(!string.IsNullOrWhiteSpace(input.VESSELID), u => u.VESSELID == input.VESSELID)
.WhereIF(!string.IsNullOrWhiteSpace(input.VESSEL), u => u.VESSEL == input.VESSEL)
.WhereIF(!string.IsNullOrWhiteSpace(input.VOYNO), u => u.VOYNO == input.VOYNO)
.WhereIF(!string.IsNullOrWhiteSpace(input.VOYNOINNER), u => u.VOYNOINNER == input.VOYNOINNER)
.WhereIF(!string.IsNullOrWhiteSpace(input.PLACERECEIPT), u => u.PLACERECEIPT == input.PLACERECEIPT)
.WhereIF(!string.IsNullOrWhiteSpace(input.PORTLOAD), u => u.PORTLOAD == input.PORTLOAD)
.WhereIF(!string.IsNullOrWhiteSpace(input.PORTDISCHARGE), u => u.PORTDISCHARGE == input.PORTDISCHARGE)
.WhereIF(!string.IsNullOrWhiteSpace(input.PLACEDELIVERY), u => u.PLACEDELIVERY == input.PLACEDELIVERY)
.WhereIF(!string.IsNullOrWhiteSpace(input.DESTINATION), u => u.DESTINATION == input.DESTINATION)
.WhereIF(!string.IsNullOrWhiteSpace(input.VESSELID), u => u.VESSELID.IndexOf(input.VESSELID) > -1)
.WhereIF(!string.IsNullOrWhiteSpace(input.VESSEL), u => u.VESSEL.ToLower().IndexOf(u.VESSEL.ToLower()) > -1)
.WhereIF(!string.IsNullOrWhiteSpace(input.VOYNO), u => u.VOYNO.IndexOf(input.VOYNO) > -1)
.WhereIF(!string.IsNullOrWhiteSpace(input.VOYNOINNER), u => u.VOYNOINNER.IndexOf(input.VOYNOINNER) > -1)
.WhereIF(!string.IsNullOrWhiteSpace(input.PLACERECEIPT), u => u.PLACERECEIPT.Contains(input.PLACERECEIPT))
.WhereIF(!string.IsNullOrWhiteSpace(input.PLACERECEIPTID), u => u.PLACERECEIPTID == input.PLACERECEIPTID)
.WhereIF(!string.IsNullOrWhiteSpace(input.PORTLOAD), u => u.PORTLOAD.IndexOf(input.PORTLOAD) > -1)
.WhereIF(!string.IsNullOrWhiteSpace(input.PORTDISCHARGE), u => u.PORTDISCHARGE.IndexOf(input.PORTDISCHARGE) > -1)
.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.COPYNOBILLL == input.COPYNOBILLL)
.WhereIF(!string.IsNullOrWhiteSpace(input.ISSUETYPE), u => u.ISSUETYPE == input.ISSUETYPE)
.WhereIF(!string.IsNullOrWhiteSpace(input.ISSUEPLACE), u => u.ISSUEPLACE == input.ISSUEPLACE)
.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 == input.PAYABLEAT)
.WhereIF(!string.IsNullOrWhiteSpace(input.SERVICE), u => u.SERVICE == input.SERVICE)
.WhereIF(!string.IsNullOrWhiteSpace(input.MARKS), u => u.MARKS == input.MARKS)
.WhereIF(!string.IsNullOrWhiteSpace(input.HSCODE), u => u.HSCODE == input.HSCODE)
.WhereIF(!string.IsNullOrWhiteSpace(input.DESCRIPTION), u => u.DESCRIPTION == input.DESCRIPTION)
.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.IndexOf(input.HSCODE) > -1)
.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 == input.CNTRTOTAL)
.WhereIF(!string.IsNullOrWhiteSpace(input.CARRIERID), u => u.CARRIERID == input.CARRIERID)
.WhereIF(!string.IsNullOrWhiteSpace(input.CARRIER), u => u.CARRIER == input.CARRIER)
.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)
@ -93,41 +105,32 @@ namespace Myshipping.Application
.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, u => u.ISCONTAINERSOC == input.ISCONTAINERSOC)
.WhereIF(!string.IsNullOrWhiteSpace(input.SOREMARK), u => u.SOREMARK == input.SOREMARK)
.WhereIF(!string.IsNullOrWhiteSpace(input.SIREMARK), u => u.SIREMARK == input.SIREMARK)
.WhereIF(!string.IsNullOrWhiteSpace(input.YARDREMARK), u => u.YARDREMARK == input.YARDREMARK)
.WhereIF(!input.ISCONTAINERSOC, 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 == input.COMPNAME)
.WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERNAME), u => u.SHIPPERNAME == input.SHIPPERNAME)
.WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERADDR1), u => u.SHIPPERADDR1 == input.SHIPPERADDR1)
.WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERADDR2), u => u.SHIPPERADDR2 == input.SHIPPERADDR2)
.WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERADDR3), u => u.SHIPPERADDR3 == input.SHIPPERADDR3)
.WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERCITY), u => u.SHIPPERCITY == input.SHIPPERCITY)
.WhereIF(!string.IsNullOrWhiteSpace(input.COMPNAME), u => u.COMPNAME.IndexOf(input.COMPNAME) > -1)
.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 == input.SHIPPERATTN)
.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 == input.CONSIGNEENAME)
.WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEEADDR1), u => u.CONSIGNEEADDR1 == input.CONSIGNEEADDR1)
.WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEEADDR2), u => u.CONSIGNEEADDR2 == input.CONSIGNEEADDR2)
.WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEEADDR3), u => u.CONSIGNEEADDR3 == input.CONSIGNEEADDR3)
.WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEECITY), u => u.CONSIGNEECITY == input.CONSIGNEECITY)
.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 == input.CONSIGNEEATTN)
.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 == input.NOTIFYPARTYNAME)
.WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTYADDR1), u => u.NOTIFYPARTYADDR1 == input.NOTIFYPARTYADDR1)
.WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTYADDR2), u => u.NOTIFYPARTYADDR2 == input.NOTIFYPARTYADDR2)
.WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTYADDR3), u => u.NOTIFYPARTYADDR3 == input.NOTIFYPARTYADDR3)
.WhereIF(!string.IsNullOrWhiteSpace(input.NOTIFYPARTYCITY), u => u.NOTIFYPARTYCITY == input.NOTIFYPARTYCITY)
.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 == input.NOTIFYPARTYATTN)
.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 == input.PONO)
.WhereIF(!string.IsNullOrWhiteSpace(input.OPID), u => u.OPID == input.OPID)
@ -135,8 +138,12 @@ namespace Myshipping.Application
.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 == input.SALE)
.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, u => u.CUSTOMERID == input.CUSTOMERID)
.WhereIF(!string.IsNullOrWhiteSpace(input.FORWARDER), u => u.FORWARDER.Contains(input.FORWARDER))
.WhereIF(!string.IsNullOrWhiteSpace(input.CUSTSERVICE), u => u.CUSTSERVICE == input.CUSTSERVICE)
.WhereIF(!string.IsNullOrWhiteSpace(input.CUSTOMERNAME), u => u.CUSTOMERNAME == input.CUSTOMERNAME)
.WhereIF(!string.IsNullOrWhiteSpace(input.FORWARDER), u => u.FORWARDER == input.FORWARDER)
@ -145,64 +152,107 @@ namespace Myshipping.Application
.WhereIF(!string.IsNullOrWhiteSpace(input.TRUCKER), u => u.TRUCKER == input.TRUCKER)
.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 == input.AGENTNAME)
.WhereIF(!string.IsNullOrWhiteSpace(input.WEITUO), u => u.WEITUO == input.WEITUO)
.WhereIF(!string.IsNullOrWhiteSpace(input.CONSIGNEEDOORADDR), u => u.CONSIGNEEDOORADDR == input.CONSIGNEEDOORADDR)
.WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERDOORADDR), u => u.SHIPPERDOORADDR == input.SHIPPERDOORADDR)
.WhereIF(!string.IsNullOrWhiteSpace(input.AGENTNAME), u => u.AGENTNAME.Contains(input.AGENTNAME))
.WhereIF(!string.IsNullOrWhiteSpace(input.AGENTID), u => u.AGENTID == input.AGENTID)
.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.PREPARDATID), u => u.PREPARDATID == input.PREPARDATID)
.WhereIF(!string.IsNullOrWhiteSpace(input.PAYABLEATID), u => u.PAYABLEATID == input.PAYABLEATID)
.WhereIF(!string.IsNullOrWhiteSpace(input.CUSTNO), u => u.CUSTNO == input.CUSTNO)
.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 == input.TRANSPORT)
.WhereIF(!string.IsNullOrWhiteSpace(input.THIRDPAYADDR), u => u.THIRDPAYADDR == input.THIRDPAYADDR)
.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 == input.LANENAME)
.WhereIF(!string.IsNullOrWhiteSpace(input.FREIGHTPAYER), u => u.FREIGHTPAYER == input.FREIGHTPAYER)
.WhereIF(!string.IsNullOrWhiteSpace(input.LANENAME), u => u.LANENAME.Contains(input.LANENAME))
.WhereIF(!string.IsNullOrWhiteSpace(input.FREIGHTPAYER), u => u.FREIGHTPAYER.Contains(input.FREIGHTPAYER))
.ToPagedListAsync(input.PageNo, input.PageSize);
return entities.XnPagedResult();
}
/// <summary>
/// 增加订舱主表
/// 增加订舱
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[SqlSugarUnitOfWork]
[HttpPost("/BookingOrder/add")]
public async Task Add(AddBookingOrderInput input)
{
JsonUtil.PropToUpper(input, "ORDNO", "BSSTATUS", "YardContract", "YardContractTel", "YardContractEmail");
JsonUtil.TrimFields(input);
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);
var entity = input.Adapt<BookingOrder>();
entity.Create();
await _rep.InsertAsync(entity);
foreach (var item in input.ctnInputs)
{
var ctnentity=item.Adapt<BookingCtn>();
ctnentity.BILLID = entity.Id;
await _repCtn.InsertAsync(ctnentity);
foreach (var it in item.ctnDetailInputs)
{
var ctndetail=it.Adapt<BookingCtnDetail>();
ctndetail.CTNID = ctnentity.Id;
await _ctndetailrep.InsertAsync(ctndetail);
}
}
}
/// <summary>
/// 删除订舱主表
/// 删除订舱
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[SqlSugarUnitOfWork]
[HttpPost("/BookingOrder/delete")]
public async Task Delete(DeleteBookingOrderInput input)
public async Task Delete(QueryeBookingOrderInput input)
{
var entity = await _rep.FirstOrDefaultAsync(u => u.Id == input.Id);
await _rep.DeleteAsync(entity);
await _rep.UpdateAsync(x=>x.Id==input.Id,x=> new BookingOrder { IsDeleted= true} );
var ctnlist=await _repCtn.AsQueryable().Where(x => x.BILLID == input.Id).Select(x => x.Id).ToListAsync();
await _repCtn.UpdateAsync(x => x.BILLID == input.Id, x => new BookingCtn { IsDeleted = true });
await _ctndetailrep.UpdateAsync(x=>ctnlist.Contains((long)x.CTNID),x=>new BookingCtnDetail { IsDeleted=true});
}
/// <summary>
/// 更新订舱主表
/// 更新订舱
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[SqlSugarUnitOfWork]
[HttpPost("/BookingOrder/edit")]
public async Task Update(UpdateBookingOrderInput input)
{
var entity = input.Adapt<BookingOrder>();
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
var ctnlist = await _repCtn.AsQueryable().Where(x => x.BILLID == input.Id).Select(x => x.Id).ToListAsync();
await _repCtn.DeleteAsync(x => x.BILLID == input.Id);
await _ctndetailrep.DeleteAsync(x => ctnlist.Contains((long)x.CTNID));
foreach (var item in input.ctnInputs)
{
var ctnentity = item.Adapt<BookingCtn>();
ctnentity.BILLID = entity.Id;
await _repCtn.InsertAsync(ctnentity);
foreach (var it in item.ctnDetailInputs)
{
var ctndetail = it.Adapt<BookingCtnDetail>();
ctndetail.CTNID = ctnentity.Id;
await _ctndetailrep.InsertAsync(ctndetail);
}
}
}
/// <summary>
@ -211,40 +261,20 @@ namespace Myshipping.Application
/// <param name="input"></param>
/// <returns></returns>
[HttpGet("/BookingOrder/detail")]
public async Task<BookingOrder> Get([FromQuery] QueryeBookingOrderInput input)
public async Task<BookingOrderOutput> Get([FromQuery] QueryeBookingOrderInput input)
{
return await _rep.FirstOrDefaultAsync(u => u.Id == input.Id);
}
var main = await _rep.FirstOrDefaultAsync(u => u.Id == input.Id);
var list= main.Adapt<BookingOrderOutput>();
/// <summary>
///
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[AllowAnonymous, ApiUser]
[HttpGet("/BookingOrder/updata")]
public async Task<dynamic> Updata()
{
return Task.Run(() =>
{
return $"当前用户:{UserManager.Name} {UserManager.TENANT_ID} {UserManager.CLAINM_TENANT_NAME}";
});
}
[AllowAnonymous, SqlSugarUnitOfWork]
[HttpGet("/BookingOrder/test")]
public async Task<dynamic> Test()
{
var bo = new BookingOrder();
await _rep.InsertAsync(bo);
Log.Information($"ins book id {bo.Id}");
var ctn = new BookingCtn();
ctn.BILLID = bo.Id;
await _repCtn.InsertAsync(ctn);
return await _rep.InsertAsync(new BookingOrder());
return list;
}
}
}

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using Myshipping.Core;
namespace Myshipping.Application
@ -737,6 +738,8 @@ namespace Myshipping.Application
/// 付款方
/// </summary>
public string FREIGHTPAYER { get; set; }
public List<AddBookingCtnInput> ctnInputs { get; set; }
}
}

@ -1,5 +1,6 @@
using Myshipping.Core;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace Myshipping.Application
@ -738,19 +739,19 @@ namespace Myshipping.Application
public class AddBookingOrderInput : BookingOrderDto
{
}
public class DeleteBookingOrderInput
public class QueryeBookingOrderInput
{
/// <summary>
/// 主键
/// </summary>
[Required(ErrorMessage = "主键不能为空")]
public long Id { get; set; }
}
public class UpdateBookingOrderInput : BookingOrderInput
public class UpdateBookingOrderInput : BookingOrderDto
{
/// <summary>
/// 主键
@ -758,10 +759,8 @@ namespace Myshipping.Application
[Required(ErrorMessage = "主键不能为空")]
public long Id { get; set; }
}
public class QueryeBookingOrderInput : DeleteBookingOrderInput
{
}
}

@ -5,737 +5,9 @@ namespace Myshipping.Application
/// <summary>
/// 订舱主表输出参数
/// </summary>
public class BookingOrderOutput
public class BookingOrderOutput:BookingOrderDto
{
/// <summary>
/// 主键
/// </summary>
public long GID { get; set; }
/// <summary>
/// 业务编号
/// </summary>
public string BSNO { get; set; }
/// <summary>
/// 业务状态
/// </summary>
public string BSSTATUS { get; set; }
/// <summary>
/// 业务状态名称
/// </summary>
public string BSSTATUSNAME { get; set; }
/// <summary>
/// 业务日期
/// </summary>
public DateTime BSDATE { get; set; }
/// <summary>
/// 主提单号
/// </summary>
public string MBLNO { get; set; }
/// <summary>
/// 分提单号
/// </summary>
public string HBLNO { get; set; }
/// <summary>
/// 订舱编号
/// </summary>
public string BOOKINGNO { get; set; }
/// <summary>
/// 合约号
/// </summary>
public string CONTRACTNO { get; set; }
/// <summary>
/// 客户合同号
/// </summary>
public string SERVICECONTRACTNO { get; set; }
/// <summary>
/// 发货人代码
/// </summary>
public string SHIPPERID { get; set; }
/// <summary>
/// 收货人代码
/// </summary>
public string CONSIGNEEID { get; set; }
/// <summary>
/// 通知人代码
/// </summary>
public string NOTIFYPARTYID { get; set; }
/// <summary>
/// 发货人
/// </summary>
public string SHIPPER { get; set; }
/// <summary>
/// 收货人
/// </summary>
public string CONSIGNEE { get; set; }
/// <summary>
/// 通知人
/// </summary>
public string NOTIFYPARTY { get; set; }
/// <summary>
/// 第二通知人
/// </summary>
public string NOTIFYPARTY2 { get; set; }
/// <summary>
/// 场站代码
/// </summary>
public string YARDID { get; set; }
/// <summary>
/// 场站
/// </summary>
public string YARD { get; set; }
/// <summary>
/// 船舶呼号
/// </summary>
public string VESSELID { get; set; }
/// <summary>
/// 船名
/// </summary>
public string VESSEL { get; set; }
/// <summary>
/// 海关航次
/// </summary>
public string VOYNO { get; set; }
/// <summary>
/// 内部航次
/// </summary>
public string VOYNOINNER { get; set; }
/// <summary>
/// 开船日期
/// </summary>
public DateTime ETD { get; set; }
/// <summary>
/// 实际开船日期
/// </summary>
public DateTime ATD { get; set; }
/// <summary>
/// 截港日期
/// </summary>
public DateTime CLOSINGDATE { get; set; }
/// <summary>
/// 截单日期
/// </summary>
public DateTime CLOSEDOCDATE { get; set; }
/// <summary>
/// 截VGM时间
/// </summary>
public DateTime CLOSEVGMDATE { get; set; }
/// <summary>
/// 预计到港日期
/// </summary>
public DateTime ETA { get; set; }
/// <summary>
/// 收货地代码
/// </summary>
public string PLACERECEIPTID { get; set; }
/// <summary>
/// 收货地
/// </summary>
public string PLACERECEIPT { get; set; }
/// <summary>
/// 起运港代码
/// </summary>
public string PORTLOADID { get; set; }
/// <summary>
/// 起运港
/// </summary>
public string PORTLOAD { get; set; }
/// <summary>
/// 卸货港代码
/// </summary>
public string PORTDISCHARGEID { get; set; }
/// <summary>
/// 卸货港
/// </summary>
public string PORTDISCHARGE { get; set; }
/// <summary>
/// 交货地代码
/// </summary>
public string PLACEDELIVERYID { get; set; }
/// <summary>
/// 交货地
/// </summary>
public string PLACEDELIVERY { get; set; }
/// <summary>
/// 目的地代码
/// </summary>
public string DESTINATIONID { get; set; }
/// <summary>
/// 目的地
/// </summary>
public string DESTINATION { get; set; }
/// <summary>
/// 提单份数
/// </summary>
public string NOBILL { get; set; }
/// <summary>
/// 副本提单份数
/// </summary>
public string COPYNOBILLL { get; set; }
/// <summary>
/// 签单方式
/// </summary>
public string ISSUETYPE { get; set; }
/// <summary>
/// 签单日期
/// </summary>
public DateTime ISSUEDATE { get; set; }
/// <summary>
/// 签单地点代码
/// </summary>
public string ISSUEPLACEID { get; set; }
/// <summary>
/// 签单地点
/// </summary>
public string ISSUEPLACE { get; set; }
/// <summary>
/// 付费方式
/// </summary>
public string BLFRT { get; set; }
/// <summary>
/// 预付地点
/// </summary>
public string PREPARDAT { get; set; }
/// <summary>
/// 到付地点
/// </summary>
public string PAYABLEAT { get; set; }
/// <summary>
/// 运输条款
/// </summary>
public string SERVICE { get; set; }
/// <summary>
/// 唛头
/// </summary>
public string MARKS { get; set; }
/// <summary>
/// HS代码
/// </summary>
public string HSCODE { get; set; }
/// <summary>
/// 货描
/// </summary>
public string DESCRIPTION { get; set; }
/// <summary>
/// 件数
/// </summary>
public int PKGS { get; set; }
/// <summary>
/// 包装
/// </summary>
public string KINDPKGS { get; set; }
/// <summary>
/// 毛重
/// </summary>
public decimal KGS { get; set; }
/// <summary>
/// 尺码
/// </summary>
public decimal CBM { get; set; }
/// <summary>
/// 件数大写
/// </summary>
public string TOTALNO { get; set; }
/// <summary>
/// 集装箱
/// </summary>
public string CNTRTOTAL { get; set; }
/// <summary>
/// 船公司代号
/// </summary>
public string CARRIERID { get; set; }
/// <summary>
/// 船公司
/// </summary>
public string CARRIER { get; set; }
/// <summary>
/// 货物标识
/// </summary>
public string CARGOID { get; set; }
/// <summary>
/// 危险品类别
/// </summary>
public string DCLASS { get; set; }
/// <summary>
/// 危险品编号
/// </summary>
public string DUNNO { get; set; }
/// <summary>
/// 危险品页号
/// </summary>
public string DPAGE { get; set; }
/// <summary>
/// 危险品标签
/// </summary>
public string DLABEL { get; set; }
/// <summary>
/// 危险品联系人
/// </summary>
public string LINKMAN { get; set; }
/// <summary>
/// 温度单位
/// </summary>
public string TEMPID { get; set; }
/// <summary>
/// 设置温度
/// </summary>
public string TEMPSET { get; set; }
/// <summary>
/// 通风度
/// </summary>
public string REEFERF { get; set; }
/// <summary>
/// 湿度
/// </summary>
public string HUMIDITY { get; set; }
/// <summary>
/// 最低温度
/// </summary>
public string TEMPMIN { get; set; }
/// <summary>
/// 最高温度
/// </summary>
public string TEMPMAX { get; set; }
/// <summary>
/// 是否SOC箱
/// </summary>
public string ISCONTAINERSOC { get; set; }
/// <summary>
/// SO备注
/// </summary>
public string SOREMARK { get; set; }
/// <summary>
/// SI备注
/// </summary>
public string SIREMARK { get; set; }
/// <summary>
/// 场站备注
/// </summary>
public string YARDREMARK { get; set; }
/// <summary>
/// 公司ID
/// </summary>
public string COMPID { get; set; }
/// <summary>
/// 公司名称
/// </summary>
public string COMPNAME { get; set; }
/// <summary>
/// 发货人名称
/// </summary>
public string SHIPPERNAME { get; set; }
/// <summary>
/// 发货人地址1
/// </summary>
public string SHIPPERADDR1 { get; set; }
/// <summary>
/// 发货人地址2
/// </summary>
public string SHIPPERADDR2 { get; set; }
/// <summary>
/// 发货人地址3
/// </summary>
public string SHIPPERADDR3 { get; set; }
/// <summary>
/// 发货人城市
/// </summary>
public string SHIPPERCITY { get; set; }
/// <summary>
/// 发货人省份代码
/// </summary>
public string SHIPPERPROVINCE { get; set; }
/// <summary>
/// 发货人邮编
/// </summary>
public string SHIPPERPOSTCODE { get; set; }
/// <summary>
/// 发货人国家代码
/// </summary>
public string SHIPPERCOUNTRY { get; set; }
/// <summary>
/// 发货人联系人
/// </summary>
public string SHIPPERATTN { get; set; }
/// <summary>
/// 发货人电话
/// </summary>
public string SHIPPERTEL { get; set; }
/// <summary>
/// 发货人名称
/// </summary>
public string CONSIGNEENAME { get; set; }
/// <summary>
/// 发货人地址1
/// </summary>
public string CONSIGNEEADDR1 { get; set; }
/// <summary>
/// 发货人地址2
/// </summary>
public string CONSIGNEEADDR2 { get; set; }
/// <summary>
/// 发货人地址3
/// </summary>
public string CONSIGNEEADDR3 { get; set; }
/// <summary>
/// 发货人城市
/// </summary>
public string CONSIGNEECITY { get; set; }
/// <summary>
/// 发货人省份代码
/// </summary>
public string CONSIGNEEPROVINCE { get; set; }
/// <summary>
/// 发货人邮编
/// </summary>
public string CONSIGNEEPOSTCODE { get; set; }
/// <summary>
/// 发货人国家代码
/// </summary>
public string CONSIGNEERCOUNTRY { get; set; }
/// <summary>
/// 发货人联系人
/// </summary>
public string CONSIGNEEATTN { get; set; }
/// <summary>
/// 发货人电话
/// </summary>
public string CONSIGNEETEL { get; set; }
/// <summary>
/// 通知人名称
/// </summary>
public string NOTIFYPARTYNAME { get; set; }
/// <summary>
/// 通知人地址1
/// </summary>
public string NOTIFYPARTYADDR1 { get; set; }
/// <summary>
/// 通知人地址2
/// </summary>
public string NOTIFYPARTYADDR2 { get; set; }
/// <summary>
/// 通知人地址3
/// </summary>
public string NOTIFYPARTYADDR3 { get; set; }
/// <summary>
/// 通知人城市
/// </summary>
public string NOTIFYPARTYCITY { get; set; }
/// <summary>
/// 通知人省份代码
/// </summary>
public string NOTIFYPARTYPROVINCE { get; set; }
/// <summary>
/// 通知人邮编
/// </summary>
public string NOTIFYPARTYPOSTCODE { get; set; }
/// <summary>
/// 通知人国家代码
/// </summary>
public string NOTIFYPARTYCOUNTRY { get; set; }
/// <summary>
/// 通知人联系人
/// </summary>
public string NOTIFYPARTYATTN { get; set; }
/// <summary>
/// 通知人电话
/// </summary>
public string NOTIFYPARTYTEL { get; set; }
/// <summary>
/// PO号
/// </summary>
public string PONO { get; set; }
/// <summary>
/// 操作id
/// </summary>
public string OPID { get; set; }
/// <summary>
/// 单证id
/// </summary>
public string DOCID { get; set; }
/// <summary>
/// 操作
/// </summary>
public string OP { get; set; }
/// <summary>
/// 单证
/// </summary>
public string DOC { get; set; }
/// <summary>
/// 销售ID
/// </summary>
public string SALEID { get; set; }
/// <summary>
/// 销售
/// </summary>
public string SALE { get; set; }
/// <summary>
/// 客服ID
/// </summary>
public string CUSTSERVICEID { get; set; }
/// <summary>
/// 客服
/// </summary>
public string CUSTSERVICE { get; set; }
/// <summary>
/// 客户
/// </summary>
public string CUSTOMERNAME { get; set; }
/// <summary>
/// 订舱代理
/// </summary>
public string FORWARDER { get; set; }
/// <summary>
/// 船代
/// </summary>
public string SHIPAGENCY { get; set; }
/// <summary>
/// 报关行
/// </summary>
public string CUSTOMSER { get; set; }
/// <summary>
/// 车队
/// </summary>
public string TRUCKER { get; set; }
/// <summary>
/// 国外代理
/// </summary>
public string AGENTID { get; set; }
/// <summary>
/// 客户代号
/// </summary>
public string CUSTOMERID { get; set; }
/// <summary>
/// 订舱代理ID
/// </summary>
public string FORWARDERID { get; set; }
/// <summary>
/// 船代ID
/// </summary>
public string SHIPAGENCYID { get; set; }
/// <summary>
/// 报关行ID
/// </summary>
public string CUSTOMSERID { get; set; }
/// <summary>
/// 车队ID
/// </summary>
public string TRUCKERID { get; set; }
/// <summary>
/// 国外代理名称
/// </summary>
public string AGENTNAME { get; set; }
/// <summary>
/// 委托方
/// </summary>
public string WEITUO { get; set; }
/// <summary>
/// 收货人DOOR地址
/// </summary>
public string CONSIGNEEDOORADDR { get; set; }
/// <summary>
/// 发货人DOOR地址
/// </summary>
public string SHIPPERDOORADDR { get; set; }
/// <summary>
/// SCAC代码
/// </summary>
public string SCACCODE { get; set; }
/// <summary>
/// ITN编号
/// </summary>
public string ITNCODE { get; set; }
/// <summary>
/// 预付地点ID
/// </summary>
public string PREPARDATID { get; set; }
/// <summary>
/// 到付地点ID
/// </summary>
public string PAYABLEATID { get; set; }
/// <summary>
/// 客户系统编号
/// </summary>
public string CUSTNO { get; set; }
/// <summary>
/// 中转港代码
/// </summary>
public string TRANSPORTID { get; set; }
/// <summary>
/// 中转港
/// </summary>
public string TRANSPORT { get; set; }
/// <summary>
/// 第三付款地
/// </summary>
public string THIRDPAYADDR { get; set; }
/// <summary>
/// 场站联系人电话
/// </summary>
public string YARDCONTRACTTEL { get; set; }
/// <summary>
/// 场站联系人邮箱
/// </summary>
public string YARDCONTRACTEMAIL { get; set; }
/// <summary>
/// 费用自结
/// </summary>
public bool FEESELF { get; set; }
/// <summary>
/// 航线代码
/// </summary>
public string LANECODE { get; set; }
/// <summary>
/// 航线名称
/// </summary>
public string LANENAME { get; set; }
/// <summary>
/// 付款方
/// </summary>
public string FREIGHTPAYER { get; set; }
}
}

@ -1,5 +1,8 @@

using Furion;
using SqlSugar;
using System;
using Yitter.IdGenerator;
namespace Myshipping.Core.Entity;
@ -14,24 +17,7 @@ public abstract class DBEntityTenant : DEntityBase
[SugarColumn(ColumnDescription = "租户id")]
public virtual long? TenantId { get; set; }
//public override void Create() {
// var userId = App.User.FindFirst(ClaimConst.CLAINM_USERID)?.Value;
// var userName = App.User.FindFirst(ClaimConst.CLAINM_ACCOUNT)?.Value;
// var tenantId = App.User.FindFirst(ClaimConst.TENANT_ID)?.Value;
// this.Id = YitIdHelper.NextId();
// this.CreatedTime = DateTime.Now;
// if (!string.IsNullOrEmpty(userId))
// {
// this.CreatedUserId = long.Parse(userId);
// this.CreatedUserName = userName;
// }
// if (!string.IsNullOrWhiteSpace(tenantId)) {
// this.TenantId = long.Parse(tenantId);
// }
//}
//public void CreateNotFillTenantInfo() {
// base.Create();
//}
}

@ -1,6 +1,8 @@
using SqlSugar;
using Furion;
using SqlSugar;
using System;
using System.ComponentModel.DataAnnotations;
using Yitter.IdGenerator;
namespace Myshipping.Core.Entity;
@ -55,30 +57,30 @@ public abstract class DEntityBase : PrimaryKeyEntity
public virtual bool IsDeleted { get; set; } = false;
//public virtual void Create()
//{
// var userId = App.User.FindFirst(ClaimConst.CLAINM_USERID)?.Value;
// var userName = App.User.FindFirst(ClaimConst.CLAINM_ACCOUNT)?.Value;
// Id = YitIdHelper.NextId();
// CreatedTime = DateTime.Now;
// if (!string.IsNullOrEmpty(userId))
// {
// CreatedUserId = long.Parse(userId);
// CreatedUserName = userName;
// }
//}
public virtual void Create()
{
var userId = App.User.FindFirst(ClaimConst.CLAINM_USERID)?.Value;
var userName = App.User.FindFirst(ClaimConst.CLAINM_ACCOUNT)?.Value;
Id = YitIdHelper.NextId();
CreatedTime = DateTime.Now;
if (!string.IsNullOrEmpty(userId))
{
CreatedUserId = long.Parse(userId);
CreatedUserName = userName;
}
}
//public void Modify()
//{
// var userId = App.User.FindFirst(ClaimConst.CLAINM_USERID)?.Value;
// var userName = App.User.FindFirst(ClaimConst.CLAINM_ACCOUNT)?.Value;
// UpdatedTime = DateTime.Now;
// if (!string.IsNullOrEmpty(userId))
// {
// UpdatedUserId = long.Parse(userId);
// UpdatedUserName = userName;
// }
//}
public void Modify()
{
var userId = App.User.FindFirst(ClaimConst.CLAINM_USERID)?.Value;
var userName = App.User.FindFirst(ClaimConst.CLAINM_ACCOUNT)?.Value;
UpdatedTime = DateTime.Now;
if (!string.IsNullOrEmpty(userId))
{
UpdatedUserId = long.Parse(userId);
UpdatedUserName = userName;
}
}
/// <summary>
/// 更新信息列

@ -1,5 +1,7 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Furion.JsonSerialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
@ -111,4 +113,92 @@ public static class JsonUtil
}
}
/// <summary>
/// 处理输入的数据,变为大写,全角改为半角
/// </summary>
/// <param name="model">数据对象</param>
/// <param name="excepProp">不需要转大写的字段</param>
public static void PropToUpper(object model, params string[] excepProp)
{
var props = model.GetType().GetProperties();
foreach (PropertyInfo prop in props)
{
var propName = prop.Name;
if (excepProp != null && excepProp.Length > 0)
{
if (!excepProp.Contains(propName))
{
if (prop.PropertyType == typeof(string))
{
object sourceVal = prop.GetValue(model);
if (sourceVal != null)
{
prop.SetValue(model, ToDBC(sourceVal.ToString().ToUpper()));
}
}
}
}
}
}
public static string ToDBC(string input)
{
char[] c = input.ToCharArray();
for (int i = 0; i < c.Length; i++)
{
if (c[i] == 12288)
{
c[i] = (char)32;
continue;
}
if (c[i] > 65280 && c[i] < 65375)
c[i] = (char)(c[i] - 65248);
}
return new string(c);
}
/// <summary>
/// 处理所有时间字段将Datetime.Min设置为null
/// </summary>
/// <param name="model"></param>
public static void MinDateToNull(object model)
{
var props = model.GetType().GetProperties();
foreach (PropertyInfo prop in props)
{
if (prop.PropertyType == typeof(DateTime?))
{
DateTime? sourceVal = (DateTime?)prop.GetValue(model);
if (sourceVal != null && sourceVal.HasValue && sourceVal.Value == DateTime.MinValue)
{
prop.SetValue(model, null);
}
}
}
}
/// <summary>
/// 去空格
/// </summary>
public static void TrimFields(object model)
{
var props = model.GetType().GetProperties();
foreach (PropertyInfo prop in props)
{
var propName = prop.Name;
if (prop.PropertyType == typeof(string))
{
object sourceVal = prop.GetValue(model);
if (sourceVal != null)
{
prop.SetValue(model, ToDBC(sourceVal.ToString().Trim()));
}
}
}
}
}

Loading…
Cancel
Save