Exemple #1
0
        private void BilletStock_Load(object sender, EventArgs e)
        {
            CommonMethod.RefreshAndAutoSize(ultraGrid1);

            try
            {
                string strKey = this.CustomInfo.ToUpper();

                if (!string.IsNullOrEmpty(strKey) && strKey.Length == 2)
                {
                    if (strKey.Substring(0, 2).Equals("GX"))
                    {
                        this._STOCK = "SH000100";
                    }
                    else if (strKey.Substring(0, 2).Equals("BC"))
                    {
                        this._STOCK = "SH000098";
                    }
                    else if (strKey.Substring(0, 2).Equals("XC"))
                    {
                        this._STOCK = "SH000120";                                                  //型材未知
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
Exemple #2
0
        private void frmWeightQueryBC_Load(object sender, EventArgs e)
        {
            CommonMethod.RefreshAndAutoSize(ultraGrid1);

            try
            {
                dateTimePicker1.Value = DateTime.Today;
                dateTimePicker2.Value = DateTime.Today.AddDays(1).AddSeconds(-1);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }

            try
            {
                this.ultraGrid1.DisplayLayout.Bands[1].Columns["FS_SHIFT"].ValueList = CommonMethod.GetValuelistBanci();
                this.ultraGrid1.DisplayLayout.Bands[1].Columns["FS_TERM"].ValueList  = CommonMethod.GetValuelistBanzu();
            }
            catch { }

            try
            {
                string strKey = this.CustomInfo.ToUpper();

                if (!string.IsNullOrEmpty(strKey) && strKey.Length == 1)
                {
                    if (strKey.Substring(0, 1).Equals("0"))                         //查询
                    {
                        this.ultraToolbarsManager1.Toolbars[1].Visible = false;
                        this.SetToolButtonVisible("判定不合格", false);
                        this.SetToolButtonVisible("撤销不合格", false);
                    }
                    else if (strKey.Substring(0, 1).Equals("1"))                    //补打
                    {
                        this.ultraToolbarsManager1.Toolbars[1].Visible = true;
                        this.SetToolButtonVisible("判定不合格", false);
                        this.SetToolButtonVisible("撤销不合格", false);
                    }
                    else if (strKey.Substring(0, 1).Equals("2"))                    //判废
                    {
                        this.ultraToolbarsManager1.Toolbars[1].Visible = false;
                        this.SetToolButtonVisible("判定不合格", true);
                        this.SetToolButtonVisible("撤销不合格", true);
                    }
                }
            }
            catch { }

            try
            {
                pictureBox3.Hide();
                pictureBox3.SendToBack();
            }
            catch { }
        }
Exemple #3
0
        private void Batch_Load(object sender, EventArgs e)
        {
            CommonMethod.RefreshAndAutoSize(ultraGrid1);
            CommonMethod.RefreshAndAutoSize(ultraGrid2);

            try
            {
                dateTimePicker1.Value = DateTime.Today;
                dateTimePicker2.Value = DateTime.Today.AddDays(1).AddSeconds(-1);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }

            try
            {
                string strKey = this.CustomInfo.ToUpper();

                if (!string.IsNullOrEmpty(strKey))
                {
                    if (strKey.Substring(0, 3).Equals("ZKD"))
                    {
                        this._STOCK       = "SH000100";
                        this._PRODUCELINE = ProduceLine.ZKD;
                        CodeType.Visible  = false;
                    }
                    else if (strKey.Substring(0, 2).Equals("BC"))
                    {
                        this._STOCK       = "SH000098";
                        this._PRODUCELINE = ProduceLine.BC;
                        CodeType.Visible  = false;
                    }
                    else if (strKey.Substring(0, 2).Equals("XC"))
                    {
                        this._STOCK       = "SH000120";                                            //型材未知
                        this._PRODUCELINE = ProduceLine.XC;
                        CodeType.Visible  = true;
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }

            this.GetBatchInfo(QueryOpportunity.UI);
            this.GetStockInfo(QueryOpportunity.AfterOpt);
        }
Exemple #4
0
        private void frmWeightPlanZKD_Load(object sender, EventArgs e)
        {
            CommonMethod.RefreshAndAutoSize(ultraGrid1);

            try
            {
                dateTimePicker1.Value = DateTime.Today;
                dateTimePicker2.Value = DateTime.Today.AddDays(1).AddSeconds(-1);
                BindPoint();
                BindBilletStatus();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
Exemple #5
0
        private void frmFlowCardQuery_Load(object sender, EventArgs e)
        {
            CommonMethod.RefreshAndAutoSize(ultraGrid1);

            try
            {
                dateTimePicker1.Value = DateTime.Today;
                dateTimePicker2.Value = DateTime.Today.AddDays(1).AddSeconds(-1);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }

            try
            {
                this._STOCK = "SH000100";
                //string strKey = this.CustomInfo.ToUpper();

                //if (!string.IsNullOrEmpty(strKey) && strKey.Length == 2)
                //{
                //    if (strKey.Substring(0, 2).Equals("GX"))
                //    {
                //        this._STOCK = "SH000100";
                //    }
                //    else if (strKey.Substring(0, 2).Equals("BC"))
                //    {
                //        this._STOCK = "SH000098";
                //    }
                //    else if (strKey.Substring(0, 2).Equals("XC"))
                //    {
                //        this._STOCK = "SH000120";
                //    }
                //    else if (strKey.Substring(0, 2).Equals("LG"))
                //    {
                //        this._STOCK = "SH000166";
                //    }
                //}
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
Exemple #6
0
        private void GetFlowCardInfo(string strCardNo)
        {
            string strWhere = string.Empty;

            if (this.cbxDateTime.Checked)
            {
                if (dateTimePicker1.Value > dateTimePicker2.Value)
                {
                    MessageBox.Show("查询结束时间不能小于开始时间!");
                    return;
                }

                string startTime = dateTimePicker1.Value.ToString("yyyy-MM-dd 00:00:00");
                string endTime   = dateTimePicker2.Value.ToString("yyyy-MM-dd 23:59:59");
                strWhere += " and a.fs_batch_optdate between  to_date('" + startTime + "','yyyy-MM-dd HH24:mi:ss') and to_date('" + endTime + "','yyyy-MM-dd HH24:mi:ss') ";
            }

            if (this.tbQueryBatchNo.Text != string.Empty)
            {
                strWhere += " and a.fs_zc_batchno like '%" + tbQueryBatchNo.Text.Trim() + "%' ";
            }

            if (tbQueryStoveNo.Text != string.Empty)
            {
                strWhere += " and a.FS_GP_STOVENO like '%" + tbQueryStoveNo.Text.Trim() + "%' ";
            }

            string strSql = "";

            strSql += Convert.ToString("select a.FS_CARDNO,'false' checked,").Trim() + " ";
            strSql += Convert.ToString("a.FS_GP_STOVENO,").Trim() + " ";
            strSql += Convert.ToString("a.FS_GP_STEELTYPE,").Trim() + " ";
            strSql += Convert.ToString("a.FS_GP_SPE,").Trim() + " ";
            strSql += Convert.ToString("nvl(e.fn_weight,0) FN_JJ_WEIGHT,").Trim() + " ";
            strSql += Convert.ToString("a.FS_GP_MEMO,").Trim() + " ";
            strSql += Convert.ToString("a.FS_GP_JUDGER,").Trim() + " ";
            strSql += Convert.ToString("to_char(e.FD_WEIGHTTIME, 'yyyy-MM-dd HH24:mi:ss') FD_ZC_ENTERDATETIME,").Trim() + " ";
            strSql += Convert.ToString("to_char(a.FD_GP_JUDGEDATE, 'yyyy-MM-dd HH24:mi:ss') FD_GP_JUDGEDATE,").Trim() + " ";
            strSql += Convert.ToString("a.FS_ZC_BATCHNO,").Trim() + " ";
            strSql += Convert.ToString("b.FS_REEL,").Trim() + " ";
            strSql += Convert.ToString("b.FS_STEELTYPE,").Trim() + " ";
            strSql += Convert.ToString("b.FS_SPEC,").Trim() + " ";
            strSql += Convert.ToString("b.FS_PRODUCTNO,").Trim() + " ";
            strSql += Convert.ToString("decode(b.fs_billetstatus,'0','成卷','1','精轧废','2','卷取废','3','中间坯',b.fs_billetstatus) fs_billetstatus,").Trim() + " ";
            strSql += Convert.ToString("b.FS_ORDER,").Trim() + " ";
            strSql += Convert.ToString("decode(b.FS_COMPLETEFLAG,'1','√','') FS_COMPLETEFLAG,").Trim() + " ";
            strSql += Convert.ToString("c.FN_WEIGHT,").Trim() + " ";
            strSql += Convert.ToString("decode(b.fs_point,'K23','卷取秤1#','K24','卷取秤2#','K25','地上衡',b.fs_point) fs_point,").Trim() + " ";
            strSql += Convert.ToString("to_char(b.FD_PLANTIME, 'yyyy-MM-dd HH24:mi:ss') FD_PLANTIME,").Trim() + " ";
            strSql += Convert.ToString("b.FS_PERSON,").Trim() + " ";
            strSql += Convert.ToString("a.FS_ADVISESPEC,").Trim() + " ";
            strSql += Convert.ToString("       decode(d.FN_ISRETURNBILLET,'1','返炉','0',decode(a.fs_transtype,'1','热送','2','冷送',a.fs_transtype)) fs_transtype").Trim() + " ";
            strSql += Convert.ToString("from it_fp_techcard a,dt_zkd_plan b,dt_zkd_productweightdetail c,dt_bp_plan d,dt_boardweightmain e ").Trim() + " ";
            strSql += Convert.ToString("where a.FS_CARDNO like 'BP10%'").Trim() + " ";
            strSql += Convert.ToString(" and a.fs_batched='1' and a.fs_zc_batchno is not null").Trim() + " ";
            strSql += Convert.ToString(" and a.fs_gp_stoveno=b.fs_stoveno(+)").Trim() + " ";
            strSql += Convert.ToString(" and a.fs_gp_stoveno=c.FS_STOVENO(+)").Trim() + " ";
            strSql += Convert.ToString(" and a.fs_gp_stoveno=d.fs_stoveno(+)").Trim() + " ";
            strSql += Convert.ToString(" and a.fs_gp_stoveno=e.fs_stoveno(+)").Trim() + " ";
            //strSql += Convert.ToString(" and (d.FN_ISRETURNBILLET='0' or (d.FN_ISRETURNBILLET='1' and d.fs_completeflag='1'))").Trim() + " ";
            strSql += strWhere;
            strSql += Convert.ToString(" order by a.fs_zc_batchno asc,e.fs_order asc").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;
        }
Exemple #7
0
        private void BilletFlowCard_Load(object sender, EventArgs e)
        {
            CommonMethod.RefreshAndAutoSize(ultraGrid1);

            try
            {
                dateTimePicker1.Value = DateTime.Today;
                dateTimePicker2.Value = DateTime.Today.AddDays(1).AddSeconds(-1);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }

            try
            {
                string strKey = this.CustomInfo.ToUpper();

                if (!string.IsNullOrEmpty(strKey))
                {
                    if (strKey.Substring(0, 3).Equals("ZKD"))
                    {
                        this._STOCK       = "SH000100";
                        this._PRODUCELINE = ProduceLine.ZKD;
                    }
                    else if (strKey.Substring(0, 2).Equals("BC"))
                    {
                        this._STOCK       = "SH000098";
                        this._PRODUCELINE = ProduceLine.BC;
                    }
                    else if (strKey.Substring(0, 2).Equals("XC"))
                    {
                        this._STOCK       = "SH000120";                                            //型材未知
                        this._PRODUCELINE = ProduceLine.XC;
                    }

                    if (strKey.Substring(3, 1).Equals("1"))
                    {
                        this._POST = Post.Receive;
                        ucBilletFlowCard1.SetPost_BilletReceive();
                        SetToolButtonCaption("Save", "验收登记");
                        SetToolButtonCaption("Cancel", "撤销验收");
                        SetToolButtonCaption("开始", "分析时间");
                        SetToolButtonCaption("轧制编号", "  货架编号");
                        SetToolButtonVisible("其他库1", false);
                        SetToolButtonVisible("其他库2", false);
                        SetToolButtonVisible("其他库3", false);
                        SetToolButtonVisible("出炉结束", false);
                        SetToolButtonVisible("取消结束", false);
                        SetToolButtonVisible("置为返回坯", false);
                        rbtnA.Text          = "未验收";
                        rbtnB.Text          = "已验收";
                        cbxDateTime.Checked = false;
                        lbl_Mark.Text       = "此颜色表示已验收登记";
                    }
                    else if (strKey.Substring(3, 1).Equals("2"))
                    {
                        this._POST = Post.Charge;
                        ucBilletFlowCard1.SetPost_Charge();
                        SetToolButtonCaption("Save", "入炉登记");
                        SetToolButtonCaption("Cancel", "撤销入炉");
                        SetToolButtonCaption("开始", "组批时间");
                        SetToolButtonCaption("轧制编号", "  轧制编号");
                        SetToolButtonVisible("其他库1", false);
                        SetToolButtonVisible("其他库2", false);
                        SetToolButtonVisible("其他库3", false);
                        SetToolButtonVisible("出炉结束", false);
                        SetToolButtonVisible("取消结束", false);
                        SetToolButtonVisible("置为返回坯", false);
                        rbtnA.Text          = "未入炉";
                        rbtnB.Text          = "已入炉";
                        cbxDateTime.Checked = true;
                        lbl_Mark.Text       = "此颜色表示已入炉登记";
                    }
                    else if (strKey.Substring(3, 1).Equals("3"))
                    {
                        this._POST = Post.DisCharge;
                        ultraExpandableGroupBox1.Visible = false;
                        SetToolButtonCaption("Save", "出炉开始");
                        SetToolButtonCaption("Cancel", "撤销开始");
                        SetToolButtonCaption("开始", "组批时间");
                        SetToolButtonCaption("轧制编号", "  轧制编号");
                        SetToolButtonVisible("其他库1", false);
                        SetToolButtonVisible("其他库2", false);
                        SetToolButtonVisible("其他库3", false);
                        SetToolButtonVisible("出炉结束", true);
                        SetToolButtonVisible("取消结束", true);
                        rbtnA.Text             = "未出炉";
                        rbtnB.Text             = "已出炉";
                        rbtnC.Checked          = true;
                        cbxDateTime.Checked    = true;
                        lbl_Mark.Text          = "此颜色表示已出炉登记";
                        lbl_InFurnance.Text    = "此颜色表示正在出炉";
                        lbl_InFurnance.Visible = true;
                    }
                    else if (strKey.Substring(3, 1).Equals("4"))
                    {
                        this._POST = Post.Roll;
                        ucBilletFlowCard1.SetPost_Rolling(_PRODUCELINE);
                        SetToolButtonCaption("Save", "保存");
                        SetToolButtonCaption("Cancel", "撤销");
                        SetToolButtonCaption("开始", "组批时间");
                        SetToolButtonCaption("轧制编号", "  轧制编号");
                        SetToolButtonVisible("其他库1", false);
                        SetToolButtonVisible("其他库2", false);
                        SetToolButtonVisible("其他库3", false);
                        SetToolButtonVisible("出炉结束", false);
                        SetToolButtonVisible("取消结束", false);
                        SetToolButtonVisible("置为返回坯", false);
                        rbtnA.Text          = "未挑废";
                        rbtnB.Text          = "已挑废";
                        cbxDateTime.Checked = true;
                        lbl_Mark.Text       = "此颜色表示已挑废登记";
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
Exemple #8
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() + " ";
            strSql += Convert.ToString(" and t.fs_gp_completeflag = '1'").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 { }
            }
        }
Exemple #9
0
        private void GetStockInfo(QueryOpportunity Opp)
        {
            //PL/SQL Special Copy
            string strSql = "";

            strSql += Convert.ToString("select 'false' checked,").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("       round(t.fn_gp_len, 3) fn_gp_len,").Trim() + " ";
            strSql += Convert.ToString("       t.fn_billet_count,").Trim() + " ";
            strSql += Convert.ToString("       round(t.fn_billet_weight, 3) fn_billet_weight,").Trim() + " ";
            strSql += Convert.ToString("       round(t.fn_billet_count * round(0.21 * t.fn_gp_len, 3), 3) fn_billet_weight_ll,").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.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.fs_cardno,").Trim() + " ";
            strSql += Convert.ToString("       '1' as fn_gpys_number,").Trim() + " ";
            strSql += Convert.ToString("       nvl(t.fs_unqualified, '0') fs_unqualified,").Trim() + " ";
            strSql += Convert.ToString("       round(nvl(x.FN_WEIGHT,0), 3) fn_gpys_weight,").Trim() + " ";
            strSql += Convert.ToString("        round(nvl(t.fn_gpys_number, 0) * round(0.21 * t.fn_gp_len, 3), 3) fn_gpys_weight_ll,").Trim() + " ";
            strSql += Convert.ToString("       decode(t.fs_checked, '1', '√', '') fs_checked").Trim() + " ";
            strSql += Convert.ToString("  from it_fp_techcard t,dt_boardweightmain x ").Trim() + " ";
            strSql += Convert.ToString(" where nvl(t.fs_batched, '0') = '0' and t.fs_gp_stoveno=x.fs_stoveno(+) ").Trim() + " ";
            strSql += Convert.ToString("   and t.fs_zc_batchno is null").Trim() + " ";
            strSql += Convert.ToString("   and t.fs_gp_flow = 'SH000100'").Trim() + " ";
            //strSql += Convert.ToString("   and nvl(t.fs_isvalid, '0') = '0'").Trim() + " ";
            //strSql += Convert.ToString("   and t.fs_checked = '1'").Trim() + " ";
            //strSql += Convert.ToString("   and nvl(t.fn_gpys_number, 0) > 0").Trim() + " ";

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

                    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() + " ";
                }

                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").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();
            }

            this.MarkupRows();

            CommonMethod.RefreshAndAutoSize(ultraGrid2);

            this.BatchCalc();
        }
Exemple #10
0
        private void GetBatchInfo(QueryOpportunity Opp)
        {
            //PL/SQL SPECIAL COPY
            string strSql = "";

            strSql += Convert.ToString("select distinct t.fs_zc_batchno,").Trim() + " ";
            strSql += Convert.ToString("                max(t.fn_zz_spec) over(partition by t.fs_zc_batchno) fn_zz_spec,").Trim() + " ";
            strSql += Convert.ToString("                max(t.fn_length) over(partition by t.fs_zc_batchno) fn_length,").Trim() + " ";
            strSql += Convert.ToString("                max(t.fs_gp_steeltype) over(partition by t.fs_zc_batchno) fs_gp_steeltype,").Trim() + " ";
            strSql += Convert.ToString("                max(t.fs_zc_orderno) over(partition by t.fs_zc_batchno) fs_zc_orderno,").Trim() + " ";
            strSql += Convert.ToString("                max(t.fs_gp_spe) over(partition by t.fs_zc_batchno) fs_gp_spe,").Trim() + " ";
            strSql += Convert.ToString("                max(t.fn_gp_len) over(partition by t.fs_zc_batchno) fn_gp_len,").Trim() + " ";
            strSql += Convert.ToString("                sum(nvl(t.fn_billet_count, 0)) over(partition by t.fs_zc_batchno) fn_billet_count,").Trim() + " ";
            strSql += Convert.ToString("                sum(nvl(t.fn_billet_weight, 0)) over(partition by t.fs_zc_batchno) fn_billet_weight,").Trim() + " ";
            strSql += Convert.ToString("                sum(nvl(t.fn_billet_weight_ll, 0)) over(partition by t.fs_zc_batchno) fn_billet_weight_ll,").Trim() + " ";
            strSql += Convert.ToString("                max(t.fs_batch_optor) over(partition by t.fs_zc_batchno) fs_batch_optor,").Trim() + " ";
            strSql += Convert.ToString("                max(t.fs_batch_optdate) over(partition by t.fs_zc_batchno) fs_batch_optdate").Trim() + " ";
            strSql += Convert.ToString("  from (select t.fs_zc_batchno,").Trim() + " ";
            strSql += Convert.ToString("               t.fn_zz_spec,").Trim() + " ";
            strSql += Convert.ToString("               round(t.fn_length, 3) fn_length,").Trim() + " ";
            strSql += Convert.ToString("               t.fn_gpys_number fn_billet_count,").Trim() + " ";
            strSql += Convert.ToString("               t.fs_gp_steeltype,").Trim() + " ";
            strSql += Convert.ToString("               t.fs_zc_orderno,").Trim() + " ";
            strSql += Convert.ToString("               t.fs_gp_spe,").Trim() + " ";
            strSql += Convert.ToString("               round(t.fn_gp_len, 3) fn_gp_len,").Trim() + " ";
            strSql += Convert.ToString("               t.fs_batch_optor,").Trim() + " ";
            strSql += Convert.ToString("               to_char(t.fs_batch_optdate, 'yyyy-MM-dd HH24:mi:ss') fs_batch_optdate,").Trim() + " ";
            strSql += Convert.ToString("               round(nvl(a.FN_WEIGHT,0), 3) fn_billet_weight,").Trim() + " ";
            strSql += Convert.ToString("               round(nvl(fn_gpys_number, 0) * round(0.21 * nvl(t.fn_gp_len, 0), 3), 3) fn_billet_weight_ll").Trim() + " ";
            strSql += Convert.ToString("          from it_fp_techcard t,dt_boardweightmain a ").Trim() + " ";
            strSql += Convert.ToString("         where t.fs_batched = '1'").Trim() + " ";
            strSql += Convert.ToString("           and t.fs_gp_stoveno=a.fs_stoveno(+)").Trim() + " ";
            strSql += Convert.ToString("           and t.fs_zc_batchno is not 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 (Opp == QueryOpportunity.UI)
            {
                if (cbxDateTime.Checked)
                {
                    string strDateTimeFrom = dateTimePicker1.Value.ToString("yyyy-MM-dd HH:mm");
                    string strDateTimeTo   = dateTimePicker2.Value.ToString("yyyy-MM-dd HH:mm");

                    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()))
                {
                    strSql += Convert.ToString("   and t.fs_zc_batchno like '%" + tbQueryBatchNo.Text.Trim() + "%'").Trim() + " ";
                }

                if (!string.IsNullOrEmpty(tbQueryStoveNo.Text.Trim()))
                {
                    strSql += Convert.ToString("   and exists (select 1 from (select x.fs_zc_batchno from it_fp_techcard x where x.fs_batched = '1' and x.fs_gp_stoveno like '%" + tbQueryStoveNo.Text.Trim() + "%') x where x.fs_zc_batchno = t.fs_zc_batchno)").Trim() + " ";
                }
            }
            else
            {
                strSql += Convert.ToString("   and t.fs_batch_optdate > (sysdate - 1)").Trim() + " ";
            }

            strSql += Convert.ToString(" ) t order by FS_ZC_BATCHNO desc").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;
                }

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

            strSql  = "";
            strSql += Convert.ToString("select t.fs_gp_stoveno,").Trim() + " ";
            strSql += Convert.ToString("       t.fs_gp_steeltype,").Trim() + " ";
            strSql += Convert.ToString("       t.fs_gp_spe,").Trim() + " ";
            strSql += Convert.ToString("       round(t.fn_gp_len, 3) fn_gp_len,").Trim() + " ";
            strSql += Convert.ToString("       '1' fn_billet_count,").Trim() + " ";
            strSql += Convert.ToString("       round(nvl(a.FN_WEIGHT,0), 3) fn_billet_weight,").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.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.fs_zc_batchno,").Trim() + " ";
            strSql += Convert.ToString("       t.fs_cardno").Trim() + " ";
            strSql += Convert.ToString("  from it_fp_techcard t,dt_boardweightmain a ").Trim() + " ";
            strSql += Convert.ToString(" where t.fs_batched = '1'").Trim() + " ";
            strSql += Convert.ToString("   and t.fs_gp_stoveno=a.fs_stoveno(+)").Trim() + " ";
            strSql += Convert.ToString("   and t.fs_zc_batchno is not 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 (Opp == QueryOpportunity.UI)
            {
                if (cbxDateTime.Checked)
                {
                    string strDateTimeFrom = dateTimePicker1.Value.ToString("yyyy-MM-dd HH:mm");
                    string strDateTimeTo   = dateTimePicker2.Value.ToString("yyyy-MM-dd HH:mm");

                    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()))
                {
                    strSql += Convert.ToString("   and t.fs_zc_batchno like '%" + tbQueryBatchNo.Text.Trim() + "%'").Trim() + " ";
                }

                if (!string.IsNullOrEmpty(tbQueryStoveNo.Text.Trim()))
                {
                    strSql += Convert.ToString("   and exists (select 1 from (select x.fs_zc_batchno from it_fp_techcard x where x.fs_batched = '1' and x.fs_gp_stoveno like '%" + tbQueryStoveNo.Text.Trim() + "%') x where x.fs_zc_batchno = t.fs_zc_batchno)").Trim() + " ";
                }
            }
            else
            {
                strSql += Convert.ToString("   and t.fs_batch_optdate > (sysdate - 1)").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 (dataTable3.Constraints.Count > 0)
                {
                    foreach (Constraint cnst in dataTable3.Constraints)
                    {
                        alistCnst1.Add(cnst);
                    }

                    dataTable3.Constraints.Clear();
                }

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

                for (int i = 0; i < alistCnst1.Count; i++)
                {
                    dataTable3.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];
            }
        }
Exemple #11
0
        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 { }
            }
        }
Exemple #12
0
        private void GetFlowCardInfo()
        {
            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 A.FS_BATCH_OPTDATE between to_date('" + strDateTimeFrom + "', 'yyyy-MM-dd HH24:mi') and to_date('" + strDateTimeTo + "', 'yyyy-MM-dd HH24:mi') ").Trim() + " ";
            }

            string ConditionName = "";

            if (!string.IsNullOrEmpty(tbQueryBatchNo.Text.Trim()) && string.IsNullOrEmpty(tbBatchNoTo.Text.Trim()))
            {
                ConditionName = rbtn_BatchNo.Checked ? "a.fs_zc_batchno" : "a.fs_gp_stoveno";
                strWhere     += Convert.ToString("   and " + ConditionName + " like '%" + tbQueryBatchNo.Text.Trim() + "%' ").Trim() + " ";
            }
            else if (!string.IsNullOrEmpty(tbBatchNoTo.Text.Trim()) && string.IsNullOrEmpty(tbQueryBatchNo.Text.Trim()))
            {
                ConditionName = rbtn_BatchNo.Checked ? "a.fs_zc_batchno" : "a.fs_gp_stoveno";
                strWhere     += Convert.ToString("   and " + ConditionName + " like '%" + tbBatchNoTo.Text.Trim() + "%' ").Trim() + " ";
            }

            //if (!string.IsNullOrEmpty(tbQueryBatchNo.Text.Trim()) && !string.IsNullOrEmpty(tbBatchNoTo.Text.Trim()))
            //{
            //    ConditionName = rbtn_BatchNo.Checked ? "a.fs_zc_batchno" : "a.fs_gp_stoveno";
            //    strWhere = " and t.fs_batch_optdate >= (select max(x.fs_batch_optdate) from it_fp_techcard x where " + ConditionName + " = '" + tbQueryBatchNo.Text.Trim() + "') ";
            //    strWhere += " and t.fs_batch_optdate <= (select max(x.fs_batch_optdate) from it_fp_techcard x where " + ConditionName + " = '" + tbBatchNoTo.Text.Trim() + "') ";
            //}

            string strSql = "";

            strSql += Convert.ToString("select a.FS_CARDNO,").Trim() + " ";
            strSql += Convert.ToString("       a.FS_GP_STOVENO,").Trim() + " ";
            strSql += Convert.ToString("       a.FS_GP_SPE,").Trim() + " ";
            strSql += Convert.ToString("       a.FN_GP_C,").Trim() + " ";
            strSql += Convert.ToString("       a.FN_GP_SI,").Trim() + " ";
            strSql += Convert.ToString("       a.FN_GP_MN,").Trim() + " ";
            strSql += Convert.ToString("       a.FN_GP_S,").Trim() + " ";
            strSql += Convert.ToString("       a.FN_GP_P,").Trim() + " ";
            strSql += Convert.ToString("       a.FN_GP_AS,").Trim() + " ";
            strSql += Convert.ToString("       a.FN_GP_TI,").Trim() + " ";
            strSql += Convert.ToString("       a.FN_GP_SB,").Trim() + " ";
            strSql += Convert.ToString("       a.FN_GP_ALS,").Trim() + " ";
            strSql += Convert.ToString("       a.FN_JJ_WEIGHT,").Trim() + " ";
            strSql += Convert.ToString("       a.FS_GP_JUDGER,").Trim() + " ";
            strSql += Convert.ToString("       to_char(a.fn_gp_LEN,'99.000') as fn_gp_LEN ,").Trim() + " ";
            strSql += Convert.ToString("       e.FS_PERSON FS_BILLETPERSON,").Trim() + "";
            strSql += Convert.ToString("       to_char(e.FD_WEIGHTTIME,'yyyy-MM-dd hh24:mi:ss') FD_BILLETWEIGHTTIME,").Trim() + " ";
            strSql += Convert.ToString("       decode(e.FS_SHIFT,'0','常白','1','早','2','中','3','晚',e.FS_SHIFT) FS_BILLETSHIFT,").Trim() + " ";
            strSql += Convert.ToString("       decode(e.FS_TERM,'0','常白','1','甲','2','乙','3','丙',e.FS_TERM) FS_BILLETTERM,").Trim() + " ";

            strSql += Convert.ToString("       d.FS_PERSON FS_ZKDPERSON,").Trim() + "";
            strSql += Convert.ToString("       decode(d.FS_SHIFT,'0','常白','1','早','2','中','3','晚',d.FS_SHIFT) FS_ZKDSHIFT,").Trim() + " ";
            strSql += Convert.ToString("       decode(d.FS_TERM,'0','常白','1','甲','2','乙','3','丙',d.FS_TERM) FS_ZKDTERM,").Trim() + " ";

            strSql += Convert.ToString("       to_char(a.FD_GP_JUDGEDATE,'yyyy-MM-dd hh24:mi:ss') FD_GP_JUDGEDATE,").Trim() + " ";
            strSql += Convert.ToString("       a.FS_ZC_BATCHNO,").Trim() + " ";
            strSql += Convert.ToString("       to_char(e.FD_WEIGHTTIME,'yyyy-MM-dd hh24:mi:ss') FD_ZC_ENTERDATETIME,").Trim() + " ";
            strSql += Convert.ToString("       to_char(a.FS_BATCH_OPTDATE,'yyyy-MM-dd hh24:mi:ss') FS_BATCH_OPTDATE,").Trim() + " ";
            strSql += Convert.ToString("       a.FS_BATCH_OPTOR,").Trim() + " ";
            strSql += Convert.ToString("       decode(b.FN_ISRETURNBILLET,'1','返炉','0',decode(a.fs_transtype,'1','热送','2','冷送',a.fs_transtype)) fs_transtype,").Trim() + " ";
            strSql += Convert.ToString("       decode(b.FN_ISRETURNBILLET,'0','否','1','是',b.FN_ISRETURNBILLET) FN_ISRETURNBILLET,").Trim() + " ";
            strSql += Convert.ToString("       decode(c.fs_billetstatus,'0','成卷','1','精轧废','2','卷取废','3','中间坯',c.fs_billetstatus) fs_billetstatus,").Trim() + " ";
            strSql += Convert.ToString("       d.FN_KHJZ AS FN_WEIGHT,").Trim() + " ";
            strSql += Convert.ToString("       to_char(d.FD_DATETIME,'yyyy-MM-dd hh24:mi:ss') FD_DATETIME,").Trim() + " ";
            strSql += Convert.ToString("       d.FS_REEL,").Trim() + " ";
            strSql += Convert.ToString("       a.FS_ADVISESPEC,").Trim() + " ";
            strSql += Convert.ToString("       d.FN_BANDNO,d.FS_SPEC,d.FS_STEELTYPE ").Trim() + " ";
            strSql += Convert.ToString("  from it_fp_techcard             a,").Trim() + " ";
            strSql += Convert.ToString("       dt_bp_plan                 b,").Trim() + " ";
            strSql += Convert.ToString("       dt_zkd_plan                c,").Trim() + " ";
            strSql += Convert.ToString("       dt_zkd_productweightdetail d,dt_boardweightmain e ").Trim() + " ";
            strSql += Convert.ToString("  where a.FS_CARDNO like 'BP10%' ").Trim() + " ";
            strSql += Convert.ToString("  and a.fs_gp_stoveno=b.fs_stoveno(+) ").Trim() + " ";
            strSql += Convert.ToString("  and a.fs_gp_stoveno=c.FS_STOVENO(+) ").Trim() + " ";
            strSql += Convert.ToString("  and a.fs_gp_stoveno=d.fs_stoveno(+) ").Trim();
            strSql += Convert.ToString("  and a.fs_gp_stoveno=e.fs_stoveno(+) ").Trim();

            strSql += strWhere;
            strSql += " order by a.fs_zc_batchno asc, e.FS_ORDER asc";
            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 (_STOCK.Equals("SH000098") || _STOCK.Equals("SH000120"))
            //{
            //    ultraGrid1.DisplayLayout.Bands[0].Columns["FN_ZZ_QUALIFIED_TRATE"].Hidden = true;
            //}

            MarkupRows();
        }
Exemple #13
0
        private void query()
        {
            try
            {
                if (this.dtpBegintime.Value > this.dtpEendtime.Value)
                {
                    MessageBox.Show("查询开始时间不能大于结束时间");
                    return;
                }

                string strStartTime = dtpBegintime.Value.ToString("yyyy-MM-dd 00:00:00");
                string strEndTime   = dtpEendtime.Value.ToString("yyyy-MM-dd 23:59:59");

                string strSql = @"select T.FS_WEIGHTNO,
       T.FS_BATCHNO,
       FN_BANDNO,
       TO_CHAR(T.FN_WEIGHT, '999.000') FN_WEIGHT,
       
       T.FS_UPLOADFLAG,
       to_char(T.FD_DATETIME, 'yyyy-MM-dd hh24:mi:ss') FD_DATETIME,
       T.FS_PLANT,
       T.FS_SAPSTORE,
       T.FS_ACCOUNTDATE,
       T.FS_PRODUCTNO,
       FS_POINTNAME AS FS_POINT,
       TO_CHAR(FN_YKL, '99990.000') FN_YKL,
       TO_CHAR(FN_KHJZ, '9999.000') FN_KHJZ,
       
       FS_REEL,
       T.FS_STOVENO,
       T.FS_PERSON,
       DECODE(T.FS_SHIFT, '0', '常白班', '1', '早', '2', '中', '3', '夜') as FS_SHIFT,
       DECODE(T.FS_TERM,
              '0',
              '常白班',
              '1',
              '甲',
              '2',
              '乙',
              '3',
              '丙',
              '4',
              '丁') as FS_TERM,
       T.FS_SPEC,
       T.FS_STEELTYPE,
       FS_KZTYPE,
       FS_SAMPLEPERSON,
       TO_CHAR(C.FN_WEIGHT, '999.000') FN_BPWEIGHT,
       TO_CHAR(FD_SAMPLETIME, 'yyyy-MM-dd hh24:mi:ss') FD_SAMPLETIME,
       T.FS_MEMO ,
       D.FS_ADVISESPEC
  from dt_zkd_productweightdetail t, BT_POINT B, dt_boardweightmain C,it_fp_techcard D
 where (t.fd_datetime between
       to_date('" + strStartTime + "', 'yyyy-MM-dd hh24:mi:ss') and to_date('" + strEndTime + "', 'yyyy-MM-dd hh24:mi:ss'))" +
                                " and t.fs_deleteflag != '1'" +
                                " AND T.FS_POINT = B.FS_POINTCODE" +
                                " AND T.FS_STOVENO = C.FS_STOVENO(+) " +
                                " AND T.FS_STOVENO = D.FS_GP_STOVENO(+) ";
                strSql = string.Format(strSql, strStartTime, strEndTime);
                if (this.txtBatchnoQuery.Text.Trim() != string.Empty)
                {
                    strSql += " and t.FS_BATCHNO like  '%" + this.txtBatchnoQuery.Text.Trim().Replace("'", "''") + "%'";
                }



                strSql += " order by t.fd_datetime desc";
                CoreClientParam ccp = new CoreClientParam();
                ccp.ServerName      = "ygjzjl.basedatamanage.OtherBaseInfo";
                ccp.MethodName      = "ExcuteQuery";
                ccp.ServerParams    = new object[] { strSql };
                ccp.SourceDataTable = this.dataSet1.Tables[0];
                this.dataSet1.Tables[0].Clear();
                this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
                CommonMethod.RefreshAndAutoSize(ultraGrid1);
            }
            catch (Exception ee)
            {
            }
        }
Exemple #14
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_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 { }
            }
        }
Exemple #15
0
        private void GetFlowCardInfo()
        {
            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_plantime between to_date('" + strDateTimeFrom + "', 'yyyy-MM-dd HH24:mi') and to_date('" + strDateTimeTo + "', 'yyyy-MM-dd HH24:mi')").Trim() + " ";
            }

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

            string strSql = "";

            strSql += Convert.ToString("select t.fs_techcardno fs_cardno,").Trim() + " ";
            strSql += Convert.ToString("       to_char(t1.fd_smeltdate, 'yyyy-MM-dd hh24:mi') fd_smeltdate,").Trim() + " ";
            strSql += Convert.ToString("       t.fs_stoveno fs_gp_stoveno,").Trim() + " ";
            strSql += Convert.ToString("       t1.FS_GP_STEELTYPE fs_gp_steeltype,").Trim() + " ";
            strSql += Convert.ToString("       t1.FS_GP_SPE fs_gp_spe,").Trim() + " ";
            strSql += Convert.ToString("       round(t.fn_length, 3) fn_length,").Trim() + " ";
            strSql += Convert.ToString("       decode(nvl(t1.fs_gp_flow, t.fs_receiver),'SH000098','棒材厂','SH000100','中宽带厂','SH000120','型材厂','SH000166','炼钢落地',t1.fs_gp_flow) fs_gp_flow,").Trim() + " ";
            strSql += Convert.ToString("       t1.fn_gp_c,").Trim() + " ";
            strSql += Convert.ToString("       t1.fn_gp_si,").Trim() + " ";
            strSql += Convert.ToString("       t1.fn_gp_mn,").Trim() + " ";
            strSql += Convert.ToString("       t1.fn_gp_s,").Trim() + " ";
            strSql += Convert.ToString("       t1.fn_gp_p,").Trim() + " ";
            strSql += Convert.ToString("       t1.fn_gp_ni,").Trim() + " ";
            strSql += Convert.ToString("       t1.fn_gp_cr,").Trim() + " ";
            strSql += Convert.ToString("       t1.fn_gp_cu,").Trim() + " ";
            strSql += Convert.ToString("       t1.fn_gp_v,").Trim() + " ";
            strSql += Convert.ToString("       t1.fn_gp_mo,").Trim() + " ";
            strSql += Convert.ToString("       t1.fn_gp_ceq,").Trim() + " ";
            strSql += Convert.ToString("       t1.fn_gp_as,").Trim() + " ";
            strSql += Convert.ToString("       t1.fn_gp_ti,").Trim() + " ";
            strSql += Convert.ToString("       t1.fn_gp_sb,").Trim() + " ";
            strSql += Convert.ToString("       t1.fn_gp_als,").Trim() + " ";
            strSql += Convert.ToString("       nvl(t2.fn_gp_totalcount, t1.FN_GP_TOTALCOUNT) fn_gp_totalcount,").Trim() + " ";
            strSql += Convert.ToString("       case when t2.fn_gp_totalcount is not null then round(round(t.fn_length *").Trim() + " ";
            strSql += Convert.ToString("                                  0.21,3) * t2.fn_gp_totalcount,").Trim() + " ";
            strSql += Convert.ToString("             3) else round(round(0.21*t.fn_length,3)*t.fn_count,3) end fn_ll_weight,").Trim() + " ";
            strSql += Convert.ToString("       t2.fn_gp_totalcount fn_gp_checkcount,").Trim() + " ";
            strSql += Convert.ToString("       nvl(round(t2.fn_jj_weight, 3), round(round(0.21*t.fn_length,3)*t.fn_count,3)) fn_jj_weight,").Trim() + " ";
            strSql += Convert.ToString("       t1.fs_gp_memo,").Trim() + " ";
            strSql += Convert.ToString("       t1.fs_gp_judger,").Trim() + " ";
            strSql += Convert.ToString("       t1.FS_ADVISESPEC,").Trim() + " ";
            strSql += Convert.ToString("       to_char(t1.fd_gp_judgedate, 'yyyy-MM-dd hh24:mi:ss') fd_gp_judgedate").Trim() + " ";
            strSql += Convert.ToString("  from dt_bp_plan t,").Trim() + " ";
            strSql += Convert.ToString("       it_fp_techcard t1,").Trim() + " ";
            strSql += Convert.ToString("       (select x.fs_stoveno,").Trim() + " ";
            strSql += Convert.ToString("               count(1) fn_gp_totalcount,").Trim() + " ";
            strSql += Convert.ToString("               sum(nvl(x.fn_weight, 0)) fn_jj_weight").Trim() + " ";
            strSql += Convert.ToString("          from dt_boardweightmain x").Trim() + " ";
            strSql += Convert.ToString("         where exists").Trim() + " ";
            strSql += Convert.ToString("         (select 1").Trim() + " ";
            strSql += Convert.ToString("                  from dt_bp_plan t").Trim() + " ";
            strSql += Convert.ToString("                 where t.fs_stoveno = x.fs_stoveno " + strWhere + ")").Trim() + " ";
            strSql += Convert.ToString("         group by x.fs_stoveno) t2").Trim() + " ";

            if (string.IsNullOrEmpty(_STOCK))
            {
                strSql += Convert.ToString(" where 1 = 1").Trim() + " ";
            }
            else
            {
                strSql += Convert.ToString(" where nvl(t1.fs_gp_flow, t.fs_receiver) = '" + _STOCK + "'").Trim() + " ";
            }

            strSql += Convert.ToString("   and t.fs_stoveno = t1.fs_gp_stoveno(+)").Trim() + " ";

            //strSql += Convert.ToString("   and t.fs_techcardno = t1.fs_cardno(+)").Trim() + " ";
            strSql += Convert.ToString("   and t.fs_stoveno = t2.fs_stoveno(+) " + strWhere).Trim() + " ";
            strSql += Convert.ToString(" order by substr(t.fs_stoveno, 4, 1), t.fs_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);
        }