| | |
| | | |
| | | //æ ¹æ®ä¸æå£çç»å®ä¿¡æ¯æ¥è¯¢å¯¹åºå·¥åï¼æ£æµæ¤å·¥åæ¯å¦å·²å®æ 宿å³å¯å°å
¶éå
¥åº |
| | | |
| | | var work = workinfoRepository.Find(x => x.workOrder == item.Number && x.drawingNo == x.drawingNo && x.heatID == item.heatNumber).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_mes_head mesinfo = mes_HeadRepository.Find(x => x.workOrder == item.Number).FirstOrDefault(); |
| | | //if (mesinfo == null) |
| | | //{ |
| | | // item.remark = "触åå
¥åºä»»å¡,使ªæ¾å°å·¥å头表ï¼"; |
| | | // item.location_state = LocationStateEnum.Abnormal.ToString(); |
| | | // stationinfoRepository.Update(item, true); |
| | | // continue; |
| | | // //throw new Exception("æªæ¾å°å·¥å头表ï¼å·¥åå·ï¼" + item.Number); |
| | | //} |
| | | //var dt_Geometry_Data = PipelineJob.QueryMateriel(mesinfo.drawingNo); |
| | | //var dt_Geometry_Data1 = PipelineJob.QueryMateriel1(mesinfo.drawingNo); |
| | | |
| | | //int CompeletedNum = Convert.ToInt32(mesinfo.quantity) - Convert.ToInt32(mesinfo.finishNum); |
| | | |
| | | |
| | | |
| | | dt_stationinfo TargetLocation = null; |
| | | string tasktype = ""; |
| | | if (item.quantity == 5 /*|| CompeletedNum == 0*/) //循ç¯è¯»å车轮æ°ä¸º5æè
订å已宿æ°éçä¸æå£ âå·¥å人工å
³éçå·¥å |
| | | |
| | | //if (item.quantity == 5) |
| | | if (item.quantity == geometry.stackNoRange) |
| | | { |
| | | |
| | | |
| | | if (/*(mesinfo.quantity <= 50 && string.IsNullOrEmpty(mesinfo.area)) ||*/ item.stationCode.Contains("3")) //å°äº50ä»¶ç´æ¥åºåº |
| | | { |
| | | //todo 寻æ¾å¯æ¾è´§å¤åæ¾è´§å° |
| | | if (!string.IsNullOrEmpty(work.area) || item.stationCode.Contains("3")) |
| | | tasktype = "TaskType_OutsourceInbound"; |
| | | TargetLocation = GetEmptyLocation(stationinfoRepository); |
| | | |
| | | } |
| | | else |
| | | { |
| | | //todo: è°ç¨WMSæ¥å£åå»ºä»»å¡ |
| | | tasktype = "TaskType_Inbound"; |
| | | TargetLocation = GetLocation.GetEmptyLocation(stationinfoRepository, work, item); |
| | | //TargetLocation = GetEmptyLocation(stationinfoRepository, mesinfo, item, CompeletedNum, dt_Geometry_Data == null ? dt_Geometry_Data1.e : dt_Geometry_Data.e); |
| | | } |
| | | 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.Number = agvtask.jobID; |
| | | stationinfoRepository.Update(TargetLocation, true); |
| | | WriteDBLog.Success("å建å
¥åºä»»å¡", $"ä»»å¡ç¼å·ï¼{agvtask.agv_tasknum}", "PCS"); |
| | | } |
| | | AGVTask.AddQueueTask(stationinfoRepository, agvtaskRepository, item, tasktype, work); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | WriteDBLog.Error("å建å
¥åºä»»å¡", $"é误信æ¯ï¼ {ex.Message}", "PCS"); |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | } |
| | | return TargetLocation; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 临æ¶ä½¿ç¨ |
| | | /// </summary> |
| | | /// <param name="stationinfoRepository"></param> |
| | | /// <returns></returns> |
| | | public static dt_stationinfo GetEmptyLocation1(Idt_stationinfoRepository stationinfoRepository) |
| | | { |
| | | return stationinfoRepository.Find(x => x.line == 1 && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == "3").OrderBy(x => x.column).FirstOrDefault();//è¡ååºåéåæ» |
| | | } |
| | | /// <summary> |
| | | /// å»å¤å |
| | | /// </summary> |
| | | /// <param name="stationinfoRepository"></param> |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception"></exception> |
| | | public static dt_stationinfo GetEmptyLocation(Idt_stationinfoRepository stationinfoRepository) |
| | | { |
| | | dt_stationinfo TargetLocation = null; |
| | |
| | | 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("å¤åå
¥åºå£å·²æ»¡"); |
| | | } |
| | | //if (TargetLocation == null) |
| | | //{ |
| | | // throw new Exception("å¤åå
¥åºå£å·²æ»¡"); |
| | | //} |
| | | return TargetLocation; |
| | | } |
| | | /// <summary> |