jianghaiqing 1 year ago
commit 274adfcfb2

@ -10,6 +10,7 @@ using Myshipping.Core.Entity;
using Myshipping.Core.Helper;
using Myshipping.Core.Service;
using Newtonsoft.Json.Linq;
using NPOI.HSSF.UserModel;
using SqlSugar;
using System;
using System.Collections.Generic;
@ -45,8 +46,16 @@ namespace Myshipping.Application.EDI
return new KeyValuePair<bool, string>(false, "订舱信息未找到");
}
var yardArr = new string[] { "GLJ", "GJF", "JIEFENG", "GANGLIANXIN", "ZHONGCHUANG" };
if (!yardArr.Contains(order.YARDID.ToUpper()))
var ctns = repCtn.Where(c => c.BILLID == bookingId).ToList();
var dictData = await cacheService.GetAllDictData();
var yardCodeSetList = dictData.Where(x => x.TypeCode == "XiaHuoZhiYardCodeSet").ToList(); //所有支持下货纸的场站代码配置
var gljEdiCarrierSetList = dictData.Where(x => x.TypeCode == "XiaHuoZhiGLJEdiCarrierSet").ToList();//港联捷通过EDI发送下货纸船司配置
var gljExcelMailCarrierSetList = dictData.Where(x => x.TypeCode == "XiaHuoZhiGLJExcelMailCarrierSet").ToList();//港联捷通过邮件Excel下货纸船司配置
var yardArr = yardCodeSetList.Select(x => x.Value).ToArray();
if (!yardArr.Contains(order.YARDID))
{
return new KeyValuePair<bool, string>(false, "不支持的场站");
}
@ -72,119 +81,356 @@ namespace Myshipping.Application.EDI
fileOpt.basePath = App.WebHostEnvironment.WebRootPath;
}
#region 港联捷场站
if (order.YARDID == "GLJ")
var yardCodeGLJ = yardCodeSetList.FirstOrDefault(x => x.Code == "YardGLJ");
if (yardCodeGLJ == null)
{
//租户参数-港联捷下货纸代号
var paraXHZ = (await cacheService.GetAllTenantParam()).FirstOrDefault(p => p.TenantId == order.TenantId && p.ParaCode == "CODE_GLJ_XHZ");
if (paraXHZ == null || string.IsNullOrEmpty(paraXHZ.ItemCode))
{
return new KeyValuePair<bool, string>(false, $"{order.TenantName} 港联捷场站 下货纸代号未找到或配置有误");
}
return new KeyValuePair<bool, string>(false, "港联捷场站代码未配置");
}
var ediFileName = $"{paraXHZ.ItemCode}_{order.MBLNO}_{DateTime.Now.Ticks}.txt";
var ediFileRela = Path.Combine(fileOpt.relativePath, EdiFilePath, ediFileName);
var yardCodeGJF = yardCodeSetList.FirstOrDefault(x => x.Code == "YardGJF");
if (yardCodeGJF == null)
{
return new KeyValuePair<bool, string>(false, "港捷丰场站代码未配置");
}
var yardCodeJieFeng = yardCodeSetList.FirstOrDefault(x => x.Code == "YardJieFeng");
if (yardCodeJieFeng == null)
{
return new KeyValuePair<bool, string>(false, "捷丰场站代码未配置");
}
var yardCodeGLX = yardCodeSetList.FirstOrDefault(x => x.Code == "YardGLX");
if (yardCodeGLX == null)
{
return new KeyValuePair<bool, string>(false, "港联欣站代码未配置");
}
var yardCodeZhongChuang = yardCodeSetList.FirstOrDefault(x => x.Code == "YardZhongChuang");
if (yardCodeZhongChuang == null)
{
return new KeyValuePair<bool, string>(false, "中创站代码未配置");
}
#region 港联捷场站
if (order.YARDID == yardCodeGLJ.Value)
{
var ediPathAbs = Path.Combine(fileOpt.basePath, fileOpt.relativePath, EdiFilePath);
var ediFileAbs = Path.Combine(ediPathAbs, ediFileName);
if (!Directory.Exists(ediPathAbs))
{
Directory.CreateDirectory(ediPathAbs);
}
var ediSettints = await cacheService.GetAllEdiSetting();
var dicData = await cacheService.GetAllDictData();
//港联捷所有用户使用一个ftp用户名和密码发送报文使用文件名中的下货纸代号进行区分
var paraServer = dicData.FirstOrDefault(x => x.TypeCode == "booking_ftp_setting_glj" && x.Code == "ftp_server");
var paraUser = dicData.FirstOrDefault(x => x.TypeCode == "booking_ftp_setting_glj" && x.Code == "username");
var paraPwd = dicData.FirstOrDefault(x => x.TypeCode == "booking_ftp_setting_glj" && x.Code == "pwd");
if (paraServer == null || paraUser == null || paraPwd == null)
{
return new KeyValuePair<bool, string>(false, $"港联捷下货纸FTP服务地址参数未配置");
}
StringBuilder sbData = new StringBuilder();
sbData.AppendLine($"01:{order.VESSEL}:{order.VOYNO}"); //船名 航次
sbData.AppendLine($"12:{order.MBLNO}:{order.TRANSPORTID}:{order.PORTDISCHARGEID}:{paraXHZ.ItemCode}:{order.CARRIERID}::{ExchangeStr(order.YARDREMARK)}"); //主提单 中转港代码 目的港代码 货代代码 船公司 HPL参考号 备注
//2021-8-17报文中不能体现英文字符①【:】②【,】,以空格代替
/*
* QDAC064651 28600 EDI28 
255
255100
*/
var despStr = ExchangeStr(order.DESCRIPTION.Replace(":", " ").Replace(",", " ")).Replace("\r\n", " ").Replace("\n", " ");
if (despStr.Length > 100)
//通过EDI发送下货纸的船司
if (gljEdiCarrierSetList.Select(x => x.Value).ToList().Contains(order.CARRIERID))
{
despStr = despStr.Substring(0, 100);
}
//租户参数-港联捷下货纸代号
var paraXHZ = (await cacheService.GetAllTenantParam()).FirstOrDefault(p => p.TenantId == order.TenantId && p.ParaCode == "CODE_GLJ_XHZ");
if (paraXHZ == null || string.IsNullOrEmpty(paraXHZ.ItemCode))
{
return new KeyValuePair<bool, string>(false, $"{order.TenantName} 港联捷场站 下货纸代号未找到或配置有误");
}
sbData.AppendLine($"22:{despStr}:{order.PKGS}:{order.KINDPKGS}:{order.KGS}:{order.CBM}:{(order.CARGOID == "D" ? "Y" : "N")}:{order.DCLASS}:{order.DUNNO}::{order.TEMPSET}:{order.REEFERF}:{order.HUMIDITY}");//货名 件数 包装代码 总重量 总体积 危品标志 危品等级 危规号 副危品等级 副危规号 温度 通风度 湿度
var ediFileName = $"{paraXHZ.ItemCode}_{order.MBLNO}_{DateTime.Now.Ticks}.txt";
var ediFileRela = Path.Combine(fileOpt.relativePath, EdiFilePath, ediFileName);
var ediFileAbs = Path.Combine(ediPathAbs, ediFileName);
var ediSettints = await cacheService.GetAllEdiSetting();
var dicData = await cacheService.GetAllDictData();
//港联捷所有用户使用一个ftp用户名和密码发送报文使用文件名中的下货纸代号进行区分
var paraServer = dicData.FirstOrDefault(x => x.TypeCode == "booking_ftp_setting_glj" && x.Code == "ftp_server");
var paraUser = dicData.FirstOrDefault(x => x.TypeCode == "booking_ftp_setting_glj" && x.Code == "username");
var paraPwd = dicData.FirstOrDefault(x => x.TypeCode == "booking_ftp_setting_glj" && x.Code == "pwd");
if (paraServer == null || paraUser == null || paraPwd == null)
{
return new KeyValuePair<bool, string>(false, $"港联捷下货纸FTP服务地址参数未配置");
}
var ctnCodes = (await GetAllCodeCtn()).Select(x => new { x.Code, x.Size }).ToList();
var ctnEdiList = (await GetAllMappingCtn()).AsQueryable().Where(x => x.Module == "XHZ_GLJ").ToList();
StringBuilder sbData = new StringBuilder();
sbData.AppendLine($"01:{order.VESSEL}:{order.VOYNO}"); //船名 航次
sbData.AppendLine($"12:{order.MBLNO}:{order.TRANSPORTID}:{order.PORTDISCHARGEID}:{paraXHZ.ItemCode}:{order.CARRIERID}::{ExchangeStr(order.YARDREMARK)}"); //主提单 中转港代码 目的港代码 货代代码 船公司 HPL参考号 备注
//2021-8-17报文中不能体现英文字符①【:】②【,】,以空格代替
/*
* QDAC064651 28600 EDI28 
255
255100
*/
var despStr = ExchangeStr(order.DESCRIPTION.Replace(":", " ").Replace(",", " ")).Replace("\r\n", " ").Replace("\n", " ");
if (despStr.Length > 100)
{
despStr = despStr.Substring(0, 100);
}
var ctns = repCtn.Where(c => c.BILLID == bookingId).ToList();
foreach (var ctn in ctns)
{
var ctnFind = ctnCodes.FirstOrDefault(c => c.Code == ctn.CTNCODE);
if (ctnFind == null)
sbData.AppendLine($"22:{despStr}:{order.PKGS}:{order.KINDPKGS}:{order.KGS}:{order.CBM}:{(order.CARGOID == "D" ? "Y" : "N")}:{order.DCLASS}:{order.DUNNO}::{order.TEMPSET}:{order.REEFERF}:{order.HUMIDITY}");//货名 件数 包装代码 总重量 总体积 危品标志 危品等级 危规号 副危品等级 副危规号 温度 通风度 湿度
var ctnCodes = (await GetAllCodeCtn()).Select(x => new { x.Code, x.Size }).ToList();
var ctnEdiList = (await GetAllMappingCtn()).AsQueryable().Where(x => x.Module == "XHZ_GLJ").ToList();
foreach (var ctn in ctns)
{
return new KeyValuePair<bool, string>(false, $"未找到箱型 {ctn.CTNALL},请联系管理员");
var ctnFind = ctnCodes.FirstOrDefault(c => c.Code == ctn.CTNCODE);
if (ctnFind == null)
{
return new KeyValuePair<bool, string>(false, $"未找到箱型 {ctn.CTNALL},请联系管理员");
}
var ctnEdi = ctnEdiList.FirstOrDefault(cc => cc.Code == ctn.CTNCODE);
if (ctnEdi == null)
{
return new KeyValuePair<bool, string>(false, $"箱型({ctn.CTNALL}不匹配EDI类型XHZ_GLJ无法发送下货纸请联系管理员");
}
sbData.AppendLine($"13:{(order.ISCONTAINERSOC.HasValue && order.ISCONTAINERSOC.Value ? "SOC" : order.CARRIERID)}:{ctnFind.Size}:{ctnEdi.MapCode}:{ctn.CTNNUM}:{ExchangeStr(ctn.REMARK)}:N");//箱经营人代码 尺寸 箱型 箱数 备注 加重箱
}
var ctnEdi = ctnEdiList.FirstOrDefault(cc => cc.Code == ctn.CTNCODE);
if (ctnEdi == null)
Log.Information($"生成下货纸报文:{sbData.ToString()}");
File.WriteAllText(ediFileAbs, sbData.ToString());
//挂载附件
var attFile = new BookingFile();
attFile.BookingId = order.Id;
attFile.FileName = ediFileName;
attFile.FilePath = ediFileRela;
attFile.TypeCode = "xiahuozhi";
attFile.TypeName = "下货纸";
attFile.TenantName = order.TenantName;
repBookingFile.Insert(attFile);
//发送ftp
SplitFtpServerAndPort(paraServer.Value, out string server, out int port);
var ftpSpiderUrl = dicData.FirstOrDefault(x => x.TypeCode == "url_set" && x.Code == "booking_edi_ftp_server").Value;
NameValueCollection par = new NameValueCollection();
par.Add("host", server);
par.Add("port", port.ToString());
par.Add("username", paraUser.Value);
par.Add("pwd", paraPwd.Value);
par.Add("path", "/");
Log.Information($"准备请求发送ftp{ftpSpiderUrl} ,参数:{par.ToJsonString()},文件:{ediFileName}");
var res = FTPHelper.TransmitFtpFile(ftpSpiderUrl, par, new
{
return new KeyValuePair<bool, string>(false, $"箱型({ctn.CTNALL}不匹配EDI类型XHZ_GLJ无法发送下货纸请联系管理员");
file = "file",
fileName = Path.GetFileName(ediFileName),
fileBytes = Encoding.UTF8.GetBytes(sbData.ToString())
});
Log.Information($"发送ftp返回{res}");
var jobjRetn = JObject.Parse(res);
if (jobjRetn.GetStringValue("status") != "1")
{
return new KeyValuePair<bool, string>(false, $"ftp发送失败{jobjRetn.GetStringValue("message")}");
}
sbData.AppendLine($"13:{(order.ISCONTAINERSOC.HasValue && order.ISCONTAINERSOC.Value ? "SOC" : order.CARRIERID)}:{ctnFind.Size}:{ctnEdi.MapCode}:{ctn.CTNNUM}:{ExchangeStr(ctn.REMARK)}:N");//箱经营人代码 尺寸 箱型 箱数 备注 加重箱
return new KeyValuePair<bool, string>(true, $"已发送");
}
//通过邮件发送Excel的船司
else if (gljExcelMailCarrierSetList.Select(x => x.Value).ToList().Contains(order.CARRIERID))
{
var ediFileName = $"{order.CARRIERID}_{order.VESSEL}_{order.VOYNO}_{DateTime.Now.Ticks}.xls";
var ediFileRela = Path.Combine(fileOpt.relativePath, EdiFilePath, ediFileName);
var ediFileAbs = Path.Combine(ediPathAbs, ediFileName);
Log.Information($"生成下货纸报文:{sbData.ToString()}");
File.WriteAllText(ediFileAbs, sbData.ToString());
var templateFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "XhzGljTemplate.xls");
if (!File.Exists(templateFile))
{
return new KeyValuePair<bool, string>(false, $"模板EXCEL文件未找到请联系管理员");
}
//挂载附件
var attFile = new BookingFile();
attFile.BookingId = order.Id;
attFile.FileName = ediFileName;
attFile.FilePath = ediFileRela;
attFile.TypeCode = "xiahuozhi";
attFile.TypeName = "下货纸";
attFile.TenantName = order.TenantName;
repBookingFile.Insert(attFile);
if (string.IsNullOrEmpty(order.YARDCONTRACTEMAIL))
{
return new KeyValuePair<bool, string>(false, $"场站联系人邮箱未填写");
}
//发送ftp
SplitFtpServerAndPort(paraServer.Value, out string server, out int port);
var userMail = repUserMail.FirstOrDefault(x => x.CreatedUserId == order.CreatedUserId);
if (userMail == null
|| string.IsNullOrEmpty(userMail.SmtpServer)
|| userMail.SmtpPort == 0)
{
return new KeyValuePair<bool, string>(false, $"发件邮箱未配置");
}
var ftpSpiderUrl = dicData.FirstOrDefault(x => x.TypeCode == "url_set" && x.Code == "booking_edi_ftp_server").Value;
NameValueCollection par = new NameValueCollection();
par.Add("host", server);
par.Add("port", port.ToString());
par.Add("username", paraUser.Value);
par.Add("pwd", paraPwd.Value);
par.Add("path", "/");
MemoryStream ms = new MemoryStream(File.ReadAllBytes(templateFile));
var workbook = new HSSFWorkbook(ms);
var sheet = workbook.GetSheetAt(0);
Log.Information($"准备请求发送ftp{ftpSpiderUrl} ,参数:{par.ToJsonString()},文件:{ediFileName}");
var res = FTPHelper.TransmitFtpFile(ftpSpiderUrl, par, new
{
file = "file",
fileName = Path.GetFileName(ediFileName),
fileBytes = Encoding.UTF8.GetBytes(sbData.ToString())
});
Log.Information($"发送ftp返回{res}");
var jobjRetn = JObject.Parse(res);
if (jobjRetn.GetStringValue("status") != "1")
//第一行标题
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(order.TRANSPORTID);
//货名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);
MemoryStream msResult = new MemoryStream();
workbook.Write(msResult);
File.WriteAllBytes(ediFileAbs, msResult.GetBuffer());
//挂载附件
var attFile = new BookingFile();
attFile.BookingId = order.Id;
attFile.FileName = ediFileName;
attFile.FilePath = ediFileRela;
attFile.TypeCode = "xiahuozhi";
attFile.TypeName = "下货纸";
attFile.TenantName = order.TenantName;
repBookingFile.Insert(attFile);
//发送邮件
var sendResult = await MailSendHelper.SendMail(userMail, title, "", order.YARDCONTRACTEMAIL,new KeyValuePair<string, byte[]>(ediFileName, msResult.GetBuffer()));
if (!sendResult.Key)
{
return new KeyValuePair<bool, string>(false, sendResult.Value);
}
return new KeyValuePair<bool, string>(true, $"已发送");
}
else
{
return new KeyValuePair<bool, string>(false, $"ftp发送失败{jobjRetn.GetStringValue("message")}");
return new KeyValuePair<bool, string>(false, "该船司不支持发送港联捷下货纸");
}
return new KeyValuePair<bool, string>(true, $"已发送");
}
#endregion
#region 港捷丰场站 捷丰场站 NOTE港捷丰场站和捷丰场站下货纸功能根据东胜7同功能模块代码翻译而来
else if (order.YARDID == "GJF" || order.YARDID == "JIEFENG")
else if (order.YARDID == yardCodeGJF.Value || order.YARDID == yardCodeJieFeng.Value)
{
if (!order.PKGS.HasValue || order.PKGS.Value == 0)
{
@ -216,11 +462,11 @@ namespace Myshipping.Application.EDI
}
DjyEdiSetting ftpset = null;
if (order.YARDID == "GJF")
if (order.YARDID == yardCodeGJF.Value)
{
ftpset = (await cacheService.GetAllEdiSetting()).FirstOrDefault(f => f.EDICODE == "XHZ_GJF" && f.TenantId == order.TenantId);
}
else if (order.YARDID == "JIEFENG")
else if (order.YARDID == yardCodeJieFeng.Value)
{
ftpset = (await cacheService.GetAllEdiSetting()).FirstOrDefault(f => f.EDICODE == "XHZ_JIEFENG" && f.TenantId == order.TenantId);
}
@ -231,7 +477,7 @@ namespace Myshipping.Application.EDI
}
var ediParaName = "XHZ_GJF";
if (order.YARDID == "JIEFENG")
if (order.YARDID == yardCodeJieFeng.Value)
{
ediParaName = "XHZ_JIEFENG";
}
@ -386,7 +632,6 @@ namespace Myshipping.Application.EDI
}
//集装箱
var ctns = repCtn.Where(c => c.BILLID == bookingId).ToList();
var groupList = ctns.Where(c => c.CTNNUM.HasValue).GroupBy(c => c.CTNCODE).Select(c => new { c.Key, CTNNUM = c.Sum(cc => cc.CTNNUM) }).ToList();
foreach (var g in groupList)
{
@ -450,12 +695,12 @@ namespace Myshipping.Application.EDI
#endregion
#region 港联欣场站
else if (order.YARDID.ToUpper() == "GANGLIANXIN" || order.YARDID.ToUpper() == "ZHONGCHUANG")
else if (order.YARDID == yardCodeGLX.Value || order.YARDID == yardCodeZhongChuang.Value)
{
//2022年6月15日增加港联欣场站若配置了通过港联捷EDI发送则使用港联捷报文格式
var tenantParam = await cacheService.GetAllTenantParam();
var pGlxEdi = tenantParam.FirstOrDefault(p => p.TenantId == order.TenantId && p.ParaCode == "XIAHUOZHI_GLX_SEND_TYPE");
if (order.YARDID.ToUpper() == "GANGLIANXIN" && pGlxEdi != null && pGlxEdi.ItemCode == "EDI_GLX")
if (order.YARDID == yardCodeGLX.Value && pGlxEdi != null && pGlxEdi.ItemCode == "EDI_GLX")
{
var ftpset = (await cacheService.GetAllEdiSetting()).FirstOrDefault(f => f.EDICODE == "XHZ_GLX" && f.TenantId == order.TenantId);
if (ftpset == null)
@ -492,7 +737,6 @@ namespace Myshipping.Application.EDI
var ctnCodes = (await GetAllCodeCtn()).Select(x => new { x.Code, x.Size }).ToList();
var ctnEdiList = (await GetAllMappingCtn()).AsQueryable().Where(x => x.Module == "XHZ_GLX").ToList();
var ctns = repCtn.Where(c => c.BILLID == bookingId).ToList();
foreach (var ctn in ctns)
{
var ctnFind = ctnCodes.FirstOrDefault(c => c.Code == ctn.CTNCODE);

@ -77,6 +77,7 @@ using RabbitMQ.Client;
using System.Configuration;
using System.Collections;
using System.Security.Principal;
using Myshipping.Core.Const;
namespace Myshipping.Application
{
@ -204,8 +205,14 @@ namespace Myshipping.Application
[HttpPost("/BookingOrder/PageData")]
public async Task<dynamic> PageData(BookingOrderInput input)
{
List<long> userlist = await _right.GetDataScopeList(351064299098181);
var traceTime = false;
var ticks = DateTime.Now;
if (traceTime)
{
_logger.LogInformation($"PageData Stage 0 ");
}
List<long> userlist = await _right.GetDataScopeList(MenuConst.MenuBookingOrder);
List<long?> pidlist = new List<long?>();
if (!string.IsNullOrWhiteSpace(input.SEALNO) || !string.IsNullOrWhiteSpace(input.CNTRNO))
{
@ -215,6 +222,13 @@ namespace Myshipping.Application
var etoday = DateTime.Now.AddDays(15);
//List<long> userlist = await DataFilterExtensions.GetDataScopeIdList();
if (traceTime)
{
var et = DateTime.Now - ticks;
ticks = DateTime.Now;
_logger.LogInformation($"PageData Stage 1 {et.TotalMilliseconds}");
}
//按部门查询
List<string> saleUserList = null;
List<string> opUserList = null;
@ -230,13 +244,20 @@ namespace Myshipping.Application
opUserList = tmpList.Select(x => x.ToString()).ToList();
}
if (traceTime)
{
var et = DateTime.Now - ticks;
ticks = DateTime.Now;
_logger.LogInformation($"PageData Stage 2 {et.TotalMilliseconds}");
}
#region
var query = _rep.AsQueryable().Filter(null, true).Where(x => x.TenantId == UserManager.TENANT_ID)
.WhereIF(!input.ISDel, x => x.IsDeleted == false)
.WhereIF(input.ISDel, x => x.IsDeleted == true)
.WhereIF(input.firstFlag, x => (x.ETD <= etoday && x.ETD >= ftoday || x.ETD == null) && x.CreatedUserId == UserManager.UserId) //首次加载数据ETD前后15天且创建人是当前人
.Where(x => x.ParentId == 0 || x.ParentId == null) //台账只查询主单!!
.WhereIF( input.Id!=0,x=>x.Id==input.Id)
.WhereIF(input.Id != 0, x => x.Id == input.Id)
.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)
@ -401,7 +422,23 @@ namespace Myshipping.Application
#endregion
var entities = await query.ToPagedListAsync(input.PageNo, input.PageSize);
if (traceTime)
{
var et = DateTime.Now - ticks;
ticks = DateTime.Now;
_logger.LogInformation($"PageData Stage 3 {et.TotalMilliseconds}");
}
var list = entities.Adapt<SqlSugarPagedList<PageBookingOrder>>();
if (traceTime)
{
var et = DateTime.Now - ticks;
ticks = DateTime.Now;
_logger.LogInformation($"PageData Stage 4 {et.TotalMilliseconds}");
}
var bookingidlist = list.Items.Select(x => x.Id).ToList();
var itgoodsStatus = _goodsStatus.AsQueryable().LeftJoin(_goodsStatusConfig.AsQueryable(),
(goods, config) => config.Id == goods.ConfigId && bookingidlist.Contains((long)goods.bookingId)).
@ -418,7 +455,7 @@ namespace Myshipping.Application
CreatedUserId = config.CreatedUserId,
Sort = config.Sort
}).ToList();
var configID = itgoodsStatus.Select(x => x.ConfigId).ToList();
var configID = itgoodsStatus.Select(x => x.ConfigId).Distinct().ToList();
var itconfigs = _goodsStatusConfig.AsQueryable().Where(x => configID.Contains(x.Id)).Select(config => new
{
@ -433,12 +470,28 @@ namespace Myshipping.Application
Sort = config.Sort
}).ToList();
if (traceTime)
{
var et = DateTime.Now - ticks;
ticks = DateTime.Now;
_logger.LogInformation($"PageData Stage 5 {et.TotalMilliseconds}");
}
var statusloglist = _repStatuslog.AsQueryable().Filter(null, true).Where(x => bookingidlist.Contains((long)x.BookingId) && (x.Status == "提箱" || x.Status == "返场") && x.IsDeleted == false).ToList();
var statuslogId = statusloglist.Select(x => x.Id).ToList();
var statuslogdetaillist = _statuslogdetail.AsQueryable().Where(x => statuslogId.Contains(x.PId)).ToList();
var BookingStatusList = _repBookingStatus.AsQueryable().Filter(null, true).Where(x => bookingidlist.Contains((long)x.BookingId)).ToList();
var bookingremarkList = _bookingremark.AsQueryable().Filter(null, true).Where(x => bookingidlist.Contains(x.PId)).ToList();
if (traceTime)
{
var et = DateTime.Now - ticks;
ticks = DateTime.Now;
_logger.LogInformation($"PageData Stage 6 {et.TotalMilliseconds}");
}
foreach (var item in list.Items)
{
var sta = BookingStatusList.Where(x => x.BookingId == item.Id).ToList();
@ -585,11 +638,16 @@ namespace Myshipping.Application
item.statuslogs1 = CNTRNODtolist;
}
return list;
}
if (traceTime)
{
var et = DateTime.Now - ticks;
ticks = DateTime.Now;
_logger.LogInformation($"PageData Stage 7 {et.TotalMilliseconds}");
}
return list;
}
/// <summary>
/// 立即返回保存信息
@ -733,7 +791,16 @@ namespace Myshipping.Application
{
var mlist = await _rep.AsQueryable().Filter(null, true).Where(x => x.Id == input.Id).FirstAsync();
if (!(mlist.OPID == UserManager.UserId.ToString() || mlist.DOCID == UserManager.UserId.ToString() || mlist.CUSTSERVICEID == UserManager.UserId.ToString() || mlist.ROUTEID == UserManager.UserId.ToString() || mlist.CreatedUserId.ToString() == UserManager.UserId.ToString() || UserManager.DjyUserId == "d85fd590-d9f6-4410-93a1-f6fac77b606e"))
var rightlist = await _right.GetDataScopeList(MenuConst.MenuBookingOrder, true);
if (!(
mlist.OPID == UserManager.UserId.ToString() ||
mlist.DOCID == UserManager.UserId.ToString() ||
mlist.CUSTSERVICEID == UserManager.UserId.ToString() ||
mlist.ROUTEID == UserManager.UserId.ToString() ||
mlist.CreatedUserId.ToString() == UserManager.UserId.ToString() ||
UserManager.DjyUserId == "d85fd590-d9f6-4410-93a1-f6fac77b606e" ||
rightlist.Contains((long)mlist.CreatedUserId)
))
{
throw Oops.Bah("您没有当前单据的操作权限!");
}
@ -926,7 +993,7 @@ namespace Myshipping.Application
var ctnlist = await _repCtn.AsQueryable().Where(x => x.BILLID == Id).ToListAsync();
var ctninput = ctnlist.Adapt<List<BookingCtnDto>>();
var ctnIdlist = ctnlist.Select(x => x.Id).ToList();
var ctndetaillist= await _ctndetailrep.AsQueryable().Where(x => ctnIdlist.Contains((long)x.CTNID)).ToListAsync();
var ctndetaillist = await _ctndetailrep.AsQueryable().Where(x => ctnIdlist.Contains((long)x.CTNID)).ToListAsync();
foreach (var item in ctninput)
{
var _ctndetaillist = ctndetaillist.Where(x => x.CTNID == item.Id).ToList();
@ -988,7 +1055,34 @@ namespace Myshipping.Application
return ordOut;
}
/// <summary>
/// 在订舱台账保存单证备注、操作备注等功能
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[HttpPost("/BookingOrder/SaveInList")]
public async Task SaveInList(BookingOrderSaveInListDto model)
{
var order = await _rep.AsQueryable().Filter(null, true).FirstAsync(x => x.Id == model.Id);
if (order == null)
{
throw Oops.Bah("订舱数据不存在");
}
//判断权限返回null表示有全部权限
List<long> userlist = await _right.GetDataScopeList(MenuConst.MenuBookingOrder, true);
if (userlist != null && !userlist.Contains(UserManager.UserId))
{
throw Oops.Bah("无权修改");
}
model.Adapt(order);
order.VERSION = Guid.NewGuid().ToString();
await _rep.UpdateAsync(order);
//todo:记录修改日志,等待抽取方法
}
/// <summary>
/// 删除订舱
@ -1115,8 +1209,6 @@ namespace Myshipping.Application
}
/// <summary>
/// 恢复删除
/// </summary>
@ -1277,6 +1369,7 @@ namespace Myshipping.Application
}
await _rep.UpdateAsync(x => dto.Id.Contains(x.Id), x => new BookingOrder
{
VERSION = Guid.NewGuid().ToString(),
VESSEL = dto.VESSEL,
VOYNOINNER = dto.VOYNOINNER,
ETD = dto.ETD,
@ -7622,7 +7715,12 @@ namespace Myshipping.Application
public async Task<dynamic> GetAllData(long bookingId)
{
var traceTime = false;
var ticks = DateTime.Now;
if (traceTime)
{
_logger.LogInformation($"{bookingId} GetAllData Stage 0 ");
}
BookingAllData allData = new BookingAllData();
if (bookingId == 0)
@ -7637,6 +7735,13 @@ namespace Myshipping.Application
var filelist = await _bookingfile.AsQueryable().Filter(null, true).Where(u => u.BookingId == bookingId).ToListAsync();
allData.file = filelist;
if (traceTime)
{
var et = DateTime.Now - ticks;
ticks = DateTime.Now;
_logger.LogInformation($"GetAllData Stage 1 {et.TotalMilliseconds}");
}
var statuslog = await _repStatuslog.AsQueryable().Filter(null, true).Where(x => x.BookingId == bookingId).OrderByDescending(x => x.CreatedTime).ToListAsync();
var dto = statuslog.Adapt<List<BookingStatusLogDto>>();
var statuslogdetail = await _statuslogdetail.AsQueryable().ToListAsync();
@ -7647,6 +7752,13 @@ namespace Myshipping.Application
}
allData.statuslog = dto;
if (traceTime)
{
var et = DateTime.Now - ticks;
ticks = DateTime.Now;
_logger.LogInformation($"GetAllData Stage 2 {et.TotalMilliseconds}");
}
List<BookingLogDto> list = new List<BookingLogDto>();
var main = await _bookinglog.AsQueryable().Where(u => u.BookingId == bookingId).ToListAsync();
list = main.Adapt<List<BookingLogDto>>();
@ -7662,6 +7774,13 @@ namespace Myshipping.Application
allData.log = list;
if (traceTime)
{
var et = DateTime.Now - ticks;
ticks = DateTime.Now;
_logger.LogInformation($"GetAllData Stage 3 {et.TotalMilliseconds}");
}
var order = _rep.Where(x => x.Id == bookingId).First();
var userid = order.CreatedUserId;
var username = order.CreatedUserName;
@ -7669,6 +7788,12 @@ namespace Myshipping.Application
{
_GoodsConfig.InitGoodsStatusConfig(Convert.ToInt64(userid), username);
if (traceTime)
{
var et = DateTime.Now - ticks;
ticks = DateTime.Now;
_logger.LogInformation($"GetAllData Stage 4 {et.TotalMilliseconds}");
}
var GoodsStatus = await _goodsStatus.AsQueryable().LeftJoin(_goodsStatusConfig.AsQueryable(),
(goods, config) => config.Id == goods.ConfigId).Where((goods, config) => config.CreatedUserId == userid && goods.bookingId == bookingId).
@ -7688,6 +7813,13 @@ namespace Myshipping.Application
Sort = config.Sort
}).ToListAsync();
if (traceTime)
{
var et = DateTime.Now - ticks;
ticks = DateTime.Now;
_logger.LogInformation($"GetAllData Stage 5 {et.TotalMilliseconds}");
}
var config = _goodsStatusConfig.AsQueryable().Where(config => config.CreatedUserId == userid).ToList().Select(config => new GoodsStatusQuery
{
@ -7703,6 +7835,13 @@ namespace Myshipping.Application
Sort = config.Sort
}).ToList();
if (traceTime)
{
var et = DateTime.Now - ticks;
ticks = DateTime.Now;
_logger.LogInformation($"GetAllData Stage 6 {et.TotalMilliseconds}");
}
foreach (var item in GoodsStatus)
{
config.RemoveAll(x => x.ConfigId == item.ConfigId);
@ -7712,6 +7851,13 @@ namespace Myshipping.Application
allData.GoodsStatus = GoodsStatus.Union<GoodsStatusQuery>(config).OrderBy(x => x.Sort).ToList();
if (traceTime)
{
var et = DateTime.Now - ticks;
ticks = DateTime.Now;
_logger.LogInformation($"GetAllData Stage 7 {et.TotalMilliseconds}");
}
}
@ -8164,6 +8310,163 @@ namespace Myshipping.Application
"} ";
}
[HttpGet("/BookingOrder/XHZGLJ"), AllowAnonymous]
public async Task XHZGLJ(long bookId = 432917132775494)
{
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);
workbook.Write(fs);
fs.Flush();
fs.Close();
}
#endregion

