From 53d6a24cb335b0c9b4449e1211ce8ea644d68d67 Mon Sep 17 00:00:00 2001 From: dengjunjie <dengjunjie@hnkhzn.com> Date: 星期五, 31 五月 2024 20:48:53 +0800 Subject: [PATCH] 可根据图号更改下料口车轮数量入库条件 --- 代码管理/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs | 330 +++++++++++++----------------------------------------- 1 files changed, 83 insertions(+), 247 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 714b1d9..04117b6 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" @@ -45,7 +45,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) @@ -69,145 +68,51 @@ 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 +132,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); @@ -262,126 +166,59 @@ 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 != "杈婇亾涓婃枡鏌ヨ璁㈠崟") + //闇�娣诲姞鏌ヨ杞﹁疆SN鍙疯鍗曢�昏緫 闇�娣诲姞鍏ュ簱妯″紡鍒ゆ柇锛屾墜鍔ㄥ叆搴撴ā寮忛渶浜哄伐娣诲姞鍏ュ簱搴撳尯锛屽惁鍒欐姤璀� + var pattern = patternRepository.FindFirst(x => x.pattern_name == "鍏ュ簱妯″紡").pattern_state; + if (pattern != 1 && string.IsNullOrEmpty(mes_Head.area)) { - //闇�娣诲姞鏌ヨ杞﹁疆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 - } + client.WriteByOrder("W_i_status", (byte)4, name); + client.WriteByOrder("R_oi_on", (byte)0, name); + #region 鏃ュ織璁板綍 + 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 = Pipeline.QueryMateriel(Mes_Work.drawingNo); + if (geometry == null) + { + //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)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); - 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 - } + //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"); + #endregion } } } @@ -408,7 +245,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); @@ -470,7 +306,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,8 +332,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 >= Mes_Work.stackNoRange) - //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閿欒淇℃伅锛氬尯鍩熷彿杞﹁疆鏁伴噺宸叉弧锛�"); @@ -602,8 +438,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妗佹灦鍋滄杩涘叆 @@ -627,7 +463,7 @@ #region 鎵樼洏绫诲瀷涓嶄竴鑷撮渶鏇存崲鎵樼洏 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(); @@ -658,7 +494,7 @@ .Where(x => x.enable && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString() - && x.quantity < Work.stackNoRange + && x.quantity < wheel.stackNoRange //&& x.quantity < 5 && x.stationType == Work.drawingNo && x.Number == Work.workOrder @@ -672,7 +508,7 @@ .Where(x => x.enable && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString() - && x.quantity < Work.stackNoRange + && x.quantity < wheel.stackNoRange //&& x.quantity < 5 && x.stationType == Work.drawingNo && x.Number == Work.workOrder) @@ -703,7 +539,7 @@ #region 鎵樼洏杞﹁疆鍫嗗灈绗洓涓椂涓嬪彂鍙﹀涓�涓倝鍙风殑鍏ュ簱浠诲姟 //if (Stationinfo.quantity + 1 >= 4) - if (Stationinfo.quantity + 1 >= Work.stackNoRange - 1) + 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) @@ -802,7 +638,7 @@ dt_stationinfo Stationinfo = Stations.Where(x => x.enable && x.stationCode == NGStation && x.location_state == LocationStateEnum.Stroge.ToString() - && x.quantity < Work.stackNoRange + && x.quantity < wheel.stackNoRange //&& x.quantity < 5 && x.stationType == Work.drawingNo).FirstOrDefault(); -- Gitblit v1.9.3