コード例 #1
0
ファイル: ucBilletFlowCard.cs プロジェクト: Strongc/sencond
        public bool DataValidation_Charge(out Hashtable htblValue)
        {
            htblValue = new Hashtable();

            try
            {
                if (ultraGrid1.Rows.Count == 0)
                {
                    return(false);
                }

                ultraGrid1.UpdateData();

                string strValue = Convert.ToString(ultraGrid1.Rows[0].Cells["FN_ZC_ENTERNUMBER"].Value).Trim();

                if (string.IsNullOrEmpty(strValue))
                {
                    MessageBox.Show("请输入入炉条数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, 0, "FN_ZC_ENTERNUMBER", true);
                    return(false);
                }

                int  iCount = 0;
                bool bOK    = false;

                bOK = int.TryParse(strValue, out iCount);

                if (!bOK)
                {
                    MessageBox.Show("入炉条数必须是整数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, 0, "FN_ZC_ENTERNUMBER", true);
                    return(false);
                }

                if (iCount <= 0)
                {
                    MessageBox.Show("入炉条数必须大于零!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, 0, "FN_ZC_ENTERNUMBER", true);
                    return(false);
                }

                htblValue.Add("V2", strValue);           //入炉条数
                strValue = Convert.ToString(ultraGrid1.Rows[0].Cells["FD_ZC_ENTERDATETIME"].Text).Trim();
                htblValue.Add("V3", strValue);           //入炉时间
                strValue = Convert.ToString(ultraGrid1.Rows[0].Cells["FS_ZC_MEMO"].Text).Trim();
                htblValue.Add("V5", strValue);           //备注

                return(true);
            }
            catch { }

            return(false);
        }
コード例 #2
0
ファイル: ucBilletFlowCard.cs プロジェクト: Strongc/sencond
        public bool DataValidation_BilletReceive(out Hashtable htblValue)
        {
            htblValue = new Hashtable();

            try
            {
                if (ultraGrid1.Rows.Count == 0)
                {
                    return(false);
                }

                ultraGrid1.UpdateData();

                string strValue = Convert.ToString(ultraGrid1.Rows[0].Cells["FN_GPYS_NUMBER"].Value).Trim();

                if (string.IsNullOrEmpty(strValue))
                {
                    MessageBox.Show("请输入验收条数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, 0, "FN_GPYS_NUMBER", true);
                    return(false);
                }

                int  iCount = 0;
                bool bOK    = false;

                bOK = int.TryParse(strValue, out iCount);

                if (!bOK)
                {
                    MessageBox.Show("验收条数必须是整数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, 0, "FN_GPYS_NUMBER", true);
                    return(false);
                }

                if (iCount < 0)
                {
                    MessageBox.Show("验收条数必须大于零!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, 0, "FN_GPYS_NUMBER", true);
                    return(false);
                }

                htblValue.Add("V2", strValue);           //验收条数
                strValue = Convert.ToString(ultraGrid1.Rows[0].Cells["FS_DJH"].Value).Trim();
                htblValue.Add("V3", strValue);           //货架号

                return(true);
            }
            catch { }

            return(false);
        }
コード例 #3
0
        private void ultraGrid1_AfterCellUpdate(object sender, CellEventArgs e)
        {
            try
            {
                if (e.Cell.Column.Key.Equals("CHECKED"))
                {
                    if (Convert.ToBoolean(e.Cell.Value))
                    {
                        this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_NUMBER"].Value    = this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GP_TOTALCOUNT"].Value;
                        this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT"].Value    = this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_JJ_WEIGHT"].Value;
                        this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT_LL"].Value = this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_JJ_WEIGHT_LL"].Value;

                        string strWeight = Convert.ToString(this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT"].Value).Trim();

                        if (string.IsNullOrEmpty(strWeight) || strWeight == "0")
                        {
                            this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT"].Value = this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT_LL"].Value;
                        }

                        CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, e.Cell.Row.Index, "FN_GPYS_NUMBER", true);
                    }
                    else
                    {
                        this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_NUMBER"].Value    = "";
                        this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT"].Value    = "";;
                        this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT_LL"].Value = "";
                    }
                }
                else if (e.Cell.Column.Key.Equals("FS_DJH") || e.Cell.Column.Key.Equals("FN_GPYS_WEIGHT"))
                {
                    string strValue = Convert.ToString(e.Cell.Value).Trim();

                    if (!Convert.ToBoolean(ultraGrid1.Rows[e.Cell.Row.Index].Cells["CHECKED"].Value) && !string.IsNullOrEmpty(strValue))
                    {
                        e.Cell.Value = "";
                        return;
                    }
                }
                else if (e.Cell.Column.Key.Equals("FN_GPYS_NUMBER"))
                {
                    string strCount = Convert.ToString(e.Cell.Value).Trim();

                    if (!Convert.ToBoolean(ultraGrid1.Rows[e.Cell.Row.Index].Cells["CHECKED"].Value) && !string.IsNullOrEmpty(strCount))
                    {
                        e.Cell.Value = "";
                        return;
                    }

                    string strCountLG = Convert.ToString(this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GP_TOTALCOUNT"].Value).Trim();

                    if (string.IsNullOrEmpty(strCount))
                    {
                        this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT"].Value    = "";
                        this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT_LL"].Value = "";
                        return;
                    }

                    int iCount   = 0;
                    int iCountLG = Convert.ToInt16(strCountLG);

                    if (!int.TryParse(strCount, out iCount))
                    {
                        MessageBox.Show("验收数必须是整数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        e.Cell.Value = iCountLG.ToString();
                        return;
                    }

                    if (iCount <= 0)
                    {
                        MessageBox.Show("验收数必须大于零!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        e.Cell.Value = iCountLG.ToString();
                        return;
                    }

                    if (iCount > iCountLG)
                    {
                        MessageBox.Show("验收数不能大于总条数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        e.Cell.Value = iCountLG.ToString();
                        return;
                    }

                    try
                    {
                        string strWeightLG = Convert.ToString(this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_JJ_WEIGHT"].Value).Trim();

                        if (!string.IsNullOrEmpty(strWeightLG))
                        {
                            decimal dWeightYS = Convert.ToDecimal(strWeightLG);

                            decimal dWeight = Math.Round(iCount * dWeightYS / iCountLG, 3);

                            this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT"].Value = dWeight.ToString();
                        }
                    }
                    catch { }

                    try
                    {
                        string strWeightLGLL = Convert.ToString(this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_JJ_WEIGHT_LL"].Value).Trim();

                        if (!string.IsNullOrEmpty(strWeightLGLL))
                        {
                            decimal dWeightYS = Convert.ToDecimal(strWeightLGLL);

                            decimal dWeightLL = Math.Round(iCount * dWeightYS / iCountLG, 3);

                            this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT_LL"].Value = dWeightLL.ToString();

                            string strWeightSZ = Convert.ToString(this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT"].Value).Trim();

                            if (string.IsNullOrEmpty(strWeightSZ) || strWeightSZ == "0")
                            {
                                this.ultraGrid1.Rows[e.Cell.Row.Index].Cells["FN_GPYS_WEIGHT"].Value = dWeightLL.ToString();
                            }
                        }
                    }
                    catch { }
                }
            }
            catch { }
        }
コード例 #4
0
        /// <summary>
        /// 数据有效性验证
        /// </summary>
        /// <param name="alistCardNo"></param>
        /// <param name="alistCount"></param>
        /// <param name="alistWeight"></param>
        /// <param name="alistPosition"></param>
        /// <param name="alistStoveNo"></param>
        /// <returns></returns>
        private bool DataValidation_Save(out ArrayList alistCardNo, out ArrayList alistCount, out ArrayList alistWeight, out ArrayList alistPosition, out ArrayList alistStoveNo)
        {
            alistStoveNo  = new ArrayList();
            alistCardNo   = new ArrayList();
            alistCount    = new ArrayList();
            alistWeight   = new ArrayList();
            alistPosition = new ArrayList();

            ultraGrid1.UpdateData();

            try
            {
                UltraGridRow row = null;
                string       strCardNo = "", strCount = "", strWeight = "", strPosition = "", strStoveNo = "";

                string str_FS_SPEC;
                string str_FN_LENGTH;
                string str_FN_WEIGHT;
                string str_FN_BILLETCOUNT;
                string str_FN_ID;
                string str_FS_MINDIFFERENTRATE;
                string str_FS_MAXDIFFERENTRATE;
                string str_FS_BUNDLEWEIGHT;
                string str_FS_BUNDLEMINWWEIGHT;
                string str_FS_BUNDLEMAXWWEIGHT;

                for (int i = 0; i < this.ultraGrid1.Rows.Count; i++)
                {
                    row = this.ultraGrid1.Rows[i];

                    if (Convert.ToBoolean(row.Cells["CHECKED"].Value))
                    {
                        strCardNo   = Convert.ToString(row.Cells["FS_CARDNO"].Value).Trim();
                        strCount    = Convert.ToString(row.Cells["FN_GPYS_NUMBER"].Value).Trim();
                        strWeight   = Convert.ToString(row.Cells["FN_GPYS_WEIGHT"].Value).Trim();
                        strPosition = Convert.ToString(row.Cells["FS_DJH"].Value).Trim();
                        strStoveNo  = Convert.ToString(row.Cells["FS_GP_STOVENO"].Value).Trim();

                        //BT_BCTHEORYWEIGHTINFO的所有字段
                        str_FS_SPEC             = Convert.ToString(row.Cells["FS_SPEC"].Value).Trim();
                        str_FN_LENGTH           = Convert.ToString(row.Cells["FN_LENGTH"].Value).Trim();
                        str_FN_WEIGHT           = Convert.ToString(row.Cells["FN_WEIGHT"].Value).Trim();
                        str_FN_BILLETCOUNT      = Convert.ToString(row.Cells["FN_BILLETCOUNT"].Value).Trim();
                        str_FN_ID               = Convert.ToString(row.Cells["FN_ID"].Value).Trim();
                        str_FS_MINDIFFERENTRATE = Convert.ToString(row.Cells["FS_MINDIFFERENTRATE"].Value).Trim();
                        str_FS_MAXDIFFERENTRATE = Convert.ToString(row.Cells["FS_MAXDIFFERENTRATE"].Value).Trim();
                        str_FS_BUNDLEWEIGHT     = Convert.ToString(row.Cells["FS_BUNDLEWEIGHT"].Value).Trim();
                        str_FS_BUNDLEMINWWEIGHT = Convert.ToString(row.Cells["FS_BUNDLEMINWWEIGHT"].Value).Trim();
                        str_FS_BUNDLEMAXWWEIGHT = Convert.ToString(row.Cells["FS_BUNDLEMAXWWEIGHT"].Value).Trim();


                        if (string.IsNullOrEmpty(strCount))
                        {
                            MessageBox.Show("请输入验收条数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                            CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, i, "FN_GPYS_NUMBER", true);
                            return(false);
                        }

                        int  iCount = 0;
                        bool bOK    = false;
                        bOK = int.TryParse(strCount, out iCount);
                        if (!bOK)
                        {
                            MessageBox.Show("验收条数必须是整数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                            CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, i, "FN_GPYS_NUMBER", true);
                            return(false);
                        }

                        if (iCount <= 0)
                        {
                            MessageBox.Show("验收条数必须大于零!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                            CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, i, "FN_GPYS_NUMBER", true);
                            return(false);
                        }

                        if (string.IsNullOrEmpty(strWeight))
                        {
                            MessageBox.Show("请输入验收重量!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                            CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, i, "FN_GPYS_WEIGHT", true);
                            return(false);
                        }

                        decimal dWeight = 0.0M;
                        bOK = decimal.TryParse(strWeight, out dWeight);
                        if (!bOK)
                        {
                            MessageBox.Show("验收重量必须是数值!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                            CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, i, "FN_GPYS_WEIGHT", true);
                            return(false);
                        }

                        if (dWeight <= 0)
                        {
                            MessageBox.Show("验收重量必须大于零!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                            CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, i, "FN_GPYS_WEIGHT", true);
                            return(false);
                        }

                        if (string.IsNullOrEmpty(strPosition))
                        {
                            MessageBox.Show("请输入货架号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                            CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, i, "FS_DJH", true);
                            return(false);
                        }

                        alistCardNo.Add(strCardNo);
                        alistCount.Add(strCount);
                        alistWeight.Add(strWeight);
                        alistPosition.Add(strPosition);
                        alistStoveNo.Add(strStoveNo);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("数据验证失败!\n" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return(false);
            }

            return(true);
        }
コード例 #5
0
ファイル: ucBilletFlowCard.cs プロジェクト: Strongc/sencond
        public bool DataValidation_Rolling(ProduceLine ProLine, out Hashtable htblValue)
        {
            htblValue = new Hashtable();

            try
            {
                if (ultraGrid1.Rows.Count == 0)
                {
                    return(false);
                }

                ultraGrid1.UpdateData();

                string strValue = Convert.ToString(ultraGrid1.Rows[0].Cells["FN_ZZ_SPEC"].Value).Trim();

                if (string.IsNullOrEmpty(strValue))
                {
                    MessageBox.Show("请输入轧制规格!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, 0, "FN_ZZ_SPEC", true);
                    return(false);
                }

                int     iCount = 0;
                decimal dCount = 0.0M;
                bool    bOK    = false;

                if (ProLine != ProduceLine.GX)
                {
                    strValue = Convert.ToString(ultraGrid1.Rows[0].Cells["FN_LENGTH"].Value).Trim();

                    if (string.IsNullOrEmpty(strValue))
                    {
                        MessageBox.Show("请输入定尺长度!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, 0, "FN_LENGTH", true);
                        return(false);
                    }

                    bOK = int.TryParse(strValue, out iCount);

                    if (!bOK)
                    {
                        MessageBox.Show("定尺长度必须是整数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, 0, "FN_LENGTH", true);
                        return(false);
                    }

                    if (iCount < 0)
                    {
                        MessageBox.Show("定尺长度必须大于零!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, 0, "FN_LENGTH", true);
                        return(false);
                    }
                }

                strValue = Convert.ToString(ultraGrid1.Rows[0].Cells["FN_ZZ_NUM"].Value).Trim();

                if (string.IsNullOrEmpty(strValue))
                {
                    MessageBox.Show("请输入成材条数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, 0, "FN_ZZ_NUM", true);
                    return(false);
                }

                bOK = decimal.TryParse(strValue, out dCount);

                if (!bOK)
                {
                    MessageBox.Show("成材条数必须是数值!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, 0, "FN_ZZ_NUM", true);
                    return(false);
                }

                if (dCount < 0)
                {
                    MessageBox.Show("成材条数必须大于零!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, 0, "FN_ZZ_NUM", true);
                    return(false);
                }

                strValue = Convert.ToString(ultraGrid1.Rows[0].Cells["FN_ZZ_WASTNUM"].Value).Trim();

                if (!string.IsNullOrEmpty(strValue))
                {
                    bOK = decimal.TryParse(strValue, out dCount);

                    if (!bOK)
                    {
                        MessageBox.Show("轧废条数必须是数值!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, 0, "FN_ZZ_WASTNUM", true);
                        return(false);
                    }

                    if (dCount < 0)
                    {
                        MessageBox.Show("轧废条数必须大于零!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, 0, "FN_ZZ_WASTNUM", true);
                        return(false);
                    }
                }

                strValue = Convert.ToString(ultraGrid1.Rows[0].Cells["FN_ZZ_SPEC"].Text).Trim();
                htblValue.Add("V2", strValue);           //轧制规格
                strValue = Convert.ToString(ultraGrid1.Rows[0].Cells["FN_LENGTH"].Text).Trim();
                htblValue.Add("V3", strValue);           //定尺长度
                strValue = Convert.ToString(ultraGrid1.Rows[0].Cells["FD_ZZ_DATE"].Text).Trim();
                htblValue.Add("V4", strValue);           //轧制时间
                strValue = Convert.ToString(ultraGrid1.Rows[0].Cells["FN_ZZ_NUM"].Text).Trim();
                htblValue.Add("V5", strValue);           //成材支数
                strValue = Convert.ToString(ultraGrid1.Rows[0].Cells["FN_ZZ_WASTNUM"].Text).Trim();
                htblValue.Add("V6", strValue);           //轧废支数
                strValue = Convert.ToString(ultraGrid1.Rows[0].Cells["FS_ZZ_MEMO"].Text).Trim();
                htblValue.Add("V8", strValue);           //轧废支数

                return(true);
            }
            catch { }

            return(false);
        }
コード例 #6
0
ファイル: Batch.cs プロジェクト: Strongc/sencond
        private bool DataValidation_Save(out ArrayList alistCardNo, out ArrayList alistCount, out ArrayList alistWeight)
        {
            alistCardNo = new ArrayList();
            alistCount  = new ArrayList();
            alistWeight = new ArrayList();

            ultraGrid2.UpdateData();

            try
            {
                UltraGridRow row = null;
                string       strCardNo = "", strCount = "", strWeight = "";

                for (int i = 0; i < this.ultraGrid2.Rows.Count; i++)
                {
                    row = this.ultraGrid2.Rows[i];

                    if (Convert.ToBoolean(row.Cells["CHECKED"].Value))
                    {
                        strCardNo = Convert.ToString(row.Cells["FS_CARDNO"].Value).Trim();
                        strCount  = Convert.ToString(row.Cells["FN_BILLET_COUNT"].Value).Trim();
                        strWeight = Convert.ToString(row.Cells["FN_BILLET_WEIGHT"].Value).Trim();

                        if (string.IsNullOrEmpty(strCount))
                        {
                            MessageBox.Show("请输入组批条数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                            CommonMethod.SetUltraGridActiveCell(ref ultraGrid2, i, "FN_BILLET_COUNT", true);
                            return(false);
                        }

                        int  iCount = 0;
                        bool bOK    = false;

                        bOK = int.TryParse(strCount, out iCount);

                        if (!bOK)
                        {
                            MessageBox.Show("组批条数必须是整数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                            CommonMethod.SetUltraGridActiveCell(ref ultraGrid2, i, "FN_BILLET_COUNT", true);
                            return(false);
                        }

                        if (iCount <= 0)
                        {
                            MessageBox.Show("组批条数必须大于零!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                            CommonMethod.SetUltraGridActiveCell(ref ultraGrid2, i, "FN_BILLET_COUNT", true);
                            return(false);
                        }

                        if (string.IsNullOrEmpty(strWeight))
                        {
                            MessageBox.Show("请输入组批重量!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                            CommonMethod.SetUltraGridActiveCell(ref ultraGrid2, i, "FN_BILLET_WEIGHT", true);
                            return(false);
                        }

                        decimal dWeight = 0.0M;
                        bOK = decimal.TryParse(strWeight, out dWeight);

                        if (!bOK)
                        {
                            MessageBox.Show("组批重量必须是数值!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                            CommonMethod.SetUltraGridActiveCell(ref ultraGrid2, i, "FN_BILLET_WEIGHT", true);
                            return(false);
                        }

                        if (dWeight <= 0)
                        {
                            MessageBox.Show("组批重量必须大于零!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                            CommonMethod.SetUltraGridActiveCell(ref ultraGrid2, i, "FN_BILLET_WEIGHT", true);
                            return(false);
                        }

                        alistCardNo.Add(strCardNo);
                        alistCount.Add(strCount);
                        alistWeight.Add(strWeight);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("数据验证失败!\n" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return(false);
            }

            return(true);
        }
コード例 #7
0
ファイル: frmWeightQueryBC.cs プロジェクト: Strongc/sencond
        private void GetWeightInfo(string strBatchNo)
        {
            string strWhere = "";

            if (cbxDateTime.Checked)
            {
                string strDateTimeFrom = dateTimePicker1.Value.ToString("yyyy-MM-dd HH:mm");
                string strDateTimeTo   = dateTimePicker2.Value.ToString("yyyy-MM-dd HH:mm");

                strWhere += Convert.ToString("   and t.fd_starttime between to_date('" + strDateTimeFrom + "', 'yyyy-MM-dd HH24:mi') and to_date('" + strDateTimeTo + "', 'yyyy-MM-dd HH24:mi')").Trim() + " ";
            }

            if (!string.IsNullOrEmpty(tbQueryBatchNo.Text.Trim()) && string.IsNullOrEmpty(txtQueryBatchNo2.Text.Trim()))
            {
                strWhere += Convert.ToString("   and t.fs_batchno like '%" + tbQueryBatchNo.Text.Trim() + "%'").Trim() + " ";
            }

            if (string.IsNullOrEmpty(tbQueryBatchNo.Text.Trim()) && !string.IsNullOrEmpty(txtQueryBatchNo2.Text.Trim()))
            {
                strWhere += Convert.ToString("   and t.fs_batchno like '%" + txtQueryBatchNo2.Text.Trim() + "%'").Trim() + " ";
            }

            if (!string.IsNullOrEmpty(tbQueryBatchNo.Text.Trim()) && !string.IsNullOrEmpty(txtQueryBatchNo2.Text.Trim()))
            {
                if (string.IsNullOrEmpty(tbQueryBatchNo.Text.Trim()))
                {
                    strWhere += " and t1.fs_batchno>='" + tbQueryBatchNo.Text.Trim() + "'";
                }
                else
                {
                    strWhere += " and t1.fs_batchno||trim(to_char(fn_bandno,'00'))>='" + tbQueryBatchNo.Text.Trim() + "'||trim(to_char('" + tbQueryBandNo.Text + "','00'))";
                }

                if (string.IsNullOrEmpty(this.tbQueryBandNo2.Text.Trim()))
                {
                    strWhere += " and t1.fs_batchno<='" + txtQueryBatchNo2.Text.Trim() + "'";
                }
                else
                {
                    strWhere += " and t1.fs_batchno||trim(to_char(fn_bandno,'00'))<='" + txtQueryBatchNo2.Text.Trim() + "'||trim(to_char('" + tbQueryBandNo2.Text + "','00'))";
                }
            }

            //PL/SQL SPECIAL COPY

            string strSql = "";

            strSql += Convert.ToString("select a.*,Round(a.fn_theoryweight/a.RealWeight,4)*100 RealRate").Trim() + " ";
            strSql += Convert.ToString("  from (select case").Trim() + " ";
            strSql += Convert.ToString("                 when grouping(fs_batchno) = 0 and grouping(fs_steeltype) = 0 and").Trim() + " ";
            strSql += Convert.ToString("                      grouping(fs_spec) = 0 then").Trim() + " ";
            strSql += Convert.ToString("                  0").Trim() + " ";
            strSql += Convert.ToString("                 when grouping(fs_batchno) = 1 and grouping(fs_steeltype) = 1 and").Trim() + " ";
            strSql += Convert.ToString("                      grouping(fs_spec) = 0 then").Trim() + " ";
            strSql += Convert.ToString("                  1").Trim() + " ";
            strSql += Convert.ToString("                 when grouping(fs_batchno) = 1 and grouping(fs_steeltype) = 0 and").Trim() + " ";
            strSql += Convert.ToString("                      grouping(fs_spec) = 1 then").Trim() + " ";
            strSql += Convert.ToString("                  2").Trim() + " ";
            strSql += Convert.ToString("                 when grouping(fs_batchno) = 1 and grouping(fs_steeltype) = 1 and").Trim() + " ";
            strSql += Convert.ToString("                      grouping(fs_spec) = 1 then").Trim() + " ";
            strSql += Convert.ToString("                  3").Trim() + " ";
            strSql += Convert.ToString("                 else").Trim() + " ";
            strSql += Convert.ToString("                  4").Trim() + " ";
            strSql += Convert.ToString("               end XH,").Trim() + " ";
            strSql += Convert.ToString("               case").Trim() + " ";
            strSql += Convert.ToString("                 when grouping(fs_batchno) = 1 and grouping(fs_steeltype) = 1 and").Trim() + " ";
            strSql += Convert.ToString("                      grouping(fs_spec) = 0 then").Trim() + " ";
            strSql += Convert.ToString("                  '规格【' || fs_spec || '】小计:'").Trim() + " ";
            strSql += Convert.ToString("                 when grouping(fs_batchno) = 1 and grouping(fs_steeltype) = 0 and").Trim() + " ";
            strSql += Convert.ToString("                      grouping(fs_spec) = 1 then").Trim() + " ";
            strSql += Convert.ToString("                  '牌号【' || fs_steeltype || '】小计:'").Trim() + " ";
            strSql += Convert.ToString("                 when grouping(fs_batchno) = 1 and grouping(fs_steeltype) = 1 and").Trim() + " ";
            strSql += Convert.ToString("                      grouping(fs_spec) = 1 then").Trim() + " ";
            strSql += Convert.ToString("                  '总计:'").Trim() + " ";
            strSql += Convert.ToString("                 when grouping(fs_steeltype) = 0 and grouping(fs_spec) = 0 then").Trim() + " ";
            strSql += Convert.ToString("                  max(fs_batchno)").Trim() + " ";
            strSql += Convert.ToString("               end fs_batchno,").Trim() + " ";
            strSql += Convert.ToString("               case").Trim() + " ";
            strSql += Convert.ToString("                 when grouping(fs_batchno) = 0 and grouping(fs_steeltype) = 0 and").Trim() + " ";
            strSql += Convert.ToString("                      grouping(fs_spec) = 0 then").Trim() + " ";
            strSql += Convert.ToString("                  fs_steeltype").Trim() + " ";
            strSql += Convert.ToString("                 else").Trim() + " ";
            strSql += Convert.ToString("                  null").Trim() + " ";
            strSql += Convert.ToString("               end fs_steeltype,").Trim() + " ";
            strSql += Convert.ToString("               case").Trim() + " ";
            strSql += Convert.ToString("                 when grouping(fs_batchno) = 0 and grouping(fs_steeltype) = 0 and").Trim() + " ";
            strSql += Convert.ToString("                      grouping(fs_spec) = 0 then").Trim() + " ";
            strSql += Convert.ToString("                  fs_spec").Trim() + " ";
            strSql += Convert.ToString("                 else").Trim() + " ";
            strSql += Convert.ToString("                  null").Trim() + " ";
            strSql += Convert.ToString("               end fs_spec,").Trim() + " ";
            strSql += Convert.ToString("               sum(nvl(fn_bandcount, 0)) fn_bandcount,").Trim() + " ";
            strSql += Convert.ToString("               round(sum(nvl(fn_totalweight, 0)), 3) fn_totalweight,").Trim() + " ";
            strSql += Convert.ToString("               round(sum(nvl(fn_theoryweight, 0)), 3) fn_theoryweight,sum(Realweight) Realweight,").Trim() + " ";
            strSql += Convert.ToString("               case").Trim() + " ";
            strSql += Convert.ToString("                 when grouping(fs_batchno) = 0 and grouping(fs_steeltype) = 0 and").Trim() + " ";
            strSql += Convert.ToString("                      grouping(fs_spec) = 0 then").Trim() + " ";
            strSql += Convert.ToString("                  max(fs_productno)").Trim() + " ";
            strSql += Convert.ToString("                 else").Trim() + " ";
            strSql += Convert.ToString("                  null").Trim() + " ";
            strSql += Convert.ToString("               end fs_productno,").Trim() + " ";
            strSql += Convert.ToString("               case").Trim() + " ";
            strSql += Convert.ToString("                 when grouping(fs_batchno) = 0 and grouping(fs_steeltype) = 0 and").Trim() + " ";
            strSql += Convert.ToString("                      grouping(fs_spec) = 0 then").Trim() + " ";
            strSql += Convert.ToString("                  max(fd_starttime)").Trim() + " ";
            strSql += Convert.ToString("                 else").Trim() + " ";
            strSql += Convert.ToString("                  null").Trim() + " ";
            strSql += Convert.ToString("               end fd_starttime,").Trim() + " ";
            strSql += Convert.ToString("               case").Trim() + " ";
            strSql += Convert.ToString("                 when grouping(fs_batchno) = 0 and grouping(fs_steeltype) = 0 and").Trim() + " ";
            strSql += Convert.ToString("                      grouping(fs_spec) = 0 then").Trim() + " ";
            strSql += Convert.ToString("                  max(fd_endtime)").Trim() + " ";
            strSql += Convert.ToString("                 else").Trim() + " ";
            strSql += Convert.ToString("                  null").Trim() + " ";
            strSql += Convert.ToString("               end fd_endtime,").Trim() + " ";
            strSql += Convert.ToString("               case").Trim() + " ";
            strSql += Convert.ToString("                 when grouping(fs_batchno) = 0 and grouping(fs_steeltype) = 0 and").Trim() + " ";
            strSql += Convert.ToString("                      grouping(fs_spec) = 0 then").Trim() + " ";
            strSql += Convert.ToString("                  max(fs_completeflag)").Trim() + " ";
            strSql += Convert.ToString("                 else").Trim() + " ";
            strSql += Convert.ToString("                  null").Trim() + " ";
            strSql += Convert.ToString("               end fs_completeflag ").Trim() + " ";
            strSql += Convert.ToString("          from (select t.fs_batchno,").Trim() + " ";
            strSql += Convert.ToString("                       t.fs_productno,").Trim() + " ";
            strSql += Convert.ToString("                       t.fs_steeltype,").Trim() + " ";
            strSql += Convert.ToString("                       t.fs_spec,").Trim() + " ";
            strSql += Convert.ToString("                       t1.fn_bandcount,").Trim() + " ";
            strSql += Convert.ToString("                       t1.fn_totalweight,").Trim() + " ";
            strSql += Convert.ToString("                       t1.fn_theoryweight,").Trim() + " ";
            strSql += Convert.ToString("                       to_char(t.fd_starttime, 'yyyy-MM-dd hh24:mi:ss') fd_starttime,").Trim() + " ";
            strSql += Convert.ToString("                       to_char(t.fd_endtime, 'yyyy-MM-dd hh24:mi:ss') fd_endtime,").Trim() + " ";
            strSql += Convert.ToString("                       decode(t.fs_completeflag, '1', '√', '') fs_completeflag").Trim() + " ";
            strSql += ",(select  sum(it.fn_jj_weight) from it_fp_techcard it where it.fs_zc_batchno=t.fs_batchno) RealWeight  ";
            strSql += Convert.ToString("                  from dt_productweightmain t,").Trim() + " ";
            strSql += Convert.ToString("                       (select t1.fs_batchno,").Trim() + " ";
            strSql += Convert.ToString("                               count(1) fn_bandcount,").Trim() + " ";
            strSql += Convert.ToString("                               round(sum(nvl(t1.fn_weight, 0)),3) fn_totalweight,").Trim() + " ";
            strSql += Convert.ToString("                               round(sum(nvl(t1.fn_theoryweight, 0)),3) fn_theoryweight").Trim() + " ";
            strSql += Convert.ToString("                          from dt_productweightdetail t1").Trim() + " ";
            strSql += Convert.ToString("                         where exists").Trim() + " ";
            strSql += Convert.ToString("                         (select 1").Trim() + " ";
            strSql += Convert.ToString("                                  from dt_productweightmain t").Trim() + " ";
            strSql += Convert.ToString("                                 where t.fs_batchno = t1.fs_batchno " + strWhere + ")").Trim() + " ";
            strSql += Convert.ToString("                         group by t1.fs_batchno) t1").Trim() + " ";
            strSql += Convert.ToString("                 where t.fs_batchno = t1.fs_batchno)").Trim() + " ";
            strSql += Convert.ToString("         group by cube(fs_batchno, fs_steeltype, fs_spec)) a").Trim() + " ";
            strSql += Convert.ToString(" where xh <> 4").Trim() + " ";
            strSql += Convert.ToString(" order by xh, fs_batchno").Trim();

            string    err = "";
            DataTable tbMain = null, tbDetail = null;

            DataSet ds = SelectReturnDS("ygjzjl.bar.DBHelp", "getSqlInfo", new object[] { strSql }, out err);

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                tbMain = ds.Tables[0];
            }
            else
            {
                if (!string.IsNullOrEmpty(err))
                {
                    MessageBox.Show("查询出错!\n" + err, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                dataTable2.Rows.Clear();
                dataTable1.Rows.Clear();
                return;
            }

            strWhere = "";
            string strWhere1 = string.Empty;

            if (cbxDateTime.Checked)
            {
                string strDateTimeFrom = dateTimePicker1.Value.ToString("yyyy-MM-dd HH:mm");
                string strDateTimeTo   = dateTimePicker2.Value.ToString("yyyy-MM-dd HH:mm");

                strWhere1 += Convert.ToString("   and x.fd_starttime between to_date('" + strDateTimeFrom + "', 'yyyy-MM-dd HH24:mi') and to_date('" + strDateTimeTo + "', 'yyyy-MM-dd HH24:mi')").Trim() + " ";
            }

            if (!string.IsNullOrEmpty(tbQueryBatchNo.Text.Trim()) && string.IsNullOrEmpty(txtQueryBatchNo2.Text.Trim()))
            {
                strWhere1 += Convert.ToString("   and x.fs_batchno like '%" + tbQueryBatchNo.Text.Trim() + "%'").Trim() + " ";
            }

            if (string.IsNullOrEmpty(tbQueryBatchNo.Text.Trim()) && !string.IsNullOrEmpty(txtQueryBatchNo2.Text.Trim()))
            {
                strWhere1 += Convert.ToString("   and x.fs_batchno like '%" + txtQueryBatchNo2.Text.Trim() + "%'").Trim() + " ";
            }

            if (!string.IsNullOrEmpty(tbQueryBatchNo.Text.Trim()) && !string.IsNullOrEmpty(txtQueryBatchNo2.Text.Trim()))
            {
                if (string.IsNullOrEmpty(tbQueryBatchNo.Text.Trim()))
                {
                    strWhere += " and t.fs_batchno>='" + tbQueryBatchNo.Text.Trim() + "'";
                }
                else
                {
                    strWhere += " and t.fs_batchno||trim(to_char(fn_bandno,'00'))>='" + tbQueryBatchNo.Text.Trim() + "'||trim(to_char('" + tbQueryBandNo.Text + "','00'))";
                }

                if (string.IsNullOrEmpty(this.tbQueryBandNo2.Text.Trim()))
                {
                    strWhere += " and t.fs_batchno<='" + txtQueryBatchNo2.Text.Trim() + "'";
                }
                else
                {
                    strWhere += " and t.fs_batchno||trim(to_char(fn_bandno,'00'))<='" + txtQueryBatchNo2.Text.Trim() + "'||trim(to_char('" + tbQueryBandNo2.Text + "','00'))";
                }
            }

            strSql  = "";
            strSql += Convert.ToString("select t.fn_bandno,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_weight,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_theoryweight,").Trim() + " ";
            strSql += Convert.ToString("       t.fs_type,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_length,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_bandbilletcount,").Trim() + " ";
            strSql += Convert.ToString("       t.fs_person,").Trim() + " ";
            strSql += Convert.ToString("       decode(t.fs_point, 'K17', '棒材1#秤', 'K18', '棒材1#秤', t.fs_point) fs_point,").Trim() + " ";
            strSql += Convert.ToString("       to_char(t.fd_datetime, 'yyyy-MM-dd HH24:mi:ss') fd_datetime,").Trim() + " ";
            strSql += Convert.ToString("       t.fs_shift,").Trim() + " ";
            strSql += Convert.ToString("       t.fs_term,").Trim() + " ";
            strSql += Convert.ToString("       decode(t.fs_upflag, '1', '√', '') fs_upflag,").Trim() + " ";
            strSql += Convert.ToString("       t1.fs_standno,").Trim() + " ";
            strSql += Convert.ToString("       t1.fs_printweighttype,").Trim() + " ";
            strSql += Convert.ToString("       t1.fs_printtype,").Trim() + " ";
            strSql += Convert.ToString("       t1.fs_twinstype,").Trim() + " ";
            strSql += Convert.ToString("       t1.fs_addresscheck,").Trim() + " ";
            strSql += Convert.ToString("       t1.fs_standardcheck,").Trim() + " ";
            strSql += Convert.ToString("       t1.fs_steeltypecheck,").Trim() + " ";
            strSql += Convert.ToString("       t.fs_weightno,t.FS_JUDGER,to_char(t.FS_JUDGETIME, 'yyyy-MM-dd HH24:mi:ss') FS_JUDGETIME,").Trim() + " ";
            strSql += Convert.ToString("       decode(nvl(t.fs_unqualified, '0'), '1', '不合格', '合格') fs_unqualified,").Trim() + " ";
            strSql += Convert.ToString("       t.fs_batchno,round((t.fn_weight-t.fn_theoryweight)/t.fn_theoryweight*100,3) FN_DISWEIGHT").Trim() + " ";
            strSql += Convert.ToString("  from dt_productweightdetail t, dt_productplan t1").Trim() + " ";
            strSql += Convert.ToString(" where exists (select 1").Trim() + " ";
            strSql += Convert.ToString("          from dt_productweightmain x").Trim() + " ";
            strSql += Convert.ToString("         where x.fs_batchno = t.fs_batchno " + strWhere1 + ")").Trim() + " ";
            strSql += strWhere;
            strSql += Convert.ToString("   and t.fs_batchno = t1.fs_batchno(+)").Trim() + " ";
            strSql += Convert.ToString("   and t.fs_point = t1.fs_pointid(+)").Trim() + " ";
            strSql += Convert.ToString(" order by t.fs_batchno, t.fn_bandno").Trim();

            err = "";

            ds = SelectReturnDS("ygjzjl.bar.DBHelp", "getSqlInfo", new object[] { strSql }, out err);

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                tbDetail = ds.Tables[0];

                ArrayList alistCnst1 = new ArrayList();
                if (dataTable2.Constraints.Count > 0)
                {
                    foreach (Constraint cnst in dataTable2.Constraints)
                    {
                        alistCnst1.Add(cnst);
                    }

                    dataTable2.Constraints.Clear();
                }

                CommonMethod.CopyDataToDatatable(ref tbDetail, ref dataTable2, true);
                CommonMethod.CopyDataToDatatable(ref tbMain, ref dataTable1, true);

                for (int i = 0; i < alistCnst1.Count; i++)
                {
                    dataTable2.Constraints.Add((Constraint)alistCnst1[i]);
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(err))
                {
                    MessageBox.Show("查询出错!\n" + err, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }

            CommonMethod.RefreshAndAutoSize(ultraGrid1);

            if (ultraGrid1.Rows.Count > 0)
            {
                ultraGrid1.ActiveRow = ultraGrid1.Rows[0];
            }

            if (string.IsNullOrEmpty(strBatchNo))
            {
                return;
            }

            for (int i = 0; i < ultraGrid1.Rows.Count; i++)
            {
                try
                {
                    if (Convert.ToString(ultraGrid1.Rows[i].Cells["FS_BATCHNO"].Value).Equals(strBatchNo))
                    {
                        ultraGrid1.Rows[i].ExpandAll();
                        CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, i, "FS_BATCHNO", false);
                        break;
                    }
                }
                catch { }
            }
        }
コード例 #8
0
        private void GetStockInfo(string strCardNo)
        {
            //PL/SQL Special Copy
            string strSql = "";

            strSql += Convert.ToString("select 'false' checked,").Trim() + " ";
            strSql += Convert.ToString("       t.fs_cardno,").Trim() + " ";
            strSql += Convert.ToString("       to_char(t.fd_smeltdate, 'yyyy-MM-dd hh24:mi:ss') fd_smeltdate,").Trim() + " ";
            strSql += Convert.ToString("       t.fs_gp_stoveno,").Trim() + " ";
            strSql += Convert.ToString("       t.fs_gp_steeltype,").Trim() + " ";
            strSql += Convert.ToString("       t.fs_gp_spe,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_gp_c,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_gp_si,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_gp_mn,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_gp_s,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_gp_p,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_gp_ni,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_gp_cr,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_gp_cu,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_gp_v,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_gp_mo,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_gp_ceq,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_gp_as,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_gp_ti,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_gp_sb,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_gp_als,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_gp_totalcount,").Trim() + " ";
            strSql += Convert.ToString("       round(t.fn_jj_weight, 3) fn_jj_weight,").Trim() + " ";
            strSql += Convert.ToString("       round(t.fn_gp_totalcount * round(decode(substr(t.fs_gp_stoveno, 4, 1), '1', 0.174, '2', 0.174, '3', 0.176, 0.174) * t.fn_gp_len, 3), 3) fn_jj_weight_ll,").Trim() + " ";
            strSql += Convert.ToString("       t.fs_gp_memo,").Trim() + " ";
            strSql += Convert.ToString("       t.fs_gp_judger,").Trim() + " ";
            strSql += Convert.ToString("       to_char(t.fd_gp_judgedate, 'yyyy-MM-dd hh24:mi:ss') fd_gp_judgedate,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_gpys_number,").Trim() + " ";
            strSql += Convert.ToString("       t.fs_djh,").Trim() + " ";
            strSql += Convert.ToString("       to_char(t.fd_gpys_receivedate, 'yyyy-MM-dd hh24:mi:ss') fd_gpys_receivedate,").Trim() + " ";
            strSql += Convert.ToString("       t.fs_gpys_receiver,").Trim() + " ";
            strSql += Convert.ToString("       decode(nvl(t.fs_checked, '0'), '0', '', '√') fs_checked,").Trim() + " ";
            strSql += Convert.ToString("       round(t.fn_gpys_weight, 3) fn_gpys_weight,").Trim() + " ";
            strSql += Convert.ToString("       round(t.fn_gpys_number * round(decode(substr(t.fs_gp_stoveno, 4, 1), '1', 0.174, '2', 0.174, '3', 0.176, 0.174) * t.fn_gp_len, 3), 3) fn_gpys_weight_ll,").Trim() + " ";
            strSql += Convert.ToString("       round(t.fn_gp_len, 2) fn_gp_len,").Trim() + " ";
            strSql += Convert.ToString("       t.fs_advisespec,").Trim() + " ";
            strSql += "decode(t.FS_UNQUALIFIED,'0','√','1','×','√') FS_UNQUALIFIED ";
            strSql += Convert.ToString("  from it_fp_techcard t").Trim() + " ";
            strSql += Convert.ToString(" where 1 = 1").Trim() + " ";
            strSql += Convert.ToString("   and case when t.fs_transtype = '1' or t.fs_transtype = '2' then nvl(t.fs_gp_completeflag, '0') when t.fs_transtype = '3' then '1' else '0' end = '1'").Trim() + " ";
            strSql += Convert.ToString("   and case when t.fs_transtype = '1' or t.fs_transtype = '2' then nvl(t.fn_jj_weight, 0) when t.fs_transtype = '3' then 1 else 0 end > 0").Trim() + " ";
            strSql += Convert.ToString("   and nvl(t.fs_batched, '0') = '0' and t.fs_zc_batchno is null").Trim() + " ";
            strSql += Convert.ToString("   and t.fs_gp_flow = '" + this._STOCK + "'").Trim() + " ";
            strSql += Convert.ToString("   and nvl(t.fs_isvalid, '0') = '0'").Trim() + " ";

            if (!string.IsNullOrEmpty(tbQueryButtressNo.Text.Trim()))
            {
                strSql += Convert.ToString("   and t.fs_djh like '%" + tbQueryButtressNo.Text.Trim() + "%'").Trim() + " ";
            }

            if (!string.IsNullOrEmpty(tbQueryStoveNo.Text.Trim()))
            {
                strSql += Convert.ToString("   and t.fs_gp_stoveno like '%" + tbQueryStoveNo.Text.Trim() + "%'").Trim() + " ";
            }

            strSql += Convert.ToString(" order by t.fs_gp_stoveno desc").Trim();

            string  err = "";
            DataSet ds  = SelectReturnDS("ygjzjl.bar.DBHelp", "getSqlInfo", new object[] { strSql }, out err);

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                DataTable table = ds.Tables[0];
                CommonMethod.CopyDataToDatatable(ref table, ref dataTable1, true);
            }
            else
            {
                if (!string.IsNullOrEmpty(err))
                {
                    MessageBox.Show("查询出错!\n" + err, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                dataTable1.Rows.Clear();
            }

            CommonMethod.RefreshAndAutoSize(ultraGrid1);

            if (ultraGrid1.Rows.Count > 0)
            {
                ultraGrid1.ActiveRow = ultraGrid1.Rows[0];
            }

            //if (string.IsNullOrEmpty(strCardNo))
            // return;

            for (int i = 0; i < ultraGrid1.Rows.Count; i++)
            {
                try
                {
                    if (Convert.ToString(ultraGrid1.Rows[i].Cells["FS_CARDNO"].Value).Equals(strCardNo))
                    {
                        CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, i, "FS_CARDNO", false);
                    }

                    if (ultraGrid1.Rows[i].Cells["FS_UNQUALIFIED"].Value.ToString() == "×")
                    {
                        ultraGrid1.Rows[i].Appearance.ForeColor = Color.Red;
                    }
                }
                catch { }
            }
        }
コード例 #9
0
        private void GetFlowCardInfo(string strCardNo)
        {
            string strSql = "";

            strSql += Convert.ToString("select 'false' checked,").Trim() + " ";
            strSql += Convert.ToString("       t.fs_cardno,").Trim() + " ";
            strSql += Convert.ToString("       to_char(t.fd_smeltdate, 'yyyy-mm-dd hh24:mi:ss') fd_smeltdate,").Trim() + " ";
            strSql += Convert.ToString("       t.fs_gp_stoveno,").Trim() + " ";
            strSql += Convert.ToString("       t.fs_gp_steeltype,").Trim() + " ";
            strSql += Convert.ToString("       t.fs_gp_spe,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_gp_c,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_gp_si,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_gp_mn,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_gp_s,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_gp_p,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_gp_ni,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_gp_cr,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_gp_cu,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_gp_v,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_gp_mo,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_gp_ceq,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_gp_as,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_gp_ti,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_gp_sb,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_gp_als,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_gp_totalcount,").Trim() + " ";
            strSql += Convert.ToString("       round(round(t.fn_gp_len *0.21, 3) * decode(nvl(t.fn_gp_checkcount, 0), 0, nvl(t.fn_gp_totalcount, 0), nvl(t.fn_gp_checkcount, 0)), 3)  fn_ll_weight,").Trim() + " ";
            strSql += Convert.ToString("       decode(nvl(t.fn_gp_checkcount, 0), 0, nvl(t.fn_gp_totalcount, 0), nvl(t.fn_gp_checkcount, 0)) fn_gp_checkcount,").Trim() + " ";
            strSql += Convert.ToString("       round(decode(nvl(t.fn_gp_totalcount, 0), 0, '', (decode(nvl(t.fn_gp_checkcount, 0), 0, nvl(t.fn_gp_totalcount, 0), nvl(t.fn_gp_checkcount, 0))*nvl(t.fn_jj_weight, 0)/nvl(t.fn_gp_totalcount,0))), 3) fn_jj_weight,").Trim() + " ";
            strSql += Convert.ToString("       t.fs_gp_memo,").Trim() + " ";
            strSql += Convert.ToString("       t.fs_gp_judger,").Trim() + " ";
            strSql += Convert.ToString("       to_char(t.fd_gp_judgedate, 'yyyy-mm-dd hh24:mi:ss') fd_gp_judgedate,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_gpys_number,").Trim() + " ";
            strSql += Convert.ToString("       t.fs_djh,").Trim() + " ";
            strSql += Convert.ToString("       to_char(t.fd_gpys_receivedate, 'yyyy-mm-dd hh24:mi:ss') fd_gpys_receivedate,").Trim() + " ";
            strSql += Convert.ToString("       t.fs_gpys_receiver,").Trim() + " ";
            strSql += Convert.ToString("       t.fs_zc_batchno,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_zc_enternumber,").Trim() + " ";
            strSql += Convert.ToString("       to_char(t.fd_zc_enterdatetime, 'yyyy-mm-dd hh24:mi:ss') fd_zc_enterdatetime,").Trim() + " ";
            strSql += Convert.ToString("       t.fs_zc_operator,").Trim() + " ";
            strSql += Convert.ToString("       t.fs_zc_memo,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_zz_spec,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_length,").Trim() + " ";
            strSql += Convert.ToString("       to_char(t.fd_zz_date, 'yyyy-mm-dd hh24:mi:ss') fd_zz_date,").Trim() + " ";
            strSql += Convert.ToString("       t.fs_zz_operator,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_zz_num,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_zz_wastnum,").Trim() + " ";
            strSql += Convert.ToString("       t.fs_zz_memo,").Trim() + " ";
            strSql += Convert.ToString("       t.fs_gp_flow,").Trim() + " ";
            strSql += Convert.ToString("       nvl(t.fs_discharge_begined, '0') fs_discharge_begined,").Trim() + " ";
            strSql += Convert.ToString("       nvl(t.fs_discharge_end, '0') fs_discharge_end,").Trim() + " ";
            strSql += Convert.ToString("       decode(t.fs_freezed, '1', '冻结', '自由') fs_freezed,").Trim() + " ";
            strSql += Convert.ToString("       decode(t.fs_checked, '1', '√', '') fs_checked,").Trim() + " ";
            strSql += "decode(t.FS_UNQUALIFIED,'0','√','1','×','√') FS_UNQUALIFIED ";
            strSql += Convert.ToString("  from it_fp_techcard t").Trim() + " ";
            strSql += Convert.ToString(" where nvl(t.fs_isvalid, '0') = '0'").Trim() + " ";

            if (_POST == Post.Receive)
            {
                string str = "";

                if (cbx_Other1.Checked)
                {
                    str += " t.fs_gp_flow = '" + GetOther1() + "' ";
                }

                if (cbx_Other2.Checked)
                {
                    str += (string.IsNullOrEmpty(str) ? "" : " or ") + " t.fs_gp_flow = '" + GetOther2() + "' ";
                }

                if (cbx_Other3.Checked)
                {
                    str += (string.IsNullOrEmpty(str) ? "" : " or ") + " t.fs_gp_flow = '" + GetOther3() + "' ";
                }

                if (string.IsNullOrEmpty(str))
                {
                    str += " t.fs_gp_flow = '" + _STOCK + "' ";
                }

                str = "(" + str + ")";

                strSql += " and " + str + " ";
                //strSql += Convert.ToString("   and case when t.fs_transtype = '1' or t.fs_transtype = '2' then nvl(t.fs_gp_completeflag, '0') when t.fs_transtype = '3' then '1' else '0' end = '1'").Trim() + " ";
                //strSql += Convert.ToString("   and case when t.fs_transtype = '1' or t.fs_transtype = '2' then nvl(t.fn_jj_weight, 0) when t.fs_transtype = '3' then 1 else 0 end > 0").Trim() + " ";
                strSql += Convert.ToString("   and nvl(t.fs_batched, '0') = '0' and t.fs_zc_batchno is null").Trim() + " ";

                if (rbtnA.Checked)
                {
                    strSql += Convert.ToString("   and (nvl(t.Fs_Checked, 0) = '0' or nvl(t.Fn_Gpys_Number, 0) <= 0)").Trim() + " ";
                }
                else if (rbtnB.Checked)
                {
                    strSql += Convert.ToString("   and nvl(t.Fs_Checked, 0) = '1' and nvl(t.Fn_Gpys_Number, 0) > 0").Trim() + " ";
                }
            }
            else if (_POST == Post.Charge)
            {
                strSql += Convert.ToString("   and t.fs_gp_flow = '" + _STOCK + "'").Trim() + " ";
                strSql += Convert.ToString("   and nvl(t.fs_batched, '0') = '1'").Trim() + " ";
                strSql += Convert.ToString("   and t.fs_zc_batchno is not null").Trim() + " ";
                strSql += Convert.ToString("   and nvl(t.fn_zz_num, 0) = 0").Trim() + " ";

                if (rbtnA.Checked)
                {
                    strSql += Convert.ToString("   and nvl(t.Fn_Zc_Enternumber, 0) <= 0").Trim() + " ";
                }
                else if (rbtnB.Checked)
                {
                    strSql += Convert.ToString("   and nvl(t.Fn_Zc_Enternumber, 0) > 0").Trim() + " ";
                }
            }
            else if (_POST == Post.DisCharge)
            {
                strSql += Convert.ToString("   and t.fs_gp_flow = '" + _STOCK + "'").Trim() + " ";
                strSql += Convert.ToString("   and nvl(t.fs_batched, '0') = '1'").Trim() + " ";
                strSql += Convert.ToString("   and t.fs_zc_batchno is not null").Trim() + " ";
                strSql += Convert.ToString("   and nvl(t.fn_zc_enternumber, 0) > 0").Trim() + " ";
                strSql += Convert.ToString("   and t.fs_zc_operator is not null").Trim() + " ";
                strSql += Convert.ToString("   and not exists (select 1 from dt_productplan t1 where t1.fs_batchno = t.fs_zc_batchno and nvl(t1.fs_completeflag, '0') = '1')").Trim() + " ";

                if (rbtnA.Checked)
                {
                    strSql += Convert.ToString("   and nvl(t.fs_discharge_begined, '0') = '0'").Trim() + " ";
                }
                else if (rbtnB.Checked)
                {
                    strSql += Convert.ToString("   and nvl(t.fs_discharge_end, '0') = '1'").Trim() + " ";
                }
            }
            else if (_POST == Post.Roll)
            {
                strSql += Convert.ToString("   and t.fs_gp_flow = '" + _STOCK + "'").Trim() + " ";
                strSql += Convert.ToString("   and nvl(t.fs_batched, '0') = '1'").Trim() + " ";
                strSql += Convert.ToString("   and t.fs_zc_batchno is not null").Trim() + " ";
                strSql += Convert.ToString("   and nvl(t.fn_zc_enternumber, 0) > 0").Trim() + " ";
                strSql += Convert.ToString("   and t.fs_zc_operator is not null").Trim() + " ";

                if (rbtnA.Checked)
                {
                    strSql += Convert.ToString("   and nvl(t.Fn_Zz_Num, 0) <= 0").Trim() + " ";
                }
                else if (rbtnB.Checked)
                {
                    strSql += Convert.ToString("   and nvl(t.Fn_Zz_Num, 0) > 0").Trim() + " ";
                }
            }

            if (cbxDateTime.Checked)
            {
                string strDateTimeFrom = dateTimePicker1.Value.ToString("yyyy-MM-dd HH:mm");
                string strDateTimeTo   = dateTimePicker2.Value.ToString("yyyy-MM-dd HH:mm");

                if (_POST == Post.Receive)
                {
                    strSql += Convert.ToString("   and t.fd_gp_judgedate between to_date('" + strDateTimeFrom + "', 'yyyy-MM-dd HH24:mi') and to_date('" + strDateTimeTo + "', 'yyyy-MM-dd HH24:mi')").Trim() + " ";
                }
                else
                {
                    strSql += Convert.ToString("   and t.fs_batch_optdate between to_date('" + strDateTimeFrom + "', 'yyyy-MM-dd HH24:mi') and to_date('" + strDateTimeTo + "', 'yyyy-MM-dd HH24:mi')").Trim() + " ";
                }
            }

            if (!string.IsNullOrEmpty(tbQueryBatchNo.Text.Trim()))
            {
                if (_POST == Post.Receive)
                {
                    strSql += Convert.ToString("   and t.fs_djh like '%" + tbQueryBatchNo.Text.Trim() + "%'").Trim() + " ";
                }
                else
                {
                    strSql += Convert.ToString("   and t.fs_zc_batchno like '%" + tbQueryBatchNo.Text.Trim() + "%'").Trim() + " ";
                }
            }

            if (!string.IsNullOrEmpty(tbQueryStoveNo.Text.Trim()))
            {
                strSql += Convert.ToString("   and t.fs_gp_stoveno like '%" + tbQueryStoveNo.Text.Trim().ToUpper() + "%'").Trim() + " ";
            }

            if (_POST == Post.Receive)
            {
                strSql += Convert.ToString("   order by t.fs_gp_stoveno desc").Trim() + " ";
            }
            else
            {
                strSql += Convert.ToString("   order by t.fs_zc_batchno desc, t.fs_gp_stoveno").Trim() + " ";
            }

            string  err = "";
            DataSet ds  = SelectReturnDS("ygjzjl.bar.DBHelp", "getSqlInfo", new object[] { strSql }, out err);

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                DataTable table = ds.Tables[0];
                CommonMethod.CopyDataToDatatable(ref table, ref dataTable1, true);
            }
            else
            {
                if (!string.IsNullOrEmpty(err))
                {
                    MessageBox.Show("查询出错!\n" + err, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                dataTable1.Rows.Clear();
            }

            CommonMethod.RefreshAndAutoSize(ultraGrid1);

            MarkupRows();

            if (dataTable1.Rows.Count == 0)
            {
                ucBilletFlowCard1.ResetData();
            }
            else
            {
                ultraGrid1.ActiveRow = ultraGrid1.Rows[0];
            }

            //if (string.IsNullOrEmpty(strCardNo))
            //return;

            for (int i = 0; i < ultraGrid1.Rows.Count; i++)
            {
                try
                {
                    if (Convert.ToString(ultraGrid1.Rows[i].Cells["FS_CARDNO"].Value).Equals(strCardNo))
                    {
                        CommonMethod.SetUltraGridActiveCell(ref ultraGrid1, i, "FS_CARDNO", false);
                    }

                    if (ultraGrid1.Rows[i].Cells["FS_UNQUALIFIED"].Value.ToString() == "×")
                    {
                        ultraGrid1.Rows[i].Appearance.ForeColor = Color.Red;
                    }
                }
                catch { }
            }
        }