Пример #1
0
        private void WtritReturnLogFromNC(DataSet dt)
        {
            AppSvrIF.Command cmdLog = null;
            int iRet = L3Session.CreateCommand((int)AppSvrIF.CommandType.Call, @"XGMESLogic\BaseDataMag\CBaseData_Mag\BaseData_Mag", "WriteLogFromNC", ref cmdLog);

            if (iRet != 0)
            {
                return;
            }
            cmdLog.set_Parameters(0, dt);
            L3Session.Execute(cmdLog);
        }
Пример #2
0
        private void btnAddSend_Click(object sender, EventArgs e)
        {
            //if (TelComm.deleteXml() == false)
            //{
            //    MessageBox.Show("请手动删除DataSent文件中的MES_Data.xml文件!");
            //    return;
            //}
            string strXslt = @"BOFAddMaterialsInforToNC.xslt";
            //组织发送记录集
            DataSet dsM = new DataSet();

            if (dsMain.Tables[0].Rows.Count > 0)
            {
                //组织主表记录集
                DataTable tbM = new DataTable();
                tbM           = dsMain.Tables[0].Clone();
                tbM           = dsMain.Tables[0].Copy();
                tbM.TableName = "M";
                dsM.Tables.Add(tbM);
            }
            else
            {
                MessageBox.Show("请查询出需要上传的数据!");
                return;
            }

            //组织从表记录集
            if (dsMaterial.Tables[0].Rows.Count > 0)
            {
                DataTable tbS = new DataTable();
                tbS           = dsMaterial.Tables[0].Clone();
                tbS           = dsMaterial.Tables[0].Copy();
                tbS.TableName = "s1";
                dsM.Tables.Add(tbS);
            }
            else
            {
                MessageBox.Show("请查询出需要上传的数据!");
                return;
            }

            string strXML = TelComm.TranslateDataSetToNC(strXslt, dsM);
            string strRet = TelComm.TransferXML(strXML);

            if (strRet != "")
            {
                if (strRet == "1")
                {
                    //组建成功记录集
                    dsLog.Clear();
                    DataRow row = dsLog.Tables[0].NewRow();
                    row["HeatID"]   = dsM.Tables[0].Rows[0]["HeatID"].ToString();
                    row["BillType"] = strXslt;
                    row["Other1"]   = dsM.Tables[0].Rows[0]["Flag"].ToString();
                    row["Flag"]     = "0";
                    dsLog.Tables[0].Rows.Add(row);

                    AppSvrIF.Command cmdLog = null;
                    int iRet = Adapter.Session.CreateCommand((int)AppSvrIF.CommandType.Call, @"XGMESLogic\BaseDataMag\CBaseData_Mag\BaseData_Mag", "WriteLogFromNC", ref cmdLog);
                    if (iRet != 0)
                    {
                        return;
                    }
                    cmdLog.set_Parameters(0, dsLog);
                    Adapter.Session.Execute(cmdLog);
                }
                else
                {
                    //组建失败记录集
                    dsLog.Clear();
                    DataRow row = dsLog.Tables[0].NewRow();
                    row["HeatID"]   = dsM.Tables[0].Rows[0]["HeatID"].ToString();
                    row["BillType"] = strXslt;
                    row["Other1"]   = dsM.Tables[0].Rows[0]["Flag"].ToString();
                    row["Flag"]     = "1";
                    row["Remark"]   = strRet;
                    dsLog.Tables[0].Rows.Add(row);

                    AppSvrIF.Command cmdLog = null;
                    int iRet = Adapter.Session.CreateCommand((int)AppSvrIF.CommandType.Call, @"XGMESLogic\BaseDataMag\CBaseData_Mag\BaseData_Mag", "WriteLogFromNC", ref cmdLog);
                    if (iRet != 0)
                    {
                        return;
                    }
                    cmdLog.set_Parameters(0, dsLog);
                    Adapter.Session.Execute(cmdLog);
                }
            }
            else
            {
                MessageBox.Show("发送失败!");
            }
        }
