|
|
|
@ -273,6 +273,13 @@ namespace EntrustSettle.Api.Controllers
|
|
|
|
|
inputDto.MblnoList = inputDto.MblnoList.Where(x => !string.IsNullOrWhiteSpace(x)).Select(x => x.Trim()).ToArray();
|
|
|
|
|
StringHelper.TrimStringProperties(inputDto);
|
|
|
|
|
|
|
|
|
|
// 提单号校验重复
|
|
|
|
|
var existsMblnoList = await orderService.Query(x => inputDto.MblnoList.Contains(x.Mblno), x => x.Mblno);
|
|
|
|
|
if (existsMblnoList.Any())
|
|
|
|
|
{
|
|
|
|
|
throw new Exception($"下列提单号已存在,无需重复下单:{string.Join("、", existsMblnoList)}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 查询税号
|
|
|
|
|
var custBalanceService = App.GetService<IBaseServices<CompanyNew>>();
|
|
|
|
|
var taxCode = await custBalanceService.Db.Queryable<CompanyNew>().Where(x => x.CompId == inputDto.CompanyId).Select(x => x.TaxCode).FirstAsync();
|
|
|
|
@ -281,27 +288,32 @@ namespace EntrustSettle.Api.Controllers
|
|
|
|
|
var billtraceList = new List<OpSeaiBillTrace>(inputDto.MblnoList.Length);
|
|
|
|
|
foreach (var item in inputDto.MblnoList)
|
|
|
|
|
{
|
|
|
|
|
var billtrace = new OpSeaiBillTrace
|
|
|
|
|
var billtraceGid = await billtraceService.QueryFirst(x => x.MBLNO == item && x.CompID == inputDto.CompanyId && x.IsOuter, x => x.GID);
|
|
|
|
|
if (billtraceGid == null)
|
|
|
|
|
{
|
|
|
|
|
GID = Guid.NewGuid().ToString(),
|
|
|
|
|
UserID = App.User.ID,
|
|
|
|
|
UserName = App.User.Name,
|
|
|
|
|
CompID = inputDto.CompanyId,
|
|
|
|
|
CompName = inputDto.CompanyName,
|
|
|
|
|
MBLNO = item,
|
|
|
|
|
StaCangDan = "N",
|
|
|
|
|
StaHaiGuan = "N",
|
|
|
|
|
StaTiHuo = "N",
|
|
|
|
|
StaFanKong = "N",
|
|
|
|
|
IsOuter = true,
|
|
|
|
|
CreateTime = DateTime.Now
|
|
|
|
|
};
|
|
|
|
|
billtraceList.Add(billtrace);
|
|
|
|
|
billtraceGid = Guid.NewGuid().ToString();
|
|
|
|
|
var billtrace = new OpSeaiBillTrace
|
|
|
|
|
{
|
|
|
|
|
GID = billtraceGid,
|
|
|
|
|
UserID = App.User.ID,
|
|
|
|
|
UserName = App.User.Name,
|
|
|
|
|
CompID = inputDto.CompanyId,
|
|
|
|
|
CompName = inputDto.CompanyName,
|
|
|
|
|
MBLNO = item,
|
|
|
|
|
StaCangDan = "N",
|
|
|
|
|
StaHaiGuan = "N",
|
|
|
|
|
StaTiHuo = "N",
|
|
|
|
|
StaFanKong = "N",
|
|
|
|
|
IsOuter = true,
|
|
|
|
|
CreateTime = DateTime.Now
|
|
|
|
|
};
|
|
|
|
|
billtraceList.Add(billtrace);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var order = new Order
|
|
|
|
|
{
|
|
|
|
|
Mblno = item,
|
|
|
|
|
BilltraceGid = billtrace.GID,
|
|
|
|
|
BilltraceGid = billtraceGid,
|
|
|
|
|
CompanyId = inputDto.CompanyId,
|
|
|
|
|
CompanyName = inputDto.CompanyName,
|
|
|
|
|
TaxCode = taxCode,
|
|
|
|
@ -360,7 +372,7 @@ namespace EntrustSettle.Api.Controllers
|
|
|
|
|
unitOfWorkManage.CommitTran();
|
|
|
|
|
|
|
|
|
|
// 保存到运踪表中
|
|
|
|
|
await billtraceService.Add(billtraceList);
|
|
|
|
|
await billtraceService.AsInsertable(billtraceList).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
// 查询所有待处理订单列表
|
|
|
|
|
var pendingOrderList = await orderService.Query(x => x.IsSend == false && orderIdList.Contains(x.Id));
|
|
|
|
|