| | |
| | | using StackExchange.Redis; |
| | | using FreeSql.Internal.Model; |
| | | using StackExchange.Redis; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Security.Cryptography.Xml; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using System.Xml.Linq; |
| | | using WIDESEA_Comm; |
| | | using WIDESEA_Comm.LogInfo; |
| | | using WIDESEA_Comm.TaskNo; |
| | | using WIDESEA_Core.EFDbContext; |
| | | using WIDESEA_Core.FreeDB; |
| | | using WIDESEA_Entity.DomainModels; |
| | | using WIDESEA_WCS.IRepositories; |
| | | using WIDESEA_WCS.JobsPart.Common; |
| | | using WIDESEA_WCS.Repositories; |
| | | using WIDESEA_WCS.WCSClient; |
| | | using WIDESEA_WMS.IRepositories; |
| | | using WIDESEA_WMS.Repositories; |
| | | using static FreeSql.Internal.GlobalFilter; |
| | | using static System.Collections.Specialized.BitVector32; |
| | | |
| | | namespace WIDESEA_WCS |
| | | { |
| | | public class Gantry |
| | | { |
| | | static VOLContext Context = new VOLContext(); |
| | | Idt_plcinfoheadRepository repository = new dt_plcinfoheadRepository(Context); |
| | | Idt_plcinfodetailRepository plcRepository = new dt_plcinfodetailRepository(Context); |
| | | Idt_geometry_dataRepository dataRepository = new dt_geometry_dataRepository(Context); |
| | | #region æ¥è¯¢è½¦è½®æ°æ® |
| | | /// <summary> |
| | | /// æ¥è¯¢è½¦è½®æ°æ® |
| | | /// </summary> |
| | | /// <param name="client"></param> |
| | | public void QueryWheeldata(PLCClient client) |
| | | { |
| | | try |
| | | { |
| | | VOLContext Context = new VOLContext(); |
| | | Idt_plcinfoheadRepository repository = new dt_plcinfoheadRepository(Context); |
| | | Idt_plcinfodetailRepository plcRepository = new dt_plcinfodetailRepository(Context); |
| | | IVV_Mes_WorkinfoRepository workinfoRepository = new VV_Mes_WorkinfoRepository(Context); |
| | | 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) |
| | | { |
| | | var details = plcRepository.Find(x => x.plcdetail_iotype == plc.plcinfo_iotyep && x.plcdetail_number == name).ToList(); |
| | | var on = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_oi_on").First(), client); |
| | | if ((Int16)on == 1) |
| | | if ((byte)on == 1) |
| | | { |
| | | var wp_type = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_o_wp_type").First(), client); |
| | | var geometry = dataRepository.FindFirst(x => x.TypeId == (Int32)wp_type); |
| | | if (geometry == null) |
| | | |
| | | var number = "1åå
è¾é䏿æ¥è¯¢è®¢å"; |
| | | if (name == "2åå
è¾é䏿æ¥è¯¢è½¦è½®") number = "2åå
è¾é䏿æ¥è¯¢è®¢å"; |
| | | if (name == "3åå
è¾é䏿æ¥è¯¢è½¦è½®") number = "3åå
è¾é䏿æ¥è¯¢è®¢å"; |
| | | 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 (Mes_Work == null) |
| | | { |
| | | //DBExtension.Write(details.Where(x => x.plcdetail_name == "W_i_status").First(), client, (Int16)2); |
| | | client.WriteByOrder("W_i_status", (Int16)2, name);//1-æ¾å°æ°æ®ï¼2-æªæ¾å°å·¥ä»¶ç±»åæ°æ® |
| | | client.WriteByOrder("W_i_skip_op", "1", name);//å±è½å·¥èº(å±è½è§è§æ£æµ/å±è½æ¶æ²¹); |
| | | //0-使ç¨ï¼1-è·³è¿ |
| | | client.WriteByOrder("R_oi_on", (Int16)0, name); |
| | | 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; |
| | | } |
| | | |
| | | #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 = 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"); |
| | | #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"); |
| | | #endregion |
| | | } |
| | | } |
| | | else |
| | | { |
| | | client.WriteByOrder("W_i_status", (Int16)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("W_i_skip_op", "0", name);//å符串åå
¥-2 |
| | | client.WriteByOrder("R_oi_on", (Int16)0, name); |
| | | 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"); |
| | | #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"); |
| | | #endregion |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw; |
| | | WriteDBLog.Error("æ¥è¯¢è½¦è½®æ°æ®", $"é误信æ¯ï¼{ex.Message}", "PCS"); |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region æ¥è¯¢è®¢å,æ¯å¦éè¦å å·¥ |
| | | /// <summary> |
| | | /// æ¥è¯¢è®¢å,æ¯å¦éè¦å å·¥ |
| | | /// æ¥è¯¢è®¢å |
| | | /// </summary> |
| | | /// <param name="client"></param> |
| | | public void QueryOrder(PLCClient client) |
| | | { |
| | | try |
| | | { |
| | | VOLContext Context = new VOLContext(); |
| | | 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); |
| | | Idt_patternRepository patternRepository = new dt_patternRepository(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) |
| | | { |
| | | var details = plcRepository.Find(x => x.plcdetail_iotype == plc.plcinfo_iotyep && x.plcdetail_number == name).ToList(); |
| | | var on = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_oi_on").First(), client); |
| | | if ((Int16)on == 1) |
| | | //var on = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_oi_on" && x.plcdetail_number == name).First(), client); |
| | | if ((byte)on == 1) |
| | | { |
| | | var wp_id = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_o_wp_id").First(), client); |
| | | //éæ·»å æ¥è¯¢è½¦è½®SNå·è®¢åé»è¾ |
| | | |
| | | var wp_type = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_o_wp_type").First(), client); |
| | | var geometry = dataRepository.FindFirst(x => x.TypeId == (Int32)wp_type); |
| | | if (geometry == null) |
| | | //var wp_id = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_o_wp_id").First(), client).ToString(); |
| | | var wp_id = client.ReadByOrder<string>("R_o_wp_id", name); |
| | | if (string.IsNullOrEmpty(wp_id)) |
| | | { |
| | | client.WriteByOrder("W_i_status", (Int16)2, name);//1-好,å
许å å·¥ï¼2-ä¸å¨å表ä¸ï¼3-ä¸å 工车轮类å |
| | | client.WriteByOrder("R_oi_on", (Int16)0, name); |
| | | #region æ¥å¿è®°å½ |
| | | client.WriteByOrder("W_i_status", (byte)2, name); |
| | | client.WriteByOrder("R_oi_on", (byte)0, name); |
| | | WriteDBLog.Error(name, $"è¯»åæ¡æ¶ä¿¡æ¯ï¼\n车轮SNï¼{wp_id}\n\nåå
¥æ¡æ¶ä¿¡æ¯ï¼\nW_i_statusï¼2\nR_oi_onï¼0\n\n车轮SNå·ä¸ºç©º", "PCS"); |
| | | #endregion |
| | | continue; |
| | | } |
| | | 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(); |
| | | 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"); |
| | | #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)) |
| | | { |
| | | 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"); |
| | | #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"); |
| | | #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 æ¥å¿è®°å½ |
| | | 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 |
| | | } |
| | | } |
| | | else |
| | | { |
| | | client.WriteByOrder("W_i_status", (Int16)1, name); |
| | | //client.WriteByOrder("W_i_job_id", "", name); |
| | | //client.WriteByOrder("W_i_drawing_id", "", name); |
| | | //client.WriteByOrder("W_i_heat_id", "", name); |
| | | //client.WriteByOrder("W_i_sourceheat", "", name); |
| | | //client.WriteByOrder("W_i_batch_id", "", name); |
| | | client.WriteByOrder("R_oi_on", (Int16)0, name); |
| | | 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"); |
| | | #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 æ¥å¿è®°å½ |
| | | 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 |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw; |
| | | WriteDBLog.Error("æ¥è¯¢è½¦è½®è®¢å", $"é误信æ¯ï¼{ex.Message}", "PCS"); |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 䏿ä½äº¤äº |
| | | /// <summary> |
| | | /// 䏿ä½äº¤äº |
| | | /// 䏿 |
| | | /// </summary> |
| | | /// <param name="client"></param> |
| | | public void Layofflevel(PLCClient client) |
| | | { |
| | | try |
| | | { |
| | | VOLContext Context = new VOLContext(); |
| | | Idt_plcinfoheadRepository repository = new dt_plcinfoheadRepository(Context); |
| | | 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); |
| | | Idt_patternRepository patternRepository = new dt_patternRepository(Context); |
| | | var plc = repository.FindFirst(x => x.plcinfo_name == client.PLCName); |
| | | List<string> names = new List<string>() { "1åå
䏿åº", "2åå
䏿åº", "3åå
䏿åº", "䏿åº" }; |
| | | var Pipeline_client = PLCClient.Clients.FirstOrDefault(t => t.PLCName == "龿¡æº"); |
| | | if (Pipeline_client == null) throw new Exception("龿¡æºè°åº¦æå¡æªå¼å¯ï¼"); |
| | | if (!Pipeline_client.IsConnected) throw new Exception("ä¸é¾æ¡æºè¿æ¥è¶
æ¶ï¼"); |
| | | var Pipelineplc = repository.FindFirst(x => x.plcinfo_name == Pipeline_client.PLCName); |
| | | List<string> names = new List<string>() { "1åå
䏿åº", "2åå
䏿åº", "3åå
䏿åº" }; |
| | | |
| | | foreach (string name in names) |
| | | { |
| | | var details = plcRepository.Find(x => x.plcdetail_iotype == plc.plcinfo_iotyep && x.plcdetail_number == name).ToList(); |
| | | |
| | | var Request = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Request_Load").First(), client); |
| | | if (!Request) continue; |
| | | var PartStatus = (Int32)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_PartStatus").First(), client);//1:ok;2:nok |
| | | var Wheel_Type = (Int32)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Wheel_Type").First(), client);//车轮类å |
| | | var Wheel_id = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Wheel_id").First(), client).ToString();//车轮SNå· |
| | | |
| | | |
| | | client.WriteByOrder("W_AreaNr", (Int16)1, name);//åºåè´§ä½å· |
| | | client.WriteByOrder("W_IndexNr", (Int16)1, name);//æçä¸ç第å 个车轮 |
| | | client.WriteByOrder("W_Storage_Type", true, name);//æçç±»å1-横æ¾;2-ç«æ¾ |
| | | client.WriteByOrder("W_Enabl_Load", true, name);//æ¯å¦å
许 |
| | | |
| | | var finished = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_load_finished").First(), client);//æ¾æå®æ |
| | | if (finished) |
| | | try |
| | | { |
| | | var details = plcRepository.Find(x => x.plcdetail_iotype == plc.plcinfo_iotyep && x.plcdetail_number == name).ToList(); |
| | | |
| | | client.WriteByOrder("W_Storage_update", true, name);//è´§ä½ç¶ææ´æ° |
| | | #region MyRegion |
| | | //var Wheel_Type = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Wheel_Type").First(), client);//车轮类å |
| | | //var Wheel_id = client.ReadByOrder<string>("R_Wheel_id", name);//车轮SNå· |
| | | //if (string.IsNullOrEmpty(Wheel_id)) continue; |
| | | ////var Wheel_id = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Wheel_id").First(), client).ToString(); |
| | | |
| | | //var mes_Detail = mes_DetailRepository.FindFirst(x => x.SN == Wheel_id); |
| | | //if (mes_Detail == null) |
| | | //{ |
| | | // #region æ¥å¿è®°å½ |
| | | // WriteDBLog.Error(name, $"è¯»åæ¡æ¶ä¿¡æ¯ï¼\n车轮SNï¼{Wheel_id}\n\næªæ¥è¯¢å°å·¥å详æ
", "PCS"); |
| | | // #endregion |
| | | // continue; |
| | | //} |
| | | //var mes_Head = mes_HeadRepository.FindFirst(x => x.jobID == mes_Detail.jobID); |
| | | //if (mes_Head == null) |
| | | //{ |
| | | // #region æ¥å¿è®°å½ |
| | | // WriteDBLog.Error(name, $"è¯»åæ¡æ¶ä¿¡æ¯ï¼\n车轮SNï¼{Wheel_id}\n\næªæ¥è¯¢å°å·¥å头表", "PCS"); |
| | | // #endregion |
| | | // continue; |
| | | //} |
| | | #endregion |
| | | |
| | | var finished = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_load_finished").First(), client);//æ¾æå®æ |
| | | var updatefinished = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "W_Storage_update").First(), client);//è´§ä½ç¶ææ´æ° |
| | | |
| | | #region è´§ä½ç¶ææ´æ°å¤ä½ |
| | | //if (!finished && updatefinished) |
| | | //{ |
| | | // client.WriteByOrder("W_Storage_update", false, name);//è´§ä½ç¶ææ´æ° |
| | | // #region æ¥å¿è®°å½ |
| | | // WriteDBLog.Success(name + "è´§ä½ç¶ææ´æ°å¤ä½", $"è¯»åæ¡æ¶ä¿¡æ¯ï¼\nR_load_finishedï¼{finished}\n\nåå
¥æ¡æ¶ä¿¡æ¯ï¼\nW_Storage_updateï¼false", "PCS"); |
| | | // #endregion |
| | | //} |
| | | #endregion |
| | | |
| | | |
| | | if (finished && !updatefinished) |
| | | { |
| | | client.WriteByOrder("W_Enabl_Load", false, name);//æ¯å¦å
许 |
| | | |
| | | #region è¯»åæ¡æ¶ä¿¡æ¯ |
| | | var WheelType = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Wheel_Type").First(), client);//车轮类å |
| | | var Wheel_SN = client.ReadByOrder<string>("R_Wheel_id", name);//车轮SNå· |
| | | if (string.IsNullOrEmpty(Wheel_SN)) |
| | | { |
| | | WriteDBLog.Error(name + "æ¾æå®æ", $"è¯»åæ¡æ¶ä¿¡æ¯ï¼\n车轮SNå·ä¸ºç©º", "PCS"); |
| | | continue; |
| | | } |
| | | |
| | | //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(); |
| | | if (Mes_Work == null) |
| | | { |
| | | #region æ¥å¿è®°å½ |
| | | WriteDBLog.Error(name, $"è¯»åæ¡æ¶ä¿¡æ¯ï¼\n车轮SNå·ï¼{Wheel_SN}\n\næªæ¥è¯¢å°å·¥å详æ
", "PCS"); |
| | | #endregion |
| | | continue; |
| | | } |
| | | #region MyRegion |
| | | //var Detail = mes_DetailRepository.FindFirst(x => x.SN == Wheel_SN); |
| | | //if (Detail == null) |
| | | //{ |
| | | // #region æ¥å¿è®°å½ |
| | | // WriteDBLog.Error(name, $"è¯»åæ¡æ¶ä¿¡æ¯ï¼\n车轮SNå·ï¼{Wheel_SN}\n\næªæ¥è¯¢å°å·¥å详æ
", "PCS"); |
| | | // #endregion |
| | | // continue; |
| | | //} |
| | | //var Head = mes_HeadRepository.FindFirst(x => x.jobID == Detail.jobID && x.processCode == "17"); |
| | | //if (Head == null) |
| | | //{ |
| | | // #region æ¥å¿è®°å½ |
| | | // WriteDBLog.Error(name, $"è¯»åæ¡æ¶ä¿¡æ¯ï¼\n车轮SNå·ï¼{Wheel_SN}\n\næªæ¥è¯¢å°å·¥å头表{Detail.jobID}", "PCS"); |
| | | // #endregion |
| | | // continue; |
| | | //} |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | var AreaNr = (Int16)DBExtension.Read(details.Where(x => x.plcdetail_name == "W_AreaNr").First(), client); |
| | | if (AreaNr == 0) |
| | | { |
| | | client.WriteByOrder("W_Storage_update", true, name);//è´§ä½ç¶ææ´æ° |
| | | continue; |
| | | } |
| | | |
| | | |
| | | var areaCode = PipelineJob.area_code(name); //æ ¹æ®ä¸æå£åå
åè·ååºå代ç |
| | | var station = stationinfoRepository.FindFirst(x => x.area == areaCode && x.stationCode.Substring(x.stationCode.Length - 1, 1) == AreaNr.ToString()); |
| | | if (station.quantity >= 5) |
| | | throw new Exception($"䏿ä½ä¿¡æ¯æ´æ°å¤±è´¥ï¼ä¸æä½è½¦è½®æ°é大äº5ï¼{station.stationCode}"); |
| | | //station.bindSN = station.bindSN == string.Empty ? Wheel_id : station.bindSN + "," + Wheel_id; |
| | | if (!string.IsNullOrEmpty(station.bindSN)) |
| | | { |
| | | if (station.bindSN.Contains(Wheel_SN)) |
| | | throw new Exception($"{station.stationCode}å·²åå¨è½¦è½®SNå·ï¼{Wheel_SN}"); |
| | | } |
| | | |
| | | station.bindSN = string.IsNullOrEmpty(station.bindSN) ? Wheel_SN : station.bindSN + "," + Wheel_SN; |
| | | station.quantity++; |
| | | if (station.quantity == 1) |
| | | { |
| | | station.stationType = Mes_Work.drawingNo; |
| | | station.Number = Mes_Work.workOrder; |
| | | station.heatNumber = Mes_Work.heatID; |
| | | station.tray_status = "StrogeTray"; |
| | | } |
| | | |
| | | var count = stationinfoRepository.Update(station, true); |
| | | if (count < 1) |
| | | throw new Exception($"䏿ä½ä¿¡æ¯æ´æ°å¤±è´¥ï¼ä¸æä½ç¼å·ï¼{station.stationCode}"); |
| | | |
| | | #region æ¸
ç©ºç»æ¡æ¶çä¸æä¿¡æ¯ |
| | | client.WriteByOrder("W_AreaNr", (Int16)0, name);//åºåè´§ä½å· |
| | | client.WriteByOrder("W_IndexNr", (Int16)0, name);//æçä¸ç第å 个车轮 |
| | | client.WriteByOrder("W_Storage_Type", (Int16)0, name);//æçç±»å1-横æ¾;2-ç«æ¾(ææ¶åªææ¨ªæ¾æç) |
| | | client.WriteByOrder("W_Storage_update", true, name);//è´§ä½ç¶ææ´æ° |
| | | WriteDBLog.Success(name + "æ¡æ¶ä¸æå®æ", |
| | | $"è¯»åæ¡æ¶ä¿¡æ¯ï¼\nR_load_finishedï¼{finished}\n车轮SNï¼{Wheel_SN}\nè½®åIDï¼{WheelType}\n䏿ä½å·ï¼{AreaNr}\n\n" + |
| | | $"å¤çåå
¥æ¡æ¶ä¿¡æ¯ï¼\nW_AreaNrï¼{0}\nW_IndexNrï¼{0}\nW_Storage_Typeï¼{0}\n\n" + |
| | | $"åå
¥æ¡æ¶ä¿¡æ¯ï¼\nW_Storage_updateï¼{true}\nW_Enabl_Loadï¼{false}", "PCS"); |
| | | #endregion |
| | | |
| | | |
| | | //client.WriteByOrder("W_Enabl_Load", false, name);//æ¯å¦å
许 |
| | | |
| | | #region ä¿®æ¹å·¥åç¶æ |
| | | 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); |
| | | if (count < 1) |
| | | throw new Exception($"å·¥ååè¡¨ä¿¡æ¯æ´æ°å¤±è´¥ï¼è½¦è½®SNå·ï¼{Detail.SN}"); |
| | | var Head = mes_HeadRepository.FindFirst(x => x.jobID == Detail.jobID); |
| | | Head.finishNum = Head.finishNum + 1; |
| | | count = mes_HeadRepository.Update(Head, true); |
| | | if (count < 1) |
| | | throw new Exception($"å·¥åå¤´è¡¨ä¿¡æ¯æ´æ°å¤±è´¥ï¼å·¥åå·ï¼{Head.jobID}"); |
| | | #endregion |
| | | |
| | | #region æ¥å¿è®°å½ |
| | | //WriteDBLog.Success(name + "æ¾æå®æ", $"è¯»åæ¡æ¶ä¿¡æ¯ï¼\n车轮SNï¼{Wheel_id}\nè½®åIDï¼{Wheel_Type}\n䏿ä½å·ï¼{AreaNr}" + |
| | | // $"\n\nåå
¥æ¡æ¶ä¿¡æ¯ï¼\nW_Storage_updateï¼true" + $"\nW_Enabl_Loadï¼false", "PCS"); |
| | | #endregion |
| | | } |
| | | |
| | | #region è´§ä½ç¶ææ´æ°å¤ä½ |
| | | finished = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_load_finished").First(), client);//æ¾æå®æ |
| | | updatefinished = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "W_Storage_update").First(), client);//è´§ä½ç¶ææ´æ° |
| | | if (!finished && updatefinished) |
| | | { |
| | | client.WriteByOrder("W_Storage_update", false, name);//è´§ä½ç¶ææ´æ° |
| | | #region æ¥å¿è®°å½ |
| | | WriteDBLog.Success(name + "è´§ä½ç¶ææ´æ°å¤ä½", $"è¯»åæ¡æ¶ä¿¡æ¯ï¼\nR_load_finishedï¼{finished}\n\nåå
¥æ¡æ¶ä¿¡æ¯ï¼\nW_Storage_updateï¼{false}", "PCS"); |
| | | #endregion |
| | | } |
| | | #endregion |
| | | |
| | | var Request = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Request_Load").First(), client); |
| | | if (!Request) continue; |
| | | |
| | | var Area = client.ReadByOrder<Int16>("W_AreaNr", name);//读åè´§ä½å·ä¿¡æ¯ |
| | | if (Area != 0) continue; |
| | | |
| | | var load_zone = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_load_zone").First(), client); |
| | | #region è¯»åæ¡æ¶ä¿¡æ¯ |
| | | var Wheel_Type = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Wheel_Type").First(), client);//车轮类å |
| | | var Wheel_id = client.ReadByOrder<string>("R_Wheel_id", name);//车轮SNå· |
| | | if (string.IsNullOrEmpty(Wheel_id)) continue; |
| | | |
| | | var Work = workinfoRepository.Find(x => x.SN == Wheel_id && x.processCode == "17").FirstOrDefault(); |
| | | if (Work == null) |
| | | { |
| | | client.WriteByOrder("W_Enabl_Load", false, name);//ä¿¡å·ä¸ºfalseæ¡æ¶åæ¢è¿å
¥ |
| | | WriteDBLog.Error(name, $"è¯»åæ¡æ¶ä¿¡æ¯ï¼\n车轮SNï¼{Wheel_id}\n\næªæ¥è¯¢å°å·¥åä¿¡æ¯", "PCS"); |
| | | } |
| | | |
| | | #region MyRegion |
| | | //var mes_Detail = mes_DetailRepository.FindFirst(x => x.SN == Wheel_id); |
| | | //if (mes_Detail == null) |
| | | //{ |
| | | // #region æ¥å¿è®°å½ |
| | | // client.WriteByOrder("W_Enabl_Load", false, name);//ä¿¡å·ä¸ºfalseæ¡æ¶åæ¢è¿å
¥ |
| | | // WriteDBLog.Error(name, $"è¯»åæ¡æ¶ä¿¡æ¯ï¼\n车轮SNï¼{Wheel_id}\n\næªæ¥è¯¢å°å·¥å详æ
", "PCS"); |
| | | // #endregion |
| | | // continue; |
| | | //} |
| | | //var mes_Head = mes_HeadRepository.FindFirst(x => x.jobID == mes_Detail.jobID); |
| | | //if (mes_Head == null) |
| | | //{ |
| | | // #region æ¥å¿è®°å½ |
| | | // client.WriteByOrder("W_Enabl_Load", false, name);//ä¿¡å·ä¸ºfalseæ¡æ¶åæ¢è¿å
¥ |
| | | // WriteDBLog.Error(name, $"è¯»åæ¡æ¶ä¿¡æ¯ï¼\n车轮SNï¼{Wheel_id}\n\næªæ¥è¯¢å°å·¥å头表", "PCS"); |
| | | // #endregion |
| | | // continue; |
| | | //} |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | |
| | | var Stations = stationinfoRepository.Find(x => x.area == PipelineJob.area_code(name)).OrderBy(x => x.lastUpdateTime).ToList(); |
| | | |
| | | var NGStation = "X01001003"; |
| | | if (name == "2åå
䏿åº") NGStation = "X02001003"; |
| | | if (name == "3åå
䏿åº") NGStation = "X03001002"; |
| | | |
| | | //foreach (var station in Stations) //ä»»ä½ä¸ä¸ªä¸æä½ä¸ºç©ºæç¦ç¨æ¶,é½ä¼åæ¢æ¡æ¶ |
| | | //{ |
| | | // if (!station.enable || station.location_state == LocationStateEnum.Empty.ToString()) |
| | | // client.WriteByOrder("W_Enabl_Load", false, name);//ä¿¡å·ä¸ºfalseæ¡æ¶åæ¢è¿å
¥ |
| | | //} |
| | | |
| | | #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 = PipelineJob.QueryMateriel(Work.drawingNo); |
| | | var wheel1 = PipelineJob.QueryMateriel1(Work.drawingNo); |
| | | if (wheel == null && wheel1 == null) |
| | | { |
| | | #region æ¥å¿è®°å½ |
| | | client.WriteByOrder("W_Enabl_Load", false, name);//ä¿¡å·ä¸ºfalseæ¡æ¶åæ¢è¿å
¥ |
| | | WriteDBLog.Error(name, $"æªæ¥è¯¢å°è½¦è½®ä¿¡æ¯ï¼", "PCS"); |
| | | #endregion |
| | | continue; |
| | | } |
| | | |
| | | var PartStatus = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_PartStatus").First(), client);//1:ok;2:nok |
| | | #region æ¥å¿è®°å½ |
| | | WriteDBLog.Success(name + "ç³è¯·æ¾æ", $"è¯»åæ¡æ¶ä¿¡æ¯ï¼\n车轮SNï¼{Wheel_id}\nè½®åIDï¼{Wheel_Type}\nè½¦è½®ç¶æï¼{PartStatus}\næ¯å¦è¿å
¥ä¸æåºï¼{load_zone}", "PCS"); |
| | | if (load_zone) continue; |
| | | #endregion |
| | | if ((Int16)PartStatus == 1) |
| | | { |
| | | dt_stationinfo Stationinfo = null; |
| | | if (Work.heatID != null) |
| | | { |
| | | Stationinfo = Stations |
| | | .Where(x => x.enable |
| | | && x.stationCode != NGStation |
| | | && x.location_state == LocationStateEnum.Stroge.ToString() |
| | | && x.quantity < 5 |
| | | && x.stationType == Work.drawingNo |
| | | && x.tray_type == ((wheel == null ? wheel1.e : wheel.e) < 1100 ? "SmallTray" : "LargeTray") |
| | | && x.Number == Work.workOrder |
| | | && x.heatNumber == Work.heatID) |
| | | .OrderByDescending(x => x.quantity) |
| | | .FirstOrDefault(); |
| | | } |
| | | else |
| | | { |
| | | Stationinfo = Stations |
| | | .Where(x => x.enable |
| | | && x.stationCode != NGStation |
| | | && x.location_state == LocationStateEnum.Stroge.ToString() |
| | | && x.quantity < 5 |
| | | && x.stationType == Work.drawingNo |
| | | && x.tray_type == ((wheel == null ? wheel1.e : wheel.e) < 1100 ? "SmallTray" : "LargeTray") |
| | | && x.Number == Work.workOrder) |
| | | .OrderByDescending(x => x.quantity) |
| | | .FirstOrDefault(); |
| | | } |
| | | |
| | | if (Stationinfo == null) |
| | | { |
| | | #region 䏿使¡ä»¶ä¸å¹é
ç´æ¥è§¦åå
¥åºä»»å¡ |
| | | //var stationinfos = Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).ToList(); |
| | | //foreach (var stationinfo in stationinfos) |
| | | //{ |
| | | // agvtask(stationinfoRepository, stationinfo, (wheel == null ? wheel1.e : wheel.e), name == "3åå
䏿åº" ? "TaskType_OutsourceInbound" : "TaskType_Inbound"); |
| | | //} |
| | | #endregion |
| | | |
| | | |
| | | #region 触åNGä»»å¡ |
| | | var NG = Stations.Where(x => x.enable && x.stationCode == NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).FirstOrDefault(); |
| | | if (NG != null) |
| | | { |
| | | if (NG.stationType != Work.drawingNo || NG.Number != Work.workOrder) |
| | | agvtask(stationinfoRepository, NG, Work, "TaskType_OutsourceInbound"); |
| | | } |
| | | #endregion |
| | | |
| | | Stationinfo = Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity == 0).FirstOrDefault(); |
| | | |
| | | #region MyRegion |
| | | //var stationinfo = Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).FirstOrDefault(); |
| | | //if (stationinfo != null) |
| | | //{ |
| | | // agvtask(stationinfoRepository, mes_Head, stationinfo, (wheel == null ? wheel1.e : wheel.e), name == "3åå
䏿åº" ? "TaskType_OutsourceInbound" : "TaskType_Inbound"); |
| | | //} |
| | | #endregion |
| | | } |
| | | |
| | | if (Stationinfo != null) |
| | | { |
| | | #region æçç±»åä¸ä¸è´éæ´æ¢æç |
| | | if (Stationinfo.tray_type != ((wheel == null ? wheel1.e : wheel.e) < 1100 ? "SmallTray" : "LargeTray")) |
| | | { |
| | | 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(); |
| | | 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æ |
| | | |
| | | //var Wheel_id = client.ReadByOrder<string>("R_Wheel_id", name); |
| | | if (PalletSignal == 1) |
| | | { |
| | | List<string> list = new List<string>(); |
| | | if (Stationinfo.bindSN != null) |
| | | { |
| | | var SNS = Stationinfo.bindSN.Split(","); |
| | | foreach (var SN in SNS) |
| | | { |
| | | if (!string.IsNullOrEmpty(SN)) |
| | | list.Add(SN); |
| | | } |
| | | } |
| | | |
| | | #region è´§ä½æ°éä¸å
çµä¸å¹é
ï¼æ¥è¦ |
| | | if (list.Count > 0 && MaterialSignal != 1) |
| | | { |
| | | client.WriteByOrder("W_Enabl_Load", false, name);//ä¿¡å·ä¸ºfalseæ¡æ¶åæ¢è¿å
¥ |
| | | Pipeline_client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//æ¥è¦ |
| | | Stationinfo.location_state = LocationStateEnum.Abnormal.ToString(); |
| | | Stationinfo.remark = "车轮æ°éä¸å
çµä¸å¹é
"; |
| | | stationinfoRepository.Update(Stationinfo, true); |
| | | WriteDBLog.Error(name + "æ¥è¦", $"è´§ä½ç¼å·ï¼{Stationinfo.stationCode}ï¼é误信æ¯ï¼{Stationinfo.remark}", "PCS"); |
| | | //WriteDBLog.Error(name+"ç³è¯·ä¸æ",$"{Stationinfo.stationCode}çè´§ä½","PCS"); |
| | | } |
| | | else if (list.Count < 1 && MaterialSignal == 1) |
| | | { |
| | | client.WriteByOrder("W_Enabl_Load", false, name);//ä¿¡å·ä¸ºfalseæ¡æ¶åæ¢è¿å
¥ |
| | | Pipeline_client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//æ¥è¦ |
| | | Stationinfo.location_state = LocationStateEnum.Abnormal.ToString(); |
| | | Stationinfo.remark = "车轮æ°éä¸å
çµä¸å¹é
"; |
| | | stationinfoRepository.Update(Stationinfo, true); |
| | | WriteDBLog.Error(name + "æ¥è¦", $"è´§ä½ç¼å·ï¼{Stationinfo.stationCode}ï¼é误信æ¯ï¼{Stationinfo.remark}", "PCS"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | //ç¼åæ¶ä¸è½¦è½®æ°éä¸SNå·æ°éä¸ä¸è´ |
| | | if (list.Count != Stationinfo.quantity) |
| | | { |
| | | Stationinfo.location_state = LocationStateEnum.Abnormal.ToString(); |
| | | Stationinfo.remark = "车轮æ°éä¸SNå·æ°éä¸ä¸è´"; |
| | | stationinfoRepository.Update(Stationinfo, true); |
| | | continue; |
| | | //åå
¥æ¡æ¶æ¥è¦ä¿¡å· |
| | | //throw new Exception("䏿ä½è½¦è½®æ°éä¸SNå·æ°éä¸ä¸è´ï¼ä¸æä½ç¼å·ï¼" + Stationinfo.stationCode); |
| | | } |
| | | var area = Convert.ToInt16(Stationinfo.stationCode.Substring(Stationinfo.stationCode.Length - 1, 1)); |
| | | client.WriteByOrder("W_AreaNr", (Int16)area, name);//åºåè´§ä½å· |
| | | client.WriteByOrder("W_IndexNr", (Int16)(Stationinfo.quantity + 1), name);//æçä¸ç第å 个车轮 |
| | | client.WriteByOrder("W_Storage_Type", (Int16)1, name);//æçç±»å1-横æ¾;2-ç«æ¾(ææ¶åªææ¨ªæ¾æç) |
| | | client.WriteByOrder("W_Enabl_Load", true, name);//æ¯å¦å
许 |
| | | #region æ¥å¿è®°å½ |
| | | WriteDBLog.Success(name + "å
è®¸æ¾æ", $"è¯»åæ¡æ¶ä¿¡æ¯ï¼\n车轮SNï¼{Wheel_id}\nè½®åIDï¼{Wheel_Type}\nè½¦è½®ç¶æï¼OK" + |
| | | $"\n读åæçå
çµä¿¡å·ï¼{PalletSignal}" + |
| | | $"\n\nåå
¥æ¡æ¶ä¿¡æ¯ï¼\n䏿ä½å·ï¼{area}\n第å 个车轮ï¼{(Stationinfo.quantity + 1)}\næçç±»åï¼1\nW_Enabl_Loadï¼true", "PCS"); |
| | | #endregion |
| | | continue; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | #region 没æçå¯ç¨,触åå
¥åºä»»å¡ |
| | | var stationinfos = Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).ToList(); |
| | | foreach (var stationinfo in stationinfos) |
| | | { |
| | | agvtask(stationinfoRepository, stationinfo, Work, name == "3åå
䏿åº" ? "TaskType_OutsourceInbound" : "TaskType_Inbound"); |
| | | } |
| | | #endregion |
| | | } |
| | | |
| | | } |
| | | else if ((Int16)PartStatus == 2) |
| | | { |
| | | dt_stationinfo Stationinfo = null; |
| | | //if (mes_Detail.heatID != null) |
| | | //{ |
| | | // Stationinfo = Stations |
| | | //.Where(x => x.enable |
| | | //&& x.stationCode == NGStation |
| | | //&& x.location_state == LocationStateEnum.Stroge.ToString() |
| | | //&& x.quantity < 5 |
| | | //&& x.stationType == mes_Head.drawingNo |
| | | //&& x.tray_type == ((wheel == null ? wheel1.e : wheel.e) < 1100 ? "SmallTray" : "LargeTray") |
| | | //&& x.Number == mes_Detail.jobID |
| | | //&& x.heatNumber == mes_Detail.heatID).FirstOrDefault(); |
| | | //} |
| | | //else |
| | | //{ |
| | | //var tray_type = "SmallTray"; |
| | | //if ((wheel == null ? wheel1.e : wheel.e) > 1100) tray_type = "LargeTray"; |
| | | Stationinfo = Stations |
| | | .Where(x => x.enable |
| | | && x.stationCode == NGStation |
| | | && x.location_state == LocationStateEnum.Stroge.ToString() |
| | | && x.quantity < 5 |
| | | && x.stationType == Work.drawingNo |
| | | && x.tray_type == ((wheel == null ? wheel1.e : wheel.e) < 1100 ? "SmallTray" : "LargeTray") |
| | | /*&& x.Number == mes_Detail.jobID*/).FirstOrDefault(); |
| | | //} |
| | | |
| | | if (Stationinfo == null) |
| | | { |
| | | //var stationinfo = Stations.Where(x => x.enable && x.stationCode == NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).FirstOrDefault(); |
| | | //if (stationinfo != null) |
| | | //{ |
| | | // agvtask(stationinfoRepository, stationinfo, (wheel == null ? wheel1.e : wheel.e), "TaskType_OutsourceInbound"); |
| | | //} |
| | | Stationinfo = Stations.Where(x => x.enable && x.stationCode == NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity == 0).FirstOrDefault(); |
| | | } |
| | | if (Stationinfo != null) |
| | | { |
| | | #region æçç±»åä¸ä¸è´éæ´æ¢æç |
| | | if (Stationinfo.tray_type != ((wheel == null ? wheel1.e : wheel.e) < 1100 ? "SmallTray" : "LargeTray")) |
| | | { |
| | | Stationinfo.location_state = LocationStateEnum.Abnormal.ToString(); |
| | | Stationinfo.tray_type = Stationinfo.tray_type == "SmallTray" ? "SmallTray/LargeTray" : "LargeTray/SmallTray"; |
| | | Stationinfo.remark = "æçç±»åä¸ä¸è´éæ´æ¢æç"; |
| | | stationinfoRepository.Update(Stationinfo, true); |
| | | } |
| | | #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æ |
| | | if (PalletSignal == 1) |
| | | { |
| | | List<string> list = new List<string>(); |
| | | if (Stationinfo.bindSN != null) |
| | | { |
| | | var SNS = Stationinfo.bindSN.Split(","); |
| | | foreach (var SN in SNS) |
| | | { |
| | | if (!string.IsNullOrEmpty(SN)) |
| | | list.Add(SN); |
| | | } |
| | | } |
| | | |
| | | #region è´§ä½æ°éä¸å
çµä¸å¹é
ï¼æ¥è¦ |
| | | //if (list.Count > 0 && MaterialSignal != 1) |
| | | // Pipeline_client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//æ¥è¦ |
| | | //else if (list.Count < 1 && MaterialSignal == 1) |
| | | // Pipeline_client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//æ¥è¦ |
| | | |
| | | if (list.Count > 0 && MaterialSignal != 1) |
| | | { |
| | | client.WriteByOrder("W_Enabl_Load", false, name);//ä¿¡å·ä¸ºfalseæ¡æ¶åæ¢è¿å
¥ |
| | | Pipeline_client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//æ¥è¦ |
| | | Stationinfo.location_state = LocationStateEnum.Abnormal.ToString(); |
| | | Stationinfo.remark = "车轮æ°éä¸å
çµä¸å¹é
"; |
| | | stationinfoRepository.Update(Stationinfo, true); |
| | | WriteDBLog.Error(name + "æ¥è¦", $"è´§ä½ç¼å·ï¼{Stationinfo.stationCode}ï¼é误信æ¯ï¼{Stationinfo.remark}", "PCS"); |
| | | //WriteDBLog.Error(name+"ç³è¯·ä¸æ",$"{Stationinfo.stationCode}çè´§ä½","PCS"); |
| | | } |
| | | else if (list.Count < 1 && MaterialSignal == 1) |
| | | { |
| | | client.WriteByOrder("W_Enabl_Load", false, name);//ä¿¡å·ä¸ºfalseæ¡æ¶åæ¢è¿å
¥ |
| | | Pipeline_client.WriteByOrder("W_AlarmSignal", (Int16)2, name);//æ¥è¦ |
| | | Stationinfo.location_state = LocationStateEnum.Abnormal.ToString(); |
| | | Stationinfo.remark = "车轮æ°éä¸å
çµä¸å¹é
"; |
| | | stationinfoRepository.Update(Stationinfo, true); |
| | | WriteDBLog.Error(name + "æ¥è¦", $"è´§ä½ç¼å·ï¼{Stationinfo.stationCode}ï¼é误信æ¯ï¼{Stationinfo.remark}", "PCS"); |
| | | } |
| | | #endregion |
| | | |
| | | //ç¼åæ¶ä¸è½¦è½®æ°éä¸SNå·æ°éä¸ä¸è´ |
| | | if (list.Count != Stationinfo.quantity) |
| | | { |
| | | Stationinfo.location_state = LocationStateEnum.Abnormal.ToString(); |
| | | Stationinfo.remark = "车轮æ°éä¸SNå·æ°éä¸ä¸è´"; |
| | | stationinfoRepository.Update(Stationinfo, true); |
| | | continue; |
| | | //åå
¥æ¡æ¶æ¥è¦ä¿¡å· |
| | | //throw new Exception("䏿ä½è½¦è½®æ°éä¸SNå·æ°éä¸ä¸è´ï¼ä¸æä½ç¼å·ï¼" + Stationinfo.stationCode); |
| | | } |
| | | var area = Convert.ToInt16(Stationinfo.stationCode.Substring(Stationinfo.stationCode.Length - 1, 1)); |
| | | client.WriteByOrder("W_AreaNr", (Int16)area, name);//åºåè´§ä½å· |
| | | client.WriteByOrder("W_IndexNr", (Int16)(Stationinfo.quantity + 1), name);//æçä¸ç第å 个车轮 |
| | | client.WriteByOrder("W_Storage_Type", (Int16)1, name);//æçç±»å1-横æ¾;2-ç«æ¾(ææ¶åªææ¨ªæ¾æç) |
| | | client.WriteByOrder("W_Enabl_Load", true, name);//æ¯å¦å
许 |
| | | #region æ¥å¿è®°å½ |
| | | 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"); |
| | | #endregion |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | #region |
| | | //var Stationinfo = Stations |
| | | // .Where(x => x.enable |
| | | // && x.location_state == LocationStateEnum.Stroge.ToString() |
| | | // && x.quantity < 5 |
| | | // && x.stationType == PipelineJob.QueryMateriel(Wheel_Type) |
| | | // && x.Number == mes_Detail.jobID |
| | | // && x.heatNumber == mes_Detail.heatID).FirstOrDefault(); |
| | | //if (Stationinfo == null) |
| | | // Stationinfo = Stations.Where(x => x.enable && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity == 0).FirstOrDefault(); |
| | | //if (Stationinfo != null) |
| | | //{ |
| | | |
| | | //} |
| | | |
| | | //List<string> StationCodes = new List<string>() { "X01001001", "X01001002", "X01001003" }; |
| | | //if (name == "2åå
䏿åº") |
| | | // StationCodes = new List<string>() { "X02001001", "X02001002", "X02001003" }; |
| | | //if (name == "3åå
䏿åº") |
| | | // StationCodes = new List<string>() { "X03001001", "X03001002" }; |
| | | |
| | | #endregion |
| | | |
| | | #region |
| | | //for (int i = 0; i < StationCodes.Count - 1; i++) |
| | | //{ |
| | | // var PartStatus = (Int32)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_PartStatus").First(), client);//1:ok;2:nok |
| | | // string NG = StationCodes[StationCodes.Count - 1];//NGè´§ä½ |
| | | // var station = stationinfoRepository.FindFirst(x => x.stationCode == StationCodes[i] && x.enable && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity < 5); |
| | | // if (station == null) continue; |
| | | // var Pipelinedetails = plcRepository.Find(x => x.plcdetail_iotype == Pipelineplc.plcinfo_iotyep && x.plcdetail_number == StationCodes[i]).ToList(); |
| | | // var PalletSignal = (Int16)DBExtension.Read(Pipelinedetails.Where(x => x.plcdetail_name == "R_PalletSignal").First(), client);//读åæçä¿¡å·:1:æ,2æ |
| | | // if (PalletSignal == 1) |
| | | // { |
| | | // if (PartStatus == 1 && NG != station.stationCode) |
| | | // { |
| | | // client.WriteByOrder("W_AreaNr", (Int16)i + 1, name);//åºåè´§ä½å· |
| | | // client.WriteByOrder("W_IndexNr", (Int16)station.quantity + 1, name);//æçä¸ç第å 个车轮 |
| | | // client.WriteByOrder("W_Storage_Type", (Int16)1, name);//æçç±»å1-横æ¾;2-ç«æ¾(ææ¶åªææ¨ªæ¾æç) |
| | | // client.WriteByOrder("W_Enabl_Load", true, name);//æ¯å¦å
许 |
| | | // return; |
| | | // } |
| | | // else if (PartStatus == 2 && NG == station.stationCode) |
| | | // { |
| | | // client.WriteByOrder("W_AreaNr", (Int16)i + 1, name);//åºåè´§ä½å· |
| | | // client.WriteByOrder("W_IndexNr", (Int16)station.quantity + 1, name);//æçä¸ç第å 个车轮 |
| | | // client.WriteByOrder("W_Storage_Type", (Int16)1, name);//æçç±»å1-横æ¾;2-ç«æ¾(ææ¶åªææ¨ªæ¾æç) |
| | | // client.WriteByOrder("W_Enabl_Load", true, name);//æ¯å¦å
许 |
| | | // return; |
| | | // } |
| | | // } |
| | | //} |
| | | #endregion |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | WriteDBLog.Error(name, $"é误信æ¯ï¼{ex.Message}", "PCS"); |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw; |
| | | WriteDBLog.Error("䏿åº", $"é误信æ¯ï¼{ex.Message}", "PCS"); |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// é²åæªæ½ |
| | | /// AGVä»»å¡ |
| | | /// </summary> |
| | | static bool Gantry_Out_of_Area1;//æ¡æ¶æ¯å¦å¨åºåå
|
| | | static bool Gantry_Out_of_Area2;//æ¡æ¶æ¯å¦å¨åºåå
|
| | | static bool Gantry_Out_of_Area3;//æ¡æ¶æ¯å¦å¨åºåå
|
| | | static bool Gantry_Out_of_Area4;//æ¡æ¶æ¯å¦å¨åºåå
|
| | | public void Stupidproofmeasure(PLCClient client) |
| | | public void agvtask(Idt_stationinfoRepository stationinfoRepository, dt_stationinfo stationinfo, VV_Mes_Workinfo Work, string tasktype) |
| | | { |
| | | try |
| | | 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") |
| | | 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) |
| | | { |
| | | var plc = repository.FindFirst(x => x.plcinfo_name == client.PLCName); |
| | | List<string> names = new List<string>() { "1åå
é²å", "2åå
é²å", "3åå
é²å", "䏿åºé²å" }; |
| | | foreach (string name in names) |
| | | dt_agvtask agvtask = new dt_agvtask() |
| | | { |
| | | var details = plcRepository.Find(x => x.plcdetail_iotype == plc.plcinfo_iotyep && x.plcdetail_number == name).ToList(); |
| | | var Release_In = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Release_In").First(), client);//å
许è¿å
¥ |
| | | if (!Release_In) { } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw; |
| | | 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); |
| | | } |
| | | } |
| | | } |