| | |
| | | } |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// AGVä»»å¡ |
| | | /// </summary> |
| | | public void agvtask(Idt_stationinfoRepository stationinfoRepository, dt_stationinfo stationinfo, VV_Mes_Workinfo Work, string tasktype) |
| | | { |
| | | VOLContext Context = new VOLContext(); |
| | | Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(Context); |
| | | Idt_mes_headRepository mes_HeadRepository = new dt_mes_headRepository(Context); |
| | | |
| | | var task = agvtaskRepository.Find(x => x.agv_fromaddress == stationinfo.stationCode).FirstOrDefault(); |
| | | if (task != null) return; |
| | | //var mes_Head = mes_HeadRepository.Find(x => x.jobID == Work.jobID).FirstOrDefault(); |
| | | //if (mes_Head == null) |
| | | //{ |
| | | // stationinfo.remark = "触åå
¥åºä»»å¡,使ªæ¾å°å·¥å头表ï¼"; |
| | | // stationinfo.location_state = LocationStateEnum.Abnormal.ToString(); |
| | | // stationinfoRepository.Update(stationinfo, true); |
| | | // return; |
| | | //} |
| | | |
| | | dt_stationinfo TargetLocation = null; |
| | | //int CompeletedNum = Convert.ToInt32(mes_Head.quantity) - Convert.ToInt32(mes_Head.finishNum); |
| | | //if (mes_Head.quantity <= 50) tasktype = "TaskType_OutsourceInbound"; |
| | | |
| | | if (tasktype == "TaskType_OutsourceInbound" || !string.IsNullOrEmpty(Work.area)) |
| | | TargetLocation = StationTask.GetEmptyLocation(stationinfoRepository); |
| | | else if (tasktype == "TaskType_Inbound") |
| | | TargetLocation = GetLocation.GetEmptyLocation(stationinfoRepository, Work, stationinfo); |
| | | //TargetLocation = GetLocation.GetEmptyLocation(stationinfoRepository, mes_Head, stationinfo); |
| | | if (TargetLocation != null) |
| | | { |
| | | dt_agvtask agvtask = new dt_agvtask() |
| | | { |
| | | agv_fromaddress = stationinfo.stationCode, |
| | | agv_id = Guid.NewGuid(), |
| | | agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"), |
| | | agv_grade = 1, |
| | | agv_createtime = DateTime.Now, |
| | | agv_taskstate = "Create", |
| | | agv_materielid = stationinfo.stationType, |
| | | agv_qty = stationinfo.quantity, |
| | | agv_tasktype = tasktype, |
| | | agv_toaddress = TargetLocation.stationCode, |
| | | agv_userid = "ç³»ç»", |
| | | bindSN = stationinfo.bindSN, |
| | | agv_worktype = Convert.ToInt32(Work.processCode), |
| | | agv_materbarcode = Work.materialCode, |
| | | agv_Traytype = stationinfo.tray_type, |
| | | jobID = stationinfo.Number, |
| | | agv_TrayStatus = stationinfo.tray_status |
| | | }; |
| | | agvtaskRepository.Add(agvtask, true); |
| | | stationinfo.location_state = LocationStateEnum.InBusy.ToString(); |
| | | stationinfoRepository.Update(stationinfo, true); |
| | | TargetLocation.location_state = LocationStateEnum.InBusy.ToString(); |
| | | TargetLocation.stationType = agvtask.agv_materielid; |
| | | TargetLocation.heatNumber = stationinfo.heatNumber; |
| | | TargetLocation.Number = agvtask.jobID; |
| | | stationinfoRepository.Update(TargetLocation, true); |
| | | } |
| | | if (!string.IsNullOrEmpty(Work.area)) |
| | | tasktype = "TaskType_OutsourceInbound"; |
| | | AGVTask.AddQueueTask(stationinfoRepository, agvtaskRepository, stationinfo, tasktype, Work); |
| | | } |
| | | |
| | | #region MyRegion |
| | | /// <summary> |
| | | /// AGVä»»å¡ |
| | | /// </summary> |
| | | //public void agvtask(Idt_stationinfoRepository stationinfoRepository, dt_stationinfo stationinfo, VV_Mes_Workinfo Work, string tasktype) |
| | | //{ |
| | | // VOLContext Context = new VOLContext(); |
| | | // Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(Context); |
| | | // Idt_mes_headRepository mes_HeadRepository = new dt_mes_headRepository(Context); |
| | | |
| | | // var task = agvtaskRepository.Find(x => x.agv_fromaddress == stationinfo.stationCode).FirstOrDefault(); |
| | | // if (task != null) return; |
| | | // //var mes_Head = mes_HeadRepository.Find(x => x.jobID == Work.jobID).FirstOrDefault(); |
| | | // //if (mes_Head == null) |
| | | // //{ |
| | | // // stationinfo.remark = "触åå
¥åºä»»å¡,使ªæ¾å°å·¥å头表ï¼"; |
| | | // // stationinfo.location_state = LocationStateEnum.Abnormal.ToString(); |
| | | // // stationinfoRepository.Update(stationinfo, true); |
| | | // // return; |
| | | // //} |
| | | |
| | | // dt_stationinfo TargetLocation = null; |
| | | // //int CompeletedNum = Convert.ToInt32(mes_Head.quantity) - Convert.ToInt32(mes_Head.finishNum); |
| | | // //if (mes_Head.quantity <= 50) tasktype = "TaskType_OutsourceInbound"; |
| | | |
| | | // if (tasktype == "TaskType_OutsourceInbound" || !string.IsNullOrEmpty(Work.area)) |
| | | // TargetLocation = StationTask.GetEmptyLocation(stationinfoRepository); |
| | | // else if (tasktype == "TaskType_Inbound") |
| | | // TargetLocation = GetLocation.GetEmptyLocation(stationinfoRepository, Work, stationinfo); |
| | | // //TargetLocation = GetLocation.GetEmptyLocation(stationinfoRepository, mes_Head, stationinfo); |
| | | // if (TargetLocation != null) |
| | | // { |
| | | // dt_agvtask agvtask = new dt_agvtask() |
| | | // { |
| | | // agv_fromaddress = stationinfo.stationCode, |
| | | // agv_id = Guid.NewGuid(), |
| | | // agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"), |
| | | // agv_grade = 1, |
| | | // agv_createtime = DateTime.Now, |
| | | // agv_taskstate = "Create", |
| | | // agv_materielid = stationinfo.stationType, |
| | | // agv_qty = stationinfo.quantity, |
| | | // agv_tasktype = tasktype, |
| | | // agv_toaddress = TargetLocation.stationCode, |
| | | // agv_userid = "ç³»ç»", |
| | | // bindSN = stationinfo.bindSN, |
| | | // agv_worktype = Convert.ToInt32(Work.processCode), |
| | | // agv_materbarcode = Work.materialCode, |
| | | // agv_Traytype = stationinfo.tray_type, |
| | | // jobID = stationinfo.Number, |
| | | // agv_TrayStatus = stationinfo.tray_status |
| | | // }; |
| | | // agvtaskRepository.Add(agvtask, true); |
| | | // stationinfo.location_state = LocationStateEnum.InBusy.ToString(); |
| | | // stationinfoRepository.Update(stationinfo, true); |
| | | // TargetLocation.location_state = LocationStateEnum.InBusy.ToString(); |
| | | // TargetLocation.stationType = agvtask.agv_materielid; |
| | | // TargetLocation.heatNumber = stationinfo.heatNumber; |
| | | // TargetLocation.Number = agvtask.jobID; |
| | | // stationinfoRepository.Update(TargetLocation, true); |
| | | // } |
| | | //} |
| | | #endregion |
| | | |
| | | } |
| | | } |