Пример #3
0
        private DataSet MesDs(string strHeatID, string strMethod)
        {
            AppSvrIF.Command cmdMaterial = null;
            int iRet = L3Session.CreateCommand((int)AppSvrIF.CommandType.Call, @"XGMESLogic\BaseDataMag\CBaseData_Mag\BaseData_Mag", strMethod, ref cmdMaterial);

            if (iRet != 0)
            {
                return(null);
            }
            cmdMaterial.set_Parameters(0, strHeatID);
            L3Session.Execute(cmdMaterial);
            if (strMethod == "SendIronQualityJudgeInfor")
            {
                //主表
                DataSet dsMain = cmdMaterial.Return as DataSet;
                if (dsMain == null)
                {
                    return(null);
                }
                if (dsMain.Tables.Count < 1)
                {
                    return(null);
                }
                //从表1
                DataSet dsReturn1 = cmdMaterial.get_Parameters(1) as DataSet;
                if (dsReturn1 == null)
                {
                    return(null);
                }
                if (dsReturn1.Tables.Count < 1)
                {
                    return(null);
                }
                //从表2
                DataSet dsReturn2 = cmdMaterial.get_Parameters(2) as DataSet;
                if (dsReturn2 == null)
                {
                    return(null);
                }
                if (dsReturn2.Tables.Count < 1)
                {
                    return(null);
                }
                DataSet dsM = new DataSet();
                //组织主表记录集
                DataTable tbM = new DataTable();
                tbM           = dsMain.Tables[0].Clone();
                tbM           = dsMain.Tables[0].Copy();
                tbM.TableName = "M";
                dsM.Tables.Add(tbM);
                //组织从表1记录集
                DataTable tbS = new DataTable();
                tbS           = dsReturn1.Tables[0].Clone();
                tbS           = dsReturn1.Tables[0].Copy();
                tbS.TableName = "s1";
                dsM.Tables.Add(tbS);
                //组织从表2记录集
                DataTable tbS1 = new DataTable();
                tbS1           = dsReturn2.Tables[0].Clone();
                tbS1           = dsReturn2.Tables[0].Copy();
                tbS1.TableName = "s2";
                dsM.Tables.Add(tbS1);

                return(dsM);
            }
            else
            {
                //主表
                DataSet dsMain = cmdMaterial.get_Parameters(1) as DataSet;
                if (dsMain == null)
                {
                    return(null);
                }
                if (dsMain.Tables.Count < 1)
                {
                    return(null);
                }
                //从表
                DataSet dsReturn = cmdMaterial.Return as DataSet;
                if (dsReturn == null)
                {
                    return(null);
                }
                if (dsReturn.Tables.Count < 1)
                {
                    return(null);
                }
                DataSet dsM = new DataSet();
                //组织主表记录集
                DataTable tbM = new DataTable();
                tbM           = dsMain.Tables[0].Clone();
                tbM           = dsMain.Tables[0].Copy();
                tbM.TableName = "M";
                dsM.Tables.Add(tbM);
                //组织从表记录集
                DataTable tbS = new DataTable();
                tbS           = dsReturn.Tables[0].Clone();
                tbS           = dsReturn.Tables[0].Copy();
                tbS.TableName = "s1";
                dsM.Tables.Add(tbS);

                return(dsM);
            }
        }
