예제 #1
0
    /// <summary>
    /// 複製鈕(複製視窗內的)
    /// </summary>
    protected void btnSave_Click(object sender, EventArgs e)
    {
        #region 輸入檢查

        if (SLP_CopyFromDate.Text == "")
        {
            ErrorMsgLabel.Text = "舊[門市進貨日]欄位不得空白";

            //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD021.aspx", "alert(' 舊[門市進貨日]欄位不得空白 ');", true);
            return;
        }

        if (txtPickBatchCopyFrom.Text == "")
        {
            ErrorMsgLabel.Text = "舊[理貨批次]欄位不得空白";

            //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD021.aspx", "alert(' 舊[理貨批次]欄位不得空白 ');", true);
            return;
        }

        if (SLP_CopyToDate.Text == "")
        {
            ErrorMsgLabel.Text = "新[門市進貨日]欄位不得空白";

            //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD021.aspx", "alert(' 新[門市進貨日]欄位不得空白 ');", true);
            return;
        }

        if (Convert.ToDateTime(SLP_CopyToDate.Text) <= DateTime.Now)
        {
            ErrorMsgLabel.Text = "新[門市進貨日]欄位不得小於等於系統日";

            //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD021.aspx", "alert(' 新[門市進貨日]欄位不得小於等於系統日 ');", true);
            return;
        }

        if (txtPickBatchCopyTo.Text == "")
        {
            ErrorMsgLabel.Text = "新[理貨批次]欄位不得空白";

            //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD021.aspx", "alert(' 新[理貨批次]欄位不得空白 ');", true);
            return;
        }

        #endregion

        System.IO.TextReader tr;

        CGDModel.CGDCommon BCOCommon = new CGDModel.CGDCommon();
        System.Data.Common.DbTransaction DBT = BCOCommon.OpenAndGetConnection(ConnectionDB).BeginTransaction();

        try
        {
            CGDModel.MaintainSetRouteOrder BCO = new CGDModel.MaintainSetRouteOrder(ConntionDB);
            string strWhere = "";

            // 檢查新日期是否有資料-----------------------------------------------------------------------------------------
            #region  checking


            DataTable DtCheckNew;
            ParameterList.Clear();

            ParameterList.Add(this.SLP_CopyToDate.Text.Trim());
            ParameterList.Add(this.txtPickBatchCopyTo.Text.Trim());

            DtCheckNew = BCO.QuerySwitch(CGDModel.CGDCommon.QueryType.QueryRouteOrder, ParameterList);

            if (DtCheckNew.Rows.Count > 0)
            {
                ErrorMsgLabel.Text = "輸入的新門市進貨日已有資料";

                //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD011.aspx", "alert(' 輸入的新門市進貨日已有資料 ');", true);
                return;
            }


            #endregion

            // 檢查舊日期是否有資料 , 如有資料則進行複製--------------------------------------------------------------------
            #region  checking


            DataTable DtCheckOld;
            ParameterList.Clear();

            ParameterList.Add(this.SLP_CopyFromDate.Text.Trim());
            ParameterList.Add(this.txtPickBatchCopyFrom.Text.Trim());

            DtCheckOld = BCO.QuerySwitch(CGDModel.CGDCommon.QueryType.QueryRouteOrder, ParameterList);

            if (DtCheckOld.Rows.Count == 0)
            {
                ErrorMsgLabel.Text = "輸入的舊門市進貨日沒有資料可以複製";

                //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD011.aspx", "alert(' 輸入的舊門市進貨日沒有資料可以複製 ');", true);
                return;
            }
            else
            {
                for (int i = 0; i <= DtCheckOld.Rows.Count - 1; i++)
                {
                    ParameterList.Clear();
                    ParameterListDel.Clear();

                    ParameterList.Add(DtCheckOld.Rows[i]["NAME"]);
                    ParameterList.Add(DtCheckOld.Rows[i]["CREATEDATE"]);
                    ParameterList.Add(DtCheckOld.Rows[i]["CREATEUID"]);
                    ParameterList.Add(System.DateTime.Now);
                    ParameterList.Add(Session["UID"].ToString());
                    ParameterList.Add(DtCheckOld.Rows[i]["STATUS"]);
                    ParameterList.Add(DtCheckOld.Rows[i]["ENABLE"]);
                    ParameterList.Add(DtCheckOld.Rows[i]["DPS_CODE"]);
                    ParameterList.Add(Convert.ToDateTime(this.SLP_CopyToDate.Text.Trim()));
                    ParameterList.Add(this.txtPickBatchCopyTo.Text.Trim());
                    ParameterList.Add(DtCheckOld.Rows[i]["LINE"]);
                    ParameterList.Add(DtCheckOld.Rows[i]["PICK_ORDER"]);
                    ParameterList.Add(DtCheckOld.Rows[i]["ROUTE"]);
                    ParameterList.Add(DtCheckOld.Rows[i]["STORE_CNT"]);

                    BCO.InsertRouteOrder(ParameterList, DBT);
                }
                DBT.Commit();//交易成功
            }


            #endregion

            ErrorMsgLabel.Text = "複製完畢";

            //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD011.aspx", "alert(' 複製完畢 ');", true);
        }
        catch (Exception ex)
        {
            DBT.Rollback();//交易失敗

            ErrorMsgLabel.Text = ex.Message;
        }

        btnCloseCopy_Click(null, null);
    }
