Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    string cargoCode     = Request.QueryString["cargoCode"].ToString().Trim();
                    string cargoName     = Request.QueryString["cargoName"].ToString().Trim();
                    string modelName     = Request.QueryString["modelName"].ToString().Trim();
                    string specName      = Request.QueryString["specName"].ToString().Trim();
                    string saleStatusStr = Request.QueryString["saleStatusStr"].ToString().Trim();
                    int    saleStatus    = -1;
                    if (!string.IsNullOrEmpty(saleStatusStr))
                    {
                        if (int.TryParse(saleStatusStr, out saleStatus) == false)
                        {
                            saleStatus = -1;
                        }
                    }

                    using (DAL.GoldEntities context = new DAL.GoldEntities())
                    {
                        List <DAL.proc_WebSelectEachDeptSaleAllocation_Result> resultList = context.proc_WebSelectEachDeptSaleAllocation().ToList <DAL.proc_WebSelectEachDeptSaleAllocation_Result>();


                        var queryResult = (from r in resultList
                                           where r.CargoCode.Contains(cargoCode) &&
                                           r.CargoName.Contains(cargoName) &&
                                           r.CargoModel.Contains(modelName) &&
                                           r.CargoSpec.Contains(specName) &&
                                           (saleStatus >= 0 ? r.SaleStatus == saleStatus : 1 == 1)
                                           select r).ToList();

                        Microsoft.Reporting.WebForms.ReportDataSource rds = new Microsoft.Reporting.WebForms.ReportDataSource("DataSet1", queryResult);
                        ReportViewer1.LocalReport.DataSources.Clear();
                        ReportViewer1.LocalReport.DataSources.Add(rds);

                        Microsoft.Reporting.WebForms.ReportParameter ReportParameter_CargoCode  = new Microsoft.Reporting.WebForms.ReportParameter("ReportParameter_CargoCode", cargoCode);
                        Microsoft.Reporting.WebForms.ReportParameter ReportParameter_CargoName  = new Microsoft.Reporting.WebForms.ReportParameter("ReportParameter_CargoName", cargoName);
                        Microsoft.Reporting.WebForms.ReportParameter ReportParameter_CargoModel = new Microsoft.Reporting.WebForms.ReportParameter("ReportParameter_CargoModel", modelName);
                        Microsoft.Reporting.WebForms.ReportParameter ReportParameter_CargoSpec  = new Microsoft.Reporting.WebForms.ReportParameter("ReportParameter_CargoSpec", specName);
                        Microsoft.Reporting.WebForms.ReportParameter ReportParameter_SaleStatus = new Microsoft.Reporting.WebForms.ReportParameter("ReportParameter_SaleStatus", saleStatus >= 0 ? (saleStatus > 0?"可售":"不可售"): "");

                        Microsoft.Reporting.WebForms.ReportParameterCollection rpList = new Microsoft.Reporting.WebForms.ReportParameterCollection();
                        rpList.Add(ReportParameter_CargoCode);
                        rpList.Add(ReportParameter_CargoName);
                        rpList.Add(ReportParameter_CargoModel);
                        rpList.Add(ReportParameter_CargoSpec);
                        rpList.Add(ReportParameter_SaleStatus);

                        ReportViewer1.LocalReport.SetParameters(rpList);
                        ReportViewer1.DataBind();
                    }
                }
            }
            catch (Exception ex)
            {
                lblGridViewMsg.Text = Utility.LogHelper.GetExceptionMsg(ex);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 新增按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnAddNew_Click(object sender, EventArgs e)
        {
            if (Page.IsValid == false)
            {
                return;
            }

            //lblAddMsg.Text = "";
            ClearTipMsgLabel();//清除提示信息
            try
            {
                PackageStatistic newModel = null;
                string           msg      = "";
                if (GetNewModel(out newModel, out msg) == false)
                {
                    lblAddMsg.Text = msg;
                    DAL.CommonConvert.ShowMessageBox(this.Page, msg);
                    return;
                }
                using (DAL.GoldEntities context = new DAL.GoldEntities())
                {
                    context.PackageStatistic.AddObject(newModel);
                    context.SaveChanges();
                    lblAddMsg.Text = "保存成功";
                    DAL.CommonConvert.ShowMessageBox(this.Page, "保存成功!");

                    gv_BinList.DataBind();
                }
            }
            catch (Exception ex)
            {
                DAL.CommonConvert.ShowMessageBox(this.Page, "保存失败!");
                lblAddMsg.Text = "保存失败!详细信息:" + Utility.LogHelper.GetExceptionMsg(ex);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 新增按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnAddNew_Click(object sender, EventArgs e)
        {
            if (Page.IsValid == false)
            {
                return;
            }

            //lblAddMsg.Text = "";
            ClearTipMsgLabel();//清除提示信息
            try
            {
                StorageBin newModel = null;
                string     msg      = "";
                if (GetNewModel(out newModel, out msg) == false)
                {
                    lblAddMsg.Text = msg;
                    return;
                }
                using (DAL.GoldEntities context = new DAL.GoldEntities())
                {
                    context.StorageBin.AddObject(newModel);
                    context.SaveChanges();
                    lblAddMsg.Text = "保存成功";

                    gv_BinList.DataBind();
                }
            }
            catch (Exception ex)
            {
                lblAddMsg.Text = "保存失败!详细信息:" + Utility.LogHelper.GetExceptionMsg(ex);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 调用用友WebService并将返回的Xml字符串解析为DataTable,并为解析后的DataTable增加两列
        /// </summary>
        /// <param name="dt"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public override bool GetNCDataDetailJoinRFID(out List <SalesOrderDetail> lstSalesOrderDetail, out string msg, string billCode)
        {
            DataTable dt = null;

            lstSalesOrderDetail = null;
            msg = "";
            try
            {
                if (GetNCDataDetail(out dt, out msg, billCode) == false)
                {
                    return(false);
                }

                if (dt != null)
                {
                    dt.Columns.Add("IsExistInRFID", typeof(int));        //代码表示是否RFID系统已存在此数据
                    dt.Columns.Add("IsExistInRFIDName", typeof(string)); //名称表示是否RFID系统已存在此数据

                    if (dt.Columns.Contains("NCOrderCode"))
                    {
                        using (Gold.DAL.GoldEntities context = new DAL.GoldEntities())
                        {
                            List <string> list = context.SalesOrderDetail.Where(r => r.NCOrderCode == billCode).Select(r => r.DetailRowNumber).ToList <string>();
                            foreach (DataRow dr in dt.Rows)
                            {
                                string detailRowNumber = dr["DetailRowNumber"].ToString();
                                if (list.Contains(detailRowNumber))
                                {
                                    dr["IsExistInRFID"]     = "1";
                                    dr["IsExistInRFIDName"] = "已存在";
                                }
                                else
                                {
                                    dr["IsExistInRFID"]     = "0";
                                    dr["IsExistInRFIDName"] = "未存在";
                                }
                            }
                        }
                    }
                }

                lstSalesOrderDetail = GetModelDetailFromDataTable(dt, out msg);
                if (lstSalesOrderDetail.Count == 0)
                {
                    //msg = "获取用友系统数据失败!详细信息:" + msg;
                    return(false);
                }

                return(true);
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(LogHelper.LogLevel.Error, "调用GetNCDataJoinRFID失败", ex);
                msg = "调用GetNCDataJoinRFID失败" + ex.Message;
                return(false);
            }
            //return base.GetNCDataJoinRFID(out dt, out msg);
        }
Ejemplo n.º 5
0
        void GridViewBind()
        {
            try
            {
                lblGridViewMsg.Text = "";

                string cargoCode     = tbxCargoCode.Text.Trim();
                string cargoName     = tbxCargoName.Text.Trim();
                string modelName     = DropDownList_CargoModel.SelectedItem.Text.Trim();
                string specName      = DropDownList_CargoSpec.SelectedItem.Text.Trim();
                string saleStatusStr = DropDownList_SaleStatus.SelectedItem.Value.Trim();
                int    saleStatus    = -1;
                if (!string.IsNullOrEmpty(saleStatusStr))
                {
                    if (int.TryParse(saleStatusStr, out saleStatus) == false)
                    {
                        saleStatus = -1;
                    }
                }

                using (DAL.GoldEntities context = new DAL.GoldEntities())
                {
                    var queryResult = (from r in context.Cargos
                                       where r.CargoCode.Contains(cargoCode) &&
                                       r.CargoName.Contains(cargoName) &&
                                       r.CargoModel.Contains(modelName) &&
                                       r.CargoSpec.Contains(specName) &&
                                       (saleStatus >= 0 ? r.SaleStatus == saleStatus : 1 == 1)
                                       select r).ToList();

                    string        sortExpression = gv_CargoList.Attributes["sortExpression"];
                    SortDirection sortDirection  = gv_CargoList.Attributes["sortDirection"] == "ASC" ? SortDirection.Ascending : SortDirection.Descending;

                    if (sortDirection == SortDirection.Ascending)
                    {
                        queryResult = queryResult.OrderBy(r => r.GetType().GetProperty(sortExpression).GetValue(r, null)).ToList();
                    }
                    else
                    {
                        queryResult = queryResult.OrderByDescending(r => r.GetType().GetProperty(sortExpression).GetValue(r, null)).ToList();
                    }

                    gv_CargoList.PageSize   = WebConfigHelper.Instance.GetDefaultPageSize();
                    gv_CargoList.DataSource = queryResult;
                    gv_CargoList.DataBind();
                }
            }
            catch (Exception ex)
            {
                lblGridViewMsg.Text = "查询出现异常!" + Utility.LogHelper.GetExceptionMsg(ex);
            }
            finally
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Guid.NewGuid().ToString(), "hiddenWaitDiv('divWait');", true);//js提示
            }
        }
Ejemplo n.º 6
0
        void GridViewBind()
        {
            try
            {
                lblGridViewMsg.Text = "";

                string cargoCode = tbxCargoCode.Text.Trim();
                string cargoName = tbxCargoName.Text.Trim();
                //string modelName = DropDownList_CargoModel.SelectedItem.Text.Trim();
                //string specName = DropDownList_CargoSpec.SelectedItem.Text.Trim();
                string   whCode         = DropDownList_WHCode.SelectedItem.Value.ToString();
                string   packageShareNo = tbxPackageShareNo.Text.Trim();
                string   isprofitOrLost = DropDownList_IsProfitOrLoss.SelectedItem.Value.ToString();;
                string   storePickType  = DropDownList_StorePickType.SelectedItem.Value.ToString();
                string   packageName    = DropDownList_PackageName.SelectedItem.Text.Trim();
                DateTime startDate      = DateTime.Parse(txtStartTime.Text);
                DateTime endDate        = DateTime.Parse(txtEndTime.Text);
                DateTime startTime      = new DateTime(startDate.Year, startDate.Month, startDate.Day, 0, 0, 0);
                DateTime endTime        = new DateTime(endDate.Year, endDate.Month, endDate.Day, 23, 59, 59, 999);

                using (DAL.GoldEntities context = new DAL.GoldEntities())
                {
                    List <proc_WebSelectStorePickAccount_Result> queryResult = context.proc_WebSelectStorePickAccount(whCode, cargoCode, cargoName, storePickType, isprofitOrLost, packageName, packageShareNo, startTime.ToString(), endTime.ToString()).ToList <proc_WebSelectStorePickAccount_Result>();

                    string        sortExpression = gv_CargoList.Attributes["sortExpression"];
                    SortDirection sortDirection  = gv_CargoList.Attributes["sortDirection"] == "ASC" ? SortDirection.Ascending : SortDirection.Descending;

                    if (sortDirection == SortDirection.Ascending)
                    {
                        queryResult = queryResult.OrderBy(r => r.GetType().GetProperty(sortExpression).GetValue(r, null)).ToList();
                    }
                    else
                    {
                        queryResult = queryResult.OrderByDescending(r => r.GetType().GetProperty(sortExpression).GetValue(r, null)).ToList();
                    }

                    gv_CargoList.PageSize   = WebConfigHelper.Instance.GetDefaultPageSize();
                    gv_CargoList.DataSource = queryResult;
                    gv_CargoList.DataBind();
                }
            }
            catch (Exception ex)
            {
                lblGridViewMsg.Text = "查询出现异常!" + Utility.LogHelper.GetExceptionMsg(ex);
            }
            finally
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Guid.NewGuid().ToString(), "hiddenWaitDiv('divWait');", true);//js提示
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 更新时检测是否重名
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gv_PackageList_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            string newPackageName = e.NewValues["PackageName"].ToString().Trim();
            string oldPackageName = e.OldValues["PackageName"].ToString().Trim();

            using (DAL.GoldEntities context = new DAL.GoldEntities())
            {
                var selectResult = (from r in context.Packages where (r.PackageName != oldPackageName && r.PackageName == newPackageName) select r).ToList();
                if (selectResult != null && selectResult.Count > 0)
                {
                    lblGridViewMsg.Text = "更新失败,系统中已经存在名为[" + newPackageName + "]的型号信息,请重新填写!";
                    e.Cancel            = true;
                }
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 调用用友WebService并将返回的Xml字符串解析为DataTable,并为解析后的DataTable增加两列
        /// </summary>
        /// <param name="dt"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public override bool GetNCDataJoinRFID(out DataTable dt, out string msg)
        {
            dt  = null;
            msg = "";
            try
            {
                if (GetNCData(out dt, out msg) == false)
                {
                    return(false);
                }

                if (dt != null)
                {
                    dt.Columns.Add("IsExistInRFID", typeof(int));        //代码表示是否RFID系统已存在此数据
                    dt.Columns.Add("IsExistInRFIDName", typeof(string)); //名称表示是否RFID系统已存在此数据

                    if (dt.Columns.Contains("CargoCode"))
                    {
                        using (Gold.DAL.GoldEntities context = new DAL.GoldEntities())
                        {
                            List <string> list = context.Cargos.Select(r => r.CargoCode).ToList <string>();
                            foreach (DataRow dr in dt.Rows)
                            {
                                string whcode = dr["CargoCode"].ToString();
                                if (list.Contains(whcode))
                                {
                                    dr["IsExistInRFID"]     = "1";
                                    dr["IsExistInRFIDName"] = "已存在";
                                }
                                else
                                {
                                    dr["IsExistInRFID"]     = "0";
                                    dr["IsExistInRFIDName"] = "未存在";
                                }
                            }
                        }
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(LogHelper.LogLevel.Error, "调用GetNCDataJoinRFID失败", ex);
                return(false);
            }
            //return base.GetNCDataJoinRFID(out dt, out msg);
        }
Ejemplo n.º 9
0
        void GridViewBind()
        {
            try
            {
                //lblGridViewMsg.Text = "";

                string cargoCode = tbxCargoCode.Text.Trim();
                string cargoName = tbxCargoName.Text.Trim();
                string modelName = DropDownList_CargoModel.SelectedItem.Text.Trim();
                string specName  = DropDownList_CargoSpec.SelectedItem.Text.Trim();
                string whCode    = DropDownList_WHCode.SelectedItem.Value.Trim();
                whCode = whCode == null ? "" : whCode;
                string isLower = DropDownList_IsUnderSafe.SelectedItem.Value.Trim();

                using (DAL.GoldEntities context = new DAL.GoldEntities())
                {
                    List <DAL.proc_WebSelectCargoSafeRemind_Result> queryResult = context.proc_WebSelectCargoSafeRemind(whCode, cargoCode, cargoName, modelName, specName, "", isLower).ToList <DAL.proc_WebSelectCargoSafeRemind_Result>();



                    string        sortExpression = gv_SaleAllocationList.Attributes["sortExpression"];
                    SortDirection sortDirection  = gv_SaleAllocationList.Attributes["sortDirection"] == "ASC" ? SortDirection.Ascending : SortDirection.Descending;

                    if (sortDirection == SortDirection.Ascending)
                    {
                        queryResult = queryResult.OrderBy(r => r.GetType().GetProperty(sortExpression).GetValue(r, null)).ToList();
                    }
                    else
                    {
                        queryResult = queryResult.OrderByDescending(r => r.GetType().GetProperty(sortExpression).GetValue(r, null)).ToList();
                    }


                    gv_SaleAllocationList.PageSize   = WebConfigHelper.Instance.GetDefaultPageSize();
                    gv_SaleAllocationList.DataSource = queryResult;
                    gv_SaleAllocationList.DataBind();
                }
            }
            catch (Exception ex)
            {
                lblGridViewMsg.Text = "查询出现异常!" + Utility.LogHelper.GetExceptionMsg(ex);
            }
            finally
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Guid.NewGuid().ToString(), "hiddenWaitDiv('divWait');", true);//js提示
            }
        }
Ejemplo n.º 10
0
        void GridViewBind()
        {
            try
            {
                lblGridViewMsg.Text = "";

                string cargoCode = txtCode.Text.Trim();
                string cargoName = txtName.Text.Trim();

                using (DAL.GoldEntities context = new DAL.GoldEntities())
                {
                    var queryResult = (from r in context.Cargos
                                       where r.CargoCode.Contains(cargoCode) && r.CargoName.Contains(cargoName)
                                       select r).ToList();

                    string        sortExpression = gvGoods.Attributes["sortExpression"];
                    SortDirection sortDirection  = gvGoods.Attributes["sortDirection"] == "ASC" ? SortDirection.Ascending : SortDirection.Descending;

                    if (sortDirection == SortDirection.Ascending)
                    {
                        queryResult = queryResult.OrderBy(r => r.GetType().GetProperty(sortExpression).GetValue(r, null)).ToList();
                    }
                    else
                    {
                        queryResult = queryResult.OrderByDescending(r => r.GetType().GetProperty(sortExpression).GetValue(r, null)).ToList();
                    }

                    //gvGoods.PageSize = Utility.WebConfigHelper.Instance.GetDefaultPageSize();
                    gvGoods.DataSource = queryResult;
                    gvGoods.DataBind();
                }
            }
            catch (Exception ex)
            {
                lblGridViewMsg.Text = "查询出现异常!" + Utility.LogHelper.GetExceptionMsg(ex);
            }
            finally
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Guid.NewGuid().ToString(), "hiddenWaitDiv('divWaitUCCargo');", true);//js提示
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 新增按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnAddNew_Click(object sender, EventArgs e)
        {
            if (Page.IsValid == false)
            {
                return;
            }

            lblAddMsg.Text = "";
            try
            {
                string newName    = tbxNewModelName.Text.Trim();
                string newComment = tbxNewComment.Text.Trim();
                using (DAL.GoldEntities context = new DAL.GoldEntities())
                {
                    var sameResult = (from r in context.Models where r.ModelName.Equals(newName) select r).FirstOrDefault();
                    if (sameResult != null)
                    {
                        //lblAddMsg.Text = "系统中已存在名为【" + newName + "】的型号信息!请重填!";
                        ShowMessageBox("系统中已存在名为【" + newName + "】的型号信息!请重填!");
                        return;
                    }

                    DAL.Models newModelObj = new DAL.Models();
                    newModelObj.ModelName = newName;
                    newModelObj.Comment   = newComment;
                    context.Models.AddObject(newModelObj);
                    context.SaveChanges();
                    //lblAddMsg.Text = "保存成功";
                    ShowMessageBox("保存成功!");

                    gv_ModelList.DataBind();
                }
            }
            catch (Exception ex)
            {
                //lblAddMsg.Text = "保存失败!详细信息:" + Utility.LogHelper.GetExceptionMsg(ex);
                ShowMessageBox("保存失败", ex);
            }
        }
Ejemplo n.º 12
0
        void GridViewBind()
        {
            try
            {
                string whCode = tbxWHCode.Text.Trim();
                string whName = tbxWHName.Text.Trim();

                using (DAL.GoldEntities context = new DAL.GoldEntities())
                {
                    var queryResult = (from r in context.WareHouse
                                       where r.WHCode.Contains(whCode) && r.WHName.Contains(whName)
                                       select r).ToList();

                    string        sortExpression = gv_WareHouseList.Attributes["sortExpression"];
                    SortDirection sortDirection  = gv_WareHouseList.Attributes["sortDirection"] == "ASC" ? SortDirection.Ascending : SortDirection.Descending;

                    if (sortDirection == SortDirection.Ascending)
                    {
                        queryResult = queryResult.OrderBy(r => r.GetType().GetProperty(sortExpression).GetValue(r, null)).ToList();
                    }
                    else
                    {
                        queryResult = queryResult.OrderByDescending(r => r.GetType().GetProperty(sortExpression).GetValue(r, null)).ToList();
                    }

                    gv_WareHouseList.PageSize   = Utility.WebConfigHelper.Instance.GetDefaultPageSize();
                    gv_WareHouseList.DataSource = queryResult;
                    gv_WareHouseList.DataBind();
                }
            }
            catch (Exception ex)
            {
                //lblGridViewMsg.Text = "查询出现异常!" + Utility.LogHelper.GetExceptionMsg(ex);
                ShowMessageBox("查询出现异常!", ex);
            }
        }
Ejemplo n.º 13
0
        void GridViewBind()
        {
            try
            {
                string cargoCode     = tbxCargoCode.Text.Trim();
                string cargoName     = tbxCargoName.Text.Trim();
                string modelName     = DropDownList_CargoModel.SelectedItem.Text.Trim();
                string specName      = DropDownList_CargoSpec.SelectedItem.Text.Trim();
                string whCode        = DropDownList_WHCode.SelectedItem.Value.ToString();
                string strStoreEqual = DropDownList_StoreEqual.SelectedItem.Value.ToString();
                string strNCEqual    = DropDownList_NCEqual.SelectedItem.Value.ToString();
                int    QueryMode     = -1;
                if (RadioButton_ByPrecise.Checked)
                {
                    QueryMode = 0;//精确查询
                }
                if (RadioButton_ByLike.Checked)
                {
                    QueryMode = 1;//模糊查询
                }
                string binCode = tbxBinCode.Text.Trim();

                using (DAL.GoldEntities context = new DAL.GoldEntities())
                {
                    List <proc_WebSelectCargoStorageDetail_Result> queryResult = context.proc_WebSelectCargoStorageDetail(whCode, cargoCode, cargoName, modelName, specName, "", QueryMode, binCode).ToList <proc_WebSelectCargoStorageDetail_Result>();

                    //对查询结果附件用友库存信息
                    if (chkQueryNC.Checked)
                    {
                        AppendNCData(ref queryResult);
                    }

                    //根据条件筛选仓库和区位存量是否一致
                    if (strStoreEqual != "")
                    {
                        if (strStoreEqual == "1") //一致
                        {
                            queryResult = (from r in queryResult where (r.Number != null) && (r.CargoStockCount == (double)r.Number) select r).ToList <proc_WebSelectCargoStorageDetail_Result>();
                        }
                        else if (strStoreEqual == "0") //不一致
                        {
                            queryResult = (from r in queryResult where (r.CargoStockCount != (double)(r.Number == null ? 0 : r.Number.Value)) select r).ToList <proc_WebSelectCargoStorageDetail_Result>();
                        }
                    }

                    //根据条件筛选用友与RFID仓库存量是否一致
                    if (strNCEqual != "")
                    {
                        if (strNCEqual == "1") //一致
                        {
                            queryResult = (from r in queryResult where (r.CargoStockCount == (double)r.NCCargoStockCount) select r).ToList <proc_WebSelectCargoStorageDetail_Result>();
                        }
                        else if (strNCEqual == "0") //不一致
                        {
                            queryResult = (from r in queryResult where (r.CargoStockCount != (double)r.NCCargoStockCount) select r).ToList <proc_WebSelectCargoStorageDetail_Result>();
                        }
                    }

                    string        sortExpression = gv_CargoList.Attributes["sortExpression"];
                    SortDirection sortDirection  = gv_CargoList.Attributes["sortDirection"] == "ASC" ? SortDirection.Ascending : SortDirection.Descending;

                    if (sortDirection == SortDirection.Ascending)
                    {
                        queryResult = queryResult.OrderBy(r => r.GetType().GetProperty(sortExpression).GetValue(r, null)).ToList();
                    }
                    else
                    {
                        queryResult = queryResult.OrderByDescending(r => r.GetType().GetProperty(sortExpression).GetValue(r, null)).ToList();
                    }

                    #region 记录本次查询的层位标签ID供亮灯和关灯使用
                    List <string> BinTagIDList = new List <string>();
                    foreach (proc_WebSelectCargoStorageDetail_Result p in queryResult)
                    {
                        if (string.IsNullOrEmpty(p.BinTagID) == false)
                        {
                            if (BinTagIDList.Contains(p.BinTagID) == false)
                            {
                                BinTagIDList.Add(p.BinTagID);
                            }
                        }
                    }
                    ViewState["BinTagIDList"] = BinTagIDList;
                    #endregion

                    gv_CargoList.PageSize   = WebConfigHelper.Instance.GetDefaultPageSize();
                    gv_CargoList.DataSource = queryResult;
                    gv_CargoList.DataBind();
                }
            }
            catch (Exception ex)
            {
                lblGridViewMsg.Text = "查询出现异常!" + Utility.LogHelper.GetExceptionMsg(ex);
            }
            finally
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Guid.NewGuid().ToString(), "hiddenWaitDiv('divWait');", true);//js提示
            }
        }
Ejemplo n.º 14
0
        void LoadByCargo(string whCode, string whName, string cargoCode, string cargoName, string cargoModel, string cargoSpec, string cargoUnits, int queryMode, string binCode, string sortExpression, string sortDirectionStr)
        {
            using (DAL.GoldEntities context = new DAL.GoldEntities())
            {
                ReportViewer1.LocalReport.ReportPath = @"Reports\Report_CargoStorageDetailList.rdlc";

                List <proc_WebSelectCargoStorageDetail_Result> queryResult = context.proc_WebSelectCargoStorageDetail(whCode,
                                                                                                                      cargoCode, cargoName, cargoModel, cargoSpec, cargoUnits, queryMode, binCode).ToList <proc_WebSelectCargoStorageDetail_Result>();

                //string sortExpression = gv_CargoList.Attributes["sortExpression"];
                SortDirection sortDirection = sortExpression == "ASC" ? SortDirection.Ascending : SortDirection.Descending;

                if (sortDirection == SortDirection.Ascending)
                {
                    queryResult = queryResult.OrderBy(r => r.GetType().GetProperty(sortExpression).GetValue(r, null)).ToList();
                }
                else
                {
                    queryResult = queryResult.OrderByDescending(r => r.GetType().GetProperty(sortExpression).GetValue(r, null)).ToList();
                }



                ReportDataSource rds = new ReportDataSource("DataSet_CargoStorageDetail", queryResult);
                ReportViewer1.LocalReport.DataSources.Clear();
                ReportViewer1.LocalReport.DataSources.Add(rds);

                /*
                 * RP_CargoCode
                 * RP_CargoName
                 * RP_CargoModel
                 * RP_CargoSpec
                 * RP_CargoUnits
                 * RP_DisplayPattern
                 * RP_WHName
                 * RP_StartDate
                 * RP_EndDate
                 * RP_TotalSumNumCurrent
                 * RP_TotalFirstOriginalNum
                 * RP_TotalSumNumAdd
                 * RP_TotalSumDel
                 */
                ReportParameter RP_CargoCode  = new ReportParameter("RP_CargoCode", cargoCode.Replace("'", ""));
                ReportParameter RP_CargoName  = new ReportParameter("RP_CargoName", cargoName);
                ReportParameter RP_CargoModel = new ReportParameter("RP_CargoModel", cargoModel);
                ReportParameter RP_CargoSpec  = new ReportParameter("RP_CargoSpec", cargoSpec);
                ReportParameter RP_CargoUnits = new ReportParameter("RP_CargoUnits", "");
                ReportParameter RP_WHName     = new ReportParameter("RP_WHName", whName);


                ReportParameterCollection rpList = new ReportParameterCollection();
                rpList.Add(RP_CargoCode);
                rpList.Add(RP_CargoName);
                rpList.Add(RP_CargoModel);
                rpList.Add(RP_CargoSpec);
                rpList.Add(RP_CargoUnits);
                rpList.Add(RP_WHName);
                //rpList.Add(RP_WHCode);

                ReportViewer1.LocalReport.SetParameters(rpList);
                ReportViewer1.DataBind();
            }
        }
Ejemplo n.º 15
0
        void GridViewBind()
        {
            try
            {
                lblGridViewMsg.Text = "";
                string cargoCode = tbxCargoCode.Text.Trim();
                string cargoName = tbxCargoName.Text.Trim();
                string modelName = DropDownList_CargoModel.SelectedItem.Text.Trim();
                string specName  = DropDownList_CargoSpec.SelectedItem.Text.Trim();
                //string whCode = DropDownList_WareHouse.SelectedItem.Value;
                string storageBinCode   = tbxCargoTagBinCode.Text.Trim();//DropDownList_StorageBin.SelectedItem.Value;
                string storageBinStatus = DropDownList_StorageState.SelectedItem.Value;


                //&& r.StorageBin.WareHouse.Contains(whCode)
                using (DAL.GoldEntities context = new DAL.GoldEntities())
                {
                    var firstResult = (from r in context.CargoTag select r);
                    if (string.IsNullOrEmpty(storageBinCode) == false)
                    {
                        firstResult = (from r in firstResult where r.BinCode.Contains(storageBinCode) select r);
                    }

                    if (storageBinStatus == "")
                    {
                        if (string.IsNullOrEmpty(cargoCode) == false)
                        {
                            firstResult = (from r in firstResult where r.CargoCode.Contains(cargoCode) select r);
                        }
                        if (string.IsNullOrEmpty(cargoName) == false)
                        {
                            firstResult = (from r in firstResult where r.Cargos.CargoName.Contains(cargoName) select r);
                        }
                        if (string.IsNullOrEmpty(modelName) == false)
                        {
                            firstResult = (from r in firstResult where r.Cargos.CargoModel.Contains(modelName) select r);
                        }
                        if (string.IsNullOrEmpty(specName) == false)
                        {
                            firstResult = (from r in firstResult where r.Cargos.CargoSpec.Contains(specName) select r);
                        }
                    }
                    else if (storageBinStatus == "1")
                    {
                        firstResult = from r in firstResult where r.CargoCode != null select r;

                        if (string.IsNullOrEmpty(cargoCode) == false)
                        {
                            firstResult = (from r in firstResult where r.CargoCode.Contains(cargoCode) select r);
                        }
                        if (string.IsNullOrEmpty(cargoName) == false)
                        {
                            firstResult = (from r in firstResult where r.Cargos.CargoName.Contains(cargoName) select r);
                        }
                        if (string.IsNullOrEmpty(modelName) == false)
                        {
                            firstResult = (from r in firstResult where r.Cargos.CargoModel.Contains(modelName) select r);
                        }
                        if (string.IsNullOrEmpty(specName) == false)
                        {
                            firstResult = (from r in firstResult where r.Cargos.CargoSpec.Contains(specName) select r);
                        }
                    }
                    else if (storageBinStatus == "0")
                    {
                        firstResult = from r in firstResult where (r.CargoCode == null || r.CargoCode == "") select r;
                    }

                    var queryResult = (from r in firstResult
                                       select new
                    {
                        //r.StorageBin.WareHouse1.WHName,
                        //r.StorageBin.WareHouse,
                        r.BinCode,
                        //r.StorageBin.BinName,
                        r.TagCode,
                        r.Number,
                        r.CargoCode,
                        r.Cargos.CargoName,
                        r.Cargos.CargoModel,
                        r.Cargos.CargoSpec,
                        r.Cargos.CargoUnits,
                        r.Comment,
                        r.Reserve1,
                        r.Reserve2
                    }).ToList();


                    string        sortExpression = gv_CargoTagList.Attributes["sortExpression"];
                    SortDirection sortDirection  = gv_CargoTagList.Attributes["sortDirection"] == "ASC" ? SortDirection.Ascending : SortDirection.Descending;

                    if (sortDirection == SortDirection.Ascending)
                    {
                        queryResult = queryResult.OrderBy(r => r.GetType().GetProperty(sortExpression).GetValue(r, null)).ToList();
                    }
                    else
                    {
                        queryResult = queryResult.OrderByDescending(r => r.GetType().GetProperty(sortExpression).GetValue(r, null)).ToList();
                    }


                    gv_CargoTagList.DataSource = queryResult.ToList();
                    gv_CargoTagList.DataBind();
                }
            }
            catch (Exception ex)
            {
                lblGridViewMsg.Text = "查询出现异常!" + Utility.LogHelper.GetExceptionMsg(ex);
            }
            finally
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Guid.NewGuid().ToString(), "hiddenWaitDiv('divWait');", true);//js提示
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 调用用友WebService并将返回的Xml字符串解析为DataTable,并为解析后的DataTable增加两列
        /// </summary>
        /// <param name="dt"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public override bool GetNCDataJoinRFID(out List <StockIn> lstOtherStockin, out string msg)
        {
            DataTable dt = null;

            lstOtherStockin = null;
            DataTable dtForNo  = null; //存放未导入的数据
            DataTable dtForYes = null; //存放已导入的数据

            msg = "";
            try
            {
                if (GetNCData(out dt, out msg) == false)
                {
                    return(false);
                }

                if (dt != null)
                {
                    if (base.isAlreadyStatus != string.Empty)
                    {
                        if (dt.Columns.Contains("BillCode"))
                        {
                            using (Gold.DAL.GoldEntities context = new DAL.GoldEntities())
                            {
                                dtForNo  = dt.Clone();
                                dtForYes = dt.Clone();

                                //List<StockIn> list = (from r in context.StockIn select r).ToList<StockIn>();
                                //foreach (DataRow dr in dt.Rows)
                                //{
                                //    string nCBillCode = dr["BillCode"].ToString();
                                //    bool isExist = false;
                                //    foreach (StockIn si in list)
                                //    {
                                //        //如果不是初始态,则说明已经导入且已开始其他操作
                                //        //0-初始态,1-已保存,2-已提交,3-撤销中,4-已撤销,5-已完成
                                //        //if (si.FromBillNo == nCBillCode && !(si.SIStatus == 0 || si.SIStatus == 1 || si.SIStatus == 4))
                                //        if (si.FromBillNo == nCBillCode && )
                                //        {
                                //            dtForYes.Rows.Add(dr.ItemArray);
                                //            isExist = true;
                                //            break;
                                //        }
                                //    }
                                //    if (!isExist)
                                //    {
                                //        dtForNo.Rows.Add(dr.ItemArray);
                                //    }
                                //}

                                foreach (DataRow dr in dt.Rows)
                                {
                                    string         nCBillCode = dr["BillCode"].ToString();
                                    bool           isExist    = false;
                                    List <StockIn> list       = (from r in context.StockIn where (r.FromBillNo == nCBillCode && r.SIStatus != 4) select r).ToList <StockIn>();
                                    if (list != null && list.Count != 0)
                                    {
                                        dtForYes.Rows.Add(dr.ItemArray);
                                        isExist = true;
                                    }
                                    if (!isExist)
                                    {
                                        dtForNo.Rows.Add(dr.ItemArray);
                                    }
                                }
                            }
                        }
                    }
                }

                if (base.isAlreadyStatus == "0")//0:未导入, 1:已导入
                {
                    if (dtForNo == null || dtForNo.Rows.Count == 0)
                    {
                        msg = "没有符合条件的用友数据!";
                        return(false);
                    }
                    lstOtherStockin = GetModelFromDataTable(dtForNo, out msg);
                }
                else if (base.isAlreadyStatus == "1")
                {
                    if (dtForYes == null || dtForYes.Rows.Count == 0)
                    {
                        msg = "没有符合条件的用友数据!";
                        return(false);
                    }
                    lstOtherStockin = GetModelFromDataTable(dtForYes, out msg);
                }
                else
                {
                    lstOtherStockin = GetModelFromDataTable(dt, out msg);
                }

                if (lstOtherStockin == null || lstOtherStockin.Count == 0)
                {
                    msg = "获取用友系统数据失败!详细信息:" + msg;
                    return(false);
                }

                return(true);
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(LogHelper.LogLevel.Error, "调用GetNCDataJoinRFID失败", ex);
                msg = "调用GetNCDataJoinRFID失败" + ex.Message;
                return(false);
            }
            //return base.GetNCDataJoinRFID(out dt, out msg);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// 调用用友WebService并将返回的Xml字符串解析为DataTable,并为解析后的DataTable增加两列
        /// </summary>
        /// <param name="dt"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public override bool GetNCDataJoinRFID(out List <SalesOrder> lstSalesOrder, out string msg)
        {
            DataTable dt = null;

            lstSalesOrder = null;
            DataTable dtForNo  = null; //存放未导入的数据
            DataTable dtForYes = null; //存放已导入的数据

            msg = "";
            try
            {
                if (GetNCData(out dt, out msg) == false)
                {
                    return(false);
                }

                if (dt != null)
                {
                    if (base.isAlreadyStatus != string.Empty)
                    {
                        if (dt.Columns.Contains("NCOrderCode"))
                        {
                            using (Gold.DAL.GoldEntities context = new DAL.GoldEntities())
                            {
                                dtForNo  = dt.Clone();
                                dtForYes = dt.Clone();

                                List <SalesOrder> list = (from r in context.SalesOrder select r).ToList <SalesOrder>();
                                foreach (DataRow dr in dt.Rows)
                                {
                                    string nCOrderCode = dr["NCOrderCode"].ToString();
                                    bool   isExist     = false;
                                    foreach (SalesOrder order in list)
                                    {
                                        //如果不是初始态,则说明已经导入且已开始其他操作
                                        //if (order.NCOrderCode == nCOrderCode && order.OrderStatus != 2)
                                        if (order.NCOrderCode == nCOrderCode)
                                        {
                                            //0:未导入, 1:已导入
                                            dtForYes.Rows.Add(dr.ItemArray);
                                            isExist = true;
                                            break;
                                        }
                                    }
                                    if (!isExist)
                                    {
                                        dtForNo.Rows.Add(dr.ItemArray);
                                    }
                                }
                            }
                        }
                    }
                }

                if (base.isAlreadyStatus == "0")
                {
                    if (dtForNo == null || dtForNo.Rows.Count == 0)
                    {
                        msg = "没有符合条件的用友数据!";
                        return(false);
                    }
                    lstSalesOrder = GetModelFromDataTable(dtForNo, out msg);
                }
                else if (base.isAlreadyStatus == "1")
                {
                    if (dtForYes == null || dtForYes.Rows.Count == 0)
                    {
                        msg = "没有符合条件的用友数据!";
                        return(false);
                    }
                    lstSalesOrder = GetModelFromDataTable(dtForYes, out msg);
                }
                else
                {
                    lstSalesOrder = GetModelFromDataTable(dt, out msg);
                }

                if (lstSalesOrder == null || lstSalesOrder.Count == 0)
                {
                    msg = "获取用友系统数据失败!详细信息:" + msg;
                    return(false);
                }

                return(true);
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(LogHelper.LogLevel.Error, "调用GetNCDataJoinRFID失败", ex);
                msg = "调用GetNCDataJoinRFID失败" + ex.Message;
                return(false);
            }
            //return base.GetNCDataJoinRFID(out dt, out msg);
        }
Ejemplo n.º 18
0
        void GridViewBind()
        {
            try
            {
                string scpCode      = tbxSCPCode.Text.Trim();
                string whCode       = DropDownList_WHCode.SelectedItem.Value.ToString();
                string scpStatus    = DropDownList_SCPStatus.SelectedItem.Value.ToString();
                int    scpStatusInt = -1;
                if (int.TryParse(scpStatus, out scpStatusInt) == false)
                {
                    scpStatusInt = -1;
                }
                string scpType    = DropDownList_Type.SelectedItem.Value.ToString();
                int    scpTypeInt = -1;
                if (int.TryParse(scpType, out scpTypeInt) == false)
                {
                    scpTypeInt = -1;
                }

                DateTime startDate = DateTime.Parse(txtStartTime.Text);
                DateTime endDate   = DateTime.Parse(txtEndTime.Text);
                DateTime startTime = new DateTime(startDate.Year, startDate.Month, startDate.Day, 0, 0, 0);
                DateTime endTime   = new DateTime(endDate.Year, endDate.Month, endDate.Day, 23, 59, 59, 999);

                using (DAL.GoldEntities context = new DAL.GoldEntities())
                {
                    var queryResult = (from r in context.StockCountingPlan
                                       where r.SCPCode.Contains(scpCode) &&
                                       r.WHCode.Contains(whCode) &&
                                       (scpStatusInt == -1 ? true : r.SCPStatus.Value.Equals(scpStatusInt)) &&
                                       (scpTypeInt == -1?true:r.SCPType.Value.Equals(scpTypeInt)) &&
                                       (r.CreateDate.Value >= startTime && r.CreateDate.Value <= endTime)
                                       select r).ToList();

                    //组合盘点层位
                    List <string> allSCPCodeList         = queryResult.Select(r => r.SCPCode).ToList <string>();
                    List <StockCountingDetail> allDetail = (from r in context.StockCountingDetail where allSCPCodeList.Contains(r.SCPCode) select r).ToList <StockCountingDetail>();

                    foreach (var temp in queryResult)
                    {
                        string        keyCode          = temp.SCPCode;
                        StringBuilder strDetailBinCode = new StringBuilder();
                        var           detailList       = (from r in allDetail orderby r.SCPCode orderby r.BinCode ascending where r.SCPCode == keyCode select r);
                        foreach (var d in detailList)
                        {
                            if (strDetailBinCode.ToString().Contains(d.BinCode) == false)
                            {
                                if (strDetailBinCode.Length > 0)
                                {
                                    strDetailBinCode.Append(",");
                                }
                                strDetailBinCode.Append(d.BinCode);
                            }
                        }
                        temp.Reserve1 = strDetailBinCode.ToString();
                    }

                    string        sortExpression = gv_CargoList.Attributes["sortExpression"];
                    SortDirection sortDirection  = gv_CargoList.Attributes["sortDirection"] == "ASC" ? SortDirection.Ascending : SortDirection.Descending;

                    if (sortDirection == SortDirection.Ascending)
                    {
                        queryResult = queryResult.OrderBy(r => r.GetType().GetProperty(sortExpression).GetValue(r, null)).ToList();
                    }
                    else
                    {
                        queryResult = queryResult.OrderByDescending(r => r.GetType().GetProperty(sortExpression).GetValue(r, null)).ToList();
                    }

                    gv_CargoList.PageSize   = WebConfigHelper.Instance.GetDefaultPageSize();
                    gv_CargoList.DataSource = queryResult;
                    gv_CargoList.DataBind();
                }
            }
            catch (Exception ex)
            {
                lblGridViewMsg.Text = "查询出现异常!" + Utility.LogHelper.GetExceptionMsg(ex);
            }
            finally
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Guid.NewGuid().ToString(), "hiddenWaitDiv('divWait');", true);//js提示
            }
        }
Ejemplo n.º 19
0
        /// <summary>
        /// 导入到系统中
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnImportToSystem_Click(object sender, EventArgs e)
        {
            try
            {
                lblSaveMsg.Text = "";
                List <Cargos> excelCargoList = null;
                if (Cache["ExcelCargoList"] != null)
                {
                    excelCargoList = (List <Cargos>)Cache["ExcelCargoList"];
                }
                if (excelCargoList == null || excelCargoList.Count == 0)
                {
                    lblSaveMsg.Text = "未选择文件或缓存过期!请先选择Excel并点击“导入前预览”,然后点击“导入到系统”!";
                    return;
                }
                else
                {
                    int insertCount     = 0; //本次新增
                    int updateCount     = 0; //本次更新
                    int affectRowsCount = 0;

                    //在本次导入过程中已经新增过的型号
                    List <string> TheTimeModelNameAddedList = new List <string>();
                    //在本次导入过程中已经新增过的规格
                    List <string> TheTimeSpecNameAddedList = new List <string>();

                    using (Gold.DAL.GoldEntities context = new DAL.GoldEntities())
                    {
                        foreach (Cargos newCargos in excelCargoList)
                        {
                            //自动从excel中新增型号
                            var existModel = (from r in context.Models where (r.ModelName.Trim() == newCargos.CargoModel && newCargos.CargoModel.Trim() != "") select r).FirstOrDefault();
                            if (existModel == null && newCargos.CargoModel.Trim() != "")
                            {
                                if (TheTimeModelNameAddedList.Contains(newCargos.CargoModel) == false)
                                {
                                    Models newModel = new Models();
                                    newModel.ModelName = newCargos.CargoModel;
                                    context.Models.AddObject(newModel);

                                    TheTimeModelNameAddedList.Add(newCargos.CargoModel);//记录到临时缓存中
                                }
                            }

                            //自动从excel中新增规格
                            var existSpec = (from r in context.Specifications where (r.SpecName.Trim() == newCargos.CargoSpec && newCargos.CargoSpec.Trim() != "") select r).FirstOrDefault();
                            if (existSpec == null && newCargos.CargoSpec.Trim() != "")
                            {
                                if (TheTimeSpecNameAddedList.Contains(newCargos.CargoSpec) == false)
                                {
                                    Specifications newSpec = new Specifications();
                                    newSpec.SpecName = newCargos.CargoSpec;
                                    context.Specifications.AddObject(newSpec);

                                    TheTimeSpecNameAddedList.Add(newCargos.CargoSpec);//记录到临时缓存中
                                }
                            }

                            //判断是否已经存在该商品
                            Cargos existSameCodeCargo = (from r in context.Cargos where (r.CargoCode == newCargos.CargoCode && newCargos.CargoCode.Trim() != "") select r).FirstOrDefault <Cargos>();
                            if (existSameCodeCargo == null)//新增
                            {
                                context.Cargos.AddObject(newCargos);

                                insertCount++;
                            }
                            else//更新
                            {
                                existSameCodeCargo.CargoName  = newCargos.CargoName;
                                existSameCodeCargo.CargoModel = newCargos.CargoModel;
                                existSameCodeCargo.CargoSpec  = newCargos.CargoSpec;
                                existSameCodeCargo.CargoUnits = newCargos.CargoUnits;
                                //existSameCodeCargo.Comment = newCargos.Comment;//2012-08-24 备注字段保留给用户使用,项目名称字段暂不显示
                                existSameCodeCargo.ProduceYear = newCargos.ProduceYear;

                                updateCount++;
                            }
                        }

                        affectRowsCount = context.SaveChanges();

                        if (affectRowsCount > 0)
                        {
                            lblSaveMsg.Text = "导入成功!(共操作" + excelCargoList.Count.ToString() + "条记录,其中新增" + insertCount.ToString() + "条,更新" + updateCount.ToString() + "条)";
                        }
                        else
                        {
                            lblSaveMsg.Text = "导入失败!请重试!";
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                lblSaveMsg.Text = "导入失败!原因:" + Utility.LogHelper.GetExceptionMsg(ex);
            }
        }
Ejemplo n.º 20
0
        void GridViewBind()
        {
            try
            {
                //lblGridViewMsg.Text = "";

                string cargoCode = tbxCargoCode.Text.Trim();
                string cargoName = tbxCargoName.Text.Trim();
                string modelName = DropDownList_CargoModel.SelectedItem.Text.Trim();
                string specName  = DropDownList_CargoSpec.SelectedItem.Text.Trim();


                System.Diagnostics.Trace.WriteLine("proc start" + DateTime.Now.ToString("yy-MM-dd hh:mm:ss:ffff"));
                using (DAL.GoldEntities context = new DAL.GoldEntities())
                {
                    List <DAL.proc_WebSelectEachDeptSaleAllocation_Result> resultList = context.proc_WebSelectEachDeptSaleAllocation().ToList <DAL.proc_WebSelectEachDeptSaleAllocation_Result>();


                    var queryResult = (from r in resultList
                                       where r.CargoCode.Contains(cargoCode) &&
                                       r.CargoName.Contains(cargoName) &&
                                       r.CargoModel.Contains(modelName) &&
                                       r.CargoSpec.Contains(specName)
                                       select r).ToList();

                    string        sortExpression = gv_SaleAllocationList.Attributes["sortExpression"];
                    SortDirection sortDirection  = gv_SaleAllocationList.Attributes["sortDirection"] == "ASC" ? SortDirection.Ascending : SortDirection.Descending;

                    if (sortDirection == SortDirection.Ascending)
                    {
                        queryResult = queryResult.OrderBy(r => r.GetType().GetProperty(sortExpression).GetValue(r, null)).ToList();
                    }
                    else
                    {
                        queryResult = queryResult.OrderByDescending(r => r.GetType().GetProperty(sortExpression).GetValue(r, null)).ToList();
                    }

                    gv_SaleAllocationList.PageSize   = WebConfigHelper.Instance.GetDefaultPageSize();
                    gv_SaleAllocationList.DataSource = queryResult;
                    gv_SaleAllocationList.DataBind();
                }
                System.Diagnostics.Trace.WriteLine("proc end" + DateTime.Now.ToString("yy-MM-dd hh:mm:ss:ffff"));
#if entityframework
                string sortExpression = gv_SaleAllocationList.Attributes["sortExpression"];
                string sortDirection  = gv_SaleAllocationList.Attributes["sortDirection"];


                DataTable dtBind = SqlHelper.ExecuteDataTable("proc_WebSelectEachDeptSaleAllocation", System.Data.CommandType.StoredProcedure, null);
                // 根据GridView排序数据列及排序方向设置显示的默认数据视图
                if ((!string.IsNullOrEmpty(sortExpression)) && (!string.IsNullOrEmpty(sortDirection)))
                {
                    dtBind.DefaultView.Sort = string.Format("{0} {1}", sortExpression, sortDirection);
                }
                gv_SaleAllocationList.DataSource = dtBind.DefaultView.ToTable();
                gv_SaleAllocationList.DataBind();
#endif
            }
            catch (Exception ex)
            {
                lblGridViewMsg.Text = "查询出现异常!" + Utility.LogHelper.GetExceptionMsg(ex);
            }
            finally
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Guid.NewGuid().ToString(), "hiddenWaitDiv('divWait');", true);//js提示
            }
        }
Ejemplo n.º 21
0
        void LoadByCargo(string whCode, string whName, string cargoCode, string cargoName,
                         string packageShareNo, string storePickType,
                         string isProfitOrLoss, string packageName,
                         string startDateStr, string endDateStr, string sortExpression, string sortDirectionStr)
        {
            DateTime startDate = DateTime.Parse(startDateStr);
            DateTime endDate   = DateTime.Parse(endDateStr);
            DateTime startTime = new DateTime(startDate.Year, startDate.Month, startDate.Day, 0, 0, 0);
            DateTime endTime   = new DateTime(endDate.Year, endDate.Month, endDate.Day, 23, 59, 59, 999);

            using (DAL.GoldEntities context = new DAL.GoldEntities())
            {
                ReportViewer1.LocalReport.ReportPath = @"Reports\Report_StorePicAccountList.rdlc";

                List <proc_WebSelectStorePickAccount_Result> queryResult = context.proc_WebSelectStorePickAccount(whCode, cargoCode, cargoName, storePickType, isProfitOrLoss, packageName, packageShareNo, startTime.ToString(), endTime.ToString()).ToList <proc_WebSelectStorePickAccount_Result>();

                foreach (proc_WebSelectStorePickAccount_Result p in queryResult)
                {
                    if (p.StorePickType == ((int)EnumData.PickOrStore.Pick).ToString())
                    {
                        p.StorePickType = EnumData.GetEnumDesc(EnumData.PickOrStore.Pick);
                    }
                    else if (p.StorePickType == ((int)EnumData.PickOrStore.Store).ToString())
                    {
                        p.StorePickType = EnumData.GetEnumDesc(EnumData.PickOrStore.Store);
                    }
                }

                //string sortExpression = gv_CargoList.Attributes["sortExpression"];
                SortDirection sortDirection = sortExpression == "ASC" ? SortDirection.Ascending : SortDirection.Descending;

                if (sortDirection == SortDirection.Ascending)
                {
                    queryResult = queryResult.OrderBy(r => r.GetType().GetProperty(sortExpression).GetValue(r, null)).ToList();
                }
                else
                {
                    queryResult = queryResult.OrderByDescending(r => r.GetType().GetProperty(sortExpression).GetValue(r, null)).ToList();
                }



                ReportDataSource rds = new ReportDataSource("DataSet_StorePickAccount", queryResult);
                ReportViewer1.LocalReport.DataSources.Clear();
                ReportViewer1.LocalReport.DataSources.Add(rds);

                /*
                 * RP_CargoCode
                 * RP_CargoName
                 * RP_CargoModel
                 * RP_CargoSpec
                 * RP_CargoUnits
                 * RP_DisplayPattern
                 * RP_WHName
                 * RP_StartDate
                 * RP_EndDate
                 * RP_TotalSumNumCurrent
                 * RP_TotalFirstOriginalNum
                 * RP_TotalSumNumAdd
                 * RP_TotalSumDel
                 */
                ReportParameter RP_CargoCode = new ReportParameter("RP_CargoCode", cargoCode);
                ReportParameter RP_CargoName = new ReportParameter("RP_CargoName", cargoName);
                //ReportParameter RP_CargoModel = new ReportParameter("RP_CargoModel", modelName);
                //ReportParameter RP_CargoSpec = new ReportParameter("RP_CargoSpec", specName);
                //ReportParameter RP_CargoUnits = new ReportParameter("RP_CargoUnits", "");
                //ReportParameter RP_DisplayPattern = new ReportParameter("RP_DisplayPattern", (displayPattern == "ByCargo" ? "按商品汇总" : "按仓库汇总"));
                ReportParameter RP_WHName    = new ReportParameter("RP_WHName", whName);
                ReportParameter RP_WHCode    = new ReportParameter("RP_WHCode", whCode);
                ReportParameter RP_StartDate = new ReportParameter("RP_StartDate", startDateStr);
                ReportParameter RP_EndDate   = new ReportParameter("RP_EndDate", endDateStr);

                string storePickTypeName = "";
                if (storePickType == ((int)EnumData.PickOrStore.Pick).ToString())
                {
                    storePickTypeName = EnumData.GetEnumDesc(EnumData.PickOrStore.Pick);
                }
                else if (storePickType == ((int)EnumData.PickOrStore.Store).ToString())
                {
                    storePickTypeName = EnumData.GetEnumDesc(EnumData.PickOrStore.Store);
                }

                ReportParameter RP_StorePickType  = new ReportParameter("RP_StorePickType", storePickTypeName);
                ReportParameter RP_PackageShareNo = new ReportParameter("RP_PackageShareNo", packageShareNo);
                ReportParameter RP_IsProfitOrLoss = new ReportParameter("RP_IsProfitOrLoss", isProfitOrLoss);
                ReportParameter RP_PackageName    = new ReportParameter("RP_PackageName", packageName);

                ReportParameterCollection rpList = new ReportParameterCollection();
                rpList.Add(RP_CargoCode);
                rpList.Add(RP_CargoName);
                //rpList.Add(RP_CargoModel);
                //rpList.Add(RP_CargoSpec);
                //rpList.Add(RP_CargoUnits);
                //rpList.Add(RP_DisplayPattern);
                rpList.Add(RP_WHName);
                rpList.Add(RP_WHCode);
                rpList.Add(RP_StartDate);
                rpList.Add(RP_EndDate);
                rpList.Add(RP_StorePickType);
                rpList.Add(RP_PackageShareNo);
                rpList.Add(RP_IsProfitOrLoss);
                rpList.Add(RP_PackageName);


                ReportViewer1.LocalReport.SetParameters(rpList);
                ReportViewer1.DataBind();
            }
        }
Ejemplo n.º 22
0
        void GridViewBind()
        {
            try
            {
                string scpCode = ViewState["EditID"].ToString();


                using (DAL.GoldEntities context = new DAL.GoldEntities())
                {
                    //查询基本信息
                    StockCountingPlan planModel = (from r in context.StockCountingPlan where r.SCPCode == scpCode select r).FirstOrDefault();
                    if (planModel != null)
                    {
                        lblSCPCodeShow.Text = planModel.SCPCode;
                        lblWHName.Text      = planModel.WHName;
                        EnumData.SCPStatusEnum status = (EnumData.SCPStatusEnum)Enum.Parse(typeof(EnumData.SCPStatusEnum), planModel.SCPStatus.Value.ToString());
                        lblStatusShow.Text = EnumData.GetEnumDesc(status);
                        EnumData.SCPTypeEnum types = (EnumData.SCPTypeEnum)Enum.Parse(typeof(EnumData.SCPTypeEnum), planModel.SCPType.Value.ToString());
                        lblType.Text       = EnumData.GetEnumDesc(types);
                        lblCreateTime.Text = planModel.CreateDate.ToString();

                        if (lblStatusShow.Text == EnumData.GetEnumDesc(EnumData.SCDetailStatusEnum.Complete))//结束盘点的按钮不可用
                        {
                            btnFinish.Enabled  = false;
                            btnFinish.CssClass = "ButtonImageStyleEnableFalse";
                        }
                    }


                    var queryResult = (from r in context.StockCountingDetail
                                       where r.SCPCode == scpCode
                                       select r).ToList();

                    foreach (var d in queryResult)
                    {
                        DateTime FinishTime = DateTime.Now;                        //如果盘点未结束则计算盘点开始至当前时间段内的出入数量
                        if (d.Status == (int)EnumData.SCDetailStatusEnum.Complete) //如果盘点已经结束则计算盘点开始和结束之间的出入数量
                        {
                            FinishTime = d.CountingEndTime.Value;
                        }

                        //台账中ChangeType 1,3出,2,4入

                        //此层位此商品 盘点至今/结束的入库数量
                        double?sumIn = (from r in context.InventoryBook
                                        where r.WHCode == planModel.WHCode &&
                                        r.CargoCode == d.CargoCode &&
                                        r.BinCode == d.BinCode &&
                                        (r.ChangeType == 2 || r.ChangeType == 4) &&
                                        r.ChangeTime >= planModel.CreateDate &&
                                        r.ChangeTime <= FinishTime
                                        select r.NumAdd).Sum();
                        //此层位此商品 盘点至今/结束的出库数量
                        double?sumOut = (from r in context.InventoryBook
                                         where r.WHCode == planModel.WHCode &&
                                         r.CargoCode == d.CargoCode &&
                                         r.BinCode == d.BinCode &&
                                         (r.ChangeType == 1 || r.ChangeType == 3) &&
                                         r.ChangeTime >= planModel.CreateDate &&
                                         r.ChangeTime <= FinishTime
                                         select r.NumDel).Sum();

                        d.PeriodInNum  = sumIn == null ? 0 : sumIn;
                        d.PeriodOutNum = sumOut == null ? 0 : sumOut;

                        if (d.NumActual != null)
                        {
                            d.NumDifference = d.NumActual - (d.NumPlan + d.PeriodInNum - d.PeriodOutNum);
                        }
                    }

                    string        sortExpression = gv_CargoList.Attributes["sortExpression"];
                    SortDirection sortDirection  = gv_CargoList.Attributes["sortDirection"] == "ASC" ? SortDirection.Ascending : SortDirection.Descending;

                    if (sortDirection == SortDirection.Ascending)
                    {
                        queryResult = queryResult.OrderBy(r => r.GetType().GetProperty(sortExpression).GetValue(r, null)).ToList();
                    }
                    else
                    {
                        queryResult = queryResult.OrderByDescending(r => r.GetType().GetProperty(sortExpression).GetValue(r, null)).ToList();
                    }

                    gv_CargoList.DataSource = queryResult;
                    gv_CargoList.DataBind();
                }
            }
            catch (Exception ex)
            {
                lblGridViewMsg.Text = "查询出现异常!" + Utility.LogHelper.GetExceptionMsg(ex);
            }
            finally
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), Guid.NewGuid().ToString(), "hiddenWaitDiv('divWait');", true);//js提示
            }
        }
