refactor(hjgl): 整理历史资源并完善焊接查询
归档数据库版本脚本并清理历史地图资源,补充焊口查询和焊接任务相关逻辑,降低项目资源维护成本并完善焊接业务查询。
This commit is contained in:
@@ -24,8 +24,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
private const string WeldingRodConsumablesType = "2";
|
||||
private const string WeldingWireConsumablesType = "1";
|
||||
private const string ManualWeldingMode = "手动";
|
||||
private const string CoverMaterialClassFe1 = "Fe-1";
|
||||
private const string CoverMaterialClassFe3 = "Fe-3";
|
||||
|
||||
public string WarehouseId
|
||||
{
|
||||
@@ -1019,7 +1017,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
/// 清除 Grid2 当前选中管线中已反写到管线材料表的材料主编码。
|
||||
/// </summary>
|
||||
/// <param name="sender">事件源。</param>
|
||||
/// <param name="e">事件参数。</param>
|
||||
/// <param name="e">事件参数。</param>WeldTask
|
||||
protected void btnClearMaterialCode_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Grid2.SelectedRowIDArray == null || !Grid2.SelectedRowIDArray.Any())
|
||||
@@ -1046,7 +1044,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
}
|
||||
|
||||
int count = BLL.PipelineMatService.ClearMaterialCodeByPipeLineMatIds(pipeLineMatIds);
|
||||
ShowNotify("已清除材料主编码" + count.ToString() + "条!", MessageBoxIcon.Success);
|
||||
ShowNotify("已清除材料主编码" + count.ToString() + "条,已生成任务单的焊口已跳过!", MessageBoxIcon.Success);
|
||||
RefreshMatchResult();
|
||||
if (Grid2.SelectedRowIDArray.Any())
|
||||
{
|
||||
@@ -1154,7 +1152,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
NewTask.PipeLineSortIndex = matchPipeline.FirstOrDefault(x => x.Value == weldJoint.PipelineId).Key;
|
||||
NewTask.WeldingRod = weldJoint.WeldingRod;
|
||||
NewTask.WeldingWire = weldJoint.WeldingWire;
|
||||
PopulateAlternativeConsumables(NewTask, weldJoint, weldingRods, weldingWires);
|
||||
BLL.WeldTaskService.PopulateAlternativeConsumables(NewTask, weldJoint, weldingRods, weldingWires);
|
||||
}
|
||||
NewTask.JointAttribute = weldJoint.JointAttribute;
|
||||
|
||||
@@ -1183,48 +1181,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
return matchPipeline;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据母材类别计算任务单可替代的焊条和焊丝。
|
||||
/// </summary>
|
||||
private void PopulateAlternativeConsumables(
|
||||
Model.HJGL_WeldTask task,
|
||||
Model.HJGL_WeldJoint weldJoint,
|
||||
IEnumerable<Model.Base_Consumables> weldingRods,
|
||||
IEnumerable<Model.Base_Consumables> weldingWires)
|
||||
{
|
||||
// 获取可替代焊材时沿用原有母材类别和焊材钢号判断规则。
|
||||
var material = BLL.Base_MaterialService.GetMaterialByMaterialId(weldJoint.Material1Id);
|
||||
string materialClass = material.MaterialClass;
|
||||
var selectedRod = weldingRods.FirstOrDefault(x => x.ConsumablesId == weldJoint.WeldingRod);
|
||||
var selectedWire = weldingWires.FirstOrDefault(x => x.ConsumablesId == weldJoint.WeldingWire);
|
||||
|
||||
task.CanWeldingRodName = GetAlternativeConsumableNames(materialClass, selectedRod, weldingRods);
|
||||
task.CanWeldingWireName = GetAlternativeConsumableNames(materialClass, selectedWire, weldingWires);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回与当前焊材钢号兼容的候选名称,保持原有逗号分隔格式。
|
||||
/// </summary>
|
||||
private string GetAlternativeConsumableNames(
|
||||
string materialClass,
|
||||
Model.Base_Consumables selectedConsumable,
|
||||
IEnumerable<Model.Base_Consumables> candidateConsumables)
|
||||
{
|
||||
if (selectedConsumable == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
bool useCoverClass = materialClass == CoverMaterialClassFe1 || materialClass == CoverMaterialClassFe3;
|
||||
var names = candidateConsumables
|
||||
.Where(item => useCoverClass
|
||||
? IsCoverClass(selectedConsumable.SteelType, item.SteelType)
|
||||
: selectedConsumable.SteelType == item.SteelType)
|
||||
.Select(item => item.ConsumablesName)
|
||||
.ToList();
|
||||
return names.Any() ? string.Join(",", names) : null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 按任务单实际生成规则过滤可生成任务单的焊口视图数据。
|
||||
/// </summary>
|
||||
@@ -1307,26 +1263,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
return new HashSet<string>(GetTaskableWeldJointRows(weldJointIds).Select(x => x.WeldJointId));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断焊材钢号类别是否能覆盖母材类别。
|
||||
/// </summary>
|
||||
/// <param name="wpsClass">焊材钢号类别。</param>
|
||||
/// <param name="matClass">母材类别。</param>
|
||||
/// <returns>能覆盖返回 true,否则返回 false。</returns>
|
||||
private bool IsCoverClass(string wpsClass, string matClass)
|
||||
{
|
||||
if (wpsClass.Length <= 2 || matClass.Length <= 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
string wpsPre = wpsClass.Substring(0, wpsClass.Length - 2);
|
||||
string matPre = matClass.Substring(0, matClass.Length - 2);
|
||||
int wpsSn = Funs.GetNewInt(wpsClass.Substring(wpsClass.Length - 1, 1)) ?? 0;
|
||||
int matSn = Funs.GetNewInt(matClass.Substring(matClass.Length - 1, 1)) ?? 0;
|
||||
return wpsPre == matPre && matSn >= wpsSn;
|
||||
}
|
||||
|
||||
#endregion 按钮事件
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user