예제 #2
0
    /// <summary>
    /// 儲存鈕
    /// </summary>
    protected void btnAddDetail_Click(object sender, EventArgs e)
    {
        if (txtNB_LOCATE_SUM.Text == "")
            txtNB_LOCATE_SUM.Text = "0";

        if (txtNB_ITEM_COUNT.Text == "")
            txtNB_ITEM_COUNT.Text = "0";

        if (Convert.ToInt32(txtNB_ITEM_COUNT.Text) != Convert.ToInt32(txtNB_LOCATE_SUM.Text))
        {
            ErrorMsgLabel.Text = "開站儲位與理貨商品的品項數不符";
            //ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "A", "alert(' 開站儲位與理貨商品的品項數不符 ');", true);

            return;
        }


        string SessionIDName = "CGD032_" + PageTimeStamp.Value;

        DataTable Dt = null;

        DataTable DT_Add = null;
        DataTable DT_Mod = null;
        DataTable DT_Del = null;

        if (Session[SessionIDName] != null)
        {
            Dt = (DataTable)Session[SessionIDName];

            DT_Add = Dt.GetChanges(DataRowState.Added);
            DT_Mod = Dt.GetChanges(DataRowState.Modified);
            DT_Del = Dt.GetChanges(DataRowState.Deleted);
        }
        else
        {
            ErrorMsgLabel.Text = "目前無資料異動";
            //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD032.aspx", "alert(' 目前無資料異動 ');", true);
            return;
        }

        if (DT_Add == null && DT_Mod == null && DT_Del == null)
        {
            ErrorMsgLabel.Text = "目前無資料異動";
            //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD032.aspx", "alert(' 目前無資料異動 ');", true);
            return;
        }


        CGDModel.CGDCommon BCOCommon = new CGDModel.CGDCommon();
        System.Data.Common.DbTransaction DBT = BCOCommon.OpenAndGetConnection(ConnectionDB).BeginTransaction();
        CGDModel.MaintainPickLocate BCO = new CGDModel.MaintainPickLocate(ConntionDB);

        try
        {
            if (userMode == "Edit")
            {
                //修改----------------------------------------------------------------------------------------------------------
                foreach (DataRow dRow in Dt.Rows)
                {
                    ParameterList.Clear();

                    ParameterList.Add(dRow["STATION_OPEN", DataRowVersion.Current].ToString());
                    ParameterList.Add(Convert.ToInt32(dRow["LOCATE_CNT", DataRowVersion.Current].ToString()));

                    ParameterList.Add(Convert.ToDateTime(dRow["CREATEDATE", DataRowVersion.Original].ToString()));
                    ParameterList.Add(dRow["CREATEUID", DataRowVersion.Original].ToString());
                    ParameterList.Add(Convert.ToDateTime(dRow["UPDATEDATE", DataRowVersion.Original].ToString()));
                    ParameterList.Add(dRow["UPDATEUID", DataRowVersion.Original].ToString());
                    ParameterList.Add(Convert.ToInt16(dRow["STATUS", DataRowVersion.Original].ToString()));
                    ParameterList.Add(Convert.ToInt16(dRow["ENABLE", DataRowVersion.Original].ToString()));
                    ParameterList.Add(Convert.ToDateTime(dRow["ST_ACCEPT_DATE", DataRowVersion.Original].ToString()));
                    ParameterList.Add(dRow["PICK_BATCH", DataRowVersion.Original].ToString());
                    ParameterList.Add(dRow["DPS_CODE", DataRowVersion.Original].ToString());
                    ParameterList.Add(dRow["STATION_NO", DataRowVersion.Original].ToString());
                    ParameterList.Add(Convert.ToInt32(dRow["LOCATE_CNT", DataRowVersion.Original].ToString()));
                    ParameterList.Add(dRow["STATION_OPEN", DataRowVersion.Original].ToString());

                    //---新增時所需資料
                    ParameterList.Add(Session["UID"]);
                    ParameterList.Add(Session["UID"]);
                    ParameterList.Add(1);
                    ParameterList.Add(Convert.ToDateTime(this.hidSLPDate1.Text.Trim()));
                    ParameterList.Add(this.hidtxtPickBatch.Text.Trim());
                    ParameterList.Add(this.ddlDPS_CODE.SelectedItem.Text.Trim());
                    ParameterList.Add(dRow["STATION_NO"]);
                    ParameterList.Add(dRow["LOCATE_CNT"]);
                    ParameterList.Add(dRow["STATION_OPEN"]);

                    string MSG = BCO.Update_VDS_CGD_PICK_STATION(ParameterList, DBT);

                    if (MSG == "NODATA")
                    {
                        throw new Exception("DB_NODATA");
                    }
                }
            }

            //新增----------------------------------------------------------------------------------------------------------
            if (userMode == "Insert")
            {
                foreach (DataRow dRow in Dt.Rows)
                {
                    ParameterList.Clear();
                    ParameterList.Add(Session["UID"]);
                    ParameterList.Add(Session["UID"]);
                    ParameterList.Add(1);
                    ParameterList.Add(Convert.ToDateTime(this.hidSLPDate1.Text.Trim()));
                    ParameterList.Add(this.hidtxtPickBatch.Text.Trim());
                    ParameterList.Add(this.ddlDPS_CODE.SelectedItem.Text.Trim());
                    ParameterList.Add(dRow["STATION_NO"]);
                    ParameterList.Add(dRow["LOCATE_CNT"]);
                    ParameterList.Add(dRow["STATION_OPEN"]);

                    BCO.Insert_VDS_CGD_PICK_STATION(ParameterList, DBT);
                }
            }

            DBT.Commit();//交易成功

            //從DB讀取最新資料
            Dt = null;
            ParameterList.Clear();

            ParameterList.Add(this.ddlDPS_CODE.SelectedItem.Text.Trim());
            ParameterList.Add(this.hidSLPDate1.Text.Trim());
            ParameterList.Add(this.hidtxtPickBatch.Text.Trim());

            Dt = BCO.QuerySwitch(CGDModel.CGDCommon.QueryType.QueryPickStation, ParameterList);

            Session[SessionIDName] = Dt;

            userMode = "Edit";
            ErrorMsgLabel.Text = "儲存完畢";
            //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD032.aspx", "alert(' 儲存完畢 ');", true);
        }
        catch (Exception ex)
        {
            DBT.Rollback();//交易失敗

            if (ex.Message.IndexOf("違反必須為唯一的限制條件") > 0)
            {
                ErrorMsgLabel.Text = "新增之站所已重複";
                //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD281.aspx", "alert(' 新增之站所已重複 ');", true);
                return;
            }

            if (ex.Message.IndexOf("NODATA") > 0)
            {
                ErrorMsgLabel.Text = "原資料已異動過,請重新查詢資料後再作處理";
                //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD281.aspx", "alert(' 原資料已異動過,請重新查詢資料後再作處理 ');", true);
                return;
            }

            ErrorMsgLabel.Text = ex.Message;
        }
        finally { }
        //Response.Redirect(string.Format("CGD031.aspx?Code=CGD03&StAcceptDate={0}&PickBatch={1}&ChanNo={2}&AreaPercent={3}", hidStAcceptDate.Text, hidPickBatch.Text, hidChanNo.Text, hidAreaPercent.Text), false);
    }
