Browse Source

bug修改完成

HQ
liuyunfeng 7 months ago
parent
commit
b0a3fba68f
  1. 3
      src/Modules/BaseService/BaseService.Application/UserManagement/UserAppService.cs
  2. 4
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgBaseData/AssemblyCfgs/Dtos/ImportErpAssemblyGroupDto.cs
  3. 13
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgCheck/BillM100s/Dtos/BillM100Dto.cs
  4. 15
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgCheck/BillM100s/Dtos/ResultBillM100Dto.cs
  5. 14
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgCheck/UnknownAssemblys/Dtos/ResultUnknownAssemblyDto.cs
  6. 15
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/PrintTable/Dtos/WaitPrintDto.cs
  7. 42
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/WY.NewJit.Application.Contracts.xml
  8. 403
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgBaseData/AssemblyCfgs/AssemblyCfgErpAppService.cs
  9. 4
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/UnknownAssemblys/UnknownAssemblyAppService.cs
  10. 4
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/PrintTable/WaitPrintAppService.cs
  11. 2
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/WY.NewJit.Application.xml
  12. 4
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/EdiParseDomainService.cs
  13. 4
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/EdiReceive/Services/HQ_M100DomainService.cs
  14. 105
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgBaseData/Services/AssemblyDomainService.cs
  15. 9
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Entitys/BillM100.cs
  16. 10
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/PrintTable/Entitys/WaitPrint.cs
  17. 7
      src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Web/appsettings.json

3
src/Modules/BaseService/BaseService.Application/UserManagement/UserAppService.cs

@ -198,8 +198,7 @@ namespace BaseService.Systems.UserManagement
var branchRoles = await GetUserBranchRolesAsync(CurrentUsers.GetId());
var groupBranchRoles = branchRoles.GroupBy(x => x.BranchId)
.Select(y => new {xx = new {BranchId = y.Key}, items = y});
foreach (var group in groupBranchRoles
)
foreach (var group in groupBranchRoles)
{
var mybranchrole = new BranchRoleDto
{

4
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgBaseData/AssemblyCfgs/Dtos/ImportErpAssemblyGroupDto.cs

@ -29,11 +29,11 @@ namespace WY.NewJit.MsgBaseData
[Required(ErrorMessage = "颜色说明{0}是必填项")]
public virtual string ColorExplain { get; set; }
/// <summary>
/// 物料号
/// SAP物料号
/// </summary>
[ExporterHeader(DisplayName = "物料号")]
[ImporterHeader(Name = "物料号")]
[Required(ErrorMessage = "物料号{0}是必填项")]
[Required(ErrorMessage = "SAP物料号{0}是必填项")]
public virtual string MaterialNum { get; set; }
}
}

13
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgCheck/BillM100s/Dtos/BillM100Dto.cs

@ -124,5 +124,18 @@ namespace WY.NewJit.MsgCheck
[ImporterHeader(Name = "手工操作日期")]
public DateTime? OperationTime { get; set; }
/// <summary>
/// 规格说明:HSC0DRCC0001
/// </summary>
[ExporterHeader(DisplayName = "规格说明")]
[ImporterHeader(Name = "规格说明")]
public virtual string SpecExplain { get; set; }
/// <summary>
/// 颜色说明:车型描述后7位,石墨黑/云杉灰
/// </summary>
[ExporterHeader(DisplayName = "颜色说明")]
[ImporterHeader(Name = "颜色说明")]
public virtual string ColorExplain { get; set; }
}
}

15
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgCheck/BillM100s/Dtos/ResultBillM100Dto.cs

@ -150,8 +150,21 @@ namespace WY.NewJit.MsgCheck
[ImporterHeader(IsIgnore = true)]
public virtual string PrintBillNum { get; set; }
/// <summary>
/// 规格说明:HSC0DRCC0001
/// </summary>
[ExporterHeader(DisplayName = "规格说明")]
[ImporterHeader(Name = "规格说明")]
public virtual string SpecExplain { get; set; }
/// <summary>
/// 颜色说明:车型描述后7位,石墨黑/云杉灰
/// </summary>
[ExporterHeader(DisplayName = "颜色说明")]
[ImporterHeader(Name = "颜色说明")]
public virtual string ColorExplain { get; set; }
}
}

14
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/MsgCheck/UnknownAssemblys/Dtos/ResultUnknownAssemblyDto.cs

@ -109,7 +109,19 @@ namespace WY.NewJit.MsgCheck.UnknownAssemblys
[ExporterHeader(DisplayName = "单据表描述")]
[ImporterHeader(Name = "单据表描述")]
public string BillDescription { get; set; }
/// <summary>
/// 规格说明:HSC0DRCC0001
/// </summary>
[ExporterHeader(DisplayName = "规格说明")]
[ImporterHeader(Name = "规格说明")]
public virtual string SpecExplain { get; set; }
/// <summary>
/// 颜色说明:车型描述后7位,石墨黑/云杉灰
/// </summary>
[ExporterHeader(DisplayName = "颜色说明")]
[ImporterHeader(Name = "颜色说明")]
public virtual string ColorExplain { get; set; }
}
}

