工单完成
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
||||
using Microsoft.VisualBasic;
|
||||
using Model.DBModel;
|
||||
using System;
|
||||
@@ -34,8 +35,14 @@ namespace ZR.Service.mes.pro.IService
|
||||
|
||||
public int UpdateWorkOrder(ProWorkorder_v2 workorder);
|
||||
|
||||
public int UpdateworkorderSort(string id ,int sort);
|
||||
|
||||
|
||||
public int StartWorkOrder(string id);
|
||||
public int CancelWorkOrder(string id);
|
||||
|
||||
public int GenerateWorkorder(int year, int week, int date);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,6 +255,7 @@ namespace ZR.Service.mes.pro
|
||||
}
|
||||
|
||||
public int DeleteWorkOrder(string id)
|
||||
|
||||
{
|
||||
return Context.Deleteable<ProWorkorder_v2>().In(id).ExecuteCommand();
|
||||
|
||||
@@ -262,7 +263,99 @@ namespace ZR.Service.mes.pro
|
||||
|
||||
public int UpdateWorkOrder(ProWorkorder_v2 workorder)
|
||||
{
|
||||
workorder.Status = 0;
|
||||
if (workorder.Remark2 == "批量")
|
||||
{
|
||||
workorder.Remark3 = "是";
|
||||
}
|
||||
return Context.Updateable(workorder).ExecuteCommand();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更改工单顺序
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="sort"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public int UpdateworkorderSort(string id, int sort)
|
||||
{
|
||||
if(sort > 0)
|
||||
{
|
||||
int finalreuslt = 0;
|
||||
|
||||
int max = Convert.ToInt32(sort.ToString().Substring(0, 6) + "999");
|
||||
int result = Context.Updateable<ProWorkorder_v2>().Where(it => it.Sort >= sort && it.Sort <= max).SetColumns(it => it.Sort == it.Sort + 1).ExecuteCommand();
|
||||
if (result > 0)
|
||||
{
|
||||
finalreuslt = Context.Updateable<ProWorkorder_v2>().Where(it => it.Id == id).SetColumns(it => it.Sort == sort).ExecuteCommand();
|
||||
}
|
||||
return finalreuslt;
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 工单开始
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public int StartWorkOrder(string id)
|
||||
{
|
||||
return Context.Updateable<ProWorkorder_v2>().Where(it => it.Id == id)
|
||||
.SetColumns(it => it.Status == 1).ExecuteCommand();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 工单上线取消
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public int CancelWorkOrder(string id)
|
||||
{
|
||||
|
||||
return Context.Updateable<ProWorkorder_v2>().Where(it => it.Id == id)
|
||||
.SetColumns(it => it.Status == 0).ExecuteCommand();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 生成工单号
|
||||
/// </summary>
|
||||
/// <param name="year"></param>
|
||||
/// <param name="week"></param>
|
||||
/// <param name="date"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
public int GenerateWorkorder(int year, int week, int date)
|
||||
{
|
||||
if (year > 0 && week > 0 && date >0)
|
||||
{
|
||||
string date_now = DateTime.Now.ToString("yyMMdd");
|
||||
|
||||
List<ProWorkorder_v2> workorderList= Context.Queryable<ProWorkorder_v2>().Where(it => it.Year == year && it.Week == week && it.Date == date).Where(it=>it.Remark3=="是").ToList();
|
||||
|
||||
foreach(ProWorkorder_v2 item in workorderList) {
|
||||
int index = workorderList.IndexOf(item) + 1;
|
||||
item.ClientWorkorder = date_now + index.ToString("000");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return Context.Updateable(workorderList).ExecuteCommand();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user