Exemplo n.º 1
0
    // 列印
    protected void btnPrint_Click(object sender, EventArgs e)
    {
        ErrorMsgLabel.Text = "";

        try
        {
            PURModel.MaintainPurchaseDeliveryGoods BCO = new PURModel.MaintainPurchaseDeliveryGoods(ConnectionDB);

            string vPICK_SELECT_1 = "0";
            string vPICK_SELECT_2 = "0";

            //固定傳 1
            vPICK_SELECT_1 = "1";
            vPICK_SELECT_2 = "1";

            ParameterList.Clear();
            ParameterList.Add(GetValueSetParameter(this.txtPLAN_ACCEPT_DATE.Text, "string", false));
            ParameterList.Add(GetValueSetParameter(this.txtPICK_BATCH.Text, "string", false));
            ParameterList.Add(GetValueSetParameter(vPICK_SELECT_1, "int", false));
            ParameterList.Add(GetValueSetParameter(vPICK_SELECT_2, "int", false));

            DataTable Dt_Print = BCO.QuerySwitch(PURModel.MaintainPurchaseDeliveryGoods.QueryType.QueryByPrint, ParameterList);

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

                return;
            }
            ShowReport(Dt_Print);
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        finally { }
    }
Exemplo n.º 2
0
    // 品項載入(續2)
    private void Item_Load2()
    {
        string vPICK_SELECT_1 = "0";
        string vPICK_SELECT_2 = "0";

        if (this.chkPICK_SELECT_1.Checked == true) //正常品
            vPICK_SELECT_1 = "1";
        if (this.chkPICK_SELECT_2.Checked == true) //客服查補
            vPICK_SELECT_2 = "1";

        SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value);

        string SessionIDName_Pick = "PUR041_Pick" + PageTimeStamp.Value;
        Session[SessionIDName_Pick] = null;

        //第一次查詢,為了餵給BCO.InsertMaster Dt資料
        ParameterList.Clear();
        ParameterList.Add(GetValueSetParameter(TextBoxRowCountLimit.Text, "int", false));
        ParameterList.Add(GetValueSetParameter(this.txtPLAN_ACCEPT_DATE.Text, "string", false));
        ParameterList.Add(GetValueSetParameter(vPICK_SELECT_1, "int", false));
        ParameterList.Add(GetValueSetParameter(vPICK_SELECT_2, "int", false));
        ParameterList.Add(GetValueSetParameter(Session["UID"].ToString(), "string", false));
        ParameterList.Add(GetValueSetParameter(DateTime.Now.ToString(), "datetime", false));

        PURModel.MaintainPurchaseDeliveryGoods BCO = new PURModel.MaintainPurchaseDeliveryGoods(ConnectionDB);
        DataTable Dt = BCO.QuerySwitch(PURModel.MaintainPurchaseDeliveryGoods.QueryType.QueryByLOAD, ParameterList);

        string msg = "", msg1 = "", msg2 = "";
        if (getDataType() == "1")
        {
            for (int i = 0; i < Dt.Rows.Count; i++)
                if (ChkDup(Dt.Rows[i]["ST_ACCEPT_DATE"].ToString(), Dt.Rows[i]["VIRTUAL_CODE"].ToString(), Dt.Rows[i]["PERIOD"].ToString(), "2"))
                {
                    msg1 += "品號:" + Dt.Rows[i]["VIRTUAL_CODE"].ToString() + "、期別:" + Dt.Rows[i]["PERIOD"].ToString() + "<br \\>";
                    Dt.Rows.Remove(Dt.Rows[i]);
                }
            if (msg1 != "") msg1 += "已存在客服查補裏,故未載入<br \\>";
        }
        else if (getDataType() == "2")
        {
            for (int i = 0; i < Dt.Rows.Count; i++)
                if (ChkDup(Dt.Rows[i]["ST_ACCEPT_DATE"].ToString(), Dt.Rows[i]["VIRTUAL_CODE"].ToString(), Dt.Rows[i]["PERIOD"].ToString(), "1"))
                {
                    msg2 += "品號:" + Dt.Rows[i]["VIRTUAL_CODE"].ToString() + "、期別:" + Dt.Rows[i]["PERIOD"].ToString() + "<br \\>";
                    Dt.Rows.Remove(Dt.Rows[i]);
                }
            if (msg2 != "") msg2 += "已存在正常品裏,故未載入";
        }
        msg = msg1 + msg2;
        if (msg != "") lblMsg.Text = msg;

        //2009/9/17 修改流程:「品項載入」後即可經由管制鈕的選擇而ENABLE「通路管制設定」鈕,所以要先Reset該DB的資料
        //先全部刪除~再新增
        ParameterList.Clear();
        ParameterList.Add(this.txtPLAN_ACCEPT_DATE.Text);
        ParameterList.Add(this.txtPICK_BATCH.Text);
        ParameterList.Add(Session["UID"].ToString());
        ParameterList.Add(getDataType()); // 2010/3/8 By Tony 新增資料來源條件:1:正常品 2:客服查補 3:正常品 + 客服查補
        DateTime dNow = DateTime.Now; //DeleteAll、InsertMaster、QuerySwitch使用統一的時間
        BCO.DeleteAll(ParameterList, null, dNow);
        BCO.InsertMaster(this.getMasterParameterList(), Dt, null, dNow);

        //第二次查詢,為了找出BCO.InsertMaster後的Update資訊
        string v_PICK_CNT = "0";
        string v_RESTRAIN_CNT = "0";
        ParameterList.Clear();
        ParameterList.Add(GetValueSetParameter(TextBoxRowCountLimit.Text, "int", false));
        ParameterList.Add(txtPLAN_ACCEPT_DATE.Text);
        ParameterList.Add(txtPICK_BATCH.Text);
        ParameterList.Add(getDataType());
        Dt = BCO.QueryPICK_CONTROL(ParameterList);
        
        GridView1.DataSource = Dt;
        Session[SessionIDName] = Dt;

        #region 將明細資料放至DetailDt中
        detailTmpDt = Dt;
        #endregion

        //將空白的資料做處理
        Dt = ProcessDBNull(Dt);

        #region 使用XML放置到前端資料
        DataSet Ds = Dt.DataSet;
        DetailOLDData.InnerHtml = Ds.GetXml();
        #endregion

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

        if (Dt == null || (Dt != null && Dt.Rows.Count <= 0))
        {
            LabelQueryRecordCount.Text = "";
            this.hid_PICK_CNT.Value = "0";
            this.hid_RESTRAIN_CNT.Value = "0";

            btnPrint.Visible = false;
            btnEdit.Visible = false;
            ErrorMsgLabel.Text = "查無資料";
            btnDelItem.Visible = false;
            //btnImportOnDate.Visible = false;
            this.hid_PageStatus.Text = "VIEW";
        }
        else
        {
            LabelQueryRecordCount.Text = "品項數:理貨品:" + Dt.Rows.Count + "筆 管制品:0筆";
            this.hid_PICK_CNT.Value = Dt.Rows.Count.ToString();
            this.hid_RESTRAIN_CNT.Value = "0";

            btnPrint.Visible = true;
            btnEdit.Visible = true;
            this.hid_PageStatus.Text = "LOAD";
            SetPageStatus();
            LockControlChk();//對ControlChk鎖定編輯
            btnDelItem.Visible = true;
            //btnImportOnDate.Visible = true;
            btnImportOnDate.Enabled = true;
        }

        #region ToolBar設定
        if (detailTmpDt == null || (detailTmpDt != null && detailTmpDt.Rows.Count <= 0))
        {
            GMToolbar1.GMToolbarStatus = WUI_GMToolbarV.GMToolbarStatusEnum.Other;
            GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Find, true, "PUR041.aspx?Code=PUR04", null, WUI_GMToolbarV.ClickAction.LinkURL);
            //GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.FindExport, false, "", this.btnEdit, WUI_GMToolbarV.ClickAction.ButtonClick);
            GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.New, false, string.Empty, this.btnEdit, WUI_GMToolbarV.ClickAction.ButtonClick);
            GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Save, false, string.Empty, this.btnSave, WUI_GMToolbarV.ClickAction.ButtonClick);
            GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Edit, false, string.Empty, this.btnEdit, WUI_GMToolbarV.ClickAction.ButtonClick);
            GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Delete, false, string.Empty, this.btnEdit, WUI_GMToolbarV.ClickAction.ButtonClick);
        }
        else
        {
            GMToolbar1.GMToolbarStatus = WUI_GMToolbarV.GMToolbarStatusEnum.Other;
            GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Find, true, "PUR041.aspx?Code=PUR04", null, WUI_GMToolbarV.ClickAction.LinkURL);
           // GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.FindExport, false, "", this.btnEdit, WUI_GMToolbarV.ClickAction.ButtonClick);
            GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.New, false, string.Empty, this.btnEdit, WUI_GMToolbarV.ClickAction.ButtonClick);
            GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Save, true, string.Empty, this.btnSave, WUI_GMToolbarV.ClickAction.ButtonClick);
            GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Edit, false, string.Empty, this.btnEdit, WUI_GMToolbarV.ClickAction.ButtonClick);
            GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Delete, false, string.Empty, this.btnEdit, WUI_GMToolbarV.ClickAction.ButtonClick);
        }
        #endregion
    }
