private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == '\r') { tsCompositionContainer = new CompositionContainer(Program.programCatalog); OperationResult operationResult = tsCompositionContainer.GetExportedValue<IFrmTsInputEditService>().TsCompleteCheck(textBox1.Text); Program.programContainer.GetExportedValue<FrmMain>().richTextBox1.AppendText(operationResult.Message + "\r"); if (operationResult.ResultType == OperationResultType.Success) { tsCompleteModel= (TsCompleteModel)operationResult.AppendData; textBox3.Text = tsCompleteModel.ts.mocode; textBox4.Text = tsCompleteModel.ts.itemcode; comboBox1.DataSource = tsCompleteModel.list; int a = comboBox1.FindString(tsCompleteModel.ts.frmroutecode); comboBox1.SelectedIndex = a; int b = comboBox2.FindString(tsCompleteModel.ts.frmopcode); comboBox2.SelectedIndex = b; button1.Enabled = true; } } }
public void TsCompleteConfirm() { var catalog = new AggregateCatalog(); catalog.Catalogs.Add(new DirectoryCatalog(Directory.GetCurrentDirectory())); catalog.Catalogs.Add(new AssemblyCatalog(Assembly.GetExecutingAssembly())); using (var testContainer = new CompositionContainer(catalog)) { TsCompleteModel CompleteModel=new TsCompleteModel(); CompleteModel.moString = Mocode; CompleteModel.routeString = RouteCode; CompleteModel.opString = OpCode; CompleteModel.ts =testContainer.GetExportedValue<ITsFormService>().Tss().FirstOrDefault(t => t.rcard == Card); OperationResult operationResult = testContainer.GetExportedValue<IFrmTsInputEditService>().TsCompleteConfirm(CompleteModel); Assert.IsTrue(operationResult.ResultType == OperationResultType.Success); } }
public OperationResult TsCompleteConfirm(TsCompleteModel tsCompleteModel) { OperationResult operationResult = new OperationResult(OperationResultType.Error); tsCompleteModel.ts.refmocode = tsCompleteModel.moString; tsCompleteModel.ts.refopcode = tsCompleteModel.opString; tsCompleteModel.ts.refroutecode = tsCompleteModel.routeString; tsCompleteModel.ts.tsstatus = TsStatus.REFLOW; return SaveTs(tsCompleteModel.ts); }
public OperationResult TsCompleteCheck(string card) { OperationResult operationResult = new OperationResult(OperationResultType.Error); if (card == null) { operationResult.Message = "条码不能为空"; return operationResult; } Ts ts = TsFormService.Tss().Where(t => t.rcard == card).OrderByDescending(t => t.TSID).FirstOrDefault(); if (ts == null) { operationResult.Message = "该产品没有登记不良品"; return operationResult; } if (!(ts.tsstatus == TsStatus.CONFIRM)) { operationResult.Message = "该产品状态不对"; return operationResult; } foreach (var ter in ts.tsErrorCodes.ToList()) { if (ter.tsErrorCauses.Count == 0) { operationResult.Message = "该产品维修中"; return operationResult; } } Item item = (Item)ItemFormService.FindEntity(ts.itemcode).AppendData; if (item == null) { operationResult.Message = "该产品不存在"; return operationResult; } List<Route> list = item.Routes.ToList(); foreach(var route in list) { route.Ops.ToList(); } TsCompleteModel tsCompleteModel = new TsCompleteModel(); tsCompleteModel.ts = ts; tsCompleteModel.list = list; operationResult.ResultType = OperationResultType.Success; operationResult.Message = "检测成功"; operationResult.AppendData = tsCompleteModel; return operationResult; }