예제 #3
0
    protected void btnYes_Click(object sender, EventArgs e)
    {
        string SessionIDName = "CGD231_" + PageTimeStamp.Value;
        DataTable Dt = (DataTable)Session[SessionIDName];
        DataTable Dt2 = null;

        CGDModel.CGDCommon BCOCommon = new CGDModel.CGDCommon();
        System.Data.Common.DbTransaction DBT = BCOCommon.OpenAndGetConnection(ConnectionDB).BeginTransaction();

        CGDModel.ProcessPickQualityCheck BCO = new CGDModel.ProcessPickQualityCheck(ConntionDB);

        try
        {
            if (Dt != null)
            {
                //存檔
                foreach (DataRow dr in Dt.Rows)
                {
                    ParameterList.Clear();

                    ParameterList.Add(dr["PICK_NO"].ToString());
                    ParameterList.Add(dr["ITEM"].ToString());
                    ParameterList.Add(dr["PERIOD"].ToString());
                    ParameterList.Add(dr["VIRTUAL_CODE"].ToString());

                    Dt2 = BCO.Get_VDS_CGD_PICK_BK_ITEM_CK(ParameterList);

                    if (Dt2.Rows.Count == 0)
                    {
                        ParameterList.Clear();

                        ParameterList.Add(Session["UID"].ToString());
                        ParameterList.Add(Session["UID"].ToString());
                        ParameterList.Add(dr["PICK_NO"].ToString());
                        ParameterList.Add(dr["ITEM"].ToString());
                        ParameterList.Add(dr["VIRTUAL_CODE"].ToString());
                        ParameterList.Add(dr["PERIOD"].ToString());
                        ParameterList.Add(dr["CHECK_BATCH"].ToString());
                        ParameterList.Add(dr["CHECK_QTY"].ToString());
                        ParameterList.Add(dr["MODIFY_QTY"].ToString());

                        BCO.Insert_VDS_CGD_PICK_BK_ITEM_CK(ParameterList, DBT);
                    }
                    else
                    {
                        ParameterList.Clear();

                        ParameterList.Add(dr["PICK_NO"].ToString());
                        ParameterList.Add(dr["ITEM"].ToString());
                        ParameterList.Add(dr["PERIOD"].ToString());
                        ParameterList.Add(dr["VIRTUAL_CODE"].ToString());
                        ParameterList.Add(dr["CHECK_QTY"].ToString());
                        ParameterList.Add(dr["MODIFY_QTY"].ToString());
                        ParameterList.Add(Session["UID"].ToString());

                        BCO.UPDATE_VDS_CGD_PICK_BK_ITEM_CK(ParameterList, DBT);
                    }
                }

                DBT.Commit();
            }

            ErrorMsgLabel.Text = "儲存完畢";
            //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD023.aspx", "alert(' 儲存完畢 ');", true);
        }
        catch (Exception ex)
        {
            DBT.Rollback();//交易失敗

            ErrorMsgLabel.Text = ex.Message;
        }
        finally { }

        txtCheckQty.Enabled = true;
        txtModifyQty.ReadOnly = true;
        txtModifyQty.BackColor = System.Drawing.Color.LightGray;
        btnCancel.Visible = false;
        btnYes.Visible = false;
        btnEndCheck.Visible = true;
        btnEndBox.Visible = true;
        btnEndCheck.Enabled = true;
        btnEndBox.Enabled = false;
        txtRCItemBarcode.Text = "";
        ViewState["RCCheckState"] = "N";
        ViewState["RCBoxEndState"] = "N";

        Response.Redirect("CGD231.aspx?Code=CGD23", false);
    }
예제 #4
0
    /// <summary>
    /// 儲存鈕
    /// </summary>
    protected void btnSave_Click1(object sender, EventArgs e)
    {
        string SessionIDName = "CGD011_" + PageTimeStamp.Value;

        DataTable Dt = null;

        DataTable DT_Add = null;
        DataTable DT_Mod = null;
        DataTable DT_Del = null;

        if (Session[SessionIDName] != null)
        {
            Dt = (DataTable)Session[SessionIDName];

            DT_Add = Dt.GetChanges(DataRowState.Added);
            DT_Mod = Dt.GetChanges(DataRowState.Modified);
            DT_Del = Dt.GetChanges(DataRowState.Deleted);
        }
        else
        {
            ErrorMsgLabel.Text = "目前無資料異動";

            //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD011.aspx", "alert(' 目前無資料異動 ');", true);
            return;
        }

        if (DT_Add == null && DT_Mod == null && DT_Del == null)
        {
            ErrorMsgLabel.Text = "目前無資料異動";

            //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD011.aspx", "alert(' 目前無資料異動 ');", true);
            return;
        }

        CGDModel.CGDCommon BCOCommon = new CGDModel.CGDCommon();
        System.Data.Common.DbTransaction DBT = BCOCommon.OpenAndGetConnection(ConnectionDB).BeginTransaction();
        CGDModel.MaintainSetRouteOrder BCO = new CGDModel.MaintainSetRouteOrder(ConntionDB);



        try
        {
            //刪除----------------------------------------------------------------------------------------------------------
            if (DT_Del != null)
            {
                foreach (DataRow dRow in DT_Del.Rows)
                {
                    ParameterList.Clear();

                    ParameterList.Add(dRow["PICK_BATCH", DataRowVersion.Original].ToString());
                    ParameterList.Add(Convert.ToDateTime(dRow["ST_ACCEPT_DATE", DataRowVersion.Original].ToString()).ToShortDateString());
                    ParameterList.Add(dRow["ROUTE", DataRowVersion.Original].ToString());
                    ParameterList.Add(Convert.ToDateTime(dRow["UPDATEDATE", DataRowVersion.Original].ToString()));
                    ParameterList.Add(dRow["UPDATEUID", DataRowVersion.Original].ToString());

                    string MSG = BCO.DeleteRouteOrder(ParameterList, DBT);

                    if (MSG == "NODATA")
                    {
                        throw new Exception("DB_NODATA");
                    }
                }
            }

            //新增----------------------------------------------------------------------------------------------------------
            if (DT_Add != null)
            {
                foreach (DataRow dRow in DT_Add.Rows)
                {
                    ParameterList.Clear();

                    if (DT_Add.Columns.Contains("NAME").ToString() == "True")
                    {
                        ParameterList.Add(dRow["NAME"]);
                    }
                    else
                    {
                        ParameterList.Add(dRow["LINE"].ToString() + "-" + dRow["ROUTE"].ToString());
                    }
                    ParameterList.Add(dRow["CREATEDATE"]);
                    ParameterList.Add(dRow["CREATEUID"]);
                    ParameterList.Add(dRow["UPDATEDATE"]);
                    ParameterList.Add(dRow["UPDATEUID"]);
                    if (DT_Add.Columns.Contains("STATUS").ToString() == "True")
                    {
                        ParameterList.Add(dRow["STATUS"]);
                    }
                    else
                    {
                        ParameterList.Add(0);
                    }
                    ParameterList.Add(dRow["ENABLE"]);
                    ParameterList.Add(dRow["DPS_CODE"]);
                    ParameterList.Add(Convert.ToDateTime(dRow["ST_ACCEPT_DATE"]).ToShortDateString());
                    ParameterList.Add(dRow["PICK_BATCH"]);
                    ParameterList.Add(dRow["LINE"]);
                    ParameterList.Add(dRow["PICK_ORDER"]);
                    ParameterList.Add(dRow["ROUTE"]);
                    ParameterList.Add(dRow["STORE_CNT"]);


                    BCO.InsertRouteOrder(ParameterList, DBT);
                }
            }

            //修改----------------------------------------------------------------------------------------------------------
            if (DT_Mod != null)
            {
                foreach (DataRow dRow in DT_Mod.Rows)
                {
                    ParameterList.Clear();

                    ParameterList.Add(dRow["UPDATEUID", DataRowVersion.Current].ToString());
                    ParameterList.Add(dRow["NAME", DataRowVersion.Current].ToString());
                    ParameterList.Add(dRow["DPS_CODE", DataRowVersion.Current].ToString());
                    ParameterList.Add(dRow["ST_ACCEPT_DATE", DataRowVersion.Current]);
                    ParameterList.Add(dRow["PICK_BATCH", DataRowVersion.Current].ToString());
                    ParameterList.Add(dRow["LINE", DataRowVersion.Current].ToString());
                    ParameterList.Add(dRow["PICK_ORDER", DataRowVersion.Current].ToString());
                    ParameterList.Add(dRow["ROUTE", DataRowVersion.Current].ToString());
                    ParameterList.Add(Convert.ToInt32(dRow["STORE_CNT", DataRowVersion.Current].ToString()));

                    ParameterList.Add(Convert.ToDateTime(dRow["CREATEDATE", DataRowVersion.Original].ToString()));
                    ParameterList.Add(dRow["CREATEUID", DataRowVersion.Original].ToString());
                    ParameterList.Add(Convert.ToDateTime(dRow["UPDATEDATE", DataRowVersion.Original].ToString()));
                    ParameterList.Add(dRow["UPDATEUID", DataRowVersion.Original].ToString());
                    ParameterList.Add(Convert.ToInt16(dRow["STATUS", DataRowVersion.Original].ToString()));
                    ParameterList.Add(Convert.ToInt16(dRow["ENABLE", DataRowVersion.Original].ToString()));
                    ParameterList.Add(dRow["NAME", DataRowVersion.Original].ToString());
                    ParameterList.Add(dRow["DPS_CODE", DataRowVersion.Original].ToString());
                    ParameterList.Add(dRow["ST_ACCEPT_DATE", DataRowVersion.Original].ToString());
                    ParameterList.Add(dRow["PICK_BATCH", DataRowVersion.Original].ToString());
                    ParameterList.Add(dRow["LINE", DataRowVersion.Original].ToString());
                    ParameterList.Add(dRow["PICK_ORDER", DataRowVersion.Original].ToString());
                    ParameterList.Add(dRow["ROUTE", DataRowVersion.Original].ToString());
                    ParameterList.Add(Convert.ToInt32(dRow["STORE_CNT", DataRowVersion.Original].ToString()));

                    string MSG = BCO.UpdateRouteOrder(ParameterList, DBT);

                    if (MSG == "NODATA")
                    {
                        throw new Exception("DB_NODATA");
                    }
                }
            }

            DBT.Commit();//交易成功

            btnQuery_Click(null, null);

            ErrorMsgLabel.Text = "儲存完畢";
            //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD011.aspx", "alert(' 儲存完畢 ');", true);
        }
        catch (Exception ex)
        {
            DBT.Rollback();//交易失敗

            if (ex.Message.IndexOf("違反必須為唯一的限制條件") > 0)
            {
                ErrorMsgLabel.Text = "新增之站所已重複";

                //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD281.aspx", "alert(' 新增之站所已重複 ');", true);
                return;
            }

            if (ex.Message.IndexOf("NODATA") > 0)
            {
                ErrorMsgLabel.Text = "原資料已異動過,請重新查詢資料後再作處理";

                //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD281.aspx", "alert(' 原資料已異動過,請重新查詢資料後再作處理 ');", true);
                return;
            }

            ErrorMsgLabel.Text = ex.Message;
        }
        finally { }
    }