15
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application.Contracts/PrintTable/Dtos/WaitPrintDto.cs

@ -154,5 +154,20 @@ namespace WY.NewJit.PrintTable
[ExporterHeader(DisplayName = "R100接收时间")]
[ImporterHeader(Name = "R100接收时间")]
public DateTime? R100ReceiveTime { get; set; }
/// <summary>
/// 规格说明:HSC0DRCC0001
/// </summary>
[ExporterHeader(DisplayName = "规格说明")]
[ImporterHeader(Name = "规格说明")]
public virtual string SpecExplain { get; set; }
/// <summary>
/// 颜色说明:车型描述后7位,石墨黑/云杉灰
/// </summary>
[ExporterHeader(DisplayName = "颜色说明")]
[ImporterHeader(Name = "颜色说明")]
public virtual string ColorExplain { get; set; }
}
}

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

@ -1440,7 +1440,7 @@
</member>
<member name="P:WY.NewJit.MsgBaseData.ImportErpAssemblyGroupDto.MaterialNum">
<summary>
物料号
SAP物料号
</summary>
</member>
<member name="P:WY.NewJit.MsgBaseData.QueryAssemblyCfgErpDto.ErpAssemblyCode">
@ -2281,6 +2281,16 @@
手工操作日期
</summary>
</member>
<member name="P:WY.NewJit.MsgCheck.BillM100Dto.SpecExplain">
<summary>
规格说明:HSC0DRCC0001
</summary>
</member>
<member name="P:WY.NewJit.MsgCheck.BillM100Dto.ColorExplain">
<summary>
颜色说明:车型描述后7位,石墨黑/云杉灰
</summary>
</member>
<member name="T:WY.NewJit.MsgCheck.BillM100PartDto">
<summary>
零件查询结果DTO
@ -2601,6 +2611,16 @@
柱护板打印状态(不为空时表示已打印)
</summary>
</member>
<member name="P:WY.NewJit.MsgCheck.ResultBillM100Dto.SpecExplain">
<summary>
规格说明:HSC0DRCC0001
</summary>
</member>
<member name="P:WY.NewJit.MsgCheck.ResultBillM100Dto.ColorExplain">
<summary>
颜色说明:车型描述后7位,石墨黑/云杉灰
</summary>
</member>
<member name="P:WY.NewJit.MsgCheck.TimeOutRemindResultDto.ProductLine">
<summary>
生产线
@ -4007,6 +4027,16 @@
单据表描述
</summary>
</member>
<member name="P:WY.NewJit.MsgCheck.UnknownAssemblys.ResultUnknownAssemblyDto.SpecExplain">
<summary>
规格说明:HSC0DRCC0001
</summary>
</member>
<member name="P:WY.NewJit.MsgCheck.UnknownAssemblys.ResultUnknownAssemblyDto.ColorExplain">
<summary>
颜色说明:车型描述后7位,石墨黑/云杉灰
</summary>
</member>
<member name="P:WY.NewJit.MsgCheck.UnknownAssemblys.ToParseInParam.IsSelectAll">
<summary>
是否选中全部
@ -4440,5 +4470,15 @@
R100接收时间
</summary>
</member>
<member name="P:WY.NewJit.PrintTable.WaitPrintDto.SpecExplain">
<summary>
规格说明:HSC0DRCC0001
</summary>
</member>
<member name="P:WY.NewJit.PrintTable.WaitPrintDto.ColorExplain">
<summary>
颜色说明:车型描述后7位,石墨黑/云杉灰
</summary>
</member>
</members>
</doc>

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

