首检添加数据看板

This commit is contained in:
2024-06-07 11:04:26 +08:00
parent c93711290e
commit 769d2da1e0
344 changed files with 1772 additions and 2526 deletions

View File

@@ -1,20 +1,13 @@
using Microsoft.AspNetCore.Http;
using Microsoft.VisualBasic;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZR.Model.mes.pro;
using ZR.Model.MES.op.DTO;
using ZR.Model.MES.pro.DTO;
namespace ZR.Service.mes.pro.IService
{
public interface IProWorkorderService
{
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);
public int SetWorkorderSechedule(string id, DateTime arrange_starttime, DateTime arrange_endtime);
@@ -25,7 +18,7 @@ namespace ZR.Service.mes.pro.IService
public int ReleaseProduction(string id, HttpContext httpContext);
public GanttTaskDTO GetGanttList(int year,int week,int date);
public GanttTaskDTO GetGanttList(int year, int week, int date);
}
}

View File

@@ -1,16 +1,4 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.VisualBasic;
using Model.DBModel;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZR.Model.MES.op.DTO;
using ZR.Model.MES.pro;
using ZR.Model.MES.pro;
using ZR.Model.MES.pro.DTO;
namespace ZR.Service.mes.pro.IService
@@ -31,14 +19,14 @@ namespace ZR.Service.mes.pro.IService
public int DeleteAllWorkorder(int year, int week, int date);
public int AddWorkOrder(ProWorkorder_v2 workorder);
public int AddWorkOrder(ProWorkorder_v2 workorder);
public int DeleteWorkOrder(string id);
public int UpdateWorkOrder(ProWorkorder_v2 workorder);
public int UpdateworkorderSort(string id ,int sort);
public int UpdateworkorderSort2(string oldId,int oldSort, string newId,int newSort);
public int UpdateworkorderSort(string id, int sort);
public int UpdateworkorderSort2(string oldId, int oldSort, string newId, int newSort);
public int StartWorkOrder(string id);

View File

