Merge branch 'main' of 192.168.0.36:doan/mes
This commit is contained in:
@@ -69,18 +69,11 @@ namespace ZR.Admin.WebApi.Controllers.MES.pro
|
||||
/// <param name="arrange_endtime">预计结束时间</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("setschedule")]
|
||||
public IActionResult SetSchedule(string id, string arrange_starttime, string arrange_endtime)
|
||||
public IActionResult SetSchedule(string id, DateTime arrange_starttime, DateTime 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);
|
||||
|
||||
int data = proWorkorderService.SetWorkorderSechedule(id, arrange_starttime, arrange_endtime);
|
||||
|
||||
return ToResponse(new ApiResult(200, "success", data));
|
||||
}
|
||||
@@ -90,7 +83,7 @@ namespace ZR.Admin.WebApi.Controllers.MES.pro
|
||||
/// </summary>
|
||||
/// <param name="id">工单ID</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("resetschedule")]
|
||||
[HttpGet("resetschedule/{id}")]
|
||||
public IActionResult ResetSchedule(string id)
|
||||
{
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
"dbConfigs": [
|
||||
{
|
||||
"Conn": "Data Source=192.168.0.36;User ID=root;Password=123456;Initial Catalog=ZrAdmin;",
|
||||
// "Conn": "Data Source=127.0.0.1;User ID=sa;Password=123456;Initial Catalog=ZrAdmin;",
|
||||
"DbType": 0, //数据库类型 MySql = 0, SqlServer = 1, Oracle = 3,PgSql = 4
|
||||
"ConfigId": "0", //多租户唯一标识
|
||||
"IsAutoCloseConnection": true
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Common;
|
||||
using ZR.Model.mes.md;
|
||||
using ZR.Model.mes.pro;
|
||||
using ZR.Service.mes.pro.IService;
|
||||
@@ -20,23 +21,39 @@ namespace ZR.Service.mes.pro
|
||||
|
||||
public (List<ProWorkorder>, int) GetWorkorderList(int pageNum, int pageSize, int year, int week, int date, string isSchedule)
|
||||
{
|
||||
|
||||
var predicate = Expressionable.Create<ProWorkorder>()
|
||||
.AndIF(year > 0, it => it.Year == year)
|
||||
.AndIF(week > 0, it => it.Week == week)
|
||||
.AndIF(date > 0, it => it.Date == date)
|
||||
.AndIF(date > 0, it => it.Isarrange.Equals(isSchedule))
|
||||
.And(it => it.Isarrange.Equals(isSchedule))
|
||||
.ToExpression();
|
||||
|
||||
int totalCount = 0;
|
||||
List<ProWorkorder> proWorkorderList = Context.Queryable<ProWorkorder>().Where(predicate).ToPageList(pageNum, pageSize, ref totalCount);
|
||||
List<ProWorkorder> proWorkorderList = Context.Queryable<ProWorkorder>().Where(predicate).OrderBy(it=>it.Order).ToPageList(pageNum, pageSize, ref totalCount);
|
||||
|
||||
return (proWorkorderList, totalCount);
|
||||
}
|
||||
|
||||
public int SetWorkorderSechedule(string id, DateTime arrange_starttime, DateTime arrange_endtime)
|
||||
{
|
||||
//获取排序最大值
|
||||
if(CacheHelper.GetCache("workorder_id_max")==null)
|
||||
{
|
||||
int? workorder_id_max = Context.Queryable<ProWorkorder>().OrderBy(it => it.Order, OrderByType.Desc).First().Order;
|
||||
//初次
|
||||
if(workorder_id_max==null|| workorder_id_max==0)
|
||||
{
|
||||
workorder_id_max = 1;
|
||||
}
|
||||
CacheHelper.SetCache("workorder_id_max", workorder_id_max);
|
||||
}
|
||||
CacheHelper.SetCache("workorder_id_max", (int)CacheHelper.GetCache("workorder_id_max")+1);
|
||||
|
||||
|
||||
TimeSpan productionTime = arrange_endtime - arrange_starttime;
|
||||
return Context.Updateable<ProWorkorder>()
|
||||
.SetColumns(it => new ProWorkorder() { ArrangeStarttime = arrange_starttime, ArrangeEndtime = arrange_endtime, Isarrange = "1" })
|
||||
.SetColumns(it => new ProWorkorder() { ArrangeStarttime = arrange_starttime, ArrangeEndtime = arrange_endtime, Isarrange = "1", ProductionTime = (decimal)productionTime.TotalMinutes,Order=(int) CacheHelper.GetCache("workorder_id_max") })
|
||||
.Where(it => it.Id.Equals(id))
|
||||
.ExecuteCommand();
|
||||
}
|
||||
@@ -45,6 +62,7 @@ namespace ZR.Service.mes.pro
|
||||
{
|
||||
return Context.Updateable<ProWorkorder>()
|
||||
.SetColumns(it => it.Isarrange == "0")
|
||||
.SetColumns(it => it.Order == 0)
|
||||
.Where(it => it.Id.Equals(id))
|
||||
.ExecuteCommand();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user