@ -492,200 +492,201 @@ SELECT top 1 v.Id
[DisableRequestSizeLimit]
public virtual async Task<ObjectResultDto<string>> ImportErpAssemblyAsync([FromForm] IFormFileCollection files)
{
_logger.LogDebug(_errorMessagePrefix + "ImportErpAssemblyAsync 进入");
ObjectResultDto<string> ret = new ObjectResultDto<string>();
try
{
List<MaterialExt> material3Lst = await _materialExtRepository.Where(itm => itm.MaterialType == "3").ToListAsync();
List<PartCfg> partCfgLst = await _partCfgRepository.GetListAsync(); //取结算件信息列表
List<ErpAssemblyInfo2Part> ass2partLst = new List<ErpAssemblyInfo2Part>();
using (var memoryStream = new MemoryStream())
{
//保存到内存流
IFormFile file = files[0];
await file.CopyToAsync(memoryStream);
memoryStream.Seek(0, SeekOrigin.Begin);
StreamReader sr = new StreamReader(memoryStream, Encoding.Default);
string strLine = ""; //记录每次读取的一行记录
string[] aryLine = null; //记录每行记录中的各字段内容
int columnCount = 0; //标示列数
//遍历文件行
while ((strLine = sr.ReadLine()) != null)
{
if (strLine.IsNullOrEmpty())
{
continue;
}
if (strLine.Contains('�'))
{
ret.Message = "导入文件的格式不对,请将其转换成utf-8格式后再导入";
ret.Status = false;
return ret;
}
aryLine = strLine.Split(" ");
columnCount = aryLine.Count();
if (columnCount == 0)
{
continue;
}
if (columnCount < 14)
{
ret.Message = "当前行的列数小于14,行号:" + aryLine[0];
ret.Status = false;
return ret;
}
ErpAssemblyInfo2Part ass2partObj = new ErpAssemblyInfo2Part();
ass2partObj.ErpAssemblyCode = aryLine[1].Trim();
ass2partObj.ErpAssemblyName = aryLine[2].Trim();
//从物料表取车型,操作员导入BOM时已经在SAP中录入物料了
MaterialExt materialObj = material3Lst.FirstOrDefault(itm => itm.MaterialNum == ass2partObj.ErpAssemblyCode);
if (materialObj != null)
{
ass2partObj.VehicleModel = materialObj.VehicleModel;
ass2partObj.MaterialMemo = materialObj.MaterialMemo?.Replace(" ",""); //SAP分组
}
//将模板中的SAP物料号转换成客户零件号
string sapMaterialNum = aryLine[11].Trim().Replace(" "," "); //取派格SAP物料号
var partCfgObj = partCfgLst.FirstOrDefault(itm => itm.RelationKey == sapMaterialNum);
if (partCfgObj != null)
{
ass2partObj.PartCode = partCfgObj.PartCode;
ass2partObj.PartCode2 = sapMaterialNum;
}
else
{
ret.Message = $"当前行的SAP物料号在零件信息表没有匹配的客户零件号,行号:{aryLine[0]},SAP物料号:{sapMaterialNum}";
ret.Status = false;
return ret;
}
ass2partObj.PartNum = aryLine[13].TryToDouble();
//数据校验
if (ass2partObj.ErpAssemblyCode == null || ass2partObj.ErpAssemblyCode.Trim() == "")
{
ret.Message = "当前行的ERP总成代码列是空,行号:" + aryLine[0];
ret.Status = false;
return ret;
}
if (ass2partObj.PartCode == null || ass2partObj.PartCode.Trim() == "")
{
if (partCfgObj.IsDisable == true) //不参与解析的也进入BOM, 报文解析时排除
{
}
else
{
ret.Message = "当前行的零件代码列是空,行号:" + aryLine[0] + "对应SAP零件号:" + sapMaterialNum;
ret.Status = false;
return ret;
}
}
if (ass2partObj.PartNum == null || ass2partObj.PartNum == 0)
{
ret.Message = "当前行的零件数量列是空或零,行号:" + aryLine[0];
ret.Status = false;
return ret;
}
ass2partLst.Add(ass2partObj);
}
}
//取Erp总成
List<AssemblyCfgErp> erpDataLst = await _assemblyCfgErpRepository.GetListAsync(itm => itm.NewVersionId == null, true);
//总成编码去重
List<string> erpAssemblyCodeLst = ass2partLst
.Where(itm => string.IsNullOrEmpty(itm.ErpAssemblyCode) == false)
.Select(itm => itm.ErpAssemblyCode)
.Distinct()
.ToList();
//校验导入
string repeatMsg = "";
foreach (var erpAssemblyCode in erpAssemblyCodeLst)
{
var partLst = ass2partLst.Where(itm => itm.ErpAssemblyCode == erpAssemblyCode).ToList();
if (partLst.Count() > 0)
{
string erpAssCode = partLst[0].ErpAssemblyCode;
string erpAssName = partLst[0].ErpAssemblyName;
string vehicleModel = partLst[0].VehicleModel;
AssemblyCfgErp erpObj = new AssemblyCfgErp(
GuidGenerator.Create(),
erpAssCode,
erpAssName,
0,
vehicleModel
);
foreach (var partObj in partLst)
{
erpObj.AddChildObject(
GuidGenerator.Create(),
partObj.PartCode,
partObj.PartNum,
partObj.PartCode2
);
}
List<string> repeatLst = _assemblyDomainService.ReturnRepeatErpAssembly(erpObj, erpDataLst, material3Lst); //返回重复总成
foreach (var repeatStr in repeatLst)
{
repeatMsg += repeatStr;
}
}
}
if (repeatMsg.Length > 0)
{
ret.Status = false;
ret.Message = repeatMsg;
return ret;
}
//遍历总成,插入数据库
int maxVer = _assemblyCfgErpRepository.Any() ? _assemblyCfgErpRepository.Max(itm => itm.ErpAssemblyVersion) : 0;
foreach (var erpAssemblyCode in erpAssemblyCodeLst)
{
var partLst = ass2partLst.Where(itm => itm.ErpAssemblyCode == erpAssemblyCode).ToList();
if (partLst.Count() > 0)
{
string erpAssCode = partLst[0].ErpAssemblyCode;
string erpAssName = partLst[0].ErpAssemblyName;
string vehicleModel = partLst[0].VehicleModel;
AssemblyCfgErp erpObj = new AssemblyCfgErp(
GuidGenerator.Create(),
erpAssCode,
erpAssName,
++maxVer,
vehicleModel
);
foreach (var partObj in partLst)
{
erpObj.AddChildObject(
GuidGenerator.Create(),
partObj.PartCode,
partObj.PartNum,
partObj.PartCode2
);
}
AssemblyCfgErp obj2 = await _assemblyCfgErpRepository.InsertAsync(erpObj);
await _assemblyDomainService.RemoveRepeatErpAssembly(obj2, erpDataLst); //删除重复总成
}
}
_globalSettingsDomainService.SetSetting(GlobalSettingsNameEnum., true);
ret.Status = true;
return ret;
}
catch (Exception ex)
{
ret.Status = false;
ret.Message = _errorMessagePrefix + "ImportErpAssemblyAsync 执行出错:" + ex.Message;
_logger.LogError(ret.Message);
return ret;
}
throw new NotImplementedException();
//_logger.LogDebug(_errorMessagePrefix + "ImportErpAssemblyAsync 进入");
//ObjectResultDto<string> ret = new ObjectResultDto<string>();
//try
//{
// List<MaterialExt> material3Lst = await _materialExtRepository.Where(itm => itm.MaterialType == "3").ToListAsync();
// List<PartCfg> partCfgLst = await _partCfgRepository.GetListAsync(); //取结算件信息列表
// List<ErpAssemblyInfo2Part> ass2partLst = new List<ErpAssemblyInfo2Part>();
// using (var memoryStream = new MemoryStream())
// {
// //保存到内存流
// IFormFile file = files[0];
// await file.CopyToAsync(memoryStream);
// memoryStream.Seek(0, SeekOrigin.Begin);
// StreamReader sr = new StreamReader(memoryStream, Encoding.Default);
// string strLine = ""; //记录每次读取的一行记录
// string[] aryLine = null; //记录每行记录中的各字段内容
// int columnCount = 0; //标示列数
// //遍历文件行
// while ((strLine = sr.ReadLine()) != null)
// {
// if (strLine.IsNullOrEmpty())
// {
// continue;
// }
// if (strLine.Contains('�'))
// {
// ret.Message = "导入文件的格式不对,请将其转换成utf-8格式后再导入";
// ret.Status = false;
// return ret;
// }
// aryLine = strLine.Split(" ");
// columnCount = aryLine.Count();
// if (columnCount == 0)
// {
// continue;
// }
// if (columnCount < 14)
// {
// ret.Message = "当前行的列数小于14,行号:" + aryLine[0];
// ret.Status = false;
// return ret;
// }
// ErpAssemblyInfo2Part ass2partObj = new ErpAssemblyInfo2Part();
// ass2partObj.ErpAssemblyCode = aryLine[1].Trim();
// ass2partObj.ErpAssemblyName = aryLine[2].Trim();
// //从物料表取车型,操作员导入BOM时已经在SAP中录入物料了
// MaterialExt materialObj = material3Lst.FirstOrDefault(itm => itm.MaterialNum == ass2partObj.ErpAssemblyCode);
// if (materialObj != null)
// {
// ass2partObj.VehicleModel = materialObj.VehicleModel;
// ass2partObj.MaterialMemo = materialObj.MaterialMemo?.Replace(" ",""); //SAP分组
// }
// //将模板中的SAP物料号转换成客户零件号
// string sapMaterialNum = aryLine[11].Trim().Replace(" "," "); //取派格SAP物料号
// var partCfgObj = partCfgLst.FirstOrDefault(itm => itm.RelationKey == sapMaterialNum);
// if (partCfgObj != null)
// {
// ass2partObj.PartCode = partCfgObj.PartCode;
// ass2partObj.PartCode2 = sapMaterialNum;
// }
// else
// {
// ret.Message = $"当前行的SAP物料号在零件信息表没有匹配的客户零件号,行号:{aryLine[0]},SAP物料号:{sapMaterialNum}";
// ret.Status = false;
// return ret;
// }
// ass2partObj.PartNum = aryLine[13].TryToDouble();
// //数据校验
// if (ass2partObj.ErpAssemblyCode == null || ass2partObj.ErpAssemblyCode.Trim() == "")
// {
// ret.Message = "当前行的ERP总成代码列是空,行号:" + aryLine[0];
// ret.Status = false;
// return ret;
// }
// if (ass2partObj.PartCode == null || ass2partObj.PartCode.Trim() == "")
// {
// if (partCfgObj.IsDisable == true) //不参与解析的也进入BOM, 报文解析时排除
// {
// }
// else
// {
// ret.Message = "当前行的零件代码列是空,行号:" + aryLine[0] + "对应SAP零件号:" + sapMaterialNum;
// ret.Status = false;
// return ret;
// }
// }
// if (ass2partObj.PartNum == null || ass2partObj.PartNum == 0)
// {
// ret.Message = "当前行的零件数量列是空或零,行号:" + aryLine[0];
// ret.Status = false;
// return ret;
// }
// ass2partLst.Add(ass2partObj);
// }
// }
// //取Erp总成
// List<AssemblyCfgErp> erpDataLst = await _assemblyCfgErpRepository.GetListAsync(itm => itm.NewVersionId == null, true);
// //总成编码去重
// List<string> erpAssemblyCodeLst = ass2partLst
// .Where(itm => string.IsNullOrEmpty(itm.ErpAssemblyCode) == false)
// .Select(itm => itm.ErpAssemblyCode)
// .Distinct()
// .ToList();
// //校验导入
// string repeatMsg = "";
// foreach (var erpAssemblyCode in erpAssemblyCodeLst)
// {
// var partLst = ass2partLst.Where(itm => itm.ErpAssemblyCode == erpAssemblyCode).ToList();
// if (partLst.Count() > 0)
// {
// string erpAssCode = partLst[0].ErpAssemblyCode;
// string erpAssName = partLst[0].ErpAssemblyName;
// string vehicleModel = partLst[0].VehicleModel;
// AssemblyCfgErp erpObj = new AssemblyCfgErp(
// GuidGenerator.Create(),
// erpAssCode,
// erpAssName,
// 0,
// vehicleModel
// );
// foreach (var partObj in partLst)
// {
// erpObj.AddChildObject(
// GuidGenerator.Create(),
// partObj.PartCode,
// partObj.PartNum,
// partObj.PartCode2
// );
// }
// List<string> repeatLst = _assemblyDomainService.ReturnRepeatErpAssembly(erpObj, erpDataLst, material3Lst); //返回重复总成
// foreach (var repeatStr in repeatLst)
// {
// repeatMsg += repeatStr;
// }
// }
// }
// if (repeatMsg.Length > 0)
// {
// ret.Status = false;
// ret.Message = repeatMsg;
// return ret;
// }
// //遍历总成,插入数据库
// int maxVer = _assemblyCfgErpRepository.Any() ? _assemblyCfgErpRepository.Max(itm => itm.ErpAssemblyVersion) : 0;
// foreach (var erpAssemblyCode in erpAssemblyCodeLst)
// {
// var partLst = ass2partLst.Where(itm => itm.ErpAssemblyCode == erpAssemblyCode).ToList();
// if (partLst.Count() > 0)
// {
// string erpAssCode = partLst[0].ErpAssemblyCode;
// string erpAssName = partLst[0].ErpAssemblyName;
// string vehicleModel = partLst[0].VehicleModel;
// AssemblyCfgErp erpObj = new AssemblyCfgErp(
// GuidGenerator.Create(),
// erpAssCode,
// erpAssName,
// ++maxVer,
// vehicleModel
// );
// foreach (var partObj in partLst)
// {
// erpObj.AddChildObject(
// GuidGenerator.Create(),
// partObj.PartCode,
// partObj.PartNum,
// partObj.PartCode2
// );
// }
// AssemblyCfgErp obj2 = await _assemblyCfgErpRepository.InsertAsync(erpObj);
// await _assemblyDomainService.RemoveRepeatErpAssembly(obj2, erpDataLst); //删除重复总成
// }
// }
// _globalSettingsDomainService.SetSetting(GlobalSettingsNameEnum.刷新报文解析缓存, true);
// ret.Status = true;
// return ret;
//}
//catch (Exception ex)
//{
// ret.Status = false;
// ret.Message = _errorMessagePrefix + "ImportErpAssemblyAsync 执行出错:" + ex.Message;
// _logger.LogError(ret.Message);
// return ret;
//}
}
/// <summary>
/// 总成组导入
/// 总成组导入【红旗版本】
/// </summary>
/// <param name="files"></param>
/// <returns></returns>
@ -830,12 +831,12 @@ SELECT top 1 v.Id
var partdists = srcLst.Select(r => r.MaterialNum).Distinct();
foreach (var material in partdists)
foreach (var sapMaterial in partdists)
{
var material3 = material3Lst.FirstOrDefault(r => r.MaterialNum == material);
var material3 = material3Lst.FirstOrDefault(r => r.MaterialNum == sapMaterial);
if (material3 == null)
{
error += $"零件编号【{material}】系统中不存在,请检查后再导入\r\n";
error += $"零件编号【{sapMaterial}】系统中不存在,请检查后再导入\r\n";
}
}
@ -856,27 +857,27 @@ SELECT top 1 v.Id
string arrStr = string.Join(',', arr);
var qry = from item in srcLst
group item by item.SpecExplain into g
group item by new { item.SpecExplain, item.ColorExplain } into g
select new
{
SpecExplain = g.Key,
ColorExplain = g.ElementAt(0).ColorExplain,
SpecExplain = g.Key.SpecExplain,
ColorExplain = g.Key.ColorExplain,
Details = g.Select(itm => itm.MaterialNum).ToList()
};
foreach (var item in qry)
{
if (item.Details.Count != 4)
{
strBuild.AppendLine($"规格说明{item.SpecExplain}包含的物料号不是4个");
strBuild.AppendLine($"规格说明{item.SpecExplain}、颜色说明{item.ColorExplain}包含的物料号不是4个");
}
//遍历物料号
List<string> strLst = new List<string>();
foreach (string materialNum in item.Details)
foreach (string sapMaterialNum in item.Details)
{
var materialObj = material3Lst.FirstOrDefault(itm => itm.RelationKey == materialNum);
var materialObj = material3Lst.FirstOrDefault(itm => itm.MaterialNum == sapMaterialNum);
if (materialObj == null)
{
strBuild.AppendLine($"规格说明{item.SpecExplain}:物料号{materialNum}在物料表不存在!");
strBuild.AppendLine($"规格说明{item.SpecExplain}:物料号{sapMaterialNum}在物料表不存在!");
}
else
{
@ -886,7 +887,7 @@ SELECT top 1 v.Id
}
else
{
strBuild.AppendLine($"规格说明{item.SpecExplain}:物料号{materialNum}的MaterialType2不是【{arrStr}】其中之一!");
strBuild.AppendLine($"规格说明{item.SpecExplain}:物料号{sapMaterialNum}的MaterialType2不是【{arrStr}】其中之一!");
}
}
}

