|
|
|
@ -1010,7 +1010,7 @@ namespace Myshipping.Application
|
|
|
|
|
return ordOut;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 在订舱台账保存单证备注、操作备注等功能
|
|
|
|
@ -1033,12 +1033,17 @@ namespace Myshipping.Application
|
|
|
|
|
throw Oops.Bah("无权修改");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var orderCompare = await _rep.AsQueryable().Filter(null, true).FirstAsync(x => x.Id == model.Id);
|
|
|
|
|
|
|
|
|
|
model.Adapt(order);
|
|
|
|
|
order.VERSION = Guid.NewGuid().ToString();
|
|
|
|
|
await _rep.UpdateAsync(order);
|
|
|
|
|
|
|
|
|
|
//todo:记录修改日志,等待抽取方法
|
|
|
|
|
//记录修改日志
|
|
|
|
|
await SaveLog(order, orderCompare);
|
|
|
|
|
|
|
|
|
|
//推送东胜
|
|
|
|
|
await SendBookingOrder(new long[] { order.Id });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -1938,13 +1943,13 @@ namespace Myshipping.Application
|
|
|
|
|
public async Task<long> LetteryardSave(UpdateBookingLetteryardInput input)
|
|
|
|
|
{
|
|
|
|
|
long rtnId = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (input.Id == 0)
|
|
|
|
|
{
|
|
|
|
|
var entity = input.Adapt<BookingLetteryard>();
|
|
|
|
|
await _repLetterYard.InsertAsync(entity);
|
|
|
|
|
rtnId = entity.Id;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -1952,7 +1957,7 @@ namespace Myshipping.Application
|
|
|
|
|
input.Adapt(entity);
|
|
|
|
|
await _repLetterYard.UpdateAsync(entity);
|
|
|
|
|
rtnId = entity.Id;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var order = _rep.FirstOrDefault(x => x.Id == input.BookingId);
|
|
|
|
@ -1971,7 +1976,7 @@ namespace Myshipping.Application
|
|
|
|
|
await VgmLink(input.BookingId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await SendLetterYard(input.BookingId);
|
|
|
|
|
await SendLetterYard(input.BookingId);
|
|
|
|
|
return rtnId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1979,10 +1984,10 @@ namespace Myshipping.Application
|
|
|
|
|
/// 放舱推送东胜
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<dynamic> SendLetterYard(long bookingId)
|
|
|
|
|
public async Task<dynamic> SendLetterYard(long bookingId)
|
|
|
|
|
{
|
|
|
|
|
var entity= _repLetterYard.AsQueryable().Filter(null, true).First(x => x.BookingId == bookingId);
|
|
|
|
|
var json = entity.ToJsonString();
|
|
|
|
|
var entity = _repLetterYard.AsQueryable().Filter(null, true).First(x => x.BookingId == bookingId);
|
|
|
|
|
var json = entity.ToJsonString();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
const string MqActionExchangeName = "djy.output.dingcang.ds6";
|
|
|
|
@ -7301,7 +7306,19 @@ namespace Myshipping.Application
|
|
|
|
|
throw Oops.Bah("请先选择场站");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var rtn = await YardDataHelper.GetYardData(UserManager.UserId, order.TenantId.Value, order.TenantName, order.MBLNO, order.YARDID, isWeb);
|
|
|
|
|
var listRtn = await GetYardDataAndMappingSystem(order, isWeb);
|
|
|
|
|
|
|
|
|
|
return listRtn.ToJsonString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 从爬虫获取场站数据,并映射为系统中的箱型
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private async Task<List<BookingGetYardDataDto>> GetYardDataAndMappingSystem(BookingOrder order, bool isWeb = false)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var rtn = await YardDataHelper.GetYardData(App.User.FindFirst(ClaimConst.CLAINM_USERID) == null ? order.CreatedUserId.Value : UserManager.UserId, order.TenantId.Value, order.TenantName, order.MBLNO, order.YARDID, isWeb);
|
|
|
|
|
if (!rtn.Key)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(rtn.Value);
|
|
|
|
@ -7311,23 +7328,24 @@ namespace Myshipping.Application
|
|
|
|
|
var ctnList = await _cache.GetAllCodeCtn();
|
|
|
|
|
var mapCtn = await _cache.GetAllMappingCtn();
|
|
|
|
|
|
|
|
|
|
var jData = JArray.Parse(rtn.Value);
|
|
|
|
|
foreach (JObject item in jData)
|
|
|
|
|
var listRtn = JsonConvert.DeserializeObject<List<BookingGetYardDataDto>>(rtn.Value);
|
|
|
|
|
|
|
|
|
|
foreach (var item in listRtn)
|
|
|
|
|
{
|
|
|
|
|
var ctnall = item.GetStringValue("CTNALL");
|
|
|
|
|
var ctnall = item.CTNALL;
|
|
|
|
|
var findMap = mapCtn.FirstOrDefault(x => x.Module == "YardData" && x.MapCode == ctnall);
|
|
|
|
|
var findCtn = ctnList.FirstOrDefault(x => x.Name == ctnall);
|
|
|
|
|
if (findMap != null)
|
|
|
|
|
{
|
|
|
|
|
item.Add("CtnCode", findMap.Code);
|
|
|
|
|
item.CtnCode = findMap.Code;
|
|
|
|
|
|
|
|
|
|
findCtn = ctnList.First(c => c.Code == findMap.Code);
|
|
|
|
|
item["CTNALL"] = findCtn.Name; //名称显示维护的箱型
|
|
|
|
|
item.CTNALL = findCtn.Name; //名称显示维护的箱型
|
|
|
|
|
}
|
|
|
|
|
else if (findCtn != null)
|
|
|
|
|
{
|
|
|
|
|
item.Add("CtnCode", findCtn.Code);
|
|
|
|
|
item["CTNALL"] = findCtn.Name; //名称显示维护的箱型
|
|
|
|
|
item.CtnCode = findCtn.Code;
|
|
|
|
|
item.CTNALL = findCtn.Name; //名称显示维护的箱型
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -7335,7 +7353,56 @@ namespace Myshipping.Application
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return jData.ToString();
|
|
|
|
|
return listRtn;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 自动引入场站箱型箱量数据
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="bookId"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private async Task AutoYardData(long bookId)
|
|
|
|
|
{
|
|
|
|
|
var order = _rep.AsQueryable().Filter(null, true).First(x => x.Id == bookId);
|
|
|
|
|
|
|
|
|
|
var paraAuto = _cache.GetAllTenantParam().Result.FirstOrDefault(x => x.TenantId == order.TenantId && x.ParaCode == "AUTO_CNTRNO_SEALNO_IMPORT");
|
|
|
|
|
if (paraAuto == null || paraAuto.ItemCode != "YES")
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation($"{order.TenantName}未开启自动箱号引入");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var ctns = _repCtn.AsQueryable().Filter(null, true).Where(x => x.BILLID == bookId).ToList();
|
|
|
|
|
if (ctns.Count(x => !string.IsNullOrEmpty(x.CNTRNO) || !string.IsNullOrEmpty(x.SEALNO)) > 0) //有数据填写了箱封号,不再处理
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation($"{bookId}({order.MBLNO})的数据已填写过箱封号,不再处理自动引入");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var rtn = await GetYardDataAndMappingSystem(order, false);
|
|
|
|
|
await _repCtn.DeleteAsync(x => x.BILLID == bookId);
|
|
|
|
|
|
|
|
|
|
foreach (var item in rtn)
|
|
|
|
|
{
|
|
|
|
|
var ctn = new BookingCtn();
|
|
|
|
|
ctn.BILLID = order.Id;
|
|
|
|
|
ctn.CTNCODE = item.CtnCode;
|
|
|
|
|
ctn.CTNALL = item.CTNALL;
|
|
|
|
|
ctn.CTNNUM = item.XiangLiang;
|
|
|
|
|
ctn.CNTRNO = item.CNTRNO;
|
|
|
|
|
ctn.SEALNO = item.SEALNO;
|
|
|
|
|
ctn.KINDPKGS = string.IsNullOrEmpty(item.KINDPKGS) ? order.KINDPKGS : item.KINDPKGS;
|
|
|
|
|
ctn.PKGS = item.PKGS;
|
|
|
|
|
ctn.KGS = Convert.ToDecimal(item.KGS);
|
|
|
|
|
ctn.CBM = Convert.ToDecimal(item.CBM);
|
|
|
|
|
ctn.TAREWEIGHT = Convert.ToDecimal(item.TAREWEIGHT);
|
|
|
|
|
ctn.TenantId = order.TenantId;
|
|
|
|
|
ctn.CreatedUserId = order.CreatedUserId;
|
|
|
|
|
ctn.CreatedUserName = "系统";
|
|
|
|
|
await _repCtn.InsertAsync(ctn);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -8100,162 +8167,11 @@ namespace Myshipping.Application
|
|
|
|
|
"} ";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpGet("/BookingOrder/XHZGLJ"), AllowAnonymous]
|
|
|
|
|
public async Task XHZGLJ(long bookId = 432917132775494)
|
|
|
|
|
[HttpGet("/BookingOrder/AutoYard"), AllowAnonymous]
|
|
|
|
|
public async Task AutoYard(long bookId = 437779259732037)
|
|
|
|
|
{
|
|
|
|
|
var order = _rep.AsQueryable().Filter(null, true).First(x => x.Id == bookId);
|
|
|
|
|
var ctns = _repCtn.AsQueryable().Filter(null, true).Where(x => x.BILLID == bookId).ToList();
|
|
|
|
|
MemoryStream ms = new MemoryStream(File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "XhzGlj.xls")));
|
|
|
|
|
var workbook = new HSSFWorkbook(ms);
|
|
|
|
|
FileStream fs = new FileStream(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "XhzGlj_1.xls"), FileMode.Create);
|
|
|
|
|
var sheet = workbook.GetSheetAt(0);
|
|
|
|
|
|
|
|
|
|
//第一行标题
|
|
|
|
|
var title = $"下货纸清单-{order.LANENAME} SERVICE";
|
|
|
|
|
sheet.GetRow(0).GetCell(0).SetCellValue(title);
|
|
|
|
|
|
|
|
|
|
//船期B2
|
|
|
|
|
sheet.GetRow(1).GetCell(1).SetCellValue(order.ETD.HasValue ? order.ETD.Value.ToString("yyyy.MM.dd") : "");
|
|
|
|
|
|
|
|
|
|
//船名B3
|
|
|
|
|
sheet.GetRow(2).GetCell(1).SetCellValue(order.VESSEL);
|
|
|
|
|
|
|
|
|
|
//航次F3
|
|
|
|
|
sheet.GetRow(2).GetCell(5).SetCellValue(order.VOYNO);
|
|
|
|
|
|
|
|
|
|
//代理B4
|
|
|
|
|
sheet.GetRow(3).GetCell(1).SetCellValue(order.TenantName);
|
|
|
|
|
|
|
|
|
|
//联系电话F4
|
|
|
|
|
var usr = _repUser.AsQueryable().Filter(null, true).First(u => u.Id == order.CreatedUserId);
|
|
|
|
|
if (!string.IsNullOrEmpty(usr.Tel))
|
|
|
|
|
{
|
|
|
|
|
sheet.GetRow(3).GetCell(5).SetCellValue(usr.Tel);
|
|
|
|
|
}
|
|
|
|
|
else if (!string.IsNullOrEmpty(usr.Phone))
|
|
|
|
|
{
|
|
|
|
|
sheet.GetRow(3).GetCell(5).SetCellValue(usr.Phone);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
sheet.GetRow(3).GetCell(5).SetCellValue("");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//订舱号B7
|
|
|
|
|
sheet.GetRow(6).GetCell(1).SetCellValue(order.CUSTNO);
|
|
|
|
|
|
|
|
|
|
//目的港C7
|
|
|
|
|
sheet.GetRow(6).GetCell(2).SetCellValue(order.PORTDISCHARGE);
|
|
|
|
|
|
|
|
|
|
//中转港D7
|
|
|
|
|
sheet.GetRow(6).GetCell(3).SetCellValue("");
|
|
|
|
|
|
|
|
|
|
//货名E7
|
|
|
|
|
sheet.GetRow(6).GetCell(4).SetCellValue(order.DESCRIPTION);
|
|
|
|
|
|
|
|
|
|
//件数F7
|
|
|
|
|
sheet.GetRow(6).GetCell(5).SetCellValue(order.PKGS.Value.ToString());
|
|
|
|
|
|
|
|
|
|
//重量G7
|
|
|
|
|
sheet.GetRow(6).GetCell(6).SetCellValue(Convert.ToDouble(order.KGS.Value).ToString());
|
|
|
|
|
|
|
|
|
|
//尺码H7
|
|
|
|
|
sheet.GetRow(6).GetCell(7).SetCellValue(Convert.ToDouble(order.CBM.Value).ToString());
|
|
|
|
|
|
|
|
|
|
//冻柜信息 温度C I7
|
|
|
|
|
if (order.CARGOID == "R")
|
|
|
|
|
{
|
|
|
|
|
sheet.GetRow(6).GetCell(8).SetCellValue(order.TEMPSET);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
sheet.GetRow(6).GetCell(8).SetCellValue("");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//冻柜信息 通风CBM/H J7
|
|
|
|
|
if (order.CARGOID == "R")
|
|
|
|
|
{
|
|
|
|
|
sheet.GetRow(6).GetCell(9).SetCellValue(order.REEFERF);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
sheet.GetRow(6).GetCell(9).SetCellValue("");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//冻柜信息 湿度% K7
|
|
|
|
|
if (order.CARGOID == "R")
|
|
|
|
|
{
|
|
|
|
|
sheet.GetRow(6).GetCell(10).SetCellValue(order.HUMIDITY);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
sheet.GetRow(6).GetCell(10).SetCellValue("");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//整理箱型箱量
|
|
|
|
|
var groupList = ctns.Where(x => x.CTNNUM > 0).GroupBy(c => c.CTNALL).Select(g => new { CTNALL = g.Key.Replace("'", ""), CTNNUM = g.Sum(gg => gg.CTNNUM) });
|
|
|
|
|
|
|
|
|
|
//箱量 20GP L7
|
|
|
|
|
var findCtn = groupList.FirstOrDefault(x => x.CTNALL == "20GP");
|
|
|
|
|
if (findCtn != null)
|
|
|
|
|
{
|
|
|
|
|
sheet.GetRow(6).GetCell(11).SetCellValue(findCtn.CTNNUM.Value.ToString());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
sheet.GetRow(6).GetCell(11).SetCellValue("");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//箱量 40GP M7
|
|
|
|
|
findCtn = groupList.FirstOrDefault(x => x.CTNALL == "40GP");
|
|
|
|
|
if (findCtn != null)
|
|
|
|
|
{
|
|
|
|
|
sheet.GetRow(6).GetCell(12).SetCellValue(findCtn.CTNNUM.Value.ToString());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
sheet.GetRow(6).GetCell(12).SetCellValue("");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//箱量 40HC N7
|
|
|
|
|
findCtn = groupList.FirstOrDefault(x => x.CTNALL == "40HC");
|
|
|
|
|
if (findCtn != null)
|
|
|
|
|
{
|
|
|
|
|
sheet.GetRow(6).GetCell(13).SetCellValue(findCtn.CTNNUM.Value.ToString());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
sheet.GetRow(6).GetCell(13).SetCellValue("");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//箱量 20RF O7
|
|
|
|
|
findCtn = groupList.FirstOrDefault(x => x.CTNALL == "20RF");
|
|
|
|
|
if (findCtn != null)
|
|
|
|
|
{
|
|
|
|
|
sheet.GetRow(6).GetCell(14).SetCellValue(findCtn.CTNNUM.Value.ToString());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
sheet.GetRow(6).GetCell(14).SetCellValue("");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//箱量 40RH P7
|
|
|
|
|
findCtn = groupList.FirstOrDefault(x => x.CTNALL == "40RH");
|
|
|
|
|
if (findCtn != null)
|
|
|
|
|
{
|
|
|
|
|
sheet.GetRow(6).GetCell(15).SetCellValue(findCtn.CTNNUM.Value.ToString());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
sheet.GetRow(6).GetCell(15).SetCellValue("");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//备注 场站/特殊要求 Q7
|
|
|
|
|
sheet.GetRow(6).GetCell(16).SetCellValue(order.YARDREMARK);
|
|
|
|
|
await AutoYardData(bookId);
|
|
|
|
|
|
|
|
|
|
workbook.Write(fs);
|
|
|
|
|
fs.Flush();
|
|
|
|
|
fs.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|