计划队列新增调试完成功能
This commit is contained in:
@@ -28,6 +28,8 @@ namespace ZR.Service.mes.pro.IService
|
||||
public int UpdateworkorderSort(string id, int sort);
|
||||
public int UpdateworkorderSort2(string oldId, int oldSort, string newId, int newSort);
|
||||
|
||||
public int UpdateWorkOrderStatus(string id, int status);
|
||||
|
||||
|
||||
public int StartWorkOrder(string id);
|
||||
public int CancelWorkOrder(string id);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using Infrastructure;
|
||||
using System;
|
||||
using System.IO;
|
||||
using Infrastructure;
|
||||
using Infrastructure.Attribute;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using MiniExcelLibs;
|
||||
using Model.DBModel;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.IO;
|
||||
using ZR.Model.MES.pro;
|
||||
using ZR.Model.MES.pro.DTO;
|
||||
using ZR.Model.MES.wms;
|
||||
@@ -16,49 +16,60 @@ namespace ZR.Service.mes.pro
|
||||
[AppService(ServiceType = typeof(IProWorkorderServiceV2), ServiceLifetime = LifeTime.Transient)]
|
||||
public class ProWorkorderServiceV2 : BaseService<ProWorkorder_v2>, IProWorkorderServiceV2
|
||||
{
|
||||
|
||||
public (List<ProWorkOrder>, int) GetWorkorderList(int pageNum, int pageSize, int year, int week, int date, int isSchedule)
|
||||
public (List<ProWorkOrder>, int) GetWorkorderList(
|
||||
int pageNum,
|
||||
int pageSize,
|
||||
int year,
|
||||
int week,
|
||||
int date,
|
||||
int isSchedule
|
||||
)
|
||||
{
|
||||
|
||||
var predicate = Expressionable.Create<ProWorkorder_v2>()
|
||||
.AndIF(year > 0, it => it.Year == year)
|
||||
.AndIF(week > 0, it => it.Week == week)
|
||||
.AndIF(date > 0, it => it.Date == date)
|
||||
.ToExpression();
|
||||
var predicate = Expressionable
|
||||
.Create<ProWorkorder_v2>()
|
||||
.AndIF(year > 0, it => it.Year == year)
|
||||
.AndIF(week > 0, it => it.Week == week)
|
||||
.AndIF(date > 0, it => it.Date == date)
|
||||
.ToExpression();
|
||||
|
||||
int totalCount = 0;
|
||||
List<ProWorkorder_v2> proWorkorderList = Context.Queryable<ProWorkorder_v2>().Where(predicate).OrderBy(it => it.Sort).ToPageList(pageNum, pageSize, ref totalCount);
|
||||
List<ProWorkorder_v2> proWorkorderList = Context
|
||||
.Queryable<ProWorkorder_v2>()
|
||||
.Where(predicate)
|
||||
.OrderBy(it => it.Sort)
|
||||
.ToPageList(pageNum, pageSize, ref totalCount);
|
||||
List<ProWorkOrder> orders = new();
|
||||
foreach (ProWorkorder_v2 item in proWorkorderList)
|
||||
{
|
||||
ProWorkOrder proWorkOrder = new()
|
||||
{
|
||||
Id = item.Id,
|
||||
Week = item.Week,
|
||||
Year = item.Year,
|
||||
Date = item.Date,
|
||||
BlankNumber = item.BlankNumber,
|
||||
ClientWorkorder = item.ClientWorkorder,
|
||||
FinishedPartNumber = item.FinishedPartNumber,
|
||||
ProductDescription = item.ProductDescription,
|
||||
Specifications = item.Specifications,
|
||||
Colour = item.Colour,
|
||||
CodeNumber = item.CodeNumber,
|
||||
CylinderNumber = item.CylinderNumber,
|
||||
hangNumber = item.hangNumber,
|
||||
PreviousNumber = item.PreviousNumber,
|
||||
VehicleNumber = item.VehicleNumber,
|
||||
CreatedBy = item.CreatedBy,
|
||||
CreatedTime = item.CreatedTime,
|
||||
UpdatedBy = item.UpdatedBy,
|
||||
UpdatedTime = item.UpdatedTime,
|
||||
Sort = item.Sort,
|
||||
Status = item.Status,
|
||||
Remark1 = item.Remark1,
|
||||
Remark2 = item.Remark2,
|
||||
Remark3 = item.Remark3,
|
||||
Remark4 = item.Remark4,
|
||||
};
|
||||
ProWorkOrder proWorkOrder =
|
||||
new()
|
||||
{
|
||||
Id = item.Id,
|
||||
Week = item.Week,
|
||||
Year = item.Year,
|
||||
Date = item.Date,
|
||||
BlankNumber = item.BlankNumber,
|
||||
ClientWorkorder = item.ClientWorkorder,
|
||||
FinishedPartNumber = item.FinishedPartNumber,
|
||||
ProductDescription = item.ProductDescription,
|
||||
Specifications = item.Specifications,
|
||||
Colour = item.Colour,
|
||||
CodeNumber = item.CodeNumber,
|
||||
CylinderNumber = item.CylinderNumber,
|
||||
hangNumber = item.hangNumber,
|
||||
PreviousNumber = item.PreviousNumber,
|
||||
VehicleNumber = item.VehicleNumber,
|
||||
CreatedBy = item.CreatedBy,
|
||||
CreatedTime = item.CreatedTime,
|
||||
UpdatedBy = item.UpdatedBy,
|
||||
UpdatedTime = item.UpdatedTime,
|
||||
Sort = item.Sort,
|
||||
Status = item.Status,
|
||||
Remark1 = item.Remark1,
|
||||
Remark2 = item.Remark2,
|
||||
Remark3 = item.Remark3,
|
||||
Remark4 = item.Remark4,
|
||||
};
|
||||
proWorkOrder.State = CheckWorkOrder(item);
|
||||
orders.Add(proWorkOrder);
|
||||
}
|
||||
@@ -66,29 +77,48 @@ namespace ZR.Service.mes.pro
|
||||
return (orders, totalCount);
|
||||
}
|
||||
|
||||
public (List<ProWorkorder_v2>, int) GetWorkorderList_Piliang(int pageNum, int pageSize, int year, int week, int date, int isSchedule)
|
||||
public (List<ProWorkorder_v2>, int) GetWorkorderList_Piliang(
|
||||
int pageNum,
|
||||
int pageSize,
|
||||
int year,
|
||||
int week,
|
||||
int date,
|
||||
int isSchedule
|
||||
)
|
||||
{
|
||||
|
||||
var predicate = Expressionable.Create<ProWorkorder_v2>()
|
||||
.AndIF(year > 0, it => it.Year == year)
|
||||
.AndIF(week > 0, it => it.Week == week)
|
||||
.AndIF(date > 0, it => it.Date == date)
|
||||
.ToExpression();
|
||||
var predicate = Expressionable
|
||||
.Create<ProWorkorder_v2>()
|
||||
.AndIF(year > 0, it => it.Year == year)
|
||||
.AndIF(week > 0, it => it.Week == week)
|
||||
.AndIF(date > 0, it => it.Date == date)
|
||||
.ToExpression();
|
||||
|
||||
int totalCount = 0;
|
||||
List<ProWorkorder_v2> proWorkorderList = Context.Queryable<ProWorkorder_v2>().Where(predicate).Where(it => it.Remark3 == "是").OrderBy(it => it.Sort).ToPageList(pageNum, pageSize, ref totalCount);
|
||||
List<ProWorkorder_v2> proWorkorderList = Context
|
||||
.Queryable<ProWorkorder_v2>()
|
||||
.Where(predicate)
|
||||
.Where(it => it.Remark3 == "是")
|
||||
.OrderBy(it => it.Sort)
|
||||
.ToPageList(pageNum, pageSize, ref totalCount);
|
||||
|
||||
return (proWorkorderList, totalCount);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取生产计划id
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private int Getworkplanid_max()
|
||||
{
|
||||
|
||||
ProWorkorder_v2 max_workoder = Context.Queryable<ProWorkorder_v2>().OrderBy(it => it.Id, OrderByType.Desc).First();
|
||||
if (max_workoder != null && !string.IsNullOrEmpty(max_workoder.Id) && max_workoder.Id.Substring(2, 8) == DateTime.Now.ToString("yyyyMMdd"))
|
||||
ProWorkorder_v2 max_workoder = Context
|
||||
.Queryable<ProWorkorder_v2>()
|
||||
.OrderBy(it => it.Id, OrderByType.Desc)
|
||||
.First();
|
||||
if (
|
||||
max_workoder != null
|
||||
&& !string.IsNullOrEmpty(max_workoder.Id)
|
||||
&& max_workoder.Id.Substring(2, 8) == DateTime.Now.ToString("yyyyMMdd")
|
||||
)
|
||||
{
|
||||
int num = Convert.ToInt32(max_workoder.Id.Substring(10)) + 1;
|
||||
return num;
|
||||
@@ -97,16 +127,12 @@ namespace ZR.Service.mes.pro
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public string ImportExceldata(List<ProWorkorder_v2> workorderList)
|
||||
{
|
||||
int max_id = Getworkplanid_max();
|
||||
|
||||
|
||||
// 更新生产计划
|
||||
if (workorderList != null && workorderList.Count > 0)
|
||||
{
|
||||
@@ -115,7 +141,12 @@ namespace ZR.Service.mes.pro
|
||||
item.Id = "WO" + DateTime.Now.ToString("yyyyMMdd") + max_id.ToString("000");
|
||||
item.Remark4 = "Excel导入";
|
||||
// 添加属性 ------》 排序规则是 年周日+序列号(000)
|
||||
item.Sort = Convert.ToInt32(item.Year.ToString("0000").Substring(2) + item.Week.ToString("00") + item.Date.ToString("00") + workorderList.IndexOf(item).ToString("000"));
|
||||
item.Sort = Convert.ToInt32(
|
||||
item.Year.ToString("0000").Substring(2)
|
||||
+ item.Week.ToString("00")
|
||||
+ item.Date.ToString("00")
|
||||
+ workorderList.IndexOf(item).ToString("000")
|
||||
);
|
||||
|
||||
if (item.Remark2 == "批量")
|
||||
{
|
||||
@@ -129,32 +160,34 @@ namespace ZR.Service.mes.pro
|
||||
foreach (ProWorkorder_v2 item in workorderList)
|
||||
{
|
||||
// 修正计划
|
||||
ProWorklplan_v2 planItem = Context.Queryable<ProWorklplan_v2>().Where(it => it.Id == item.FinishedPartNumber).First();
|
||||
ProWorklplan_v2 planItem = Context
|
||||
.Queryable<ProWorklplan_v2>()
|
||||
.Where(it => it.Id == item.FinishedPartNumber)
|
||||
.First();
|
||||
if (planItem != null)
|
||||
{
|
||||
Context.Updateable<ProWorklplan_v2>().Where(it => it.Id == planItem.Id)
|
||||
.SetColumns(it =>
|
||||
|
||||
it.NoSchedule == planItem.RequireNum - item.hangNumber
|
||||
).ExecuteCommandAsync();
|
||||
|
||||
Context
|
||||
.Updateable<ProWorklplan_v2>()
|
||||
.Where(it => it.Id == planItem.Id)
|
||||
.SetColumns(it =>
|
||||
it.NoSchedule == planItem.RequireNum - item.hangNumber
|
||||
)
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
UseTran(() =>
|
||||
{
|
||||
// 删除之前的工单
|
||||
Context.Deleteable<ProWorkorder_v2>().Where(it => it.Year == workorderList[0].Year)
|
||||
Context
|
||||
.Deleteable<ProWorkorder_v2>()
|
||||
.Where(it => it.Year == workorderList[0].Year)
|
||||
.Where(it => it.Week == workorderList[0].Week)
|
||||
.Where(it => it.Date == workorderList[0].Date).ExecuteCommand();
|
||||
|
||||
|
||||
.Where(it => it.Date == workorderList[0].Date)
|
||||
.ExecuteCommand();
|
||||
|
||||
//插入
|
||||
Context.Insertable(workorderList).ExecuteCommand();
|
||||
|
||||
});
|
||||
|
||||
return "success";
|
||||
@@ -178,8 +211,7 @@ namespace ZR.Service.mes.pro
|
||||
// x.TotalList.Count);
|
||||
|
||||
|
||||
return ""; //插入可插入部分
|
||||
|
||||
return ""; //插入可插入部分
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -192,11 +224,14 @@ namespace ZR.Service.mes.pro
|
||||
public (string, string) ExportExceldata(int year, int week, int date)
|
||||
{
|
||||
//1.0 读取表数据
|
||||
var list = Queryable().Where(it => it.Year == year && it.Week == week && it.Date == date)
|
||||
.OrderBy(it => it.Sort).ToList();
|
||||
var list = Queryable()
|
||||
.Where(it => it.Year == year && it.Week == week && it.Date == date)
|
||||
.OrderBy(it => it.Sort)
|
||||
.ToList();
|
||||
|
||||
//2.0 保存为excel
|
||||
IWebHostEnvironment webHostEnvironment = (IWebHostEnvironment)App.ServiceProvider.GetService(typeof(IWebHostEnvironment));
|
||||
IWebHostEnvironment webHostEnvironment = (IWebHostEnvironment)
|
||||
App.ServiceProvider.GetService(typeof(IWebHostEnvironment));
|
||||
string sFileName = $"{year}年{week}周{date}日计划-{DateTime.Now:MM-dd-HHmmss}.xlsx";
|
||||
string fullPath = Path.Combine(webHostEnvironment.WebRootPath, "export", sFileName);
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(fullPath));
|
||||
@@ -209,7 +244,11 @@ namespace ZR.Service.mes.pro
|
||||
|
||||
workorder = list
|
||||
};
|
||||
string templatePath = Path.Combine(webHostEnvironment.WebRootPath, "ImportTemplate", "日生产计划模板1.xlsx");
|
||||
string templatePath = Path.Combine(
|
||||
webHostEnvironment.WebRootPath,
|
||||
"ImportTemplate",
|
||||
"日生产计划模板1.xlsx"
|
||||
);
|
||||
MiniExcel.SaveAsByTemplate(fullPath, templatePath, Sheet1);
|
||||
// MiniExcel.SaveAs(fullPath, list);
|
||||
//3.0 返回路径和文件名
|
||||
@@ -224,19 +263,27 @@ namespace ZR.Service.mes.pro
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public int DeleteAllWorkorder(int year, int week, int date)
|
||||
{
|
||||
return Context.Deleteable<ProWorkorder_v2>().Where(it => it.Year == year && it.Week == week && it.Date == date).ExecuteCommand();
|
||||
return Context
|
||||
.Deleteable<ProWorkorder_v2>()
|
||||
.Where(it => it.Year == year && it.Week == week && it.Date == date)
|
||||
.ExecuteCommand();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取生产计划id
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private int Getworkorderid_max()
|
||||
{
|
||||
|
||||
ProWorkorder_v2 max_workorder = Context.Queryable<ProWorkorder_v2>().OrderBy(it => it.Id, OrderByType.Desc).First();
|
||||
if (max_workorder != null && !string.IsNullOrEmpty(max_workorder.Id) && max_workorder.Id.Substring(2, 8) == DateTime.Now.ToString("yyyyMMdd"))
|
||||
ProWorkorder_v2 max_workorder = Context
|
||||
.Queryable<ProWorkorder_v2>()
|
||||
.OrderBy(it => it.Id, OrderByType.Desc)
|
||||
.First();
|
||||
if (
|
||||
max_workorder != null
|
||||
&& !string.IsNullOrEmpty(max_workorder.Id)
|
||||
&& max_workorder.Id.Substring(2, 8) == DateTime.Now.ToString("yyyyMMdd")
|
||||
)
|
||||
{
|
||||
int num = Convert.ToInt32(max_workorder.Id.Substring(10)) + 1;
|
||||
return num;
|
||||
@@ -245,15 +292,12 @@ namespace ZR.Service.mes.pro
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public int AddWorkOrder(ProWorkorder_v2 workorder)
|
||||
{
|
||||
|
||||
|
||||
workorder.Id = "WO" + DateTime.Now.ToString("yyyyMMdd") + Getworkorderid_max().ToString("000");
|
||||
workorder.Id =
|
||||
"WO" + DateTime.Now.ToString("yyyyMMdd") + Getworkorderid_max().ToString("000");
|
||||
workorder.Remark4 = "手动插入";
|
||||
workorder.Status = 0;
|
||||
if (workorder.Remark2 == "批量")
|
||||
@@ -264,20 +308,19 @@ namespace ZR.Service.mes.pro
|
||||
if (workorder.Sort > 0)
|
||||
{
|
||||
int max = Convert.ToInt32(workorder.Sort.ToString().Substring(0, 6) + "999");
|
||||
Context.Updateable<ProWorkorder_v2>().Where(it => it.Sort >= workorder.Sort && it.Sort <= max).SetColumns(it => it.Sort == it.Sort + 1).ExecuteCommand();
|
||||
|
||||
Context
|
||||
.Updateable<ProWorkorder_v2>()
|
||||
.Where(it => it.Sort >= workorder.Sort && it.Sort <= max)
|
||||
.SetColumns(it => it.Sort == it.Sort + 1)
|
||||
.ExecuteCommand();
|
||||
}
|
||||
|
||||
|
||||
|
||||
return Context.Insertable(workorder).ExecuteCommand();
|
||||
}
|
||||
|
||||
public int DeleteWorkOrder(string id)
|
||||
|
||||
{
|
||||
return Context.Deleteable<ProWorkorder_v2>().In(id).ExecuteCommand();
|
||||
|
||||
}
|
||||
|
||||
public int UpdateWorkOrder(ProWorkorder_v2 workorder)
|
||||
@@ -287,8 +330,21 @@ namespace ZR.Service.mes.pro
|
||||
{
|
||||
workorder.Remark3 = "是";
|
||||
}
|
||||
else
|
||||
{
|
||||
workorder.Remark3 = "";
|
||||
}
|
||||
|
||||
return Context.Updateable(workorder).IgnoreColumns(it => new { it.CreatedBy, it.CreatedTime, it.Remark4, it.Sort }).ExecuteCommand();
|
||||
return Context
|
||||
.Updateable(workorder)
|
||||
.IgnoreColumns(it => new
|
||||
{
|
||||
it.CreatedBy,
|
||||
it.CreatedTime,
|
||||
it.Remark4,
|
||||
it.Sort
|
||||
})
|
||||
.ExecuteCommand();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -306,20 +362,26 @@ namespace ZR.Service.mes.pro
|
||||
|
||||
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();
|
||||
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();
|
||||
finalreuslt = Context
|
||||
.Updateable<ProWorkorder_v2>()
|
||||
.Where(it => it.Id == id)
|
||||
.SetColumns(it => it.Sort == sort)
|
||||
.ExecuteCommand();
|
||||
}
|
||||
return finalreuslt;
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 工单开始
|
||||
/// </summary>
|
||||
@@ -328,12 +390,13 @@ namespace ZR.Service.mes.pro
|
||||
/// <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();
|
||||
return Context
|
||||
.Updateable<ProWorkorder_v2>()
|
||||
.Where(it => it.Id == id)
|
||||
.SetColumns(it => it.Status == 1)
|
||||
.ExecuteCommand();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 工单上线取消
|
||||
/// </summary>
|
||||
@@ -342,13 +405,13 @@ namespace ZR.Service.mes.pro
|
||||
/// <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();
|
||||
return Context
|
||||
.Updateable<ProWorkorder_v2>()
|
||||
.Where(it => it.Id == id)
|
||||
.SetColumns(it => it.Status == 0)
|
||||
.ExecuteCommand();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 生成工单号
|
||||
/// </summary>
|
||||
@@ -361,13 +424,16 @@ namespace ZR.Service.mes.pro
|
||||
{
|
||||
if (year > 0 && week > 0 && date > 0)
|
||||
{
|
||||
|
||||
DateTime week_first = GetWeekStartTime(year, week);
|
||||
|
||||
string date_now = week_first.AddDays(date - 1).ToString("yyMMdd");
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
Console.WriteLine($"生成工单号前缀{date_now}");
|
||||
List<ProWorkorder_v2> workorderList = Context.Queryable<ProWorkorder_v2>().Where(it => it.Year == year && it.Week == week && it.Date == date).Where(it => it.Remark3 == "是").ToList();
|
||||
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)
|
||||
{
|
||||
@@ -375,7 +441,6 @@ namespace ZR.Service.mes.pro
|
||||
item.ClientWorkorder = date_now + index.ToString("000");
|
||||
}
|
||||
|
||||
|
||||
return Context.Updateable(workorderList).ExecuteCommand();
|
||||
}
|
||||
return 0;
|
||||
@@ -404,13 +469,17 @@ namespace ZR.Service.mes.pro
|
||||
/// <returns></returns>
|
||||
private DateTime GetWeekStartTime(int year, int weekNum)
|
||||
{
|
||||
|
||||
//本年1月1日
|
||||
DateTime firstOfYear = new DateTime(year, 1, 1);
|
||||
//周数
|
||||
|
||||
//本年1月1日与本周星期一相差的天数
|
||||
int dayDiff = (firstOfYear.DayOfWeek == DayOfWeek.Sunday ? 7 : Convert.ToInt32(firstOfYear.DayOfWeek)) - 1;
|
||||
int dayDiff =
|
||||
(
|
||||
firstOfYear.DayOfWeek == DayOfWeek.Sunday
|
||||
? 7
|
||||
: Convert.ToInt32(firstOfYear.DayOfWeek)
|
||||
) - 1;
|
||||
//第一周的星期一
|
||||
DateTime firstDayOfFirstWeek = firstOfYear.AddDays(-dayDiff);
|
||||
//当前周的星期一
|
||||
@@ -421,8 +490,16 @@ namespace ZR.Service.mes.pro
|
||||
public int UpdateworkorderSort2(string oldId, int oldSort, string newId, int newSort)
|
||||
{
|
||||
int finalreuslt = 0;
|
||||
int result1 = Context.Updateable<ProWorkorder_v2>().Where(it => it.Id == oldId).SetColumns(it => it.Sort == newSort).ExecuteCommand();
|
||||
int result2 = Context.Updateable<ProWorkorder_v2>().Where(it => it.Id == newId).SetColumns(it => it.Sort == oldSort).ExecuteCommand();
|
||||
int result1 = Context
|
||||
.Updateable<ProWorkorder_v2>()
|
||||
.Where(it => it.Id == oldId)
|
||||
.SetColumns(it => it.Sort == newSort)
|
||||
.ExecuteCommand();
|
||||
int result2 = Context
|
||||
.Updateable<ProWorkorder_v2>()
|
||||
.Where(it => it.Id == newId)
|
||||
.SetColumns(it => it.Sort == oldSort)
|
||||
.ExecuteCommand();
|
||||
if (result1 > 0 && result2 > 0)
|
||||
{
|
||||
finalreuslt = 1;
|
||||
@@ -430,6 +507,15 @@ namespace ZR.Service.mes.pro
|
||||
return finalreuslt;
|
||||
}
|
||||
|
||||
public int UpdateWorkOrderStatus(string id, int status)
|
||||
{
|
||||
return Context
|
||||
.Updateable<ProWorkorder_v2>()
|
||||
.Where(it => it.Id == id)
|
||||
.SetColumns(it => it.Status == status)
|
||||
.ExecuteCommand();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断
|
||||
/// </summary>
|
||||
@@ -444,32 +530,45 @@ namespace ZR.Service.mes.pro
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
WmMaterial material = Context.Queryable<WmMaterial>()
|
||||
.Where(it => it.Partnumber == proWorkorder.FinishedPartNumber)
|
||||
// .Where(it => it.Status == 1)
|
||||
.First();
|
||||
WmMaterial material = Context
|
||||
.Queryable<WmMaterial>()
|
||||
.Where(it => it.Partnumber == proWorkorder.FinishedPartNumber)
|
||||
// .Where(it => it.Status == 1)
|
||||
.First();
|
||||
// 物料号不存在
|
||||
if (material == null)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
// 毛坯号异常
|
||||
if (!string.IsNullOrEmpty(material.BlankNum) && material.BlankNum != proWorkorder.BlankNumber)
|
||||
if (
|
||||
!string.IsNullOrEmpty(material.BlankNum)
|
||||
&& material.BlankNum != proWorkorder.BlankNumber
|
||||
)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
// 颜色异常
|
||||
if (!string.IsNullOrEmpty(material.Color) && !material.Color.Contains(proWorkorder.Colour))
|
||||
if (
|
||||
!string.IsNullOrEmpty(material.Color)
|
||||
&& !material.Color.Contains(proWorkorder.Colour)
|
||||
)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
// 规格异常
|
||||
if (!string.IsNullOrEmpty(material.Specification) && !material.Specification.Contains(proWorkorder.Specifications))
|
||||
if (
|
||||
!string.IsNullOrEmpty(material.Specification)
|
||||
&& !material.Specification.Contains(proWorkorder.Specifications)
|
||||
)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
// 描述异常不包含
|
||||
if (!string.IsNullOrEmpty(material.Description) && !material.Description.Contains(proWorkorder.ProductDescription))
|
||||
if (
|
||||
!string.IsNullOrEmpty(material.Description)
|
||||
&& !material.Description.Contains(proWorkorder.ProductDescription)
|
||||
)
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
@@ -480,7 +579,6 @@ namespace ZR.Service.mes.pro
|
||||
{
|
||||
throw new Exception(ex.Message);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user