Browse Source

测试未知总成、打印通过

HQ
liuyunfeng 10 months ago
parent
commit
8c4b13e190
  1. 2
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgCheck/UnknownAssemblys/Interfaces/IUnknownAssemblyAppService.cs
  2. 7
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/WY.NewJit.Application.Contracts.xml
  3. 1
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgBaseData/AssemblyCfgs/AssemblyCfgVehicleAppService.cs
  4. 614
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/UnknownAssemblys/UnknownAssemblyAppService.cs
  5. 32
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml
  6. 62
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/EdiParseDomainService.cs
  7. 20
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/HQ_M100DomainService.cs

2
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgCheck/UnknownAssemblys/Interfaces/IUnknownAssemblyAppService.cs

@ -64,7 +64,7 @@ namespace WY.NewJit.MsgCheck.UnknownAssemblys
/// </summary> /// </summary>
/// <param name="takeCount"></param> /// <param name="takeCount"></param>
/// <returns></returns> /// <returns></returns>
ObjectResultDto<string> BatchParseAsync(BatchParseParam input); //ObjectResultDto<string> BatchParseAsync(BatchParseParam input);
/// <summary> /// <summary>
/// 根据vin从天合mes系统中取erp总成编码列表 /// 根据vin从天合mes系统中取erp总成编码列表

7
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/WY.NewJit.Application.Contracts.xml

@ -4115,13 +4115,6 @@
<param name="input">总成、分总成、零件三级关系实体</param> <param name="input">总成、分总成、零件三级关系实体</param>
<returns>执行成功返回真</returns> <returns>执行成功返回真</returns>
</member> </member>
<member name="M:WY.NewJit.MsgCheck.UnknownAssemblys.IUnknownAssemblyAppService.BatchParseAsync(WY.NewJit.MsgCheck.UnknownAssemblys.BatchParseParam)">
<summary>
系统初始化时使用,批量解析
</summary>
<param name="takeCount"></param>
<returns></returns>
</member>
<member name="M:WY.NewJit.MsgCheck.UnknownAssemblys.IUnknownAssemblyAppService.GetErpAssemblyCodeByMesAsync(System.String)"> <member name="M:WY.NewJit.MsgCheck.UnknownAssemblys.IUnknownAssemblyAppService.GetErpAssemblyCodeByMesAsync(System.String)">
<summary> <summary>
根据vin从天合mes系统中取erp总成编码列表 根据vin从天合mes系统中取erp总成编码列表

1
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgBaseData/AssemblyCfgs/AssemblyCfgVehicleAppService.cs

@ -123,6 +123,7 @@ namespace WY.NewJit.MsgBaseData.AssemblyCfgs
ObjectResultDto<AssemblyCfgErpDto> erpAssemblyObj = await _assemblyCfgErpAppService.GetErpAssemblyAsync(vehicleChildItem.ErpAssemblyId); ObjectResultDto<AssemblyCfgErpDto> erpAssemblyObj = await _assemblyCfgErpAppService.GetErpAssemblyAsync(vehicleChildItem.ErpAssemblyId);
ret.Add(erpAssemblyObj.Item); ret.Add(erpAssemblyObj.Item);
} }
ret = ret.OrderBy(itm => itm.ErpAssemblyCode).ToList();
return ret; return ret;
} }
else else

