wet 1 year ago
commit e3fb21ea45

@ -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>
@ -1971,7 +1976,7 @@ namespace Myshipping.Application
await VgmLink(input.BookingId);
}
await SendLetterYard(input.BookingId);
await SendLetterYard(input.BookingId);
return rtnId;
}
@ -1981,8 +1986,8 @@ namespace Myshipping.Application
/// <returns></returns>
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

@ -0,0 +1,137 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application.Service.BookingOrder.Dto
{
public class BookingYardDataRtn
{
/// <summary>
/// 箱号
/// </summary>
public string CNTRNO { get; set; }
/// <summary>
/// 封号
/// </summary>
public string SEALNO { get; set; }
/// <summary>
/// 箱型
/// </summary>
public string CTNALL { get; set; }
/// <summary>
/// 箱量
/// </summary>
public int XiangLiang { get; set; }
/// <summary>
/// 船名
/// </summary>
public string VESSEL { get; set; }
/// <summary>
/// 航次
/// </summary>
public string VOYNO { get; set; }
/// <summary>
/// 中转港
/// </summary>
public string tra_name { get; set; }
/// <summary>
/// 卸货港
/// </summary>
public string pod_name { get; set; }
/// <summary>
/// 目的港
/// </summary>
public string Destination { get; set; }
/// <summary>
/// 皮重
/// </summary>
public float? TAREWEIGHT { get; set; }
/// <summary>
/// 车号
/// </summary>
public string CheHao { get; set; }
/// <summary>
/// 包装
/// </summary>
public string KINDPKGS { get; set; }
/// <summary>
/// 件数
/// </summary>
public int PKGS { get; set; }
/// <summary>
/// 尺码
/// </summary>
public float? CBM { get; set; }
/// <summary>
/// 货重
/// </summary>
public float? KGS { get; set; }
/// <summary>
/// 提箱时间
/// </summary>
public string TiXiangShiJian { get; set; }
/// <summary>
/// 返场时间
/// </summary>
public string FanChangShiJian { get; set; }
/// <summary>
/// 集港时间
/// </summary>
public string JiGangShiJian { get; set; }
/// <summary>
/// 计划集港开始时间
/// </summary>
public string PortStartPlanTime { get; set; }
/// <summary>
/// 计划集港结束时间
/// </summary>
public string PortEndPlanTime { get; set; }
/// <summary>
/// 完船时间
/// </summary>
public string WanChuanShiJian { get; set; }
/// <summary>
/// 危险品主等级
/// </summary>
public string DClass { get; set; }
/// <summary>
/// 危险品编号
/// </summary>
public string DUNNo { get; set; }
/// <summary>
/// 危险品副等级
/// </summary>
public string FuDClass { get; set; }
/// <summary>
/// 危险品副编号
/// </summary>
public string FuDUNNo { get; set; }
/// <summary>
/// 海污
/// </summary>
public string HaiWu { get; set; }
/// <summary>
/// 温度
/// </summary>
public string TempSet { get; set; }
/// <summary>
/// 通风
/// </summary>
public string Reeferf { get; set; }
/// <summary>
/// 湿度
/// </summary>
public string Humidity { get; set; }
}
public class BookingGetYardDataDto: BookingYardDataRtn
{
/// <summary>
/// 箱型代码
/// </summary>
public string CtnCode { get; set; }
}
}

@ -138,31 +138,6 @@ namespace Myshipping.Application
/// </summary>
public string RecvUserName { get; set; }
/// <summary>
/// 任务对应接收操作人ID(大简云账户体系)
/// </summary>
public string DJYRecvUserId { get; set; }
/// <summary>
/// 任务对应接收操作人名称(大简云账户体系)
/// </summary>
public string DJYRecvUserName { get; set; }
/// <summary>
/// 任务对应接收操作人邮箱(大简云账户体系)
/// </summary>
public string DJYRecvUserEmail { get; set; }
/// <summary>
/// 任务对应部门代码(大简云账户体系)
/// </summary>
public string DJYTaskOrgCode { get; set; }
/// <summary>
/// 任务对应部门名称(大简云账户体系)
/// </summary>
public string DJYTaskOrgName { get; set; }
/// <summary>
/// 状态列表
/// </summary>

