optimize
wet 1 year ago
parent ac9dd0f443
commit b2c770f081

@ -130,7 +130,7 @@ namespace Myshipping.Application
private readonly SqlSugarRepository<BookingLineOpMgrConfig> _repLineOpMgrConfig; private readonly SqlSugarRepository<BookingLineOpMgrConfig> _repLineOpMgrConfig;
private readonly SqlSugarRepository<SysEmp> _repSysEmp; private readonly SqlSugarRepository<SysEmp> _repSysEmp;
private readonly SqlSugarRepository<Booking_AutoYardImport> _repAutoYard; private readonly SqlSugarRepository<Booking_AutoYardImport> _repAutoYard;
private readonly SqlSugarRepository<BookingExtendState> _repextendstate;
const string CONST_MAPPING_MODULE = "BOOK_OR_CLOSING"; const string CONST_MAPPING_MODULE = "BOOK_OR_CLOSING";
const string CONST_MAPPING_MODULE_ROUTE = "BOOK_OR_CLOSING_RT"; const string CONST_MAPPING_MODULE_ROUTE = "BOOK_OR_CLOSING_RT";
@ -145,7 +145,7 @@ namespace Myshipping.Application
SqlSugarRepository<BookingLog> bookinglog, SqlSugarRepository<BookingLogDetail> bookinglogdetail, SqlSugarRepository<BookingRemark> bookingremark, SqlSugarRepository<BookingLog> bookinglog, SqlSugarRepository<BookingLogDetail> bookinglogdetail, SqlSugarRepository<BookingRemark> bookingremark,
SqlSugarRepository<BookingFile> bookingfile, SqlSugarRepository<DjyUserConfig> repUserConfig, SqlSugarRepository<BookingPrintTemplate> repPrint, SqlSugarRepository<BookingFile> bookingfile, SqlSugarRepository<DjyUserConfig> repUserConfig, SqlSugarRepository<BookingPrintTemplate> repPrint,
SqlSugarRepository<SysDictData> dicdata, SqlSugarRepository<BookingStatusLog> statuslog, SqlSugarRepository<BookingStatusLogDetail> statuslogdetail, SqlSugarRepository<SysDictData> dicdata, SqlSugarRepository<BookingStatusLog> statuslog, SqlSugarRepository<BookingStatusLogDetail> statuslogdetail,
SqlSugarRepository<BookingTemplateShare> repPrintTemplateShare, SqlSugarRepository<DjyVesselInfo> vesselInfo, SqlSugarRepository<BookingTemplateShare> repPrintTemplateShare, SqlSugarRepository<DjyVesselInfo> vesselInfo, SqlSugarRepository<BookingExtendState> repextendstate,
ILogger<BookingOrderService> logger, ISysCacheService cache, IDjyWebsiteAccountConfigService webAccountConfig, ISysDataUserMenu right, SqlSugarRepository<ParaGoodsInfo> paraGoodsInfoRepository, ILogger<BookingOrderService> logger, ISysCacheService cache, IDjyWebsiteAccountConfigService webAccountConfig, ISysDataUserMenu right, SqlSugarRepository<ParaGoodsInfo> paraGoodsInfoRepository,
SqlSugarRepository<BookingPrintTemplate> repPrintTemplate, SqlSugarRepository<BookingLetteryard> repLetterYard, SqlSugarRepository<SysUser> repUser, SqlSugarRepository<BookingTemplate> bookingTemplate, SqlSugarRepository<BookingPrintTemplate> repPrintTemplate, SqlSugarRepository<BookingLetteryard> repLetterYard, SqlSugarRepository<SysUser> repUser, SqlSugarRepository<BookingTemplate> bookingTemplate,
SqlSugarRepository<BookingOrderUrl> repOrderUrl, SqlSugarRepository<BookingOrderContact> repOrderContact, SqlSugarRepository<BookingSampleBill> repSampleBill, SqlSugarRepository<DjyCustomer> djycustomer, SqlSugarRepository<BookingOrderUrl> repOrderUrl, SqlSugarRepository<BookingOrderContact> repOrderContact, SqlSugarRepository<BookingSampleBill> repSampleBill, SqlSugarRepository<DjyCustomer> djycustomer,
@ -198,6 +198,7 @@ namespace Myshipping.Application
this._repLineOpMgrConfig = repLineOpMgrConfig; this._repLineOpMgrConfig = repLineOpMgrConfig;
this._repSysEmp = repSysEmp; this._repSysEmp = repSysEmp;
this._repAutoYard = repAutoYard; this._repAutoYard = repAutoYard;
this._repextendstate = repextendstate;
} }
#region 主表和箱信息 #region 主表和箱信息
@ -1341,11 +1342,15 @@ namespace Myshipping.Application
{ {
long Id = Convert.ToInt64(ar); long Id = Convert.ToInt64(ar);
var order = _rep.AsQueryable().Filter(null, true).Where(x => x.Id == Id).First(); var order = _rep.AsQueryable().Filter(null, true).Where(x => x.Id == Id).First();
var et = await _rep.AsQueryable().Filter(null, true).WhereIF(!string.IsNullOrWhiteSpace(order.MBLNO),x => x.MBLNO == order.MBLNO).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID && x.ParentId == 0 && x.Id != Id).FirstAsync(); if (!string.IsNullOrEmpty(order.MBLNO))
if (et != null)
{ {
throw Oops.Bah("当前主提单号已存在,无法恢复!"); var et = await _rep.AsQueryable().Filter(null, true).Where(x => x.MBLNO == order.MBLNO && x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID && x.ParentId == 0 && x.Id != Id).FirstAsync();
if (et != null)
{
throw Oops.Bah("当前主提单号已存在,无法恢复!");
}
} }
var ctnlist = await _repCtn.AsQueryable().Where(x => x.BILLID == Id).Select(x => x.Id).ToListAsync(); var ctnlist = await _repCtn.AsQueryable().Where(x => x.BILLID == Id).Select(x => x.Id).ToListAsync();
await _repCtn.UpdateAsync(x => x.BILLID == Id, x => new BookingCtn { IsDeleted = false }); await _repCtn.UpdateAsync(x => x.BILLID == Id, x => new BookingCtn { IsDeleted = false });
await _ctndetailrep.UpdateAsync(x => ctnlist.Contains((long)x.CTNID), x => new BookingCtnDetail { IsDeleted = false }); await _ctndetailrep.UpdateAsync(x => ctnlist.Contains((long)x.CTNID), x => new BookingCtnDetail { IsDeleted = false });
@ -8792,6 +8797,9 @@ HLCUTA12307DPXJ3 以这票为例 6个柜
#endregion #endregion
#region 同步东胜
/// <summary> /// <summary>
/// /批量提单号同步东胜 /// /批量提单号同步东胜
/// </summary> /// </summary>
@ -8831,6 +8839,92 @@ HLCUTA12307DPXJ3 以这票为例 6个柜
await SendBookingOrder(orderlist.ToArray()); await SendBookingOrder(orderlist.ToArray());
} }
#endregion
#region 提箱小票CMA
/// <summary>
/// 提箱小票CMA
/// </summary>
/// <param name="Ids"></param>
/// <returns></returns>
[HttpPost("/BookingOrder/SaveBookingTxxp")]
public async Task SaveBookingTxxp(string Ids)
{
//获取url
var url = _cache.GetAllDictData().Result.Where(x => x.TypeCode == "bookingTxxpUrl").Select(x => x.Value).FirstOrDefault();
//亿通账号
var ytAcc = _webAccountConfig.GetAccountConfig("CmaWeb", UserManager.UserId).Result;
if (ytAcc == null)
{
throw Oops.Bah(BookingErrorCode.BOOK119);
}
var arr = Ids.Split(",");
if (arr.Count() > 0)
{
foreach (var ar in arr)
{
long Id = Convert.ToInt64(ar);
var order = _rep.FirstOrDefault(x => x.Id == Id);
//条件判断 目前只支持CMA 的数据
if (order.CARRIERID != "CMA")
{
throw Oops.Bah("船公司目前只支持CMA");
}
if (string.IsNullOrEmpty(order.VESSEL))
{
throw Oops.Bah("船名不能为空");
}
if (string.IsNullOrEmpty(order.MBLNO))
{
throw Oops.Bah("船名不能为空");
}
var json = new
{
custname = "DJY",
custpsw = "123",
username = ytAcc.Account,
password = ytAcc.Password,
company = "CMA",
vessel = order.VESSEL
}.ToJsonString();
var rtn = await url.SetBody(json).PostAsStringAsync();
JObject jobjRtn = JObject.Parse(rtn);
var status = jobjRtn.GetValue("status").ToString();
if (status != "1")
{
///不等于1 返回结果错误
throw Oops.Bah(jobjRtn.GetValue("message").ToString());
}
else
{
var jarrData = jobjRtn.GetValue("message") as JArray;
foreach (JObject item in jarrData)
{
//订舱号(单号)
var mb = item.GetStringValue("bookingno"); //提单号
if (mb==order.MBLNO) {
var noApply= item.GetIntValue("noApply"); //未申请
var applyNoPrint = item.GetIntValue("applyNoPrint"); //已申请未打印
var print = item.GetIntValue("print"); //已打印
await _repextendstate.InsertAsync(new BookingExtendState
{
bookingId=Id,
noApply= noApply,
applyNoPrint= applyNoPrint,
print= print
});
}
}
}
}
}
}
#endregion
} }
} }

Loading…
Cancel
Save