Пример #4
0
        private void Adapter_OnObjectPropChanged(string strObj, string strProp, object newVal, object oldVal)
        {
            //取出入库时需要上传的炉次号并反写标志
            AppSvrIF.Command cmdInstore        = null;
            AppSvrIF.Command cmdInstoreComfirm = null;
            int iRet = L3Session.CreateCommand((int)AppSvrIF.CommandType.Call, @"XGMESLogic\BaseDataMag\CBaseData_Mag\BaseData_Mag", "GetInStore", ref cmdInstore);

            if (iRet != 0)
            {
                return;
            }
            iRet = L3Session.CreateCommand((int)AppSvrIF.CommandType.Call, @"XGMESLogic\BaseDataMag\CBaseData_Mag\BaseData_Mag", "ConfirmInStore", ref cmdInstoreComfirm);
            if (iRet != 0)
            {
                return;
            }
            L3Session.Execute(cmdInstore);
            DataSet dsInstore = cmdInstore.Return as DataSet;

            if (dsInstore != null)
            {
                if (dsInstore.Tables.Count > 0)
                {
                    DataTable tbData2 = dsInstore.Tables[0];
                    if (tbData2.Rows.Count > 0)
                    {
                        foreach (DataRow tbrow in tbData2.Rows)
                        {
                            tbrow["NC_Confirm_Flag"] = "1";
                        }
                        InStoredt.Merge(tbData2);
                        cmdInstoreComfirm.set_Parameters(0, dsInstore);
                        L3Session.Execute(cmdInstoreComfirm);
                    }
                }
            }

            //取出铁水需要上传的炉次号并反写标志
            AppSvrIF.Command cmdIron        = null;
            AppSvrIF.Command cmdIronComfirm = null;
            iRet = L3Session.CreateCommand((int)AppSvrIF.CommandType.Call, @"XGMESLogic\BaseDataMag\CBaseData_Mag\BaseData_Mag", "GetIron", ref cmdIron);
            if (iRet != 0)
            {
                return;
            }
            iRet = L3Session.CreateCommand((int)AppSvrIF.CommandType.Call, @"XGMESLogic\BaseDataMag\CBaseData_Mag\BaseData_Mag", "ConfirmIron", ref cmdIronComfirm);
            if (iRet != 0)
            {
                return;
            }
            L3Session.Execute(cmdIron);
            DataSet dsIron = cmdIron.Return as DataSet;

            if (dsIron != null)
            {
                if (dsIron.Tables.Count > 0)
                {
                    DataTable tbData = dsIron.Tables[0];
                    if (tbData.Rows.Count > 0)
                    {
                        Irondt.Merge(tbData);
                        cmdIronComfirm.set_Parameters(0, dsIron);
                        L3Session.Execute(cmdIronComfirm);
                    }
                }
            }

            //取出库内改判炉号并反写标志
            AppSvrIF.Command cmdQuality        = null;
            AppSvrIF.Command cmdQualityComfirm = null;
            iRet = L3Session.CreateCommand((int)AppSvrIF.CommandType.Call, @"XGMESLogic\BaseDataMag\CBaseData_Mag\BaseData_Mag", "GetInStoreQuality", ref cmdQuality);
            if (iRet != 0)
            {
                return;
            }
            iRet = L3Session.CreateCommand((int)AppSvrIF.CommandType.Call, @"XGMESLogic\BaseDataMag\CBaseData_Mag\BaseData_Mag", "ConfirmInStoreQuality", ref cmdQualityComfirm);
            if (iRet != 0)
            {
                return;
            }
            L3Session.Execute(cmdQuality);
            DataSet dsQuality = cmdQuality.Return as DataSet;

            if (dsQuality != null)
            {
                if (dsQuality.Tables.Count > 0)
                {
                    DataTable tbData1 = dsQuality.Tables[0];
                    if (tbData1.Rows.Count > 0)
                    {
                        foreach (DataRow tbrow in tbData1.Rows)
                        {
                            tbrow["NC_Confirm_Flag"] = "1";
                        }
                        Qualitydt.Merge(tbData1);
                        cmdQualityComfirm.set_Parameters(0, dsQuality);
                        L3Session.Execute(cmdQualityComfirm);
                    }
                }
            }

            //取出全回炉时需要上传的炉次号并反写标志
            AppSvrIF.Command cmdAll        = null;
            AppSvrIF.Command cmdAllComfirm = null;
            iRet = L3Session.CreateCommand((int)AppSvrIF.CommandType.Call, @"XGMESLogic\BaseDataMag\CBaseData_Mag\BaseData_Mag", "GetAllReturn", ref cmdAll);
            if (iRet != 0)
            {
                return;
            }
            iRet = L3Session.CreateCommand((int)AppSvrIF.CommandType.Call, @"XGMESLogic\BaseDataMag\CBaseData_Mag\BaseData_Mag", "ConfirmAllReturn", ref cmdAllComfirm);
            if (iRet != 0)
            {
                return;
            }
            L3Session.Execute(cmdAll);
            DataSet dsAll = cmdAll.Return as DataSet;

            if (dsAll != null)
            {
                if (dsAll.Tables.Count > 0)
                {
                    DataTable tbData3 = dsAll.Tables[0];
                    if (tbData3.Rows.Count > 0)
                    {
                        foreach (DataRow tbrow in tbData3.Rows)
                        {
                            tbrow["NC_Confirm_Flag"] = "1";
                        }
                        Allreturndt.Merge(tbData3);
                        cmdAllComfirm.set_Parameters(0, dsAll);
                        L3Session.Execute(cmdAllComfirm);
                    }
                }
            }
        }