@ -262,8 +262,27 @@ namespace Myshipping.Application
entity.UpdatedUserId = UserManager.UserId;
entity.UpdatedUserName = UserManager.Name;
if(string.IsNullOrWhiteSpace(model.DEVELOP_VERSION) && !string.IsNullOrWhiteSpace(model.RELEASE_VERSION))
entity.DEVELOP_VERSION = "DEVELOP";
if (!isSetEnable)
{
entity.IS_ENABLE = model.IS_ENABLE;
}
entity.IS_LOCK = model.IS_LOCK;
if (string.IsNullOrWhiteSpace(model.DEVELOP_VERSION))
{
if(!string.IsNullOrWhiteSpace(model.RELEASE_VERSION))
{
entity.DEVELOP_VERSION = "DEVELOP";
}
}
else
{
entity.DEVELOP_VERSION = model.DEVELOP_VERSION;
}
currVersion = entity.DEVELOP_VERSION;
if (info.StatusSkuList != null && info.StatusSkuList.Count > 0)
{
@ -290,7 +309,7 @@ namespace Myshipping.Application
it.IS_LOCK
}).ExecuteCommandAsync();
currVersion = model.DEVELOP_VERSION;
currVersion = entity.DEVELOP_VERSION;
//批量删除服务流程与服务项目关系(物理删除)
_serviceWorkFlowProjectRelationRepository.EntityContext.Deleteable<ServiceWorkFlowProjectRelation>()
@ -529,16 +548,18 @@ namespace Myshipping.Application
1ID
2
*/
var activitiesList = _serviceWorkFlowActivitiesRelationRepository.AsQueryable()
.LeftJoin<ServiceWorkFlowBaseInfo>((rela, wf) => rela.SERVICE_WORKFLOW_ID == wf.PK_ID)
var activitiesList = _serviceWorkFlowActivitiesRelationRepository.AsQueryable().Filter(null, true)
.LeftJoin<ServiceWorkFlowBaseInfo>((rela, wf) => rela.SERVICE_WORKFLOW_ID == wf.PK_ID
&& rela.WF_VERSION == wf.RELEASE_VERSION)
.Where((rela,wf) => activitiesArgs.Contains(rela.SERVICE_ACTIVITIES_ID)
&& !wf.IsDeleted && wf.IS_ENABLE == 1 && !string.IsNullOrWhiteSpace(wf.RELEASE_VERSION))
&& !wf.IsDeleted && wf.IS_ENABLE == 1)
.Select((rela, wf) => wf).Distinct().ToList();
var subActList = _serviceWorkFlowActivitiesSubRelationRepository.AsQueryable()
.LeftJoin<ServiceWorkFlowBaseInfo>((rela, wf) => rela.SERVICE_WORKFLOW_ID == wf.PK_ID)
var subActList = _serviceWorkFlowActivitiesSubRelationRepository.AsQueryable().Filter(null, true)
.LeftJoin<ServiceWorkFlowBaseInfo>((rela, wf) => rela.SERVICE_WORKFLOW_ID == wf.PK_ID
&& rela.WF_VERSION == wf.RELEASE_VERSION)
.Where((rela, wf) => activitiesArgs.Contains(rela.SUB_SERVICE_ACTIVITIES_ID)
&& !wf.IsDeleted && wf.IS_ENABLE == 1 && !string.IsNullOrWhiteSpace(wf.RELEASE_VERSION))
&& !wf.IsDeleted && wf.IS_ENABLE == 1)
.Select((rela, wf) => wf).Distinct().ToList();
if(subActList.Count > 0)
@ -558,41 +579,41 @@ namespace Myshipping.Application
var wfArg = activitiesList.Select(a => a.PK_ID).ToArray();
var mergeList =
_serviceWorkFlowBaseRepository.AsQueryable()
_serviceWorkFlowBaseRepository.AsQueryable().Filter(null, true)
.LeftJoin<ServiceWorkFlowActivitiesRelation>((wf, rela) => wf.PK_ID == rela.SERVICE_WORKFLOW_ID
&& wf.RELEASE_VERSION == rela.WF_VERSION)
.Where(wf => wfArg.Contains(wf.PK_ID))
.Select((wf, rela) => new { WF = wf, Rela = rela })
.LeftJoin<ServiceWorkFlowActivitiesInfo>((rela, act) =>
rela.Rela.SERVICE_ACTIVITIES_ID == act.PK_ID)
.LeftJoin<StatusSkuBaseInfo>((rela, act, sku) =>
.LeftJoin<ServiceWorkFlowActivitiesInfo>((wf,rela, act) =>
rela.SERVICE_ACTIVITIES_ID == act.PK_ID && wf.RELEASE_VERSION == rela.WF_VERSION)
.LeftJoin<StatusSkuBaseInfo>((wf,rela, act, sku) =>
act.STATUS_SKU_ID == sku.PK_ID)
.Select((rela, act, sku) =>
new { WF = rela.WF, Act = act, Sku = sku, SortNo = rela.Rela.SORT_NO, IsSub = rela.Rela.IS_CONTAINS_SUB, ValType = rela.Rela.VAL_TYPE })
.Where((wf) => wfArg.Contains(wf.PK_ID))
.Select((wf,rela, act, sku) =>
new { WF = wf, Act = act, Sku = sku, SortNo = rela.SORT_NO, IsSub = rela.IS_CONTAINS_SUB, ValType = rela.VAL_TYPE })
.ToList();
var mergeSubList =
_serviceWorkFlowBaseRepository.AsQueryable()
_serviceWorkFlowBaseRepository.AsQueryable().Filter(null, true)
.LeftJoin<ServiceWorkFlowActivitiesSubRelation>((wf, rela) => wf.PK_ID == rela.SERVICE_WORKFLOW_ID
&& wf.RELEASE_VERSION == rela.WF_VERSION)
.Where(wf => wfArg.Contains(wf.PK_ID))
.Select((wf, rela) => new { WF = wf, Rela = rela })
.LeftJoin<ServiceWorkFlowActivitiesInfo>((rela, act) =>
rela.Rela.SUB_SERVICE_ACTIVITIES_ID == act.PK_ID)
.LeftJoin<StatusSkuBaseInfo>((rela, act, sku) =>
.LeftJoin<ServiceWorkFlowActivitiesInfo>((wf, rela, act) =>
rela.SUB_SERVICE_ACTIVITIES_ID == act.PK_ID && wf.RELEASE_VERSION == rela.WF_VERSION)
.LeftJoin<StatusSkuBaseInfo>((wf, rela, act, sku) =>
act.STATUS_SKU_ID == sku.PK_ID)
.Select((rela, act, sku) =>
new { WF = rela.WF, Act = act, Sku = sku, SortNo = rela.Rela.SORT_NO, ParentId = rela.Rela.SERVICE_ACTIVITIES_ID, ValType = rela.Rela.VAL_TYPE })
.Where((wf) => wfArg.Contains(wf.PK_ID))
.Select((wf,rela, act, sku) =>
new { WF = wf, Act = act, Sku = sku, SortNo = rela.SORT_NO, ParentId = rela.SERVICE_ACTIVITIES_ID, ValType = rela.VAL_TYPE })
.ToList();
var prjectList = _serviceWorkFlowBaseRepository.AsQueryable()
var prjectList =
_serviceWorkFlowBaseRepository.AsQueryable().Filter(null, true)
.LeftJoin<ServiceWorkFlowProjectRelation>((wf, rela) => wf.PK_ID == rela.SERVICE_WORKFLOW_ID
&& wf.RELEASE_VERSION == rela.WF_VERSION)
.Select((wf,rela)=> new { WF = wf, Rela = rela })
.LeftJoin<ServiceProjectBaseInfo>((rela, prj) =>
rela.Rela.SERVICE_PROJECT_ID == prj.PK_ID)
.Select((rela, prj) => new{ WF = rela.WF, Rela = rela.Rela,Prj = prj }).ToList();
.LeftJoin<ServiceProjectBaseInfo>((wf,rela, prj) =>
rela.SERVICE_PROJECT_ID == prj.PK_ID)
.Where((wf) => wfArg.Contains(wf.PK_ID))
.Select((wf,rela, prj) => new{ WF = wf, Rela = rela,Prj = prj }).ToList();
var list = mergeList.GroupBy(a => a.WF.PK_ID)
@ -615,7 +636,8 @@ namespace Myshipping.Application
{
actModel.SubList = mergeSubList.Where(
b =>
b.WF.PK_ID == a.WF.PK_ID && b.Act.PK_ID == a.Act.PK_ID).OrderBy(b => b.SortNo)
b.WF.PK_ID == a.WF.PK_ID && b.ParentId == a.Act.PK_ID)
.OrderBy(b => b.SortNo)
.Select(b =>
{
@ -1233,14 +1255,15 @@ namespace Myshipping.Application
};
if (lastReleaseInfo != null)
{
releaseInfo.LAST_PK_ID = lastReleaseInfo.PK_ID;
lastReleaseInfo.IS_DEL = 1;
lastReleaseInfo.IS_DEL = 1;
_serviceWorkFlowReleaseInfoRepository.AsUpdateable(lastReleaseInfo).UpdateColumns(it => new
{
it.IS_DEL
}).ExecuteCommand();
_serviceWorkFlowReleaseInfoRepository.AsUpdateable(lastReleaseInfo).UpdateColumns(it => new
{
it.IS_DEL
}).ExecuteCommand();
}
//写入发布表
_serviceWorkFlowReleaseInfoRepository.Insert(releaseInfo);

@ -3,11 +3,13 @@ using Furion.DistributedIDGenerator;
using Furion.DynamicApiController;
using Furion.FriendlyException;
using Furion.JsonSerialization;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Myshipping.Application.Entity;
using Myshipping.Core;
using Myshipping.Core.Entity;
using NPOI.OpenXmlFormats.Vml;
using NPOI.SS.Formula.Functions;
using Org.BouncyCastle.Asn1.Tsp;
using Org.BouncyCastle.Ocsp;
@ -23,7 +25,7 @@ namespace Myshipping.Application
/// <summary>
/// 服务流程管理
/// </summary>
[ApiDescriptionSettings("Application", Name = "ServiceWorkFlowManage", Order = 30)]
[AllowAnonymous, ApiDescriptionSettings("Application", Name = "ServiceWorkFlowManage", Order = 30)]
public class ServiceWorkFlowManageService : IServiceWorkFlowManageService, IDynamicApiController, ITransient
{
private readonly ILogger<ServiceWorkFlowManageService> _logger;
@ -124,20 +126,10 @@ namespace Myshipping.Application
throw Oops.Oh($"报文Main的状态列表至少需要提供一个以上的状态信息", typeof(InvalidOperationException));
}
UserTendDto userTendInfo = null;
//如果大简云用户ID不为空接收人为空时通过大简云用户ID关联订舱人ID
if (!string.IsNullOrWhiteSpace(info.Main.DJYRecvUserId))
{
userTendInfo = GetUserTendInfoByDJYUserId(info.Main.DJYRecvUserId, info.Main.DJYRecvUserEmail);
}
else
{
userTendInfo = GetUserTendInfo(info.Main.RecvUserId);
}
UserTendDto userTendInfo = GetUserTendInfo(info.Main.RecvUserId);
//根据状态编号检索对应的状态和活动信息,如果已经提取到的状态数量与推送的不一致不能直接返回错误
var skuList = _statusSkuBaseInfoRepository.AsQueryable()
var skuList = _statusSkuBaseInfoRepository.AsQueryable().Filter(null, true)
.LeftJoin<ServiceWorkFlowActivitiesInfo>((sts, act) => sts.PK_ID == act.STATUS_SKU_ID)
.Where((sts, act) => statusArg.Contains(sts.STATUS_SKU_CODE) && !sts.IsDeleted && sts.IS_ENABLE == 1
&& !act.IsDeleted)
@ -168,7 +160,7 @@ namespace Myshipping.Application
}
//先从运行表按主键获取运行主表和活动表
var runList = _serviceWorkFlowRunInfoRepository.AsQueryable()
var runList = _serviceWorkFlowRunInfoRepository.AsQueryable().Filter(null, true)
.LeftJoin<ServiceWorkFlowRunActivitiesInfo>(
(m, s) => m.PK_ID == s.RUN_ID)
.Where((m, s) => m.BUSI_ID == info.Main.BusiId
@ -254,8 +246,6 @@ namespace Myshipping.Application
IS_START = sku.SortNo == 1 ? 1 : 0,
IS_END = sku.SortNo == endNum ? 1 : 0,
ACT_ID = sku.PKId,
ACT_DATE = currReq.Req.StatusDate,
ACT_VAL = currReq.Req.StatusVal,
STATUS_SKU_CODE = sku.statusSkuBase.StatusSKUCode,
STATUS_SKU_ID = sku.StatusSKUId,
SHOW_NAME = sku.ShowName,
@ -272,7 +262,14 @@ namespace Myshipping.Application
SOURCE_TYPE = "AUTO"
};
if(!string.IsNullOrWhiteSpace(lastActId))
if(currReq != null)
{
activitiesRunInfo.ACT_DATE = currReq.Req.StatusDate;
activitiesRunInfo.ACT_VAL = currReq.Req.StatusVal;
}
if (!string.IsNullOrWhiteSpace(lastActId))
activitiesRunInfo.NEXT_ACT_ID = lastActId;
await _serviceWorkFlowRunActivitiesInfoRepository.InsertAsync(activitiesRunInfo);
@ -296,8 +293,6 @@ namespace Myshipping.Application
IS_START = sub.SortNo == 1 ? 1 : 0,
IS_END = sub.SortNo == endNum ? 1 : 0,
ACT_ID = sub.PKId,
ACT_DATE = currSubReq.Req.StatusDate,
ACT_VAL = currSubReq.Req.StatusVal,
STATUS_SKU_CODE = sub.statusSkuBase.StatusSKUCode,
STATUS_SKU_ID = sub.StatusSKUId,
SHOW_NAME = sub.ShowName,
@ -314,6 +309,12 @@ namespace Myshipping.Application
SOURCE_TYPE = "AUTO"
};
if(currSubReq != null)
{
activitiesSubRunInfo.ACT_DATE = currSubReq.Req.StatusDate;
activitiesSubRunInfo.ACT_VAL = currSubReq.Req.StatusVal;
}
if (!string.IsNullOrWhiteSpace(lastSubActId))
activitiesSubRunInfo.NEXT_ACT_ID = lastSubActId;

@ -15,6 +15,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Myshipping.FlowCenter", "My
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Myshipping.Report", "Myshipping.Report\Myshipping.Report.csproj", "{66E98A13-17A5-4B2A-B78A-A3FC87D2645A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceDeamon", "ServiceDeamon\ServiceDeamon.csproj", "{A0F9B98D-6466-465F-B2D1-278B7284C11E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -45,6 +47,10 @@ Global
{66E98A13-17A5-4B2A-B78A-A3FC87D2645A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{66E98A13-17A5-4B2A-B78A-A3FC87D2645A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{66E98A13-17A5-4B2A-B78A-A3FC87D2645A}.Release|Any CPU.Build.0 = Release|Any CPU
{A0F9B98D-6466-465F-B2D1-278B7284C11E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A0F9B98D-6466-465F-B2D1-278B7284C11E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A0F9B98D-6466-465F-B2D1-278B7284C11E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A0F9B98D-6466-465F-B2D1-278B7284C11E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="ServiceName" value=""/>
</appSettings>
</configuration>

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;
namespace ServiceDeamon
{
public class CheckServiceHelper
{
private static ServiceController servCtl;
public static void CheckStatus(string servName)
{
if (servCtl == null || servCtl.ServiceName != servName)
{
servCtl = new ServiceController(servName);
}
if (servCtl != null && servCtl.Status == ServiceControllerStatus.Stopped)
{
servCtl.Start();
}
}
}
}

@ -0,0 +1,13 @@
using ServiceDeamon;
using System.Configuration;
using System.ServiceProcess;
var servName = ConfigurationManager.AppSettings["ServiceName"];
//Timer t = new System.Threading.Timer((sta) =>
//{
// CheckServiceHelper.CheckStatus(servName);
//});
//t.Change(1000,)

@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.ServiceProcess.ServiceController" Version="7.0.1" />
</ItemGroup>
</Project>
Loading…
Cancel
Save