예제 #5
0
    /// <summary>
    /// 執行按鈕
    /// </summary>
    protected void btnRun_Click(object sender, EventArgs e)
    {
        DataBind();

        if (VerifyFormData())
        {
            #region 

            CGDModel.CGDCommon BCOCommon = new CGDModel.CGDCommon();
            System.Data.Common.DbTransaction DBT = BCOCommon.OpenAndGetConnection(ConnectionDB).BeginTransaction();

            try
            {
                DataSet dataSet;
                CGDModel.ProcessResetBatchAdj BCO = new CGDModel.ProcessResetBatchAdj(ConntionDB);
                dataSet = ((DataSet)Session[PAGE_DT_01 + PageTimeStamp.Value.ToString()]);

                if (optOperation.SelectedValue == "1" || optOperation.SelectedValue == "2")
                {
                    foreach (DataRow dr in dataSet.Tables[0].Rows)
                    {
                        if (dr["item_no"].ToString().Trim() != "")
                        {
                            string[] chainsSelected = dr["chain"].ToString().Split(new Char[] { '^' });

                            foreach (string chain in chainsSelected)
                            {
                                if (chain.Trim() != "")
                                {
                                    ParameterList.Clear();

                                    ParameterList.Add(slpdStAcceptDate.Text.Trim());
                                    ParameterList.Add(txtPickBatch.Text.Trim());
                                    ParameterList.Add(dr["item_no"].ToString().Trim());
                                    ParameterList.Add(dr["period_no"].ToString().Trim());

                                    string outQty = BCO.QueryItemOutQty(ParameterList);

                                    if (outQty == "")
                                    {
                                        DBT.Rollback();
                                        ErrorMsgLabel.Text = "資料不存在於門市進貨檔,執行中止。";
                                        return;
                                    }
                                    else
                                    {
                                        ParameterList.Clear();
                                        ParameterList.Add(Convert.ToInt16(optOperation.SelectedValue));
                                        ParameterList.Add(slpdStAcceptDate.Text.Trim());
                                        ParameterList.Add(txtPickBatch.Text.Trim());
                                        ParameterList.Add(dr["item_no"].ToString().Trim());
                                        ParameterList.Add(dr["period_no"].ToString().Trim());
                                        ParameterList.Add(chain.Trim());
                                        ParameterList.Add(Session["UID"].ToString());

                                        BCO.ProcessBatchSelect(ParameterList, DBT);
                                    }
                                }
                            }
                        }
                    }
                }
                else if (optOperation.SelectedValue == "3" || optOperation.SelectedValue == "4")
                {
                    foreach (DataRow dr in dataSet.Tables[0].Rows)
                    {
                        if (dr["item_no"].ToString().Trim() != "")
                        {
                            ParameterList.Clear();

                            ParameterList.Add(slpdStAcceptDate.Text.Trim());
                            ParameterList.Add(txtPickBatch.Text.Trim());
                            ParameterList.Add(dr["item_no"].ToString().Trim());
                            ParameterList.Add(dr["period_no"].ToString().Trim());

                            string outQty = BCO.QueryItemOutQty(ParameterList);

                            if (outQty == "")
                            {
                                DBT.Rollback();
                                ErrorMsgLabel.Text = "資料不存在於門市進貨檔,執行中止。";
                                //ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "A", "alert(' " + "[門市進貨日]      = " + slpdStAcceptDate.Text.Trim() + "\\n" + " [理貨批次]          = " + txtPickBatch.Text.Trim() + "\\n" + " [品號/虛擬品號] = " + dr["item_no"].ToString().Trim() + "\\n" + " [期別]                  = " + dr["period_no"].ToString().Trim() + "\\n" + "\\n" + "之資料不存在於門市進貨檔,執行中止。 ');", true);
                                return;
                            }
                            else if ((Convert.ToInt16(outQty) > 0) && (optOperation.SelectedValue == "4"))
                            {
                                DBT.Rollback();
                                ErrorMsgLabel.Text = "此商品期別數量未刪單,不可執行恢復作業,執行中止。";
                                //ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "A", "alert(' " + "[門市進貨日]      = " + slpdStAcceptDate.Text.Trim() + "\\n" + " [理貨批次]          = " + txtPickBatch.Text.Trim() + "\\n" + " [品號/虛擬品號] = " + dr["item_no"].ToString().Trim() + "\\n" + " [期別]                  = " + dr["period_no"].ToString().Trim() + "\\n" + "\\n" + "此商品期別數量未刪單,不可執行恢復作業,執行中止。 ');", true);
                                return;
                            }
                            else if ((Convert.ToInt16(outQty) == 0) && (optOperation.SelectedValue == "3"))
                            {
                                DBT.Rollback();
                                ErrorMsgLabel.Text = "此商品期別數量已歸0,不可執行刪單作業,執行中止。";
                                //ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "A", "alert(' " + "[門市進貨日]      = " + slpdStAcceptDate.Text.Trim() + "\\n" + " [理貨批次]          = " + txtPickBatch.Text.Trim() + "\\n" + " [品號/虛擬品號] = " + dr["item_no"].ToString().Trim() + "\\n" + " [期別]                  = " + dr["period_no"].ToString().Trim() + "\\n" + "\\n" + "此商品期別數量已歸0,不可執行刪單作業,執行中止。 ');", true);
                                return;
                            }
                            else
                            {
                                ParameterList.Clear();
                                ParameterList.Add(Convert.ToInt16(optOperation.SelectedValue));
                                ParameterList.Add(slpdStAcceptDate.Text.Trim());
                                ParameterList.Add(txtPickBatch.Text.Trim());
                                ParameterList.Add(dr["item_no"].ToString().Trim());
                                ParameterList.Add(dr["period_no"].ToString().Trim());
                                ParameterList.Add(Session["UID"].ToString());

                                BCO.ProcessBatchAdj(ParameterList, DBT);
                            }
                        }
                    }
                }
                else if (optOperation.SelectedValue == "5")
                {
                    foreach (DataRow dr in dataSet.Tables[0].Rows)
                    {
                        if (dr["item_no"].ToString().Trim() != "")
                        {
                            string[] chainsSelected = dr["chain"].ToString().Split(new Char[] { '^' });

                            foreach (string chain in chainsSelected)
                            {
                                if (chain.Trim() != "")
                                {
                                    ParameterList.Clear();

                                    ParameterList.Add(slpdStAcceptDate.Text.Trim());
                                    ParameterList.Add(txtPickBatch.Text.Trim());
                                    ParameterList.Add(dr["item_no"].ToString().Trim());
                                    ParameterList.Add(dr["period_no"].ToString().Trim());

                                    string outQty = BCO.QueryItemOutQty(ParameterList);

                                    if (outQty == "")
                                    {
                                        DBT.Rollback();
                                        ErrorMsgLabel.Text = "資料不存在於門市進貨檔,執行中止。";
                                        //ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "A", "alert(' " + "[門市進貨日]      = " + slpdStAcceptDate.Text.Trim() + "\\n" + " [理貨批次]          = " + txtPickBatch.Text.Trim() + "\\n" + " [品號/虛擬品號] = " + dr["item_no"].ToString().Trim() + "\\n" + " [期別]                  = " + dr["period_no"].ToString().Trim() + "\\n" + "\\n" + "之資料不存在於門市進貨檔,執行中止。 ');", true);
                                        return;
                                    }
                                    else
                                    {
                                        ParameterList.Clear();
                                        ParameterList.Add(slpdStAcceptDate.Text.Trim());
                                        ParameterList.Add(txtPickBatch.Text.Trim());
                                        ParameterList.Add(txtModifiedPickBatch.Text);
                                        ParameterList.Add(dr["item_no"].ToString().Trim());
                                        ParameterList.Add(dr["period_no"].ToString().Trim());
                                        ParameterList.Add(chain.Trim());
                                        ParameterList.Add(Session["UID"].ToString());

                                        BCO.ProcessPickBatch(ParameterList, DBT);
                                    }
                                }
                            }
                        }
                    }
                }

                DBT.Commit();
            }
            catch (Exception ex)
            {
                DBT.Rollback();//交易失敗

                ErrorMsgLabel.Text = ex.Message;
            }
            finally { }

            #endregion

            ErrorMsgLabel.Text = "執行完畢";
        }
    }
