示例#1
0
    protected void gvInfo_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string[] Arg     = Convert.ToString(e.CommandArgument).Split('_');
        string   DocID   = Arg[0];
        int      isExist = StorageInBrowseBLL.DocIdIsExistByDocId(DocID);

        //Exist
        if (isExist > 0)
        {
            if (e.CommandName == "Auditing")
            {
                int isAuditing = StorageInBrowseBLL.IsAuditingByDocId(DocID, 1);
                //Effective(In other words,Auditing)
                if (isAuditing > 0)
                {
                    Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("006888", "该入库单已经被审核!")));
                }
                //No Auditing
                else
                {
                    string   DocAuditer   = CommonDataBLL.GetNameByAdminID(Session["Company"].ToString());
                    DateTime DocAuditTime = MYDateTime1.GetCurrentDateTime();
                    string   OperateIP    = CommonDataBLL.OperateIP;
                    string   OperateNum   = CommonDataBLL.OperateBh;

                    //更新公司库存
                    string TempWareHouseID = Arg[1];
                    int    changwei        = Convert.ToInt32(Arg[2]);
                    int    auditingCout    = StorageInBrowseBLL.checkDoc(DocAuditer, DocAuditTime, OperateIP, OperateNum, DocID, TempWareHouseID, changwei);
                    if (auditingCout > 0)
                    {
                        Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>if(confirm('" + GetTran("002214", "入库单审核成功,是否要打印此入库单?") + "'))window.open('docPrint.aspx?DocID=" + DocID + "');</script>");
                    }

                    else
                    {
                        Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("002216", "入库单审核失败,请联系管理员!")));
                        return;
                    }
                }
            }
            else if (e.CommandName == "NoEffect")
            {
                int isEffect = StorageInBrowseBLL.IsAuditingByDocId(DocID, 0);
                //No effect
                if (isEffect <= 0)
                {
                    DateTime CloseDate     = MYDateTime1.GetCurrentDateTime();
                    string   OperateIP     = CommonDataBLL.OperateIP;
                    string   OperateNum    = CommonDataBLL.OperateBh;
                    int      noEffectCount = StorageInBrowseBLL.updDocTypeName(CloseDate, DocID, OperateIP, OperateNum);
                    if (noEffectCount > 0)
                    {
                        Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("002218", "此入库单审核无效成功!")));
                    }

                    else
                    {
                        Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("002221", "此入库单审核无效失败,请联系管理员!")));
                    }
                }

                else
                {
                    Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("006890", "该入库单已经被审核无效!")));
                }
            }
            else if (e.CommandName == "Del")
            {
                ChangeLogs cl = new ChangeLogs("InventoryDoc", "DocID");
                cl.AddRecord(DocID);
                ChangeLogs cl2 = new ChangeLogs("InventoryDocDetails", "DocID");
                cl2.AddRecord(DocID);
                int delCount = StorageInBrowseBLL.delDoc(DocID);
                if (delCount > 0)
                {
                    cl.AddRecord(DocID);
                    cl.DeletedIntoLogs(ChangeCategory.company8, Session["Company"].ToString(), ENUM_USERTYPE.objecttype0);
                    cl2.AddRecord(DocID);
                    cl2.DeletedIntoLogs(ChangeCategory.company8, Session["Company"].ToString(), ENUM_USERTYPE.objecttype0);

                    Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("002225", "入库单删除成功!")));
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("002228", "入库单编辑失败,请联系管理员!")));
                    return;
                }
            }
            else if (e.CommandName == "Edit")
            {
                Response.Redirect("StorageInEdit.aspx?billID=" + DocID);
            }
        }
        else
        {
            Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("006894", "该入库单不存在!")));
        }
        Btn_Search_Click(null, null);
    }
