コード例 #1
0
ファイル: CGR011.aspx.cs プロジェクト: ChiangHanLung/PIC_VDS
    /// <summary>
    /// 查詢鈕
    /// </summary>
    protected void btnQuery_Click(object sender, EventArgs e)
    {
        if (VerifyFormData() == true)
        {
            try
            {
                ErrorMsgLabel.Text = "";

                int intP_Qty_S = 0;
                int intP_Qty_E = 0;

                //如果刷讀數量起迄都沒輸入,預設為 0 ~ 9999
                if (txt_P_Qty_S.Text.Length == 0 && txt_P_Qty_E.Text.Length == 0)
                {
                    intP_Qty_S = 0;
                    intP_Qty_E = 9999;
                }

                //如果只輸入迄,未輸入起,則起設為和迄相等
                if (txt_P_Qty_S.Text.Length == 0 && txt_P_Qty_E.Text.Length != 0)
                {
                    intP_Qty_E = int.Parse(txt_P_Qty_E.Text);
                    intP_Qty_S = intP_Qty_E;
                }

                //如果只輸入起,未輸入迄,則迄設為和起相等
                if (txt_P_Qty_S.Text.Length != 0 && txt_P_Qty_E.Text.Length == 0)
                {
                    intP_Qty_S = int.Parse(txt_P_Qty_S.Text);
                    intP_Qty_E = intP_Qty_S;
                }

                if (txt_P_Qty_S.Text.Length != 0 && txt_P_Qty_E.Text.Length != 0)
                {
                    intP_Qty_S = int.Parse(txt_P_Qty_S.Text);
                    intP_Qty_E = int.Parse(txt_P_Qty_E.Text);
                }

                //抓取本頁初次登記的時間
                string SessionIDName = "CGR011_" + PageTimeStamp.Value;

                CGRModel.MaintainSorterData BCO = new PIC.VDS2G.LGT.CGR.MaintainSorterData(ConntionDB);
                DataTable Dt;
                ParameterList.Clear();

                ParameterList.Add(SLP_StoreChain.Text);//通路
                ParameterList.Add(SLP_Store.Text);//門市
                ParameterList.Add(SLP_P_Date.Text);//處理日
                ParameterList.Add(txtChan_Source_No.Text);//通路單號
                ParameterList.Add(SLP_T_Date.Text);//模板日
                ParameterList.Add(SLP_Sign_Date.Text);//簽收日
                ParameterList.Add(txtBatch_No.Text);//批次序號
                ParameterList.Add(SLP_SKU1.Text);//品號/品名
                ParameterList.Add(SLP_ItemPeriod.Text);//期別
                ParameterList.Add(intP_Qty_S);//刷讀數量_起
                ParameterList.Add(intP_Qty_E);//刷讀數量_迄
                ParameterList.Add(Int16.Parse(TextBoxRowCountLimit.Text));

                Dt = BCO.QueryDetlByFind(ParameterList);


                if (Dt.Rows.Count == 0)
                {
                    ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGR011.aspx", "alert(' 查無資料 ');", true);
                }

                Session[SessionIDName] = Dt;
                GridView1.DataSource = Dt;
                //設定分頁大小
                GridView1.PageSize = (TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) < 0) ? 10 : int.Parse(TextBoxPagesize.Text);
                GridView1.PageIndex = 0;
                GridView1.DataBind();

                //為求總品項數的欄位
                string[] fileds ={ "ITEM", "PERIOD" };
                DataTable newdt = this.SelectDistinct(Dt, fileds);

                lblDistinct.Text = newdt.Rows.Count.ToString();

                Label1.Visible = true;
                Label2.Visible = true;
                lblSumPQty.Visible = true;
                lblDistinct.Visible = true;
            }
            catch (Exception ex)
            {
                ErrorMsgLabel.Text = ex.Message;
            }
        }

    }
コード例 #2
0
ファイル: CGR011.aspx.cs プロジェクト: ChiangHanLung/PIC_VDS
    private void BindGrid(ArrayList AL_Rule)
    {
        //抓取本頁初次登記的時間
        string SessionIDName = "CGR011_" + PageTimeStamp.Value;

        CGRModel.MaintainSorterData BCO = new PIC.VDS2G.LGT.CGR.MaintainSorterData(ConntionDB);

        DataTable Dt;

        Dt = BCO.QueryDetlByFind(AL_Rule);

        Session[SessionIDName] = Dt;
        GridView1.DataSource = Dt;
        //設定分頁大小
        GridView1.PageSize = (TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) < 0) ? 10 : int.Parse(TextBoxPagesize.Text);
        GridView1.PageIndex = 0;
        GridView1.DataBind();

        //為求總品項數的欄位
        string[] fileds ={ "ITEM", "PERIOD" };
        DataTable newdt = this.SelectDistinct(Dt, fileds);

        lblDistinct.Text = newdt.Rows.Count.ToString();

        Label1.Visible = true;
        Label2.Visible = true;
        lblSumPQty.Visible = true;
        lblDistinct.Visible = true;
    }
