private void btnLoad_Click(object sender, EventArgs e) { if (txtJSNo.Text == "") { XtraMessageBox.Show("请先输入派工单号 !!"); txtJSNo.Focus(); return; } try { JS = ProdOrder.LoadExchange(txtJSNo.Text); if (JS.ActiveLocation != "Q") { XtraMessageBox.Show(string.Format("这张单现时地点为{0}, 不在FQC, 所以不能过帐 !!", JS.ActiveLocation)); txtJSNo.SelectAll(); txtJSNo.Focus(); return; } txtPartNo.Text = JS.ItemNo; txtPartName.Text = JS.ItemName; txtPartType.Text = JS.ItemType; txtShipQty.Text = JS.ActiveQty.ToString(); if (JS.Item != null) { txtRevision.Text = JS.Item.CustomerRevision; txtBoxQty.Text = JS.Item.BoxQty.ToString(); } txtIRNo.Text = JS.IrNo; txtInspector.Text = JS.FQCInspector; txtJSStatus.Text = JS.OrderStatus; EnableFindButton(false); txtShipQty.SelectAll(); txtShipQty.Focus(); } catch { XtraMessageBox.Show(string.Format("找不到此单号 {0}, 请查清楚再试!!", txtJSNo.Text)); txtJSNo.Focus(); } }
public static ProdOrder LoadExchange(string StrJSNo) { try { Logger.For(typeof(ProdOrder)).Info(string.Format("开始. 单号 : {0}.", StrJSNo)); ADODB.Connection Cnn = ServerHelper.ConnectExchange(JSPATH); ADODB.Record Rec = new ADODB.Record(); Rec.Open(string.Format("{0}{1}.eml", JSPATH, StrJSNo), Cnn, ADODB.ConnectModeEnum.adModeReadWrite, ADODB.RecordCreateOptionsEnum.adFailIfNotExists, ADODB.RecordOpenOptionsEnum.adOpenRecordUnspecified, "namwah", "ParaW0rld"); ProdOrder JS = new ProdOrder(); JS.InitFromRec(Rec); Logger.For(typeof(ProdOrder)).Info(string.Format("结束. 单号 : {0}.", StrJSNo)); return JS; } catch (Exception ex) { Logger.For(typeof(ProdOrder)).Error(string.Format("单号 : {0}. 原因 : {1}", StrJSNo, ex.Message)); throw ex; } }