Exemplo n.º 3
0
    //指定日期匯入(續)
    private void LoadFromDate1(string importDate)
    {
        SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value);
        string SessionIDName_Pick = "PUR041_Pick" + PageTimeStamp.Value;
        string vPICK_SELECT_1 = "0";
        string vPICK_SELECT_2 = "0";

        if (this.chkPICK_SELECT_1.Checked == true) //正常品
            vPICK_SELECT_1 = "1";
        if (this.chkPICK_SELECT_2.Checked == true) //客服查補
            vPICK_SELECT_2 = "1";

        DataTable dt_main_tmp = new DataTable();

        //第一次查詢,為了餵給BCO.InsertMaster Dt資料
        ParameterList.Clear();
        ParameterList.Add(GetValueSetParameter(TextBoxRowCountLimit.Text, "int", false));
        ParameterList.Add(GetValueSetParameter(importDate, "string", false));
        ParameterList.Add(GetValueSetParameter("1", "int", false)); //只取得正常品的資料
        ParameterList.Add(GetValueSetParameter("0", "int", false));
        ParameterList.Add(GetValueSetParameter(Session["UID"].ToString(), "string", false));
        ParameterList.Add(GetValueSetParameter(DateTime.Now.ToString(), "datetime", false));
        PURModel.MaintainPurchaseDeliveryGoods BCO = new PURModel.MaintainPurchaseDeliveryGoods(ConnectionDB);
        DataTable Dt = BCO.QuerySwitch(PURModel.MaintainPurchaseDeliveryGoods.QueryType.QueryByLOAD, ParameterList);

        if (Session[SessionIDName] != null && Session[SessionIDName] != "")
            dt_main_tmp = (DataTable)Session[SessionIDName];

        Session["dt_main_tmp" + PageTimeStamp.Value] = dt_main_tmp;//為了給變更Lock使用者後,繼續執行程式用
        
        int Dt_Count = Dt.Rows.Count;
        DataTable Dt_Copy = Dt.Copy();

        //已存在的資料就不再寫入了
        if (dt_main_tmp.Rows.Count > 0)
            for (int i = 0; i < Dt_Count; i++) //刪除虛擬品號、期別已存在於dt_main_tmp的資料
            {
                Dt_Copy.Rows[i]["ST_ACCEPT_DATE"] = txtPLAN_ACCEPT_DATE.Text;
                DataRow[] drsTmp = dt_main_tmp.Select("VIRTUAL_CODE = '" + Dt_Copy.Rows[i]["VIRTUAL_CODE"].ToString() + "' and PERIOD = '" + Dt_Copy.Rows[i]["PERIOD"].ToString() + "'");
                DataRow[] drsCop = Dt.Select("VIRTUAL_CODE = '" + Dt_Copy.Rows[i]["VIRTUAL_CODE"].ToString() + "' and PERIOD = '" + Dt_Copy.Rows[i]["PERIOD"].ToString() + "'");
                if (drsTmp.Length > 0)
                    Dt.Rows.Remove(drsCop[0]);
            }

        if (Dt.Rows.Count > 0)
        {
            Session["LoadFromDate1" + PageTimeStamp.Value] = Dt;//為了給變更Lock使用者後,繼續執行程式用
            if (hid_PageStatus.Text == "VIEW")
            {
                DataTable dtLock = getControlChk();
                if (dtLock.Rows.Count > 0)
                {
                    ViewState["ControlChk"] = dtLock;
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "if (confirm('該進貨日期、理貨批次目前仍由(" + dtLock.Rows[0]["UPDATEUID"].ToString() + ")於" + dtLock.Rows[0]["UPDATEDATE"].ToString() + "編輯中\\n\\n如繼續,將會重新鎖定該日期、批號\\n\\n於編輯期間由(" + dtLock.Rows[0]["UPDATEUID"].ToString() + ")編輯中的資料將無法存檔\\n\\n是否確定仍要繼續匯入品項?')){__doPostBack('','LoadFromDate2');}", true);
                    return;
                }
            }
            LoadFromDate2();
        }
        else
            ErrorMsgLabel.Text = "無資料可載入 !!";
    }