| | |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_QuartzJob.DTO; |
| | | using WIDESEAWCS_QuartzJob.Service; |
| | | using WIDESEAWCS_Tasks.ProductionLineJob; |
| | | using WIDESEAWCS_Tasks.StackerCraneJob; |
| | |
| | | { |
| | | try |
| | | { |
| | | //ProductionLineDTO MaterielGroupDTO = new ProductionLineDTO() |
| | | //{ |
| | | // stationCode = "MDX01", |
| | | // traytype = 4, |
| | | // Barcode = "25" + i.ToString("000000"), |
| | | // batchNo = "20250222T3", |
| | | //}; |
| | | //var content = ProductionLineToWMSRequest(MaterielGroupDTO); |
| | | //i++; |
| | | #region MyRegion |
| | | //OtherDevice ProductionLine = (OtherDevice)context.JobDetail.JobDataMap.Get("JobParams"); |
| | | //if (ProductionLine != null) |
| | | //{ |
| | | // var request = ProductionLine.GetValue<ProductionLineDBName, short>(ProductionLineDBName.request); |
| | | // if (request == 1) |
| | | // { |
| | | // var traytype = ProductionLine.GetValue<ProductionLineDBName, short>(ProductionLineDBName.trayType); |
| | | // //var content = Request(ProductionLine, traytype, ProductionLine.DeviceCode); |
| | | // if (traytype == 4) |
| | | // { |
| | | // var Barcode = ProductionLine.GetValue<ProductionLineDBName, string>(ProductionLineDBName.trayBarcode); |
| | | // var batchNo = ProductionLine.GetValue<ProductionLineDBName, string>(ProductionLineDBName.batchNo); |
| | | // ProductionLineDTO MaterielGroupDTO = new ProductionLineDTO() |
| | | // { |
| | | // stationCode = ProductionLine.DeviceCode, |
| | | // traytype = traytype, |
| | | // Barcode = Barcode, |
| | | // batchNo = batchNo, |
| | | // }; |
| | | // var content = ProductionLineToWMSRequest(MaterielGroupDTO); |
| | | // if (content.Status) ProductionLine.SetValue(ProductionLineDBName.Wrequest, 1); |
| | | // } |
| | | // } |
| | | //} |
| | | #endregion |
| | | #region MyRegion |
| | | //short[] shorts = { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }; |
| | | //ProductionLineDTO MaterielGroupDTO = new ProductionLineDTO() |
| | | //{ |
| | | // Barcode = "A1001", |
| | | // batchNo = "20241212001T1", |
| | | // stationCode = "Z1", |
| | | // productQty = string.Join(",", shorts), |
| | | // traytype = 4 |
| | | //}; |
| | | //ProductionLineToWMSRequest(MaterielGroupDTO); |
| | | //if (ProductionLine != null) |
| | | //{ |
| | | // switch (ProductionLine.DeviceName) |
| | | // { |
| | | // case "å
¥åºäº§çº¿": |
| | | // ProductionLineIn(ProductionLine); |
| | | // break; |
| | | // case "åºåºäº§çº¿": |
| | | // ProductionLineOut(ProductionLine); |
| | | // break; |
| | | // default: |
| | | // throw new Exception("æªå®ä¹äº§çº¿"); |
| | | // } |
| | | //} |
| | | OtherDevice ProductionLine = (OtherDevice)context.JobDetail.JobDataMap.Get("JobParams"); |
| | | if (ProductionLine != null) |
| | | { |
| | | //ProductionLineDTO MaterielGroupDTO = new ProductionLineDTO() |
| | | //{ |
| | | // stationCode = ProductionLine.DeviceCode, |
| | | // traytype = 4, |
| | | // Barcode = "25000037", |
| | | // batchNo = "250325T1", |
| | | //}; |
| | | //var content = ProductionLineToWMSRequest(MaterielGroupDTO); |
| | | #region MyRegion |
| | | var request = ProductionLine.GetValue<ProductionLineDBName, short>(ProductionLineDBName.request); |
| | | if (request == 1) |
| | | { |
| | | var traytype = ProductionLine.GetValue<ProductionLineDBName, short>(ProductionLineDBName.trayType); |
| | | //var content = Request(ProductionLine, traytype, ProductionLine.DeviceCode); |
| | | if (traytype == 4) |
| | | { |
| | | var Barcode = ProductionLine.GetValue<ProductionLineDBName, string>(ProductionLineDBName.trayBarcode).Replace("\0", ""); |
| | | var task = _taskRepository.QueryFirst(x => x.PalletCode == Barcode); |
| | | if (task == null) |
| | | { |
| | | var batchNo = ProductionLine.GetValue<ProductionLineDBName, string>(ProductionLineDBName.batchNo).Replace("\0", ""); |
| | | ProductionLineDTO MaterielGroupDTO = new ProductionLineDTO() |
| | | { |
| | | stationCode = ProductionLine.DeviceCode, |
| | | traytype = traytype, |
| | | Barcode = Barcode, |
| | | batchNo = batchNo, |
| | | }; |
| | | var content = ProductionLineToWMSRequest(MaterielGroupDTO); |
| | | if (content.Status) |
| | | ProductionLine.SetValue(ProductionLineDBName.Wrequest, request); |
| | | } |
| | | } |
| | | } |
| | | #endregion |
| | | } |
| | | #endregion |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //Console.Out.WriteLine(nameof(CommonProductionLineJob) + ":" + ex.ToString()); |
| | | Console.Out.WriteLine(nameof(CommonProductionLineJob) + ":" + ex.ToString()); |
| | | } |
| | | return Task.CompletedTask; |
| | | } |
| | | |
| | | public string GetString<TEnum, TResult>(TEnum value, OtherDevice ProductionLine) where TEnum : Enum |
| | | { |
| | | TEnum value2 = value; |
| | | if (!ProductionLine.IsConnected) |
| | | { |
| | | throw new Exception("éè®¯è¿æ¥é误ï¼è¯·æ£æ¥ç½ç»"); |
| | | } |
| | | DeviceProDTO deviceProDTO = ProductionLine.DeviceProDTOs.FirstOrDefault((DeviceProDTO x) => x.DeviceProParamName == value2.ToString()); |
| | | if (deviceProDTO != null) |
| | | { |
| | | return Encoding.ASCII.GetString(ProductionLine.Communicator.Read(deviceProDTO.DeviceProAddress, deviceProDTO.DeviceProDataLength)).Replace("\0", ""); |
| | | //return (TResult)Communicator.ReadAsObj(deviceProDTO.DeviceProAddress, deviceProDTO.DeviceDataType); |
| | | } |
| | | throw new Exception("è¯»åæ°æ®é误,æªå¨å议信æ¯é颿¾å°åæ°" + value2.ToString()); |
| | | } |
| | | } |
| | | } |