@ -812,4 +812,24 @@ namespace Myshipping.Application
/// </summary>
public string VERSION { get; set; }
}
/// <summary>
/// 台账保存(操作备注、单证备注)功能
/// </summary>
public class BookingOrderSaveInListDto
{
/// <summary>
/// 主键
/// </summary>
public long Id { get; set; }
/// <summary>
/// 单证备注
/// </summary>
public string DZRemark { get; set; }
/// <summary>
/// 操作备注
/// </summary>
public string CZRemark { get; set; }
}
}

@ -306,8 +306,7 @@ namespace Myshipping.Application
mDATA.FORWARDER =
_cache.GetAllMappingForwarder().Result.Where(x => x.Code == FORWARDER && x.Module == "cangdan").Select(x => x.MapCode).FirstOrDefault();
mDATA.YARDID = _cache.GetAllCodeYard().Result.Where(x => x.Code == YardCode).Select(x => x.ShowCode).FirstOrDefault();
mDATA.YARDID = _cache.GetAllMappingYard().Result.Where(x => x.Code == YardCode && x.Module == "cangdan").Select(x => x.MapCode).FirstOrDefault();
CTNDATA = ctns.Adapt<List<CTNDATAItem>>();
foreach (var item in CTNDATA)
{

@ -161,12 +161,11 @@ namespace Myshipping.Application
}
if (issend)
{
await _bookingorderservice.SendBookingOrder(order.Where(x => x.ParentId == 0).Select(x => x.Id).ToArray());
var ids = order.Where(x => x.ParentId == 0).Select(x => x.Id).ToArray();
if (ids.Count() > 0)
{
await _bookingorderservice.SendBookingOrder(ids);
}
}
}