예제 #6
0
    /// <summary>
    /// 複製鈕(複製視窗內的)
    /// </summary>
    protected void btnSave_Click(object sender, EventArgs e)
    {
        #region 輸入檢查

        if (SLP_CopyFromDate.Text == "")
        {
            ErrorMsgLabel.Text = "舊[門市進貨日]欄位不得空白";

            //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD021.aspx", "alert(' 舊[門市進貨日]欄位不得空白 ');", true);
            return;
        }

        if (txtPickBatchCopyFrom.Text == "")
        {
            ErrorMsgLabel.Text = "舊[理貨批次]欄位不得空白";

            //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD021.aspx", "alert(' 舊[理貨批次]欄位不得空白 ');", true);
            return;
        }

        if (SLP_CopyToDate.Text == "")
        {
            ErrorMsgLabel.Text = "新[門市進貨日]欄位不得空白";

            //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD021.aspx", "alert(' 新[門市進貨日]欄位不得空白 ');", true);
            return;
        }

        if (Convert.ToDateTime(SLP_CopyToDate.Text) <= DateTime.Now)
        {
            ErrorMsgLabel.Text = "新[門市進貨日]欄位不得小於等於系統日";

            //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD021.aspx", "alert(' 新[門市進貨日]欄位不得小於等於系統日 ');", true);
            return;
        }


        if (txtPickBatchCopyTo.Text == "")
        {
            ErrorMsgLabel.Text = "新[理貨批次]欄位不得空白";

            //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD021.aspx", "alert(' 新[理貨批次]欄位不得空白 ');", true);
            return;
        }

        #endregion

        System.IO.TextReader tr;

        CGDModel.CGDCommon BCOCommon = new CGDModel.CGDCommon();
        System.Data.Common.DbTransaction DBT = BCOCommon.OpenAndGetConnection(ConnectionDB).BeginTransaction();

        try
        {
            CGDModel.MaintainSpecStore BCO = new CGDModel.MaintainSpecStore(ConntionDB);
            string strWhere = "";

            // 檢查新日期是否有資料-----------------------------------------------------------------------------------------
            #region  checking


            DataTable DtCheckNew;
            ParameterList.Clear();

            //組sql where字串
            strWhere = "";

            strWhere += " and MA.ST_ACCEPT_DATE = to_date('" + this.SLP_CopyToDate.Text.Trim() + "' , 'yyyy/mm/dd')";
            strWhere += " and MA.PICK_BATCH = '" + this.txtPickBatchCopyTo.Text.Trim() + "'";


            ParameterList.Add(strWhere);

            DtCheckNew = BCO.QuerySwitch(CGDModel.CGDCommon.QueryType.QueryStoreData, ParameterList);

            if (DtCheckNew.Rows.Count > 0)
            {
                ErrorMsgLabel.Text = "輸入的新門市進貨日已有資料";

                //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD021.aspx", "alert(' 輸入的新門市進貨日已有資料 ');", true);
                return;
            }


            #endregion

            // 檢查舊日期是否有資料 , 如有資料則進行複製--------------------------------------------------------------------
            #region  checking


            DataTable DtCheckOld;
            ParameterList.Clear();

            //組sql where字串
            strWhere = "";

            strWhere += " and MA.ST_ACCEPT_DATE = to_date('" + this.SLP_CopyFromDate.Text.Trim() + "' , 'yyyy/mm/dd')";
            strWhere += " and MA.PICK_BATCH = '" + this.txtPickBatchCopyFrom.Text.Trim() + "'";


            ParameterList.Add(strWhere);

            DtCheckOld = BCO.QuerySwitch(CGDModel.CGDCommon.QueryType.QueryStoreData, ParameterList);

            if (DtCheckOld.Rows.Count == 0)
            {
                ErrorMsgLabel.Text = "輸入的舊門市進貨日沒有資料可以複製";

                //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD021.aspx", "alert(' 輸入的舊門市進貨日沒有資料可以複製 ');", true);
                return;
            }
            else
            {
                for (int i = 0; i <= DtCheckOld.Rows.Count - 1; i++)
                {
                    ParameterList.Clear();
                    ParameterListDel.Clear();

                    ParameterList.Add(System.DateTime.Now);
                    ParameterList.Add(Session["UID"].ToString());
                    ParameterList.Add(System.DateTime.Now);
                    ParameterList.Add(Session["UID"].ToString());
                    ParameterList.Add(DtCheckOld.Rows[i]["STATUS"]);
                    ParameterList.Add(DtCheckOld.Rows[i]["ENABLE"]);
                    ParameterList.Add(Convert.ToDateTime(this.SLP_CopyToDate.Text.Trim()));
                    ParameterList.Add(this.txtPickBatchCopyTo.Text.Trim());
                    ParameterList.Add(DtCheckOld.Rows[i]["CHAN_NO"]);
                    ParameterList.Add(DtCheckOld.Rows[i]["STORE"]);
                    ParameterList.Add(DtCheckOld.Rows[i]["DELIV_EARLY"]);
                    ParameterList.Add(DtCheckOld.Rows[i]["LABEL_QTY"]);

                    BCO.CreatePICK_SPEC_STORE(ParameterList, DBT);
                }
                DBT.Commit();//交易成功
            }


            #endregion

            ErrorMsgLabel.Text = "複製完畢";

            ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD021.aspx", "alert(' 複製完畢 ');", true);
        }
        catch (Exception ex)
        {
            DBT.Rollback();//交易失敗

            ErrorMsgLabel.Text = ex.Message;
        }

        btnCloseCopy_Click(null, null);
    }
