diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgCheck/UnknownAssemblys/Interfaces/IUnknownAssemblyAppService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgCheck/UnknownAssemblys/Interfaces/IUnknownAssemblyAppService.cs
index d7bf628..4bd4bcf 100644
--- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgCheck/UnknownAssemblys/Interfaces/IUnknownAssemblyAppService.cs
+++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgCheck/UnknownAssemblys/Interfaces/IUnknownAssemblyAppService.cs
@@ -64,7 +64,7 @@ namespace WY.NewJit.MsgCheck.UnknownAssemblys
///
///
///
- ObjectResultDto BatchParseAsync(BatchParseParam input);
+ //ObjectResultDto BatchParseAsync(BatchParseParam input);
///
/// 根据vin从天合mes系统中取erp总成编码列表
diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/WY.NewJit.Application.Contracts.xml b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/WY.NewJit.Application.Contracts.xml
index 8412411..c0b0ef5 100644
--- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/WY.NewJit.Application.Contracts.xml
+++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/WY.NewJit.Application.Contracts.xml
@@ -4115,13 +4115,6 @@
总成、分总成、零件三级关系实体
执行成功返回真
-
-
- 系统初始化时使用,批量解析
-
-
-
-
根据vin从天合mes系统中取erp总成编码列表
diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgBaseData/AssemblyCfgs/AssemblyCfgVehicleAppService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgBaseData/AssemblyCfgs/AssemblyCfgVehicleAppService.cs
index ba2e09d..bd14ff1 100644
--- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgBaseData/AssemblyCfgs/AssemblyCfgVehicleAppService.cs
+++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgBaseData/AssemblyCfgs/AssemblyCfgVehicleAppService.cs
@@ -123,6 +123,7 @@ namespace WY.NewJit.MsgBaseData.AssemblyCfgs
ObjectResultDto erpAssemblyObj = await _assemblyCfgErpAppService.GetErpAssemblyAsync(vehicleChildItem.ErpAssemblyId);
ret.Add(erpAssemblyObj.Item);
}
+ ret = ret.OrderBy(itm => itm.ErpAssemblyCode).ToList();
return ret;
}
else
diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/BillM100s/BillM100AppService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/BillM100s/BillM100AppService.cs
index 9534cc7..fddd690 100644
--- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/BillM100s/BillM100AppService.cs
+++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/BillM100s/BillM100AppService.cs
@@ -547,12 +547,12 @@ select * from
}
else
{
- where += " and b.BillStatus in (2,3)"; //单据状态是已匹配、已打印
+ //where += " and b.BillStatus in (2,3)"; //单据状态是已匹配、已打印
}
if (input.IsNeedReplenishPrint == true) //只显示需要补打的记录
{
- where += " and b.NeedReplenishPrint = 1";
+ //where += " and b.NeedReplenishPrint = 1";
}
sqlCnt = string.Format(sqlCnt, where);
diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/UnknownAssemblys/UnknownAssemblyAppService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/UnknownAssemblys/UnknownAssemblyAppService.cs
index 9dbe1db..fc577c8 100644
--- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/UnknownAssemblys/UnknownAssemblyAppService.cs
+++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/UnknownAssemblys/UnknownAssemblyAppService.cs
@@ -25,6 +25,8 @@ using Volo.Abp.EventBus.Distributed;
using WY.NewJit.SettleAccountFis;
using WY.NewJit.MsgTransmission.PaiGe;
using WY.NewJit.PrintTable;
+using WY.NewJit.EdiReceive.Services;
+using WY.NewJit.EdiReceive.Entitys;
namespace WY.NewJit.MsgCheck
{
@@ -61,12 +63,12 @@ namespace WY.NewJit.MsgCheck
///
/// R100报文解析及校验领域服务
///
- private readonly R100CheckDomainService _r100CheckDomainSrv;
+ //private readonly R100CheckDomainService _r100CheckDomainSrv;
///
/// M100报文解析及校验领域服务
///
- private readonly M100CheckDomainService _m100CheckDomainService;
+ //private readonly M100CheckDomainService _m100CheckDomainService;
///
/// 日志
@@ -91,12 +93,28 @@ namespace WY.NewJit.MsgCheck
///
/// 零件基本信息
///
- private readonly IRepository _partCfgRepository;
+ //private readonly IRepository _partCfgRepository;
+
+ ///
+ /// 缓存管理 领域服务
+ ///
+ private readonly HQ_CacheManagerDomainService _hqCacheManagerDomainService;
+
+ ///
+ /// 报文解析 领域服务
+ ///
+ private readonly EdiParseDomainService _ediParseDomainService;
+
+ ///
+ /// 导入记录仓储
+ ///
+ private readonly IRepository _importRecordRepository;
+
///
/// 结算件切换列表
///
- private List _partSwitchList = new List();
+ //private List _partSwitchList = new List();
///
/// 结算件信息列表
@@ -131,13 +149,16 @@ namespace WY.NewJit.MsgCheck
IBlobContainer blobContainer,
IRepository assemblyCfgErpRepository,
MsgTransmissionAppService msgTransmissionAppService,
- R100CheckDomainService r100CheckDomainSrv,
- M100CheckDomainService m100CheckDomainService,
+ //R100CheckDomainService r100CheckDomainSrv,
+ //M100CheckDomainService m100CheckDomainService,
IDistributedEventBus distributedEventBus,
- IRepository partCfgRepository,
+ //IRepository partCfgRepository,
IRepository waitPrintRepository,
- M100DomainService m100DomainService
- )
+ M100DomainService m100DomainService,
+ HQ_CacheManagerDomainService hqCacheManagerDomainService
+,
+ EdiParseDomainService ediParseDomainService,
+ IRepository importRecordRepository)
{
_UnknownAssemblyRepository = UnknownAssemblyRepository;
_UnknownAssemblyPartRepository = UnknownAssemblyPartRepository;
@@ -154,12 +175,15 @@ namespace WY.NewJit.MsgCheck
_blobContainer = blobContainer;
_assemblyCfgErpRepository = assemblyCfgErpRepository;
_msgTransmissionAppService = msgTransmissionAppService;
- _r100CheckDomainSrv = r100CheckDomainSrv;
- _m100CheckDomainService = m100CheckDomainService;
+ //_r100CheckDomainSrv = r100CheckDomainSrv;
+ //_m100CheckDomainService = m100CheckDomainService;
_distributedEventBus = distributedEventBus;
- _partCfgRepository = partCfgRepository;
+ //_partCfgRepository = partCfgRepository;
_waitPrintRepository = waitPrintRepository;
_m100DomainService = m100DomainService;
+ _hqCacheManagerDomainService = hqCacheManagerDomainService;
+ _ediParseDomainService = ediParseDomainService;
+ _importRecordRepository = importRecordRepository;
}
#endregion
@@ -174,8 +198,8 @@ namespace WY.NewJit.MsgCheck
string sqlCnt = @"
with b as
(
- select Id,HostSN,KNR,'' as VIN,AssemblyID,OnlineTime,ReceiveTime,VehicleModelCode,ProductLine,[Version],BillStatus from FisBillR100 where BillStatus =1
- union all
+ -- select Id,HostSN,KNR,'' as VIN,AssemblyID,OnlineTime,ReceiveTime,VehicleModelCode,ProductLine,[Version],BillStatus from FisBillR100 where BillStatus =1
+ -- union all
select Id,HostSN,KNR,VIN,AssemblyID,OnlineTime,ReceiveTime,VehicleModelCode,ProductLine,[Version],BillStatus from FisBillM100 where BillStatus =1
)
,d as
@@ -188,7 +212,7 @@ select * from
from FisUnknownAssembly a
join b on a.BillID = b.Id
left join d on b.VehicleModelCode = d.DicItemCode
- where a.IsDeleted <> 1 {0}
+ where a.IsDeleted = 0 {0}
) t
";
@@ -196,8 +220,8 @@ select * from
with b as
(
- select Id,HostSN,KNR,'' as VIN,AssemblyID,OnlineTime,ReceiveTime,VehicleModelCode,ProductLine,[Version],BillStatus, Description, SerialNumStr from FisBillR100 where BillStatus =1
- union all
+ -- select Id,HostSN,KNR,'' as VIN,AssemblyID,OnlineTime,ReceiveTime,VehicleModelCode,ProductLine,[Version],BillStatus, Description, SerialNumStr from FisBillR100 where BillStatus =1
+ -- union all
select Id,HostSN,KNR,VIN,AssemblyID,OnlineTime,ReceiveTime,VehicleModelCode,ProductLine,[Version],BillStatus, Description, SerialNumStr from FisBillM100 where BillStatus =1
)
,d as
@@ -211,7 +235,7 @@ select * from
from FisUnknownAssembly a
join b on a.BillID = b.Id
left join d on b.VehicleModelCode = d.DicItemCode
- where a.IsDeleted <> 1 {0}
+ where a.IsDeleted = 0 {0}
) t where row_number between {1} and {2}
";
string where = "";
@@ -281,28 +305,28 @@ select * from
return ret;
}
- [UnitOfWork]
- private bool OneParseAsync(Guid unknownAssemblyId)
- {
- bool isMatch = false;
- //根据未知总成ID取单据Id
- UnknownAssembly unknownAssemblyObj = _UnknownAssemblyRepository.GetAsync(unknownAssemblyId, false).GetAwaiter().GetResult();
- if (unknownAssemblyObj.ScanPoint == "R100")//!!
- {
- }
- else if (unknownAssemblyObj.ScanPoint == "M100")
- {
- //天合版本的匹配总成算法:
- //匹配上时:插入整车总成配置表、更新单据表的整车总成ID字段、返回true
- //匹配不上时返回false
- //isMatch = _msgTransmissionAppServiceTianHe.MatchAssembly_Init(unknownAssemblyObj.BillID);
- var billObj = _billM100Repository.GetAsync(unknownAssemblyObj.BillID).GetAwaiter().GetResult();
- _m100CheckDomainService.DoMatchAssembly(billObj);
- }
- unknownAssemblyObj.SetExtraProperties("1");
- _UnknownAssemblyRepository.UpdateAsync(unknownAssemblyObj).GetAwaiter().GetResult();
- return isMatch;
- }
+ //[UnitOfWork]
+ //private bool OneParseAsync(Guid unknownAssemblyId)
+ //{
+ // bool isMatch = false;
+ // //根据未知总成ID取单据Id
+ // UnknownAssembly unknownAssemblyObj = _UnknownAssemblyRepository.GetAsync(unknownAssemblyId, false).GetAwaiter().GetResult();
+ // if (unknownAssemblyObj.ScanPoint == "R100")//!!
+ // {
+ // }
+ // else if (unknownAssemblyObj.ScanPoint == "M100")
+ // {
+ // //天合版本的匹配总成算法:
+ // //匹配上时:插入整车总成配置表、更新单据表的整车总成ID字段、返回true
+ // //匹配不上时返回false
+ // //isMatch = _msgTransmissionAppServiceTianHe.MatchAssembly_Init(unknownAssemblyObj.BillID);
+ // var billObj = _billM100Repository.GetAsync(unknownAssemblyObj.BillID).GetAwaiter().GetResult();
+ // _m100CheckDomainService.DoMatchAssembly(billObj);
+ // }
+ // unknownAssemblyObj.SetExtraProperties("1");
+ // _UnknownAssemblyRepository.UpdateAsync(unknownAssemblyObj).GetAwaiter().GetResult();
+ // return isMatch;
+ //}
private FISVersionEto ConvertToFISVersion(List m100BillList)
{
@@ -434,147 +458,147 @@ select * from
return isEqual;
}
- private void DoInitLoadCache()
- {
- //取全部整车总成ID
- string vehicleSql = "select Id, VehicleModelCode as VehicleModel from FisAssemblyCfgVehicle v where NewVersionId is null order by CreationTime desc";
- List vehicleAssemblyIdList = _newJitDapperRepository.GetListBySql(vehicleSql, true);
-
- //取全部零件:按整车总成Id、零件编码分组汇总数量
- const string vehicle2PartSql = @"
- select v.Id as VehicleAssemblyId, ep.PartCode, sum(ep.PartNum) as PartNum
- from FisAssemblyCfgVehicle v
- join FisAssemblyCfgVehicleChild vc on v.Id = vc.AssemblyCfgVehicleId
- join FisAssemblyCfgErp e on vc.ErpAssemblyId = e.Id
- join FisAssemblyCfgPart ep on e.Id = ep.AssemblyCfgErpId
- where 1=1 and not exists (select PartCode from FisPartCfg pc where IsDisable = 1 and ep.PartCode = pc.PartCode)
- and v.NewVersionId is null
- and ep.PartCode is not null
- group by v.Id, ep.PartCode
- order by v.Id, ep.PartCode
- ";
- var vehicle2partList = _newJitDapperRepository.GetListBySql(vehicle2PartSql, true);
-
- //取Erp总成
- string erpMainSql = "select Id, VehicleModel from FisAssemblyCfgErp where NewVersionId is null order by ErpAssemblyVersion, CreationTime desc";
- List erpAssemblyMainList = _newJitDapperRepository.GetListBySql(erpMainSql, true);
-
- List erp2partList = new List();
- if (ConfigDic.CurrentVersion == ConfigDicVersionOption.派格)
- {
- //取所有零件(IsDisable = 1时表示不需要解析BOM)
- string erp2partSql = @"
- select e.GroupId, e.Id as ErpAssemblyId, e.ErpAssemblyCode, ep.Id as PartId, ep.PartCode, ep.PartNum, ep.IsKey
- from FisAssemblyCfgErp e
- join FisAssemblyCfgPart ep on e.Id = ep.AssemblyCfgErpId
- where ep.PartCode is not null
- and not exists (select PartCode from FisPartCfg pc where IsDisable = 1 and ep.PartCode = pc.PartCode)
- ";
- erp2partList = _newJitDapperRepository.GetListBySql(erp2partSql, true);
-
- //结算件切换列表
- string partSwitchSql = "select SourcePartCode,TargetPartCode,ActiveBeginTime,ActiveEndTime from FisPartSwitch";
- _partSwitchList = _newJitDapperRepository.GetListBySql(partSwitchSql, true);
-
- }
- else
- {
- //取所有零件(IsDisable = 1时表示不需要解析BOM)
- string erp2partSql = @"
- select e.Id as ErpAssemblyId, e.ErpAssemblyCode, ep.Id as PartId, ep.PartCode, ep.PartNum, ep.IsKey
- from FisAssemblyCfgErp e
- join FisAssemblyCfgPart ep on e.Id = ep.AssemblyCfgErpId
- where e.NewVersionId is null
- and ep.PartCode is not null
- and not exists (select PartCode from FisPartCfg pc where IsDisable = 1 and ep.PartCode = pc.PartCode)
- ";
- erp2partList = _newJitDapperRepository.GetListBySql(erp2partSql, true);
- }
-
- _r100CheckDomainSrv.InitPub(vehicleAssemblyIdList, vehicle2partList, erpAssemblyMainList, erp2partList, _partSwitchList); //整车总成内存及时刷新, ERP总成增删改时触发刷新标志
- _m100CheckDomainService.InitPub(vehicleAssemblyIdList, vehicle2partList, erpAssemblyMainList, erp2partList, _partSwitchList);
-
- #region 无法缓存的
- //结算件信息列表,库存系统同步过来,无法缓存
- string partCfgSql = @"select Id, PartCode, PartName, PartType, Description, PartType2, PartType3, RelationKey from FisPartCfg where 1=1"; //,DaXiaoLiangGang,DoorPlankCode,MaterialDescription,SAPMaterialNum
- _partCfgList = _newJitDapperRepository.GetListBySql(partCfgSql, true);
- #endregion
-
- }
-
- private void DifferenceMenBan_ZhuHuBan(BillResult billResObj)
- {
- //根据物料组区分门板、柱护板, 柱护板不参与匹配,但是参与发货
- if (ConfigDic.CurrentVersion == ConfigDicVersionOption.派格)
- {
- if (billResObj.R100Bill != null)
- {
- if (billResObj.R100Bill.VehicleModelCode == "Q5")
- {
- foreach (BillR100Part billPart in billResObj.R100Bill.BillR100Parts)
- {
- PartCfg partObj = _partCfgList.FirstOrDefault(itm => itm.PartCode == billPart.PartCode);
- if (partObj != null)
- {
- billPart.PartType = partObj.PartType;
- billPart.Description = partObj.PartType == "2" ? "柱护板" : "控制件";
- billPart.PartType2 = partObj.PartType2;
- }
- else
- {
- billPart.PartType = "1";
- billPart.Description = "控制件";
- string errorMsg = $"R100结算件{billPart.PartCode}在结算件信息表中不存在!KNR={billResObj.R100Bill.KNR}";
- //throw new Exception(errorMsg); ////???? 此处需要优化,不触发异常,直接入库
- //_logRemindDomainService.WriteLogRemind("报文解析", errorMsg, LogTypeEnum.R100);
- _logger.LogError(errorMsg);
- }
- }
- }
- else //除Q5,其它车型没有柱护板
- {
- foreach (BillR100Part partItm in billResObj.R100Bill.BillR100Parts)
- {
- partItm.PartType = "1";
- partItm.Description = "控制件";
- }
- }
- }
- else if (billResObj.M100Bill != null)
- {
- if (billResObj.M100Bill.VehicleModelCode == "Q5")
- {
- foreach (BillM100Part billPart in billResObj.M100Bill.BillM100Parts)
- {
- PartCfg partObj = _partCfgList.FirstOrDefault(itm => itm.PartCode == billPart.PartCode);
- if (partObj != null)
- {
- billPart.PartType = partObj.PartType;
- billPart.Description = partObj.PartType == "2" ? "柱护板" : "控制件";
- billPart.PartType2 = partObj.PartType2;
- }
- else
- {
- billPart.PartType = "1";
- billPart.Description = "控制件";
- string errorMsg = $"M100结算件{billPart.PartCode}在结算件信息表中不存在!VIN={billResObj.M100Bill.VIN}";
- //_logRemindDomainService.WriteLogRemind("报文解析", errorMsg, LogTypeEnum.M100);
- _logger.LogError(errorMsg);
- //throw new Exception(errorMsg);
- }
- }
- }
- else
- {
- foreach (BillM100Part partItm in billResObj.M100Bill.BillM100Parts)
- {
- partItm.PartType = "1";
- partItm.Description = "控制件";
- }
- }
- }
- }
- }
+ //private void DoInitLoadCache()
+ //{
+ // //取全部整车总成ID
+ // string vehicleSql = "select Id, VehicleModelCode as VehicleModel from FisAssemblyCfgVehicle v where NewVersionId is null order by CreationTime desc";
+ // List vehicleAssemblyIdList = _newJitDapperRepository.GetListBySql(vehicleSql, true);
+
+ // //取全部零件:按整车总成Id、零件编码分组汇总数量
+ // const string vehicle2PartSql = @"
+ // select v.Id as VehicleAssemblyId, ep.PartCode, sum(ep.PartNum) as PartNum
+ // from FisAssemblyCfgVehicle v
+ // join FisAssemblyCfgVehicleChild vc on v.Id = vc.AssemblyCfgVehicleId
+ // join FisAssemblyCfgErp e on vc.ErpAssemblyId = e.Id
+ // join FisAssemblyCfgPart ep on e.Id = ep.AssemblyCfgErpId
+ // where 1=1 and not exists (select PartCode from FisPartCfg pc where IsDisable = 1 and ep.PartCode = pc.PartCode)
+ // and v.NewVersionId is null
+ // and ep.PartCode is not null
+ // group by v.Id, ep.PartCode
+ // order by v.Id, ep.PartCode
+ // ";
+ // var vehicle2partList = _newJitDapperRepository.GetListBySql(vehicle2PartSql, true);
+
+ // //取Erp总成
+ // string erpMainSql = "select Id, VehicleModel from FisAssemblyCfgErp where NewVersionId is null order by ErpAssemblyVersion, CreationTime desc";
+ // List erpAssemblyMainList = _newJitDapperRepository.GetListBySql(erpMainSql, true);
+
+ // List erp2partList = new List();
+ // if (ConfigDic.CurrentVersion == ConfigDicVersionOption.派格)
+ // {
+ // //取所有零件(IsDisable = 1时表示不需要解析BOM)
+ // string erp2partSql = @"
+ // select e.GroupId, e.Id as ErpAssemblyId, e.ErpAssemblyCode, ep.Id as PartId, ep.PartCode, ep.PartNum, ep.IsKey
+ // from FisAssemblyCfgErp e
+ // join FisAssemblyCfgPart ep on e.Id = ep.AssemblyCfgErpId
+ // where ep.PartCode is not null
+ // and not exists (select PartCode from FisPartCfg pc where IsDisable = 1 and ep.PartCode = pc.PartCode)
+ // ";
+ // erp2partList = _newJitDapperRepository.GetListBySql(erp2partSql, true);
+
+ // //结算件切换列表
+ // string partSwitchSql = "select SourcePartCode,TargetPartCode,ActiveBeginTime,ActiveEndTime from FisPartSwitch";
+ // _partSwitchList = _newJitDapperRepository.GetListBySql(partSwitchSql, true);
+
+ // }
+ // else
+ // {
+ // //取所有零件(IsDisable = 1时表示不需要解析BOM)
+ // string erp2partSql = @"
+ // select e.Id as ErpAssemblyId, e.ErpAssemblyCode, ep.Id as PartId, ep.PartCode, ep.PartNum, ep.IsKey
+ // from FisAssemblyCfgErp e
+ // join FisAssemblyCfgPart ep on e.Id = ep.AssemblyCfgErpId
+ // where e.NewVersionId is null
+ // and ep.PartCode is not null
+ // and not exists (select PartCode from FisPartCfg pc where IsDisable = 1 and ep.PartCode = pc.PartCode)
+ // ";
+ // erp2partList = _newJitDapperRepository.GetListBySql(erp2partSql, true);
+ // }
+
+ // _r100CheckDomainSrv.InitPub(vehicleAssemblyIdList, vehicle2partList, erpAssemblyMainList, erp2partList, _partSwitchList); //整车总成内存及时刷新, ERP总成增删改时触发刷新标志
+ // _m100CheckDomainService.InitPub(vehicleAssemblyIdList, vehicle2partList, erpAssemblyMainList, erp2partList, _partSwitchList);
+
+ // #region 无法缓存的
+ // //结算件信息列表,库存系统同步过来,无法缓存
+ // string partCfgSql = @"select Id, PartCode, PartName, PartType, Description, PartType2, PartType3, RelationKey from FisPartCfg where 1=1"; //,DaXiaoLiangGang,DoorPlankCode,MaterialDescription,SAPMaterialNum
+ // _partCfgList = _newJitDapperRepository.GetListBySql(partCfgSql, true);
+ // #endregion
+
+ //}
+
+ //private void DifferenceMenBan_ZhuHuBan(BillResult billResObj)
+ //{
+ // //根据物料组区分门板、柱护板, 柱护板不参与匹配,但是参与发货
+ // if (ConfigDic.CurrentVersion == ConfigDicVersionOption.派格)
+ // {
+ // if (billResObj.R100Bill != null)
+ // {
+ // if (billResObj.R100Bill.VehicleModelCode == "Q5")
+ // {
+ // foreach (BillR100Part billPart in billResObj.R100Bill.BillR100Parts)
+ // {
+ // PartCfg partObj = _partCfgList.FirstOrDefault(itm => itm.PartCode == billPart.PartCode);
+ // if (partObj != null)
+ // {
+ // billPart.PartType = partObj.PartType;
+ // billPart.Description = partObj.PartType == "2" ? "柱护板" : "控制件";
+ // billPart.PartType2 = partObj.PartType2;
+ // }
+ // else
+ // {
+ // billPart.PartType = "1";
+ // billPart.Description = "控制件";
+ // string errorMsg = $"R100结算件{billPart.PartCode}在结算件信息表中不存在!KNR={billResObj.R100Bill.KNR}";
+ // //throw new Exception(errorMsg); ////???? 此处需要优化,不触发异常,直接入库
+ // //_logRemindDomainService.WriteLogRemind("报文解析", errorMsg, LogTypeEnum.R100);
+ // _logger.LogError(errorMsg);
+ // }
+ // }
+ // }
+ // else //除Q5,其它车型没有柱护板
+ // {
+ // foreach (BillR100Part partItm in billResObj.R100Bill.BillR100Parts)
+ // {
+ // partItm.PartType = "1";
+ // partItm.Description = "控制件";
+ // }
+ // }
+ // }
+ // else if (billResObj.M100Bill != null)
+ // {
+ // if (billResObj.M100Bill.VehicleModelCode == "Q5")
+ // {
+ // foreach (BillM100Part billPart in billResObj.M100Bill.BillM100Parts)
+ // {
+ // PartCfg partObj = _partCfgList.FirstOrDefault(itm => itm.PartCode == billPart.PartCode);
+ // if (partObj != null)
+ // {
+ // billPart.PartType = partObj.PartType;
+ // billPart.Description = partObj.PartType == "2" ? "柱护板" : "控制件";
+ // billPart.PartType2 = partObj.PartType2;
+ // }
+ // else
+ // {
+ // billPart.PartType = "1";
+ // billPart.Description = "控制件";
+ // string errorMsg = $"M100结算件{billPart.PartCode}在结算件信息表中不存在!VIN={billResObj.M100Bill.VIN}";
+ // //_logRemindDomainService.WriteLogRemind("报文解析", errorMsg, LogTypeEnum.M100);
+ // _logger.LogError(errorMsg);
+ // //throw new Exception(errorMsg);
+ // }
+ // }
+ // }
+ // else
+ // {
+ // foreach (BillM100Part partItm in billResObj.M100Bill.BillM100Parts)
+ // {
+ // partItm.PartType = "1";
+ // partItm.Description = "控制件";
+ // }
+ // }
+ // }
+ // }
+ //}
#endregion
@@ -637,22 +661,21 @@ select * from
throw new Exception("不是R100或M100!");
}
//填充零件类型
- if (vehicleModel == "Q5")
- {
- foreach (UnknownAssemblyPartDto partDto in targetObj.UnknownAssemblyParts)
- {
- var tempObj = await _partCfgRepository.FirstOrDefaultAsync(itm => itm.PartCode == partDto.PartCode);
- if (tempObj != null)
- {
- partDto.PartType = tempObj.PartType;
- }
- else
- {
- throw new Exception("Q5车型的零件在零件配置中没有对应!");
- }
- }
-
- }
+ //if (vehicleModel == "Q5")
+ //{
+ // foreach (UnknownAssemblyPartDto partDto in targetObj.UnknownAssemblyParts)
+ // {
+ // var tempObj = await _partCfgRepository.FirstOrDefaultAsync(itm => itm.PartCode == partDto.PartCode);
+ // if (tempObj != null)
+ // {
+ // partDto.PartType = tempObj.PartType;
+ // }
+ // else
+ // {
+ // throw new Exception("Q5车型的零件在零件配置中没有对应!");
+ // }
+ // }
+ //}
ret.Item = targetObj;
return ret;
@@ -836,8 +859,8 @@ select * from
string sql = @"
with b as
(
- select Id from FisBillR100 where BillStatus =1
- union all
+ -- select Id from FisBillR100 where BillStatus =1
+ -- union all
select Id from FisBillM100 where BillStatus =1
)
select a.Id from FisUnknownAssembly a where IsDeleted = 0 and BillID in (select Id from b)
@@ -850,89 +873,35 @@ select * from
}
int matchNum = 0;
int notMatchNum = 0;
-
- DoInitLoadCache(); //新版初始化缓存
-
- //取所有总成包含的子零件列表
- string allAssemblyPartSql = @"
- select distinct p.PartCode
- from FisAssemblyCfgGroup g
- join FisAssemblyCfgErp e on g.Id = e.GroupId
- join FisAssemblyCfgPart p on e.Id = p.AssemblyCfgErpId
- where g.IsDisable <> 1
- ";
- List allAssemblyPartLst =_newJitDapperRepository.GetListBySql(allAssemblyPartSql, true);
+ //新版初始化缓存
+ //DoInitLoadCache();
+ _hqCacheManagerDomainService.InitLoadCache(true);
foreach (Guid selId in selLst)
{
//根据未知总成ID取单据Id
- UnknownAssembly unknownAssemblyObj = await _UnknownAssemblyRepository.GetAsync(selId, false);
- if (unknownAssemblyObj.ScanPoint == "R100")
+ UnknownAssembly unknownAssemblyObj = await _UnknownAssemblyRepository.GetAsync(selId, false);
+
+ BillM100 m100Obj = await _billM100Repository.GetAsync(unknownAssemblyObj.BillID, false);
+ if (m100Obj.MessageFileReceiveID == null)
{
- //根据单据Id取单据信息
- BillR100 r100Obj = await _billR100Repository.GetAsync(unknownAssemblyObj.BillID);
- //Q5车型区分控制件、柱护板
- BillResult billResObj = new BillResult();
- billResObj.R100Bill = r100Obj;
- DifferenceMenBan_ZhuHuBan(billResObj);
- //匹配上时:插入整车总成配置表、更新单据表的整车总成ID字段、返回true
- //匹配不上时返回false
- bool isMatch = _r100CheckDomainSrv.DoMatchAssembly(r100Obj, true, true);
- if (isMatch)
- {
- matchNum++;
- }
- else
- {
- notMatchNum++;
- var billNotExistPartLst = r100Obj.BillR100Parts.Where(itm => itm.PartType == "1" && allAssemblyPartLst.Contains(itm.PartCode) == false).ToList();
- if (billNotExistPartLst.Count > 0)
- {
- string desc = "如下是新零件,在总成子零件中不存在:" + billNotExistPartLst.Select(itm => itm.PartCode).Distinct().JoinAsString(",");
- unknownAssemblyObj.Description = desc;
- await _UnknownAssemblyRepository.UpdateAsync(unknownAssemblyObj);
- }
- }
+ throw new Exception("M100表的MessageFileReceiveID字段值不能为空:" + m100Obj.HostSN2.ToString());
}
- else if (unknownAssemblyObj.ScanPoint == "M100")
+ ImportRecord impRecObj = await _importRecordRepository.GetAsync((Guid)(m100Obj.MessageFileReceiveID));
+ string specExplain = impRecObj.SpecDesc;
+ string colorExplain = impRecObj.VehicleModelDesc.Trim().Right(7);
+ ObjectResultDto repasingRet = await _ediParseDomainService.ReParsing(m100Obj, specExplain, colorExplain);
+ if (repasingRet.Status == false)
{
- //根据单据Id取单据信息
- BillM100 m100Obj = await _billM100Repository.GetAsync(unknownAssemblyObj.BillID);
- string curPL = m100Obj.ProductLine;
- string curSNStr = m100Obj.SerialNumStr;
- //Q5车型区分控制件、柱护板
- BillResult billResObj = new BillResult();
- billResObj.M100Bill = m100Obj;
- DifferenceMenBan_ZhuHuBan(billResObj);
- //匹配上时:插入整车总成配置表、更新单据表的整车总成ID字段、返回true
- //匹配不上时返回false
- bool isMatch = _m100CheckDomainService.DoMatchAssembly(m100Obj, true, true);
- if (isMatch)
- {
- matchNum++;
- //判断未打印表是否有数据,有则更新,没有则插入
- ObjectResultDto res = await _m100DomainService.InsertOrUpdateWaitPrintByM100(m100Obj);
-
- #region 当前单据在未匹配时已经参与打印,重新解析后进入补打
- //bool hasPrintData = _billM100Repository.Any(itm => itm.ProductLine == curPL && itm.SerialNumStr.CompareTo(curSNStr) > 0 && itm.BillStatus == BillStatusEnum.Publish);
- //if (hasPrintData) //该单据处于未解析时,已经打印
- //{
- // m100Obj.NeedReplenishPrint = 1;
- // await _billM100Repository.UpdateAsync(m100Obj);
- //}
- #endregion
- }
- else
- {
- notMatchNum++;
- var billNotExistPartLst = m100Obj.BillM100Parts.Where(itm => itm.PartType == "1" && allAssemblyPartLst.Contains(itm.PartCode) == false).ToList();
- if (billNotExistPartLst.Count > 0)
- {
- string desc = "如下是新零件,在总成子零件中不存在:" + billNotExistPartLst.Select(itm => itm.PartCode).Distinct().JoinAsString(",");
- unknownAssemblyObj.Description = desc;
- await _UnknownAssemblyRepository.UpdateAsync(unknownAssemblyObj);
- }
- }
+ throw new Exception(repasingRet.Message);
+ }
+ if (repasingRet.Item == true)
+ {
+ matchNum++;
+ }
+ else
+ {
+ notMatchNum++;
}
} //foreach
@@ -962,74 +931,73 @@ select * from
///
///
///
- [HttpPost]
- //[UnitOfWork(true)]
- [Route("batch-parse")]
- public virtual ObjectResultDto BatchParseAsync(BatchParseParam input)
- {
- _logger.LogDebug(_errorMessagePrefix + "BatchParseAsync 进入");
- //批量删除未匹配单据
- //string delSql = "delete from FisNotMatchTempBill";
- // _newJitDapperRepository.ExecuteSql(delSql, null, true);
-
- ObjectResultDto ret = new ObjectResultDto();
- try
- {
- string sql = @"
- with b as
- (
- select Id, OnlineTime from FisBillM100 where BillStatus =1 {1}
- )
- select top {0} a.Id from FisUnknownAssembly a
- join b on a.BillId = b.Id
- where a.IsDeleted <> 1 and a.ExtraProperties is null
- order by b.OnlineTime desc
- ";
- int takeCount = input.TakeCount;
- string sqlWhere = "";
- if (input.BeginDate != null && input.EndDate != null)
- {
- sqlWhere = "and OnlineTime between convert(datetime,'{0}', 20) and convert(datetime,'{1}', 20)";
- sqlWhere = string.Format(sqlWhere, ((DateTime)input.BeginDate).ToString("yyyy-MM-dd HH:mm:ss"), ((DateTime)input.EndDate).ToString("yyyy-MM-dd HH:mm:ss"));
- }
-
- sql = string.Format(sql, takeCount, sqlWhere);
- List selLst = _newJitDapperRepository.GetListBySql(sql, true);
-
- int matchNum = 0;
- int notMatchNum = 0;
-
- //_msgTransmissionAppService.ClearPub();
- _msgTransmissionAppService.InitPub();
- foreach (Guid selId in selLst)
- {
- bool isMatch = OneParseAsync(selId);
- if (isMatch)
- {
- matchNum++;
- }
- else
- {
- notMatchNum++;
- }
-
- } //foreach
-
- ret.Status = true;
- ret.Message = $"本次共重新解析{matchNum + notMatchNum}条,其中匹配{matchNum}条、不匹配{notMatchNum}条";
- ret.Item = ret.Message;
- _logger.LogDebug(_errorMessagePrefix + "BatchParseAsync 完成:" + ret.Message);
-
- return ret;
- }
- catch (Exception ex)
- {
- ret.Status = false;
- ret.Message = _errorMessagePrefix + "BatchParseAsync 执行出错:" + ex.Message;
- _logger.LogError(ret.Message);
- return ret;
- }
- }
+ // [HttpPost]
+ // [Route("batch-parse")]
+ // public virtual ObjectResultDto BatchParseAsync(BatchParseParam input)
+ // {
+ // _logger.LogDebug(_errorMessagePrefix + "BatchParseAsync 进入");
+ // //批量删除未匹配单据
+ // //string delSql = "delete from FisNotMatchTempBill";
+ // // _newJitDapperRepository.ExecuteSql(delSql, null, true);
+
+ // ObjectResultDto ret = new ObjectResultDto();
+ // try
+ // {
+ // string sql = @"
+ // with b as
+ // (
+ // select Id, OnlineTime from FisBillM100 where BillStatus =1 {1}
+ // )
+ // select top {0} a.Id from FisUnknownAssembly a
+ //join b on a.BillId = b.Id
+ //where a.IsDeleted <> 1 and a.ExtraProperties is null
+ //order by b.OnlineTime desc
+ // ";
+ // int takeCount = input.TakeCount;
+ // string sqlWhere = "";
+ // if (input.BeginDate != null && input.EndDate != null)
+ // {
+ // sqlWhere = "and OnlineTime between convert(datetime,'{0}', 20) and convert(datetime,'{1}', 20)";
+ // sqlWhere = string.Format(sqlWhere, ((DateTime)input.BeginDate).ToString("yyyy-MM-dd HH:mm:ss"), ((DateTime)input.EndDate).ToString("yyyy-MM-dd HH:mm:ss"));
+ // }
+
+ // sql = string.Format(sql, takeCount, sqlWhere);
+ // List selLst = _newJitDapperRepository.GetListBySql(sql, true);
+
+ // int matchNum = 0;
+ // int notMatchNum = 0;
+
+ // //_msgTransmissionAppService.ClearPub();
+ // _msgTransmissionAppService.InitPub();
+ // foreach (Guid selId in selLst)
+ // {
+ // bool isMatch = OneParseAsync(selId);
+ // if (isMatch)
+ // {
+ // matchNum++;
+ // }
+ // else
+ // {
+ // notMatchNum++;
+ // }
+
+ // } //foreach
+
+ // ret.Status = true;
+ // ret.Message = $"本次共重新解析{matchNum + notMatchNum}条,其中匹配{matchNum}条、不匹配{notMatchNum}条";
+ // ret.Item = ret.Message;
+ // _logger.LogDebug(_errorMessagePrefix + "BatchParseAsync 完成:" + ret.Message);
+
+ // return ret;
+ // }
+ // catch (Exception ex)
+ // {
+ // ret.Status = false;
+ // ret.Message = _errorMessagePrefix + "BatchParseAsync 执行出错:" + ex.Message;
+ // _logger.LogError(ret.Message);
+ // return ret;
+ // }
+ // }
///
/// 根据vin从天合mes系统中取erp总成编码列表
diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml
index 67dfb75..fcee04f 100644
--- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml
+++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml
@@ -1787,16 +1787,6 @@
ERP总成仓储
-
-
- R100报文解析及校验领域服务
-
-
-
-
- M100报文解析及校验领域服务
-
-
日志
@@ -1817,14 +1807,19 @@
事物总线仓库
-
+
- 零件基本信息
+ 缓存管理 领域服务
-
+
- 结算件切换列表
+ 报文解析 领域服务
+
+
+
+
+ 导入记录仓储
@@ -1837,7 +1832,7 @@
错误信息前缀
-
+
构造函数
@@ -1912,13 +1907,6 @@
总成、分总成、零件三级关系实体
执行成功返回真
-
-
- 系统初始化时使用,批量解析【天合版本】
-
-
-
-
根据vin从天合mes系统中取erp总成编码列表
diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/EdiParseDomainService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/EdiParseDomainService.cs
index 959d1ab..019516e 100644
--- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/EdiParseDomainService.cs
+++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/EdiParseDomainService.cs
@@ -163,7 +163,7 @@ namespace WY.NewJit.EdiReceive.Services
List notRepeatOrder = await GetNotRepeatOrder(input);
if (notRepeatOrder.Count == 0)
{
- ret.Status = true;
+ ret.Status = false;
ret.Message = "根据Vin和HostSN,排除在数据库中重复的Excel订单后,已经没有不重复的订单!";
return ret;
}
@@ -172,6 +172,7 @@ namespace WY.NewJit.EdiReceive.Services
string betweenBreakNumMsg = await CheckBetweenBreakNum(input);
//校验本次导入数据是否断号
string breakNumMsg = CheckBreakNum(ref notRepeatOrder);
+
if (betweenBreakNumMsg.HasValue() || breakNumMsg.HasValue())
{
if (forceExecute == false)
@@ -212,8 +213,9 @@ namespace WY.NewJit.EdiReceive.Services
}
//绑定总成分组
+ string specExplain = orderItem.SpecDesc;
string colorExplain = orderItem.VehicleModelDesc.Trim().Right(7);
- Group_Assembly groupAssemblyObj = HQ_CacheManagerDomainService._groupAssemblyList.FirstOrDefault(itm => itm.SpecExplain == orderItem.SpecDesc && itm.ColorExplain == colorExplain);
+ Group_Assembly groupAssemblyObj = HQ_CacheManagerDomainService._groupAssemblyList.FirstOrDefault(itm => itm.SpecExplain == specExplain && itm.ColorExplain == colorExplain);
if (groupAssemblyObj != null)
{
#region 插入整车总成
@@ -234,6 +236,10 @@ namespace WY.NewJit.EdiReceive.Services
m100Obj.SetAssemblyID(vehicleAssemblyResu.Id);
m100Obj.SetBillStatus(BillStatusEnum.Match);
var insM100Ret = await _hqM100DomainServie.InsertM100(m100Obj, true);
+ if (insM100Ret == null)
+ {
+ throw new Exception("插入M100返回结果为空InsertAsync!");
+ }
}
else
{
@@ -259,6 +265,62 @@ namespace WY.NewJit.EdiReceive.Services
return ret;
}
+ ///
+ /// 未知总成-重新解析
+ ///
+ ///
+ ///
+ ///
+ ///
+ public async Task> ReParsing(BillM100 m100Obj, string specExplain, string colorExplain)
+ {
+ ObjectResultDto ret = new ObjectResultDto();
+ Group_Assembly groupAssemblyObj = HQ_CacheManagerDomainService._groupAssemblyList.FirstOrDefault(itm => itm.SpecExplain == specExplain && itm.ColorExplain == colorExplain);
+ if (groupAssemblyObj != null)
+ {
+ #region 插入整车总成
+ Guid vehicleAssemblyId = GuidGenerator.Create();
+ AssemblyCfgVehicle vehicleAssemblyCfgObj = new AssemblyCfgVehicle(vehicleAssemblyId, null, m100Obj.VehicleModelCode, null, true);
+ foreach (OnlyAssemblyInfo assemblyItem in groupAssemblyObj.AssemblyDetails) //插入子表
+ {
+ vehicleAssemblyCfgObj.AddChildObj(GuidGenerator.Create(), assemblyItem.Id);
+ }
+ var vehicleAssemblyResu = await _assemblyCfgVehicleRepository.InsertAsync(vehicleAssemblyCfgObj, true);
+ if (vehicleAssemblyResu == null)
+ {
+ throw new Exception($"{_errorMessagePrefix}插入整车总成失败:{m100Obj.HostSN2}");
+ }
+ #endregion
+
+ //更新M100
+ m100Obj.SetAssemblyID(vehicleAssemblyResu.Id);
+ m100Obj.SetBillStatus(BillStatusEnum.Match);
+ var m100Ret = await _billM100Repository.UpdateAsync(m100Obj);
+ if (m100Ret == null)
+ {
+ throw new Exception($"{_errorMessagePrefix}更新M100失败:{m100Obj.HostSN2}");
+ }
+ //判断未打印表是否有数据,有则更新,没有则插入
+ ObjectResultDto wpRet = await _hqM100DomainServie.InsertOrUpdateWaitPrintByM100(m100Ret, false, true);
+ if (wpRet.Status == false)
+ {
+ throw new Exception(wpRet.Message);
+ }
+ //var updM100Ret = await _hqM100DomainServie.UpdateM100(m100Obj);
+ ret.Status = true;
+ ret.Item = true;
+ return ret;
+ }
+ else
+ {
+ ret.Status = true;
+ ret.Item = false;
+ ret.Message = $"重新解析失败:流水号{m100Obj.HostSN2},规格说明:{specExplain},颜色说明:{colorExplain}";
+ return ret;
+ }
+ }
+
+
///
/// 上次导入和本次导入之间的流水号是否连续
///
diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/HQ_M100DomainService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/HQ_M100DomainService.cs
index b0be7e4..68e7220 100644
--- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/HQ_M100DomainService.cs
+++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/HQ_M100DomainService.cs
@@ -167,10 +167,10 @@ namespace WY.NewJit.MsgCheck
///
///
///
- public async Task InsertOrUpdateWaitPrintByM100(BillM100 m100Obj, bool autoSave = false)
+ public async Task InsertOrUpdateWaitPrintByM100(BillM100 m100Obj, bool autoSave = false, bool isReplenishPrint = false)
{
ObjectResultDto ret = new ObjectResultDto(true, "");
- List wpLst = await _waitPrintRepository.GetListAsync(itm => itm.VIN == m100Obj.VIN && itm.BusinessType == BusinessTypeEnum.MenBan);
+ List wpLst = await _waitPrintRepository.GetListAsync(itm => itm.M100Id == m100Obj.Id);
bool hasData = wpLst.Count > 0;
if (hasData) //未打印表有数据
{
@@ -178,25 +178,15 @@ namespace WY.NewJit.MsgCheck
{
wp.AssemblyID = m100Obj.AssemblyID;
wp.BillStatus = m100Obj.BillStatus;
+ wp.PrintType = isReplenishPrint ? PrintTypeEnum.ReplenishPrint : PrintTypeEnum.OrderPrint;
}
await _waitPrintRepository.UpdateManyAsync(wpLst, autoSave);
}
else //未打印表没有数据
{
- WaitPrint[] wpArr;
- if (m100Obj.ProductLine == "08")
- {
- WaitPrint mbRec = ConvertWaitPrint(m100Obj, BusinessTypeEnum.MenBan);
- //WaitPrint zhbOtherRec = ConvertWaitPrint(m100Obj, BusinessTypeEnum.OtherZhuHuBan);
- //WaitPrint zhbRec = ConvertWaitPrint(m100Obj, BusinessTypeEnum.AC_ZhuHuBan);
- //wpArr = new WaitPrint[3] { mbRec, zhbOtherRec, zhbRec };
- wpArr = new WaitPrint[1] { mbRec };
- }
- else
- {
- WaitPrint mbRec = ConvertWaitPrint(m100Obj, BusinessTypeEnum.MenBan);
- wpArr = new WaitPrint[1] { mbRec };
- }
+ WaitPrint mbRec = ConvertWaitPrint(m100Obj, BusinessTypeEnum.MenBan);
+ WaitPrint[] wpArr = new WaitPrint[1] { mbRec };
+
foreach (WaitPrint wp in wpArr)
{
wp.PrintType = PrintTypeEnum.ReplenishPrint;