@ -252,8 +252,6 @@ namespace Myshipping.Application
return entity.Id;
}
/// <summary>
/// 批量同步客户无返回值
/// </summary>
@ -401,8 +399,6 @@ namespace Myshipping.Application
}
/// <summary>
/// 批量同步船期无返回值
/// </summary>
@ -569,15 +565,18 @@ namespace Myshipping.Application
}
}
var ids = order.Where(x => x.ParentId == 0).Select(x => x.Id).ToArray();
if (ids.Count()>0) {
await _bookingorderservice.SendBookingOrder(ids);
}
}
}
return "上传成功!";
}
/// <summary>
/// 同步订舱批量 没有返回值
/// </summary>
@ -1796,7 +1795,11 @@ namespace Myshipping.Application
}
if (issend)
{
await _bookingorderservice.SendBookingOrder(order.Where(x => x.ParentId == 0).Select(x => x.Id).ToArray());
var ids = order.Where(x => x.ParentId == 0).Select(x => x.Id).ToArray();
if (ids.Count() > 0)
{
await _bookingorderservice.SendBookingOrder(ids);
}
}
}
}
@ -1970,12 +1973,14 @@ namespace Myshipping.Application
issend = true;
await _rep.AsUpdateable(it).IgnoreColumns().ExecuteCommandAsync();
}
}
if (issend)
{
await _bookingorderservice.SendBookingOrder(order.Where(x => x.ParentId == 0).Select(x => x.Id).ToArray());
var ids = order.Where(x => x.ParentId == 0).Select(x => x.Id).ToArray();
if (ids.Count() > 0)
{
await _bookingorderservice.SendBookingOrder(ids);
}
}