예제 #7
0
    /// <summary>
    /// 儲存鈕
    /// </summary>
    protected void btnSave_Click(object sender, EventArgs e)
    {
        string SessionIDName = "CGD281_" + PageTimeStamp.Value;

        DataTable Dt = null;

        DataTable DT_Add = null;
        DataTable DT_Mod = null;
        DataTable DT_Del = null;

        if (Session[SessionIDName] != null)
        {
            Dt = (DataTable)Session[SessionIDName];

            DT_Add = Dt.GetChanges(DataRowState.Added);
            DT_Mod = Dt.GetChanges(DataRowState.Modified);
            DT_Del = Dt.GetChanges(DataRowState.Deleted);
        }
        else
        {
            ErrorMsgLabel.Text = "目前無資料異動";

            return;
        }

        if (DT_Add == null && DT_Mod == null && DT_Del == null)
        {
            ErrorMsgLabel.Text = "目前無資料異動";

            return;
        }

        CGDModel.CGDCommon BCOCommon = new CGDModel.CGDCommon();
        System.Data.Common.DbTransaction DBT = BCOCommon.OpenAndGetConnection(ConnectionDB).BeginTransaction();
        CGDModel.MaintainPickWorkstation BCO = new CGDModel.MaintainPickWorkstation(ConntionDB);

        try
        {
            //刪除----------------------------------------------------------------------------------------------------------
            if (DT_Del != null)
            {
                foreach (DataRow dRow in DT_Del.Rows)
                {
                    ParameterList.Clear();

                    ParameterList.Add(dRow["DPS_CODE", DataRowVersion.Original].ToString());
                    ParameterList.Add(dRow["STATION_NO", DataRowVersion.Original].ToString());
                    ParameterList.Add(Convert.ToDateTime(dRow["UPDATEDATE", DataRowVersion.Original]));

                    string MSG = BCO.DeletePick_Workstation(ParameterList, DBT);

                    if ( MSG == "NODATA" )
                    {
                        throw new Exception("DB_NODATA");
                    }
                }
            }

            //新增----------------------------------------------------------------------------------------------------------
            if (DT_Add != null)
            {
                foreach (DataRow dRow in DT_Add.Rows)
                {
                    ParameterList.Clear();

                    ParameterList.Add(dRow["CREATEUID"]);
                    ParameterList.Add(dRow["UPDATEUID"]);
                    ParameterList.Add(dRow["STATUS"]);
                    ParameterList.Add(dRow["ENABLE"]);
                    ParameterList.Add(dRow["DPS_CODE"]);
                    ParameterList.Add(dRow["STATION_NO"]);
                    ParameterList.Add(dRow["USE_LOCATE_CNT"]);
                    ParameterList.Add(dRow["LIMIT_LOCATE_CNT"]);
                    ParameterList.Add(dRow["INTERFLOW_LOCATE"]);
                    ParameterList.Add(dRow["SHELF"]);

                    BCO.CreatePick_Workstation(ParameterList, DBT);
                }
            }

            //修改----------------------------------------------------------------------------------------------------------
            if (DT_Mod != null)
            {
                foreach (DataRow dRow in DT_Mod.Rows)
                {
                    string v_DPS_CODE = hidlbl_DPS_CODE.Text.Trim();
                    string v_STATION_NO = dRow["STATION_NO", DataRowVersion.Original].ToString();
                    DateTime v_UPDATEDATE = Convert.ToDateTime(dRow["UPDATEDATE", DataRowVersion.Original]);

                    ParameterList.Clear();

                    ParameterList.Add(dRow["UPDATEUID", DataRowVersion.Current].ToString());
                    ParameterList.Add(dRow["DPS_CODE", DataRowVersion.Current].ToString());
                    ParameterList.Add(dRow["STATION_NO", DataRowVersion.Current].ToString());
                    ParameterList.Add(Convert.ToInt32(dRow["USE_LOCATE_CNT", DataRowVersion.Current].ToString()));
                    ParameterList.Add(Convert.ToInt32(dRow["LIMIT_LOCATE_CNT", DataRowVersion.Current].ToString()));
                    ParameterList.Add(dRow["INTERFLOW_LOCATE", DataRowVersion.Current].ToString());
                    ParameterList.Add(dRow["SHELF", DataRowVersion.Current].ToString());

                    ParameterList.Add(Convert.ToDateTime(dRow["CREATEDATE", DataRowVersion.Original].ToString()));
                    ParameterList.Add(dRow["CREATEUID", DataRowVersion.Original].ToString());
                    ParameterList.Add(Convert.ToDateTime(dRow["UPDATEDATE", DataRowVersion.Original].ToString()));
                    ParameterList.Add(dRow["UPDATEUID", DataRowVersion.Original].ToString());
                    ParameterList.Add(dRow["STATUS", DataRowVersion.Original].ToString());
                    ParameterList.Add(dRow["ENABLE", DataRowVersion.Original].ToString());
                    ParameterList.Add(dRow["DPS_CODE", DataRowVersion.Original].ToString());
                    ParameterList.Add(dRow["STATION_NO", DataRowVersion.Original].ToString());
                    ParameterList.Add(Convert.ToInt32(dRow["USE_LOCATE_CNT", DataRowVersion.Original].ToString()));
                    ParameterList.Add(Convert.ToInt32(dRow["LIMIT_LOCATE_CNT", DataRowVersion.Original].ToString()));
                    ParameterList.Add(dRow["INTERFLOW_LOCATE", DataRowVersion.Original].ToString());
                    ParameterList.Add(dRow["SHELF", DataRowVersion.Original].ToString());
                  
                    string MSG = BCO.UpdatePick_Workstation(ParameterList, DBT);

                    if (MSG == "NODATA")
                    {
                        throw new Exception("DB_NODATA");
                    }
                }
            }

            DBT.Commit();//交易成功

            btnQuery_Click(null, null);

            ErrorMsgLabel.Text = "儲存完畢";

            //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD281.aspx", "alert(' 儲存完畢 ');", true);
        }
        catch (Exception ex)
        {
            DBT.Rollback();//交易失敗

            if (ex.Message.IndexOf("違反必須為唯一的限制條件") > 0)
            {
                ErrorMsgLabel.Text = "新增之站所已重複";

                //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD281.aspx", "alert(' 新增之站所已重複 ');", true);
                return;
            }

            if (ex.Message.IndexOf("NODATA") > 0)
            {
                ErrorMsgLabel.Text = "原資料已異動過,請重新查詢資料後再作處理";

                //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD281.aspx", "alert(' 原資料已異動過,請重新查詢資料後再作處理 ');", true);
                return;
            }

            ErrorMsgLabel.Text = ex.Message;
        }

        txtSTATION_NO.Text = "";
        txtUSE_LOCATE_CNT.Text = "";
        txtLIMIT_LOCATE_CNT.Text = "";
        chkINTERFLOW_LOCATE.Checked = false;
        chkSHELF.Checked = false;
        Panel1.Visible = false;
    }