4
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/UnknownAssemblys/UnknownAssemblyAppService.cs

@ -222,7 +222,7 @@ 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,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, SpecExplain, ColorExplain from FisBillM100 where BillStatus =1
)
,d as
(
@ -231,7 +231,7 @@ with b as
select * from
(
select ROW_NUMBER() OVER(order by b.SerialNumStr) as row_number,
a.*, b.HostSN,b.KNR,VIN,b.AssemblyID,b.OnlineTime,b.ReceiveTime,b.VehicleModelCode,b.[Version],b.BillStatus, '' as MessageFileName, b.Description as BillDescription
a.*, b.HostSN,b.KNR,VIN,b.AssemblyID,b.OnlineTime,b.ReceiveTime,b.VehicleModelCode,b.[Version],b.BillStatus, '' as MessageFileName, b.Description as BillDescription, b.SpecExplain, b.ColorExplain
from FisUnknownAssembly a
join b on a.BillID = b.Id
left join d on b.VehicleModelCode = d.DicItemCode

4
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/PrintTable/WaitPrintAppService.cs

@ -43,7 +43,7 @@ namespace WY.NewJit.PrintTable
}
}
private const string _providerCode = "0709FAW-VW7XH";
private const string _providerCode = "LAJ46"; //0709FAW-VW7XH
/// <summary>
/// 柱护板缓存列表(打印柱护板时用到)
@ -454,7 +454,7 @@ namespace WY.NewJit.PrintTable
List<AssemblyCfgErp> erpAssemblyLst = GetErpAssemblyListByBill((Guid)billObj.AssemblyID);
List<string> erpCodeLst = erpAssemblyLst.Select(itm => itm.ErpAssemblyCode).ToList();
//根据ERP总成编码取对应的物料扩展信息
List<MaterialExt> materialExtLst = _materialExtRepository.Where(itm => erpCodeLst.Contains(itm.RelationKey)).ToList();
List<MaterialExt> materialExtLst = _materialExtRepository.Where(itm => erpCodeLst.Contains(itm.MaterialNum)).ToList();
if (erpCodeLst.Count != 4)
{
promMsg += $"*总成数量是{erpCodeLst.Count}*";

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

@ -409,7 +409,7 @@
</member>
<member name="M:WY.NewJit.MsgBaseData.AssemblyCfgErpAppService.ImportErpAssemblyGroupAsync(Microsoft.AspNetCore.Http.IFormFileCollection)">
<summary>
总成组导入
总成组导入【红旗版本】
</summary>
<param name="files"></param>
<returns></returns>

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

@ -236,6 +236,8 @@ namespace WY.NewJit.EdiReceive.Services
//插入M100、未打印表
m100Obj.SetAssemblyID(vehicleAssemblyResu.Id);
m100Obj.SetBillStatus(BillStatusEnum.Match);
m100Obj.SpecExplain = specExplain;
m100Obj.ColorExplain = colorExplain;
var insM100Ret = await _hqM100DomainServie.InsertM100(m100Obj, true);
if (insM100Ret == null)
{
@ -249,6 +251,8 @@ namespace WY.NewJit.EdiReceive.Services
//更新单据表
m100Obj.SetAssemblyID(null);
m100Obj.SetBillStatus(BillStatusEnum.NotMatch);
m100Obj.SpecExplain = specExplain;
m100Obj.ColorExplain = colorExplain;
var succObj1 = await _hqM100DomainServie.InsertM100(m100Obj, true);
//不匹配时,插入未知总成

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

@ -131,6 +131,8 @@ namespace WY.NewJit.MsgCheck
waitPrint.CreatorId = m100Ret.CreatorId;
waitPrint.LastModificationTime = m100Ret.LastModificationTime;
waitPrint.LastModifierId = m100Ret.LastModifierId;
waitPrint.SpecExplain = m100Ret.SpecExplain;
waitPrint.ColorExplain = m100Ret.ColorExplain;
}
private void Set_WaitPrint(WaitPrint sourceWaitPrint, WaitPrint targetWaitPrint)
@ -153,6 +155,8 @@ namespace WY.NewJit.MsgCheck
targetWaitPrint.CreatorId = sourceWaitPrint.CreatorId;
targetWaitPrint.LastModificationTime = sourceWaitPrint.LastModificationTime;
targetWaitPrint.LastModifierId = sourceWaitPrint.LastModifierId;
targetWaitPrint.SpecExplain = sourceWaitPrint.SpecExplain;
targetWaitPrint.ColorExplain = sourceWaitPrint.ColorExplain;
}
public async Task<Dictionary<Guid, List<BillM100Part>>> GetM100PartDic(List<Guid> m100IdLst)

