|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207 |
- using BPASmartClient.Helper;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
-
- namespace BPASmartClient.MorkTM
- {
- public enum MaterialPosion
- {
- Top1 =1, Top2 =2, Top3 =3, Top4 = 4, Top5 = 5, Top6= 6, Top7 = 7, Top8=8, Top9 =9, Top10 =10,
- Top11 = 11, Top12 =12, Top13 =13, Top14 =14, Top15= 15, Top16=16, Top17 =17, Top18 =18, Top19 =19, Top20 =20,
- Top21 =21, Top22 =22, Top23 =23, Top24 =24, Top25 =25, Top26 =26, Top27 =27, Top28=28
-
- }
- public enum OutMaterialPosion
- {
- 一号位 = 1, 二号位 = 2, 三号位 = 3, 四号位 = 4, 五号位 = 5, 六号位 = 6,出料位 = 0
- }
- public class CommationPosionPLC
- {
- public CommationPosionPLC( string set,string get, Enum @enum)
- {
- SetPLCPosion = set;
- GetPLCPosion = get;
- posion = @enum;
- }
- public string SetPLCPosion;
-
- public string GetPLCPosion;
-
- public Enum posion;
- }
- public class PolymerBatching
- {
- /// <summary>
- /// 物料需求对应的plc点位
- /// </summary>
- public Dictionary<MaterialPosion, string> MaterialPosionList = new Dictionary<MaterialPosion, string>()
- {
- {MaterialPosion.Top1 , "VW304"},
- {MaterialPosion.Top2 , "VW308"},
- {MaterialPosion.Top3 , "VW312"},
- {MaterialPosion.Top4 , "VW316"},
- {MaterialPosion.Top5 , "VW320"},
- {MaterialPosion.Top6 , "VW324"},
- {MaterialPosion.Top7 , "VW328"},
- {MaterialPosion.Top8 , "VW332"},
- {MaterialPosion.Top9 , "VW336"},
- {MaterialPosion.Top10, "VW340" },
- {MaterialPosion.Top11, "VW344" },
- {MaterialPosion.Top12, "VW348" },
- {MaterialPosion.Top13, "VW352" },
- {MaterialPosion.Top14, "VW356" },
- {MaterialPosion.Top15, "VW360" },
- {MaterialPosion.Top16, "VW364" },
- {MaterialPosion.Top17, "VW368" },
- {MaterialPosion.Top18, "VW372" },
- {MaterialPosion.Top19, "VW376" },
- {MaterialPosion.Top20, "VW380" },
- {MaterialPosion.Top21, "VW384" },
- {MaterialPosion.Top22, "VW388" },
- {MaterialPosion.Top23, "VW392" },
- {MaterialPosion.Top24, "VW396" },
- {MaterialPosion.Top25, "VW400" },
- {MaterialPosion.Top26, "VW404" },
- {MaterialPosion.Top27, "VW408" },
- {MaterialPosion.Top28, "VW412" },
-
- };
- /// <summary>
- /// 通道校正值PLC点位
- /// </summary>
- public Dictionary<MaterialPosion, string> PasswayPosionList = new Dictionary<MaterialPosion, string>()
- {
- {MaterialPosion.Top1 , "VW104"},
- {MaterialPosion.Top2 , "VW108"},
- {MaterialPosion.Top3 , "VW112"},
- {MaterialPosion.Top4 , "VW116"},
- {MaterialPosion.Top5 , "VW120"},
- {MaterialPosion.Top6 , "VW124"},
- {MaterialPosion.Top7 , "VW128"},
- {MaterialPosion.Top8 , "VW132"},
- {MaterialPosion.Top9 , "VW136"},
- {MaterialPosion.Top10, "VW140" },
- {MaterialPosion.Top11, "VW144" },
- {MaterialPosion.Top12, "VW148" },
- {MaterialPosion.Top13, "VW152" },
- {MaterialPosion.Top14, "VW156" },
- {MaterialPosion.Top15, "VW160" },
- {MaterialPosion.Top16, "VW164" },
- {MaterialPosion.Top17, "VW168" },
- {MaterialPosion.Top18, "VW172" },
- {MaterialPosion.Top19, "VW176" },
- {MaterialPosion.Top20, "VW180" },
- {MaterialPosion.Top21, "VW184" },
- {MaterialPosion.Top22, "VW188" },
- {MaterialPosion.Top23, "VW192" },
- {MaterialPosion.Top24, "VW196" },
- {MaterialPosion.Top25, "VW200" },
- {MaterialPosion.Top26, "VW204" },
- {MaterialPosion.Top27, "VW208" },
- {MaterialPosion.Top28, "VW212" },
-
- };
- /// <summary>
- /// plc转盘点位
- /// </summary>
- public List<CommationPosionPLC> TurnPosionPLCs = new List<CommationPosionPLC>()
- {
- //new CommationPosionPLC("M4.0","M14.0",OutMaterialPosion.一号位),
- //new CommationPosionPLC("M4.1","M14.1",OutMaterialPosion.二号位),
- //new CommationPosionPLC("M4.2","M14.2",OutMaterialPosion.三号位),
- //new CommationPosionPLC("M4.3","M14.3",OutMaterialPosion.四号位),
- //new CommationPosionPLC("M4.4","M14.4",OutMaterialPosion.五号位),
- //new CommationPosionPLC("M4.5","M14.5",OutMaterialPosion.六号位),
- };
- /// <summary>
- /// plc出料点位
- /// </summary>
- public List<CommationPosionPLC> OutPosionPLCs = new List<CommationPosionPLC>()
- {
- //new CommationPosionPLC("M0.0","M10.0",MaterialPosion.Top1),
- //new CommationPosionPLC("M0.1","M10.1",MaterialPosion.Top2),
- //new CommationPosionPLC("M0.2","M10.2",MaterialPosion.Top3),
- //new CommationPosionPLC("M0.3","M10.3",MaterialPosion.Top4),
- //new CommationPosionPLC("M0.4","M10.4",MaterialPosion.Top5),
- //new CommationPosionPLC("M0.5","M10.5",MaterialPosion.Top6),
- //new CommationPosionPLC("M0.6","M10.6",MaterialPosion.Top7),
- //new CommationPosionPLC("M0.7","M10.7",MaterialPosion.Top8),
- //new CommationPosionPLC("M1.0","M11.0",MaterialPosion.Top9),
- //new CommationPosionPLC("M1.1","M11.1",MaterialPosion.Top10),
- //new CommationPosionPLC("M1.2","M11.2",MaterialPosion.Top11),
- //new CommationPosionPLC("M1.3","M11.3",MaterialPosion.Top12),
- //new CommationPosionPLC("M1.4","M11.4",MaterialPosion.Top13),
- //new CommationPosionPLC("M1.5","M11.5",MaterialPosion.Top14),
- //new CommationPosionPLC("M1.6","M11.6",MaterialPosion.Top15),
- //new CommationPosionPLC("M1.7","M11.7",MaterialPosion.Top16),
- //new CommationPosionPLC("M2.0","M12.0",MaterialPosion.Top17),
- //new CommationPosionPLC("M2.1","M12.1",MaterialPosion.Top18),
- //new CommationPosionPLC("M2.2","M12.2",MaterialPosion.Top19),
- //new CommationPosionPLC("M2.3","M12.3",MaterialPosion.Top20),
- //new CommationPosionPLC("M2.4","M12.4",MaterialPosion.Top21),
- //new CommationPosionPLC("M2.5","M12.5",MaterialPosion.Top22),
- //new CommationPosionPLC("M2.6","M12.6",MaterialPosion.Top23),
- //new CommationPosionPLC("M2.7","M12.7",MaterialPosion.Top24),
- //new CommationPosionPLC("M3.0","M13.0",MaterialPosion.Top25),
- //new CommationPosionPLC("M3.1","M13.1",MaterialPosion.Top26),
- //new CommationPosionPLC("M3.2","M13.2",MaterialPosion.Top27),
- //new CommationPosionPLC("M3.3","M13.3",MaterialPosion.Top28),
- };
- /// <summary>
- /// 通道绑定出料位置
- /// </summary>
- public void GetMaterialInfo()
- {
- List<MaterialPosion> materialPosions = Enum.GetValues(typeof(MaterialPosion)).Cast<MaterialPosion>().ToList();
-
- for (int i = 0; i < Enum.GetValues(typeof(OutMaterialPosion)).Length -1; i++)
- {
- if (i == 2 || i == 3)
- {
- GoodsMaterialPosion.Add(materialPosions.Take(4).ToList(), TurnPosionPLCs[i]);
- materialPosions.RemoveRange(0, 4);
- }
- else
- {
- GoodsMaterialPosion.Add(materialPosions.Take(5).ToList(), TurnPosionPLCs[i]);
- materialPosions.RemoveRange(0, 5);
- }
- }
-
-
-
- }
- /// <summary>
- /// 出料通道和出料口位置绑定集合
- /// 一号位(1,2,3,4,5),二号位(6,7,8,9,10),三号位(11,12,13,14),4号位(15,16,17,18),五号位(19,20,21,22,23),六号位(24,25,26,27,28)
- /// </summary>
- public Dictionary<List<MaterialPosion>, CommationPosionPLC> GoodsMaterialPosion = new Dictionary<List<MaterialPosion>, CommationPosionPLC>();
-
- string Path = AppDomain.CurrentDomain.BaseDirectory + "AccessFile\\DeviceConfig\\PLCVars.csv";
-
- private void init()
- {
- DataTable dt = ExcelHelper.ReadDataFromCSV(Path);
- DataRowCollection dr = dt.Rows;
- for (int i = 0; i < 28; i++)
- {
- OutPosionPLCs.Add(new CommationPosionPLC(dr[i][0].ToString(), dr[i][2].ToString(), (MaterialPosion)i+1));
- }
- for(int i = 28; i <34;i++)
- {
- TurnPosionPLCs.Add(new CommationPosionPLC(dr[i][0].ToString(), dr[i][2].ToString(), (OutMaterialPosion)i - 27));
- }
-
- }
-
- public PolymerBatching()
- {
- init();
- }
-
- }
- }
|