105040 增加下单日期字段,增加逻辑
This commit is contained in:
parent
a8815b8f9a
commit
ce014b95e0
|
@ -301,6 +301,14 @@
|
||||||
Binding="{Binding Quantity}"
|
Binding="{Binding Quantity}"
|
||||||
Header="数量"
|
Header="数量"
|
||||||
IsReadOnly="True" />
|
IsReadOnly="True" />
|
||||||
|
<DataGridTextColumn
|
||||||
|
Binding="{Binding NumberTubeSpec}"
|
||||||
|
Header="号码管型号"
|
||||||
|
IsReadOnly="True" />
|
||||||
|
<DataGridTextColumn
|
||||||
|
Binding="{Binding NumberTubeMaterialNo}"
|
||||||
|
Header="号码管料号"
|
||||||
|
IsReadOnly="True" />
|
||||||
<DataGridTextColumn
|
<DataGridTextColumn
|
||||||
Binding="{Binding DiscolorationDesc}"
|
Binding="{Binding DiscolorationDesc}"
|
||||||
Header="变色套型号"
|
Header="变色套型号"
|
||||||
|
|
|
@ -134,5 +134,10 @@
|
||||||
/// E绝缘软套型号物料编码
|
/// E绝缘软套型号物料编码
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string InsulationMaterialNo { get; set; }
|
public string InsulationMaterialNo { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 下单日期
|
||||||
|
/// </summary>
|
||||||
|
public string OrderDate { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,35 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Models
|
||||||
|
|
||||||
private string imprint;
|
private string imprint;
|
||||||
|
|
||||||
|
private string numberTubeSpec;
|
||||||
|
private string numberTubeMaterialNo;
|
||||||
|
private string numberTubeContent;
|
||||||
|
/// <summary>
|
||||||
|
/// B号码管规格
|
||||||
|
/// </summary>
|
||||||
|
public string NumberTubeSpec
|
||||||
|
{
|
||||||
|
get => numberTubeSpec;
|
||||||
|
set => SetProperty(ref numberTubeSpec, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// B号码管物料编码
|
||||||
|
/// </summary>
|
||||||
|
public string NumberTubeMaterialNo
|
||||||
|
{
|
||||||
|
get => numberTubeMaterialNo;
|
||||||
|
set => SetProperty(ref numberTubeMaterialNo, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// B号码管内容
|
||||||
|
/// </summary>
|
||||||
|
public string NumberTubeContent
|
||||||
|
{
|
||||||
|
get => numberTubeContent;
|
||||||
|
set => SetProperty(ref numberTubeContent, value);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 导线名称
|
/// 导线名称
|
||||||
|
|
|
@ -66,11 +66,15 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Utils
|
||||||
// .ToList();
|
// .ToList();
|
||||||
//}
|
//}
|
||||||
|
|
||||||
public static string GetNumberTube(string numberTubeSpec)
|
public static dynamic GetNumberTube(string wireModel)
|
||||||
{
|
{
|
||||||
CheckAndGetCache();
|
CheckAndGetCache();
|
||||||
return _terminalMappingCache.Where(item => item.TubeModel == numberTubeSpec)
|
return _terminalMappingCache.Where(item => item.WireModelSpecification == wireModel)
|
||||||
.Select(item => item.TubeMaterialCode)
|
.Select(item => new
|
||||||
|
{
|
||||||
|
item.TubeModel,
|
||||||
|
item.TubeMaterialCode,
|
||||||
|
})
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
}
|
}
|
||||||
public static void SaveByTemplate(object data, string newFilePath)
|
public static void SaveByTemplate(object data, string newFilePath)
|
||||||
|
|
|
@ -36,11 +36,21 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
|
||||||
{
|
{
|
||||||
CheckCeCompliance(item);
|
CheckCeCompliance(item);
|
||||||
}
|
}
|
||||||
|
CheckNumberTube(item);
|
||||||
|
|
||||||
CheckInsulation(item);
|
CheckInsulation(item);
|
||||||
CheckTerminals(item);
|
CheckTerminals(item);
|
||||||
CheckDuplicateModel(item);
|
CheckDuplicateModel(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CheckNumberTube(StuffedDataModel item)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(item.NumberTubeSpec))
|
||||||
|
{
|
||||||
|
SetItemError(item, "未匹配到正确的号码管!\r\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void CheckRequiredFields(StuffedDataModel item)
|
private void CheckRequiredFields(StuffedDataModel item)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(item.RearTerminalMaterialCode))
|
if (string.IsNullOrEmpty(item.RearTerminalMaterialCode))
|
||||||
|
@ -92,7 +102,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
|
||||||
{
|
{
|
||||||
if (insMatch.Value != "RV1.5")
|
if (insMatch.Value != "RV1.5")
|
||||||
{
|
{
|
||||||
SetItemError(item, "变色套大小与线径不匹配!");
|
SetItemError(item, "变色套(绝缘软套)大小与线径不匹配!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -100,18 +110,18 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
|
||||||
var insDiameter = double.Parse(insMatch.Value.Replace("V-", ""));
|
var insDiameter = double.Parse(insMatch.Value.Replace("V-", ""));
|
||||||
if (Math.Abs(insDiameter - itemWireDiameter) > 0)
|
if (Math.Abs(insDiameter - itemWireDiameter) > 0)
|
||||||
{
|
{
|
||||||
SetItemError(item, "变色套大小与线径不匹配!");
|
SetItemError(item, "变色套(绝缘软套)大小与线径不匹配!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetItemError(item, "变色套未匹配到平方数!");
|
SetItemError(item, "变色套(绝缘软套)未匹配到大小!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetItemError(item, "未匹配到线材平方数!");
|
SetItemError(item, "未匹配到线材大小!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -140,7 +150,23 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
|
||||||
{
|
{
|
||||||
if (StuffedData.Count(it => it != null && it.Model == item.Model) > 1)
|
if (StuffedData.Count(it => it != null && it.Model == item.Model) > 1)
|
||||||
{
|
{
|
||||||
SetItemError(item, $"{item.Model} 该型号存在重复!\r\n");
|
if (string.IsNullOrEmpty(item.WireLength))
|
||||||
|
{
|
||||||
|
SetItemError(item, $"线长度获取异常!\r\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var newModel = $"RV-{item.WireColor}-1x{item.CrossSection}-{item.WireLength + 5}-16×N2-{item.WireNumber}";
|
||||||
|
if (StuffedData.Any(it => it.Model == newModel))
|
||||||
|
{
|
||||||
|
SetItemError(item, $"{item.Model} 该型号存在重复!\r\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
item.WireLength += 5;
|
||||||
|
item.Model = newModel;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -168,6 +168,7 @@ public partial class MainViewModel : INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
FlagType = WireFlagType.Dual;
|
FlagType = WireFlagType.Dual;
|
||||||
}
|
}
|
||||||
|
|
||||||
var reportDatas = new ConcurrentBag<ReportModel>();
|
var reportDatas = new ConcurrentBag<ReportModel>();
|
||||||
//foreach (var entry in data)
|
//foreach (var entry in data)
|
||||||
data.AsParallel().WithDegreeOfParallelism(8).ForAll(entry =>
|
data.AsParallel().WithDegreeOfParallelism(8).ForAll(entry =>
|
||||||
|
@ -177,11 +178,10 @@ public partial class MainViewModel : INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
if (!entry.Properties.ContainsKey(column.ColumnID)) continue;
|
if (!entry.Properties.ContainsKey(column.ColumnID)) continue;
|
||||||
var value = entry.Properties[column.ColumnID].GetDisplayValue();
|
var value = entry.Properties[column.ColumnID].GetDisplayValue();
|
||||||
|
|
||||||
var property = typeof(ReportModel).GetProperty(column.ID);
|
var property = typeof(ReportModel).GetProperty(column.ID);
|
||||||
if (property != null)
|
property?.SetValue(obj, value ?? "");
|
||||||
{
|
|
||||||
property.SetValue(obj, value ?? "");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
reportDatas.Add(obj);
|
reportDatas.Add(obj);
|
||||||
}
|
}
|
||||||
|
@ -261,7 +261,12 @@ public partial class MainViewModel : INotifyPropertyChanged
|
||||||
//MID(输出报表!J2,1,FIND(" mm2",输出报表!J2)-1)
|
//MID(输出报表!J2,1,FIND(" mm2",输出报表!J2)-1)
|
||||||
data.CrossSection = item.CoreDiameter.Replace(" mm2", "").Trim();
|
data.CrossSection = item.CoreDiameter.Replace(" mm2", "").Trim();
|
||||||
//=ROUND(MID(输出报表!H2,1,FIND(" mm",输出报表!H2)-1),0)+0
|
//=ROUND(MID(输出报表!H2,1,FIND(" mm",输出报表!H2)-1),0)+0
|
||||||
data.WireLength = item.Length.Replace(" mm", "").Trim();
|
if (double.TryParse(item.Length.Replace(" mm", "").Trim(), out double wireLength))
|
||||||
|
data.WireLength = $"{Math.Round(wireLength, 0)}";
|
||||||
|
else
|
||||||
|
{
|
||||||
|
data.WireLength = string.Empty;
|
||||||
|
}
|
||||||
//data.WireNumber = item.Imprint;
|
//data.WireNumber = item.Imprint;
|
||||||
data.Quantity = 1;
|
data.Quantity = 1;
|
||||||
//"RV-"&A2&"-"&"1×"&J2&"-"&L2&"-"&"16×N2"&"-"&M2
|
//"RV-"&A2&"-"&"1×"&J2&"-"&L2&"-"&"16×N2"&"-"&M2
|
||||||
|
@ -281,6 +286,14 @@ public partial class MainViewModel : INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
data.Insulation = new InsulationModel();
|
data.Insulation = new InsulationModel();
|
||||||
}
|
}
|
||||||
|
var numberTube = ExcelHelper.GetNumberTube(data.WireModel);
|
||||||
|
if (numberTube != null)
|
||||||
|
{
|
||||||
|
|
||||||
|
data.NumberTubeSpec = numberTube.TubeModel;
|
||||||
|
data.NumberTubeMaterialNo = numberTube.TubeMaterialCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//if (datas.Any(it => it.Model == data.Model))
|
//if (datas.Any(it => it.Model == data.Model))
|
||||||
|
@ -352,43 +365,43 @@ public partial class MainViewModel : INotifyPropertyChanged
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取号码管规格
|
/// 获取号码管规格
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string GetNumberTubeSpecification(string crossSection, string colorCode)
|
//public string GetNumberTubeSpecification(string crossSection, string colorCode)
|
||||||
{
|
//{
|
||||||
if (crossSection == "16")
|
// if (crossSection == "16")
|
||||||
{
|
// {
|
||||||
if (colorCode == "YE") return "黄色热缩管φ12/定制";
|
// if (colorCode == "YE") return "黄色热缩管φ12/定制";
|
||||||
if (colorCode == "GN") return "绿色热缩管φ12/定制";
|
// if (colorCode == "GN") return "绿色热缩管φ12/定制";
|
||||||
if (colorCode == "RD") return "红色热缩管φ12/定制";
|
// if (colorCode == "RD") return "红色热缩管φ12/定制";
|
||||||
if (colorCode == "BU") return "蓝色热缩管φ12/定制";
|
// if (colorCode == "BU") return "蓝色热缩管φ12/定制";
|
||||||
if (colorCode == "GNYE") return "黄绿色热缩管φ12/定制";
|
// if (colorCode == "GNYE") return "黄绿色热缩管φ12/定制";
|
||||||
}
|
// }
|
||||||
else if (crossSection == "0.3" || crossSection == "0.5" || crossSection == "0.75" || crossSection == "1")
|
// else if (crossSection == "0.3" || crossSection == "0.5" || crossSection == "0.75" || crossSection == "1")
|
||||||
{
|
// {
|
||||||
return "白色号码管φ2.5/定制";
|
// return "白色号码管φ2.5/定制";
|
||||||
}
|
// }
|
||||||
else if (crossSection == "1.5")
|
// else if (crossSection == "1.5")
|
||||||
{
|
// {
|
||||||
return "白色号码管φ3/定制";
|
// return "白色号码管φ3/定制";
|
||||||
}
|
// }
|
||||||
else if (crossSection == "2.5")
|
// else if (crossSection == "2.5")
|
||||||
{
|
// {
|
||||||
return "白色号码管φ4/定制";
|
// return "白色号码管φ4/定制";
|
||||||
}
|
// }
|
||||||
else if (crossSection == "4")
|
// else if (crossSection == "4")
|
||||||
{
|
// {
|
||||||
return "白色号码管φ5/定制";
|
// return "白色号码管φ5/定制";
|
||||||
}
|
// }
|
||||||
else if (crossSection == "6")
|
// else if (crossSection == "6")
|
||||||
{
|
// {
|
||||||
return "白色号码管φ6/定制";
|
// return "白色号码管φ6/定制";
|
||||||
}
|
// }
|
||||||
else if (crossSection == "10")
|
// else if (crossSection == "10")
|
||||||
{
|
// {
|
||||||
return "白色号码管φ8/定制";
|
// return "白色号码管φ8/定制";
|
||||||
}
|
// }
|
||||||
|
|
||||||
return string.Empty;
|
// return string.Empty;
|
||||||
}
|
//}
|
||||||
public event PropertyChangedEventHandler PropertyChanged;
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
|
||||||
private void OnPropertyChanged(string propertyName)
|
private void OnPropertyChanged(string propertyName)
|
||||||
|
@ -414,11 +427,12 @@ public partial class MainViewModel : INotifyPropertyChanged
|
||||||
ExportData = [];
|
ExportData = [];
|
||||||
int seqNo = 1;
|
int seqNo = 1;
|
||||||
var dataList = new List<ExportModel>();
|
var dataList = new List<ExportModel>();
|
||||||
|
var nowDateStr = DateTime.Now.ToString("yyyy-MM-dd");
|
||||||
//foreach (var stuffedDataModel in StuffedData)
|
//foreach (var stuffedDataModel in StuffedData)
|
||||||
StuffedData.AsParallel().WithDegreeOfParallelism(1).ForAll(stuffedDataModel =>
|
StuffedData.AsParallel().WithDegreeOfParallelism(1).ForAll(stuffedDataModel =>
|
||||||
|
|
||||||
{
|
{
|
||||||
var numberTubeSpec = GetNumberTubeSpecification(stuffedDataModel.CrossSection, stuffedDataModel.WireColor);
|
//var numberTubeSpec = GetNumberTubeSpecification(stuffedDataModel.CrossSection, stuffedDataModel.WireColor);
|
||||||
var exportModel = new ExportModel
|
var exportModel = new ExportModel
|
||||||
{
|
{
|
||||||
SeqNo = seqNo.ToString(),
|
SeqNo = seqNo.ToString(),
|
||||||
|
@ -429,8 +443,8 @@ public partial class MainViewModel : INotifyPropertyChanged
|
||||||
WireOrTubeSpec = stuffedDataModel.WireModel,
|
WireOrTubeSpec = stuffedDataModel.WireModel,
|
||||||
WireOrTubeMaterialNo = stuffedDataModel.WireCode,
|
WireOrTubeMaterialNo = stuffedDataModel.WireCode,
|
||||||
WireOrTubeLength = Math.Round(double.Parse(stuffedDataModel.WireLength), 0),
|
WireOrTubeLength = Math.Round(double.Parse(stuffedDataModel.WireLength), 0),
|
||||||
NumberTubeSpec = numberTubeSpec,
|
NumberTubeSpec = stuffedDataModel.NumberTubeSpec,
|
||||||
NumberTubeMaterialNo = ExcelHelper.GetNumberTube(numberTubeSpec),
|
NumberTubeMaterialNo = stuffedDataModel.NumberTubeMaterialNo,
|
||||||
NumberTubeContent = stuffedDataModel.Imprint,
|
NumberTubeContent = stuffedDataModel.Imprint,
|
||||||
FrontTerminalModel = stuffedDataModel.FrontTerminalModel,
|
FrontTerminalModel = stuffedDataModel.FrontTerminalModel,
|
||||||
FrontTerminalMaterialNo = stuffedDataModel.FrontTerminalMaterialCode,
|
FrontTerminalMaterialNo = stuffedDataModel.FrontTerminalMaterialCode,
|
||||||
|
@ -439,7 +453,8 @@ public partial class MainViewModel : INotifyPropertyChanged
|
||||||
RearTerminalMaterialNo = stuffedDataModel.RearTerminalMaterialCode,
|
RearTerminalMaterialNo = stuffedDataModel.RearTerminalMaterialCode,
|
||||||
RearTerminalStripLength = stuffedDataModel.RearStripLength,
|
RearTerminalStripLength = stuffedDataModel.RearStripLength,
|
||||||
InsulationModel = stuffedDataModel.Insulation?.Specification,
|
InsulationModel = stuffedDataModel.Insulation?.Specification,
|
||||||
InsulationMaterialNo = stuffedDataModel.Insulation?.MaterialCode
|
InsulationMaterialNo = stuffedDataModel.Insulation?.MaterialCode,
|
||||||
|
OrderDate = nowDateStr
|
||||||
};
|
};
|
||||||
seqNo++;
|
seqNo++;
|
||||||
dataList.Add(exportModel);
|
dataList.Add(exportModel);
|
||||||
|
|
Loading…
Reference in New Issue