예제 #8
0
    /// <summary>
    /// 儲存鈕
    /// </summary>
    protected void btnSave_Click(object sender, EventArgs e)
    {
        string SessionIDName = "CGD041_" + PageTimeStamp.Value;

        DataTable Dt = null;

        DataTable DT_Add = null;
        DataTable DT_Mod = null;
        DataTable DT_Del = null;

        if (Session[SessionIDName] != null)
        {
            Dt = (DataTable)Session[SessionIDName];

            DT_Add = Dt.GetChanges(DataRowState.Added);
            DT_Mod = Dt.GetChanges(DataRowState.Modified);
            DT_Del = Dt.GetChanges(DataRowState.Deleted);
        }
        else
        {
            ErrorMsgLabel.Text = "目前無資料異動";
            //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD041.aspx", "alert(' 目前無資料異動 ');", true);
            return;
        }

        if (DT_Add == null && DT_Mod == null && DT_Del == null)
        {
            ErrorMsgLabel.Text = "目前無資料異動";
            //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD041.aspx", "alert(' 目前無資料異動 ');", true);
            return;
        }

        CGDModel.CGDCommon BCOCommon = new CGDModel.CGDCommon();
        System.Data.Common.DbTransaction DBT = BCOCommon.OpenAndGetConnection(ConnectionDB).BeginTransaction();
        CGDModel.MaintainCheckQualityStore BCO = new CGDModel.MaintainCheckQualityStore(ConntionDB);

        try
        {
            //新增----------------------------------------------------------------------------------------------------------
            if (DT_Add != null)
            {
                foreach (DataRow dRow in DT_Add.Rows)
                {
                    ParameterList.Clear();

                    ParameterList.Add(dRow["CREATEDATE"]);
                    ParameterList.Add(dRow["CREATEUID"]);
                    ParameterList.Add(dRow["UPDATEDATE"]);
                    ParameterList.Add(dRow["UPDATEUID"]);
                    ParameterList.Add(dRow["ENABLE"]);
                    ParameterList.Add(dRow["PICK_BATCH"]);
                    ParameterList.Add(dRow["CHAN_NO"]);
                    ParameterList.Add(dRow["STORE"]);
                    ParameterList.Add(dRow["START_DATE"]);
                    ParameterList.Add(dRow["END_DATE"]);

                    BCO.CreatePICK_CK_STORE(ParameterList, DBT);
                }
            }

            //修改----------------------------------------------------------------------------------------------------------
            if (DT_Mod != null)
            {
                foreach (DataRow dRow in DT_Mod.Rows)
                {
                    ParameterList.Clear();

                    ParameterList.Add(dRow["UPDATEUID", DataRowVersion.Current].ToString());
                    ParameterList.Add(dRow["PICK_BATCH", DataRowVersion.Current].ToString());
                    ParameterList.Add(dRow["CHAN_NO", DataRowVersion.Current].ToString());
                    ParameterList.Add(dRow["STORE", DataRowVersion.Current].ToString());
                    ParameterList.Add(Convert.ToDateTime(dRow["START_DATE", DataRowVersion.Current].ToString()));
                    ParameterList.Add(Convert.ToDateTime(dRow["END_DATE", DataRowVersion.Current].ToString()));

                    ParameterList.Add(Convert.ToDateTime(dRow["CREATEDATE", DataRowVersion.Original].ToString()));
                    ParameterList.Add(dRow["CREATEUID", DataRowVersion.Original].ToString());
                    ParameterList.Add(Convert.ToDateTime(dRow["UPDATEDATE", DataRowVersion.Original].ToString()));
                    ParameterList.Add(dRow["UPDATEUID", DataRowVersion.Original].ToString());
                    ParameterList.Add(dRow["ENABLE", DataRowVersion.Original].ToString());
                    ParameterList.Add(dRow["PICK_BATCH", DataRowVersion.Original].ToString());
                    ParameterList.Add(dRow["CHAN_NO", DataRowVersion.Original].ToString());
                    ParameterList.Add(dRow["STORE", DataRowVersion.Original].ToString());
                    ParameterList.Add(Convert.ToDateTime(dRow["START_DATE", DataRowVersion.Original].ToString()));
                    ParameterList.Add(Convert.ToDateTime(dRow["END_DATE", DataRowVersion.Original].ToString()));

                    string MSG = BCO.UpdatePICK_CK_STORE(ParameterList, DBT);

                    if (MSG == "NODATA")
                    {
                        throw new Exception("DB_NODATA");
                    }
                }
            }

            DBT.Commit();//交易成功

            btnQuery_Click(null, null);

            ErrorMsgLabel.Text = "儲存完畢";
            //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD041.aspx", "alert(' 儲存完畢 ');", true);
        }
        catch (Exception ex)
        {
            DBT.Rollback();//交易失敗

            if (ex.Message.IndexOf("新增之資料已重複") > 0)
            {
                ErrorMsgLabel.Text = "查無資料";
                //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD281.aspx", "alert(' 新增之資料已重複 ');", true);
                return;
            }

            if (ex.Message.IndexOf("NODATA") > 0)
            {
                ErrorMsgLabel.Text = "原資料已異動過,請重新查詢資料後再作處理";
                //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD281.aspx", "alert(' 原資料已異動過,請重新查詢資料後再作處理 ');", true);
                return;
            }

            ErrorMsgLabel.Text = ex.Message;
        }

        txtChanNo.Text = "";
        txtChanNo_Add.Text = "";
        txtStore.Text = "";
        txtStore_Add.Text = "";
        SLP_StartDate_Add.Text = "";
        SLP_EndDate_Add.Text = "";

        Panel1.Visible = false;
    }
