jianghaiqing 2 years ago
commit 6d070833ad

@ -152,9 +152,13 @@ namespace Myshipping.Application
public async Task<dynamic> Page([FromQuery] BookingOrderInput input) public async Task<dynamic> Page([FromQuery] BookingOrderInput input)
{ {
List<long> userlist = await _right.GetDataScopeList(351064299098181); List<long> userlist = await _right.GetDataScopeList(351064299098181);
var 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();
//List<long> userlist = await DataFilterExtensions.GetDataScopeIdList(); //List<long> userlist = await DataFilterExtensions.GetDataScopeIdList();
var entities = await _rep.AsQueryable(). var entities = await _rep.AsQueryable().
WhereIF(string.IsNullOrWhiteSpace(input.HBLNO), x => x.ParentId == 0|| x.ParentId==null) WhereIF(string.IsNullOrWhiteSpace(input.HBLNO), 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.BSNO), u => u.BSNO.Contains(input.BSNO))
.WhereIF(!string.IsNullOrWhiteSpace(input.BSSTATUS), u => u.BSSTATUS == input.BSSTATUS) .WhereIF(!string.IsNullOrWhiteSpace(input.BSSTATUS), u => u.BSSTATUS == input.BSSTATUS)
.WhereIF(input.BBSDATE != null, u => u.BSDATE >= input.BBSDATE) .WhereIF(input.BBSDATE != null, u => u.BSDATE >= input.BBSDATE)
@ -213,7 +217,7 @@ namespace Myshipping.Application
.WhereIF(!string.IsNullOrWhiteSpace(input.HSCODE), u => u.HSCODE.Contains(input.HSCODE)) .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.DESCRIPTION), u => u.DESCRIPTION.Contains(input.DESCRIPTION))
.WhereIF(!string.IsNullOrWhiteSpace(input.KINDPKGS), u => u.KINDPKGS == input.KINDPKGS) .WhereIF(!string.IsNullOrWhiteSpace(input.KINDPKGS), u => u.KINDPKGS == input.KINDPKGS)
.WhereIF(!string.IsNullOrWhiteSpace(input.CNTRTOTAL), u => u.CNTRTOTAL == input.CNTRTOTAL) .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.CARRIERID), u => u.CARRIERID == input.CARRIERID)
.WhereIF(!string.IsNullOrWhiteSpace(input.CARRIER), u => u.CARRIER.Contains(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.CARGOID), u => u.CARGOID == input.CARGOID)
@ -272,7 +276,6 @@ namespace Myshipping.Application
.WhereIF(!string.IsNullOrWhiteSpace(input.FORWARDER), u => u.FORWARDER == input.FORWARDER) .WhereIF(!string.IsNullOrWhiteSpace(input.FORWARDER), u => u.FORWARDER == input.FORWARDER)
.WhereIF(!string.IsNullOrWhiteSpace(input.SHIPAGENCY), u => u.SHIPAGENCY == input.SHIPAGENCY) .WhereIF(!string.IsNullOrWhiteSpace(input.SHIPAGENCY), u => u.SHIPAGENCY == input.SHIPAGENCY)
.WhereIF(!string.IsNullOrWhiteSpace(input.CUSTOMSER), u => u.CUSTOMSER == input.CUSTOMSER) .WhereIF(!string.IsNullOrWhiteSpace(input.CUSTOMSER), u => u.CUSTOMSER == input.CUSTOMSER)
.WhereIF(!string.IsNullOrWhiteSpace(input.TRUCKER), u => u.TRUCKER == input.TRUCKER)
.WhereIF(!string.IsNullOrWhiteSpace(input.AGENTID), u => u.AGENTID == input.AGENTID) .WhereIF(!string.IsNullOrWhiteSpace(input.AGENTID), u => u.AGENTID == input.AGENTID)
.WhereIF(!string.IsNullOrWhiteSpace(input.FORWARDERID), u => u.FORWARDERID == input.FORWARDERID) .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.SHIPAGENCY), u => u.SHIPAGENCY.Contains(input.SHIPAGENCY))
@ -293,6 +296,9 @@ namespace Myshipping.Application
.WhereIF(!string.IsNullOrWhiteSpace(input.YARDCONTRACTEMAIL), u => u.YARDCONTRACTEMAIL == input.YARDCONTRACTEMAIL) .WhereIF(!string.IsNullOrWhiteSpace(input.YARDCONTRACTEMAIL), u => u.YARDCONTRACTEMAIL == input.YARDCONTRACTEMAIL)
.WhereIF(!string.IsNullOrWhiteSpace(input.LANECODE), u => u.LANECODE == input.LANECODE) .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.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.CreatedUserName), u => u.CreatedUserName.Contains(input.CreatedUserName))
.WhereIF(!string.IsNullOrWhiteSpace(input.FREIGHTPAYER), u => u.FREIGHTPAYER.Contains(input.FREIGHTPAYER)) .WhereIF(!string.IsNullOrWhiteSpace(input.FREIGHTPAYER), u => u.FREIGHTPAYER.Contains(input.FREIGHTPAYER))
.WhereIF(userlist != null && userlist.Count() > 0, u => userlist.Contains((long)u.CreatedUserId)||UserManager.UserId.ToString()==u.ROUTEID|| UserManager.UserId.ToString()==u.SALEID || UserManager.UserId.ToString() == u.OPID|| UserManager.UserId.ToString() == u.DOCID|| UserManager.UserId.ToString() == u.CUSTSERVICEID) .WhereIF(userlist != null && userlist.Count() > 0, u => userlist.Contains((long)u.CreatedUserId)||UserManager.UserId.ToString()==u.ROUTEID|| UserManager.UserId.ToString()==u.SALEID || UserManager.UserId.ToString() == u.OPID|| UserManager.UserId.ToString() == u.DOCID|| UserManager.UserId.ToString() == u.CUSTSERVICEID)
.OrderBy(PageInputOrder.OrderBuilder(input.SortField, input.descSort)) .OrderBy(PageInputOrder.OrderBuilder(input.SortField, input.descSort))
@ -349,28 +355,28 @@ namespace Myshipping.Application
public async Task<long> Add(BookingOrderDto input) public async Task<long> Add(BookingOrderDto input)
{ {
if (input.ParentId == 0) //if (input.ParentId == 0)
{
//if (!string.IsNullOrWhiteSpace(input.HBLNO))
//{ //{
// throw Oops.Bah("主单不需要填写分单号"); // //if (!string.IsNullOrWhiteSpace(input.HBLNO))
// //{
// // throw Oops.Bah("主单不需要填写分单号");
// //}
// if (string.IsNullOrWhiteSpace(input.MBLNO))
// {
// throw Oops.Bah("请填写提单号!");
// }
//}
//else
//{
// if (string.IsNullOrWhiteSpace(input.MBLNO))
// {
// throw Oops.Bah("请填写主提单号");
// }
// if (string.IsNullOrWhiteSpace(input.HBLNO))
// {
// throw Oops.Bah("请填写分提单号");
// }
//} //}
if (string.IsNullOrWhiteSpace(input.MBLNO))
{
throw Oops.Bah("请填写提单号!");
}
}
else
{
if (string.IsNullOrWhiteSpace(input.MBLNO))
{
throw Oops.Bah("请填写主提单号");
}
if (string.IsNullOrWhiteSpace(input.HBLNO))
{
throw Oops.Bah("请填写分提单号");
}
}
JsonUtil.PropToUpper(input, "ORDNO", "BSSTATUS", "YardContract", "YardContractTel", "YardContractEmail", "MARKS", "DESCRIPTION", "CONSIGNEENAME", "SHIPPERNAME", "NOTIFYPARTYNAME"); JsonUtil.PropToUpper(input, "ORDNO", "BSSTATUS", "YardContract", "YardContractTel", "YardContractEmail", "MARKS", "DESCRIPTION", "CONSIGNEENAME", "SHIPPERNAME", "NOTIFYPARTYNAME");
@ -380,6 +386,7 @@ namespace Myshipping.Application
var groupList = input.ctnInputs.Where(x => x.CTNNUM > 0).GroupBy(c => c.CTNALL).Select(g => $"{g.Key}*{g.Sum(gg => gg.CTNNUM)}"); 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); input.CNTRTOTAL = string.Join(" / ", groupList);
} }
if (!string.IsNullOrWhiteSpace(input.MBLNO)) {
var et = await _rep.Where(x => x.MBLNO == input.MBLNO && x.TenantId == UserManager.TENANT_ID && x.HBLNO == input.HBLNO && x.ParentId == input.ParentId).FirstAsync(); var et = await _rep.Where(x => x.MBLNO == input.MBLNO && x.TenantId == UserManager.TENANT_ID && x.HBLNO == input.HBLNO && x.ParentId == input.ParentId).FirstAsync();
if (et != null) if (et != null)
{ {
@ -387,6 +394,8 @@ namespace Myshipping.Application
throw Oops.Bah("当前提单号已存在,请勿重复录入!"); throw Oops.Bah("当前提单号已存在,请勿重复录入!");
} }
}
var entity = input.Adapt<BookingOrder>(); var entity = input.Adapt<BookingOrder>();
//entity.TOTALNO = NumberToUpper.ToUpper(entity.PKGS == null ? 0 : entity.PKGS); //entity.TOTALNO = NumberToUpper.ToUpper(entity.PKGS == null ? 0 : entity.PKGS);
await _rep.InsertAsync(entity); await _rep.InsertAsync(entity);
@ -464,28 +473,28 @@ namespace Myshipping.Application
[HttpPost("/BookingOrder/Update")] [HttpPost("/BookingOrder/Update")]
public async Task Update(BookingOrderDto input) public async Task Update(BookingOrderDto input)
{ {
if (input.ParentId == 0) //if (input.ParentId == 0)
{
//if (!string.IsNullOrWhiteSpace(input.HBLNO))
//{ //{
// throw Oops.Bah("主单不需要填写分单号"); // //if (!string.IsNullOrWhiteSpace(input.HBLNO))
// //{
// // throw Oops.Bah("主单不需要填写分单号");
// //}
// if (string.IsNullOrWhiteSpace(input.MBLNO))
// {
// throw Oops.Bah("请填写提单号!");
// }
//}
//else
//{
// if (string.IsNullOrWhiteSpace(input.MBLNO))
// {
// throw Oops.Bah("请填写主提单号");
// }
// if (string.IsNullOrWhiteSpace(input.HBLNO))
// {
// throw Oops.Bah("请填写分提单号");
// }
//} //}
if (string.IsNullOrWhiteSpace(input.MBLNO))
{
throw Oops.Bah("请填写提单号!");
}
}
else
{
if (string.IsNullOrWhiteSpace(input.MBLNO))
{
throw Oops.Bah("请填写主提单号");
}
if (string.IsNullOrWhiteSpace(input.HBLNO))
{
throw Oops.Bah("请填写分提单号");
}
}
JsonUtil.PropToUpper(input, "ORDNO", "BSSTATUS", "YardContract", "YardContractTel", "YardContractEmail", "MARKS", "DESCRIPTION", "CONSIGNEENAME", "SHIPPERNAME", "NOTIFYPARTYNAME"); JsonUtil.PropToUpper(input, "ORDNO", "BSSTATUS", "YardContract", "YardContractTel", "YardContractEmail", "MARKS", "DESCRIPTION", "CONSIGNEENAME", "SHIPPERNAME", "NOTIFYPARTYNAME");
JsonUtil.TrimFields(input); JsonUtil.TrimFields(input);
if (input.ctnInputs != null) if (input.ctnInputs != null)
@ -495,6 +504,7 @@ namespace Myshipping.Application
} }
var main = await _rep.AsQueryable().Filter(null, true).Where(x => x.Id == input.Id).FirstAsync(); var main = await _rep.AsQueryable().Filter(null, true).Where(x => x.Id == input.Id).FirstAsync();
if (!string.IsNullOrWhiteSpace(input.MBLNO)) {
var et = await _rep.Where(x => x.MBLNO == input.MBLNO && x.TenantId == UserManager.TENANT_ID && x.HBLNO == input.HBLNO && x.ParentId == input.ParentId && x.Id != input.Id).FirstAsync(); var et = await _rep.Where(x => x.MBLNO == input.MBLNO && x.TenantId == UserManager.TENANT_ID && x.HBLNO == input.HBLNO && x.ParentId == input.ParentId && x.Id != input.Id).FirstAsync();
if (et != null) if (et != null)
{ {
@ -502,6 +512,8 @@ namespace Myshipping.Application
throw Oops.Bah("当前提单号已存在,请勿重复录入!"); throw Oops.Bah("当前提单号已存在,请勿重复录入!");
} }
}
var entity = input.Adapt<BookingOrder>(); var entity = input.Adapt<BookingOrder>();
//entity.TOTALNO = NumberToUpper.ToUpper(entity.PKGS == null ? 0 : entity.PKGS); //entity.TOTALNO = NumberToUpper.ToUpper(entity.PKGS == null ? 0 : entity.PKGS);

@ -766,6 +766,19 @@ namespace Myshipping.Application
/// </summary> /// </summary>
public string ROUTE { get; set; } public string ROUTE { get; set; }
/// <summary>
/// 录入人
/// </summary>
public string CreatedUserName { get; set; }
/// <summary>
/// 封号
/// </summary>
public string SEALNO { get; set; }
/// <summary>
/// 箱号
/// </summary>
public string CNTRNO { get; set; }
} }
public class AddBookingOrderInput : BookingOrderDto public class AddBookingOrderInput : BookingOrderDto

Loading…
Cancel
Save