Пример #5
0
        private void MesAllReturnSendToNC()
        {
            string    strXslt = "";
            string    Method  = "";
            DataTable dt      = new DataTable();

            dt = Allreturndt.Copy();
            Allreturndt.Clear();
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string strHeatID = dt.Rows[i]["HeatID"].ToString();
                    string strType   = "1";
                    //订单
                    strXslt = @"MillPlanToNC.xslt";
                    AppSvrIF.Command cmdPlanOrder = null;
                    int iRet = L3Session.CreateCommand((int)AppSvrIF.CommandType.Call, @"XGMESLogic\BaseDataMag\CBaseData_Mag\BaseData_Mag", "SendPlanInfor", ref cmdPlanOrder);
                    if (iRet != 0)
                    {
                        continue;
                    }
                    cmdPlanOrder.set_Parameters(0, strHeatID);
                    L3Session.Execute(cmdPlanOrder);

                    DataSet dsPlanOrder = cmdPlanOrder.Return as DataSet;
                    if (dsPlanOrder != null && dsPlanOrder.Tables.Count > 0 && dsPlanOrder.Tables[0].Rows.Count > 0)
                    {
                        string strXML = TranslateDataSetToNC(strXslt, dsPlanOrder);
                        TransferXML(strXML, strHeatID, strType, strXslt);
                    }
                    else
                    {
                        dsLog.Clear();
                        DataRow row = dsLog.Tables[0].NewRow();
                        row["HeatID"]   = strHeatID;
                        row["BillType"] = strXslt;
                        row["Other1"]   = strType;
                        row["Flag"]     = "1";
                        row["Remark"]   = "在MES中没有查询出相应的数据";
                        dsLog.Tables[0].Rows.Add(row);
                        WtritReturnLogFromNC(dsLog);
                    }
                    //投料
                    strXslt = @"BOFAddMaterialsInforToNC.xslt";
                    Method  = "SendAddMaterialsInfor";
                    DataSet dsM = new DataSet();
                    dsM = MesDs(strHeatID, Method);
                    if (dsM != null)
                    {
                        string strXML = TranslateDataSetToNC(strXslt, dsM);
                        TransferXML(strXML, strHeatID, strType, strXslt);
                    }
                    else
                    {
                        dsLog.Clear();
                        DataRow row = dsLog.Tables[0].NewRow();
                        row["HeatID"]   = strHeatID;
                        row["BillType"] = strXslt;
                        row["Other1"]   = strType;
                        row["Flag"]     = "1";
                        row["Remark"]   = "在MES中没有查询出相应的数据";
                        dsLog.Tables[0].Rows.Add(row);
                        WtritReturnLogFromNC(dsLog);
                    }

                    //完工
                    strXslt = @"BloomInfor.xslt";
                    Method  = "SendBloomInfor";
                    DataSet dsB = new DataSet();
                    dsB = MesDs(strHeatID, Method);
                    if (dsB != null)
                    {
                        string strXML = TranslateDataSetToNC(strXslt, dsB);
                        TransferXML(strXML, strHeatID, strType, strXslt);
                    }
                    else
                    {
                        dsLog.Clear();
                        DataRow row = dsLog.Tables[0].NewRow();
                        row["HeatID"]   = strHeatID;
                        row["BillType"] = strXslt;
                        row["Other1"]   = strType;
                        row["Flag"]     = "1";
                        row["Remark"]   = "在MES中没有查询出相应的数据";
                        dsLog.Tables[0].Rows.Add(row);
                        WtritReturnLogFromNC(dsLog);
                    }

                    //入库
                    strXslt = @"BloomInStoreInfor.xslt";
                    Method  = "SendBloomInStoreInfor";
                    DataSet dsI = new DataSet();
                    dsI = MesDs(strHeatID, Method);
                    if (dsI != null)
                    {
                        string strXML = TranslateDataSetToNC(strXslt, dsI);
                        TransferXML(strXML, strHeatID, strType, strXslt);
                    }
                    else
                    {
                        dsLog.Clear();
                        DataRow row = dsLog.Tables[0].NewRow();
                        row["HeatID"]   = strHeatID;
                        row["BillType"] = strXslt;
                        row["Other1"]   = strType;
                        row["Flag"]     = "1";
                        row["Remark"]   = "在MES中没有查询出相应的数据";
                        dsLog.Tables[0].Rows.Add(row);
                        WtritReturnLogFromNC(dsLog);
                    }
                }
            }
        }