示例#2
0
    /// <summary>
    /// 确认
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSaveOrder_Click(object sender, EventArgs e)
    {
        if (Session["storageList"] == null || Session["storageList"].ToString() == "")
        {
            Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("001992", "对不起,您所填写的入库产品的数量不能全部是0!")));
            return;
        }
        else
        {
            if (ddlProvider.SelectedValue == "")
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("006009", "对不起,请选择供应商!")));
                return;
            }
            if (ddlDepotSeat.SelectedValue == "")
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("001934", "对不起,请选择库位!")));
                return;
            }

            if (txtpici.Text == "")
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("002027", "填写批次")));
                return;
            }

            ///通过批次通过入库批次获取入库批次行数
            var boolvalue = GetOrderInfo();
            if (!boolvalue)
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert("正确填入产品数量!"));
                return;
            }

            DateTime dt               = MYDateTime1.GetCurrentDateTime();
            string   BatchCode        = this.txtpici.Text.ToString();
            string   availableOrderID = ViewState["billId"].ToString();
            int      i = StorageInBLL.CheckBatch(availableOrderID, BatchCode);
            if (i > 0)
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("001995", "批次已存在!")));
                return;
            }
            string            makeman = CommonDataBLL.GetNameByAdminID(Session["Company"].ToString());
            int               n       = 0;
            InventoryDocModel idm     = new InventoryDocModel();
            idm.Provider        = Convert.ToInt32(ddlProvider.SelectedValue);
            idm.WareHouseID     = Convert.ToInt32(this.ddlWareHouse.SelectedValue);
            idm.DepotSeatID     = Convert.ToInt32(this.ddlDepotSeat.SelectedValue);
            idm.TotalMoney      = Convert.ToDouble(ViewState["zongPrice"]);
            idm.TotalPV         = Convert.ToDouble(ViewState["totalPV"]);
            idm.ExpectNum       = CommonDataBLL.getMaxqishu();
            idm.Note            = this.txtMemo.Text.ToString();
            idm.BatchCode       = this.txtpici.Text.ToString();
            idm.OperationPerson = this.txtOperationPerson.Text.ToString();
            idm.DocID           = ViewState["billId"].ToString();
            idm.Address         = this.txtAddress.Text.ToString();
            idm.OriginalDocID   = this.txtOriginalDocID.Text.ToString();
            idm.OperateIP       = CommonDataBLL.OperateIP;
            idm.OperateNum      = CommonDataBLL.OperateBh;
            ChangeLogs cl = new ChangeLogs("InventoryDoc", "DocID");
            cl.AddRecord(idm.DocID);
            n = StorageInBLL.updAndSaveOrder(idm, list);//(ArrayList)ViewState["list"]
            if (n > 0)
            {
                cl.AddRecord(idm.DocID);
                cl.ModifiedIntoLogs(ChangeCategory.company8, Session["Company"].ToString(), ENUM_USERTYPE.objecttype0);
                ScriptManager.RegisterStartupScript(this, GetType(), "abs", "alert('" + GetTran("004179", "入库单编辑完成,等待管理员审核!") + "');location.href='StorageInBrowse.aspx'", true);
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("004180", "入库单编辑失败,请准确填写!")));
            }
        }
    }
示例#3
0
    /// <summary>
    /// 确认
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSaveOrder_Click(object sender, EventArgs e)
    {
        if (Session["storageList"] == null || Session["storageList"].ToString() == "")
        {
            Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("001992", "对不起,您所填写的入库产品的数量不能全部是0!")));
            return;
        }
        else
        {
            if (ddlProvider.SelectedValue == "")
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("006009", "对不起,请选择供应商!")));
                return;
            }
            if (ddlDepotSeat.SelectedValue == "")
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("001934", "对不起,请选择库位!")));
                return;
            }
            DateTime dt = MYDateTime1.GetCurrentDateTime();
            ///获取新的订单号
            string availableOrderID = StorageInBLL.GetNewOrderID(EnumOrderFormType.InStorage);

            if (txtpici.Text == "")
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("002027", "填写批次")));
                return;
            }

            ///通过批次通过入库批次获取入库批次行数
            int getCount = StorageInBLL.GetCountByBatchCode(txtpici.Text.Trim());

            if (getCount > 0)
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("001995", "批次已存在!")));
                return;
            }
            var boolvalue = GetOrderInfo();
            if (!boolvalue)
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert("正确填入产品数量!"));
                return;
            }

            using (SqlConnection conn = new SqlConnection(DAL.DBHelper.connString))
            {
                conn.Open();
                SqlTransaction tran = conn.BeginTransaction();
                try
                {
                    string makeman   = StorageInBLL.GetManageNameByNumber(Session["Company"].ToString());
                    int    docTypeId = StorageInBLL.GetDocTypeIDByDocTypeName("RK");

                    if (ddlWareHouse.Enabled == false || ddlDepotSeat.Enabled == false)
                    {
                        Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("001999", "对不起,没有可选仓库或库位!")));
                        return;
                    }
                    else
                    {
                        /// <summary>
                        /// 实例化库存单据模型
                        /// </summary>
                        InventoryDocModel inventoryDocModel = new InventoryDocModel
                                                              (
                            docTypeId, availableOrderID, dt, makeman, Convert.ToInt32(ddlProvider.SelectedValue), "", Convert.ToInt32(ddlWareHouse.SelectedValue),
                            Convert.ToInt32(ddlDepotSeat.SelectedValue),
                            Convert.ToDouble(ViewState["zongPrice"]), Convert.ToDouble(ViewState["totalPV"]), "",
                            CommonDataBLL.getMaxqishu(), "RK", txtMemo.Text.Trim(), 0, txtpici.Text.Trim(), txtOperationPerson.Text.Trim()
                                                              );
                        inventoryDocModel.OriginalDocID = this.txtOriginalDocID.Text.Trim();
                        inventoryDocModel.Address       = this.txtAddress.Text.Trim();
                        //inventoryDocModel.Currency = StorageInBLL.GetMoreStandardMoneyIDByCountryCode(ddlCountry.SelectedValue);
                        //inventoryDocModel.PayCurrency = StorageInBLL.GetMoreCurrencyIDByCountryCode(ddlCountry.SelectedValue);

                        //inventoryDocModel.PayMoney = Convert.ToDecimal(ViewState["zongPrice"]) * StorageInBLL.GetRate_TimesForStandardMoneyByCountryCode(ddlCountry.SelectedValue);
                        inventoryDocModel.OperateIP  = CommonDataBLL.OperateIP;
                        inventoryDocModel.OperateNum = CommonDataBLL.OperateBh;

                        ///生成一个单据入库
                        StorageInBLL.CreateInventoryDoc_WH(tran, inventoryDocModel);

                        foreach (InventoryDocDetailsModel InventoryDocDetails in list)//(ArrayList)ViewState["list"]
                        {
                            InventoryDocDetails.DocID = availableOrderID;
                        }
                        ///向单据明细表中插入相关记录
                        StorageInBLL.CreateBillofDocumentDetails(tran, list);

                        tran.Commit();
                    }
                }
                catch
                {
                    tran.Rollback();
                    Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("002010", "入库单申请失败,请联系管理员!")));
                    return;
                }
                finally
                {
                    conn.Close();
                }
            }
            ScriptManager.RegisterStartupScript(this, GetType(), "abs", "alert('" + GetTran("002015", "入库单申请完成,等待管理员审核!") + "');location.href='StorageInBrowse.aspx'", true);
        }
    }
