コード例 #1
0
        protected void BtnSequence_Click(object sender, EventArgs e)
        {
            int    RSLT = 0; long PkUpID = 0;
            string confirmValue = Request.Form["confirm_value"];

            BrilliantWMS.WMSOutbound.iOutboundClient Outbound = new WMSOutbound.iOutboundClient();
            BrilliantWMS.WMSInbound.iInboundClient   Inbound  = new WMSInbound.iInboundClient();
            try
            {
                if (confirmValue == "Yes")
                {
                    CustomProfile profile = CustomProfile.GetProfile();
                    BrilliantWMS.WMSOutbound.tPickUpHead pkh = new WMSOutbound.tPickUpHead();
                    //BrilliantWMS.WMSOutbound.tTransferHead trh = new WMSOutbound.tTransferHead();
                    if (Session["SOID"] != null)
                    {
                        int chkJObCart = Inbound.CheckJobCard(Convert.ToInt64(HttpContext.Current.Session["SOID"].ToString()), "SalesOrder", profile.DBConnection._constr);
                        if (chkJObCart >= 1)
                        {
                            DataSet dsJCN = new DataSet();
                            dsJCN = Outbound.CheckSelectedSOJobCardNo(Convert.ToInt64(HttpContext.Current.Session["SOID"].ToString()), "SalesOrder", profile.DBConnection._constr);
                            if (dsJCN != null && dsJCN.Tables[0].Rows.Count > 0)
                            {
                                string   grpSOID = dsJCN.Tables[0].Rows[0]["OrderNo"].ToString();
                                string[] TotOD   = grpSOID.Split(',');
                                int      ODCnt   = TotOD.Count();
                                for (int q = 0; q <= ODCnt - 1; q++)
                                {
                                    pkh.CreatedBy    = profile.Personal.UserID;
                                    pkh.CreationDate = DateTime.Now;
                                    pkh.ObjectName   = "SalesOrder";
                                    pkh.OID          = long.Parse(TotOD[q].ToString());
                                    pkh.PickUpDate   = DateTime.Now;
                                    pkh.Status       = 38;
                                    pkh.CompanyID    = profile.Personal.CompanyID;
                                    pkh.PickUpBy     = profile.Personal.UserID;

                                    PkUpID = Outbound.SavetPickUpHead(pkh, profile.DBConnection._constr);

                                    if (PkUpID > 0)
                                    {
                                        RSLT = Outbound.FinalSavePickUpDetail(long.Parse(TotOD[q].ToString()), Session.SessionID, ObjectName, PkUpID, profile.Personal.UserID.ToString(), Convert.ToInt16(pkh.Status), profile.DBConnection._constr);
                                        if (RSLT == 1)
                                        {
                                            this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "showAlert('Products Picked Up Successfully!','info','../WMS/PickUpList.aspx')", true);
                                        }
                                        else
                                        {
                                            this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "showAlert('Some Error Occured!','info','../WMS/PickUpList.aspx')", true);
                                        }
                                    }
                                }
                                Outbound.ClearTempDataFromDBPickUp(HttpContext.Current.Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, profile.DBConnection._constr);
                            }
                        }
                        else
                        {
                            pkh.CreatedBy    = profile.Personal.UserID;
                            pkh.CreationDate = DateTime.Now;
                            pkh.ObjectName   = "SalesOrder";
                            pkh.OID          = long.Parse(Session["SOID"].ToString());
                            pkh.PickUpDate   = DateTime.Now;
                            pkh.Status       = 38;
                            pkh.CompanyID    = profile.Personal.CompanyID;
                            pkh.PickUpBy     = profile.Personal.UserID;

                            PkUpID = Outbound.SavetPickUpHead(pkh, profile.DBConnection._constr);
                            if (PkUpID > 0)
                            {
                                RSLT = Outbound.FinalSavePickUpDetail(long.Parse(Session["SOID"].ToString()), Session.SessionID, ObjectName, PkUpID, profile.Personal.UserID.ToString(), Convert.ToInt16(pkh.Status), profile.DBConnection._constr);
                                if (RSLT == 1)
                                {
                                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "showAlert('Products Picked Up Successfully!','info','../WMS/PickUpList.aspx')", true);
                                }
                                else
                                {
                                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "showAlert('Some Error Occured!','info','../WMS/PickUpList.aspx')", true);
                                }
                            }
                            Outbound.ClearTempDataFromDBPickUp(HttpContext.Current.Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, profile.DBConnection._constr);
                        }
                    }
                    else if (Session["TRID"] != null)
                    {
                        int chkJObCart = Inbound.CheckJobCard(Convert.ToInt64(HttpContext.Current.Session["TRID"].ToString()), "Transfer", profile.DBConnection._constr);
                        if (chkJObCart >= 1)
                        {
                            DataSet dsJCN = new DataSet();
                            dsJCN = Outbound.CheckSelectedSOJobCardNo(Convert.ToInt64(HttpContext.Current.Session["TRID"].ToString()), "Transfer", profile.DBConnection._constr);
                            if (dsJCN != null && dsJCN.Tables[0].Rows.Count > 0)
                            {
                                string   grpSOID = dsJCN.Tables[0].Rows[0]["OrderNo"].ToString();
                                string[] TotOD   = grpSOID.Split(',');
                                int      ODCnt   = TotOD.Count();
                                for (int q = 0; q <= ODCnt - 1; q++)
                                {
                                    pkh.CreatedBy    = profile.Personal.UserID;
                                    pkh.CreationDate = DateTime.Now;
                                    pkh.ObjectName   = "Transfer";
                                    pkh.OID          = long.Parse(TotOD[q].ToString());
                                    pkh.PickUpDate   = DateTime.Now;
                                    pkh.Status       = 57;
                                    pkh.CompanyID    = profile.Personal.CompanyID;
                                    pkh.PickUpBy     = profile.Personal.UserID;

                                    PkUpID = Outbound.SavetPickUpHead(pkh, profile.DBConnection._constr);

                                    if (PkUpID > 0)
                                    {
                                        RSLT = Outbound.FinalSavePickUpDetail(long.Parse(TotOD[q].ToString()), Session.SessionID, ObjectName, PkUpID, profile.Personal.UserID.ToString(), Convert.ToInt16(pkh.Status), profile.DBConnection._constr);
                                        if (RSLT == 1)
                                        {
                                            this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "showAlert('Products Picked Up Successfully!','info','../WMS/Transfer.aspx')", true);
                                        }
                                        else
                                        {
                                            this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "showAlert('Some Error Occured!','info','../WMS/Transfer.aspx')", true);
                                        }
                                    }
                                }
                                Outbound.ClearTempDataFromDBPickUp(HttpContext.Current.Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, profile.DBConnection._constr);
                            }
                        }
                        else
                        {
                            pkh.CreatedBy    = profile.Personal.UserID;
                            pkh.CreationDate = DateTime.Now;
                            pkh.ObjectName   = "Transfer";
                            pkh.OID          = long.Parse(Session["TRID"].ToString());
                            pkh.PickUpDate   = DateTime.Now;
                            pkh.Status       = 57;
                            pkh.CompanyID    = profile.Personal.CompanyID;
                            pkh.PickUpBy     = profile.Personal.UserID;

                            PkUpID = Outbound.SavetPickUpHead(pkh, profile.DBConnection._constr);
                            if (PkUpID > 0)
                            {
                                RSLT = Outbound.FinalSavePickUpDetail(long.Parse(Session["TRID"].ToString()), Session.SessionID, ObjectName, PkUpID, profile.Personal.UserID.ToString(), Convert.ToInt16(pkh.Status), profile.DBConnection._constr);
                                if (RSLT == 1)
                                {
                                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "showAlert('Products Picked Up Successfully!','info','../WMS/Transfer.aspx')", true);
                                }
                                else
                                {
                                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "showAlert('Some Error Occured!','info','../WMS/Transfer.aspx')", true);
                                }
                            }
                            Outbound.ClearTempDataFromDBPickUp(HttpContext.Current.Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, profile.DBConnection._constr);
                        }
                    }
                }
                else
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "showAlert('One or More Product Dones Not Assigned The Location. Please Assign the Location For Product... ','erroe','#')", true);
                }
            }
            catch (Exception ex)
            {
                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "showAlert('" + ex.Message.ToString() + "','Error','#')", true);
            }
            finally
            {
                Outbound.Close();
            }
        }