diff --git a/ZR.Admin.WebApi/Controllers/mes/pro/ProWorkorderV2Controller.cs b/ZR.Admin.WebApi/Controllers/mes/pro/ProWorkorderV2Controller.cs index 2310c5af..6f9742f3 100644 --- a/ZR.Admin.WebApi/Controllers/mes/pro/ProWorkorderV2Controller.cs +++ b/ZR.Admin.WebApi/Controllers/mes/pro/ProWorkorderV2Controller.cs @@ -42,6 +42,17 @@ namespace ZR.Admin.WebApi.Controllers.mes.pro return ToResponse(new ApiResult(200, "success", data)); } + // + + + [HttpGet("getWorkoderList_piliang")] + public IActionResult GetWorkorderList_Piliang(int pageNum, int pageSize, int year = -1, int week = -1, int date = -1) + { + (List, int) data = proWorkorderService.GetWorkorderList_Piliang(pageNum, pageSize, year, week, date, 0); + + return ToResponse(new ApiResult(200, "success", data)); + } + /// /// 生产工单模板下载 /// @@ -71,6 +82,12 @@ namespace ZR.Admin.WebApi.Controllers.mes.pro int year = 0; int week = 0; int date = 0; + if (!Directory.Exists(target)) + { + // 如果目录不存在就创建 + Directory.CreateDirectory(target); + + } using (var stream = formFile.OpenReadStream()) { FileStream targetFileStream = new FileStream(target, FileMode.Create, FileAccess.Write); @@ -82,17 +99,18 @@ namespace ZR.Admin.WebApi.Controllers.mes.pro targetFileStream.Write(buffer, 0, bytesRead); } - //2.0 解析excel - //读取第一行 解析 年和月 - var row = stream.Query().Skip(1).First(); - year = Convert.ToInt32(row.A); - week = Convert.ToInt32(row.B); - date = Convert.ToInt32(row.C); + //读取列表数据 try { + //2.0 解析excel + //读取第一行 解析 年和月 + var row = stream.Query().Skip(1).First(); + year = Convert.ToInt32(row.A); + week = Convert.ToInt32(row.B); + date = Convert.ToInt32(row.C); var list = stream.Query(sheetName: "Sheet1", startCell: "A3").ToList(); ; @@ -106,12 +124,7 @@ namespace ZR.Admin.WebApi.Controllers.mes.pro item.ProductDescription = ""; if (item.Colour == null) item.Colour = ""; - if (item.FinishedPartNumber == null) - item.FinishedPartNumber = ""; - if (item.ProductDescription == null) - item.ProductDescription = ""; - if (item.Colour == null) - item.Colour = ""; + if (item.Specifications == null) item.Specifications = ""; if (item.CylinderNumber == null) @@ -131,14 +144,16 @@ namespace ZR.Admin.WebApi.Controllers.mes.pro item.Week = week; item.Date = date; } - var final_list = list.Where(it => !it.BlankNumber.Contains("圈数")).ToList(); + var final_list = list.Where(it => !it.BlankNumber.Contains("圈数")) + .Where(it => !(it.BlankNumber == "" && it.FinishedPartNumber == "" && it.ProductDescription == "" && it.Specifications == "" && it.CylinderNumber == "" && it.Remark1 == "" && it.Remark2== "" && it.Remark3 == "" && it.Remark4== ""&&it.ClientWorkorder=="")) + .ToList(); string result = proWorkorderService.ImportExceldata(final_list); return SUCCESS(result); } catch (Exception ex) { - return ToResponse(ResultCode.GLOBAL_ERROR, "模板内容错误,请仔细检测格式,并联系管理员" + ex.Message); + return ToResponse(ResultCode.GLOBAL_ERROR, "内容错误,请仔细检测格式,并联系管理员" + ex.Message); } } @@ -305,7 +320,7 @@ namespace ZR.Admin.WebApi.Controllers.mes.pro public IActionResult GenerateWorkorder(int? year, int? week, int? date) { int data = 0; - data = proWorkorderService.GenerateWorkorder((int)year, (int)week,(int)date); + data = proWorkorderService.GenerateWorkorder((int)year, (int)week, (int)date); return ToResponse(new ApiResult(200, "success", data)); } diff --git a/ZR.Admin.WebApi/Controllers/mes/pro/ProWorkplanV2Controller.cs b/ZR.Admin.WebApi/Controllers/mes/pro/ProWorkplanV2Controller.cs index 72f6f1fa..002bbfa7 100644 --- a/ZR.Admin.WebApi/Controllers/mes/pro/ProWorkplanV2Controller.cs +++ b/ZR.Admin.WebApi/Controllers/mes/pro/ProWorkplanV2Controller.cs @@ -169,6 +169,10 @@ namespace ZR.Admin.WebApi.Controllers.mes.pro IWebHostEnvironment webHostEnvironment = (IWebHostEnvironment)App.ServiceProvider.GetService(typeof(IWebHostEnvironment)); string sFileName = DateTime.Now.ToString("yyyyMMddHHmmss") + formFile.FileName; string target = Path.Combine(webHostEnvironment.WebRootPath, "workplan", sFileName); + if (!Directory.Exists(target)) + { + Directory.CreateDirectory(target); + } int year = 0; int week = 0; using (var stream = formFile.OpenReadStream()) @@ -182,17 +186,18 @@ namespace ZR.Admin.WebApi.Controllers.mes.pro targetFileStream.Write(buffer, 0, bytesRead); } - //2.0 解析excel - //读取第一行 解析 年和月 - var row = stream.Query().Take(1).First(); - year = Convert.ToInt32(row.A); - - week = Convert.ToInt32(row.B); + //读取列表数据 try { + //2.0 解析excel + //读取第一行 解析 年和月 + var row = stream.Query().Take(1).First(); + year = Convert.ToInt32(row.A); + + week = Convert.ToInt32(row.B); var list = stream.Query(sheetName: "Sheet1", startCell: "B3") .Where(it => it.Partnumber != null) .Where(it => !it.Partnumber.Contains("合计")) @@ -203,6 +208,7 @@ namespace ZR.Admin.WebApi.Controllers.mes.pro it.ToCreate(HttpContext); it.Year = year; it.Week = week; + it.NoSchedule = it.RequireNum; }); string result = proWorkplanService.ImportExceldata(list); @@ -210,7 +216,7 @@ namespace ZR.Admin.WebApi.Controllers.mes.pro } catch (Exception ex) { - return ToResponse(ResultCode.GLOBAL_ERROR,"模板内容错误,请仔细检测格式,并联系管理员"+ex.Message); + return ToResponse(ResultCode.GLOBAL_ERROR,"内容错误,请仔细检测格式,并联系管理员"+ex.Message); } } return SUCCESS(null); diff --git a/ZR.Admin.WebApi/Controllers/mes/qc/FQC/FirstFQCController.cs b/ZR.Admin.WebApi/Controllers/mes/qc/FQC/FirstFQCController.cs index 84221afd..9bc26c82 100644 --- a/ZR.Admin.WebApi/Controllers/mes/qc/FQC/FirstFQCController.cs +++ b/ZR.Admin.WebApi/Controllers/mes/qc/FQC/FirstFQCController.cs @@ -25,7 +25,8 @@ namespace ZR.Admin.WebApi.Controllers.mes.qc.IQC private readonly IFirstFQCService fQCService; private readonly IHubContext hubContext; - public FirstFQCController(IFirstFQCService fQCService, IHubContext hubContext) { + public FirstFQCController(IFirstFQCService fQCService, IHubContext hubContext) + { this.fQCService = fQCService; this.hubContext = hubContext; } @@ -40,18 +41,62 @@ namespace ZR.Admin.WebApi.Controllers.mes.qc.IQC public IActionResult GetcheckItemTable() { - CheckItemTableDTO itemTableDTO= fQCService.GetCheckItemTable(); - + CheckItemTableDTO itemTableDTO = fQCService.GetCheckItemTable(); + return SUCCESS(itemTableDTO); } [HttpGet("getcheckitemRecord")] - public IActionResult GetcheckitemRecord() + public IActionResult GetcheckitemRecord() { - + return null; } + + + + /// + /// 获取当前工单 + /// + /// + [HttpGet("getcurrentWorkorder")] + public IActionResult GetcurrentWorkorder() + { + + QcCurrentWorkorderDto workorder= fQCService.GetcurrentWorkorder(); + + return SUCCESS(workorder); + } + + + /// + /// 获取下一个工单 + /// + /// + [HttpGet("getcurrentWorkorder_next")] + public IActionResult GetcurrentWorkorder_next() + { + + QcCurrentWorkorderDto workorder = fQCService.GetcurrentWorkorder_next(); + + return SUCCESS(workorder); + } + + + /// + /// 获取上一个工单 + /// + /// + [HttpGet("getcurrentWorkorder_previous")] + public IActionResult GetcurrentWorkorder_previous() + { + + QcCurrentWorkorderDto workorder = fQCService.GetcurrentWorkorder_previous(); + + return SUCCESS(workorder); + } + } } diff --git a/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj b/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj index 7c1dc8c0..5b0baab5 100644 --- a/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj +++ b/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj @@ -44,8 +44,8 @@ - + diff --git a/ZR.Admin.WebApi/wwwroot/workorder/2024012216134397e79fbae8a188e6a19d%bf.xlsx b/ZR.Admin.WebApi/wwwroot/workorder/2024012216134397e79fbae8a188e6a19d%bf.xlsx deleted file mode 100644 index 06c48fce..00000000 Binary files a/ZR.Admin.WebApi/wwwroot/workorder/2024012216134397e79fbae8a188e6a19d%bf.xlsx and /dev/null differ diff --git a/ZR.Admin.WebApi/wwwroot/workorder/2024012216405497e79fbae8a188e6a19d%bf.xlsx b/ZR.Admin.WebApi/wwwroot/workorder/2024012216405497e79fbae8a188e6a19d%bf.xlsx deleted file mode 100644 index 06c48fce..00000000 Binary files a/ZR.Admin.WebApi/wwwroot/workorder/2024012216405497e79fbae8a188e6a19d%bf.xlsx and /dev/null differ diff --git a/ZR.Admin.WebApi/wwwroot/workorder/2024012216434597e79fbae8a188e6a19d%bf.xlsx b/ZR.Admin.WebApi/wwwroot/workorder/2024012216434597e79fbae8a188e6a19d%bf.xlsx deleted file mode 100644 index 06c48fce..00000000 Binary files a/ZR.Admin.WebApi/wwwroot/workorder/2024012216434597e79fbae8a188e6a19d%bf.xlsx and /dev/null differ diff --git a/ZR.Admin.WebApi/wwwroot/workorder/2024012216482597e79fbae8a188e6a19d%bf.xlsx b/ZR.Admin.WebApi/wwwroot/workorder/2024012216482597e79fbae8a188e6a19d%bf.xlsx deleted file mode 100644 index 06c48fce..00000000 Binary files a/ZR.Admin.WebApi/wwwroot/workorder/2024012216482597e79fbae8a188e6a19d%bf.xlsx and /dev/null differ diff --git a/ZR.Admin.WebApi/wwwroot/workorder/2024012216530097e79fbae8a188e6a19d%bf.xlsx b/ZR.Admin.WebApi/wwwroot/workorder/2024012216530097e79fbae8a188e6a19d%bf.xlsx deleted file mode 100644 index 06c48fce..00000000 Binary files a/ZR.Admin.WebApi/wwwroot/workorder/2024012216530097e79fbae8a188e6a19d%bf.xlsx and /dev/null differ diff --git a/ZR.Admin.WebApi/wwwroot/workorder/2024012311144797e79fbae8a188e6a19d%bf.xlsx b/ZR.Admin.WebApi/wwwroot/workorder/2024012311144797e79fbae8a188e6a19d%bf.xlsx deleted file mode 100644 index 6f35b14c..00000000 Binary files a/ZR.Admin.WebApi/wwwroot/workorder/2024012311144797e79fbae8a188e6a19d%bf.xlsx and /dev/null differ diff --git a/ZR.Admin.WebApi/wwwroot/workorder/2024012318564397e79fbae8a188e6a19d%bf.xlsx b/ZR.Admin.WebApi/wwwroot/workorder/2024012318564397e79fbae8a188e6a19d%bf.xlsx deleted file mode 100644 index 06c48fce..00000000 Binary files a/ZR.Admin.WebApi/wwwroot/workorder/2024012318564397e79fbae8a188e6a19d%bf.xlsx and /dev/null differ diff --git a/ZR.Admin.WebApi/wwwroot/workorder/2024012318590497e79fbae8a188e6a19d%bf.xlsx b/ZR.Admin.WebApi/wwwroot/workorder/2024012318590497e79fbae8a188e6a19d%bf.xlsx deleted file mode 100644 index 06c48fce..00000000 Binary files a/ZR.Admin.WebApi/wwwroot/workorder/2024012318590497e79fbae8a188e6a19d%bf.xlsx and /dev/null differ diff --git a/ZR.Admin.WebApi/wwwroot/workorder/2024012319060897e79fbae8a188e6a19d%bf.xlsx b/ZR.Admin.WebApi/wwwroot/workorder/2024012319060897e79fbae8a188e6a19d%bf.xlsx deleted file mode 100644 index 06c48fce..00000000 Binary files a/ZR.Admin.WebApi/wwwroot/workorder/2024012319060897e79fbae8a188e6a19d%bf.xlsx and /dev/null differ diff --git a/ZR.Admin.WebApi/wwwroot/workorder/2024012319123497e79fbae8a188e6a19d%bf.xlsx b/ZR.Admin.WebApi/wwwroot/workorder/2024012319123497e79fbae8a188e6a19d%bf.xlsx deleted file mode 100644 index 06c48fce..00000000 Binary files a/ZR.Admin.WebApi/wwwroot/workorder/2024012319123497e79fbae8a188e6a19d%bf.xlsx and /dev/null differ diff --git a/ZR.Admin.WebApi/wwwroot/workorder/2024012319485797e79fbae8a188e6a19d%bf.xlsx b/ZR.Admin.WebApi/wwwroot/workorder/2024012319485797e79fbae8a188e6a19d%bf.xlsx deleted file mode 100644 index 6f35b14c..00000000 Binary files a/ZR.Admin.WebApi/wwwroot/workorder/2024012319485797e79fbae8a188e6a19d%bf.xlsx and /dev/null differ diff --git a/ZR.Admin.WebApi/wwwroot/workorder/2024012319543897e79fbae8a188e6a19d%bf.xlsx b/ZR.Admin.WebApi/wwwroot/workorder/2024012319543897e79fbae8a188e6a19d%bf.xlsx deleted file mode 100644 index 6f35b14c..00000000 Binary files a/ZR.Admin.WebApi/wwwroot/workorder/2024012319543897e79fbae8a188e6a19d%bf.xlsx and /dev/null differ diff --git a/ZR.Admin.WebApi/wwwroot/workorder/2024012216552497e79fbae8a188e6a19d%bf.xlsx b/ZR.Admin.WebApi/wwwroot/workorder/2024012614503797e79fbae8a188e6a19d%bf.xlsx similarity index 100% rename from ZR.Admin.WebApi/wwwroot/workorder/2024012216552497e79fbae8a188e6a19d%bf.xlsx rename to ZR.Admin.WebApi/wwwroot/workorder/2024012614503797e79fbae8a188e6a19d%bf.xlsx diff --git a/ZR.Admin.WebApi/wwwroot/workplan/2024012309515591e8a188e68787e6a19d%bf.xlsx b/ZR.Admin.WebApi/wwwroot/workplan/2024012309515591e8a188e68787e6a19d%bf.xlsx deleted file mode 100644 index 34be72e6..00000000 Binary files a/ZR.Admin.WebApi/wwwroot/workplan/2024012309515591e8a188e68787e6a19d%bf.xlsx and /dev/null differ diff --git a/ZR.Model/MES/qc/DTO/QcCurrentWorkorderDto.cs b/ZR.Model/MES/qc/DTO/QcCurrentWorkorderDto.cs new file mode 100644 index 00000000..ad1de46e --- /dev/null +++ b/ZR.Model/MES/qc/DTO/QcCurrentWorkorderDto.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Numerics; +using System.Text; +using System.Threading.Tasks; + +namespace ZR.Model.MES.qc.DTO +{ + /// + /// 当前工单 + /// + public class QcCurrentWorkorderDto + { + /// + /// 工单号 + /// + public string ClientWorkorder { set; get; } + /// + /// 产品描述 + /// + public string ProductDescription { set; get; } + /// + /// 零件号 + /// + public string FinishedPartNumber { set; get; } + /// + /// 规格 + /// + public string Specifications { set; get; } + + /// + ///颜色 + /// + public string Colour { set; get; } + /// + /// A/B班 + /// + public string Team { set; get; } + /// + /// 投入数 + /// + public int PreviousNumber { set; get; } + /// + /// 一次合格数 + /// + + public int FirstPassNumber { set; get; } + /// + /// 一次合格率 + /// + + public double FirstPassRate { set; get; } + /// + /// 打磨数 + /// + + public int PolisheNumber { set; get; } + /// + /// 报废数 + /// + public int ScrapNumber { set; get; } + /// + /// 抛光数 + /// + public int DefectNumber { set; get; } + + + } +} diff --git a/ZR.Model/MES/qc/QcFirstinspectionRecord.cs b/ZR.Model/MES/qc/QcFirstinspectionRecord.cs index 5871b0d5..d784aecd 100644 --- a/ZR.Model/MES/qc/QcFirstinspectionRecord.cs +++ b/ZR.Model/MES/qc/QcFirstinspectionRecord.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Security.Principal; using SqlSugar; namespace ZR.Model.MES.qc { @@ -14,7 +15,7 @@ namespace ZR.Model.MES.qc /// 流水号 /// [SugarColumn(ColumnName = "id", IsPrimaryKey = true)] - public string Id { get; set; } + public string Id { get; set; } /// /// 工单id /// diff --git a/ZR.Service/mes/pro/IService/IProWorkorderServiceV2.cs b/ZR.Service/mes/pro/IService/IProWorkorderServiceV2.cs index 953d8f4c..fc2afb12 100644 --- a/ZR.Service/mes/pro/IService/IProWorkorderServiceV2.cs +++ b/ZR.Service/mes/pro/IService/IProWorkorderServiceV2.cs @@ -20,6 +20,8 @@ namespace ZR.Service.mes.pro.IService public (List, int) GetWorkorderList(int pageNum, int pageSize, int year, int week, int date, int isSchedule); + public (List, int) GetWorkorderList_Piliang(int pageNum, int pageSize, int year, int week, int date, int isSchedule); + public string ImportExceldata(List proWorklplans); diff --git a/ZR.Service/mes/pro/ProWorkorderServiceV2.cs b/ZR.Service/mes/pro/ProWorkorderServiceV2.cs index a24ead8c..11972317 100644 --- a/ZR.Service/mes/pro/ProWorkorderServiceV2.cs +++ b/ZR.Service/mes/pro/ProWorkorderServiceV2.cs @@ -46,6 +46,21 @@ namespace ZR.Service.mes.pro return (proWorkorderList, totalCount); } + + public (List, int) GetWorkorderList_Piliang(int pageNum, int pageSize, int year, int week, int date, int isSchedule) + { + + var predicate = Expressionable.Create() + .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 proWorkorderList = Context.Queryable().Where(predicate).Where(it=>it.Remark3=="是").OrderBy(it => it.Sort).ToPageList(pageNum, pageSize, ref totalCount); + + return (proWorkorderList, totalCount); + } /// /// 获取生产计划id /// @@ -163,15 +178,8 @@ namespace ZR.Service.mes.pro //2.0 保存为excel 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)); - - - var Sheet1 = new { year = year, @@ -183,20 +191,9 @@ namespace ZR.Service.mes.pro }; string templatePath = Path.Combine(webHostEnvironment.WebRootPath, "ImportTemplate", "日生产计划模板1.xlsx"); MiniExcel.SaveAsByTemplate(fullPath, templatePath, Sheet1); - - - - - // MiniExcel.SaveAs(fullPath, list); - - //3.0 返回路径和文件名 return (sFileName, fullPath); - - - - } /// @@ -209,6 +206,8 @@ namespace ZR.Service.mes.pro { return Context.Deleteable().Where(it => it.Year == year && it.Week == week && it.Date == date).ExecuteCommand(); } + + /// /// 获取生产计划id /// @@ -268,7 +267,8 @@ namespace ZR.Service.mes.pro { workorder.Remark3 = "是"; } - return Context.Updateable(workorder).ExecuteCommand(); + + return Context.Updateable(workorder).IgnoreColumns(it => new { it.CreatedBy, it.CreatedTime,it.Remark4,it.Sort }).ExecuteCommand(); } /// diff --git a/ZR.Service/mes/qc/FirstFQCService.cs b/ZR.Service/mes/qc/FirstFQCService.cs index 0f299609..b2ff53a7 100644 --- a/ZR.Service/mes/qc/FirstFQCService.cs +++ b/ZR.Service/mes/qc/FirstFQCService.cs @@ -5,9 +5,11 @@ using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; +using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; +using ZR.Model.MES.pro; using ZR.Model.MES.qc; using ZR.Model.MES.qc.DTO; using ZR.Model.MES.qu; @@ -48,7 +50,7 @@ namespace ZR.Service.mes.qc { //更新实时记录表 QcFirstinspectionRecord record = new QcFirstinspectionRecord(); - record.Id = DateTime.Now.ToString("MMddHHmmss"); + record.Id = DateTime.Now.ToString("YYMMddHHmmss"); record.InspectionModule = InspectionModule; record.FKWorkorderId = workorder_id; record.FKInpectionId = checkid.Substring(0, 3); @@ -100,7 +102,7 @@ namespace ZR.Service.mes.qc { //更新实时记录表 QcAgaininspectionRecord record = new QcAgaininspectionRecord(); - record.Id = DateTime.Now.ToString("MMddHHmmss"); + record.Id = DateTime.Now.ToString("YYMMddHHmmss"); record.InspectionModule = InspectionModule; record.FkWorkorderId = workorder_id; record.FkInpectionId = checkid.Substring(0, 3); @@ -150,7 +152,7 @@ namespace ZR.Service.mes.qc { //更新实时记录表 QcFinalinspectionRecord record = new QcFinalinspectionRecord(); - record.Id = DateTime.Now.ToString("MMddHHmmss"); + record.Id = DateTime.Now.ToString("YYMMddHHmmss"); record.InspectionModule = InspectionModule; record.FkWorkorderId = workorder_id; record.FkInpectionId = checkid.Substring(0, 3); @@ -161,7 +163,7 @@ namespace ZR.Service.mes.qc .ToStorage(); x.AsInsertable.ExecuteCommandAsync(); //执行插入 - x.AsUpdateable.ExecuteCommandAsync(); //执行更新 + x.AsUpdateable.UpdateColumns(it => new { it.UpdatedBy,it.UpdatedTime,it.Counter }).ExecuteCommandAsync(); //执行更新 ////更新初检报废表 //if (Convert.ToInt32(checkid) / 10 % 10==3) @@ -345,5 +347,167 @@ namespace ZR.Service.mes.qc double percentage = ((double)num1 / num2) * 100; return Math.Round(percentage, 2); } + + public static QcCurrentWorkorderDto Now_producting_Workorder = null; //当前生产工单 + /// + /// 获取当前_生产中_工单列表 + /// + /// + /// + public List GetNow_producting_WorkorderList() + { + List workorders= Context.Queryable().Where(it => it.Remark3 == "是").Where(it => it.Status == 1).OrderBy(it=>it.Sort).ToList(); + + List qcCurrentList= new List(); + foreach(ProWorkorder_v2 item in workorders) + { + qcCurrentList.Add(new QcCurrentWorkorderDto() + { + ClientWorkorder = item.ClientWorkorder, + ProductDescription = item.ProductDescription, + FinishedPartNumber = item.FinishedPartNumber, + Specifications = item.Specifications, + Colour = item.Colour, + Team = "", + PreviousNumber=item.PreviousNumber, + FirstPassNumber=0, + FirstPassRate=0.0, + PolisheNumber=0, + ScrapNumber = 0, + DefectNumber = 0 + }); + ; + + } + + return qcCurrentList; + } + + + /// + /// 获取当前生产工单 + /// + /// + /// + public QcCurrentWorkorderDto GetcurrentWorkorder() + { + //获取状态为1的生产工单列表 + List Now_producting_WorkorderList= GetNow_producting_WorkorderList(); + // 当前没有生产工单 + if (Now_producting_WorkorderList==null|| Now_producting_WorkorderList.Count<=0) + { + Now_producting_Workorder = null; + return null; + } + else if(Now_producting_Workorder==null) + { + Now_producting_Workorder = Now_producting_WorkorderList[0]; + return Now_producting_Workorder; + } + else + { + return Now_producting_Workorder; + } + + } + + + + /// + /// 获取下一个生产工单 + /// + /// + /// + public QcCurrentWorkorderDto GetcurrentWorkorder_next() + { + //获取状态为1的生产工单列表 + List Now_producting_WorkorderList = GetNow_producting_WorkorderList(); + // 当前没有生产工单 + if (Now_producting_WorkorderList == null || Now_producting_WorkorderList.Count <= 0) + { + Now_producting_Workorder = null; + return null; + } + else + { + + // 当前没有生产工单 + if (Now_producting_Workorder == null) + { + return null; + } + //获取上一个工单号 游标 + int index= Now_producting_WorkorderList.FindIndex(x => x.ClientWorkorder== Now_producting_Workorder.ClientWorkorder); + if (index < 0) + { + // 逻辑异常 + Now_producting_Workorder = Now_producting_WorkorderList[0]; + return null; + } + if (index== Now_producting_WorkorderList.Count()-1) + { + // 已经是最后一个了没有 + return null; + + } + else + { + Now_producting_Workorder = Now_producting_WorkorderList[index + 1]; + return Now_producting_Workorder; + } + + } + + } + /// + /// 获取上一个工单 + /// + /// + /// + + public QcCurrentWorkorderDto GetcurrentWorkorder_previous() + { + //获取状态为1的生产工单列表 + List Now_producting_WorkorderList = GetNow_producting_WorkorderList(); + // 当前没有生产工单 + if (Now_producting_WorkorderList == null || Now_producting_WorkorderList.Count <= 0) + { + Now_producting_Workorder = null; + return null; + } + else + { + + // 当前没有生产工单 + if (Now_producting_Workorder == null) + { + return null; + } + //获取上一个工单号 游标 + int index = Now_producting_WorkorderList.FindIndex(x => x.ClientWorkorder == Now_producting_Workorder.ClientWorkorder); + if (index < 0) + { + // 逻辑异常 + Now_producting_Workorder = Now_producting_WorkorderList[0]; + return null; + } + if (index == 0) + { + // 已经是最后一个了没有 + return null; + + } + else + { + Now_producting_Workorder = Now_producting_WorkorderList[index -1]; + return Now_producting_Workorder; + } + + } + } + + + + } } diff --git a/ZR.Service/mes/qc/IService/IFirstFQCService.cs b/ZR.Service/mes/qc/IService/IFirstFQCService.cs index 379d6834..221a4d9f 100644 --- a/ZR.Service/mes/qc/IService/IFirstFQCService.cs +++ b/ZR.Service/mes/qc/IService/IFirstFQCService.cs @@ -13,5 +13,9 @@ namespace ZR.Service.mes.qc.IService public Task SaveinspectItem_v1(string workorder_id, string InspectionModule, string checkid, int counter); public Task SaveinspectItem_v2(string workorder_id, string InspectionModule, string checkid, int counter); public Task SaveinspectItem_v3(string workorder_id, string InspectionModule, string checkid, int counter); + + public QcCurrentWorkorderDto GetcurrentWorkorder(); + public QcCurrentWorkorderDto GetcurrentWorkorder_next(); + public QcCurrentWorkorderDto GetcurrentWorkorder_previous(); } }