Ejemplo n.º 23
0
        void LoadByCargo(string displayPattern, string cargoCode, string cargoName, string modelName, string specName, string startDateStr, string endDateStr, string sortExpression, string sortDirectionStr)
        {
            DateTime startDate = DateTime.Parse(startDateStr);
            DateTime endDate   = DateTime.Parse(endDateStr);
            DateTime startTime = new DateTime(startDate.Year, startDate.Month, startDate.Day, 0, 0, 0);
            DateTime endTime   = new DateTime(endDate.Year, endDate.Month, endDate.Day, 23, 59, 59, 999);

            using (DAL.GoldEntities context = new DAL.GoldEntities())
            {
                double totalFirstOriginalNum = 0;
                double totalNumAdd           = 0;
                double totalNumDel           = 0;
                double totalNumCurrent       = 0;

                ReportViewer1.LocalReport.ReportPath = @"Reports\Report_InOutCollectByCargo.rdlc";

                List <proc_WebSelectInOutCollectByCargo_Result> queryResult = context.proc_WebSelectInOutCollectByCargo(cargoCode, cargoName, modelName, specName, "", startTime, endTime).ToList <proc_WebSelectInOutCollectByCargo_Result>();

                //string sortExpression = gv_CargoList.Attributes["sortExpression"];
                SortDirection sortDirection = sortDirectionStr == "ASC" ? SortDirection.Ascending : SortDirection.Descending;//gv_CargoList.Attributes["sortDirection"] == "ASC" ? SortDirection.Ascending : SortDirection.Descending;

                if (sortDirection == SortDirection.Ascending)
                {
                    queryResult = queryResult.OrderBy(r => r.GetType().GetProperty(sortExpression).GetValue(r, null)).ToList();
                }
                else
                {
                    queryResult = queryResult.OrderByDescending(r => r.GetType().GetProperty(sortExpression).GetValue(r, null)).ToList();
                }

                totalFirstOriginalNum = queryResult.Sum(r => r.FirstOrignialNum).Value;
                totalNumAdd           = queryResult.Sum(r => r.SumNumAdd).Value;
                totalNumDel           = queryResult.Sum(r => r.SumNumDel).Value;
                totalNumCurrent       = queryResult.Sum(r => r.SumNumCurrent).Value;

                ReportDataSource rds = new ReportDataSource("DataSet_InOutCollectByCargo", queryResult);
                ReportViewer1.LocalReport.DataSources.Clear();
                ReportViewer1.LocalReport.DataSources.Add(rds);

                /*
                 * RP_CargoCode
                 * RP_CargoName
                 * RP_CargoModel
                 * RP_CargoSpec
                 * RP_CargoUnits
                 * RP_DisplayPattern
                 * RP_WHName
                 * RP_StartDate
                 * RP_EndDate
                 * RP_TotalSumNumCurrent
                 * RP_TotalFirstOriginalNum
                 * RP_TotalSumNumAdd
                 * RP_TotalSumDel
                 */
                ReportParameter RP_CargoCode             = new ReportParameter("RP_CargoCode", cargoCode);
                ReportParameter RP_CargoName             = new ReportParameter("RP_CargoName", cargoName);
                ReportParameter RP_CargoModel            = new ReportParameter("RP_CargoModel", modelName);
                ReportParameter RP_CargoSpec             = new ReportParameter("RP_CargoSpec", specName);
                ReportParameter RP_CargoUnits            = new ReportParameter("RP_CargoUnits", "");
                ReportParameter RP_DisplayPattern        = new ReportParameter("RP_DisplayPattern", (displayPattern == "ByCargo" ? "按商品汇总" : "按仓库汇总"));
                ReportParameter RP_WHName                = new ReportParameter("RP_WHName", "");
                ReportParameter RP_StartDate             = new ReportParameter("RP_StartDate", startDateStr);
                ReportParameter RP_EndDate               = new ReportParameter("RP_EndDate", endDateStr);
                ReportParameter RP_TotalFirstOriginalNum = new ReportParameter("RP_TotalFirstOriginalNum", totalFirstOriginalNum.ToString());
                ReportParameter RP_TotalSumNumAdd        = new ReportParameter("RP_TotalSumNumAdd", totalNumAdd.ToString());
                ReportParameter RP_TotalSumDel           = new ReportParameter("RP_TotalSumDel", totalNumDel.ToString());
                ReportParameter RP_TotalSumNumCurrent    = new ReportParameter("RP_TotalSumNumCurrent", totalNumCurrent.ToString());

                ReportParameterCollection rpList = new ReportParameterCollection();
                rpList.Add(RP_CargoCode);
                rpList.Add(RP_CargoName);
                rpList.Add(RP_CargoModel);
                rpList.Add(RP_CargoSpec);
                rpList.Add(RP_CargoUnits);
                rpList.Add(RP_DisplayPattern);
                rpList.Add(RP_WHName);
                rpList.Add(RP_StartDate);
                rpList.Add(RP_EndDate);
                rpList.Add(RP_TotalFirstOriginalNum);
                rpList.Add(RP_TotalSumNumAdd);
                rpList.Add(RP_TotalSumDel);
                rpList.Add(RP_TotalSumNumCurrent);

                ReportViewer1.LocalReport.SetParameters(rpList);
                ReportViewer1.DataBind();
            }
        }
