| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Net; |
| | | using System.Security.Cryptography.Xml; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | |
| | | 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) |
| | |
| | | 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}"); |
| | | } |
| | | } |
| | |
| | | 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); |
| | |
| | | } |
| | | 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 |
| | | } |
| | | } |
| | | } |
| | |
| | | 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); |
| | |
| | | } |
| | | |
| | | //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 æ¥å¿è®°å½ |
| | |
| | | #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); |
| | |
| | | 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é误信æ¯ï¼åºåå·è½¦è½®æ°é已满ï¼"); |
| | |
| | | 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($"å·¥ååè¡¨ä¿¡æ¯æ´æ°å¤±è´¥ï¼è½¦è½®SNå·ï¼{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 |
| | |
| | | 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);//ä¿¡å·ä¸ºfalseæ¡æ¶åæ¢è¿å
¥ |
| | |
| | | WriteLog.Write_Log(name + "ç³è¯·æ¾æå¼å¸¸", Wheel_id, "æ¥è¯¢æºå 工工å", $"è¯»åæ¡æ¶ä¿¡æ¯ï¼\n车轮SNå·ï¼{Wheel_id}æªæ¥è¯¢å°å·¥åä¿¡æ¯\nåå
¥æ¡æ¶ä¿¡æ¯ï¼\næ¯å¦å
è®¸ä¸æï¼{false}"); |
| | | continue; |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | #region MyRegion |
| | | //var currentAreaNr = (Int16)DBExtension.Read(details.Where(x => x.plcdetail_name == "W_Are00aNr").First(), client); |
| | | //var currentAreaCode = PipelineJob.area_code(name); //æ ¹æ®ä¸æå£åå
åè·ååºå代ç |
| | | //var currentStation = stationinfoRepository.FindFirst(x => x.area == currentAreaCode && x.stationCode.Substring(x.stationCode.Length - 1, 1) == currentAreaNr.ToString()); |
| | | //if (!currentStation.enable || currentStation.location_state == LocationStateEnum.Empty.ToString()) |
| | | // client.WriteByOrder("W_Enabl_Load", false, name);//ä¿¡å·ä¸ºfalseæ¡æ¶åæ¢è¿å
¥ |
| | | #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);//ä¿¡å·ä¸ºfalseæ¡æ¶åæ¢è¿å
¥ |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region æçç±»åä¸ä¸è´éæ´æ¢æç |
| | | stations = Stations.Where(x => x.enable).ToList(); |
| | | foreach (var Stationinfo in stations) |
| | | { |
| | | if (Stationinfo.tray_type != "LargeTray" && /*(wheel == null ? wheel1.e :)*/ wheel.e > 1100) |
| | | { |
| | | client.WriteByOrder("W_Enabl_Load", false, name);//ä¿¡å·ä¸ºfalseæ¡æ¶åæ¢è¿å
¥ |
| | | Stationinfo.location_state = LocationStateEnum.Trayswitching.ToString(); |
| | | Stationinfo.remark = "æçç±»åä¸ä¸è´éæ´æ¢æç"; |
| | | stationinfoRepository.Update(Stationinfo, x => new { x.location_state }, true); |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | Stations = stationinfoRepository.Find(x => x.area == Pipeline.area_code(name)).OrderBy(x => x.lastUpdateTime).ToList(); |
| | | |
| | | var PartStatus = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_PartStatus").First(), client);//1:ok;2:nok |
| | | |
| | | var load_zone = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_load_zone").First(), client); |
| | |
| | | .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) |
| | |
| | | .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) |
| | |
| | | #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) |
| | | agvtask(stationinfoRepository, stationinfo, Work, name == "3åå
䏿åº" ? "TaskType_OutsourceInbound" : "TaskType_Inbound"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region æçç±»åä¸ä¸è´éæ´æ¢æç |
| | | if (Stationinfo.tray_type != "LargeTray" && (wheel == null ? wheel1.e : wheel.e) > 1100) |
| | | { |
| | | client.WriteByOrder("W_Enabl_Load", false, name);//ä¿¡å·ä¸ºfalseæ¡æ¶åæ¢è¿å
¥ |
| | | Stationinfo.location_state = LocationStateEnum.Abnormal.ToString(); |
| | | Stationinfo.tray_type = Stationinfo.tray_type == "SmallTray" ? "SmallTray/LargeTray" : "LargeTray/SmallTray"; |
| | | Stationinfo.remark = "æçç±»åä¸ä¸è´éæ´æ¢æç"; |
| | | stationinfoRepository.Update(Stationinfo, true); |
| | | continue; |
| | | } |
| | | #endregion |
| | | |
| | | var Pipelinedetails = plcRepository.Find(x => x.plcdetail_iotype == Pipelineplc.plcinfo_iotyep && x.plcdetail_number == Stationinfo.stationCode).ToList(); |
| | |
| | | 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) |
| | |
| | | } |
| | | if (Stationinfo != null) |
| | | { |
| | | #region æçç±»åä¸ä¸è´éæ´æ¢æç |
| | | //if (Stationinfo.tray_type != ((wheel == null ? wheel1.e : wheel.e) < 1100 ? "SmallTray" : "LargeTray")) |
| | | if (Stationinfo.tray_type != "LargeTray" && (wheel == null ? wheel1.e : wheel.e) > 1100) |
| | | { |
| | | Stationinfo.location_state = LocationStateEnum.Abnormal.ToString(); |
| | | Stationinfo.tray_type = Stationinfo.tray_type == "SmallTray" ? "SmallTray/LargeTray" : "LargeTray/SmallTray"; |
| | | Stationinfo.remark = "æçç±»åä¸ä¸è´éæ´æ¢æç"; |
| | | stationinfoRepository.Update(Stationinfo, true); |
| | | continue; |
| | | } |
| | | #endregion |
| | | var Pipelinedetails = plcRepository.Find(x => x.plcdetail_iotype == Pipelineplc.plcinfo_iotyep && x.plcdetail_number == Stationinfo.stationCode).ToList(); |
| | | var PalletSignal = (Int16)DBExtension.Read(Pipelinedetails.Where(x => x.plcdetail_name == "R_PalletSignal").First(), Pipeline_client);//读åæçä¿¡å·:1:æ,2æ |
| | | var MaterialSignal = (Int16)DBExtension.Read(Pipelinedetails.Where(x => x.plcdetail_name == "R_MaterialSignal").First(), Pipeline_client);//读åè´§ç©ä¿¡å·:1:æ,2æ |
| | |
| | | //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ï¼true", "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æ¯å¦å
è®¸ä¸æï¼true"); |
| | | #endregion |
| | |
| | | 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 |
| | | |
| | | } |
| | | } |