Example #1
0
        public override void Form_Ref()
        {
            string sFromLoc = "";
            string sToLoc   = "";

            //if ((txt_f_addr.Text == "" || txt_t_addr.Text == "" )&& txt_slab_no.Text!="")
            //{
            //    GeneralCommon.Gp_MsgBoxDisplay("板坯号输入的情况下,起始垛位号以及目的垛位号必须输入", "W", "警告");
            //    return;
            //}
            if (txt_f_addr.Text != "" && txt_t_addr.Text != "")
            {
                if (txt_slab_no.Text != "" && txt_slab_no.Text.Length != 10)
                {
                    GeneralCommon.Gp_MsgBoxDisplay("板坯号长度必须为10位", "W", "警告");
                    return;
                }
            }



            if (opt_Left_Right.Checked)
            {
                sFromLoc = txt_f_addr.Text;
                sToLoc   = txt_t_addr.Text;
            }
            else
            {
                sFromLoc = txt_t_addr.Text;
                sToLoc   = txt_f_addr.Text;
            }

            if (sFromLoc != "" && sToLoc != "")
            {
                if (sFromLoc == sToLoc)
                {
                    GeneralCommon.Gp_MsgBoxDisplay("起始垛位号和目的垛位号相同!请重新选择起始垛位号和目的垛位号!", "W", "");
                    return;
                }
                else if (sFromLoc != "S0A0101")
                {
                    if (txt_slab_no.Text != "")
                    {
                        GeneralCommon.Gp_MsgBoxDisplay("不是在线板坯入库,板坯号和目的垛位号不能同时输入!", "W", "");
                        return;
                    }
                }
            }



            //if (txt_f_addr.Text == "S0A0101" || txt_f_addr.Text == "S0Q0101")
            //    SpreadCommon.Gp_Sp_ColHidden(ss1, 0, true);
            //else
            //    SpreadCommon.Gp_Sp_ColHidden(ss1, 0, false);

            //if (txt_t_addr.Text == "S0A0101" || txt_t_addr.Text == "S0Q0101")
            //    SpreadCommon.Gp_Sp_ColHidden(ss2, 0, true);
            //else
            //    SpreadCommon.Gp_Sp_ColHidden(ss2, 0, false);

            //if (p_Ref(1, 1, true, false))
            if (SpreadCommon.Gf_Sp_Refer(GeneralCommon.M_CN1, (Collection)Proc_Sc[1], (Collection)Proc_Mc[1], (Collection)((Collection)Proc_Mc[1])["npControl"], (Collection)((Collection)Proc_Mc[1])["mControl"], false))
            {
                this.ss1.ActiveSheet.Rows.Add(0, 60 - this.ss1.ActiveSheet.Rows.Count);

                if ((sFromLoc == "S0A0101" || sFromLoc == "S0Q0101" || sFromLoc == "") && (txt_slab_no.Text != ""))
                {
                    for (int i = 0; i < this.ss1_Sheet1.RowCount; i++)
                    {
                        if (this.ss1_Sheet1.Cells[i, 1].Text == txt_slab_no.Text)
                        {
                            this.ss1_Sheet1.RowHeader.Cells[i, 0].Text = "入库";
                            proNum            = 1;
                            txt_slab_cnt.Text = "1";
                            this.ss1_Sheet1.Cells[i, 1].BackColor = Color.Red;
                            break;
                        }
                    }
                }
            }
            else
            {
                setSpread(ss1);
                ss1HaveRowCount = 60;
            }
            this.ss1.SetViewportTopRow(0, 43);

            // if (p_Ref(1, 2, true, false))
            if (SpreadCommon.Gf_Sp_Refer(GeneralCommon.M_CN1, (Collection)Proc_Sc[2], (Collection)Proc_Mc[1], (Collection)((Collection)Proc_Mc[1])["npControl"], (Collection)((Collection)Proc_Mc[1])["mControl"], false))
            {
                int temp = this.ss2.ActiveSheet.Rows.Count;
                this.ss2.ActiveSheet.Rows.Add(0, 60 - this.ss2.ActiveSheet.Rows.Count);
                if (txt_slab_no.Text != "")
                {
                    if (GeneralCommon.Gf_CodeFind(GeneralCommon.M_CN1, "SELECT YARD_ADDR FROM FP_SLABYARD WHERE SLAB_NO = '" + txt_slab_no.Text + "' AND YARD_KND = '" + CBO_CUR_INV.Text + "'") == "")
                    {
                        this.ss2_Sheet1.RowHeader.Cells[59 - temp, 0].Text = "增加";
                        this.ss2_Sheet1.Cells[59 - temp, 0].Text           = (temp + 1).ToString();
                        this.ss2_Sheet1.Cells[59 - temp, 1].Text           = txt_slab_no.Text;
                        this.ss2_Sheet1.Cells[59 - temp, 1].BackColor      = Color.Red;
                        this.ss2_Sheet1.Cells[59 - temp, 3].Text           = sToLoc;
                        this.ss2_Sheet1.Cells[59 - temp, 15].Text          = sFromLoc;
                        this.ss2_Sheet1.Cells[59 - temp, 14].Text          = GeneralCommon.sUserID;
                        ssc_can.Enabled = true;
                    }
                    else
                    {
                        if (sToLoc == "")
                        {
                            for (int i = 0; i < this.ss2_Sheet1.RowCount; i++)
                            {
                                if (this.ss2_Sheet1.Cells[i, 1].Text == txt_slab_no.Text)
                                {
                                    this.ss2_Sheet1.Cells[i, 1].BackColor = Color.Red;
                                }
                            }
                        }
                        if (sFromLoc == "S0A0101" || sFromLoc == "S0Q0101")
                        {
                            GeneralCommon.Gp_MsgBoxDisplay("板坯 " + txt_slab_no.Text + " 已经在库中,不需再做入库处理!", "W", "");
                            txt_slab_no.Text = "";
                        }
                    }
                }
            }
            else
            {
                ss2HaveRowCount = 60;
                setSpread(ss2);

                if (txt_slab_no.Text != "" && (sFromLoc == "S0A0101" || sFromLoc == "S0Q0101" || sFromLoc == ""))
                {
                    if (GeneralCommon.Gf_CodeFind(GeneralCommon.M_CN1, "SELECT YARD_ADDR FROM FP_SLABYARD WHERE SLAB_NO = '" + txt_slab_no.Text + "' AND YARD_KND = '" + CBO_CUR_INV.Text + "'") == "")
                    {
                        this.ss2_Sheet1.RowHeader.Cells[59, 0].Text = "增加";
                        this.ss2_Sheet1.Cells[59, 0].Text           = (1).ToString();
                        this.ss2_Sheet1.Cells[59, 1].Text           = txt_slab_no.Text;
                        this.ss2_Sheet1.Cells[59, 1].BackColor      = Color.Red;
                        this.ss2_Sheet1.Cells[59, 3].Text           = sToLoc;
                        this.ss2_Sheet1.Cells[59, 15].Text          = sFromLoc;
                        this.ss2_Sheet1.Cells[59, 14].Text          = GeneralCommon.sUserID;
                        txt_slab_cnt.Text = "1";
                        ssc_can.Enabled   = true;
                    }
                    else
                    {
                        GeneralCommon.Gp_MsgBoxDisplay("板坯 " + txt_slab_no.Text + " 已经在库中,不需再做入库处理!", "W", "");
                        txt_slab_no.Text = "";
                        return;
                    }
                }
            }
            this.ss2.SetViewportTopRow(0, 43);

            for (int i = 0; i < this.ss1_Sheet1.RowCount; i++)
            {
                if (this.ss1_Sheet1.Cells[i, 1].Text == "")
                {
                    this.ss1_Sheet1.Cells[i, 1].Locked    = true;
                    this.ss1_Sheet1.Cells[i, 1].BackColor = Color.White;
                }
            }
            for (int i = 0; i < this.ss2_Sheet1.RowCount; i++)
            {
                if (this.ss2_Sheet1.Cells[i, 1].Text == "")
                {
                    this.ss2_Sheet1.Cells[i, 1].Locked    = true;
                    this.ss2_Sheet1.Cells[i, 1].BackColor = Color.White;
                }
            }

            ssc_move.Enabled     = false;
            ssc_can.Enabled      = false;
            txt_slab_cnt.Enabled = false;
            txt_p_row.Enabled    = false;


            for (int i = 0; i < this.ss1_Sheet1.RowCount; i++)
            {
                if (this.ss1_Sheet1.Cells[i, 1].Text != "")
                {
                    ss1HaveRowCount = i;
                    break;
                }
            }
            for (int i = 0; i < this.ss2_Sheet1.RowCount; i++)
            {
                if (this.ss2_Sheet1.Cells[i, 1].Text != "")
                {
                    ss2HaveRowCount = i;
                    break;
                }
            }
        }