Ejemplo n.º 24
0
        void GridViewBind()
        {
            try
            {
                string   whCode        = drpWHCode.SelectedItem.Value.ToString();
                string   cargoCode     = txtCargoCode.Text.Trim();
                string   cargoName     = txtCargoName.Text.Trim();
                string   modelName     = txtCargoModel.Text.Trim();
                string   specName      = txtCargoSpec.Text.Trim();
                DateTime datetimeStart = DateTime.Now.AddDays(-30);
                DateTime datetimeEnd   = DateTime.Now;
                if (DateTime.TryParse(txtStartDate.Text, out datetimeStart) == false ||
                    DateTime.TryParse(txtEndDate.Text, out datetimeEnd) == false)
                {
                    ShowMessageBox("请选择有效的台账日期!");
                    GridView1.DataSource = null;
                    GridView1.DataBind();
                    return;
                }

                //设置截止时间为当天的23:59:59:999
                datetimeEnd = new DateTime(datetimeEnd.Year, datetimeEnd.Month, datetimeEnd.Day, 23, 59, 59, 999);


                using (DAL.GoldEntities context = new DAL.GoldEntities())
                {
                    var queryResult = from r in context.VInventoryBookJoinWH
                                      where r.ChangeTime >= datetimeStart && r.ChangeTime <= datetimeEnd
                                      select r;


                    if (string.IsNullOrEmpty(whCode) == false)
                    {
                        queryResult = (from r in queryResult where r.WHCode.Contains(whCode) select r);
                    }
                    if (string.IsNullOrEmpty(cargoCode) == false)
                    {
                        queryResult = (from r in queryResult where r.CargoCode.Contains(cargoCode) select r);
                    }
                    if (string.IsNullOrEmpty(cargoName) == false)
                    {
                        queryResult = (from r in queryResult where r.CargoName.Contains(cargoName) select r);
                    }
                    if (string.IsNullOrEmpty(modelName) == false)
                    {
                        queryResult = (from r in queryResult where r.CargoModel.Contains(modelName) select r);
                    }
                    if (string.IsNullOrEmpty(specName) == false)
                    {
                        queryResult = (from r in queryResult where r.CargoSpec.Contains(specName) select r);
                    }

                    #region 排序

                    //获取自定义排序
                    string        sortExpression = GridView1.Attributes["sortExpression"];
                    SortDirection sortDirection  = GridView1.Attributes["sortDirection"] == "ASC" ? SortDirection.Ascending : SortDirection.Descending;

                    //在商品名相同时还要按商品编码排序
                    if (sortExpression == "CargoCode")
                    {
                        if (sortDirection == SortDirection.Ascending)
                        {
                            queryResult = queryResult.OrderBy(r => r.WHCode).ThenBy(r => r.CargoCode).ThenBy(r => r.ChangeTime).ThenBy(r => r.TableAccountID);////加ThenBy(o=>o.TableAccountID)目的是防止台账时间一致,排序结果显示异常的问题
                        }
                        else
                        {
                            queryResult = queryResult.OrderBy(r => r.WHCode).ThenByDescending(r => r.CargoCode).ThenBy(r => r.ChangeTime).ThenBy(r => r.TableAccountID);
                        }
                    }
                    else if (sortExpression == "CargoName")
                    {
                        if (sortDirection == SortDirection.Ascending)
                        {
                            queryResult = queryResult.OrderBy(r => r.WHCode).ThenBy(r => r.CargoName).ThenBy(r => r.CargoCode).ThenBy(r => r.ChangeTime).ThenBy(r => r.TableAccountID);
                        }
                        else
                        {
                            queryResult = queryResult.OrderBy(r => r.WHCode).ThenByDescending(r => r.CargoName).ThenBy(r => r.CargoCode).ThenBy(r => r.ChangeTime).ThenBy(r => r.TableAccountID);
                        }
                    }
                    #endregion

                    GridView1.DataSource = queryResult.ToList();
                    GridView1.DataBind();
                }
            }
            catch (Exception ex)
            {
                //lblGridViewMsg.Text = "查询出现异常!" + Utility.LogHelper.GetExceptionMsg(ex);
                ShowMessageBox("查询出现异常!", ex);
            }
        }
