提交
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using ZR.Admin.WebApi.Extensions;
|
||||||
using ZR.Model.MES.mm.Dto;
|
using ZR.Model.MES.mm.Dto;
|
||||||
using ZR.Service.mes.mm;
|
using ZR.Service.mes.mm;
|
||||||
using ZR.Service.mes.mm.IService;
|
using ZR.Service.mes.mm.IService;
|
||||||
@@ -58,5 +59,22 @@ namespace ZR.Admin.WebApi.Controllers.mes.mm
|
|||||||
var response = materialInputService.Getworkorderlist(query.datetimespan);
|
var response = materialInputService.Getworkorderlist(query.datetimespan);
|
||||||
return SUCCESS(response);
|
return SUCCESS(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生成配料任务
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("generatetask")]
|
||||||
|
public IActionResult Generatetask([FromBody] IngredientTaskDto task)
|
||||||
|
{
|
||||||
|
if(task==null||task.workorders==null)
|
||||||
|
{
|
||||||
|
SUCCESS(null);
|
||||||
|
}
|
||||||
|
task.ToCreate();
|
||||||
|
int res = materialInputService.Generatetask(task, HttpContext.GetName());
|
||||||
|
return SUCCESS(res);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
24
ZR.Model/MES/mm/Dto/IngredientTaskDto.cs
Normal file
24
ZR.Model/MES/mm/Dto/IngredientTaskDto.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ZR.Model.MES.mm.Dto
|
||||||
|
{
|
||||||
|
public class IngredientTaskDto
|
||||||
|
{
|
||||||
|
|
||||||
|
public string agv_position { set; get; }
|
||||||
|
public List<Workerorder_Ingredient> workorders { set; get; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Workerorder_Ingredient
|
||||||
|
{
|
||||||
|
public string workorder { set; get; }
|
||||||
|
public string partnumber { set; get; }
|
||||||
|
public int previousNumber { set; get; }
|
||||||
|
public int previousNumbered { set; get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
78
ZR.Model/MES/mm/MmIngredientTask.cs
Normal file
78
ZR.Model/MES/mm/MmIngredientTask.cs
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ZR.Model.MES.mm
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 配料任务清单
|
||||||
|
/// </summary>
|
||||||
|
[SugarTable("mm_ingredient_task")]
|
||||||
|
public class MmIngredientTask
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// id
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 站点
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "agv_position")]
|
||||||
|
public string AgvPosition { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 配料任务id
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "task_id")]
|
||||||
|
public long TaskId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 工单id
|
||||||
|
/// </summary>
|
||||||
|
public string Workorder { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 零件号id
|
||||||
|
/// </summary>
|
||||||
|
public string Partnumber { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 上件数
|
||||||
|
/// </summary>
|
||||||
|
public int? PreviousNumber { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 已经上件数
|
||||||
|
/// </summary>
|
||||||
|
public int? PreviousNumbered { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建人
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "cREATED_BY")]
|
||||||
|
public string CreatedBy { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "cREATED_TIME")]
|
||||||
|
public DateTime? CreatedTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更新人
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "uPDATED_BY")]
|
||||||
|
public string UpdatedBy { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更新时间
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "uPDATED_TIME")]
|
||||||
|
public DateTime? UpdatedTime { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
using System;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using ZR.Model.MES.mm.Dto;
|
||||||
using ZR.Model.MES.pro;
|
using ZR.Model.MES.pro;
|
||||||
|
|
||||||
namespace ZR.Service.mes.mm.IService
|
namespace ZR.Service.mes.mm.IService
|
||||||
@@ -13,6 +15,7 @@ namespace ZR.Service.mes.mm.IService
|
|||||||
string[] Getend_AGV_points();
|
string[] Getend_AGV_points();
|
||||||
|
|
||||||
List<ProWorkorder_v2> Getworkorderlist(DateTime datetimespan);
|
List<ProWorkorder_v2> Getworkorderlist(DateTime datetimespan);
|
||||||
|
int Generatetask(IngredientTaskDto task,string name);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ using ZR.Model.MES.mm;
|
|||||||
using ZR.Model.MES.pro;
|
using ZR.Model.MES.pro;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||||
|
using ZR.Model.MES.mm.Dto;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
namespace ZR.Service.mes.mm
|
namespace ZR.Service.mes.mm
|
||||||
{
|
{
|
||||||
@@ -73,10 +75,7 @@ namespace ZR.Service.mes.mm
|
|||||||
DayOfWeek dayOfWeek = datetimespan.DayOfWeek;
|
DayOfWeek dayOfWeek = datetimespan.DayOfWeek;
|
||||||
int dayOfWeekNumber = (int)dayOfWeek + 1; // 将 DayOfWeek 枚举转换为从 1 开始的数字
|
int dayOfWeekNumber = (int)dayOfWeek + 1; // 将 DayOfWeek 枚举转换为从 1 开始的数字
|
||||||
|
|
||||||
Console.WriteLine($"日期:{datetimespan}");
|
|
||||||
Console.WriteLine($"年份:{year}");
|
|
||||||
Console.WriteLine($"周数:{week}");
|
|
||||||
Console.WriteLine($"这一周中的第几天:{dayOfWeekNumber}");
|
|
||||||
|
|
||||||
List<ProWorkorder_v2> WorkorderList = Context.Queryable<ProWorkorder_v2>()
|
List<ProWorkorder_v2> WorkorderList = Context.Queryable<ProWorkorder_v2>()
|
||||||
.Where(it => it.Year == year)
|
.Where(it => it.Year == year)
|
||||||
@@ -89,6 +88,36 @@ namespace ZR.Service.mes.mm
|
|||||||
return WorkorderList;
|
return WorkorderList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生成任务单
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="task"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public int Generatetask(IngredientTaskDto task,string name)
|
||||||
|
{
|
||||||
|
List<MmIngredientTask> ingredientTasks=new List<MmIngredientTask> ();
|
||||||
|
|
||||||
|
foreach(var item in task.workorders)
|
||||||
|
{
|
||||||
|
MmIngredientTask ingredientTask = new MmIngredientTask();
|
||||||
|
ingredientTask.AgvPosition = task.agv_position;
|
||||||
|
ingredientTask.TaskId = SnowFlakeSingle.Instance.NextId();
|
||||||
|
ingredientTask.Workorder = item.workorder;
|
||||||
|
ingredientTask.Partnumber = item.partnumber;
|
||||||
|
ingredientTask.PreviousNumber = item.previousNumber;
|
||||||
|
ingredientTask.PreviousNumbered=item.previousNumbered;
|
||||||
|
ingredientTask.CreatedBy = name;
|
||||||
|
|
||||||
|
|
||||||
|
ingredientTasks.Add(ingredientTask);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return Context.Insertable(ingredientTasks).ExecuteCommand();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user