예제 #9
0
    /// <summary>
    /// 儲存鈕
    /// </summary>
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (txtChanNo.Text == "")
        {
            ErrorMsgLabel.Text = "請先執行[商品擷取]";
            //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD031.aspx", "alert(' 請先執行[商品擷取] ');", true);
            return;
        }

        string checkResult = CheckPickLocateSum();

        if (checkResult != txtChanNo.Text)
        {
            ErrorMsgLabel.Text = "開站儲位與理貨商品的品項數不符";
            //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD031.aspx", "alert(' 開站儲位與理貨商品的品項數不符 ');", true);
            return;
        }

        string SessionIDName = "CGD031_" + PageTimeStamp.Value;
        DataTable Dt = (DataTable)Session[SessionIDName];

        CGDModel.CGDCommon BCOCommon = new CGDModel.CGDCommon();
        System.Data.Common.DbTransaction DBT = BCOCommon.OpenAndGetConnection(ConnectionDB).BeginTransaction();

        try
        {
            //刪除
            ParameterList.Clear();

            //ParameterList.Add(hidSLPDate.Text);
            //ParameterList.Add(hidPickBatch.Text);

            ParameterList.Add(SLP_StAcceptDate.Text);
            ParameterList.Add(txtPickBatch.Text);

            CGDModel.MaintainPickLocate BCO = new CGDModel.MaintainPickLocate(ConntionDB);

            BCO.DeletePickLocate(ParameterList, DBT);


            //新增
            for (int i = 0; i <= Dt.Rows.Count - 1; i++)
            {
                ParameterList.Clear();

                ParameterList.Add(Dt.Rows[i]["NAME"]);
                ParameterList.Add(Session["UID"].ToString());
                ParameterList.Add(Session["UID"].ToString());
                ParameterList.Add(Dt.Rows[i]["STATUS"]);

                if (Dt.Rows[i]["ST_ACCEPT_DATE"].ToString() == "")
                {
                    ParameterList.Add(SLP_StAcceptDate.Text);
                }
                else
                {
                    ParameterList.Add(Dt.Rows[i]["ST_ACCEPT_DATE"]);
                }

                if (Dt.Rows[i]["PICK_BATCH"].ToString() == "")
                {
                    ParameterList.Add(txtPickBatch.Text);
                }
                else
                {
                    ParameterList.Add(Dt.Rows[i]["PICK_BATCH"]);
                }

                ParameterList.Add(Dt.Rows[i]["NUM"]);

                if (Dt.Rows[i]["STATION_NO"].ToString() == "")
                {
                    DBT.Rollback();//交易失敗

                    ErrorMsgLabel.Text = "請先執行儲位設定";
                    //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD031.aspx", "alert(' 請先執行[儲位設定] ');", true);
                    return;
                }
                else
                {
                    ParameterList.Add(Dt.Rows[i]["STATION_NO"]);
                }

                if (Dt.Rows[i]["LOCATE_NO"].ToString() == "")
                {
                    DBT.Rollback();//交易失敗

                    ErrorMsgLabel.Text = "請先執行儲位設定";
                    //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD031.aspx", "alert(' 請先執行[儲位設定] ');", true);
                    return;
                }
                else
                {
                    ParameterList.Add(Dt.Rows[i]["LOCATE_NO"]);
                }

                ParameterList.Add(Dt.Rows[i]["ITEM"]);
                ParameterList.Add(Dt.Rows[i]["PERIOD"]);
                ParameterList.Add(Dt.Rows[i]["ITEM_NAME"]);
                ParameterList.Add(Dt.Rows[i]["VIRTUAL_CODE"]);
                ParameterList.Add(Dt.Rows[i]["VIRTUAL_NAME"]);
                ParameterList.Add(Dt.Rows[i]["BARCODE"]);
                ParameterList.Add(Dt.Rows[i]["PERIOD_BARCODE"]);
                ParameterList.Add(Dt.Rows[i]["S_LENGTH"]);
                ParameterList.Add(Dt.Rows[i]["S_WIDTH"]);
                ParameterList.Add(Dt.Rows[i]["S_HEIGHT"]);
                ParameterList.Add(Dt.Rows[i]["S_WEIGHT"]);
                ParameterList.Add(Dt.Rows[i]["P_LENGTH"]);
                ParameterList.Add(Dt.Rows[i]["P_WIDTH"]);
                ParameterList.Add(Dt.Rows[i]["P_HEIGHT"]);
                ParameterList.Add(Dt.Rows[i]["P_WEIGHT"]);
                ParameterList.Add(Dt.Rows[i]["PMA"]);
                ParameterList.Add(Dt.Rows[i]["DPS_STATUS"]);
                ParameterList.Add(Dt.Rows[i]["DPS_UP_TIME"]);
                ParameterList.Add(Dt.Rows[i]["PICK_QTY"]);

                BCO.Insert_VDS_CGD_PICK_LOCATE(ParameterList, DBT);
            }

            DBT.Commit();//交易成功

            ErrorMsgLabel.Text = "儲存完畢";
            //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD031.aspx", "alert(' 儲存完畢 ');", true);
        }
        catch (Exception ex)
        {
            DBT.Rollback();//交易失敗

            ErrorMsgLabel.Text = ex.Message;
        }
        finally { }
    }