Ejemplo n.º 25
0
        //对每个部门保存分配量
        void SetNewOrUpdateModel(string deptNo, string cargoCode, int newAllocationNumber, ref System.Text.StringBuilder LogMsg, ref DAL.GoldEntities context)
        {
            //新增或更新渠道部分配量

            SaleAllocation existDeptChannel = (from r in context.SaleAllocation where r.DepartmentCode == deptNo && r.CargoCode == cargoCode select r).FirstOrDefault <SaleAllocation>();

            if (existDeptChannel != null)//更新
            {
                LogMsg.Append(" 部门[");
                LogMsg.Append(deptNo);
                LogMsg.Append("]分配量由");
                LogMsg.Append(existDeptChannel.Allocation.ToString());
                LogMsg.Append("更改为");
                LogMsg.Append(newAllocationNumber.ToString());

                existDeptChannel.Allocation = newAllocationNumber;
            }
            else //新增
            {
                LogMsg.Append(" 部门[");
                LogMsg.Append(deptNo);
                LogMsg.Append("]分配量首次设置为");
                LogMsg.Append(newAllocationNumber.ToString());

                SaleAllocation newAllocation = new SaleAllocation();
                newAllocation.Allocation     = newAllocationNumber;
                newAllocation.CargoCode      = cargoCode;
                newAllocation.DepartmentCode = deptNo;

                context.SaleAllocation.AddObject(newAllocation);
            }
        }