jianghaiqing 2 years ago
commit 6d070833ad

@ -152,9 +152,13 @@ namespace Myshipping.Application
public async Task<dynamic> Page([FromQuery] BookingOrderInput input)
{
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();
var entities = await _rep.AsQueryable().
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.BSSTATUS), u => u.BSSTATUS == input.BSSTATUS)
.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.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.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)
@ -272,7 +276,6 @@ namespace Myshipping.Application
.WhereIF(!string.IsNullOrWhiteSpace(input.FORWARDER), u => u.FORWARDER == input.FORWARDER)
.WhereIF(!string.IsNullOrWhiteSpace(input.SHIPAGENCY), u => u.SHIPAGENCY == input.SHIPAGENCY)
.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.FORWARDERID), u => u.FORWARDERID == input.FORWARDERID)
.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.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.CreatedUserName), u => u.CreatedUserName.Contains(input.CreatedUserName))
.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)
.OrderBy(PageInputOrder.OrderBuilder(input.SortField, input.descSort))
@ -349,28 +355,28 @@ namespace Myshipping.Application
public async Task<long> Add(BookingOrderDto input)
{
if (input.ParentId == 0)
{
//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 (input.ParentId == 0)
//{
// //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");
@ -380,13 +386,16 @@ 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)}");
input.CNTRTOTAL = string.Join(" / ", groupList);
}
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 (!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();
if (et != null)
{
throw Oops.Bah("当前提单号已存在,请勿重复录入!");
throw Oops.Bah("当前提单号已存在,请勿重复录入!");
}
}
var entity = input.Adapt<BookingOrder>();
//entity.TOTALNO = NumberToUpper.ToUpper(entity.PKGS == null ? 0 : entity.PKGS);
await _rep.InsertAsync(entity);
@ -464,28 +473,28 @@ namespace Myshipping.Application
[HttpPost("/BookingOrder/Update")]
public async Task Update(BookingOrderDto input)
{
if (input.ParentId == 0)
{
//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 (input.ParentId == 0)
//{
// //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.TrimFields(input);
if (input.ctnInputs != null)
@ -495,13 +504,16 @@ namespace Myshipping.Application
}
var main = await _rep.AsQueryable().Filter(null, true).Where(x => 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 (!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();
if (et != null)
{
throw Oops.Bah("当前提单号已存在,请勿重复录入!");
throw Oops.Bah("当前提单号已存在,请勿重复录入!");
}
}
var entity = input.Adapt<BookingOrder>();
//entity.TOTALNO = NumberToUpper.ToUpper(entity.PKGS == null ? 0 : entity.PKGS);

@ -766,6 +766,19 @@ namespace Myshipping.Application
/// </summary>
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

Loading…
Cancel
Save