From abf1d2f5d5cac084a7b6dc518293834595d2ebb0 Mon Sep 17 00:00:00 2001
From: wet <1034391973@qq.com>
Date: Tue, 27 Dec 2022 09:27:49 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E8=BF=90=E8=B8=AA=E8=B0=83=E7=94=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Myshipping.Application.xml | 33 +++++++++++++++++++
.../BookingOrder/BookingOrderService.cs | 9 +++--
2 files changed, 39 insertions(+), 3 deletions(-)
diff --git a/Myshipping.Application/Myshipping.Application.xml b/Myshipping.Application/Myshipping.Application.xml
index 6b1b610a..6cf65c78 100644
--- a/Myshipping.Application/Myshipping.Application.xml
+++ b/Myshipping.Application/Myshipping.Application.xml
@@ -3341,6 +3341,21 @@
租户名称
+
+
+ 订舱打印模板权限表
+
+
+
+
+ 人员id
+
+
+
+
+ 模板id
+
+
订舱备注
@@ -6793,6 +6808,11 @@
主单ID
+
+
+ 人员id
+
+
EDI扩展
@@ -8932,6 +8952,19 @@
+
+
+ 新增打印模板权限
+
+
+
+
+
+
+ 获取打印模板权限
+
+
+
订舱打印模板输入参数
diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs
index 43a54dc7..ae1e2efd 100644
--- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs
+++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs
@@ -916,8 +916,11 @@ namespace Myshipping.Application
_logger.LogInformation("调用运踪接口发送josn:" + json);
var html = await url.FirstOrDefault(x => x.TypeCode == "url_set" && x.Code == "request_seae_billtraceurl").Value.SetHttpMethod(HttpMethod.Post).SetQueries(new { msg = json }).SetRetryPolicy(3, 5000).SendAsAsync();
_logger.LogInformation("调用运踪接口返回" + html.ToJsonString());
-
-
+ if (html.Success!=true) {
+ _logger.LogError("调用运踪接口发送josn:" + json);
+ throw Oops.Bah(html.Message);
+ }
+
}
///
@@ -1555,7 +1558,7 @@ namespace Myshipping.Application
{
//当前公司所有已配置的模板
var allList = await _repPrintTemplate.AsQueryable()
- .Filter(null, true).InnerJoin((d,t)=>d.Id==t.PrintTemplateId&&t.SysUserId==UserManager.UserId)
+ .Filter(null, true)//.InnerJoin((d,t)=>d.Id==t.PrintTemplateId&&t.SysUserId==UserManager.UserId)
.Where(x => x.TenantId == UserManager.TENANT_ID)
.Select(x => new
{
From 47c3fd668548a4246549088b6aa073d130c74182 Mon Sep 17 00:00:00 2001
From: wet <1034391973@qq.com>
Date: Tue, 27 Dec 2022 15:07:36 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E8=BF=90=E8=B8=AA=E8=AE=A2=E9=98=85?=
=?UTF-8?q?=E6=97=A5=E5=BF=97?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../BookingOrder/BookingOrderService.cs | 87 +++++++++++++++++--
.../Service/User/SysDataUserMenu.cs | 7 +-
2 files changed, 82 insertions(+), 12 deletions(-)
diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs
index ae1e2efd..1c9ae63a 100644
--- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs
+++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs
@@ -141,7 +141,7 @@ namespace Myshipping.Application
[HttpGet("/BookingOrder/Page")]
public async Task Page([FromQuery] BookingOrderInput input)
{
- List userlist = await _right.GetDataScopeList(351064299098181);
+ List userlist = await _right.GetDataScopeList(351064299098181);
//List userlist = await DataFilterExtensions.GetDataScopeIdList();
var entities = await _rep.AsQueryable().Where(x => x.ParentId == 0)
.WhereIF(!string.IsNullOrWhiteSpace(input.BSNO), u => u.BSNO.Contains(input.BSNO))
@@ -365,9 +365,15 @@ 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).FirstAsync();
+ if (et != null)
+ {
+
+ throw Oops.Bah("当前数据已存在,不能重复录入");
+ }
var entity = input.Adapt();
- //entity.TOTALNO = NumberToUpper.ToUpper(entity.PKGS == null ? 0 : entity.PKGS);
+ //entity.TOTALNO = NumberToUpper.ToUpper(entity.PKGS == null ? 0 : entity.PKGS);
await _rep.InsertAsync(entity);
if (input.ctnInputs != null)
{
@@ -473,6 +479,15 @@ namespace Myshipping.Application
input.CNTRTOTAL = string.Join(" / ", groupList);
}
var main = await _rep.AsQueryable().Where(x => x.Id == input.Id).FirstAsync();
+
+ var et = await _rep.Where(x => x.MBLNO == input.MBLNO && x.TenantId == UserManager.TENANT_ID && x.Id != input.Id).FirstAsync();
+ if (et != null)
+ {
+
+ throw Oops.Bah("当前数据已存在,不能重复录入");
+
+ }
+
var entity = input.Adapt();
//entity.TOTALNO = NumberToUpper.ToUpper(entity.PKGS == null ? 0 : entity.PKGS);
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
@@ -877,9 +892,9 @@ namespace Myshipping.Application
/// 调用运踪接口
///
[HttpPost("/BookingOrder/SendTrace")]
+ [SqlSugarUnitOfWork]
public async Task SendTrace(List dto)
{
-
if (dto == null)
{
throw Oops.Bah("未传入正确参数!");
@@ -887,14 +902,32 @@ namespace Myshipping.Application
var key = _webAccountConfig.GetAccountConfig("seae_billtraceurl", UserManager.UserId).Result;
if (key == null)
{
-
throw Oops.Bah("调用运踪接口相关账号未维护!");
}
var url = _cache.GetAllDictData().Result;
BillTraceDto billdto = new BillTraceDto();
List billTraceList = new List();
+ var dicdatalist = _cache.GetAllDictData().Result;
foreach (var item in dto)
{
+
+ if (item.CARRIERID != "")
+ {
+ var et = _repBookingStatus.Where(x => x.StaCode == "sta_mudigang" && x.BookingId == Convert.ToInt64(item.BusinessId)).FirstAsync();
+ if (et != null)
+ {
+ throw Oops.Bah("提单号"+item.MBLNO+"已订阅!");
+ }
+ }
+ if (item.YardCode != "")
+ {
+ var et = _repBookingStatus.Where(x => x.StaCode == "sta_qiyungang" && x.BookingId == Convert.ToInt64(item.BusinessId)).FirstAsync();
+ if (et != null)
+ {
+ throw Oops.Bah("提单号" + item.MBLNO + "已订阅!");
+ }
+ }
+
_logger.LogInformation("调用运踪接口提单号:" + item.MBLNO + " 调用运踪接口");
billTraceList.Add(new BillTraceList
{
@@ -906,6 +939,46 @@ namespace Myshipping.Application
CARRIERID = item.CARRIERID == "" ? null : item.CARRIERID,
isBook = item.isBook
});
+ var bookingStatusLog = new BookingStatusLog();
+ bookingStatusLog.BookingId = Convert.ToInt64(item.BusinessId);
+ bookingStatusLog.Category = "ship";
+ bookingStatusLog.CreatedTime = DateTime.Now;
+ if (item.YardCode == "" && item.CARRIERID != "")
+ {
+ bookingStatusLog.Status = "订阅目的港";
+ }
+ if (item.YardCode != "" && item.CARRIERID == "")
+ {
+ bookingStatusLog.Status = "订阅起运港";
+ }
+ if (item.YardCode != "" && item.CARRIERID != "")
+ {
+ bookingStatusLog.Status = "订阅起运港,目的港";
+ }
+ bookingStatusLog.OpTime = DateTime.Now;
+ bookingStatusLog.MBLNO = item.MBLNO;
+ await _repStatuslog.InsertAsync(bookingStatusLog);
+
+ if (item.CARRIERID != "")
+ {
+ BookingStatus bookingStatus = new BookingStatus();
+ bookingStatus.BookingId = Convert.ToInt64(item.BusinessId);
+ bookingStatus.StaCode = "sta_mudigang";
+ bookingStatus.StaName = dicdatalist.Where(x => x.Code == "sta_mudigang").Select(x => x.Value).FirstOrDefault();
+ bookingStatus.StaTime = DateTime.Now;
+ bookingStatus.StaCate = "book_sta_cate_billtrace";
+ await _repBookingStatus.InsertAsync(bookingStatus);
+ }
+ if (item.YardCode != "")
+ {
+ BookingStatus bookingStatus = new BookingStatus();
+ bookingStatus.BookingId = Convert.ToInt64(item.BusinessId);
+ bookingStatus.StaCode = "sta_qiyungang";
+ bookingStatus.StaName = dicdatalist.Where(x => x.Code == "sta_qiyungang").Select(x => x.Value).FirstOrDefault();
+ bookingStatus.StaTime = DateTime.Now;
+ bookingStatus.StaCate = "book_sta_cate_billtrace";
+ await _repBookingStatus.InsertAsync(bookingStatus);
+ }
}
billdto.Children = billTraceList;
billdto.Key = key.Account;
@@ -916,11 +989,11 @@ namespace Myshipping.Application
_logger.LogInformation("调用运踪接口发送josn:" + json);
var html = await url.FirstOrDefault(x => x.TypeCode == "url_set" && x.Code == "request_seae_billtraceurl").Value.SetHttpMethod(HttpMethod.Post).SetQueries(new { msg = json }).SetRetryPolicy(3, 5000).SendAsAsync();
_logger.LogInformation("调用运踪接口返回" + html.ToJsonString());
- if (html.Success!=true) {
- _logger.LogError("调用运踪接口发送josn:" + json);
+ if (html.Success != true)
+ {
+ _logger.LogError("调用运踪接口返回:" + html.ToJsonString());
throw Oops.Bah(html.Message);
}
-
}
///
diff --git a/Myshipping.Core/Service/User/SysDataUserMenu.cs b/Myshipping.Core/Service/User/SysDataUserMenu.cs
index 89aa8e29..a95269bf 100644
--- a/Myshipping.Core/Service/User/SysDataUserMenu.cs
+++ b/Myshipping.Core/Service/User/SysDataUserMenu.cs
@@ -123,8 +123,7 @@ public class SysDataUserMenuService : ISysDataUserMenu, IDynamicApiController,IT
}
await _sysUserDataScopeRep.DeleteAsync(x => x.SysUserId == input.UserId);
- foreach (var item in input.childrens)
- {
+
var list = new List();
input.childrens.ForEach(u =>
{
@@ -134,15 +133,13 @@ public class SysDataUserMenuService : ISysDataUserMenu, IDynamicApiController,IT
SysUserId = input.UserId,
SysMenuId=u.MenuId,
SysOrgId=u.OrgId
-
-
});
});
await _sysUserDataScopeRep.InsertAsync(list);
//var userdatalist = _rep.AsQueryable().ToListAsync();
//_sysCache.Set(CommonConst.CACHE_KEY_USERDATASCOPE, userdatalist);
- }
+
}
catch (System.Exception)