コード例 #3
0
ファイル: CGR012.aspx.cs プロジェクト: ChiangHanLung/PIC_VDS
    private void SaveData()
    {
        if (IsInt(PQty.Text))
        {
            string DtName = Request.QueryString["PageTimeStamp"];

            DataTable Dt = (DataTable)Session["CGR011_" + DtName];
            DataRow Dr = Dt.Select("ID=" + Request.QueryString["DID"])[0];

            DateTime dtLastDate;
            DateTime dtLastDateNew = DateTime.Now;

            CGRModel.MaintainSorterData BCO = new PIC.VDS2G.LGT.CGR.MaintainSorterData(ConntionDB);

            ParameterList.Clear();

            ParameterList.Add(int.Parse(ID.Value.ToString()));
            ParameterList.Add(Store.Text);
            ParameterList.Add(int.Parse(PQty.Text));

            if (DateTime.TryParse(Dr["LAST_DATE"].ToString(), out dtLastDate))
            {
                ParameterList.Add(dtLastDate.ToString("yyyy/MM/dd HH:mm:ss"));
            }
            else
            {
                ParameterList.Add("");
            }
            ParameterList.Add(dtLastDateNew.ToString("yyyy/MM/dd HH:mm:ss"));
            ParameterList.Add(LastID.Text);
            ParameterList.Add(Session["UID"].ToString());

            BCO.UpdSorterData(ParameterList, DBT);

            Dr["STORE"] = Store.Text;
            Dr["P_QTY"] = int.Parse(PQty.Text);
            Dr["LAST_DATE"] = dtLastDateNew;
            Dr.AcceptChanges();

            Dt.AcceptChanges();
            Session["CGR011_" + DtName] = Dt;

            ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "CloseWindow", "window.close();", true);
        }
        else
        {
            ScriptManager.RegisterStartupScript(Page, this.GetType(), "NotPositive", "alert(' 請輸入 0 或正整數 ');", true);
        }
    }
コード例 #4
0
ファイル: CGR012.aspx.cs プロジェクト: ChiangHanLung/PIC_VDS
    private bool CheckSameChan()
    {
        DataRow Dr = (DataRow)Session["Dr_" + PageTimeStamp.Value];

        if (Store.Text.Trim() != Dr["STORE"].ToString())
        {

            CGRModel.MaintainSorterData BCO = new PIC.VDS2G.LGT.CGR.MaintainSorterData(ConntionDB);

            ParameterList.Clear();

            ParameterList.Add(ChanNo.Text);
            ParameterList.Add(Store.Text);

            DataTable Dt = BCO.QueryChanStore(ParameterList);

            if (Dt.Rows.Count == 0)
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGR012.aspx", "alert(' 請選擇相同通路的門市 ');", true);
                return false;
            }
        }
        return true;
    }
コード例 #5
0
ファイル: CGR012.aspx.cs プロジェクト: ChiangHanLung/PIC_VDS
    /// <summary>
    /// 檢查是否曾出貨給該門市
    /// </summary>
    /// <returns></returns>
    private bool CheckHisData()
    {
        DataRow Dr = (DataRow)Session["Dr_" + PageTimeStamp.Value];

        if (Store.Text.Trim() != Dr["STORE"].ToString())
        {
            int intAccept_Qty = 0;
            int intPatch_In_Qty_P = 0;
            int intPatch_Out_Qty_P = 0;
            int intAdj_In_Qty = 0;

            DataTable Dt;

            CGRModel.MaintainSorterData BCO = new PIC.VDS2G.LGT.CGR.MaintainSorterData(ConntionDB);

            ParameterList.Clear();

            ParameterList.Add(ChanNo.Text);
            ParameterList.Add(Store.Text);
            ParameterList.Add(Item.Text);
            ParameterList.Add(Period.Text);

            Dt = BCO.StoreAcceptHisData(ParameterList);

            if (Dt.Rows.Count > 0)
            {
                intAccept_Qty = int.Parse(Dt.Rows[0]["Accept_Qty"].ToString());
                intPatch_In_Qty_P = int.Parse(Dt.Rows[0]["Patch_In_Qty_P"].ToString());
                intPatch_Out_Qty_P = int.Parse(Dt.Rows[0]["Patch_Out_Qty_P"].ToString());
                intAdj_In_Qty = int.Parse(Dt.Rows[0]["Adj_In_Qty"].ToString());

                if (intAccept_Qty + intPatch_In_Qty_P + intPatch_Out_Qty_P + intAdj_In_Qty <= 0)
                {
                    ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGR012.aspx", "if (confirm('未發行此門市,確認修改?')){__doPostBack('SaveData','');}", true);
                    return false;
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGR012.aspx", "alert(' 未發行此門市 ');", true);
                return false;
            }
        }
        return true;
    }
コード例 #6
0
ファイル: CGR012.aspx.cs プロジェクト: ChiangHanLung/PIC_VDS
    /// <summary>
    /// 計算總刷讀數
    /// </summary>
    /// <param name="strBatchNo"></param>
    /// <param name="strItem"></param>
    /// <param name="strPeriod"></param>
    /// <param name="strChanNo"></param>
    /// <returns></returns>
    private string GetSumPQty(string strBatchNo, string strItem, string strPeriod, string strChanNo)
    {
        string result = string.Empty;

        CGRModel.MaintainSorterData BCO = new PIC.VDS2G.LGT.CGR.MaintainSorterData(ConntionDB);

        ParameterList.Clear();

        ParameterList.Add(strBatchNo);
        ParameterList.Add(strItem);
        ParameterList.Add(strPeriod);
        ParameterList.Add(strChanNo);

        result = BCO.CalSumPQty(ParameterList).ToString();

        return result;
    }