614
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.SettleAccountFis;
using WY.NewJit.MsgTransmission.PaiGe; using WY.NewJit.MsgTransmission.PaiGe;
using WY.NewJit.PrintTable; using WY.NewJit.PrintTable;
using WY.NewJit.EdiReceive.Services;
using WY.NewJit.EdiReceive.Entitys;
namespace WY.NewJit.MsgCheck namespace WY.NewJit.MsgCheck
{ {
@ -61,12 +63,12 @@ namespace WY.NewJit.MsgCheck
/// <summary> /// <summary>
/// R100报文解析及校验领域服务 /// R100报文解析及校验领域服务
/// </summary> /// </summary>
private readonly R100CheckDomainService _r100CheckDomainSrv; //private readonly R100CheckDomainService _r100CheckDomainSrv;
/// <summary> /// <summary>
/// M100报文解析及校验领域服务 /// M100报文解析及校验领域服务
/// </summary> /// </summary>
private readonly M100CheckDomainService _m100CheckDomainService; //private readonly M100CheckDomainService _m100CheckDomainService;
/// <summary> /// <summary>
/// 日志 /// 日志
@ -91,12 +93,28 @@ namespace WY.NewJit.MsgCheck
/// <summary> /// <summary>
/// 零件基本信息 /// 零件基本信息
/// </summary> /// </summary>
private readonly IRepository<PartCfg, Guid> _partCfgRepository; //private readonly IRepository<PartCfg, Guid> _partCfgRepository;
/// <summary>
/// 缓存管理 领域服务
/// </summary>
private readonly HQ_CacheManagerDomainService _hqCacheManagerDomainService;
/// <summary>
/// 报文解析 领域服务
/// </summary>
private readonly EdiParseDomainService _ediParseDomainService;
/// <summary>
/// 导入记录仓储
/// </summary>
private readonly IRepository<ImportRecord, Guid> _importRecordRepository;
/// <summary> /// <summary>
/// 结算件切换列表 /// 结算件切换列表
/// </summary> /// </summary>
private List<PartSwitch> _partSwitchList = new List<PartSwitch>(); //private List<PartSwitch> _partSwitchList = new List<PartSwitch>();
/// <summary> /// <summary>
/// 结算件信息列表 /// 结算件信息列表
@ -131,13 +149,16 @@ namespace WY.NewJit.MsgCheck
IBlobContainer<OurFileContainer> blobContainer, IBlobContainer<OurFileContainer> blobContainer,
IRepository<AssemblyCfgErp, Guid> assemblyCfgErpRepository, IRepository<AssemblyCfgErp, Guid> assemblyCfgErpRepository,
MsgTransmissionAppService msgTransmissionAppService, MsgTransmissionAppService msgTransmissionAppService,
R100CheckDomainService r100CheckDomainSrv, //R100CheckDomainService r100CheckDomainSrv,
M100CheckDomainService m100CheckDomainService, //M100CheckDomainService m100CheckDomainService,
IDistributedEventBus distributedEventBus, IDistributedEventBus distributedEventBus,
IRepository<PartCfg, Guid> partCfgRepository, //IRepository<PartCfg, Guid> partCfgRepository,
IRepository<WaitPrint, Guid> waitPrintRepository, IRepository<WaitPrint, Guid> waitPrintRepository,
M100DomainService m100DomainService M100DomainService m100DomainService,
) HQ_CacheManagerDomainService hqCacheManagerDomainService
,
EdiParseDomainService ediParseDomainService,
IRepository<ImportRecord, Guid> importRecordRepository)
{ {
_UnknownAssemblyRepository = UnknownAssemblyRepository; _UnknownAssemblyRepository = UnknownAssemblyRepository;
_UnknownAssemblyPartRepository = UnknownAssemblyPartRepository; _UnknownAssemblyPartRepository = UnknownAssemblyPartRepository;
@ -154,12 +175,15 @@ namespace WY.NewJit.MsgCheck
_blobContainer = blobContainer; _blobContainer = blobContainer;
_assemblyCfgErpRepository = assemblyCfgErpRepository; _assemblyCfgErpRepository = assemblyCfgErpRepository;
_msgTransmissionAppService = msgTransmissionAppService; _msgTransmissionAppService = msgTransmissionAppService;
_r100CheckDomainSrv = r100CheckDomainSrv; //_r100CheckDomainSrv = r100CheckDomainSrv;
_m100CheckDomainService = m100CheckDomainService; //_m100CheckDomainService = m100CheckDomainService;
_distributedEventBus = distributedEventBus; _distributedEventBus = distributedEventBus;
_partCfgRepository = partCfgRepository; //_partCfgRepository = partCfgRepository;
_waitPrintRepository = waitPrintRepository; _waitPrintRepository = waitPrintRepository;
_m100DomainService = m100DomainService; _m100DomainService = m100DomainService;
_hqCacheManagerDomainService = hqCacheManagerDomainService;
_ediParseDomainService = ediParseDomainService;
_importRecordRepository = importRecordRepository;
} }
#endregion #endregion
@ -174,8 +198,8 @@ namespace WY.NewJit.MsgCheck
string sqlCnt = @" string sqlCnt = @"
with b as with b as
( (
select Id,HostSN,KNR,'' as VIN,AssemblyID,OnlineTime,ReceiveTime,VehicleModelCode,ProductLine,[Version],BillStatus from FisBillR100 where BillStatus =1 -- select Id,HostSN,KNR,'' as VIN,AssemblyID,OnlineTime,ReceiveTime,VehicleModelCode,ProductLine,[Version],BillStatus from FisBillR100 where BillStatus =1
union all -- union all
select Id,HostSN,KNR,VIN,AssemblyID,OnlineTime,ReceiveTime,VehicleModelCode,ProductLine,[Version],BillStatus from FisBillM100 where BillStatus =1 select Id,HostSN,KNR,VIN,AssemblyID,OnlineTime,ReceiveTime,VehicleModelCode,ProductLine,[Version],BillStatus from FisBillM100 where BillStatus =1
) )
,d as ,d as
@ -188,7 +212,7 @@ select * from
from FisUnknownAssembly a from FisUnknownAssembly a
join b on a.BillID = b.Id join b on a.BillID = b.Id
left join d on b.VehicleModelCode = d.DicItemCode left join d on b.VehicleModelCode = d.DicItemCode
where a.IsDeleted <> 1 {0} where a.IsDeleted = 0 {0}
) t ) t
"; ";
@ -196,8 +220,8 @@ select * from
with b as with b as
( (
select Id,HostSN,KNR,'' as VIN,AssemblyID,OnlineTime,ReceiveTime,VehicleModelCode,ProductLine,[Version],BillStatus, Description, SerialNumStr from FisBillR100 where BillStatus =1 -- select Id,HostSN,KNR,'' as VIN,AssemblyID,OnlineTime,ReceiveTime,VehicleModelCode,ProductLine,[Version],BillStatus, Description, SerialNumStr from FisBillR100 where BillStatus =1
union all -- union all
select Id,HostSN,KNR,VIN,AssemblyID,OnlineTime,ReceiveTime,VehicleModelCode,ProductLine,[Version],BillStatus, Description, SerialNumStr from FisBillM100 where BillStatus =1 select Id,HostSN,KNR,VIN,AssemblyID,OnlineTime,ReceiveTime,VehicleModelCode,ProductLine,[Version],BillStatus, Description, SerialNumStr from FisBillM100 where BillStatus =1
) )
,d as ,d as
@ -211,7 +235,7 @@ select * from
from FisUnknownAssembly a from FisUnknownAssembly a
join b on a.BillID = b.Id join b on a.BillID = b.Id
left join d on b.VehicleModelCode = d.DicItemCode 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} ) t where row_number between {1} and {2}
"; ";
string where = ""; string where = "";
@ -281,28 +305,28 @@ select * from
return ret; return ret;
} }
[UnitOfWork] //[UnitOfWork]
private bool OneParseAsync(Guid unknownAssemblyId) //private bool OneParseAsync(Guid unknownAssemblyId)
{ //{
bool isMatch = false; // bool isMatch = false;
//根据未知总成ID取单据Id // //根据未知总成ID取单据Id
UnknownAssembly unknownAssemblyObj = _UnknownAssemblyRepository.GetAsync(unknownAssemblyId, false).GetAwaiter().GetResult(); // UnknownAssembly unknownAssemblyObj = _UnknownAssemblyRepository.GetAsync(unknownAssemblyId, false).GetAwaiter().GetResult();
if (unknownAssemblyObj.ScanPoint == "R100")//!! // if (unknownAssemblyObj.ScanPoint == "R100")//!!
{ // {
} // }
else if (unknownAssemblyObj.ScanPoint == "M100") // else if (unknownAssemblyObj.ScanPoint == "M100")
{ // {
//天合版本的匹配总成算法: // //天合版本的匹配总成算法:
//匹配上时:插入整车总成配置表、更新单据表的整车总成ID字段、返回true // //匹配上时:插入整车总成配置表、更新单据表的整车总成ID字段、返回true
//匹配不上时返回false // //匹配不上时返回false
//isMatch = _msgTransmissionAppServiceTianHe.MatchAssembly_Init(unknownAssemblyObj.BillID); // //isMatch = _msgTransmissionAppServiceTianHe.MatchAssembly_Init(unknownAssemblyObj.BillID);
var billObj = _billM100Repository.GetAsync(unknownAssemblyObj.BillID).GetAwaiter().GetResult(); // var billObj = _billM100Repository.GetAsync(unknownAssemblyObj.BillID).GetAwaiter().GetResult();
_m100CheckDomainService.DoMatchAssembly(billObj); // _m100CheckDomainService.DoMatchAssembly(billObj);
} // }
unknownAssemblyObj.SetExtraProperties("1"); // unknownAssemblyObj.SetExtraProperties("1");
_UnknownAssemblyRepository.UpdateAsync(unknownAssemblyObj).GetAwaiter().GetResult(); // _UnknownAssemblyRepository.UpdateAsync(unknownAssemblyObj).GetAwaiter().GetResult();
return isMatch; // return isMatch;
} //}
private FISVersionEto ConvertToFISVersion(List<BillM100> m100BillList) private FISVersionEto ConvertToFISVersion(List<BillM100> m100BillList)
{ {
@ -434,147 +458,147 @@ select * from
return isEqual; return isEqual;
} }
private void DoInitLoadCache() //private void DoInitLoadCache()
{ //{
//取全部整车总成ID // //取全部整车总成ID
string vehicleSql = "select Id, VehicleModelCode as VehicleModel from FisAssemblyCfgVehicle v where NewVersionId is null order by CreationTime desc"; // string vehicleSql = "select Id, VehicleModelCode as VehicleModel from FisAssemblyCfgVehicle v where NewVersionId is null order by CreationTime desc";
List<VehicleAssemblyMainList> vehicleAssemblyIdList = _newJitDapperRepository.GetListBySql<VehicleAssemblyMainList>(vehicleSql, true); // List<VehicleAssemblyMainList> vehicleAssemblyIdList = _newJitDapperRepository.GetListBySql<VehicleAssemblyMainList>(vehicleSql, true);
//取全部零件:按整车总成Id、零件编码分组汇总数量 // //取全部零件:按整车总成Id、零件编码分组汇总数量
const string vehicle2PartSql = @" // const string vehicle2PartSql = @"
select v.Id as VehicleAssemblyId, ep.PartCode, sum(ep.PartNum) as PartNum // select v.Id as VehicleAssemblyId, ep.PartCode, sum(ep.PartNum) as PartNum
from FisAssemblyCfgVehicle v // from FisAssemblyCfgVehicle v
join FisAssemblyCfgVehicleChild vc on v.Id = vc.AssemblyCfgVehicleId // join FisAssemblyCfgVehicleChild vc on v.Id = vc.AssemblyCfgVehicleId
join FisAssemblyCfgErp e on vc.ErpAssemblyId = e.Id // join FisAssemblyCfgErp e on vc.ErpAssemblyId = e.Id
join FisAssemblyCfgPart ep on e.Id = ep.AssemblyCfgErpId // 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) // 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 v.NewVersionId is null
and ep.PartCode is not null // and ep.PartCode is not null
group by v.Id, ep.PartCode // group by v.Id, ep.PartCode
order by v.Id, ep.PartCode // order by v.Id, ep.PartCode
"; // ";
var vehicle2partList = _newJitDapperRepository.GetListBySql<AssemblyCfgVehicle2Part>(vehicle2PartSql, true); // var vehicle2partList = _newJitDapperRepository.GetListBySql<AssemblyCfgVehicle2Part>(vehicle2PartSql, true);
//取Erp总成 // //取Erp总成
string erpMainSql = "select Id, VehicleModel from FisAssemblyCfgErp where NewVersionId is null order by ErpAssemblyVersion, CreationTime desc"; // string erpMainSql = "select Id, VehicleModel from FisAssemblyCfgErp where NewVersionId is null order by ErpAssemblyVersion, CreationTime desc";
List<ErpAssemblyMain> erpAssemblyMainList = _newJitDapperRepository.GetListBySql<ErpAssemblyMain>(erpMainSql, true); // List<ErpAssemblyMain> erpAssemblyMainList = _newJitDapperRepository.GetListBySql<ErpAssemblyMain>(erpMainSql, true);
List<AssemblyCfgErp2Part> erp2partList = new List<AssemblyCfgErp2Part>(); // List<AssemblyCfgErp2Part> erp2partList = new List<AssemblyCfgErp2Part>();
if (ConfigDic.CurrentVersion == ConfigDicVersionOption.) // if (ConfigDic.CurrentVersion == ConfigDicVersionOption.派格)
{ // {
//取所有零件(IsDisable = 1时表示不需要解析BOM) // //取所有零件(IsDisable = 1时表示不需要解析BOM)
string erp2partSql = @" // string erp2partSql = @"
select e.GroupId, e.Id as ErpAssemblyId, e.ErpAssemblyCode, ep.Id as PartId, ep.PartCode, ep.PartNum, ep.IsKey // select e.GroupId, e.Id as ErpAssemblyId, e.ErpAssemblyCode, ep.Id as PartId, ep.PartCode, ep.PartNum, ep.IsKey
from FisAssemblyCfgErp e // from FisAssemblyCfgErp e
join FisAssemblyCfgPart ep on e.Id = ep.AssemblyCfgErpId // join FisAssemblyCfgPart ep on e.Id = ep.AssemblyCfgErpId
where ep.PartCode is not null // where ep.PartCode is not null
and not exists (select PartCode from FisPartCfg pc where IsDisable = 1 and ep.PartCode = pc.PartCode) // and not exists (select PartCode from FisPartCfg pc where IsDisable = 1 and ep.PartCode = pc.PartCode)
"; // ";
erp2partList = _newJitDapperRepository.GetListBySql<AssemblyCfgErp2Part>(erp2partSql, true); // erp2partList = _newJitDapperRepository.GetListBySql<AssemblyCfgErp2Part>(erp2partSql, true);
//结算件切换列表 // //结算件切换列表
string partSwitchSql = "select SourcePartCode,TargetPartCode,ActiveBeginTime,ActiveEndTime from FisPartSwitch"; // string partSwitchSql = "select SourcePartCode,TargetPartCode,ActiveBeginTime,ActiveEndTime from FisPartSwitch";
_partSwitchList = _newJitDapperRepository.GetListBySql<PartSwitch>(partSwitchSql, true); // _partSwitchList = _newJitDapperRepository.GetListBySql<PartSwitch>(partSwitchSql, true);
} // }
else // else
{ // {
//取所有零件(IsDisable = 1时表示不需要解析BOM) // //取所有零件(IsDisable = 1时表示不需要解析BOM)
string erp2partSql = @" // string erp2partSql = @"
select e.Id as ErpAssemblyId, e.ErpAssemblyCode, ep.Id as PartId, ep.PartCode, ep.PartNum, ep.IsKey // select e.Id as ErpAssemblyId, e.ErpAssemblyCode, ep.Id as PartId, ep.PartCode, ep.PartNum, ep.IsKey
from FisAssemblyCfgErp e // from FisAssemblyCfgErp e
join FisAssemblyCfgPart ep on e.Id = ep.AssemblyCfgErpId // join FisAssemblyCfgPart ep on e.Id = ep.AssemblyCfgErpId
where e.NewVersionId is null // where e.NewVersionId is null
and ep.PartCode is not null // and ep.PartCode is not null
and not exists (select PartCode from FisPartCfg pc where IsDisable = 1 and ep.PartCode = pc.PartCode) // and not exists (select PartCode from FisPartCfg pc where IsDisable = 1 and ep.PartCode = pc.PartCode)
"; // ";
erp2partList = _newJitDapperRepository.GetListBySql<AssemblyCfgErp2Part>(erp2partSql, true); // erp2partList = _newJitDapperRepository.GetListBySql<AssemblyCfgErp2Part>(erp2partSql, true);
} // }
_r100CheckDomainSrv.InitPub(vehicleAssemblyIdList, vehicle2partList, erpAssemblyMainList, erp2partList, _partSwitchList); //整车总成内存及时刷新, ERP总成增删改时触发刷新标志 // _r100CheckDomainSrv.InitPub(vehicleAssemblyIdList, vehicle2partList, erpAssemblyMainList, erp2partList, _partSwitchList); //整车总成内存及时刷新, ERP总成增删改时触发刷新标志
_m100CheckDomainService.InitPub(vehicleAssemblyIdList, vehicle2partList, erpAssemblyMainList, erp2partList, _partSwitchList); // _m100CheckDomainService.InitPub(vehicleAssemblyIdList, vehicle2partList, erpAssemblyMainList, erp2partList, _partSwitchList);
#region 无法缓存的 // #region 无法缓存的
//结算件信息列表,库存系统同步过来,无法缓存 // //结算件信息列表,库存系统同步过来,无法缓存
string partCfgSql = @"select Id, PartCode, PartName, PartType, Description, PartType2, PartType3, RelationKey from FisPartCfg where 1=1"; //,DaXiaoLiangGang,DoorPlankCode,MaterialDescription,SAPMaterialNum // string partCfgSql = @"select Id, PartCode, PartName, PartType, Description, PartType2, PartType3, RelationKey from FisPartCfg where 1=1"; //,DaXiaoLiangGang,DoorPlankCode,MaterialDescription,SAPMaterialNum
_partCfgList = _newJitDapperRepository.GetListBySql<PartCfg>(partCfgSql, true); // _partCfgList = _newJitDapperRepository.GetListBySql<PartCfg>(partCfgSql, true);
#endregion // #endregion
} //}
private void DifferenceMenBan_ZhuHuBan(BillResult billResObj) //private void DifferenceMenBan_ZhuHuBan(BillResult billResObj)
{ //{
//根据物料组区分门板、柱护板, 柱护板不参与匹配,但是参与发货 // //根据物料组区分门板、柱护板, 柱护板不参与匹配,但是参与发货
if (ConfigDic.CurrentVersion == ConfigDicVersionOption.) // if (ConfigDic.CurrentVersion == ConfigDicVersionOption.派格)
{ // {
if (billResObj.R100Bill != null) // if (billResObj.R100Bill != null)
{ // {
if (billResObj.R100Bill.VehicleModelCode == "Q5") // if (billResObj.R100Bill.VehicleModelCode == "Q5")
{ // {
foreach (BillR100Part billPart in billResObj.R100Bill.BillR100Parts) // foreach (BillR100Part billPart in billResObj.R100Bill.BillR100Parts)
{ // {
PartCfg partObj = _partCfgList.FirstOrDefault(itm => itm.PartCode == billPart.PartCode); // PartCfg partObj = _partCfgList.FirstOrDefault(itm => itm.PartCode == billPart.PartCode);
if (partObj != null) // if (partObj != null)
{ // {
billPart.PartType = partObj.PartType; // billPart.PartType = partObj.PartType;
billPart.Description = partObj.PartType == "2" ? "柱护板" : "控制件"; // billPart.Description = partObj.PartType == "2" ? "柱护板" : "控制件";
billPart.PartType2 = partObj.PartType2; // billPart.PartType2 = partObj.PartType2;
} // }
else // else
{ // {
billPart.PartType = "1"; // billPart.PartType = "1";
billPart.Description = "控制件"; // billPart.Description = "控制件";
string errorMsg = $"R100结算件{billPart.PartCode}在结算件信息表中不存在!KNR={billResObj.R100Bill.KNR}"; // string errorMsg = $"R100结算件{billPart.PartCode}在结算件信息表中不存在!KNR={billResObj.R100Bill.KNR}";
//throw new Exception(errorMsg); ////???? 此处需要优化,不触发异常,直接入库 // //throw new Exception(errorMsg); ////???? 此处需要优化,不触发异常,直接入库
//_logRemindDomainService.WriteLogRemind("报文解析", errorMsg, LogTypeEnum.R100); // //_logRemindDomainService.WriteLogRemind("报文解析", errorMsg, LogTypeEnum.R100);
_logger.LogError(errorMsg); // _logger.LogError(errorMsg);
} // }
} // }
} // }
else //除Q5,其它车型没有柱护板 // else //除Q5,其它车型没有柱护板
{ // {
foreach (BillR100Part partItm in billResObj.R100Bill.BillR100Parts) // foreach (BillR100Part partItm in billResObj.R100Bill.BillR100Parts)
{ // {
partItm.PartType = "1"; // partItm.PartType = "1";
partItm.Description = "控制件"; // partItm.Description = "控制件";
} // }
} // }
} // }
else if (billResObj.M100Bill != null) // else if (billResObj.M100Bill != null)
{ // {
if (billResObj.M100Bill.VehicleModelCode == "Q5") // if (billResObj.M100Bill.VehicleModelCode == "Q5")
{ // {
foreach (BillM100Part billPart in billResObj.M100Bill.BillM100Parts) // foreach (BillM100Part billPart in billResObj.M100Bill.BillM100Parts)
{ // {
PartCfg partObj = _partCfgList.FirstOrDefault(itm => itm.PartCode == billPart.PartCode); // PartCfg partObj = _partCfgList.FirstOrDefault(itm => itm.PartCode == billPart.PartCode);
if (partObj != null) // if (partObj != null)
{ // {
billPart.PartType = partObj.PartType; // billPart.PartType = partObj.PartType;
billPart.Description = partObj.PartType == "2" ? "柱护板" : "控制件"; // billPart.Description = partObj.PartType == "2" ? "柱护板" : "控制件";
billPart.PartType2 = partObj.PartType2; // billPart.PartType2 = partObj.PartType2;
} // }
else // else
{ // {
billPart.PartType = "1"; // billPart.PartType = "1";
billPart.Description = "控制件"; // billPart.Description = "控制件";
string errorMsg = $"M100结算件{billPart.PartCode}在结算件信息表中不存在!VIN={billResObj.M100Bill.VIN}"; // string errorMsg = $"M100结算件{billPart.PartCode}在结算件信息表中不存在!VIN={billResObj.M100Bill.VIN}";
//_logRemindDomainService.WriteLogRemind("报文解析", errorMsg, LogTypeEnum.M100); // //_logRemindDomainService.WriteLogRemind("报文解析", errorMsg, LogTypeEnum.M100);
_logger.LogError(errorMsg); // _logger.LogError(errorMsg);
//throw new Exception(errorMsg); // //throw new Exception(errorMsg);
} // }
} // }
} // }
else // else
{ // {
foreach (BillM100Part partItm in billResObj.M100Bill.BillM100Parts) // foreach (BillM100Part partItm in billResObj.M100Bill.BillM100Parts)
{ // {
partItm.PartType = "1"; // partItm.PartType = "1";
partItm.Description = "控制件"; // partItm.Description = "控制件";
} // }
} // }
} // }
} // }
} //}
#endregion #endregion
@ -637,22 +661,21 @@ select * from
throw new Exception("不是R100或M100!"); throw new Exception("不是R100或M100!");
} }
//填充零件类型 //填充零件类型
if (vehicleModel == "Q5") //if (vehicleModel == "Q5")
{ //{
foreach (UnknownAssemblyPartDto partDto in targetObj.UnknownAssemblyParts) // foreach (UnknownAssemblyPartDto partDto in targetObj.UnknownAssemblyParts)
{ // {
var tempObj = await _partCfgRepository.FirstOrDefaultAsync(itm => itm.PartCode == partDto.PartCode); // var tempObj = await _partCfgRepository.FirstOrDefaultAsync(itm => itm.PartCode == partDto.PartCode);
if (tempObj != null) // if (tempObj != null)
{ // {
partDto.PartType = tempObj.PartType; // partDto.PartType = tempObj.PartType;
} // }
else // else
{ // {
throw new Exception("Q5车型的零件在零件配置中没有对应!"); // throw new Exception("Q5车型的零件在零件配置中没有对应!");
} // }
} // }
//}
}
ret.Item = targetObj; ret.Item = targetObj;
return ret; return ret;
@ -836,8 +859,8 @@ select * from
string sql = @" string sql = @"
with b as with b as
( (
select Id from FisBillR100 where BillStatus =1 -- select Id from FisBillR100 where BillStatus =1
union all -- union all
select Id from FisBillM100 where BillStatus =1 select Id from FisBillM100 where BillStatus =1
) )
select a.Id from FisUnknownAssembly a where IsDeleted = 0 and BillID in (select Id from b) 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 matchNum = 0;
int notMatchNum = 0; int notMatchNum = 0;
//新版初始化缓存
DoInitLoadCache(); //新版初始化缓存 //DoInitLoadCache();
_hqCacheManagerDomainService.InitLoadCache(true);
//取所有总成包含的子零件列表
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<string> allAssemblyPartLst =_newJitDapperRepository.GetListBySql<string>(allAssemblyPartSql, true);
foreach (Guid selId in selLst) foreach (Guid selId in selLst)
{ {
//根据未知总成ID取单据Id //根据未知总成ID取单据Id
UnknownAssembly unknownAssemblyObj = await _UnknownAssemblyRepository.GetAsync(selId, false); UnknownAssembly unknownAssemblyObj = await _UnknownAssemblyRepository.GetAsync(selId, false);
if (unknownAssemblyObj.ScanPoint == "R100")
{ BillM100 m100Obj = await _billM100Repository.GetAsync(unknownAssemblyObj.BillID, false);
//根据单据Id取单据信息 if (m100Obj.MessageFileReceiveID == null)
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++; throw new Exception("M100表的MessageFileReceiveID字段值不能为空:" + m100Obj.HostSN2.ToString());
} }
else ImportRecord impRecObj = await _importRecordRepository.GetAsync((Guid)(m100Obj.MessageFileReceiveID));
{ string specExplain = impRecObj.SpecDesc;
notMatchNum++; string colorExplain = impRecObj.VehicleModelDesc.Trim().Right(7);
var billNotExistPartLst = r100Obj.BillR100Parts.Where(itm => itm.PartType == "1" && allAssemblyPartLst.Contains(itm.PartCode) == false).ToList(); ObjectResultDto<bool> repasingRet = await _ediParseDomainService.ReParsing(m100Obj, specExplain, colorExplain);
if (billNotExistPartLst.Count > 0) if (repasingRet.Status == false)
{ {
string desc = "如下是新零件,在总成子零件中不存在:" + billNotExistPartLst.Select(itm => itm.PartCode).Distinct().JoinAsString(","); throw new Exception(repasingRet.Message);
unknownAssemblyObj.Description = desc;
await _UnknownAssemblyRepository.UpdateAsync(unknownAssemblyObj);
} }
} if (repasingRet.Item == true)
}
else if (unknownAssemblyObj.ScanPoint == "M100")
{
//根据单据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++; 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 else
{ {
notMatchNum++; 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);
}
}
} }
} //foreach } //foreach
@ -962,74 +931,73 @@ select * from
/// </summary> /// </summary>
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost] // [HttpPost]
//[UnitOfWork(true)] // [Route("batch-parse")]
[Route("batch-parse")] // public virtual ObjectResultDto<string> BatchParseAsync(BatchParseParam input)
public virtual ObjectResultDto<string> BatchParseAsync(BatchParseParam input) // {
{ // _logger.LogDebug(_errorMessagePrefix + "BatchParseAsync 进入");
_logger.LogDebug(_errorMessagePrefix + "BatchParseAsync 进入"); // //批量删除未匹配单据
//批量删除未匹配单据 // //string delSql = "delete from FisNotMatchTempBill";
//string delSql = "delete from FisNotMatchTempBill"; // // _newJitDapperRepository.ExecuteSql(delSql, null, true);
// _newJitDapperRepository.ExecuteSql(delSql, null, true);
ObjectResultDto<string> ret = new ObjectResultDto<string>(); // ObjectResultDto<string> ret = new ObjectResultDto<string>();
try // try
{ // {
string sql = @" // string sql = @"
with b as // with b as
( // (
select Id, OnlineTime from FisBillM100 where BillStatus =1 {1} // select Id, OnlineTime from FisBillM100 where BillStatus =1 {1}
) // )
select top {0} a.Id from FisUnknownAssembly a // select top {0} a.Id from FisUnknownAssembly a
join b on a.BillId = b.Id //join b on a.BillId = b.Id
where a.IsDeleted <> 1 and a.ExtraProperties is null //where a.IsDeleted <> 1 and a.ExtraProperties is null
order by b.OnlineTime desc //order by b.OnlineTime desc
"; // ";
int takeCount = input.TakeCount; // int takeCount = input.TakeCount;
string sqlWhere = ""; // string sqlWhere = "";
if (input.BeginDate != null && input.EndDate != null) // if (input.BeginDate != null && input.EndDate != null)
{ // {
sqlWhere = "and OnlineTime between convert(datetime,'{0}', 20) and convert(datetime,'{1}', 20)"; // 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")); // 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); // sql = string.Format(sql, takeCount, sqlWhere);
List<Guid> selLst = _newJitDapperRepository.GetListBySql<Guid>(sql, true); // List<Guid> selLst = _newJitDapperRepository.GetListBySql<Guid>(sql, true);
int matchNum = 0; // int matchNum = 0;
int notMatchNum = 0; // int notMatchNum = 0;
//_msgTransmissionAppService.ClearPub(); // //_msgTransmissionAppService.ClearPub();
_msgTransmissionAppService.InitPub(); // _msgTransmissionAppService.InitPub();
foreach (Guid selId in selLst) // foreach (Guid selId in selLst)
{ // {
bool isMatch = OneParseAsync(selId); // bool isMatch = OneParseAsync(selId);
if (isMatch) // if (isMatch)
{ // {
matchNum++; // matchNum++;
} // }
else // else
{ // {
notMatchNum++; // notMatchNum++;
} // }
} //foreach // } //foreach
ret.Status = true; // ret.Status = true;
ret.Message = $"本次共重新解析{matchNum + notMatchNum}条,其中匹配{matchNum}条、不匹配{notMatchNum}条"; // ret.Message = $"本次共重新解析{matchNum + notMatchNum}条,其中匹配{matchNum}条、不匹配{notMatchNum}条";
ret.Item = ret.Message; // ret.Item = ret.Message;
_logger.LogDebug(_errorMessagePrefix + "BatchParseAsync 完成:" + ret.Message); // _logger.LogDebug(_errorMessagePrefix + "BatchParseAsync 完成:" + ret.Message);
return ret; // return ret;
} // }
catch (Exception ex) // catch (Exception ex)
{ // {
ret.Status = false; // ret.Status = false;
ret.Message = _errorMessagePrefix + "BatchParseAsync 执行出错:" + ex.Message; // ret.Message = _errorMessagePrefix + "BatchParseAsync 执行出错:" + ex.Message;
_logger.LogError(ret.Message); // _logger.LogError(ret.Message);
return ret; // return ret;
} // }
} // }
/// <summary> /// <summary>
/// 根据vin从天合mes系统中取erp总成编码列表 /// 根据vin从天合mes系统中取erp总成编码列表

32
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml

@ -1787,16 +1787,6 @@
ERP总成仓储 ERP总成仓储
</summary> </summary>
</member> </member>
<member name="F:WY.NewJit.MsgCheck.UnknownAssemblyAppService._r100CheckDomainSrv">
<summary>
R100报文解析及校验领域服务
</summary>
</member>
<member name="F:WY.NewJit.MsgCheck.UnknownAssemblyAppService._m100CheckDomainService">
<summary>
M100报文解析及校验领域服务
</summary>
</member>
<member name="F:WY.NewJit.MsgCheck.UnknownAssemblyAppService._logger"> <member name="F:WY.NewJit.MsgCheck.UnknownAssemblyAppService._logger">
<summary> <summary>
日志 日志
@ -1817,14 +1807,19 @@
事物总线仓库 事物总线仓库
</summary> </summary>
</member> </member>
<member name="F:WY.NewJit.MsgCheck.UnknownAssemblyAppService._partCfgRepository"> <member name="F:WY.NewJit.MsgCheck.UnknownAssemblyAppService._hqCacheManagerDomainService">
<summary> <summary>
零件基本信息 缓存管理 领域服务
</summary> </summary>
</member> </member>
<member name="F:WY.NewJit.MsgCheck.UnknownAssemblyAppService._partSwitchList"> <member name="F:WY.NewJit.MsgCheck.UnknownAssemblyAppService._ediParseDomainService">
<summary> <summary>
结算件切换列表 报文解析 领域服务
</summary>
</member>
<member name="F:WY.NewJit.MsgCheck.UnknownAssemblyAppService._importRecordRepository">
<summary>
导入记录仓储
</summary> </summary>
</member> </member>
<member name="F:WY.NewJit.MsgCheck.UnknownAssemblyAppService._partCfgList"> <member name="F:WY.NewJit.MsgCheck.UnknownAssemblyAppService._partCfgList">
@ -1837,7 +1832,7 @@
错误信息前缀 错误信息前缀
</summary> </summary>
</member> </member>
<member name="M:WY.NewJit.MsgCheck.UnknownAssemblyAppService.#ctor(Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgCheck.UnknownAssembly,System.Guid},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgCheck.UnknownAssemblyPart,System.Guid},Microsoft.Extensions.Logging.ILogger{WY.NewJit.MsgCheck.UnknownAssemblyAppService},WY.NewJit.EntityFrameworkCore.NewJitDapperRepository,Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgBaseData.AssemblyCfgVehicle,System.Guid},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgBaseData.AssemblyCfgErp,System.Guid},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgBaseData.AssemblyCfgPart,System.Guid},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgCheck.BillR100,System.Guid},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgCheck.BillM100,System.Guid},Volo.Abp.BlobStoring.IBlobContainer{WY.NewJit.Common.OurFileContainer},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgBaseData.AssemblyCfgErp,System.Guid},WY.NewJit.MsgTransmission.PaiGe.MsgTransmissionAppService,WY.NewJit.MsgCheck.R100CheckDomainService,WY.NewJit.MsgCheck.M100CheckDomainService,Volo.Abp.EventBus.Distributed.IDistributedEventBus,Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgBaseData.PartCfg,System.Guid},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.PrintTable.WaitPrint,System.Guid},WY.NewJit.MsgCheck.M100DomainService)"> <member name="M:WY.NewJit.MsgCheck.UnknownAssemblyAppService.#ctor(Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgCheck.UnknownAssembly,System.Guid},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgCheck.UnknownAssemblyPart,System.Guid},Microsoft.Extensions.Logging.ILogger{WY.NewJit.MsgCheck.UnknownAssemblyAppService},WY.NewJit.EntityFrameworkCore.NewJitDapperRepository,Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgBaseData.AssemblyCfgVehicle,System.Guid},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgBaseData.AssemblyCfgErp,System.Guid},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgBaseData.AssemblyCfgPart,System.Guid},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgCheck.BillR100,System.Guid},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgCheck.BillM100,System.Guid},Volo.Abp.BlobStoring.IBlobContainer{WY.NewJit.Common.OurFileContainer},Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.MsgBaseData.AssemblyCfgErp,System.Guid},WY.NewJit.MsgTransmission.PaiGe.MsgTransmissionAppService,Volo.Abp.EventBus.Distributed.IDistributedEventBus,Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.PrintTable.WaitPrint,System.Guid},WY.NewJit.MsgCheck.M100DomainService,WY.NewJit.EdiReceive.Services.HQ_CacheManagerDomainService,WY.NewJit.EdiReceive.Services.EdiParseDomainService,Volo.Abp.Domain.Repositories.IRepository{WY.NewJit.EdiReceive.Entitys.ImportRecord,System.Guid})">
<summary> <summary>
构造函数 构造函数
</summary> </summary>
@ -1912,13 +1907,6 @@
<param name="input">总成、分总成、零件三级关系实体</param> <param name="input">总成、分总成、零件三级关系实体</param>
<returns>执行成功返回真</returns> <returns>执行成功返回真</returns>
</member> </member>
<member name="M:WY.NewJit.MsgCheck.UnknownAssemblyAppService.BatchParseAsync(WY.NewJit.MsgCheck.UnknownAssemblys.BatchParseParam)">
<summary>
系统初始化时使用,批量解析【天合版本】
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:WY.NewJit.MsgCheck.UnknownAssemblyAppService.GetErpAssemblyCodeByMesAsync(System.String)"> <member name="M:WY.NewJit.MsgCheck.UnknownAssemblyAppService.GetErpAssemblyCodeByMesAsync(System.String)">
<summary> <summary>
根据vin从天合mes系统中取erp总成编码列表 根据vin从天合mes系统中取erp总成编码列表

62
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/EdiParseDomainService.cs

@ -163,7 +163,7 @@ namespace WY.NewJit.EdiReceive.Services
List<ImportRecord> notRepeatOrder = await GetNotRepeatOrder(input); List<ImportRecord> notRepeatOrder = await GetNotRepeatOrder(input);
if (notRepeatOrder.Count == 0) if (notRepeatOrder.Count == 0)
{ {
ret.Status = true; ret.Status = false;
ret.Message = "根据Vin和HostSN,排除在数据库中重复的Excel订单后,已经没有不重复的订单!"; ret.Message = "根据Vin和HostSN,排除在数据库中重复的Excel订单后,已经没有不重复的订单!";
return ret; return ret;
} }
@ -172,6 +172,7 @@ namespace WY.NewJit.EdiReceive.Services
string betweenBreakNumMsg = await CheckBetweenBreakNum(input); string betweenBreakNumMsg = await CheckBetweenBreakNum(input);
//校验本次导入数据是否断号 //校验本次导入数据是否断号
string breakNumMsg = CheckBreakNum(ref notRepeatOrder); string breakNumMsg = CheckBreakNum(ref notRepeatOrder);
if (betweenBreakNumMsg.HasValue() || breakNumMsg.HasValue()) if (betweenBreakNumMsg.HasValue() || breakNumMsg.HasValue())
{ {
if (forceExecute == false) if (forceExecute == false)
@ -212,8 +213,9 @@ namespace WY.NewJit.EdiReceive.Services
} }
//绑定总成分组 //绑定总成分组
string specExplain = orderItem.SpecDesc;
string colorExplain = orderItem.VehicleModelDesc.Trim().Right(7); 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) if (groupAssemblyObj != null)
{ {
#region 插入整车总成 #region 插入整车总成
@ -234,6 +236,10 @@ namespace WY.NewJit.EdiReceive.Services
m100Obj.SetAssemblyID(vehicleAssemblyResu.Id); m100Obj.SetAssemblyID(vehicleAssemblyResu.Id);
m100Obj.SetBillStatus(BillStatusEnum.Match); m100Obj.SetBillStatus(BillStatusEnum.Match);
var insM100Ret = await _hqM100DomainServie.InsertM100(m100Obj, true); var insM100Ret = await _hqM100DomainServie.InsertM100(m100Obj, true);
if (insM100Ret == null)
{
throw new Exception("插入M100返回结果为空InsertAsync!");
}
} }
else else
{ {
@ -259,6 +265,58 @@ namespace WY.NewJit.EdiReceive.Services
return ret; return ret;
} }
/// <summary>
/// 未知总成-重新解析
/// </summary>
/// <param name="m100Obj"></param>
/// <param name="specExplain"></param>
/// <param name="colorExplain"></param>
/// <returns></returns>
public async Task<ObjectResultDto<bool>> ReParsing(BillM100 m100Obj, string specExplain, string colorExplain)
{
ObjectResultDto<bool> ret = new ObjectResultDto<bool>();
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("插入整车总成返回结果为空InsertAsync!");
}
#endregion
//更新M100
m100Obj.SetAssemblyID(vehicleAssemblyResu.Id);
m100Obj.SetBillStatus(BillStatusEnum.Match);
var m100Ret = await _billM100Repository.UpdateAsync(m100Obj);
//判断未打印表是否有数据,有则更新,没有则插入
ObjectResultDto wpRet = await _hqM100DomainServie.InsertOrUpdateWaitPrintByM100(m100Obj, 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;
}
}
/// <summary> /// <summary>
/// 上次导入和本次导入之间的流水号是否连续 /// 上次导入和本次导入之间的流水号是否连续
/// </summary> /// </summary>

