终端一体化运控平台
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

PolymerBatching.cs 8.9 KiB

1年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
2年前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. using BPA.Helper;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Data;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace BPASmartClient.MorkTM
  9. {
  10. public enum MaterialPosion
  11. {
  12. Top1 =1, Top2 =2, Top3 =3, Top4 = 4, Top5 = 5, Top6= 6, Top7 = 7, Top8=8, Top9 =9, Top10 =10,
  13. Top11 = 11, Top12 =12, Top13 =13, Top14 =14, Top15= 15, Top16=16, Top17 =17, Top18 =18, Top19 =19, Top20 =20,
  14. Top21 =21, Top22 =22, Top23 =23, Top24 =24, Top25 =25, Top26 =26, Top27 =27, Top28=28
  15. }
  16. public enum OutMaterialPosion
  17. {
  18. 一号位 = 1, 二号位 = 2, 三号位 = 3, 四号位 = 4, 五号位 = 5, 六号位 = 6,出料位 = 0
  19. }
  20. public class CommationPosionPLC
  21. {
  22. public CommationPosionPLC( string set,string get, Enum @enum)
  23. {
  24. SetPLCPosion = set;
  25. GetPLCPosion = get;
  26. posion = @enum;
  27. }
  28. public string SetPLCPosion;
  29. public string GetPLCPosion;
  30. public Enum posion;
  31. }
  32. public class PolymerBatching
  33. {
  34. /// <summary>
  35. /// 物料需求对应的plc点位
  36. /// </summary>
  37. public Dictionary<MaterialPosion, string> MaterialPosionList = new Dictionary<MaterialPosion, string>()
  38. {
  39. {MaterialPosion.Top1 , "VW304"},
  40. {MaterialPosion.Top2 , "VW308"},
  41. {MaterialPosion.Top3 , "VW312"},
  42. {MaterialPosion.Top4 , "VW316"},
  43. {MaterialPosion.Top5 , "VW320"},
  44. {MaterialPosion.Top6 , "VW324"},
  45. {MaterialPosion.Top7 , "VW328"},
  46. {MaterialPosion.Top8 , "VW332"},
  47. {MaterialPosion.Top9 , "VW336"},
  48. {MaterialPosion.Top10, "VW340" },
  49. {MaterialPosion.Top11, "VW344" },
  50. {MaterialPosion.Top12, "VW348" },
  51. {MaterialPosion.Top13, "VW352" },
  52. {MaterialPosion.Top14, "VW356" },
  53. {MaterialPosion.Top15, "VW360" },
  54. {MaterialPosion.Top16, "VW364" },
  55. {MaterialPosion.Top17, "VW368" },
  56. {MaterialPosion.Top18, "VW372" },
  57. {MaterialPosion.Top19, "VW376" },
  58. {MaterialPosion.Top20, "VW380" },
  59. {MaterialPosion.Top21, "VW384" },
  60. {MaterialPosion.Top22, "VW388" },
  61. {MaterialPosion.Top23, "VW392" },
  62. {MaterialPosion.Top24, "VW396" },
  63. {MaterialPosion.Top25, "VW400" },
  64. {MaterialPosion.Top26, "VW404" },
  65. {MaterialPosion.Top27, "VW408" },
  66. {MaterialPosion.Top28, "VW412" },
  67. };
  68. /// <summary>
  69. /// 通道校正值PLC点位
  70. /// </summary>
  71. public Dictionary<MaterialPosion, string> PasswayPosionList = new Dictionary<MaterialPosion, string>()
  72. {
  73. {MaterialPosion.Top1 , "VW104"},
  74. {MaterialPosion.Top2 , "VW108"},
  75. {MaterialPosion.Top3 , "VW112"},
  76. {MaterialPosion.Top4 , "VW116"},
  77. {MaterialPosion.Top5 , "VW120"},
  78. {MaterialPosion.Top6 , "VW124"},
  79. {MaterialPosion.Top7 , "VW128"},
  80. {MaterialPosion.Top8 , "VW132"},
  81. {MaterialPosion.Top9 , "VW136"},
  82. {MaterialPosion.Top10, "VW140" },
  83. {MaterialPosion.Top11, "VW144" },
  84. {MaterialPosion.Top12, "VW148" },
  85. {MaterialPosion.Top13, "VW152" },
  86. {MaterialPosion.Top14, "VW156" },
  87. {MaterialPosion.Top15, "VW160" },
  88. {MaterialPosion.Top16, "VW164" },
  89. {MaterialPosion.Top17, "VW168" },
  90. {MaterialPosion.Top18, "VW172" },
  91. {MaterialPosion.Top19, "VW176" },
  92. {MaterialPosion.Top20, "VW180" },
  93. {MaterialPosion.Top21, "VW184" },
  94. {MaterialPosion.Top22, "VW188" },
  95. {MaterialPosion.Top23, "VW192" },
  96. {MaterialPosion.Top24, "VW196" },
  97. {MaterialPosion.Top25, "VW200" },
  98. {MaterialPosion.Top26, "VW204" },
  99. {MaterialPosion.Top27, "VW208" },
  100. {MaterialPosion.Top28, "VW212" },
  101. };
  102. /// <summary>
  103. /// plc转盘点位
  104. /// </summary>
  105. public List<CommationPosionPLC> TurnPosionPLCs = new List<CommationPosionPLC>()
  106. {
  107. //new CommationPosionPLC("M4.0","M14.0",OutMaterialPosion.一号位),
  108. //new CommationPosionPLC("M4.1","M14.1",OutMaterialPosion.二号位),
  109. //new CommationPosionPLC("M4.2","M14.2",OutMaterialPosion.三号位),
  110. //new CommationPosionPLC("M4.3","M14.3",OutMaterialPosion.四号位),
  111. //new CommationPosionPLC("M4.4","M14.4",OutMaterialPosion.五号位),
  112. //new CommationPosionPLC("M4.5","M14.5",OutMaterialPosion.六号位),
  113. };
  114. /// <summary>
  115. /// plc出料点位
  116. /// </summary>
  117. public List<CommationPosionPLC> OutPosionPLCs = new List<CommationPosionPLC>()
  118. {
  119. //new CommationPosionPLC("M0.0","M10.0",MaterialPosion.Top1),
  120. //new CommationPosionPLC("M0.1","M10.1",MaterialPosion.Top2),
  121. //new CommationPosionPLC("M0.2","M10.2",MaterialPosion.Top3),
  122. //new CommationPosionPLC("M0.3","M10.3",MaterialPosion.Top4),
  123. //new CommationPosionPLC("M0.4","M10.4",MaterialPosion.Top5),
  124. //new CommationPosionPLC("M0.5","M10.5",MaterialPosion.Top6),
  125. //new CommationPosionPLC("M0.6","M10.6",MaterialPosion.Top7),
  126. //new CommationPosionPLC("M0.7","M10.7",MaterialPosion.Top8),
  127. //new CommationPosionPLC("M1.0","M11.0",MaterialPosion.Top9),
  128. //new CommationPosionPLC("M1.1","M11.1",MaterialPosion.Top10),
  129. //new CommationPosionPLC("M1.2","M11.2",MaterialPosion.Top11),
  130. //new CommationPosionPLC("M1.3","M11.3",MaterialPosion.Top12),
  131. //new CommationPosionPLC("M1.4","M11.4",MaterialPosion.Top13),
  132. //new CommationPosionPLC("M1.5","M11.5",MaterialPosion.Top14),
  133. //new CommationPosionPLC("M1.6","M11.6",MaterialPosion.Top15),
  134. //new CommationPosionPLC("M1.7","M11.7",MaterialPosion.Top16),
  135. //new CommationPosionPLC("M2.0","M12.0",MaterialPosion.Top17),
  136. //new CommationPosionPLC("M2.1","M12.1",MaterialPosion.Top18),
  137. //new CommationPosionPLC("M2.2","M12.2",MaterialPosion.Top19),
  138. //new CommationPosionPLC("M2.3","M12.3",MaterialPosion.Top20),
  139. //new CommationPosionPLC("M2.4","M12.4",MaterialPosion.Top21),
  140. //new CommationPosionPLC("M2.5","M12.5",MaterialPosion.Top22),
  141. //new CommationPosionPLC("M2.6","M12.6",MaterialPosion.Top23),
  142. //new CommationPosionPLC("M2.7","M12.7",MaterialPosion.Top24),
  143. //new CommationPosionPLC("M3.0","M13.0",MaterialPosion.Top25),
  144. //new CommationPosionPLC("M3.1","M13.1",MaterialPosion.Top26),
  145. //new CommationPosionPLC("M3.2","M13.2",MaterialPosion.Top27),
  146. //new CommationPosionPLC("M3.3","M13.3",MaterialPosion.Top28),
  147. };
  148. /// <summary>
  149. /// 通道绑定出料位置
  150. /// </summary>
  151. public void GetMaterialInfo()
  152. {
  153. List<MaterialPosion> materialPosions = Enum.GetValues(typeof(MaterialPosion)).Cast<MaterialPosion>().ToList();
  154. for (int i = 0; i < Enum.GetValues(typeof(OutMaterialPosion)).Length -1; i++)
  155. {
  156. if (i == 2 || i == 3)
  157. {
  158. GoodsMaterialPosion.Add(materialPosions.Take(4).ToList(), TurnPosionPLCs[i]);
  159. materialPosions.RemoveRange(0, 4);
  160. }
  161. else
  162. {
  163. GoodsMaterialPosion.Add(materialPosions.Take(5).ToList(), TurnPosionPLCs[i]);
  164. materialPosions.RemoveRange(0, 5);
  165. }
  166. }
  167. }
  168. /// <summary>
  169. /// 出料通道和出料口位置绑定集合
  170. /// 一号位(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)
  171. /// </summary>
  172. public Dictionary<List<MaterialPosion>, CommationPosionPLC> GoodsMaterialPosion = new Dictionary<List<MaterialPosion>, CommationPosionPLC>();
  173. string Path = AppDomain.CurrentDomain.BaseDirectory + "AccessFile\\DeviceConfig\\PLCVars.csv";
  174. private void init()
  175. {
  176. DataTable dt = ExcelHelper.ReadDataFromCSV(Path);
  177. DataRowCollection dr = dt.Rows;
  178. for (int i = 0; i < 28; i++)
  179. {
  180. OutPosionPLCs.Add(new CommationPosionPLC(dr[i][0].ToString(), dr[i][2].ToString(), (MaterialPosion)i+1));
  181. }
  182. for(int i = 28; i <34;i++)
  183. {
  184. TurnPosionPLCs.Add(new CommationPosionPLC(dr[i][0].ToString(), dr[i][2].ToString(), (OutMaterialPosion)i - 27));
  185. }
  186. }
  187. public PolymerBatching()
  188. {
  189. init();
  190. }
  191. }
  192. }