材料匹配生成焊接任务单修改

This commit is contained in:
2024-12-26 14:42:15 +08:00
parent 0a2f9ea3a7
commit 9c2b6d962a
14 changed files with 272 additions and 56 deletions
+30 -7
View File
@@ -35,10 +35,13 @@ namespace BLL
public static string GetTaskCodeByDate(string projectId, string date,string unitworkid,string unitid)
{
string code = string.Empty;
var list = (from x in Funs.DB.HJGL_WeldTask where x.ProjectId == projectId && x.TaskDate == Convert.ToDateTime(date) orderby x.TaskCode descending select x.TaskCode).Distinct().ToList();
if (list.Count > 0)
var list = (from x in Funs.DB.HJGL_WeldTask where x.ProjectId == projectId && x.UnitWorkId== unitworkid && x.UnitId== unitid && x.TaskDate == Convert.ToDateTime(date) orderby x.TaskCode descending select x.TaskCode).Distinct().ToList();
var count = list.Count;
code = date +"-"+ (count + 1).ToString("D3") + UnitService.GetUnitCodeByUnitId(unitid) + "-" + UnitWorkService.getUnitWorkByUnitWorkId(unitworkid)?.UnitWorkCode;
/*if (list.Count > 0)
{
string oldCode = list[0];
if (oldCode.Length > 4)
{
string partCode = oldCode.Substring(8,3);
@@ -65,15 +68,32 @@ namespace BLL
{
code = date + "-001";
}
code = code.Replace("-", "") + "-" + UnitService.GetUnitCodeByUnitId(unitid) + "-" + UnitWorkService.getUnitWorkByUnitWorkId(unitworkid)?.UnitWorkCode;
code = code.Replace("-", "") + "-" + UnitService.GetUnitCodeByUnitId(unitid) + "-" + UnitWorkService.getUnitWorkByUnitWorkId(unitworkid)?.UnitWorkCode;*/
return code;
}
public static List<Model.View_HJGL_WeldingTask> GetWeldingTaskList(string ProjectId, string UnitWorkId, string unitId, DateTime taskDate, string canWelder)
public static string GetSerialNumberByDate(string projectId, string date, string unitworkid, string unitid)
{
string code = string.Empty;
var list = (from x in Funs.DB.HJGL_WeldTask where x.ProjectId == projectId && x.UnitWorkId == unitworkid && x.UnitId == unitid && x.TaskDate == Convert.ToDateTime(date) orderby x.TaskCode descending select x.TaskCode).Distinct().ToList();
var count = list.Count;
code = (count + 1).ToString("D3");
return code;
}
public static string GetSerialNumberByDate(string projectId,string taskCode)
{
string result = string.Empty;
var list = (from x in Funs.DB.HJGL_WeldTask where x.ProjectId == projectId && x.TaskCode == taskCode orderby x.SerialNumber descending select x.SerialNumber).FirstOrDefault();
result = list?.ToString();
return result;
}
public static List<Model.View_HJGL_WeldingTask> GetWeldingTaskList(string ProjectId, string UnitWorkId, string unitId, DateTime taskDate, string canWelder,string serialNumber)
{
var q = from x in Funs.DB.View_HJGL_WeldingTask
where x.ProjectId == ProjectId && x.UnitWorkId == UnitWorkId
&& x.TaskDate.Value.Date == taskDate.Date
&& x.TaskDate.Value.Date == taskDate.Date && x.SerialNumber==serialNumber
select x;
if (!string.IsNullOrEmpty(unitId))
{
@@ -115,7 +135,9 @@ namespace BLL
WeldingRod = WeldTask.WeldingRod,
WeldingWire = WeldTask.WeldingWire,
CanWeldingRodName = WeldTask.CanWeldingRodName,
CanWeldingWireName = WeldTask.CanWeldingWireName
CanWeldingWireName = WeldTask.CanWeldingWireName,
PipeLineSortIndex = WeldTask.PipeLineSortIndex,
SerialNumber = WeldTask.SerialNumber
};
@@ -146,7 +168,8 @@ namespace BLL
newWeldTask.TableDate = WeldTask.TableDate;
newWeldTask.WeldingMode = WeldTask.WeldingMode;
newWeldTask.IsSaved = WeldTask.IsSaved;
newWeldTask.SerialNumber= WeldTask.SerialNumber;
newWeldTask.PipeLineSortIndex= WeldTask.PipeLineSortIndex;
db.SubmitChanges();
}
}