From 76eef0389848065963a295c66163a630697054fa Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期日, 07 七月 2024 09:47:01 +0800
Subject: [PATCH] PDA
---
代码管理/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs | 419 ++++++++++++++---------------------------------------------
1 files changed, 100 insertions(+), 319 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs"
index 9ad8b37..d56fee2 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs"
@@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Net;
using System.Security.Cryptography.Xml;
using System.Text;
using System.Threading.Tasks;
@@ -26,7 +27,7 @@
namespace WIDESEA_WCS
{
- public class Gantry
+ public class Gantry : Gantry2
{
#region 鏌ヨ杞﹁疆鏁版嵁
/// <summary>
@@ -45,7 +46,6 @@
Idt_geometry_dataRepository dataRepository = new dt_geometry_dataRepository(Context);
Idt_mes_detailRepository mes_DetailRepository = new dt_mes_detailRepository(Context);
Idt_mes_headRepository mes_HeadRepository = new dt_mes_headRepository(Context);
- Idt_geometry_data_detectionlineRepository detectionlineRepository = new dt_geometry_data_detectionlineRepository(Context);
var plc = repository.FindFirst(x => x.plcinfo_name == client.PLCName);
List<string> names = new List<string>() { "1鍗曞厓杈婇亾涓嬫枡鏌ヨ杞﹁疆", "2鍗曞厓杈婇亾涓嬫枡鏌ヨ杞﹁疆", "3鍗曞厓杈婇亾涓嬫枡鏌ヨ杞﹁疆", "杈婇亾涓婃枡鏌ヨ杞﹁疆" };
foreach (string name in names)
@@ -63,151 +63,69 @@
if (name == "杈婇亾涓婃枡鏌ヨ杞﹁疆") number = "杈婇亾涓婃枡鏌ヨ璁㈠崟";
var wp_id = client.ReadByOrder<string>("R_o_wp_id", number);
- var Mes_Work = workinfoRepository.Find(x => x.SN == wp_id && x.processCode == (name != "杈婇亾涓婃枡鏌ヨ杞﹁疆" ? "17" : "28")).FirstOrDefault();
+ if (name == "杈婇亾涓婃枡鏌ヨ杞﹁疆")
+ {
+ var wp_id1 = client.ReadByOrder<string>("W_Wheel_id", "涓婃枡鍖�");//杞﹁疆SN鍙�
+ if (wp_id != wp_id1)
+ {
+ client.WriteByOrder("W_i_status", (byte)2, name);
+ client.WriteByOrder("R_oi_on", (byte)0, name);
+ WriteLog.Write_Log(name, wp_id, "閿欒淇℃伅锛�", $"璇诲彇妗佹灦淇℃伅锛歕n鏌ヨ杞﹁疆SN锛歿wp_id}\n涓婃枡鐢宠SN锛歿wp_id}\n\n鍐欏叆妗佹灦淇℃伅锛歕nW_i_status锛�2\nR_oi_on锛�0\n\n鏈煡璇㈠埌宸ュ崟淇℃伅");
+ continue;
+ }
+ }
+
+ var Mes_Work = workinfoRepository.Find(x => x.SN == wp_id && x.processCode == (name != "杈婇亾涓婃枡鏌ヨ杞﹁疆" ? "17" : "28")).OrderByDescending(x => x.CreateTime).FirstOrDefault();
if (Mes_Work == null)
{
client.WriteByOrder("W_i_status", (byte)2, name);
client.WriteByOrder("R_oi_on", (byte)0, name);
#region 鏃ュ織璁板綍
- //WriteDBLog.Error(name, $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN锛歿wp_id}\n\n鍐欏叆妗佹灦淇℃伅锛歕nW_i_status锛�2\nR_oi_on锛�0\n\n鏈煡璇㈠埌宸ュ崟淇℃伅", "PCS");
WriteLog.Write_Log(name, wp_id, "閿欒淇℃伅锛�", $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN锛歿wp_id}\n\n鍐欏叆妗佹灦淇℃伅锛歕nW_i_status锛�2\nR_oi_on锛�0\n\n鏈煡璇㈠埌宸ュ崟淇℃伅");
#endregion
continue;
}
-
- #region MyRegion
- //var mes_Detail = mes_DetailRepository.FindFirst(x => x.SN == wp_id);
- //if (mes_Detail == null)
- //{
- // client.WriteByOrder("W_i_status", (byte)2, name);
- // client.WriteByOrder("R_oi_on", (byte)0, name);
- // #region 鏃ュ織璁板綍
- // WriteDBLog.Error(name, $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN锛歿wp_id}\n\n鍐欏叆妗佹灦淇℃伅锛歕nW_i_status锛�2\nR_oi_on锛�0\n\n鏈煡璇㈠埌宸ュ崟璇︽儏", "PCS");
- // #endregion
- // continue;
- //}
- //var mes_Head = mes_HeadRepository.FindFirst(x => x.jobID == mes_Detail.jobID);
- //if (mes_Head == null)
- //{
- // client.WriteByOrder("W_i_status", (byte)2, name);
- // client.WriteByOrder("R_oi_on", (byte)0, name);
- // #region 鏃ュ織璁板綍
- // WriteDBLog.Error(name, $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN锛歿wp_id}\n\n鍐欏叆妗佹灦淇℃伅锛歕nW_i_status锛�2\nR_oi_on锛�0\n\n鏈煡璇㈠埌宸ュ崟澶磋〃", "PCS");
- // #endregion
- // continue;
- //}
- #endregion
-
-
- if (name != "杈婇亾涓婃枡鏌ヨ杞﹁疆")
+ var geometry = Pipeline.QueryMateriel(Mes_Work.drawingNo);
+ if (geometry == null)
{
- //var geometry = dataRepository.FindFirst(x => x.TypeId == (Int32)wp_type);
- var geometry = dataRepository.Find(x => x.Description == Mes_Work.drawingNo).FirstOrDefault();
- var geometry1 = detectionlineRepository.Find(x => x.Description == Mes_Work.drawingNo).FirstOrDefault();
- if (geometry == null && geometry1 == null)
- {
- //DBExtension.Write(details.Where(x => x.plcdetail_name == "W_i_status").First(), client, (Int16)2);
- //1-鎵惧埌鏁版嵁锛�2-鏈壘鍒板伐浠剁被鍨嬫暟鎹�
- client.WriteByOrder("W_i_status", (byte)2, name);
- client.WriteByOrder("R_oi_on", (byte)0, name);
- #region 鏃ュ織璁板綍
- //WriteDBLog.Error(name, $"璇诲彇妗佹灦淇℃伅锛歕n杞瀷ID锛歿wp_type}\n\n鍐欏叆妗佹灦淇℃伅锛歕nW_i_status锛�2\nR_oi_on锛�0\n\n鏈煡璇㈠埌鏈哄姞宸ヨ溅杞俊鎭�", "PCS");
- WriteLog.Write_Log(name, wp_id, "閿欒淇℃伅锛�", $"璇诲彇妗佹灦淇℃伅锛歕n杞瀷ID锛歿wp_type}\n\n鍐欏叆妗佹灦淇℃伅锛歕nW_i_status锛�2\nR_oi_on锛�0\n\n鏈煡璇㈠埌鏈哄姞宸ヨ溅杞俊鎭�");
- #endregion
- }
- else
- {
- //1-鎵惧埌鏁版嵁锛�2-鏈壘鍒板伐浠剁被鍨嬫暟鎹�
- client.WriteByOrder("W_i_status", (byte)1, name);
- client.WriteByOrder("W_i_parameter_a", geometry == null ? (float)geometry1.a : (float)geometry.a, name);
- client.WriteByOrder("W_i_parameter_b", geometry == null ? (float)geometry1.b : (float)geometry.b, name);
- client.WriteByOrder("W_i_parameter_c", geometry == null ? (float)geometry1.c : (float)geometry.c, name);
- client.WriteByOrder("W_i_parameter_d", geometry == null ? (float)geometry1.d : (float)geometry.d, name);
- client.WriteByOrder("W_i_parameter_e", geometry == null ? (float)geometry1.e : (float)geometry.e, name);
- client.WriteByOrder("W_i_parameter_f", geometry == null ? (float)geometry1.f : (float)geometry.f, name);
- client.WriteByOrder("W_i_parameter_g", geometry == null ? (float)geometry1.g : (float)geometry.g, name);
- client.WriteByOrder("W_i_parameter_h", geometry == null ? (float)geometry1.h : (float)geometry.h, name);
- client.WriteByOrder("R_oi_on", (byte)0, name);
- #region 鏃ュ織璁板綍
- //WriteDBLog.Success(name, $"璇诲彇妗佹灦淇℃伅锛歕n杞瀷ID锛歿wp_type}\n\n鍐欏叆妗佹灦淇℃伅锛歕nW_i_status锛�1" + $"\n" +
- // $"a锛歿(geometry == null ? (float)geometry1.a : (float)geometry.a)}\n" +
- // $"b锛歿(geometry == null ? (float)geometry1.b : (float)geometry.b)}\n" +
- // $"c锛歿(geometry == null ? (float)geometry1.c : (float)geometry.c)}\n" +
- // $"d锛歿(geometry == null ? (float)geometry1.d : (float)geometry.d)}\n" +
- // $"e锛歿(geometry == null ? (float)geometry1.e : (float)geometry.e)}\n" +
- // $"f锛歿(geometry == null ? (float)geometry1.f : (float)geometry.f)}\n" +
- // $"g锛歿(geometry == null ? (float)geometry1.g : (float)geometry.g)}\n" +
- // $"h锛歿(geometry == null ? (float)geometry1.h : (float)geometry.h)}\n" +
- // $"R_oi_on锛�0", "PCS");
- WriteLog.Write_Log(name, wp_id, "鍐欏叆淇℃伅锛�", $"璇诲彇妗佹灦淇℃伅锛歕n杞瀷ID锛歿wp_type}\n\n鍐欏叆妗佹灦淇℃伅锛歕nW_i_status锛�1" + $"\n" +
- $"a锛歿(geometry == null ? (float)geometry1.a : (float)geometry.a)}\n" +
- $"b锛歿(geometry == null ? (float)geometry1.b : (float)geometry.b)}\n" +
- $"c锛歿(geometry == null ? (float)geometry1.c : (float)geometry.c)}\n" +
- $"d锛歿(geometry == null ? (float)geometry1.d : (float)geometry.d)}\n" +
- $"e锛歿(geometry == null ? (float)geometry1.e : (float)geometry.e)}\n" +
- $"f锛歿(geometry == null ? (float)geometry1.f : (float)geometry.f)}\n" +
- $"g锛歿(geometry == null ? (float)geometry1.g : (float)geometry.g)}\n" +
- $"h锛歿(geometry == null ? (float)geometry1.h : (float)geometry.h)}\n" +
- $"R_oi_on锛�0");
- #endregion
- }
+ //1-鎵惧埌鏁版嵁锛�2-鏈壘鍒板伐浠剁被鍨嬫暟鎹�
+ client.WriteByOrder("W_i_status", (byte)2, name);
+ client.WriteByOrder("R_oi_on", (byte)0, name);
+ #region 鏃ュ織璁板綍
+ WriteLog.Write_Log(name, wp_id, "閿欒淇℃伅锛�", $"璇诲彇妗佹灦淇℃伅锛歕n杞瀷ID锛歿wp_type}\n\n鍐欏叆妗佹灦淇℃伅锛歕nW_i_status锛�2\nR_oi_on锛�0\n\n鏈煡璇㈠埌鏈哄姞宸ヨ溅杞俊鎭�");
+ #endregion
}
else
{
- var geometry = detectionlineRepository.Find(x => x.Description == Mes_Work.drawingNo).FirstOrDefault();
- var geometry1 = dataRepository.Find(x => x.Description == Mes_Work.drawingNo).FirstOrDefault();
- if (geometry == null && geometry1 == null)
- {
- client.WriteByOrder("W_i_status", (byte)2, name);
- client.WriteByOrder("R_oi_on", (byte)0, name);
- #region 鏃ュ織璁板綍
- //WriteDBLog.Error(name, $"璇诲彇妗佹灦淇℃伅锛歕n杞瀷ID锛歿wp_type}\n\n鍐欏叆妗佹灦淇℃伅锛歕nW_i_status锛�2\nR_oi_on锛�0\n\n鏈煡璇㈠埌妫�娴嬬嚎杞﹁疆淇℃伅", "PCS");
- WriteLog.Write_Log(name, wp_id, "閿欒淇℃伅锛�", $"璇诲彇妗佹灦淇℃伅锛歕n杞瀷ID锛歿wp_type}\n\n鍐欏叆妗佹灦淇℃伅锛歕nW_i_status锛�2\nR_oi_on锛�0\n\n鏈煡璇㈠埌妫�娴嬬嚎杞﹁疆淇℃伅");
- #endregion
- }
- else
- {
- client.WriteByOrder("W_i_status", (byte)1, name);
- client.WriteByOrder("W_i_parameter_a", geometry == null ? (float)geometry1.a : (float)geometry.a, name);
- client.WriteByOrder("W_i_parameter_b", geometry == null ? (float)geometry1.b : (float)geometry.b, name);
- client.WriteByOrder("W_i_parameter_c", geometry == null ? (float)geometry1.c : (float)geometry.c, name);
- client.WriteByOrder("W_i_parameter_d", geometry == null ? (float)geometry1.d : (float)geometry.d, name);
- client.WriteByOrder("W_i_parameter_e", geometry == null ? (float)geometry1.e : (float)geometry.e, name);
- client.WriteByOrder("W_i_parameter_f", geometry == null ? (float)geometry1.f : (float)geometry.f, name);
- client.WriteByOrder("W_i_parameter_g", geometry == null ? (float)geometry1.g : (float)geometry.g, name);
- client.WriteByOrder("W_i_parameter_h", geometry == null ? (float)geometry1.h : (float)geometry.h, name);
- client.WriteByOrder("R_oi_on", (byte)0, name);
- #region 鏃ュ織璁板綍
- //WriteDBLog.Success(name, $"璇诲彇妗佹灦淇℃伅锛歕n杞瀷ID锛歿wp_type}\n\n鍐欏叆妗佹灦淇℃伅锛歕nW_i_status锛�1" + $"\n" +
- // $"a锛歿(geometry == null ? (float)geometry1.a : (float)geometry.a)}\n" +
- // $"b锛歿(geometry == null ? (float)geometry1.b : (float)geometry.b)}\n" +
- // $"c锛歿(geometry == null ? (float)geometry1.c : (float)geometry.c)}\n" +
- // $"d锛歿(geometry == null ? (float)geometry1.d : (float)geometry.d)}\n" +
- // $"e锛歿(geometry == null ? (float)geometry1.e : (float)geometry.e)}\n" +
- // $"f锛歿(geometry == null ? (float)geometry1.f : (float)geometry.f)}\n" +
- // $"g锛歿(geometry == null ? (float)geometry1.g : (float)geometry.g)}\n" +
- // $"h锛歿(geometry == null ? (float)geometry1.h : (float)geometry.h)}\n" +
- // $"R_oi_on锛�0", "PCS");
- WriteLog.Write_Log(name, wp_id, "鍐欏叆淇℃伅锛�", $"璇诲彇妗佹灦淇℃伅锛歕n杞瀷ID锛歿wp_type}\n\n鍐欏叆妗佹灦淇℃伅锛歕nW_i_status锛�1" + $"\n" +
- $"a锛歿(geometry == null ? (float)geometry1.a : (float)geometry.a)}\n" +
- $"b锛歿(geometry == null ? (float)geometry1.b : (float)geometry.b)}\n" +
- $"c锛歿(geometry == null ? (float)geometry1.c : (float)geometry.c)}\n" +
- $"d锛歿(geometry == null ? (float)geometry1.d : (float)geometry.d)}\n" +
- $"e锛歿(geometry == null ? (float)geometry1.e : (float)geometry.e)}\n" +
- $"f锛歿(geometry == null ? (float)geometry1.f : (float)geometry.f)}\n" +
- $"g锛歿(geometry == null ? (float)geometry1.g : (float)geometry.g)}\n" +
- $"h锛歿(geometry == null ? (float)geometry1.h : (float)geometry.h)}\n" +
- $"R_oi_on锛�0");
- #endregion
- }
+ //1-鎵惧埌鏁版嵁锛�2-鏈壘鍒板伐浠剁被鍨嬫暟鎹�
+ client.WriteByOrder("W_i_status", (byte)1, name);
+ client.WriteByOrder("W_i_parameter_a", (float)geometry.a, name);
+ client.WriteByOrder("W_i_parameter_b", (float)geometry.b, name);
+ client.WriteByOrder("W_i_parameter_c", (float)geometry.c, name);
+ client.WriteByOrder("W_i_parameter_d", (float)geometry.d, name);
+ client.WriteByOrder("W_i_parameter_e", (float)geometry.e, name);
+ client.WriteByOrder("W_i_parameter_f", (float)geometry.f, name);
+ client.WriteByOrder("W_i_parameter_g", (float)geometry.g, name);
+ client.WriteByOrder("W_i_parameter_h", (float)geometry.h, name);
+ client.WriteByOrder("R_oi_on", (byte)0, name);
+ #region 鏃ュ織璁板綍
+ WriteLog.Write_Log(name, wp_id, "鍐欏叆淇℃伅锛�", $"璇诲彇妗佹灦淇℃伅锛歕n杞瀷ID锛歿wp_type}\n\n鍐欏叆妗佹灦淇℃伅锛歕nW_i_status锛�1" + $"\n" +
+ $"a锛歿(float)geometry.a}\n" +
+ $"b锛歿(float)geometry.b}\n" +
+ $"c锛歿(float)geometry.c}\n" +
+ $"d锛歿(float)geometry.d}\n" +
+ $"e锛歿(float)geometry.e}\n" +
+ $"f锛歿(float)geometry.f}\n" +
+ $"g锛歿(float)geometry.g}\n" +
+ $"h锛歿(float)geometry.h}\n" +
+ $"R_oi_on锛�0");
+ #endregion
}
-
}
}
}
catch (Exception ex)
{
- //WriteDBLog.Error("鏌ヨ杞﹁疆鏁版嵁", $"閿欒淇℃伅锛歿ex.Message}", "PCS");
WriteLog.Write_Log("鎶ラ敊鏃ュ織", namea, "閿欒淇℃伅锛�", $"閿欒淇℃伅锛歿ex.Message}");
}
}
@@ -227,7 +145,6 @@
Idt_plcinfoheadRepository repository = new dt_plcinfoheadRepository(Context);
Idt_plcinfodetailRepository plcRepository = new dt_plcinfodetailRepository(Context);
Idt_geometry_dataRepository dataRepository = new dt_geometry_dataRepository(Context);
- Idt_geometry_data_detectionlineRepository detectionlineRepository = new dt_geometry_data_detectionlineRepository(Context);
Idt_mes_detailRepository mes_DetailRepository = new dt_mes_detailRepository(Context);
IVV_Mes_WorkinfoRepository workinfoRepository = new VV_Mes_WorkinfoRepository(Context);
Idt_mes_headRepository mes_HeadRepository = new dt_mes_headRepository(Context);
@@ -256,132 +173,54 @@
}
var wp_type = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_o_wp_type").First(), client);
- var Mes_Work = workinfoRepository.Find(x => x.SN == wp_id && x.processCode == (name != "杈婇亾涓婃枡鏌ヨ璁㈠崟" ? "17" : "28")).FirstOrDefault();
+ var Mes_Work = workinfoRepository.Find(x => x.SN == wp_id && x.processCode == (name != "杈婇亾涓婃枡鏌ヨ璁㈠崟" ? "17" : "28")).OrderByDescending(x => x.CreateTime).FirstOrDefault();
if (Mes_Work == null)
{
client.WriteByOrder("W_i_status", (byte)2, name);
client.WriteByOrder("R_oi_on", (byte)0, name);
#region 鏃ュ織璁板綍
- //WriteDBLog.Error(name, $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN锛歿wp_id}\n\n鍐欏叆妗佹灦淇℃伅锛歕nW_i_status锛�2\nR_oi_on锛�0\n\n鏈煡璇㈠埌宸ュ崟璇︽儏", "PCS");
WriteLog.Write_Log(name, wp_id, "閿欒淇℃伅锛�", $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN锛歿wp_id}\n\n鍐欏叆妗佹灦淇℃伅锛歕nW_i_status锛�2\nR_oi_on锛�0\n\n鏈煡璇㈠埌宸ュ崟璇︽儏");
#endregion
continue;
}
- #region MyRegion
- //var mes_Detail = mes_DetailRepository.FindFirst(x => x.SN == wp_id);
- //if (mes_Detail == null)
- //{
- // client.WriteByOrder("W_i_status", (byte)2, name);
- // client.WriteByOrder("R_oi_on", (byte)0, name);
- // #region 鏃ュ織璁板綍
- // WriteDBLog.Error(name, $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN锛歿wp_id}\n\n鍐欏叆妗佹灦淇℃伅锛歕nW_i_status锛�2\nR_oi_on锛�0\n\n鏈煡璇㈠埌宸ュ崟璇︽儏", "PCS");
- // #endregion
- // continue;
- //}
- //var mes_Head = mes_HeadRepository.FindFirst(x => x.jobID == mes_Detail.jobID);
- //if (mes_Head == null)
- //{
- // client.WriteByOrder("W_i_status", (byte)2, name);
- // client.WriteByOrder("R_oi_on", (byte)0, name);
- // #region 鏃ュ織璁板綍
- // WriteDBLog.Error(name, $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN锛歿wp_id}\n\n鍐欏叆妗佹灦淇℃伅锛歕nW_i_status锛�2\nR_oi_on锛�0\n\n鏈煡璇㈠埌宸ュ崟澶磋〃", "PCS");
- // #endregion
- // continue;
- //}
- #endregion
var mes_Head = mes_HeadRepository.FindFirst(x => x.jobID == Mes_Work.jobID);
- if (name != "杈婇亾涓婃枡鏌ヨ璁㈠崟")
+ var geometry = Pipeline.QueryMateriel(Mes_Work.drawingNo);
+ if (geometry == null)
{
- //闇�娣诲姞鏌ヨ杞﹁疆SN鍙疯鍗曢�昏緫 闇�娣诲姞鍏ュ簱妯″紡鍒ゆ柇锛屾墜鍔ㄥ叆搴撴ā寮忛渶浜哄伐娣诲姞鍏ュ簱搴撳尯锛屽惁鍒欐姤璀�
- var pattern = patternRepository.FindFirst(x => x.pattern_name == "鍏ュ簱妯″紡").pattern_state;
- if (pattern != 1 && string.IsNullOrEmpty(mes_Head.area))
- {
- client.WriteByOrder("W_i_status", (byte)4, name);
- client.WriteByOrder("R_oi_on", (byte)0, name);
- #region 鏃ュ織璁板綍
- //WriteDBLog.Error(name, $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN锛歿wp_id}\n\n鍐欏叆妗佹灦淇℃伅锛歕nW_i_status锛�4\nR_oi_on锛�0\n\n鎵嬪姩鍏ュ簱妯″紡鏈�夋嫨搴撳尯", "PCS");
- WriteLog.Write_Log(name, wp_id, "閿欒淇℃伅锛�", $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN锛歿wp_id}\n\n鍐欏叆妗佹灦淇℃伅锛歕nW_i_status锛�4\nR_oi_on锛�0\n\n鎵嬪姩鍏ュ簱妯″紡鏈�夋嫨搴撳尯");
- #endregion
- continue;
- }
- //var geometry = dataRepository.FindFirst(x => x.TypeId == (Int32)wp_type);
- var geometry = dataRepository.Find(x => x.Description == mes_Head.drawingNo /*&& x.TypeId == (Int32)wp_type*/).FirstOrDefault();
- var geometry1 = detectionlineRepository.Find(x => x.Description == mes_Head.drawingNo).FirstOrDefault();
- if (geometry == null && geometry1 == null)
- {
- //1-濂�,鍏佽鍔犲伐锛�2-涓嶅湪鍒楄〃涓紝3-涓嶅姞宸ヨ溅杞被鍨嬶紝4-鎵嬪姩鍏ュ簱妯″紡浜哄伐鏈�夋嫨搴撳尯
- client.WriteByOrder("W_i_status", (byte)2, name);
- client.WriteByOrder("R_oi_on", (byte)0, name);
- #region 鏃ュ織璁板綍
- //WriteDBLog.Error(name, $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN锛歿wp_id}\n杞瀷ID锛歿wp_type}\n\n鍐欏叆妗佹灦淇℃伅锛歕nW_i_status锛�2\nR_oi_on锛�0\n\n鏈煡璇㈠埌鏈哄姞宸ヨ溅杞俊鎭�", "PCS");
- WriteLog.Write_Log(name, wp_id, "閿欒淇℃伅锛�", $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN锛歿wp_id}\n杞瀷ID锛歿wp_type}\n\n鍐欏叆妗佹灦淇℃伅锛歕nW_i_status锛�2\nR_oi_on锛�0\n\n鏈煡璇㈠埌鏈哄姞宸ヨ溅杞俊鎭�");
- #endregion
- continue;
- }
- else
- {
- //1-濂�,鍏佽鍔犲伐锛�2-涓嶅湪鍒楄〃涓紝3-涓嶅姞宸ヨ溅杞被鍨嬶紝4-鎵嬪姩鍏ュ簱妯″紡浜哄伐鏈�夋嫨搴撳尯
- client.WriteByOrder("W_i_status", (byte)1, name);
- client.WriteByOrder("W_i_job_id", Mes_Work.jobID, name);
- client.WriteByOrder("W_i_drawing_id", Mes_Work.drawingNo, name);
- client.WriteByOrder("W_i_heat_id", Mes_Work.heatID, name);
- //client.WriteByOrder("W_i_sourceheat", "", name);
- client.WriteByOrder("W_i_batch_id", Mes_Work.heatBatchID, name);
-
- //灞忚斀宸ヨ壓(灞忚斀瑙嗚妫�娴�/灞忚斀娑傛补)
- //if (name != "杈婇亾涓婃枡鏌ヨ杞﹁疆")
- //{
- client.WriteByOrder("W_i_skip_op_SJ1", name == "3鍗曞厓杈婇亾涓嬫枡鏌ヨ璁㈠崟" ? true : mes_Head.skip_op_1, name);//灞忚斀瑙嗚妫�娴嬭澶�1
- client.WriteByOrder("W_i_skip_op_SJ2", name == "3鍗曞厓杈婇亾涓嬫枡鏌ヨ璁㈠崟" ? true : mes_Head.skip_op_2, name);//灞忚斀瑙嗚妫�娴嬭澶�2
- client.WriteByOrder("W_i_skip_op_LT", mes_Head.skip_op_3, name);//灞忚斀閾炬潯鏈�
- //}
- client.WriteByOrder("R_oi_on", (byte)0, name);
- #region 鏃ュ織璁板綍
- WriteLog.Write_Log(name, wp_id, "鍐欏叆淇℃伅锛�", $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN锛歿wp_id}\n杞瀷ID锛歿wp_type}\n\n鍐欏叆妗佹灦淇℃伅锛歕nW_i_status锛�1" +
- $"\nW_i_job_id锛歿Mes_Work.jobID}\nW_i_drawing_id锛歿Mes_Work.drawingNo}\nW_i_heat_id锛歿Mes_Work.heatID}\nW_i_batch_id锛歿Mes_Work.heatBatchID}" +
- $"\nW_i_skip_op_SJ1锛歿(name == "3鍗曞厓杈婇亾涓嬫枡鏌ヨ璁㈠崟" ? true : mes_Head.skip_op_1)}\nW_i_skip_op_SJ2锛歿(name == "3鍗曞厓杈婇亾涓嬫枡鏌ヨ璁㈠崟" ? true : mes_Head.skip_op_2)}" +
- $"\nW_i_skip_op_LT锛歿mes_Head.skip_op_3}\nR_oi_on锛�0");
- //WriteDBLog.Success(name, $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN锛歿wp_id}\n杞瀷ID锛歿wp_type}\n\n鍐欏叆妗佹灦淇℃伅锛歕nW_i_status锛�1" +
- // $"\nW_i_job_id锛歿Mes_Work.jobID}\nW_i_drawing_id锛歿Mes_Work.drawingNo}\nW_i_heat_id锛歿Mes_Work.heatID}\nW_i_batch_id锛歿Mes_Work.heatBatchID}" +
- // $"\nW_i_skip_op_SJ1锛歿(name == "3鍗曞厓杈婇亾涓嬫枡鏌ヨ璁㈠崟" ? true : mes_Head.skip_op_1)}\nW_i_skip_op_SJ2锛歿(name == "3鍗曞厓杈婇亾涓嬫枡鏌ヨ璁㈠崟" ? true : mes_Head.skip_op_2)}" +
- // $"\nW_i_skip_op_LT锛歿mes_Head.skip_op_3}\nR_oi_on锛�0", "PCS");
- #endregion
- }
+ //1-濂�,鍏佽鍔犲伐锛�2-涓嶅湪鍒楄〃涓紝3-涓嶅姞宸ヨ溅杞被鍨嬶紝4-鎵嬪姩鍏ュ簱妯″紡浜哄伐鏈�夋嫨搴撳尯
+ client.WriteByOrder("W_i_status", (byte)2, name);
+ client.WriteByOrder("R_oi_on", (byte)0, name);
+ #region 鏃ュ織璁板綍
+ WriteLog.Write_Log(name, wp_id, "閿欒淇℃伅锛�", $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN锛歿wp_id}\n杞瀷ID锛歿wp_type}\n\n鍐欏叆妗佹灦淇℃伅锛歕nW_i_status锛�2\nR_oi_on锛�0\n\n鏈煡璇㈠埌鏈哄姞宸ヨ溅杞俊鎭�");
+ #endregion
+ continue;
}
else
{
- var geometry = detectionlineRepository.Find(x => x.Description == mes_Head.drawingNo /*&& x.TypeId == (Int32)wp_type*/).FirstOrDefault();
- var geometry1 = dataRepository.Find(x => x.Description == mes_Head.drawingNo).FirstOrDefault();
- if (geometry == null && geometry1 == null)
+ //1-濂�,鍏佽鍔犲伐锛�2-涓嶅湪鍒楄〃涓紝3-涓嶅姞宸ヨ溅杞被鍨嬶紝4-鎵嬪姩鍏ュ簱妯″紡浜哄伐鏈�夋嫨搴撳尯
+ client.WriteByOrder("W_i_status", (byte)1, name);
+ client.WriteByOrder("W_i_job_id", Mes_Work.jobID, name);
+ client.WriteByOrder("W_i_drawing_id", Mes_Work.drawingNo, name);
+ client.WriteByOrder("W_i_heat_id", Mes_Work.heatID, name);
+ //client.WriteByOrder("W_i_sourceheat", "", name);
+ client.WriteByOrder("W_i_batch_id", Mes_Work.heatBatchID, name);
+
+ //灞忚斀宸ヨ壓(灞忚斀瑙嗚妫�娴�/灞忚斀娑傛补)
+ if (name != "杈婇亾涓婃枡鏌ヨ璁㈠崟")
{
- //1-濂�,鍏佽鍔犲伐锛�2-涓嶅湪鍒楄〃涓紝3-涓嶅姞宸ヨ溅杞被鍨嬶紝4-鎵嬪姩鍏ュ簱妯″紡浜哄伐鏈�夋嫨搴撳尯
- client.WriteByOrder("W_i_status", (byte)2, name);
- client.WriteByOrder("R_oi_on", (byte)0, name);
- #region 鏃ュ織璁板綍
- //WriteDBLog.Error(name, $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN锛歿wp_id}\n杞瀷ID锛歿wp_type}\n\n鍐欏叆妗佹灦淇℃伅锛歕nW_i_status锛�2\nR_oi_on锛�0\n\n鏈煡璇㈠埌妫�娴嬬嚎杞﹁疆淇℃伅", "PCS");
- WriteLog.Write_Log(name, wp_id, "閿欒淇℃伅锛�", $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN锛歿wp_id}\n杞瀷ID锛歿wp_type}\n\n鍐欏叆妗佹灦淇℃伅锛歕nW_i_status锛�2\nR_oi_on锛�0\n\n鏈煡璇㈠埌妫�娴嬬嚎杞﹁疆淇℃伅");
- #endregion
- continue;
+ client.WriteByOrder("W_i_skip_op_SJ1", name == "3鍗曞厓杈婇亾涓嬫枡鏌ヨ璁㈠崟" ? true : mes_Head.skip_op_1, name);//灞忚斀瑙嗚妫�娴嬭澶�1
+ client.WriteByOrder("W_i_skip_op_SJ2", name == "3鍗曞厓杈婇亾涓嬫枡鏌ヨ璁㈠崟" ? true : mes_Head.skip_op_2, name);//灞忚斀瑙嗚妫�娴嬭澶�2
+ client.WriteByOrder("W_i_skip_op_LT", mes_Head.skip_op_3, name);//灞忚斀閾炬潯鏈�
}
- else
- {
- //1-濂�,鍏佽鍔犲伐锛�2-涓嶅湪鍒楄〃涓紝3-涓嶅姞宸ヨ溅杞被鍨嬶紝4-鎵嬪姩鍏ュ簱妯″紡浜哄伐鏈�夋嫨搴撳尯
- client.WriteByOrder("W_i_status", (byte)1, name);
- client.WriteByOrder("W_i_job_id", Mes_Work.jobID, name);
- client.WriteByOrder("W_i_drawing_id", Mes_Work.drawingNo, name);
- client.WriteByOrder("W_i_heat_id", Mes_Work.heatID, name);
- //client.WriteByOrder("W_i_sourceheat", "", name);
- client.WriteByOrder("W_i_batch_id", Mes_Work.heatBatchID, name);
- client.WriteByOrder("R_oi_on", (byte)0, name);
- #region 鏃ュ織璁板綍
- WriteLog.Write_Log(name, wp_id, "鍐欏叆淇℃伅锛�", $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN锛歿wp_id}\n杞瀷ID锛歿wp_type}\n\n鍐欏叆妗佹灦淇℃伅锛歕nW_i_status锛�1" + $"\nW_i_job_id锛歿Mes_Work.jobID}" +
- $"\nW_i_drawing_id锛歿mes_Head.drawingNo}\nW_i_heat_id锛歿Mes_Work.heatID}\nW_i_batch_id锛歿Mes_Work.heatBatchID}\nR_oi_on锛�0");
- //WriteDBLog.Success(name, $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN锛歿wp_id}\n杞瀷ID锛歿wp_type}\n\n鍐欏叆妗佹灦淇℃伅锛歕nW_i_status锛�1" + $"\nW_i_job_id锛歿Mes_Work.jobID}" +
- // $"\nW_i_drawing_id锛歿mes_Head.drawingNo}\nW_i_heat_id锛歿Mes_Work.heatID}\nW_i_batch_id锛歿Mes_Work.heatBatchID}\nR_oi_on锛�0", "PCS");
- #endregion
- }
+ client.WriteByOrder("R_oi_on", (byte)0, name);
+ #region 鏃ュ織璁板綍
+ WriteLog.Write_Log(name, wp_id, "鍐欏叆淇℃伅锛�", $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN锛歿wp_id}\n杞瀷ID锛歿wp_type}\n\n鍐欏叆妗佹灦淇℃伅锛歕nW_i_status锛�1" +
+ $"\nW_i_job_id锛歿Mes_Work.jobID}\nW_i_drawing_id锛歿Mes_Work.drawingNo}\nW_i_heat_id锛歿Mes_Work.heatID}\nW_i_batch_id锛歿Mes_Work.heatBatchID}" +
+ $"\nW_i_skip_op_SJ1锛歿(name == "3鍗曞厓杈婇亾涓嬫枡鏌ヨ璁㈠崟" ? true : mes_Head.skip_op_1)}\nW_i_skip_op_SJ2锛歿(name == "3鍗曞厓杈婇亾涓嬫枡鏌ヨ璁㈠崟" ? true : mes_Head.skip_op_2)}" +
+ $"\nW_i_skip_op_LT锛歿mes_Head.skip_op_3}\nR_oi_on锛�0");
+ #endregion
}
}
}
@@ -408,7 +247,6 @@
Idt_plcinfodetailRepository plcRepository = new dt_plcinfodetailRepository(Context);
Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context);
Idt_geometry_dataRepository dataRepository = new dt_geometry_dataRepository(Context);
- Idt_geometry_data_detectionlineRepository detectionlineRepository = new dt_geometry_data_detectionlineRepository(Context);
Idt_mes_detailRepository mes_DetailRepository = new dt_mes_detailRepository(Context);
Idt_mes_headRepository mes_HeadRepository = new dt_mes_headRepository(Context);
IVV_Mes_WorkinfoRepository workinfoRepository = new VV_Mes_WorkinfoRepository(Context);
@@ -461,7 +299,7 @@
}
//var Wheel_id = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Wheel_id").First(), client).ToString();
- var Mes_Work = workinfoRepository.Find(x => x.SN == Wheel_SN && x.processCode == "17").FirstOrDefault();
+ var Mes_Work = workinfoRepository.Find(x => x.SN == Wheel_SN && x.processCode == "17").OrderByDescending(x => x.CreateTime).FirstOrDefault();
if (Mes_Work == null)
{
#region 鏃ュ織璁板綍
@@ -470,7 +308,7 @@
#endregion
continue;
}
-
+ var geometry = Pipeline.QueryMateriel(Mes_Work.drawingNo);
#endregion
var AreaNr = (Int16)DBExtension.Read(details.Where(x => x.plcdetail_name == "W_AreaNr").First(), client);
@@ -496,7 +334,8 @@
var station = stationinfoRepository.Find(x => x.area == areaCode && x.stationCode.Substring(x.stationCode.Length - 1, 1) == AreaNr.ToString()).FirstOrDefault();
if (station != null)
{
- if (station.quantity >= 5)
+ if (station.quantity >= geometry.stackNoRange)
+ //if (station.quantity >= 5)
{
Pipeline_client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//鎶ヨ
WriteLog.Write_Log(name + "鏀炬枡瀹屾垚鍑洪敊", Wheel_SN, "杞﹁疆鏁伴噺宸叉弧锛�", $"鍖哄煙鍙凤細{AreaNr}锛沑n杞﹁疆鏁帮細{station.quantity}\n閿欒淇℃伅锛氬尯鍩熷彿杞﹁疆鏁伴噺宸叉弧锛�");
@@ -556,13 +395,13 @@
var Detail = mes_DetailRepository.FindFirst(x => x.jobID == Mes_Work.jobID && x.SN == Mes_Work.SN);
Detail.Status = "涓嬬嚎";
Detail.FinishTime = DateTime.Now;
- count = mes_DetailRepository.Update(Detail, true);
+ count = mes_DetailRepository.Update(Detail, x => new { x.Status, x.FinishTime }, true);
if (count < 1)
throw new Exception($"宸ュ崟瀛愯〃淇℃伅鏇存柊澶辫触锛佽溅杞甋N鍙凤細{Detail.SN}");
var Head = mes_HeadRepository.FindFirst(x => x.jobID == Detail.jobID);
Head.finishNum = Head.finishNum + 1;
if (Head.finishNum == Head.quantity) Head.FinishTime = DateTime.Now;
- count = mes_HeadRepository.Update(Head, true);
+ count = mes_HeadRepository.Update(Head, x => new { x.finishNum, x.FinishTime }, true);
if (count < 1)
throw new Exception($"宸ュ崟澶磋〃淇℃伅鏇存柊澶辫触锛佸伐鍗曞彿锛歿Head.jobID}");
#endregion
@@ -590,7 +429,7 @@
WriteLog.Write_Log(name + "鐢宠鏀炬枡寮傚父", "杞﹁疆SN鍙蜂负绌�", "", $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN鍙凤細{Wheel_id}涓虹┖");
continue;
}
- var Work = workinfoRepository.Find(x => x.SN == Wheel_id && x.processCode == "17").FirstOrDefault();
+ var Work = workinfoRepository.Find(x => x.SN == Wheel_id && x.processCode == "17").OrderByDescending(x => x.CreateTime).FirstOrDefault();
if (Work == null)
{
client.WriteByOrder("W_Enabl_Load", false, name);//淇″彿涓篺alse妗佹灦鍋滄杩涘叆
@@ -601,8 +440,8 @@
#endregion
var wheel = Pipeline.QueryMateriel(Work.drawingNo);
- var wheel1 = Pipeline.QueryMateriel1(Work.drawingNo);
- if (wheel == null && wheel1 == null)
+ //var wheel1 = Pipeline.QueryMateriel1(Work.drawingNo);
+ if (wheel == null /*&& wheel1 == null*/)
{
#region 鏃ュ織璁板綍
client.WriteByOrder("W_Enabl_Load", false, name);//淇″彿涓篺alse妗佹灦鍋滄杩涘叆
@@ -624,9 +463,10 @@
#endregion
#region 鎵樼洏绫诲瀷涓嶄竴鑷撮渶鏇存崲鎵樼洏
- foreach (var Stationinfo in Stations)
+ stations = Stations.Where(x => x.enable).ToList();
+ foreach (var Stationinfo in stations)
{
- if (Stationinfo.tray_type != "LargeTray" && (wheel == null ? wheel1.e : wheel.e) > 1100)
+ if (Stationinfo.tray_type != "LargeTray" && /*(wheel == null ? wheel1.e :)*/ wheel.e > 1100)
{
client.WriteByOrder("W_Enabl_Load", false, name);//淇″彿涓篺alse妗佹灦鍋滄杩涘叆
Stationinfo.location_state = LocationStateEnum.Trayswitching.ToString();
@@ -657,7 +497,8 @@
.Where(x => x.enable
&& x.stationCode != NGStation
&& x.location_state == LocationStateEnum.Stroge.ToString()
- && x.quantity < 5
+ && x.quantity < wheel.stackNoRange
+ //&& x.quantity < 5
&& x.stationType == Work.drawingNo
&& x.Number == Work.workOrder
&& x.heatNumber == Work.heatID)
@@ -670,7 +511,8 @@
.Where(x => x.enable
&& x.stationCode != NGStation
&& x.location_state == LocationStateEnum.Stroge.ToString()
- && x.quantity < 5
+ && x.quantity < wheel.stackNoRange
+ //&& x.quantity < 5
&& x.stationType == Work.drawingNo
&& x.Number == Work.workOrder)
.OrderByDescending(x => x.quantity)
@@ -699,7 +541,8 @@
#endregion
#region 鎵樼洏杞﹁疆鍫嗗灈绗洓涓椂涓嬪彂鍙﹀涓�涓倝鍙风殑鍏ュ簱浠诲姟
- if (Stationinfo.quantity + 1 >= 4)
+ //if (Stationinfo.quantity + 1 >= 4)
+ if (Stationinfo.quantity + 1 >= wheel.stackNoRange - 1)
{
var stationinfo = Stations.Where(x => x.enable && x.stationCode != NGStation && x.stationCode != Stationinfo.stationCode && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).FirstOrDefault();
if (stationinfo != null)
@@ -784,7 +627,8 @@
if (!Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state != LocationStateEnum.Stroge.ToString()).Any())
{
var station = Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString()).OrderBy(x => x.lastUpdateTime).FirstOrDefault();
- agvtask(stationinfoRepository, station, Work, name == "3鍗曞厓涓嬫枡鍖�" ? "TaskType_OutsourceInbound" : "TaskType_Inbound");
+ if (station != null)
+ agvtask(stationinfoRepository, station, Work, name == "3鍗曞厓涓嬫枡鍖�" ? "TaskType_OutsourceInbound" : "TaskType_Inbound");
}
#endregion
}
@@ -798,7 +642,8 @@
dt_stationinfo Stationinfo = Stations.Where(x => x.enable
&& x.stationCode == NGStation
&& x.location_state == LocationStateEnum.Stroge.ToString()
- && x.quantity < 5
+ && x.quantity < wheel.stackNoRange
+ //&& x.quantity < 5
&& x.stationType == Work.drawingNo).FirstOrDefault();
if (Stationinfo == null)
@@ -874,7 +719,7 @@
//WriteDBLog.Success(name + "鍏佽鏀炬枡", $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN锛歿Wheel_id}\n杞瀷ID锛歿Wheel_Type}\n杞﹁疆鐘舵�侊細NG" +$"\n璇诲彇鎵樼洏鍏夌數淇″彿锛歿PalletSignal}" +
// $"\n\n鍐欏叆妗佹灦淇℃伅锛歕n涓嬫枡浣嶅彿锛歿area}\n绗嚑涓溅杞細{(Stationinfo.quantity + 1)}\n鎵樼洏绫诲瀷锛�1\nW_Enabl_Load锛歵rue", "PCS");
WriteLog.Write_Log(name + "鐢宠鏀炬枡", Wheel_id, "鍏佽鏀炬枡",
- $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN锛歿Wheel_id}\n杞瀷ID锛歿Wheel_Type}\n杞﹁疆鐘舵�侊細鍚堟牸" +
+ $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN锛歿Wheel_id}\n杞瀷ID锛歿Wheel_Type}\n杞﹁疆鐘舵�侊細涓嶅悎鏍�" +
$"\n璇诲彇鎵樼洏鍏夌數淇″彿锛歿PalletSignal}" +
$"\n\n鍐欏叆妗佹灦淇℃伅锛歕n涓嬫枡浣嶅彿锛歿area}\n绗嚑涓溅杞細{(Stationinfo.quantity + 1)}\n鎵樼洏绫诲瀷锛�1\n鏄惁鍏佽涓嬫枡锛歵rue");
#endregion
@@ -905,77 +750,13 @@
VOLContext Context = new VOLContext();
Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(Context);
IVV_Mes_WorkinfoRepository workinfoRepository = new VV_Mes_WorkinfoRepository(Context);
- Work = workinfoRepository.Find(x => x.workOrder == stationinfo.Number && x.processCode == "17").FirstOrDefault();
+ Work = workinfoRepository.Find(x => x.workOrder == stationinfo.Number && x.processCode == "17").OrderByDescending(x => x.CreateTime).FirstOrDefault();
var task = agvtaskRepository.Find(x => x.agv_fromaddress == stationinfo.stationCode).FirstOrDefault();
if (task != null) return;
if (!string.IsNullOrEmpty(Work.area))
tasktype = "TaskType_OutsourceInbound";
AGVTask.AddQueueTask(stationinfoRepository, agvtaskRepository, stationinfo, tasktype, Work);
}
-
- #region MyRegion
- /// <summary>
- /// AGV浠诲姟
- /// </summary>
- //public void agvtask(Idt_stationinfoRepository stationinfoRepository, dt_stationinfo stationinfo, VV_Mes_Workinfo Work, string tasktype)
- //{
- // VOLContext Context = new VOLContext();
- // Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(Context);
- // Idt_mes_headRepository mes_HeadRepository = new dt_mes_headRepository(Context);
-
- // var task = agvtaskRepository.Find(x => x.agv_fromaddress == stationinfo.stationCode).FirstOrDefault();
- // if (task != null) return;
- // //var mes_Head = mes_HeadRepository.Find(x => x.jobID == Work.jobID).FirstOrDefault();
- // //if (mes_Head == null)
- // //{
- // // stationinfo.remark = "瑙﹀彂鍏ュ簱浠诲姟,浣嗘湭鎵惧埌宸ュ崟澶磋〃锛�";
- // // stationinfo.location_state = LocationStateEnum.Abnormal.ToString();
- // // stationinfoRepository.Update(stationinfo, true);
- // // return;
- // //}
-
- // dt_stationinfo TargetLocation = null;
- // //int CompeletedNum = Convert.ToInt32(mes_Head.quantity) - Convert.ToInt32(mes_Head.finishNum);
- // //if (mes_Head.quantity <= 50) tasktype = "TaskType_OutsourceInbound";
-
- // if (tasktype == "TaskType_OutsourceInbound" || !string.IsNullOrEmpty(Work.area))
- // TargetLocation = StationTask.GetEmptyLocation(stationinfoRepository);
- // else if (tasktype == "TaskType_Inbound")
- // TargetLocation = GetLocation.GetEmptyLocation(stationinfoRepository, Work, stationinfo);
- // //TargetLocation = GetLocation.GetEmptyLocation(stationinfoRepository, mes_Head, stationinfo);
- // if (TargetLocation != null)
- // {
- // dt_agvtask agvtask = new dt_agvtask()
- // {
- // agv_fromaddress = stationinfo.stationCode,
- // agv_id = Guid.NewGuid(),
- // agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
- // agv_grade = 1,
- // agv_createtime = DateTime.Now,
- // agv_taskstate = "Create",
- // agv_materielid = stationinfo.stationType,
- // agv_qty = stationinfo.quantity,
- // agv_tasktype = tasktype,
- // agv_toaddress = TargetLocation.stationCode,
- // agv_userid = "绯荤粺",
- // bindSN = stationinfo.bindSN,
- // agv_worktype = Convert.ToInt32(Work.processCode),
- // agv_materbarcode = Work.materialCode,
- // agv_Traytype = stationinfo.tray_type,
- // jobID = stationinfo.Number,
- // agv_TrayStatus = stationinfo.tray_status
- // };
- // agvtaskRepository.Add(agvtask, true);
- // stationinfo.location_state = LocationStateEnum.InBusy.ToString();
- // stationinfoRepository.Update(stationinfo, true);
- // TargetLocation.location_state = LocationStateEnum.InBusy.ToString();
- // TargetLocation.stationType = agvtask.agv_materielid;
- // TargetLocation.heatNumber = stationinfo.heatNumber;
- // TargetLocation.Number = agvtask.jobID;
- // stationinfoRepository.Update(TargetLocation, true);
- // }
- //}
- #endregion
}
}
--
Gitblit v1.9.3