@ -19,6 +19,7 @@ using Myshipping.Application.EDI;
using Myshipping.Application.Entity;
using Myshipping.Application.Helper;
using Myshipping.Core;
using Myshipping.Core.Const;
using Myshipping.Core.Entity;
using Myshipping.Core.Helper;
using Myshipping.Core.Service;
@ -812,7 +813,7 @@ namespace Myshipping.Application
//&& t.STAT_TYPE == TaskStatLevelEnum.PERSON.ToString()) || (t.COMP_ID == userTendInfo.Tend.Id && t.STAT_TYPE == TaskStatLevelEnum.PUBLIC.ToString())).ToList();
//菜单375504048771141=我的任务台账
List<long> userlist = await _sysDataUserMenuService.GetDataScopeList(375504048771141);
List<long> userlist = await _sysDataUserMenuService.GetDataScopeList(MenuConst.MenuTaskManage);
bool isAdmin = userlist == null;
//任务列表分组统计
@ -1077,7 +1078,7 @@ namespace Myshipping.Application
entityOrderCol = MapsterExtHelper.GetAdaptProperty<TaskBaseInfoDto, TaskBaseInfo>(QuerySearch.SortField);
//菜单375504048771141=我的任务台账
List<long> userlist = await _sysDataUserMenuService.GetDataScopeList(375504048771141);
List<long> userlist = await _sysDataUserMenuService.GetDataScopeList(MenuConst.MenuTaskManage);
if (userlist == null)
userlist = new List<long> { UserManager.UserId };

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Core.Const
{
public class MenuConst
{
/// <summary>
/// 订舱台账菜单
/// </summary>
public const long MenuBookingOrder = 351064299098181;
/// <summary>
/// 我的任务台账
/// </summary>
public const long MenuTaskManage = 375504048771141;
}
}

