From a765da90e5ee63e04d2d8460a5ad1ebd0e8eb4db Mon Sep 17 00:00:00 2001 From: huanghongfeng <huanghongfeng@hnkhzn.com> Date: 星期一, 15 七月 2024 21:43:59 +0800 Subject: [PATCH] 工单处理 --- 代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/StationTask.cs | 77 ++++++++------------------------------ 1 files changed, 17 insertions(+), 60 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/StationTask.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/StationTask.cs" index c2f4dce..8b52c8e 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/StationTask.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/StationTask.cs" @@ -54,19 +54,28 @@ //鏍规嵁涓嬫枡鍙g殑缁戝畾淇℃伅鏌ヨ瀵瑰簲宸ュ崟锛屾娴嬫宸ュ崟鏄惁宸插畬鎴� 瀹屾垚鍗冲彲灏嗗叾閫佸叆搴� - var work = workinfoRepository.Find(x => x.workOrder == item.Number && x.drawingNo == item.stationType && x.heatID == item.heatNumber && x.processCode == "17").FirstOrDefault(); + var work = workinfoRepository.Find(x => x.workOrder == item.Number && x.drawingNo == item.stationType && x.heatID == item.heatNumber && x.processCode == "17").OrderByDescending(x => x.CreateTime).FirstOrDefault(); if (work == null) { item.remark = "瑙﹀彂鍏ュ簱浠诲姟,浣嗘湭鎵惧埌宸ュ崟淇℃伅锛�"; item.location_state = LocationStateEnum.Abnormal.ToString(); - stationinfoRepository.Update(item, true); + stationinfoRepository.Update(item, x => new { x.remark, x.location_state }, true); + continue; + } + var geometry = Pipeline.QueryMateriel(work.drawingNo); + if (geometry == null) + { + item.remark = "鏈壘鍒拌溅杞俊鎭紒"; + item.location_state = LocationStateEnum.Abnormal.ToString(); + stationinfoRepository.Update(item, x => new { x.remark, x.location_state }, true); continue; } dt_stationinfo TargetLocation = null; string tasktype = ""; - if (item.quantity == 5) + //if (item.quantity == 5) + if (item.quantity == geometry.stackNoRange) { if (!string.IsNullOrEmpty(work.area) || item.stationCode.Contains("3")) tasktype = "TaskType_OutsourceInbound"; @@ -74,58 +83,6 @@ tasktype = "TaskType_Inbound"; AGVTask.AddQueueTask(stationinfoRepository, agvtaskRepository, item, tasktype, work); - - #region MyRegion - //if (/*(mesinfo.quantity <= 50 &&*/ !string.IsNullOrEmpty(work.area) || item.stationCode.Contains("3")) - //{ - // //todo 瀵绘壘鍙斁璐у鍗忔斁璐у彴 - // tasktype = "TaskType_OutsourceInbound"; - // TargetLocation = GetEmptyLocation(stationinfoRepository); - - //} - //else - //{ - // //todo: 璋冪敤WMS鎺ュ彛鍒涘缓浠诲姟 - // tasktype = "TaskType_Inbound"; - // TargetLocation = GetLocation.GetEmptyLocation(stationinfoRepository, work, item); - //} - //if (TargetLocation != null) - //{ - // dt_agvtask agvtask = new dt_agvtask() - // { - // agv_fromaddress = item.stationCode, - // agv_id = Guid.NewGuid(), - // agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"), - // agv_grade = 1, - // agv_createtime = DateTime.Now, - // agv_taskstate = "Create", - // agv_materielid = item.stationType, - // agv_qty = item.quantity, - // agv_tasktype = tasktype, - // agv_toaddress = TargetLocation.stationCode, - // agv_userid = "绯荤粺", - // bindSN = item.bindSN, - // agv_worktype = Convert.ToInt32(work.processCode), - // agv_materbarcode = work.materialCode, - // agv_Traytype = item.tray_type, - // jobID = item.Number, - // agv_TrayStatus = item.tray_status - // }; - // agvtaskRepository.Add(agvtask, true); - - // item.location_state = LocationStateEnum.InBusy.ToString(); - // stationinfoRepository.Update(item, true); - - // TargetLocation.location_state = LocationStateEnum.InBusy.ToString(); - // TargetLocation.stationType = agvtask.agv_materielid; - // TargetLocation.heatNumber = item.heatNumber; - // TargetLocation.billetID = item.billetID; - // TargetLocation.Number = agvtask.jobID; - // stationinfoRepository.Update(TargetLocation, true); - // WriteDBLog.Success("鍒涘缓鍏ュ簱浠诲姟", $"浠诲姟缂栧彿锛歿agvtask.agv_tasknum}", "PCS"); - //} - #endregion - } } } @@ -408,17 +365,17 @@ if (!Pipeline_client.IsConnected) throw new Exception("涓庨摼鏉℃満杩炴帴瓒呮椂锛�"); foreach (var item in target) { - TargetLocation = stationinfoRepository.Find(x => x.stationCode == item && x.location_state == "Empty" /*LocationStateEnum.Empty.ToString()*/ && x.enable).FirstOrDefault(); + TargetLocation = stationinfoRepository.Find(x => x.stationCode == item && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).FirstOrDefault(); var PalletSignal = Pipeline_client.ReadByOrder<Int16>("R_PalletSignal", item);//璇诲彇鎵樼洏淇″彿:1:鏈�,2鏃� var MaterialSignal = Pipeline_client.ReadByOrder<Int16>("R_MaterialSignal", item);//璇诲彇璐х墿淇″彿:1:鏈�,2鏃� if (TargetLocation != null && PalletSignal == 2 && MaterialSignal == 2) return TargetLocation; } - if (TargetLocation == null) - { - throw new Exception("澶栧崗鍏ュ簱鍙e凡婊�"); - } + //if (TargetLocation == null) + //{ + // throw new Exception("澶栧崗鍏ュ簱鍙e凡婊�"); + //} return TargetLocation; } /// <summary> -- Gitblit v1.9.3