@@ -1,18 +1,11 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZR.Model.mes.pro;
using ZR.Model.MES.op.DTO;
using ZR.Model.mes.pro;
namespace ZR.Service.mes.pro.IService
{
public interface IProWorkplanService
{
public (List<ProWorkplan>,int) GetAllData(int pageNum, int pageSize, int year, int week, string partNumber, string color);
public (List<ProWorkplan>, int) GetAllData(int pageNum, int pageSize, int year, int week, string partNumber, string color);
/// <summary>
/// 根据计划ID获取对象

View File

@@ -1,15 +1,6 @@
using Model.DBModel;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZR.Model.mes.pro;
using ZR.Model.MES.op.DTO;
using ZR.Model.MES.pro.DTO;
using ZR.Model.mes.pro;
namespace ZR.Service.mes.pro.IService
{
@@ -30,11 +21,11 @@ namespace ZR.Service.mes.pro.IService
public int UpdateWorkPlan(ProWorklplan_v2 proWorkplan);
public int DeleteWorkPlan(string id);
public int DeleteAllWorkPlan(int year,int week);
public int DeleteAllWorkPlan(int year, int week);
public string ImportExceldata(List<ProWorklplan_v2> proWorklplans);
public string ImportExceldata(List<ProWorklplan_v2> proWorklplans);
public (string,string) ExportExceldata(int year, int week);
public (string, string) ExportExceldata(int year, int week);
/// <summary>
/// 生产计划字段数据检查
@@ -43,7 +34,7 @@ namespace ZR.Service.mes.pro.IService
/// <returns>0-正常 1-物料号不存在 2-物料号与描述不匹配</returns>
public int CheckWorkPlan(ProWorklplan_v2 proWorkplan);
public WorkplanSummaryDto GetWeekSummary(int year ,int week);
public WorkplanSummaryDto GetWeekSummary(int year, int week);
/// <summary>
/// 根据生产计划ID获取工单列表

View File

@@ -1,6 +1,4 @@
using System;
using ZR.Model;
using System.Collections.Generic;
using ZR.Model.mes.pro;
using ZR.Model.MES.pro.DTO;

View File

@@ -1,32 +1,15 @@
using Infrastructure.Attribute;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using ZR.Common;
using ZR.Service.mes.pro.IService;
using ZR.Service.MES.md.IService;
using static System.Net.WebRequestMethods;
using JinianNet.JNTemplate;
using static Aliyun.OSS.Model.LiveChannelStat;
using ZR.Model.MES.pro.DTO;
using ZR.Model.MES.qu;
using ZR.Model.MES.pro;
using Model.DBModel;
using Infrastructure;
using Infrastructure;
using Infrastructure.Attribute;
using Microsoft.AspNetCore.Hosting;
using MiniExcelLibs;
using System.IO;
using SqlSugar.Extensions;
using ZR.Model.mes.pro;
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;
using ZR.Service.mes.pro.IService;
namespace ZR.Service.mes.pro
{
@@ -53,7 +36,7 @@ namespace ZR.Service.mes.pro
Id = item.Id,
Week = item.Week,
Year = item.Year,
Date = item.Date,
Date = item.Date,
BlankNumber = item.BlankNumber,
ClientWorkorder = item.ClientWorkorder,
FinishedPartNumber = item.FinishedPartNumber,
@@ -90,10 +73,10 @@ namespace ZR.Service.mes.pro
.AndIF(year > 0, it => it.Year == year)
.AndIF(week > 0, it => it.Week == week)
.AndIF(date > 0, it => it.Date == date)
.ToExpression();
.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);
}
@@ -305,7 +288,7 @@ namespace ZR.Service.mes.pro
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>
@@ -317,14 +300,14 @@ namespace ZR.Service.mes.pro
/// <exception cref="NotImplementedException"></exception>
public int UpdateworkorderSort(string id, int sort)
{
if(sort > 0)
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();
@@ -344,7 +327,7 @@ namespace ZR.Service.mes.pro
/// <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();
}
@@ -359,7 +342,7 @@ 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();
}
@@ -376,25 +359,26 @@ namespace ZR.Service.mes.pro
public int GenerateWorkorder(int year, int week, int date)
{
if (year > 0 && week > 0 && date >0)
if (year > 0 && week > 0 && date > 0)
{
DateTime week_first = GetWeekStartTime(year, week);
string date_now = week_first.AddDays(date-1).ToString("yyMMdd");
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();
foreach(ProWorkorder_v2 item in workorderList) {
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");
item.ClientWorkorder = date_now + index.ToString("000");
}
return Context.Updateable(workorderList).ExecuteCommand();
return Context.Updateable(workorderList).ExecuteCommand();
}
return 0;
return 0;
}
/// <summary>
@@ -407,9 +391,9 @@ namespace ZR.Service.mes.pro
static DateTime GetDateFromWeek(int year, int weekNumber, DayOfWeek dayOfWeek)
{
DateTime jan1 = new DateTime(year, 1, 1);
int daysOffset = (int)dayOfWeek- (int)jan1.DayOfWeek;
int daysOffset = (int)dayOfWeek - (int)jan1.DayOfWeek;
DateTime firstDayOfWeek = jan1.AddDays(7 * (weekNumber - 1) - daysOffset+2);
DateTime firstDayOfWeek = jan1.AddDays(7 * (weekNumber - 1) - daysOffset + 2);
return firstDayOfWeek;
}
@@ -418,13 +402,13 @@ namespace ZR.Service.mes.pro
/// </summary>
/// <param name="yearWeek">周数格式yyyywww</param>
/// <returns></returns>
private DateTime GetWeekStartTime(int year,int weekNum)
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;
//第一周的星期一
@@ -439,7 +423,7 @@ namespace ZR.Service.mes.pro
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();
if (result1 > 0 && result2 >0)
if (result1 > 0 && result2 > 0)
{
finalreuslt = 1;
}

View File

@@ -1,16 +1,8 @@
using Infrastructure.Attribute;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZR.Model.mes.md;
using ZR.Model.mes.pro;
using ZR.Service.mes.pro.IService;
using ZR.Service.MES.md.IService;
namespace ZR.Service.mes.pro
{
@@ -18,13 +10,13 @@ namespace ZR.Service.mes.pro
[AppService(ServiceType = typeof(IProWorkplanService), ServiceLifetime = LifeTime.Transient)]
public class ProWorkplanService : BaseService<ProWorkplan>, IProWorkplanService
{
public (List<ProWorkplan>, int) GetAllData(int pageNum, int pageSize, int year, int week, string partNumber, string color)
{
var predicate = Expressionable.Create<ProWorkplan>()
.AndIF(year > 0, it => it.Year == year)
.AndIF(week > 0, it => it.Week == week)
.AndIF(!string.IsNullOrEmpty(partNumber), it => it.Partnumber.Contains( partNumber))
.AndIF(!string.IsNullOrEmpty(partNumber), it => it.Partnumber.Contains(partNumber))
.AndIF(!string.IsNullOrEmpty(color), it => it.Color.Contains(color))
.ToExpression();
int totalCount = 0;
@@ -32,7 +24,7 @@ namespace ZR.Service.mes.pro
return (proWorkplanList, totalCount);
}
public List<ProWorkplan> GetProWorkplanById(string id)
{
return Context.Queryable<ProWorkplan>().Where(it => it.Id == id).ToList();
@@ -67,7 +59,7 @@ namespace ZR.Service.mes.pro
public int AddWorkorder(ProWorkorder proWorkorder)
{
return Context.Insertable(proWorkorder).ExecuteCommand();
}
@@ -81,6 +73,6 @@ namespace ZR.Service.mes.pro
return Context.Deleteable<ProWorkorder>().In(id).ExecuteCommand();
}
}
}

View File

@@ -1,24 +1,15 @@
using Infrastructure;
using Infrastructure.Attribute;
using Mapster.Utils;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Routing.Template;
using Microsoft.Extensions.DependencyInjection;
using MiniExcelLibs;
using Model.DBModel;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZR.Model.mes.pro;
using ZR.Model.MES.pro.DTO;
using ZR.Model.MES.wms;
using ZR.Service.mes.pro.IService;
using ZR.Service.MES.md.IService;
namespace ZR.Service.mes.pro
{
@@ -276,7 +267,7 @@ namespace ZR.Service.mes.pro
/// <param name="week"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public int DeleteAllWorkPlan(int year,int week)
public int DeleteAllWorkPlan(int year, int week)
{
return Context.Deleteable<ProWorklplan_v2>().Where(it => it.Year == year && it.Week == week).ExecuteCommand();
}
@@ -294,22 +285,23 @@ namespace ZR.Service.mes.pro
.Where(it => it.Status == 1)
.First();
// 物料号不存在
if(material == null)
if (material == null)
{
return 1;
}
// 规格与颜色异常
if(material.Specification != proWorkplan.Specification || material.Color != proWorkplan.ColorCode)
if (material.Specification != proWorkplan.Specification || material.Color != proWorkplan.ColorCode)
{
return 2;
}
return 0;
}catch (Exception ex)
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
}
}

View File

@@ -1,14 +1,10 @@
using System;
using SqlSugar;
using Infrastructure.Attribute;
using Infrastructure.Extensions;
using SqlSugar;
using System;
using ZR.Model;
using ZR.Repository;
using ZR.Service.Business.IBusinessService;
using System.Linq;
using ZR.Model.mes.pro;
using ZR.Model.MES.pro.DTO;
using ZR.Repository;
namespace ZR.Service.mes.pro.IService
{