修改Draft格式单比对

修改服务状态的保存、取消和订舱台账加载
optimize
jianghaiqing 1 year ago
parent 9b58095144
commit b5ff162d60

@ -79,6 +79,8 @@ using System.Collections;
using System.Security.Principal;
using Myshipping.Core.Const;
using ICSharpCode.SharpZipLib.BZip2;
using Furion.ClayObject;
using System.Dynamic;
namespace Myshipping.Application
{
@ -134,6 +136,7 @@ namespace Myshipping.Application
private readonly SqlSugarRepository<BookingExtendState> _repextendstate;
private readonly IServiceWorkFlowManageService _serviceWorkFlowManageService;
private readonly IDjyUserConfigService _djyUserConfigService;
const string CONST_MAPPING_MODULE = "BOOK_OR_CLOSING";
@ -157,7 +160,7 @@ namespace Myshipping.Application
SqlSugarRepository<SysTenant> repTenant, SqlSugarRepository<BookingStatus> repBookingStatus, SqlSugarRepository<BookingEDIExt> bookingEDIExt, SqlSugarRepository<BookingServiceItem> serviceItem,
SqlSugarRepository<ParaContractNoInfo> paraContractNoInfoRepository, IHttpContextAccessor httpContextAccessor, IBookingGoodsStatusConfigService GoodsConfig, SqlSugarRepository<DjyWebsiteAccountConfig> djyWebsiteAccountConfigRepository,
ISysOrgService orgService, SqlSugarRepository<BookingLineOpMgrConfig> repLineOpMgrConfig, SqlSugarRepository<SysEmp> repSysEmp, SqlSugarRepository<BookingAutoYardImport> repAutoYard,
IServiceWorkFlowManageService serviceWorkFlowManageService)
IServiceWorkFlowManageService serviceWorkFlowManageService, IDjyUserConfigService djyUserConfigService)
{
this._logger = logger;
this._rep = rep;
@ -203,6 +206,7 @@ namespace Myshipping.Application
this._repAutoYard = repAutoYard;
this._repextendstate = repextendstate;
_serviceWorkFlowManageService = serviceWorkFlowManageService;
_djyUserConfigService = djyUserConfigService;
}
#region 主表和箱信息
@ -466,8 +470,23 @@ namespace Myshipping.Application
var itgoodsStatus = new List<ITGoodsStatusDto>();
var itconfigs = new List<ITConfigsDto>();
//是否展示服务状态列表
bool isUserShowGoodsStatus = true;
List<ServiceProjectStatusDto> statusList = new List<ServiceProjectStatusDto>();
if (App.Configuration["ServiceStatusOpenAuto"] == "1")
{
var djyUserCfg = _djyUserConfigService.Multi(new string[] { "booking_list_column" })
.GetAwaiter().GetResult().FirstOrDefault();
if (djyUserCfg != null)
{
//如果不存在goodsStatusList则不获取服务状态详情
isUserShowGoodsStatus = !Regex.IsMatch(djyUserCfg.ConfigJson, "\\bfield\\b.*?\\bgoodsStatusList\\b");
}
if (isUserShowGoodsStatus)
{
QueryServiceProjectWithStatusBatch batchQuery = new QueryServiceProjectWithStatusBatch
{
@ -475,6 +494,7 @@ namespace Myshipping.Application
QueryType = TrackingQueryTypeEnum.QUERY_SERVICE_ALL,
TenantId = list.Items.FirstOrDefault().TenantId.Value
};
var queryRlt = _serviceWorkFlowManageService.GetEnableStatusListByBusinessBatch(batchQuery)
.GetAwaiter().GetResult();
@ -483,6 +503,7 @@ namespace Myshipping.Application
statusList = JSON.Deserialize<List<ServiceProjectStatusDto>>(JSON.Serialize(queryRlt.ext));
}
}
}
else
{
//货物状态
@ -608,6 +629,8 @@ namespace Myshipping.Application
#endregion
if (App.Configuration["ServiceStatusOpenAuto"] == "1")
{
if (isUserShowGoodsStatus)
{
var currStatusList = statusList.Where(a => long.Parse(a.BusiId) == item.Id).ToList();
@ -615,18 +638,27 @@ namespace Myshipping.Application
{
if (currStatusList.Any(a => a.StatusSKUCode.Equals("YFVGM", StringComparison.OrdinalIgnoreCase) && a.IsYield))
{
item.IsVGM = currStatusList.FirstOrDefault(a =>
a.StatusSKUCode.Equals("YFVGM", StringComparison.OrdinalIgnoreCase) && a.IsYield).ActDate.Value;
var currSt = currStatusList.FirstOrDefault(a =>
a.StatusSKUCode.Equals("YFVGM", StringComparison.OrdinalIgnoreCase) && a.IsYield);
if (currSt != null && currSt.ActDate.HasValue)
item.IsVGM = currSt.ActDate.Value;
}
if (currStatusList.Any(a => a.StatusSKUCode.Equals("YFCD", StringComparison.OrdinalIgnoreCase) && a.IsYield))
{
item.IsCanDan = currStatusList.FirstOrDefault(a =>
a.StatusSKUCode.Equals("YFCD", StringComparison.OrdinalIgnoreCase) && a.IsYield).ActDate.Value;
var currSt = currStatusList.FirstOrDefault(a =>
a.StatusSKUCode.Equals("YFCD", StringComparison.OrdinalIgnoreCase) && a.IsYield);
if (currSt != null && currSt.ActDate.HasValue)
item.IsCanDan = currSt.ActDate.Value;
}
if (currStatusList.Any(a => a.StatusSKUCode.Equals("ZZFX", StringComparison.OrdinalIgnoreCase) && a.IsYield))
{
item.IsZZFX = currStatusList.FirstOrDefault(a =>
a.StatusSKUCode.Equals("ZZFX", StringComparison.OrdinalIgnoreCase) && a.IsYield).ActDate.Value;
var currSt = currStatusList.FirstOrDefault(a =>
a.StatusSKUCode.Equals("ZZFX", StringComparison.OrdinalIgnoreCase) && a.IsYield);
if (currSt != null && currSt.ActDate.HasValue)
item.IsZZFX = currSt.ActDate.Value;
}
item.GoodsStatusList = currStatusList.OrderBy(a => a.CalcSortNo)
@ -647,6 +679,11 @@ namespace Myshipping.Application
}
}
else
{
item.GoodsStatusList = new List<GoodsStatusList>();
}
}
else
{
var itgoods = itgoodsStatus.Where(x => x.CreatedUserId == item.CreatedUserId && x.bookingid == item.Id).OrderBy(x => x.Sort).
Select(x => new GoodsStatusList
@ -9218,8 +9255,10 @@ HLCUTA12307DPXJ3 以这票为例 6个柜
if (statusList != null)
{
var maxStatus = statusList.Where(a => a.IsYield)
.OrderByDescending(a=>a.WFSortNo)
.ThenByDescending(a => a.CalcSortNo).FirstOrDefault();
//.OrderByDescending(a=>a.WFSortNo)
//.ThenByDescending(a => a.CalcSortNo)
.OrderByDescending(a => a.SortNo)
.FirstOrDefault();
if (maxStatus != null)
{
@ -9227,7 +9266,7 @@ HLCUTA12307DPXJ3 以这票为例 6个柜
.First(a => a.Id == bookingId);
model.BSSTATUSNAME = maxStatus.ShowName;
model.VERSION = IDGen.NextID().ToString().Replace("-", "");
//model.VERSION = IDGen.NextID().ToString().Replace("-", "");
//更新订舱
_rep.AsUpdateable(model)
@ -9311,8 +9350,10 @@ HLCUTA12307DPXJ3 以这票为例 6个柜
if (statusList != null)
{
var maxStatus = statusList.Where(a => a.IsYield)
.OrderByDescending(a => a.WFSortNo)
.ThenByDescending(a => a.CalcSortNo).FirstOrDefault();
//.OrderByDescending(a => a.WFSortNo)
//.ThenByDescending(a => a.CalcSortNo)
.OrderByDescending(a => a.SortNo)
.FirstOrDefault();
var model = _rep.AsQueryable().Filter(null, true)
.First(a => a.Id == bookingId);
@ -9326,7 +9367,7 @@ HLCUTA12307DPXJ3 以这票为例 6个柜
model.BSSTATUSNAME = string.Empty;
}
model.VERSION = IDGen.NextID().ToString().Replace("-", "");
//model.VERSION = IDGen.NextID().ToString().Replace("-", "");
//更新订舱
_rep.AsUpdateable(model)
@ -9352,7 +9393,7 @@ HLCUTA12307DPXJ3 以这票为例 6个柜
/// <param name="bookingId"></param>
/// <param name="isAutoSyncDS">是否默认同步东胜 true-自动同步 false-不自动同步</param>
/// <returns></returns>
public async Task SetBookingOrderGoodsStatus(long bookingId, bool isAutoSyncDS = false)
public async Task SetBookingGoodsStatus(long bookingId, bool isAutoSyncDS = false)
{
var bookingOrder = _rep.AsQueryable().Filter(null, true)
.First(a => a.Id == bookingId);
@ -9373,8 +9414,10 @@ HLCUTA12307DPXJ3 以这票为例 6个柜
if (statusList != null)
{
var maxStatus = statusList.Where(a => a.IsYield)
.OrderByDescending(a => a.WFSortNo)
.ThenByDescending(a => a.CalcSortNo).FirstOrDefault();
//.OrderByDescending(a => a.WFSortNo)
//.ThenByDescending(a => a.CalcSortNo)
.OrderByDescending(a=>a.SortNo)
.FirstOrDefault();
var model = _rep.AsQueryable().Filter(null, true)
.First(a => a.Id == bookingId);

@ -2309,7 +2309,7 @@ namespace Myshipping.Application
result.succ = true;
result.msg = "推送成功";
await _bookingOrderService.SetBookingOrderGoodsStatus(bookingOrder.Id, true);
await _bookingOrderService.SetBookingGoodsStatus(bookingOrder.Id, true);
}
}
@ -2403,7 +2403,7 @@ namespace Myshipping.Application
result.succ = true;
result.msg = "推送成功";
await _bookingOrderService.SetBookingOrderGoodsStatus(bookingOrder.Id, true);
await _bookingOrderService.SetBookingGoodsStatus(bookingOrder.Id, true);
}
}

@ -107,6 +107,6 @@ namespace Myshipping.Application
/// <param name="bookingId"></param>
/// <param name="isAutoSyncDS">是否默认同步东胜 true-自动同步 false-不自动同步</param>
/// <returns></returns>
Task SetBookingOrderGoodsStatus(long bookingId, bool isAutoSyncDS = false);
Task SetBookingGoodsStatus(long bookingId, bool isAutoSyncDS = false);
}
}

@ -240,7 +240,8 @@ namespace Myshipping.Application
var bookFilePath = await FileAttachHelper.MoveFile(bookingOrder.Id.ToString(), fileFullName, batchNo);
//将格式单附件写入订舱的附件
await SaveEDIFile(bookingOrder.Id, bookFilePath, new System.IO.FileInfo(fileFullName).Name, CONST_DRAFT_FILE_CODE, CONST_DRAFT_FILE_NAME);
await SaveEDIFile(bookingOrder.Id, bookFilePath, new System.IO.FileInfo(fileFullName).Name, entity.TenantId.Value,
CONST_DRAFT_FILE_CODE, CONST_DRAFT_FILE_NAME);
result = compareResult;
}
@ -396,11 +397,13 @@ namespace Myshipping.Application
/// <param name="boookId">订舱ID</param>
/// <param name="FilePath">文件路径</param>
/// <param name="fileName">文件名</param>
/// <param name="tenantId">租户ID</param>
/// <param name="fileTypeCode">附件类型代码</param>
/// <param name="fileTypeName">附件类型名称</param>
/// <returns></returns>
[NonAction]
private async Task SaveEDIFile(long boookId, string FilePath, string fileName, string fileTypeCode = "bc", string fileTypeName = "Booking Confirmation")
private async Task SaveEDIFile(long boookId, string FilePath, string fileName, long tenantId,
string fileTypeCode = "bc", string fileTypeName = "Booking Confirmation")
{
/*
@ -414,6 +417,7 @@ namespace Myshipping.Application
TypeCode = fileTypeCode,
TypeName = fileTypeName,
BookingId = boookId,
TenantId = tenantId
};
await _bookingFileRepository.InsertAsync(bookFile);

@ -2003,6 +2003,17 @@ namespace Myshipping.Application
int lastWFSortNo = 0;
int calcNum = 1;
var allStatus = statuList.SelectMany(b => {
var curArg = b.StatusList.SelectMany(x => x.SubStatusList).ToList();
if (curArg == null)
curArg = new List<ServiceProjectStatusDto>();
curArg.AddRange(b.StatusList);
return curArg;
}).ToList();
var resultList = statuList.Join(runList, l => l.WFPKId, r => r.WFPKId,
(l, r) => {
@ -2025,6 +2036,7 @@ namespace Myshipping.Application
ActRemark = b.ActRemark,
WFSortNo = l.SortNo,
CalcSortNo = (decimal)b.ActSortNo,
SortNo = b.SortNo
});
if(b.SubStatusList != null && b.SubStatusList.Count > 0)
@ -2038,7 +2050,8 @@ namespace Myshipping.Application
StatusSKUCode = c.StatusSKUCode,
ActRemark = c.ActRemark,
WFSortNo = l.SortNo,
CalcSortNo = (decimal)b.ActSortNo + (c.ActSortNo * 0.001m)
CalcSortNo = (decimal)b.ActSortNo + (c.ActSortNo * 0.001m),
SortNo = c.SortNo
}).ToList());
}
});
@ -2046,6 +2059,8 @@ namespace Myshipping.Application
else
{
runInfo.ActivitiesList.ForEach(b => {
var pSkuInfo = allStatus.FirstOrDefault(x => x.SkuPKId == b.StatusSKUId);
rltList.Add(new ServiceProjectStatusDto
{
ActPKId = b.ActId,
@ -2057,12 +2072,17 @@ namespace Myshipping.Application
StatusSKUCode = b.StatusSKUCode,
ActRemark = b.ActRemark,
WFSortNo = l.SortNo,
CalcSortNo = (decimal)b.ExecSortNo
CalcSortNo = (decimal)b.ExecSortNo,
SortNo = pSkuInfo != null? pSkuInfo.SortNo:0,
});
if (b.SubList != null && b.SubList.Count > 0)
{
rltList.AddRange(b.SubList.Select(c => new ServiceProjectStatusDto
b.SubList.ForEach(c =>
{
var subSkuInfo = allStatus.FirstOrDefault(x => x.SkuPKId == c.StatusSKUId);
rltList.Add(new ServiceProjectStatusDto
{
ActPKId = c.ActId,
ActSortNo = c.ExecSortNo,
@ -2073,8 +2093,11 @@ namespace Myshipping.Application
StatusSKUCode = c.StatusSKUCode,
ActRemark = c.ActRemark,
WFSortNo = l.SortNo,
CalcSortNo = (decimal)b.ExecSortNo + (c.ExecSortNo * 0.001m)
}).ToList());
CalcSortNo = (decimal)b.ExecSortNo + (c.ExecSortNo * 0.001m),
SortNo = subSkuInfo.SortNo
});
});
}
});
}

@ -10,6 +10,7 @@ using Microsoft.Extensions.Logging;
using ServiceProjectSyncWin;
using SqlSugar;
using System.Text;
using System.Text.RegularExpressions;
using static System.Net.Mime.MediaTypeNames;
Serve.RunGeneric(additional: services =>
@ -23,13 +24,18 @@ Serve.RunGeneric(additional: services =>
Console.WriteLine("开始准备同步历史服务状态数据");
var service1 = App.GetService<ISyncHisRecord>();
service1.SyncServiceProjectRecord();
//service1.SyncServiceProjectRecord();
service1.SyncServiceProjectRecord2();
Console.ReadKey();
public interface ISyncHisRecord
{
void SyncServiceProjectRecord();
void SyncServiceProjectRecord2();
//void SyncServiceProjectRecord3();
}
public class SyncHisRecord: ISyncHisRecord,ITransient
@ -350,4 +356,66 @@ public class SyncHisRecord: ISyncHisRecord,ITransient
return model;
}
public void SyncServiceProjectRecord2()
{
/*
string fmt = "(16)PortofDischarge(17)PlaceofDelivery";
var fmtList = fmt.Select(a => a).ToList();
string name = "(1P6)E PNorAt oNf GDi,scMhaArgLeA YSIA P(1E7)N PAlaNceG o,f DMeAlivLerAy YSIA";
List<char> array = new List<char>();
List<char> array2 = new List<char>();
for (var i=0;i< name.Length;i++)
{
bool isExists = false;
if(fmtList.Count > 0)
{
if (name[i] == fmtList.First())
{
array.Add(name[i]);
fmtList.Remove(fmtList[0]);
isExists = true;
}
}
if (!isExists)
array2.Add(name[i]);
}
string s1 = string.Join("", array);
string s2 = string.Join("", array2);
*/
string Consignee = "LOT 13/3,KAWASAN PERINDUSTRIAN, K AMPUNG KOLAM PADANG BESAR,02100 P ADANG BESAR,PERLIS. T EL;04-949 0507 FAX 94-949 2888";
string NotifyParty = "SHUN EE TRADING SDN BHD (1183208 U) LOT 13/3,KAWASAN PERINDUSTRIAN, K AMPUNG KOLAM PADANG BESAR,02100 P ADANG BESAR,PERLIS. T EL;04-949 0507 FAX 94-949 2888";
if (Regex.IsMatch(Consignee, "\\b[a-zA-Z]{1}\\b\\s+\\b[a-zA-Z]+\\b"))
{
Consignee = Regex.Replace(Consignee, "\\b[a-zA-Z]{1}\\b\\s+\\b[a-zA-Z]+\\b", m => Regex.Replace(m.Value, "\\s+", ""));
}
if (Regex.IsMatch(NotifyParty, "\\b[a-zA-Z]{1}\\b\\s+\\b[a-zA-Z]+\\b"))
{
NotifyParty = Regex.Replace(NotifyParty, "\\b[a-zA-Z]{1}\\b\\s+\\b[a-zA-Z]+\\b", m => Regex.Replace(m.Value, "\\s+", ""));
}
decimal similarity = 100;
for (int i = 0; i < NotifyParty.Length; i++)
{
}
}
}
Loading…
Cancel
Save