| | |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using Autofac.Core; |
| | | using HslCommunication.WebSocket; |
| | | using Microsoft.AspNetCore.Components; |
| | | using Quartz; |
| | | using SqlSugar; |
| | | using WIDESEA_Model.Models.Basic; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core.BaseRepository; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_DTO.MES; |
| | | using WIDESEAWCS_DTO.Stock; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Model.Models.System; |
| | |
| | | |
| | | private readonly IRepository<Dt_StationManger> _stationMangerRepository; |
| | | private readonly IRepository<Dt_Task> _TaskRepository; |
| | | private readonly IRepository<Dt_FillingOrder> _FillingOrderRepository; |
| | | private readonly ITaskService _ITaskService; |
| | | private static Stock Stock = new Stock(); |
| | | private static bool k = true; |
| | | private static int i = 0; |
| | | |
| | | //夿æ¯å¦æåºåºä¿¡å·åç»WMS |
| | | private static bool m = true; |
| | | private static bool n = true; |
| | | |
| | | //åå¨ä¿¡å· |
| | | private readonly Commands comm = new Commands(); |
| | | |
| | | public ConveyorLineJob(WebSocketServer webSocketServer, IRepository<Dt_StationManger> stationMangerRepository, IRepository<Dt_Task> TaskRepository, ITaskService ITaskService) |
| | | public ConveyorLineJob(WebSocketServer webSocketServer, IRepository<Dt_StationManger> stationMangerRepository, IRepository<Dt_Task> TaskRepository, IRepository<Dt_FillingOrder> FillingOrderRepository, ITaskService ITaskService) |
| | | { |
| | | _stationMangerRepository = stationMangerRepository; |
| | | _TaskRepository = TaskRepository; |
| | | _ITaskService = ITaskService; |
| | | _FillingOrderRepository = FillingOrderRepository; |
| | | } |
| | | |
| | | public Task Execute(IJobExecutionContext context) |
| | |
| | | //åéæ¶å°ç¼å·ä¿¡å· |
| | | device.SetValue(ConveyorLineName.W_ReceivedD, 1, item.StationCode); |
| | | k = true; |
| | | |
| | | //åMESå鿥工å |
| | | if (Stock.MaterialCode1 != null && !Stock.MaterialCode1.Equals("")) |
| | | { |
| | | MESReport(Stock.MaterialCode1); |
| | | } |
| | | if (Stock.MaterialCode2 != null && !Stock.MaterialCode2.Equals("")) |
| | | { |
| | | MESReport(Stock.MaterialCode2); |
| | | } |
| | | if (Stock.MaterialCode3 != null && !Stock.MaterialCode3.Equals("")) |
| | | { |
| | | MESReport(Stock.MaterialCode3); |
| | | } |
| | | if (Stock.MaterialCode4 != null && !Stock.MaterialCode4.Equals("")) |
| | | { |
| | | MESReport(Stock.MaterialCode4); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | n = true; |
| | | } |
| | | } |
| | | //åè¯WMSä¸å¯ä»¥åºåº |
| | | else |
| | | { |
| | | if (n) |
| | |
| | | } |
| | | return Task.CompletedTask; |
| | | } |
| | | |
| | | //MESæ¥å·¥ |
| | | public void MESReport(string MaterialCode) |
| | | { |
| | | try |
| | | { |
| | | Reports reports = new Reports(); |
| | | |
| | | //æ¥è¯¢äºç»´ç |
| | | Dt_FillingOrder FillingOrder = _FillingOrderRepository.QueryFirst(x => x.BarCode == MaterialCode); |
| | | |
| | | reports.report.Qty = FillingOrder.BarNum; |
| | | reports.report.DispatchID = FillingOrder.WorkID + ""; |
| | | reports.barcodeSN[0].Barcode = FillingOrder.BarCode; |
| | | reports.barcodeSN[0].BatchNum = int.Parse(FillingOrder.batchNum); |
| | | reports.barcodeSN[0].Id = FillingOrder.BarCodeID; |
| | | reports.barcodeSN[0].MaterialId = FillingOrder.ArticleNumID; |
| | | reports.barcodeSN[0].Quantity = (int)FillingOrder.BarNum; |
| | | reports.barcodeSN[0].DispatchId = FillingOrder.WorkID; |
| | | |
| | | string mes = AppSettings.Get("WMSApiAddress"); |
| | | if (!string.IsNullOrEmpty(mes)) |
| | | { |
| | | HttpHelper.Post($"{mes}/Task/SaveReportRaw/", reports.Serialize()); |
| | | } |
| | | } |
| | | catch (Exception ex) { |
| | | WriteInfo( "MESæ¥å·¥é误", $"{ex.Message}"); |
| | | } |
| | | } |
| | | } |
| | | } |