Esempio n. 1
0
        /// <summary>
        /// 查询记录
        /// </summary>
        private void GetBCtheoryWeightInfo()
        {
            string strSql = @"select   'false' checked, 
                                       FS_SPEC,
                                       FN_LENGTH,
                                       FN_WEIGHT,
                                       FN_BILLETCOUNT,
                                       FN_ID,
                                       FS_MINDIFFERENTRATE,
                                       FS_MAXDIFFERENTRATE,
                                       FS_BUNDLEWEIGHT,
                                       FS_BUNDLEMINWWEIGHT,
                                       FS_BUNDLEMAXWWEIGHT
                              from BT_BCTHEORYWEIGHTINFO  t  
                              where 1 = 1 ";

            if (!string.IsNullOrEmpty(tbqueryFS_SPEC.Text.Trim()))//规格
            {
                strSql += Convert.ToString("   and t.FS_SPEC like '%" + tbqueryFS_SPEC.Text.Trim() + "%'").Trim() + " ";
            }

            if (!string.IsNullOrEmpty(tbqueryFN_LENGTH.Text.Trim()))//长度
            {
                strSql += Convert.ToString("   and t.FN_LENGTH like '%" + tbqueryFN_LENGTH.Text.Trim() + "%'").Trim() + " ";
            }

            if (!string.IsNullOrEmpty(tbqueryFN_WEIGHT.Text.Trim()))//单支理论重量
            {
                strSql += Convert.ToString("   and t.FN_WEIGHT like '%" + tbqueryFN_WEIGHT.Text.Trim() + "%'").Trim() + " ";
            }

            if (!string.IsNullOrEmpty(tbqueryFN_BILLETCOUNT.Text.Trim())) //单捆包装支数
            {
                strSql += Convert.ToString("   and t.FN_BILLETCOUNT like '%" + tbqueryFN_BILLETCOUNT.Text.Trim() + "%'").Trim() + " ";
            }
            strSql += Convert.ToString(" order by t.FN_ID 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);

            if (ultraGrid1.Rows.Count > 0)
            {
                ultraGrid1.ActiveRow = ultraGrid1.Rows[0];
            }
            for (int i = 0; i < ultraGrid1.Rows.Count; i++)
            {
                ultraGrid1.Rows[i].Cells["FN_ID"].Appearance.BackColor = Color.FromArgb(192, 255, 192);
            }


            //for (int i = 0; i < ultraGrid1.Rows.Count; i++)
            //{
            //    try
            //    {
            //        if (Convert.ToString(ultraGrid1.Rows[i].Cells["FS_CARDNO"].Value).Equals(""))
            //        {
            //            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 { }
            //}
        }
Esempio n. 2
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.fs_gp_memo,").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_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("       t.fn_gpys_number,").Trim() + " ";
            strSql += Convert.ToString("       nvl(t.fs_unqualified, '0') fs_unqualified,").Trim() + " ";
            strSql += Convert.ToString("       round(t.fn_gpys_weight, 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").Trim() + " ";
            strSql += Convert.ToString(" where nvl(t.fs_batched, '0') = '0'").Trim() + " ";
            strSql += Convert.ToString("   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() + " ";
            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();
        }
Esempio n. 3
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.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 ? "t.fs_zc_batchno" : "t.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 ? "t.fs_zc_batchno" : "t.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 ? "x.fs_zc_batchno" : "x.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 'false' checked,").Trim() + " ";
            strSql += Convert.ToString("       t.fs_cardno,").Trim() + " ";
            strSql += Convert.ToString("       t.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_nb,").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() + " ";

            if (_STOCK.Equals("SH000100"))
            {
                strSql += Convert.ToString("       ,(select sum(d.fn_weight) from dt_gx_storageweightdetail d where d.fs_batchno = t.fs_zc_batchno and nvl(d.fs_unqualified,'0') = '0') FN_ZZ_QUALIFIED_WEIGHT").Trim() + " ";
                strSql += Convert.ToString("       ,(select sum(d.fn_weight) from dt_gx_storageweightdetail d where d.fs_batchno = t.fs_zc_batchno and nvl(d.fs_unqualified,'0') = '1') FN_ZZ_UNQUALIFIED_WEIGHT").Trim() + " ";
                strSql += Convert.ToString(",round((select sum(d.fn_weight) from dt_gx_storageweightdetail d where d.fs_batchno = t.fs_zc_batchno and nvl(d.fs_unqualified,'0') = '0')").Trim() + " ";
                strSql += Convert.ToString(" /(select sum(round(decode(nvl(fn_gp_totalcount, 0),0,'',(decode(nvl(fn_gp_checkcount, 0),0,nvl(fn_gp_totalcount, 0),nvl(fn_gp_checkcount, 0))*nvl(fn_jj_weight, 0) / nvl(fn_gp_totalcount, 0))),3)) from it_fp_techcard where fs_zc_batchno = t.fs_zc_batchno),4)*100 FN_ZZ_QUALIFIED_RATE").Trim() + " ";
                strSql += Convert.ToString(" ,round((select sum(d.fn_weight) from dt_gx_storageweightdetail d where d.fs_batchno = t.fs_zc_batchno and nvl(d.fs_unqualified,'0') = '0')").Trim() + " ";
                strSql += Convert.ToString(" /(select sum(round(round(fn_gp_len * 0.21, 3) * decode(nvl(fn_gp_checkcount, 0),0,nvl(fn_gp_totalcount, 0),nvl(fn_gp_checkcount, 0)),3)) from it_fp_techcard where fs_zc_batchno = t.fs_zc_batchno),4)*100 FN_ZZ_QUALIFIED_TRATE").Trim() + " ";
            }
            else if (_STOCK.Equals("SH000098"))
            {
                strSql += Convert.ToString("       ,(select sum(d.fn_weight) from dt_productweightdetail d where d.fs_batchno = t.fs_zc_batchno and nvl(d.fs_unqualified,'0') = '0') FN_ZZ_QUALIFIED_WEIGHT").Trim() + " ";
                strSql += Convert.ToString("       ,(select sum(d.fn_weight) from dt_productweightdetail d where d.fs_batchno = t.fs_zc_batchno and nvl(d.fs_unqualified,'0') = '1') FN_ZZ_UNQUALIFIED_WEIGHT").Trim() + " ";
                strSql += Convert.ToString(",round((select sum(d.FN_THEORYWEIGHT) from dt_productweightdetail d where d.fs_batchno = t.fs_zc_batchno and nvl(d.fs_unqualified,'0') = '0')").Trim() + " ";
                strSql += Convert.ToString(" /(select sum(fn_jj_weight) from it_fp_techcard where fs_zc_batchno = t.fs_zc_batchno),4)*100 FN_ZZ_QUALIFIED_RATE").Trim() + " ";
                strSql += Convert.ToString(" ,round((select sum(d.FN_THEORYWEIGHT) from dt_productweightdetail d where d.fs_batchno = t.fs_zc_batchno and nvl(d.fs_unqualified,'0') = '0')").Trim() + " ";
                strSql += Convert.ToString(" /(select sum(round(round(fn_gp_len * 0.21, 3) * decode(nvl(fn_gp_checkcount, 0),0,nvl(fn_gp_totalcount, 0),nvl(fn_gp_checkcount, 0)),3)) from it_fp_techcard where fs_zc_batchno = t.fs_zc_batchno),4)*100 FN_ZZ_QUALIFIED_TRATE").Trim() + " ";
            }
            else if (_STOCK.Equals("SH000120"))
            {
                strSql += Convert.ToString("       ,(select sum(d.fn_weight) from dt_xc_productweightdetail d where d.fs_batchno = t.fs_zc_batchno and nvl(d.fs_unqualified,'0') = '0') FN_ZZ_QUALIFIED_WEIGHT").Trim() + " ";
                strSql += Convert.ToString("       ,(select sum(d.fn_weight) from dt_xc_productweightdetail d where d.fs_batchno = t.fs_zc_batchno and nvl(d.fs_unqualified,'0') = '1') FN_ZZ_UNQUALIFIED_WEIGHT").Trim() + ", ";
                strSql += Convert.ToString("round((select sum(d.FN_THEORYWEIGHT) from dt_xc_productweightdetail d where d.fs_batchno = t.fs_zc_batchno and nvl(d.fs_unqualified,'0') = '0')").Trim() + " ";
                strSql += Convert.ToString(" /(select sum(fn_jj_weight) from it_fp_techcard where fs_zc_batchno = t.fs_zc_batchno),4)*100 FN_ZZ_QUALIFIED_RATE").Trim() + " ";
                strSql += Convert.ToString(" ,round((select sum(d.FN_THEORYWEIGHT) from dt_xc_productweightdetail d where d.fs_batchno = t.fs_zc_batchno and nvl(d.fs_unqualified,'0') = '0')").Trim() + " ";
                strSql += Convert.ToString(" /(select sum(round(round(fn_gp_len * 0.21, 3) * decode(nvl(fn_gp_checkcount, 0),0,nvl(fn_gp_totalcount, 0),nvl(fn_gp_checkcount, 0)),3)) from it_fp_techcard where fs_zc_batchno = t.fs_zc_batchno),4)*100 FN_ZZ_QUALIFIED_TRATE").Trim() + " ";
            }

            strSql += Convert.ToString("  from it_fp_techcard t").Trim() + " ";
            strSql += Convert.ToString(" where t.fs_gp_flow = '" + _STOCK + "' and nvl(t.fs_isvalid, '0') = '0' and t.fs_batched = '1' and t.fs_zc_batchno is not null").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 += " " + strWhere + " ";
            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);

            if (_STOCK.Equals("SH000098") || _STOCK.Equals("SH000120"))
            {
                ultraGrid1.DisplayLayout.Bands[0].Columns["FN_ZZ_QUALIFIED_TRATE"].Hidden = true;
            }

            MarkupRows();
        }
Esempio n. 4
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(t.fn_gpys_weight, 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").Trim() + " ";
            strSql += Convert.ToString("         where t.fs_batched = '1'").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("       t.fn_gpys_number fn_billet_count,").Trim() + " ";
            strSql += Convert.ToString("       round(t.fn_gpys_weight, 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.fs_gp_memo,").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_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").Trim() + " ";
            strSql += Convert.ToString(" where t.fs_batched = '1'").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];
            }
        }
Esempio n. 5
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 { }
            }
        }
Esempio n. 6
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 { }
            }
        }
Esempio n. 7
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 { }
            }
        }
Esempio n. 8
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("       to_char(t1.fd_gp_judgedate, 'yyyy-MM-dd hh24:mi:ss') fd_gp_judgedate").Trim() + " ";
            strSql += Convert.ToString("  from dt_fp_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_netweight, 0)) fn_jj_weight").Trim() + " ";
            strSql += Convert.ToString("          from dt_steelweightdetailroll x").Trim() + " ";
            strSql += Convert.ToString("         where exists").Trim() + " ";
            strSql += Convert.ToString("         (select 1").Trim() + " ";
            strSql += Convert.ToString("                  from dt_fp_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);
        }