MesModel.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. using LocalhostMES.Enums;
  2. using Prism.Mvvm;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace LocalhostMES.Models
  9. {
  10. public class MesModel
  11. {
  12. }
  13. #region 通用响应模型
  14. public class ApiResponse<T>
  15. {
  16. public string code { get; set; } = "200";
  17. public bool success { get; set; } = true;
  18. public string msg { get; set; } = "请求成功";
  19. public string msgTime { get; set; } = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  20. public string traceId { get; set; } = Guid.NewGuid().ToString("N").Substring(0, 24);
  21. public T data { get; set; }
  22. }
  23. public class ErrorResponse
  24. {
  25. public string code { get; set; } = "55000";
  26. public bool success { get; set; } = false;
  27. public string msg { get; set; }
  28. public string msgTime { get; set; } = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  29. public string traceId { get; set; } = Guid.NewGuid().ToString("N").Substring(0, 24);
  30. public object data { get; set; } = null;
  31. }
  32. #endregion
  33. #region 2.1 厂级MES下发工单信息
  34. public class WorkOrderRequest
  35. {
  36. public string WorkOrderNo { get; set; } // 工单号
  37. public string MaterialCode { get; set; } // 成品物料号
  38. public string MaterialName { get; set; } // 成品物料名称
  39. public string OrderNo { get; set; } // 订单号
  40. public string SequenceNo { get; set; } // 工单顺序号
  41. public string WorkOrderNum { get; set; } // 工单生产数量
  42. public string PlanOnlineTime { get; set; } // 计划上线时间
  43. public string PlanOfflineTime { get; set; } // 计划下线时间
  44. public string Status { get; set; } // 工单状态
  45. public string FrozenStatus { get; set; } // 冻结状态
  46. public string ReleaseStatus { get; set; } // 下发状态
  47. public string LineCode { get; set; } // 线体编码
  48. }
  49. public class WorkOrderInfo
  50. {
  51. [SqlSugar.SugarColumn(IsPrimaryKey = true)]
  52. public string WorkOrderNo { get; set; }
  53. public bool IsLocalhost { get; set;}
  54. public string OrderNo { get; set; } = "0";
  55. public string MaterialCode { get; set; }
  56. public string MaterialName { get; set; }
  57. public int PlannedQuantity { get; set; }
  58. public int CompletedQuantity { get; set; }
  59. public string Status { get; set; }
  60. public string LineCode { get; set; }
  61. public DateTime CreateTime { get; set; }
  62. public DateTime? StartTime { get; set; }
  63. public DateTime? EndTime { get; set; }
  64. }
  65. #endregion
  66. #region 2.2 SN打印请求
  67. public class SnPrintRequest
  68. {
  69. public string plant { get; set; } // 工厂编码
  70. public string workShop { get; set; } // 车间
  71. public string line { get; set; } // 产线
  72. public string station { get; set; } // 工位编码
  73. public string site { get; set; } // 站点编码
  74. public string equipment { get; set; } // 设备编码
  75. public string orderNo { get; set; } // 订单号
  76. public string workOrderNo { get; set; } // 工单号
  77. public int count { get; set; } // 数量
  78. public int printType { get; set; } // 条码类型
  79. public string messageTime { get; set; } // 接口同步时间
  80. }
  81. public class SnInfo
  82. {
  83. [SqlSugar.SugarColumn(IsPrimaryKey = true)]
  84. public string Sn { get; set; } // SN条码
  85. public DateTime GenerateTime { get; set; } // 生成时间
  86. public string WorkOrderNo { get; set; } // 所属工单
  87. public string PrintType { get; set; } // 条码类型
  88. public bool IsUsed { get; set; } = false; // 是否已使用
  89. }
  90. public class SnPrintResponseData
  91. {
  92. public List<SnItem> Sn { get; set; } // SN列表
  93. public string OrderNo { get; set; } // 订单号
  94. public string WorkOrderNo { get; set; } // 工单号
  95. public string Line { get; set; } // 产线
  96. public string VehicleCode { get; set; } // 成品物料编码
  97. public string MaterialDesc { get; set; } // 成品物料名称
  98. }
  99. public class SnItem
  100. {
  101. public string Sn { get; set; }
  102. }
  103. #endregion
  104. #region 2.3 接收SN和关键件
  105. public class SnKeyComponentRequest
  106. {
  107. public string businessTpye { get; set; } = "SCAN_TASK"; // 业务类型
  108. public string plant { get; set; } // 工厂编码
  109. public string workShop { get; set; } // 车间
  110. public string lineCode { get; set; } // 产线
  111. public string stationCode { get; set; } // 工位编码
  112. public string positionCode { get; set; } // 站点编码
  113. public string barcodeBoundProcInfo { get; set; } = "1"; // 绑定关键件加工信息
  114. public string equipment { get; set; } // 设备编码
  115. public string scanTime { get; set; } // 扫描时间
  116. public string taskCode { get; set; } // 任务编码
  117. public string scanTpye { get; set; } = "1"; // 扫描执行类型
  118. public string sn { get; set; } // SN
  119. public string gbCode { get; set; } // 国标码
  120. public string snStatus { get; set; } // 产品状态
  121. public string employee { get; set; } // 人员
  122. public List<PartInfo> part { get; set; } // 关键件信息
  123. }
  124. public class PartInfo
  125. {
  126. public string partNum { get; set; } // 关键件条码
  127. public decimal partQty { get; set; } // 关键件数量
  128. public string materialCode { get; set; } // 关键件物料
  129. public string oldPartNum { get; set; } // 原关键件条码
  130. public string materialType { get; set; } // 关键件类型
  131. public string positionNo { get; set; } // 位置序号
  132. }
  133. public class LocalhostPartInfo : BindableBase
  134. {
  135. private StationType _FormulaType;
  136. private string _PartNum; // 关键件条码
  137. private decimal _PartQty; // 关键件数量
  138. private string _MaterialCode; // 关键件物料
  139. private string _OldPartNum; // 原关键件条码
  140. private string _MaterialType="1"; // 关键件类型
  141. private string _PositionNo=""; // 位置序号
  142. public StationType FormulaType { get => _FormulaType; set { SetProperty(ref _FormulaType, value); } }
  143. public string PartNum { get => _PartNum; set { SetProperty(ref _PartNum, value); } }
  144. public decimal PartQty { get => _PartQty; set { SetProperty(ref _PartQty, value); } }
  145. [SqlSugar.SugarColumn(IsPrimaryKey = true)]
  146. public string MaterialCode { get => _MaterialCode; set { SetProperty(ref _MaterialCode, value); } }
  147. public string OldPartNum { get => _OldPartNum; set { SetProperty(ref _OldPartNum, value); } }
  148. public string MaterialType { get => _MaterialType; set { SetProperty(ref _MaterialType, value); } }
  149. public string PositionNo { get => _PositionNo; set { SetProperty(ref _PositionNo, value); } }
  150. }
  151. public class BindRecord
  152. {
  153. [SqlSugar.SugarColumn(IsPrimaryKey = true,IsIdentity =true)]
  154. public int id { get; set; }
  155. public string Sn { get; set; }
  156. public string PartNum { get; set; }
  157. public string StationCode { get; set; }
  158. public DateTime BindTime { get; set; }
  159. public string Employee { get; set; }
  160. public string ScanType { get; set; }
  161. }
  162. #endregion
  163. #region 2.4 接收工件加工参数
  164. public class ProcessParameterRequest
  165. {
  166. public string businessTpye { get; set; } // 业务类型
  167. public string plant { get; set; } // 工厂编码
  168. public string workShop { get; set; } // 车间
  169. public string line { get; set; } // 产线
  170. public string station { get; set; } // 工位编码
  171. public string site { get; set; } // 站点编码
  172. public string sn { get; set; } // SN
  173. public string barcode { get; set; } // 关键件条码
  174. public string materialCode { get; set; } // 物料号
  175. public string equipment { get; set; } // 设备编号
  176. public string overallResult { get; set; } // 总结果
  177. public List<TightenResult> tightenResultDetail { get; set; } // 拧紧任务结果详情
  178. public List<StepResult> stepResultDetail { get; set; } // 工步任务结果详情
  179. public string reservedField1 { get; set; } // 预留字段1
  180. public string reservedField2 { get; set; } // 预留字段2
  181. public string reservedField3 { get; set; } // 预留字段3
  182. public string messageTime { get; set; } // 接口同步时间
  183. }
  184. public class TightenResult
  185. {
  186. public int point_num { get; set; } // 拧紧序号
  187. public int pset { get; set; } // 拧紧程序编号
  188. public decimal torque { get; set; } // 拧紧扭矩
  189. public decimal angle { get; set; } // 拧紧角度
  190. public string tighten_status { get; set; } // 单次拧紧结果
  191. public string tighten_dt { get; set; } // 拧紧时间
  192. }
  193. public class StepResult
  194. {
  195. public string tagCode { get; set; } // 参数名
  196. public string tagValue { get; set; } // 实际值
  197. public string tagRage { get; set; } // 参数上下限范围
  198. public string tagResult { get; set; } // 参数结果
  199. public string tagUnit { get; set; } // 参数单位
  200. public List<NgCodeInfo> ngCode { get; set; } // 异常代码
  201. }
  202. public class NgCodeInfo
  203. {
  204. public string ngCode { get; set; } // 异常代码
  205. public string ngDes { get; set; } // 异常描述
  206. }
  207. public class ProcessRecord
  208. {
  209. public string Sn { get; set; }
  210. public string Station { get; set; }
  211. public string OverallResult { get; set; }
  212. public DateTime ProcessTime { get; set; }
  213. public string Equipment { get; set; }
  214. }
  215. #endregion
  216. #region
  217. /// <summary>
  218. /// 生产数据
  219. /// </summary>
  220. public class ProductionToStation : BindableBase
  221. {
  222. private Guid _id = Guid.NewGuid();
  223. private string _SN;
  224. private string _PartNum;
  225. private DateTime _CreateTime;
  226. private string _FormulaName;
  227. private FormulaPartType _formulaPart;
  228. private string _Result;
  229. private List<ResultInfo> _resultContent = new List<ResultInfo>();
  230. public Guid Id { get => _id; set { SetProperty(ref _id, value); } }
  231. public DateTime CreateTime { get => _CreateTime; set { SetProperty(ref _CreateTime, value); } }
  232. public string FormulaName { get => _FormulaName; set { SetProperty(ref _FormulaName, value); } }
  233. public FormulaPartType FormulaPart { get => _formulaPart; set { SetProperty(ref _formulaPart, value); } }
  234. public string Result { get => _Result; set { SetProperty(ref _Result, value); } }
  235. [SqlSugar.SugarColumn(IsJson = true, ColumnDataType = "nvarchar(2000)")]//必填
  236. public List<ResultInfo> ResultContent { get => _resultContent; set { SetProperty(ref _resultContent, value); } }
  237. public string SN { get => _SN; set { SetProperty(ref _SN, value); } }
  238. public string PartNum { get => _PartNum; set { SetProperty(ref _PartNum, value); } }
  239. }
  240. public class ParkingLot : BindableBase
  241. {
  242. private int _id = 0;
  243. private StationType _FormulaType;
  244. private string _SerialNumber;
  245. private string _PartNumber;
  246. private string _PartName;
  247. private string _PlanNum;
  248. private string _UseNum;
  249. private int _CompletedNum;
  250. public StationType FormulaType { get => _FormulaType; set { SetProperty(ref _FormulaType, value); } }
  251. /// <summary>
  252. /// 序号
  253. /// </summary>
  254. public string SerialNumber { get => _SerialNumber; set { SetProperty(ref _SerialNumber, value); } }
  255. /// <summary>
  256. /// 零件号
  257. /// </summary>
  258. public string PartNumber { get => _PartNumber; set { SetProperty(ref _PartNumber, value); } }
  259. /// <summary>
  260. /// 零件名称
  261. /// </summary>
  262. public string PartName { get => _PartName; set { SetProperty(ref _PartName, value); } }
  263. /// <summary>
  264. /// 计划数量
  265. /// </summary>
  266. public string PlanNum { get => _PlanNum; set { SetProperty(ref _PlanNum, value); } }
  267. /// <summary>
  268. /// 使用数量
  269. /// </summary>
  270. public string UseNum { get => _UseNum; set { SetProperty(ref _UseNum, value); } }
  271. /// <summary>
  272. /// 已完成数量
  273. /// </summary>
  274. public int CompletedNum { get => _CompletedNum; set { SetProperty(ref _CompletedNum, value); } }
  275. [SqlSugar.SugarColumn(IsPrimaryKey = true,IsIdentity =true)]
  276. public int Id { get => _id; set { SetProperty(ref _id, value); } }
  277. }
  278. public class ResultInfo : BindableBase
  279. {
  280. private string resultName;
  281. private string resultValue;
  282. private string result;
  283. public string ResultName { get => resultName; set { SetProperty(ref resultName, value); } }
  284. public string ResultValue { get => resultValue; set { SetProperty(ref resultValue, value); } }
  285. public string Result { get => result; set { SetProperty(ref result, value); } }
  286. }
  287. #endregion
  288. }