MesModel.cs 15 KB

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