/// <summary> /// 执行命令。 /// </summary> public override void Run() { //遍历工作台中已经打开的视图对象。 foreach (IViewContent viewContent in WorkbenchSingleton.Workbench.ViewContentCollection) { //如果已打开视图,则选中该视图显示,返回以结束该方法的运行。 LotOperationViewContent openView = viewContent as LotOperationViewContent; if (openView != null && openView.OperationType == LotOperationType.CellScrap) { openView.WorkbenchWindow.SelectWindow(); return; } } LotOperationDetailModel model = new LotOperationDetailModel(); model.OperationType = LotOperationType.CellScrap; //显示电池片操作明细界面。 WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.CloseWindow(false); //创建新的视图并显示 LotOperationDetailViewContent view = new LotOperationDetailViewContent(model); WorkbenchSingleton.Workbench.ShowView(view); ////创建新的视图对象,并显示该视图界面。 //LotOperationViewContent view = new LotOperationViewContent(LotOperationType.CellScrap); //WorkbenchSingleton.Workbench.ShowView(view); }
/// <summary> /// 关闭按钮事件。 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsbCancle_Click(object sender, EventArgs e) { //WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.CloseWindow(false); ////遍历工作台中已经打开的视图对象。 //foreach (IViewContent viewContent in WorkbenchSingleton.Workbench.ViewContentCollection) //{ // //如果已打开创建批次的视图,则选中该视图显示,返回以结束该方法的运行。 // if (viewContent is LotOperation && viewContent.TitleName==this.lblMenu.Name) // { // viewContent.WorkbenchWindow.SelectWindow(); // return; // } //} ////重新打开批次创建视图。 //LotOperationViewContent view = new LotOperationViewContent(this._model.OperationType); //WorkbenchSingleton.Workbench.ShowView(view); //遍历工作台中已经打开的视图对象。 foreach (IViewContent viewContent in WorkbenchSingleton.Workbench.ViewContentCollection) { //如果已打开视图,则选中该视图显示,返回以结束该方法的运行。 LotOperationViewContent openView = viewContent as LotOperationViewContent; if (openView != null && openView.OperationType == LotOperationType.Rework) { openView.WorkbenchWindow.SelectWindow(); return; } } LotOperationDetailModel model = new LotOperationDetailModel(); if (_model.OperationType == LotOperationType.Rework) { model.OperationType = LotOperationType.Rework; } else { if (_model.OperationType == LotOperationType.BatchRework) { model.OperationType = LotOperationType.BatchRework; } } //显示电池片操作明细界面。 WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.CloseWindow(false); //创建新的视图并显示 LotOperationDetailViewContent view = new LotOperationDetailViewContent(model); WorkbenchSingleton.Workbench.ShowView(view); }
/// <summary> /// 进行批次操作。 /// </summary> private void Operate() { string roomKey = Convert.ToString(this.lueFactoryRoom.EditValue); string roomName = this.lueFactoryRoom.Text.Trim(); string lotNumber = this.beLotNumber.Text.Trim(); //车间没有选择,给出提示。 if (string.IsNullOrEmpty(roomKey)) { MessageService.ShowMessage(StringParser.Parse("${res:FanHai.Hemera.Addins.WIP.LotDispatch.Msg004}"), MESSAGEBOX_CAPTION);//车间名称不能为空 //MessageService.ShowMessage("车间名称不能为空","提示"); this.lueFactoryRoom.Select(); return; } //批号没有输入,给出提示。 if (string.IsNullOrEmpty(lotNumber)) { MessageService.ShowMessage(StringParser.Parse("${res:FanHai.Hemera.Addins.WIP.LotDispatch.Msg008}"), MESSAGEBOX_CAPTION);//序列号不能为空 //MessageService.ShowMessage("序列号不能为空","提示"); this.beLotNumber.SelectAll(); return; } DataSet dsLot = this._entity.GetLotInfo(lotNumber); if (!string.IsNullOrEmpty(this._entity.ErrorMsg)) { MessageService.ShowMessage(this._entity.ErrorMsg, "提示"); return; } if (dsLot == null || dsLot.Tables.Count <= 0 || dsLot.Tables[0].Rows.Count <= 0) { MessageService.ShowMessage(StringParser.Parse("${res:FanHai.Hemera.Addins.WIP.LotDispatch.Msg010}"), MESSAGEBOX_CAPTION);//序列号不存在 //MessageService.ShowMessage("序列号不存在。", "提示"); this.beLotNumber.SelectAll(); return; } DataRow drLotInfo = dsLot.Tables[0].Rows[0]; //判断批次号在指定车间中是否存在。 string currentRoomKey = Convert.ToString(drLotInfo[POR_LOT_FIELDS.FIELD_FACTORYROOM_KEY]); if (roomKey != currentRoomKey) { MessageService.ShowMessage(string.Format("【{0}】在当前车间中不存在,请确认。", lotNumber), "提示"); this.beLotNumber.SelectAll(); return; } //判断批次是否被暂停 int holdFlag = Convert.ToInt32(drLotInfo[POR_LOT_FIELDS.FIELD_HOLD_FLAG]); if (holdFlag == 1 && this._operationType != LotOperationType.BatchRelease && this._operationType != LotOperationType.Release && this._operationType != LotOperationType.Rework && this._operationType != LotOperationType.BatchRework) { MessageService.ShowMessage(string.Format("【{0}】已被暂停,请确认。", lotNumber), "提示"); this.beLotNumber.SelectAll(); return; } if (holdFlag == 0 && (this._operationType == LotOperationType.BatchRelease || this._operationType == LotOperationType.Release || this._operationType == LotOperationType.Rework || this._operationType == LotOperationType.BatchRework)) { MessageService.ShowMessage(string.Format("【{0}】未暂停,请确认。", lotNumber), "提示"); this.beLotNumber.SelectAll(); return; } //判断批次是否被暂停 string lotType = Convert.ToString(drLotInfo[POR_LOT_FIELDS.FIELD_LOT_TYPE]); if (lotType == "N" && (this._operationType == LotOperationType.CellPatch || this._operationType == LotOperationType.CellRecovered)) { MessageService.ShowMessage(string.Format("批次必须是组件补片批次,请确认。"), "提示"); this.beLotNumber.SelectAll(); return; } //判断批次是否被删除 int deleteFlag = Convert.ToInt32(drLotInfo[POR_LOT_FIELDS.FIELD_DELETED_TERM_FLAG]); if (deleteFlag == 1) { MessageService.ShowMessage(string.Format("【{0}】已结束,请确认。", lotNumber), "提示"); this.beLotNumber.SelectAll(); return; } //判断批次是否已结束 if (deleteFlag == 2) { MessageService.ShowMessage(string.Format("【{0}】已删除,请确认。", lotNumber), "提示"); this.beLotNumber.SelectAll(); return; } //判断批次是否完成。 int stateFlag = Convert.ToInt32(drLotInfo[POR_LOT_FIELDS.FIELD_STATE_FLAG]); if (stateFlag >= 10) { MessageService.ShowMessage(StringParser.Parse("${res:FanHai.Hemera.Addins.WIP.LotOperation.Msg001}"));//批次已完成,请确认 //MessageBox.Show("批次已完成,请确认。"); this.beLotNumber.SelectAll(); return; } string palletNo = Convert.ToString(drLotInfo[POR_LOT_FIELDS.FIELD_PALLET_NO]); //如果是返修、不良、报废、批次退料、调整批次、拆分批次、合并批次或者终结批次操作。 //批次不能被包装才能进行对应操作。 if ((this._operationType == LotOperationType.Scrap || this._operationType == LotOperationType.Defect || this._operationType == LotOperationType.BatchRework || this._operationType == LotOperationType.ReturnMaterial || this._operationType == LotOperationType.Rework || this._operationType == LotOperationType.Adjust || this._operationType == LotOperationType.BatchAdjust || this._operationType == LotOperationType.Terminal || this._operationType == LotOperationType.Split || this._operationType == LotOperationType.Merge) && !string.IsNullOrEmpty(palletNo)) { MessageService.ShowMessage(string.Format("【{0}】已包装,出托后才能进行对应操作。", lotNumber), "提示"); this.beLotNumber.SelectAll(); return; } LotOperationDetailModel model = new LotOperationDetailModel(); model.OperationType = this._operationType; model.LotNumber = lotNumber; model.RoomKey = roomKey; model.RoomName = roomName; model.ShiftName = Convert.ToString(this.lueShift.EditValue); model.UserName = this.teUserNumber.Text; model.LotEditTime = Convert.ToString(dsLot.Tables[0].Rows[0][POR_LOT_FIELDS.FIELD_EDIT_TIME]); //model.TitleName = this.lblApplicationTitle.Text; //显示结束批次对话框。 if (this._operationType == LotOperationType.Terminal) { TerminalLotDialog terminalLot = new TerminalLotDialog(model); //显示结束批次的对话框。 terminalLot.ShowDialog(); } else { //显示电池片操作明细界面。 WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.CloseWindow(false); //创建新的视图并显示 LotOperationDetailViewContent view = new LotOperationDetailViewContent(model); view.Control.Size = new Size(1000, 500); WorkbenchSingleton.Workbench.ShowView(view); } }