public ToolScanGlassID_StockOutViewModel() { this._eventAggregator = ServiceLocator.Current.GetInstance<IEventAggregator>(); _rule = new FormworkRule(); this._eventAggregator.GetEvent<CmdEvent>().Subscribe(param => { switch (param.cmdName) { case CmdName.New: CurrentStockDetail = param.Entity as StockDetail; CurrentStockDetail.DuMoDT = DateTime.Now; IsWu = true; IsDanMian = false; IsShuangMian = false; //CurrentStockDetail.IsPaoGuang = true; if (param.Tag != null && param.Tag.Contains("镀膜")) { IsImgHOLD = true; } else IsImgHOLD = false; string ErrMsg = string.Empty; FormWork fw = _rule.GetFormWorkByProModel(CurrentStockDetail.StockLot.ProModel, ref ErrMsg); _eventAggregator.GetEvent<CmdEvent>().Publish(new CmdEventParam() { cmdName = CmdName.New, Entity = fw, Entity1 = CurrentStockDetail.StockLot, // Tag = param.Tag, Target = "ToolScanGlassID_StockOutView", }); break; case CmdName.SendTag: if ((!string.IsNullOrWhiteSpace(param.Tag)) && CurrentStockDetail.StockLot.ImageHOLD.Contains("镀膜")) { if (string.IsNullOrWhiteSpace(param.Entity.ToString())) { Common.MessageBox.Show("当前已勾选品质信息,所以在图形界面中至少需要勾选一个或以上的单元"); return; } } _eventAggregator.GetEvent<CmdEvent>().Publish(new CmdEventParam() { cmdName = CmdName.Close, Target = "ToolScanGlassID_StockOutView", }); CurrentStockDetail.DuMoImgInfo = param.Entity.ToString(); CurrentStockDetail.DuMoInfo = param.Tag; if (IsWu) CurrentStockDetail.IsPaoGuangOverInfo = "无"; if (IsDanMian) CurrentStockDetail.IsPaoGuangOverInfo = "单面"; if (IsShuangMian) CurrentStockDetail.IsPaoGuangOverInfo = "双面"; _eventAggregator.GetEvent<CmdEvent>().Publish(new CmdEventParam() { cmdName = CmdName.SaveGlassID, Entity = CurrentStockDetail, Target = "StockOutMainViewModel", }); break; } }, ThreadOption.UIThread, true, p => p.Target == "ToolScanGlassID_StockOutViewModel"); }
public ToolScanGlassID_JianBaoViewModel() { this._eventAggregator = ServiceLocator.Current.GetInstance<IEventAggregator>(); _rule = new FormworkRule(); this._eventAggregator.GetEvent<CmdEvent>().Subscribe(param => { switch (param.cmdName) { case CmdName.New: CurrentStockDetail = param.Entity as StockDetail; CurrentStockDetail.JianBaoDT = DateTime.Now; CurrentStockDetail.IsPaoGuang = true; if (param.Tag != null && param.Tag.Contains("减薄")) { IsImgHOLD = true; } else IsImgHOLD = false; IsHOLD = false; string ErrMsg = string.Empty; FormWork fw = _rule.GetFormWorkByProModel(CurrentStockDetail.StockLot.ProModel, ref ErrMsg); _eventAggregator.GetEvent<CmdEvent>().Publish(new CmdEventParam() { cmdName = CmdName.New, Entity = fw, Entity1 = CurrentStockDetail.StockLot, // Tag = param.Tag, Target = "ToolScanGlassID_JianBaoView", }); break; case CmdName.SendTag: if (string.IsNullOrWhiteSpace(CurrentStockDetail.JianBaoNum)) { Common.MessageBox.Show("必须输入减薄槽号"); return; } //如果勾选了品质信息和LOT 具有图片减薄品质信息开关 if ((!string.IsNullOrWhiteSpace(param.Tag)) && CurrentStockDetail.StockLot.ImageHOLD.Contains("减薄")) { if (string.IsNullOrWhiteSpace(param.Entity.ToString())) { Common.MessageBox.Show("当前已勾选品质信息,所以在图形界面中至少需要勾选一个或以上的单元"); return; } } //CF面判断,必须选择至少一项 if (CurrentStockDetail.IsPaoGuang) { if ((!IsTFT) && (!IsCF)) { Common.MessageBox.Show("抛光面至少需要选择一项"); return; } } _eventAggregator.GetEvent<CmdEvent>().Publish(new CmdEventParam() { cmdName = CmdName.Close, Target = "ToolScanGlassID_JianBaoView", }); CurrentStockDetail.IsHOLD = IsHOLD; CurrentStockDetail.JianBaoImgInfo = param.Entity.ToString(); CurrentStockDetail.JianBaoInfo = param.Tag; if (CurrentStockDetail.IsPaoGuang) { if (IsFuFei) CurrentStockDetail.PaoguangType = "付费抛光"; else CurrentStockDetail.PaoguangType = "制程抛光"; string strPaoGuangMian = string.Empty;//抛光面 if (IsTFT) strPaoGuangMian += "TFT面,"; if (IsCF) strPaoGuangMian += "CF面"; CurrentStockDetail.PaoGuangMian = strPaoGuangMian; } _eventAggregator.GetEvent<CmdEvent>().Publish(new CmdEventParam() { cmdName = CmdName.SaveGlassID, Entity = CurrentStockDetail, Target = "Process_JianBaoViewModel", }); break; } //if (CurrentStockLot != null) //{ // if (CurrentStockLot.DetailInfoHOLD != null) // ControlsEnabled = CurrentStockLot.DetailInfoHOLD.Contains("入库"); // else // ControlsEnabled = false; // _eventAggregator.GetEvent<CmdEvent>().Publish(new CmdEventParam() // { // cmdName = CmdName.New, // Target = "ToolScanGlassID_StockInView", // }); //} }, ThreadOption.UIThread, true, p => p.Target == "ToolScanGlassID_JianBaoViewModel"); }