105
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgBaseData/Services/AssemblyDomainService.cs

@ -143,59 +143,60 @@ namespace WY.NewJit.MsgBaseData
[UnitOfWork]
public virtual async Task SyncErpAssemblyAsync(int takeRecordCount)
{
string sql = @"
SELECT AppraisalCategory as RelationKey, ErpMaterialCode, MaterialDesc, SettleMaterialCode, Qty
FROM [SettleAccountService].[dbo].[v_relationship] a
where not exists (select * from [dbo].[FisAssemblyCfgErp] e where a.AppraisalCategory = e.RelationKey)
order by [Version], ErpMaterialCode, MaterialDesc, SettleMaterialCode, Qty
";
//取ERP总成 最大版本
int maxVer = _assemblyCfgErpRepository.Any() ? _assemblyCfgErpRepository.Max(itm => itm.ErpAssemblyVersion) : 0;
//初始化ERP总成及结算件数据
await ClearPub(maxVer);
//取增量数据
List<V_Relationship> relationshipLst = await _newJitDapperRepository.GetListBySqlAsync<V_Relationship>(sql, true);
List<string> keyLst = relationshipLst.Select(itm => itm.RelationKey).Distinct().Take(takeRecordCount).ToList();
throw new NotImplementedException();
// string sql = @"
//SELECT AppraisalCategory as RelationKey, ErpMaterialCode, MaterialDesc, SettleMaterialCode, Qty
// FROM [SettleAccountService].[dbo].[v_relationship] a
// where not exists (select * from [dbo].[FisAssemblyCfgErp] e where a.AppraisalCategory = e.RelationKey)
// order by [Version], ErpMaterialCode, MaterialDesc, SettleMaterialCode, Qty
//";
// //取ERP总成 最大版本
// int maxVer = _assemblyCfgErpRepository.Any() ? _assemblyCfgErpRepository.Max(itm => itm.ErpAssemblyVersion) : 0;
// //初始化ERP总成及结算件数据
// await ClearPub(maxVer);
// //取增量数据
// List<V_Relationship> relationshipLst = await _newJitDapperRepository.GetListBySqlAsync<V_Relationship>(sql, true);
// List<string> keyLst = relationshipLst.Select(itm => itm.RelationKey).Distinct().Take(takeRecordCount).ToList();
foreach (string keyStr in keyLst)
{
List<V_Relationship> filterLst = relationshipLst.Where(itm => itm.RelationKey == keyStr).ToList();
//填充erp主实体
AssemblyCfgErp targetObj = new AssemblyCfgErp(
_guidGenerator.Create(),
filterLst[0].ErpMaterialCode,
filterLst[0].MaterialDesc,
++maxVer,
null,
filterLst[0].RelationKey
);
//填充erp子实体
foreach (V_Relationship filterItm in filterLst)
{
targetObj.AddChildObject(
_guidGenerator.Create(),
filterItm.SettleMaterialCode,
filterItm.Qty,
"",
false
);
}
//判断结算件配置重复
List<ErpAssembly2> repeatIdLst = await FindRepeatErpAssembly(targetObj);
if (repeatIdLst == null || repeatIdLst.Count == 0) //没有重复,直接插入
{
AssemblyCfgErp obj2 = await _assemblyCfgErpRepository.InsertAsync(targetObj);
}
else //存在重复
{
foreach (ErpAssembly2 item in repeatIdLst)
{
//更新历史数据NewVersionId字段
await UpdateNewVersionId(item.ErpAssemblyId, targetObj.Id);
}
AssemblyCfgErp obj2 = await _assemblyCfgErpRepository.InsertAsync(targetObj);
}
}
// foreach (string keyStr in keyLst)
// {
// List<V_Relationship> filterLst = relationshipLst.Where(itm => itm.RelationKey == keyStr).ToList();
// //填充erp主实体
// AssemblyCfgErp targetObj = new AssemblyCfgErp(
// _guidGenerator.Create(),
// filterLst[0].ErpMaterialCode,
// filterLst[0].MaterialDesc,
// ++maxVer,
// null,
// filterLst[0].RelationKey
// );
// //填充erp子实体
// foreach (V_Relationship filterItm in filterLst)
// {
// targetObj.AddChildObject(
// _guidGenerator.Create(),
// filterItm.SettleMaterialCode,
// filterItm.Qty,
// "",
// false
// );
// }
// //判断结算件配置重复
// List<ErpAssembly2> repeatIdLst = await FindRepeatErpAssembly(targetObj);
// if (repeatIdLst == null || repeatIdLst.Count == 0) //没有重复,直接插入
// {
// AssemblyCfgErp obj2 = await _assemblyCfgErpRepository.InsertAsync(targetObj);
// }
// else //存在重复
// {
// foreach (ErpAssembly2 item in repeatIdLst)
// {
// //更新历史数据NewVersionId字段
// await UpdateNewVersionId(item.ErpAssemblyId, targetObj.Id);
// }
// AssemblyCfgErp obj2 = await _assemblyCfgErpRepository.InsertAsync(targetObj);
// }
// }
}
/// <summary>

