diff --git a/ZR.Admin.WebApi/Controllers/mes/pro/ProWorkorderController.cs b/ZR.Admin.WebApi/Controllers/mes/pro/ProWorkorderController.cs
index fe39d92b..209609b6 100644
--- a/ZR.Admin.WebApi/Controllers/mes/pro/ProWorkorderController.cs
+++ b/ZR.Admin.WebApi/Controllers/mes/pro/ProWorkorderController.cs
@@ -1,5 +1,9 @@
-using Microsoft.AspNetCore.Mvc;
+using JinianNet.JNTemplate;
+using Microsoft.AspNetCore.Mvc;
using Microsoft.IdentityModel.Tokens;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System.Text.Json;
using ZR.Admin.WebApi.Extensions;
using ZR.Model.mes.md;
using ZR.Model.mes.pro;
@@ -21,7 +25,15 @@ namespace ZR.Admin.WebApi.Controllers.MES.pro
this.proWorkorderService = proWorkorderService;
}
-
+ ///
+ /// 获取所有非排产工单
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
[HttpGet("getworkorderListwithoutschedule")]
public IActionResult GetWorkorderListWithoutSchedule(int pageNum, int pageSize, int year = -1, int week = -1, int date = -1)
{
@@ -30,6 +42,15 @@ namespace ZR.Admin.WebApi.Controllers.MES.pro
return ToResponse(new ApiResult(200, "success", data));
}
+ ///
+ /// 获取所有排产工单
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
[HttpGet("getworkorderListwithschedule")]
public IActionResult GetWorkorderListWithSchedule(int pageNum, int pageSize, int year = -1, int week = -1, int date = -1)
{
@@ -37,5 +58,75 @@ namespace ZR.Admin.WebApi.Controllers.MES.pro
return ToResponse(new ApiResult(200, "success", data));
}
+
+ ///
+ /// 根据工单ID,设置为排产状态
+ ///
+ /// 工单ID
+ /// 预计开始时间
+ /// 预计结束时间
+ ///
+ [HttpGet("setschedule")]
+ public IActionResult SetSchedule(string id, string arrange_starttime,string arrange_endtime)
+ {
+ DateTime bgDateTime = DateTime.Now;
+ DateTime edDateTime = DateTime.Now;
+ try
+ {
+ bgDateTime = Convert.ToDateTime(arrange_starttime);
+ edDateTime = Convert.ToDateTime(arrange_endtime);
+ }
+ catch { }
+
+ int data = proWorkorderService.SetWorkorderSechedule(id, bgDateTime, edDateTime);
+
+ return ToResponse(new ApiResult(200, "success", data));
+ }
+
+ ///
+ /// 根据工单ID,设置为非排产状态
+ ///
+ /// 工单ID
+ ///
+ [HttpGet("resetschedule")]
+ public IActionResult ResetSchedule(string id)
+ {
+
+ int data = proWorkorderService.ResetWorkorderSechedule(id);
+
+ return ToResponse(new ApiResult(200, "success", data));
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpPost("sortschedule")]
+ public IActionResult SortSchedule([FromBody] List parameter)
+ {
+
+ //JsonElement t = (JsonElement)parameter;
+ //JsonElement.
+ //parameter.Adapt(t);
+ //string t = parameter["listKeyValue"];
+ //Dictionary KV_ID_Sort = new Dictionary();
+
+
+ //JArray ja = (JArray)JsonConvert.DeserializeObject(t);
+ //foreach (JToken item in ja.ToList())
+ //{
+ // KV_ID_Sort.Add(item["id"].ToString(), item["value"].ToString());
+ //}
+
+
+ return ToResponse(new ApiResult(200, "success", 1));
+ }
+ }
+
+ public class t
+ {
+ public string id { get; set; }
+public string order { get; set; }
}
}
diff --git a/ZR.Model/mes/pro/ProWorkorder.cs b/ZR.Model/mes/pro/ProWorkorder.cs
index 3771ef3d..e5794897 100644
--- a/ZR.Model/mes/pro/ProWorkorder.cs
+++ b/ZR.Model/mes/pro/ProWorkorder.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using ZR.Model.MES.pro;
namespace ZR.Model.mes.pro
{
@@ -57,6 +58,12 @@ namespace ZR.Model.mes.pro
[SugarColumn(ColumnName = "priority")]
public int Priority { get; set; }
+ ///
+ /// 工单顺序
+ ///
+ [SugarColumn(ColumnName = "order")]
+ public int Order { get; set; }
+
///
/// 排产开始时间
///
diff --git a/ZR.Service/mes/pro/IService/IProWorkorderService.cs b/ZR.Service/mes/pro/IService/IProWorkorderService.cs
index 160fd2c2..489dcf9d 100644
--- a/ZR.Service/mes/pro/IService/IProWorkorderService.cs
+++ b/ZR.Service/mes/pro/IService/IProWorkorderService.cs
@@ -12,5 +12,9 @@ namespace ZR.Service.mes.pro.IService
public interface IProWorkorderService
{
public (List, int) GetWorkorderList(int pageNum, int pageSize, int year, int week,int date,string isSchedule);
+
+ public int SetWorkorderSechedule(string id, DateTime arrange_starttime, DateTime arrange_endtime);
+
+ public int ResetWorkorderSechedule(string id);
}
}
diff --git a/ZR.Service/mes/pro/ProWorkorderService.cs b/ZR.Service/mes/pro/ProWorkorderService.cs
index 30a21600..68887ddb 100644
--- a/ZR.Service/mes/pro/ProWorkorderService.cs
+++ b/ZR.Service/mes/pro/ProWorkorderService.cs
@@ -32,5 +32,22 @@ namespace ZR.Service.mes.pro
return (proWorkorderList, totalCount);
}
+
+ public int SetWorkorderSechedule(string id, DateTime arrange_starttime, DateTime arrange_endtime)
+ {
+ return Context.Updateable()
+ .SetColumns(it => new ProWorkorder() { ArrangeStarttime = arrange_starttime, ArrangeEndtime = arrange_endtime, Isarrange = "1" })
+ .Where(it => it.Id.Equals(id))
+ .ExecuteCommand();
+ }
+
+ public int ResetWorkorderSechedule(string id)
+ {
+ return Context.Updateable()
+ .SetColumns(it => it.Isarrange == "0")
+ .Where(it => it.Id.Equals(id))
+ .ExecuteCommand();
+ }
+
}
}