示例#4
0
    protected void gvInfo_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string DocID   = Convert.ToString(e.CommandArgument);
        int    isExist = StorageInBrowseBLL.DocIdIsExistByDocId(DocID);

        //Exist
        if (isExist > 0)
        {
            if (e.CommandName == "Auditing")
            {
                int isAuditing = StorageInBrowseBLL.IsAuditingByDocId(DocID, 1);
                //Effective(In other words,Auditing)
                if (isAuditing > 0)
                {
                    Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("006888", "该入库单已经被审核!")));
                }

                //No Auditing
                else
                {
                    string   DocAuditer   = CommonDataBLL.GetNameByAdminID(Session["Company"].ToString());
                    DateTime DocAuditTime = MYDateTime1.GetCurrentDateTime();
                    string   OperateIP    = CommonDataBLL.OperateIP;
                    string   OperateNum   = CommonDataBLL.OperateBh;

                    //更新公司库存
                    GridViewRow row             = (GridViewRow)((LinkButton)e.CommandSource).NamingContainer;
                    string      TempWareHouseID = ((HtmlInputHidden)row.FindControl("hidwarehouseId")).Value;
                    string      aaa             = ((HtmlInputHidden)row.FindControl("changwei")).Value;
                    int         changwei        = Convert.ToInt32(aaa);
                    int         auditingCout    = StorageInBrowseBLL.checkDoc(DocAuditer, DocAuditTime, OperateIP, OperateNum, DocID, TempWareHouseID, changwei);
                    if (auditingCout > 0)
                    {
                        Page.ClientScript.RegisterStartupScript(GetType(), "", "<script>if(confirm('" + GetTran("002214", "入库单审核成功,是否要打印此入库单?") + "'))window.open('docPrint.aspx?DocID=" + DocID + "');</script>");
                    }

                    else
                    {
                        Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("002216", "入库单审核失败,请联系管理员!")));
                        return;
                    }
                }
            }

            else if (e.CommandName == "NoEffect")
            {
                int isEffect = StorageInBrowseBLL.IsAuditingByDocId(DocID, 0);
                //No effect
                if (isEffect <= 0)
                {
                    DateTime CloseDate     = MYDateTime1.GetCurrentDateTime();
                    string   OperateIP     = CommonDataBLL.OperateIP;
                    string   OperateNum    = CommonDataBLL.OperateBh;
                    int      noEffectCount = StorageInBrowseBLL.updDocTypeName(CloseDate, DocID, OperateIP, OperateNum);
                    if (noEffectCount > 0)
                    {
                        Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("002218", "此入库单审核无效成功!")));
                    }

                    else
                    {
                        Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("002221", "此入库单审核无效失败,请联系管理员!")));
                    }
                }

                else
                {
                    Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("006890", "该入库单已经被审核无效!")));
                }
            }

            else if (e.CommandName == "Del")
            {
                int delCount = StorageInBrowseBLL.delDoc(DocID);
                if (delCount > 0)
                {
                    Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("002225", "入库单删除成功!")));
                }

                else
                {
                    Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("002228", "入库单编辑失败,请联系管理员!")));
                    return;
                }
            }

            else if (e.CommandName == "Edit")
            {
                Response.Redirect("StorageInEdit.aspx?billID=" + DocID);
            }
        }

        else
        {
            Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("006894", "该入库单不存在!")));
        }
        Response.Redirect("StorageInBrowse.aspx");
    }