9
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Entitys/BillM100.cs

@ -134,6 +134,15 @@ namespace WY.NewJit.MsgCheck
/// </summary>
public virtual bool? IsPartSwitch { get; set; }
/// <summary>
/// 规格说明:HSC0DRCC0001
/// </summary>
public virtual string SpecExplain { get; set; }
/// <summary>
/// 颜色说明:车型描述后7位,石墨黑/云杉灰
/// </summary>
public virtual string ColorExplain { get; set; }
public BillM100()
{

10
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/PrintTable/Entitys/WaitPrint.cs

@ -110,6 +110,16 @@ namespace WY.NewJit.PrintTable
/// </summary>
public Guid? LastModifierId { get; set; }
/// <summary>
/// 规格说明:HSC0DRCC0001
/// </summary>
public virtual string SpecExplain { get; set; }
/// <summary>
/// 颜色说明:车型描述后7位,石墨黑/云杉灰
/// </summary>
public virtual string ColorExplain { get; set; }
public WaitPrint()
{

7
src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Web/appsettings.json

@ -11,10 +11,11 @@
//"Default": "Server=192.168.0.140;Database=ABP;User ID=sa;Password=Microsoft2008;",
//"WMS": "Server=192.168.0.140;Database=CPAT_WMS_TEST;User ID=sa;Password=Microsoft2008;"
"NewJitPG": "Server=dev.ccwin-in.com,6208;Database=NewJitPG_HQ;uid=sa;pwd=ChangkeTec@2021;",
"Default": "Server=dev.ccwin-in.com,6208;Database=ABP;User ID=sa;Password=ChangkeTec@2021;",
"WMS": "Server=dev.ccwin-in.com,6208;Database=CPAT_WMS;User ID=sa;Password=ChangkeTec@2021;"
//"NewJitPG": "Server=dev.ccwin-in.com,6208;Database=NewJitPG_HQ;uid=sa;pwd=ChangkeTec@2021;",
//"WMS": "Server=dev.ccwin-in.com,6208;Database=CPAT_WMS;User ID=sa;Password=ChangkeTec@2021;"
"NewJitPG": "Server=192.168.0.68;Database=NewJitPG_HQ;uid=sa;pwd=Microsoft@2022;",
"WMS": "Server=192.168.0.140;Database=CPAT_WMS_TEST;User ID=sa;Password=Microsoft2008;"
},
"AuthServer": {
"Authority": "http://dev.ccwin-in.com:16077",

Loading…
Cancel
Save