@ -772,6 +772,16 @@
删除字段
</summary>
</member>
<member name="F:Myshipping.Core.Const.MenuConst.MenuBookingOrder">
<summary>
订舱台账菜单
</summary>
</member>
<member name="F:Myshipping.Core.Const.MenuConst.MenuTaskManage">
<summary>
我的任务台账
</summary>
</member>
<member name="P:Myshipping.Core.Entity.CodeCarrier.Code">
<summary>
代码

@ -83,11 +83,11 @@ namespace Myshipping.Core.Service
[HttpPost("/DjyCustomer/add"), SqlSugarUnitOfWork]
public async Task<long> Add(AddDjyCustomerInput input)
{
var find = await _rep.FirstOrDefaultAsync(u => u.CodeName == input.CodeName);
if (find != null)
{
throw Oops.Oh($"助记码已存在:{input.CodeName}");
}
//var find = await _rep.FirstOrDefaultAsync(u => u.CodeName == input.CodeName);
//if (find != null)
//{
// throw Oops.Oh($"助记码已存在:{input.CodeName}");
//}
var entity = input.Adapt<DjyCustomer>();
if (entity.Level == "R3" && !string.IsNullOrEmpty(entity.CUSTSERVICE))
@ -123,11 +123,11 @@ namespace Myshipping.Core.Service
throw Oops.Oh(ErrorCode.D1002);
}
find = await _rep.FirstOrDefaultAsync(u => u.CodeName == input.CodeName && u.Id != input.Id);
if (find != null)
{
throw Oops.Oh($"助记码已存在:{input.CodeName}");
}
//find = await _rep.FirstOrDefaultAsync(u => u.CodeName == input.CodeName && u.Id != input.Id);
//if (find != null)
//{
// throw Oops.Oh($"助记码已存在:{input.CodeName}");
//}
var entity = input.Adapt<DjyCustomer>();

@ -202,6 +202,7 @@ public class SysDataUserMenuService : ISysDataUserMenu, IDynamicApiController, I
}
DataScopeType _dataScopeType = list.Where(x => x.SysMenuId == menuid && x.SysUserId == UserManager.UserId).WhereIF(IsEdit == true, x => x.IsEdit == true).Select(x => x.DataScopeType).FirstOrDefault();
//全部数据返回null
if (_dataScopeType == DataScopeType.ALL)
{
datascope = null;
@ -240,10 +241,6 @@ public class SysDataUserMenuService : ISysDataUserMenu, IDynamicApiController, I
{
datascope.Add(UserManager.UserId);
}
if (IsEdit && datascope == null)
{
datascope.Add(UserManager.UserId);
}
return datascope;
}

@ -46,7 +46,7 @@
"ValidateAudience": true, // bool true
"ValidAudience": "myshipping", // string
"ValidateLifetime": true, // bool truetrue
"ExpiredTime": 1440, // long 20
"ExpiredTime": 720, // long 20
"ClockSkew": 5 // long 5
},
"EncryptKey": {

Loading…
Cancel
Save