20
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/HQ_M100DomainService.cs

@ -167,10 +167,10 @@ namespace WY.NewJit.MsgCheck
/// </summary> /// </summary>
/// <param name="m100Obj"></param> /// <param name="m100Obj"></param>
/// <returns></returns> /// <returns></returns>
public async Task<ObjectResultDto> InsertOrUpdateWaitPrintByM100(BillM100 m100Obj, bool autoSave = false) public async Task<ObjectResultDto> InsertOrUpdateWaitPrintByM100(BillM100 m100Obj, bool autoSave = false, bool isReplenishPrint = false)
{ {
ObjectResultDto ret = new ObjectResultDto(true, ""); ObjectResultDto ret = new ObjectResultDto(true, "");
List<WaitPrint> wpLst = await _waitPrintRepository.GetListAsync(itm => itm.VIN == m100Obj.VIN && itm.BusinessType == BusinessTypeEnum.MenBan); List<WaitPrint> wpLst = await _waitPrintRepository.GetListAsync(itm => itm.M100Id == m100Obj.Id);
bool hasData = wpLst.Count > 0; bool hasData = wpLst.Count > 0;
if (hasData) //未打印表有数据 if (hasData) //未打印表有数据
{ {
@ -178,25 +178,15 @@ namespace WY.NewJit.MsgCheck
{ {
wp.AssemblyID = m100Obj.AssemblyID; wp.AssemblyID = m100Obj.AssemblyID;
wp.BillStatus = m100Obj.BillStatus; wp.BillStatus = m100Obj.BillStatus;
wp.PrintType = isReplenishPrint ? PrintTypeEnum.ReplenishPrint : PrintTypeEnum.OrderPrint;
} }
await _waitPrintRepository.UpdateManyAsync(wpLst, autoSave); await _waitPrintRepository.UpdateManyAsync(wpLst, autoSave);
} }
else //未打印表没有数据 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); WaitPrint mbRec = ConvertWaitPrint(m100Obj, BusinessTypeEnum.MenBan);
wpArr = new WaitPrint[1] { mbRec }; WaitPrint[] wpArr = new WaitPrint[1] { mbRec };
}
foreach (WaitPrint wp in wpArr) foreach (WaitPrint wp in wpArr)
{ {
wp.PrintType = PrintTypeEnum.ReplenishPrint; wp.PrintType = PrintTypeEnum.ReplenishPrint;

Loading…
Cancel
Save