|
|
|
@ -73,7 +73,8 @@ namespace Aucma.Core.SheetMetal.ViewModels
|
|
|
|
|
task.ProductPlanCode = PlanInfo.PlanCode;
|
|
|
|
|
task.OrderCode = PlanInfo.OrderCode;
|
|
|
|
|
task.ProductLineCode = stationCode;//计划工位
|
|
|
|
|
task.TaskCode = GetMaxCodeAsync(list);
|
|
|
|
|
//task.TaskCode = GetMaxCodeAsync();
|
|
|
|
|
task.TaskCode = System.Guid.NewGuid().ToString("N").Substring(0,16);
|
|
|
|
|
task.MaterialCode = PlanInfo.MaterialCode;
|
|
|
|
|
task.MaterialName = PlanInfo.MaterialName;
|
|
|
|
|
if (list.Count == 0)
|
|
|
|
@ -150,45 +151,30 @@ namespace Aucma.Core.SheetMetal.ViewModels
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
public string GetMaxCodeAsync(List<ExecutePlanInfo> planInfos)
|
|
|
|
|
public string GetMaxCodeAsync()
|
|
|
|
|
{
|
|
|
|
|
string taskCodeStr = string.Empty;
|
|
|
|
|
if(planInfos != null)
|
|
|
|
|
|
|
|
|
|
string stationCode = Appsettings.app("StoreInfo", "StationCode");
|
|
|
|
|
string today = DateTime.Now.ToString("yyyyMMdd");
|
|
|
|
|
var maxCode = _executePlanInfoServices.QueryAsync(d => d.ProductLineCode.Equals(stationCode)).Result.Max(d => d.TaskCode);
|
|
|
|
|
if (maxCode.IsNotEmptyOrNull())
|
|
|
|
|
{
|
|
|
|
|
if (planInfos.Count > 0)
|
|
|
|
|
string date = maxCode.Substring(0, 8);
|
|
|
|
|
string max = maxCode.Substring(maxCode.Length - 4, maxCode.Length);
|
|
|
|
|
|
|
|
|
|
if (today.Equals(date))
|
|
|
|
|
{
|
|
|
|
|
ExecutePlanInfo planInfo = planInfos.Where(x => x.TaskCode.Contains(DateTime.Now.ToString("yyyy-MM-dd"))).OrderByDescending(x => x.TaskCode).First();
|
|
|
|
|
if (planInfo != null)
|
|
|
|
|
return date + (int.Parse(max) + 1);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
int taskCode = Convert.ToInt32(planInfo.TaskCode);
|
|
|
|
|
taskCodeStr = (taskCode + 1).ToString();
|
|
|
|
|
return taskCodeStr;
|
|
|
|
|
return today + "00001";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return today + "00001";
|
|
|
|
|
}
|
|
|
|
|
taskCodeStr = DateTime.Now.ToString("yyyy-MM-dd") + "1".PadLeft(5, '0');
|
|
|
|
|
|
|
|
|
|
return taskCodeStr;
|
|
|
|
|
//string stationCode = Appsettings.app("StoreInfo", "StationCode");
|
|
|
|
|
//string today = DateTime.Now.ToString("yyyyMMdd");
|
|
|
|
|
//var maxCode = _executePlanInfoServices.QueryAsync(d => d.ProductLineCode.Equals(stationCode)).Result.Max(d=>d.TaskCode);
|
|
|
|
|
//if (maxCode.IsNotEmptyOrNull())
|
|
|
|
|
//{
|
|
|
|
|
// string date= maxCode.Substring(0, 8);
|
|
|
|
|
// string max = maxCode.Substring(maxCode.Length-4, maxCode.Length);
|
|
|
|
|
|
|
|
|
|
// if (today.Equals(date)) {
|
|
|
|
|
// return date + (int.Parse(max) + 1);
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// return today + "00001";
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
//else
|
|
|
|
|
//{
|
|
|
|
|
// return today + "00001";
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|