Пример #6
0
        //3#混铁炉出铁同样调用此方法  hyh 2012-03-29
        //出铁
        private void btnTap_Click(object sender, EventArgs e)
        {
            if (!(sender is Control))
            {
                return;
            }
            Control ctrl = sender as Control;//强制转换成Control
            //TextBox ctrl = sender as TextBox;

            double fWeight            = 0;
            double fReturnSteelWeight = 0;

            //Modify by hyh 2012-03-29
            if (ctrl.Tag.ToString() == "S11")
            {
                fWeight = double.Parse(this.txS11GrossWeight.Text);
            }
            else if (ctrl.Tag.ToString() == "S12")
            {
                fWeight = double.Parse(this.txS12GrossWeight.Text);
            }
            else if (ctrl.Tag.ToString() == "S13")
            {
                fWeight = double.Parse(this.txS13GrossWeight.Text);
            }
            //end

            TappedFrm frm = new TappedFrm();

            frm.Weight            = fWeight;
            frm.ReturnSteelWeight = fReturnSteelWeight;
            if (frm.ShowDialogEx(Adapter.Session) == DialogResult.Cancel)
            {
                return;
            }
            if (frm.LadleID == "")
            {
                MessageBox.Show("没有选择可用的铁包,不能出铁!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (frm.Destination == "")
            {
                MessageBox.Show("没有选择去向,不能出铁!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (frm.Weight < 0)
            {
                MessageBox.Show("铁水重量小于零,不能出铁!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (frm.ReturnSteelWeight < 0)
            {
                MessageBox.Show("回炉钢水量小于零,不能出铁!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            string MIFID = ctrl.Tag.ToString();

            AppSvrIF.Command cmd    = new AppSvrIF.Command();
            string           MIFUri = "XGMESLogic\\MIXFMag\\CMIF_Unit_Mag\\" + MIFID;
            int iRet = Adapter.Session.CreateCommand((int)AppSvrIF.CommandType.Call, MIFUri, "OutputIron", ref cmd);

            if (iRet != 0)
            {
                //  [12/28/2008 sun]
                // string strReasultShow = CommDataMag.CommonMethed.GetErrorDescByErrorCode(dsError, string.Format("{0:X}", l3cmdIron.Command.ErrorCode));
                MessageBox.Show(string.Format("出铁失败!错误代码:{0:X}", iRet));
                return;
            }

            cmd.set_Parameters(0, frm.LadleID);
            cmd.set_Parameters(1, frm.Weight);
            cmd.set_Parameters(2, frm.ReturnSteelWeight);
            if (frm.Destination == "转炉(碳钢)")
            {
                cmd.set_Parameters(3, "1");
            }
            else
            {
                cmd.set_Parameters(3, "2");
            }
            iRet = Adapter.Session.Execute(cmd);
            if (iRet != 0 || 0 == (short)cmd.Return)
            {
                if (cmd.ErrorCode == 0xB1001003)
                {
                    MessageBox.Show(string.Format("混铁炉中铁量不足!"));
                }
                else
                {
                    //  [12/28/2008 sun]
                    string strReasultShow = CommDataMag.CommonMethed.GetErrorDescByErrorCode(dsError, string.Format("{0:X}", cmd.ErrorCode));
                    //MessageBox.Show(string.Format("出铁失败!错误代码:{0:X},{1:X}",cmd.ErrorCode,iRet));
                    MessageBox.Show("出铁失败!" + strReasultShow);
                }
            }
            else
            {
                MessageBox.Show("出铁成功!");
            }
        }
Пример #7
0
        private void tabControl1_Selected(object sender, TabControlEventArgs e)
        {
            try
            {
                if (e.Action == TabControlAction.Selected)
                {
                    Set_TabPlan_AutoSubscribe(false);
                    Set_tabElementA_AutoSubscribe(false);
                    Set_tabElementB_AutoSubscribe(false);
                    Set_tabProStd_AutoSubscribe(false);
                    Set_tabProcessA_AutoSubscribe(false);
                    //Set_tabProcessB_AutoSubscribe(false);
                    switch (e.TabPage.Name)
                    {
                    case "tabPlan":
                        if (dsPlan.L3DataAdapter == null)
                        {
                            dsPlan.L3DataAdapter = Adapter;
                        }

                        if (dsArrivleLFSteel.L3DataAdapter == null)
                        {
                            dsArrivleLFSteel.L3DataAdapter = Adapter;
                        }

                        Set_TabPlan_AutoSubscribe(true);
                        break;

                    case "tabArearA":
                        if (dsElementA.L3DataAdapter == null)
                        {
                            dsElementA.L3DataAdapter = Adapter;
                        }
                        dsElementA.SourceCondition = "SteelGradeIndex = '" + dbxSteelGradeIndexA.Text + "'";

                        if (dsInCtrolEleA.L3DataAdapter == null)
                        {
                            dsInCtrolEleA.L3DataAdapter = Adapter;
                        }
                        dsInCtrolEleA.SourceCondition = "SteelGradeIndex = '" + dbxSteelGradeIndexA.Text + "'";

                        if (dsElementInfoA.L3DataAdapter == null)
                        {
                            dsElementInfoA.L3DataAdapter = Adapter;
                        }
                        dsElementInfoA.SourceCondition = "HeatID = '" + dbxHeatIDA.Text
                                                         + "' and UnitTypeID = '" + UnitID.Substring(1, 1).ToString() + "' order by HeatID,AppID,Sample_Count";

                        Set_tabElementA_AutoSubscribe(true);

                        //Modify begin by llj 2011-04-13  增加Ca/Al比值
                        String           HeatID_A    = dbxHeatIDA.Text.Trim();
                        AppSvrIF.Command command_A   = null;
                        String           strMethod_A = @"CalEleRateValue";
                        String           strObjURI_A = @"XGMESLogic\LFMag\CLF_Unit_Mag\S41";
                        try
                        {
                            int iRet = this.Adapter.Session.CreateCommand((int)AppSvrIF.CommandType.Call, strObjURI_A, strMethod_A, ref command_A);
                            if (iRet == 0)
                            {
                                command_A.set_Parameters(0, HeatID_A);
                                command_A.set_Parameters(1, "Ca");
                                command_A.set_Parameters(2, "Al");
                                this.Adapter.Session.Execute(command_A);
                                object retValue = command_A.Return;
                                if (retValue != null)
                                {
                                    string strA = retValue.ToString();
                                    txtCaAl_A.Text = strA;
                                    if (strA.Length > 7)
                                    {
                                        txtCaAl_A.Text = strA.Substring(0, 7);
                                    }
                                }
                            }
                        }
                        catch
                        {
                            txtCaAl_A.Text = "";
                        }
                        finally
                        {
                            command_A.Dispose();
                        }
                        //Modify end
                        break;

                    case "tabArearB":
                        if (dsElementB.L3DataAdapter == null)
                        {
                            dsElementB.L3DataAdapter = Adapter;
                        }
                        dsElementB.SourceCondition = "SteelGradeIndex = '" + dbxSteelGradeIndexB.Text + "'";

                        if (dsInCtrolEleB.L3DataAdapter == null)
                        {
                            dsInCtrolEleB.L3DataAdapter = Adapter;
                        }
                        dsInCtrolEleB.SourceCondition = "SteelGradeIndex = '" + dbxSteelGradeIndexB.Text + "'";

                        if (dsElementInfoB.L3DataAdapter == null)
                        {
                            dsElementInfoB.L3DataAdapter = Adapter;
                        }
                        dsElementInfoB.SourceCondition = "HeatID = '" + dbxHeatIDB.Text
                                                         + "' and UnitTypeID = '" + UnitID.Substring(1, 1).ToString() + "' order by HeatID,AppID,Sample_Count";

                        Set_tabElementB_AutoSubscribe(true);

                        //Modify begin by llj 2011-04-13  增加Ca/Al比值
                        String           HeatID_B    = dbxHeatIDB.Text.Trim();
                        AppSvrIF.Command command_B   = null;
                        String           strMethod_B = @"CalEleRateValue";
                        String           strObjURI_B = @"XGMESLogic\LFMag\CLF_Unit_Mag\S41";
                        try
                        {
                            int iRet = this.Adapter.Session.CreateCommand((int)AppSvrIF.CommandType.Call, strObjURI_B, strMethod_B, ref command_B);
                            if (iRet == 0)
                            {
                                command_B.set_Parameters(0, HeatID_B);
                                command_B.set_Parameters(1, "Ca");
                                command_B.set_Parameters(2, "Al");
                                this.Adapter.Session.Execute(command_B);
                                object retValue = command_B.Return;
                                if (retValue != null)
                                {
                                    string strB = retValue.ToString();
                                    txtCaAl_B.Text = strB;
                                    if (strB.Length > 5)
                                    {
                                        txtCaAl_B.Text = strB.Substring(0, 5);
                                    }
                                }
                            }
                        }
                        catch
                        {
                            txtCaAl_B.Text = "";
                        }
                        finally
                        {
                            command_B.Dispose();
                        }
                        //Modify end
                        break;

                    case "tabProStd":
                        if (dsSlagele.L3DataAdapter == null)
                        {
                            dsSlagele.L3DataAdapter = Adapter;
                        }

                        if (dsBaseData.L3DataAdapter == null)
                        {
                            dsBaseData.L3DataAdapter = Adapter;
                        }

                        if (dsProcess.L3DataAdapter == null)
                        {
                            dsProcess.L3DataAdapter = Adapter;
                        }

                        if (dsAlloy.L3DataAdapter == null)
                        {
                            dsAlloy.L3DataAdapter = Adapter;
                        }

                        if (dsAddSlag.L3DataAdapter == null)
                        {
                            dsAddSlag.L3DataAdapter = Adapter;
                        }

                        if (dsFeed.L3DataAdapter == null)
                        {
                            dsFeed.L3DataAdapter = Adapter;
                        }

                        Set_tabProStd_AutoSubscribe(true);
                        break;

                    case "tabProcessA":
                        dsTapProcessData.SourceCondition = "HeatID = '" + dbxHeatIDA.Text.Trim() + "'";
                        if (dsTapProcessData.L3DataAdapter == null)
                        {
                            dsTapProcessData.L3DataAdapter = Adapter;
                        }

                        dsBOFProcessData.SourceCondition = "HeatID = '" + dbxHeatIDA.Text.Trim() + "'";
                        if (dsBOFProcessData.L3DataAdapter == null)
                        {
                            dsBOFProcessData.L3DataAdapter = Adapter;
                        }

                        dsLFTempData.SourceCondition = "TreatNo = '" + dbxTreatNoA.Text.Trim().ToString() + "' and \"MODE\" <> 4 order by MeasureTime desc";
                        if (dsLFTempData.L3DataAdapter == null)
                        {
                            dsLFTempData.L3DataAdapter = Adapter;
                        }

                        dsLFOxyData.SourceCondition = "TreatNo = '" + dbxTreatNoA.Text.Trim().ToString() + "' order by Measure_Time desc";
                        if (dsLFOxyData.L3DataAdapter == null)
                        {
                            dsLFOxyData.L3DataAdapter = Adapter;
                        }

                        dsExcept.SourceCondition = "HeatID = '" + dbxHeatIDA.Text.Trim() + "' order by UnitTypeID,UnitID,Exceptional_Time asc ";
                        if (dsExcept.L3DataAdapter == null)
                        {
                            dsExcept.L3DataAdapter = Adapter;
                        }

                        dsProcessStatus.SourceCondition = "TreatNo = '" + dbxTreatNoA.Text.Trim().ToString() + "' order by Change_Time desc";
                        if (dsProcessStatus.L3DataAdapter == null)
                        {
                            dsProcessStatus.L3DataAdapter = Adapter;
                        }

                        dsAddition.SourceCondition = "TreatNo = '" + dbxTreatNoA.Text.Trim() + "' order by Discharge_Time desc";
                        if (dsAddition.L3DataAdapter == null)
                        {
                            dsAddition.L3DataAdapter = Adapter;
                        }

                        dsWireData.SourceCondition = "TreatNo = '" + dbxTreatNoA.Text.Trim().ToString() + "' order by WireTime desc";
                        if (dsWireData.L3DataAdapter == null)
                        {
                            dsWireData.L3DataAdapter = Adapter;
                        }

                        dsLFProcess.SourceCondition = "TreatNo = '" + dbxTreatNoA.Text.Trim().ToString() + "'";
                        if (dsLFProcess.L3DataAdapter == null)
                        {
                            dsLFProcess.L3DataAdapter = Adapter;
                        }

                        dsLadleInfo.SourceCondition = "TreatNo = '" + dbxTreatNoA.Text.Trim().ToString() + "'";
                        if (dsLadleInfo.L3DataAdapter == null)
                        {
                            dsLadleInfo.L3DataAdapter = Adapter;
                        }

                        Set_tabProcessA_AutoSubscribe(true);
                        break;

                    case "tabProcessB":
                        dsTapProcessData.SourceCondition = "HeatID = '" + dbxHeatIDB.Text.Trim() + "'";
                        if (dsTapProcessData.L3DataAdapter == null)
                        {
                            dsTapProcessData.L3DataAdapter = Adapter;
                        }

                        dsBOFProcessData.SourceCondition = "HeatID = '" + dbxHeatIDB.Text.Trim() + "'";
                        if (dsBOFProcessData.L3DataAdapter == null)
                        {
                            dsBOFProcessData.L3DataAdapter = Adapter;
                        }

                        dsLFTempData.SourceCondition = "TreatNo = '" + dbxTreatNoB.Text.Trim().ToString() + "' and \"MODE\" <> 4 order by MeasureTime desc";
                        if (dsLFTempData.L3DataAdapter == null)
                        {
                            dsLFTempData.L3DataAdapter = Adapter;
                        }

                        dsLFOxyData.SourceCondition = "TreatNo = '" + dbxTreatNoB.Text.Trim().ToString() + "' order by Measure_Time desc";
                        if (dsLFOxyData.L3DataAdapter == null)
                        {
                            dsLFOxyData.L3DataAdapter = Adapter;
                        }

                        dsExcept.SourceCondition = "HeatID = '" + dbxHeatIDB.Text.Trim() + "' order by UnitTypeID,UnitID,Exceptional_Time asc ";
                        if (dsExcept.L3DataAdapter == null)
                        {
                            dsExcept.L3DataAdapter = Adapter;
                        }

                        dsProcessStatus.SourceCondition = "TreatNo = '" + dbxTreatNoB.Text.Trim().ToString() + "' order by Change_Time desc";
                        if (dsProcessStatus.L3DataAdapter == null)
                        {
                            dsProcessStatus.L3DataAdapter = Adapter;
                        }

                        dsAddition.SourceCondition = "TreatNo = '" + dbxTreatNoB.Text.Trim() + "' order by Discharge_Time desc";
                        if (dsAddition.L3DataAdapter == null)
                        {
                            dsAddition.L3DataAdapter = Adapter;
                        }

                        dsWireData.SourceCondition = "TreatNo = '" + dbxTreatNoB.Text.Trim().ToString() + "' order by WireTime desc";
                        if (dsWireData.L3DataAdapter == null)
                        {
                            dsWireData.L3DataAdapter = Adapter;
                        }

                        dsLFProcess.SourceCondition = "TreatNo = '" + dbxTreatNoB.Text.Trim().ToString() + "'";
                        if (dsLFProcess.L3DataAdapter == null)
                        {
                            dsLFProcess.L3DataAdapter = Adapter;
                        }

                        dsLadleInfo.SourceCondition = "TreatNo = '" + dbxTreatNoB.Text.Trim().ToString() + "'";
                        if (dsLadleInfo.L3DataAdapter == null)
                        {
                            dsLadleInfo.L3DataAdapter = Adapter;
                        }

                        Set_tabProcessA_AutoSubscribe(true);
                        break;

                    default:
                        break;
                    }
                }
            }
            catch { }
        }
Пример #8
0
        private void btnInStoreUpdate_Click(object sender, EventArgs e)
        {
            string strXslt = @"updateInStoreQualityInfor.xslt";
            //组织发送记录集
            DataSet dsM = new DataSet();

            if (dsMain.Tables[0].Rows.Count > 0)
            {
                //组织主表记录集
                DataTable tbM = new DataTable();
                tbM           = dsMain.Tables[0].Clone();
                tbM           = dsMain.Tables[0].Copy();
                tbM.TableName = "M";
                dsM.Tables.Add(tbM);
            }
            else
            {
                MessageBox.Show("请查询出需要上传的数据!");
                return;
            }

            //组织从表记录集1
            if (dsMaterial1.Tables[0].Rows.Count > 0)
            {
                DataTable tbS1 = new DataTable();
                tbS1           = dsMaterial1.Tables[0].Clone();
                tbS1           = dsMaterial1.Tables[0].Copy();
                tbS1.TableName = "s1";
                dsM.Tables.Add(tbS1);
            }
            else
            {
                MessageBox.Show("请查询出需要上传的数据!");
                return;
            }
            //组织从表记录集2
            if (dsMaterial2.Tables[0].Rows.Count > 0)
            {
                DataTable tbS2 = new DataTable();
                tbS2           = dsMaterial2.Tables[0].Clone();
                tbS2           = dsMaterial2.Tables[0].Copy();
                tbS2.TableName = "s2";
                dsM.Tables.Add(tbS2);
            }
            else
            {
                MessageBox.Show("请查询出需要上传的数据!");
                return;
            }

            string strXML = TelComm.TranslateDataSetToNC(strXslt, dsM);
            string strRet = TelComm.TransferXML(strXML);

            if (strRet != "")
            {
                if (strRet == "1")
                {
                    //组建成功记录集
                    dsLog.Clear();
                    DataRow row = dsLog.Tables[0].NewRow();
                    row["HeatID"]   = dsM.Tables[0].Rows[0]["HeatID"].ToString();
                    row["BillType"] = strXslt;
                    row["Other1"]   = dsM.Tables[0].Rows[0]["Flag"].ToString();
                    row["Flag"]     = "0";
                    dsLog.Tables[0].Rows.Add(row);

                    AppSvrIF.Command cmdLog = null;
                    int iRet = Adapter.Session.CreateCommand((int)AppSvrIF.CommandType.Call, @"XGMESLogic\BaseDataMag\CBaseData_Mag\BaseData_Mag", "WriteLogFromNC", ref cmdLog);
                    if (iRet != 0)
                    {
                        return;
                    }
                    cmdLog.set_Parameters(0, dsLog);
                    Adapter.Session.Execute(cmdLog);
                }
                else
                {
                    //组建失败记录集
                    dsLog.Clear();
                    DataRow row = dsLog.Tables[0].NewRow();
                    row["HeatID"]   = dsM.Tables[0].Rows[0]["HeatID"].ToString();
                    row["BillType"] = strXslt;
                    row["Other1"]   = dsM.Tables[0].Rows[0]["Flag"].ToString();
                    row["Flag"]     = "1";
                    row["Remark"]   = strRet;
                    dsLog.Tables[0].Rows.Add(row);

                    AppSvrIF.Command cmdLog = null;
                    int iRet = Adapter.Session.CreateCommand((int)AppSvrIF.CommandType.Call, @"XGMESLogic\BaseDataMag\CBaseData_Mag\BaseData_Mag", "WriteLogFromNC", ref cmdLog);
                    if (iRet != 0)
                    {
                        return;
                    }
                    cmdLog.set_Parameters(0, dsLog);
                    Adapter.Session.Execute(cmdLog);
                }
            }
            else
            {
                MessageBox.Show("发送失败!");
            }
        }
Пример #9
0
        private void btnAddSend_Click(object sender, EventArgs e)
        {
            //if (TelComm.deleteXml() == false)
            //{
            //    MessageBox.Show("请手动删除DataSent文件中的MES_Data.xml文件!");
            //    return;
            //}
            string strXslt = @"MillPlanToNC.xslt";

            if (dsPlanOrder.Tables[0].Rows.Count > 0)
            {
                //将数据写入到xml中
                string strXML = TelComm.TranslateDataSetToNC(strXslt, dsPlanOrder);
                //将xml文件发送至NC
                string strRet = TelComm.TransferXML(strXML);
                if (strRet != "")
                {
                    if (strRet == "1")
                    {
                        //组建成功记录集
                        dsLog.Clear();
                        DataRow row = dsLog.Tables[0].NewRow();
                        row["HeatID"]   = dsPlanOrder.Tables[0].Rows[0]["HeatID"].ToString();
                        row["BillType"] = strXslt;
                        row["Other1"]   = dsPlanOrder.Tables[0].Rows[0]["Flag"].ToString();
                        row["Flag"]     = "0";
                        dsLog.Tables[0].Rows.Add(row);

                        AppSvrIF.Command cmdLog = null;
                        int iRet = Adapter.Session.CreateCommand((int)AppSvrIF.CommandType.Call, @"XGMESLogic\BaseDataMag\CBaseData_Mag\BaseData_Mag", "WriteLogFromNC", ref cmdLog);
                        if (iRet != 0)
                        {
                            return;
                        }
                        cmdLog.set_Parameters(0, dsLog);
                        Adapter.Session.Execute(cmdLog);
                    }
                    else
                    {
                        //组建失败记录集
                        dsLog.Clear();
                        DataRow row = dsLog.Tables[0].NewRow();
                        row["HeatID"]   = dsPlanOrder.Tables[0].Rows[0]["HeatID"].ToString();
                        row["BillType"] = strXslt;
                        row["Other1"]   = dsPlanOrder.Tables[0].Rows[0]["Flag"].ToString();
                        row["Flag"]     = "1";
                        row["Remark"]   = strRet;
                        dsLog.Tables[0].Rows.Add(row);

                        AppSvrIF.Command cmdLog = null;
                        int iRet = Adapter.Session.CreateCommand((int)AppSvrIF.CommandType.Call, @"XGMESLogic\BaseDataMag\CBaseData_Mag\BaseData_Mag", "WriteLogFromNC", ref cmdLog);
                        if (iRet != 0)
                        {
                            return;
                        }
                        cmdLog.set_Parameters(0, dsLog);
                        Adapter.Session.Execute(cmdLog);
                    }
                }
                else
                {
                    MessageBox.Show("发送失败!");
                }
            }
            else
            {
                MessageBox.Show("请先查询出需要上传的数据!");
            }
        }