示例#1
0
        public ActionResult AbnormalPODSearch(AbnormalPODSearchModel model, int?PageIndex)
        {
            if (model.IsExport)
            {
                model.Config = ((Projects)ApplicationConfigHelper.GetApplicationConfig()).ProjectCollection.First(p => p.Id == base.UserInfo.ProjectID.ToString()).ModuleCollection.First(m => m.Id == "M001").Tables.TableCollection.First(t => t.Name == "Pod");
                return(this.GetAbnormalPODSearchToExcel(model));
            }
            else if (model.IsExportTrack)
            {
                return(this.GetAbnormalPODTrackSearchToExcel(model));
            }
            else
            {
                var Result = new AKZOService().GetAbnormalPODSearch(new GetAbnormalPODSearchRequest()
                {
                    SqlWhere = this.GetWhere(model), PageSize = UtilConstants.PAGESIZE, PageIndex = PageIndex ?? 0
                }).Result;
                model.AbnormalTable = Result.AbnormalTable;
                model.PageIndex     = Result.PageIndex;
                model.PageSize      = Result.PageSize;
                model.PageCount     = Result.PageCount;
            }

            return(View(model));
        }
示例#2
0
        private void GenQueryAbnormalPODSearchModel(AbnormalPODSearchModel model)
        {
            model.Config = ((Projects)ApplicationConfigHelper.GetApplicationConfig()).ProjectCollection.First(p => p.Id == base.UserInfo.ProjectID.ToString()).ModuleCollection.First(m => m.Id == "M001").Tables.TableCollection.First(t => t.Name == "Pod");

            if (base.UserInfo.UserType == 2)
            {
                model.Customers = ApplicationConfigHelper.GetProjectUserCustomers(base.UserInfo.ProjectID, base.UserInfo.ID)
                                  .Select(c => new SelectListItem()
                {
                    Value = c.CustomerID.ToString(), Text = c.CustomerName
                });
            }
            else if (base.UserInfo.UserType == 0)
            {
                model.Customers = new List <SelectListItem>()
                {
                    new SelectListItem()
                    {
                        Value = base.UserInfo.CustomerOrShipperID.ToString(), Text = ApplicationConfigHelper.GetApplicationCustomers().First(c => c.ID == base.UserInfo.CustomerOrShipperID).Name
                    }
                };
            }
            else
            {
                model.Customers = Enumerable.Empty <SelectListItem>();
            }
        }
示例#3
0
        public string GetWhere(AbnormalPODSearchModel model)
        {
            string sql = "";

            if (!string.IsNullOrEmpty(model.BeginActualDeliveryDate.ToString()))
            {
                sql += " AND POD.ActualDeliveryDate>='" + model.BeginActualDeliveryDate.ToString() + "'";
            }

            if (!string.IsNullOrEmpty(model.EndActualDeliveryDate.ToString()))
            {
                sql += " AND POD.ActualDeliveryDate<='" + model.EndActualDeliveryDate.ToString() + "'";
            }

            return(sql);
        }
示例#4
0
        public ActionResult GetAbnormalPODTrackSearchToExcel(AbnormalPODSearchModel model)
        {
            var Result = new AKZOService().GetAbnormalPODTrackSearchToExcel(new GetAbnormalPODSearchRequest()
            {
                SqlWhere = this.GetWhere(model)
            }).Result;

            var columns = ((Projects)ApplicationConfigHelper.GetApplicationConfig()).ProjectCollection.First(p => p.Id == base.UserInfo.ProjectID.ToString()).ModuleCollection.First(m => m.Id == "M001").Tables.TableCollection.First(t => t.Name == "PodTrack")
                          .ColumnCollection.Where(c => (c.IsKey && c.ForView) || (!c.IsKey && !c.IsHide) || (!c.IsKey && c.IsHide && c.InnerColumns.Any(innerc => innerc.CustomerID == _CustomerID)))
                          .Select(c =>
            {
                if (c.InnerColumns.Count == 0)
                {
                    return(c);
                }
                else
                {
                    if (c.InnerColumns.Any(innerc => innerc.CustomerID == _CustomerID))
                    {
                        return(c.InnerColumns.First(innerc => innerc.CustomerID == _CustomerID));
                    }

                    return(c);
                }
            });

            return(this.ExportPodTracksToExcel(Result, columns));



            //var Result = new AKZOService().GetAbnormalPODTrackSearchToExcel(new GetAbnormalPODSearchRequest() { SqlWhere = this.GetWhere(model) }).Result;
            //DataTable Exprottable = Result.AbnormalTable;


            //string ReportName = "POD跟踪异常数据报表" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xlsx";

            //ExcelHelper excelHelper = new ExcelHelper();
            //string targetPath = Path.Combine(Runbow.TWS.Common.Constants.UPLOAD_FOLDER_PATH, base.UserInfo.ProjectID.ToString(), "Temp");
            //string fileFullPath = Path.Combine(targetPath, ReportName);
            //excelHelper.CreateExcelByDataTable(fileFullPath, Exprottable);
            //excelHelper.Dispose();

            //string mimeType = "application/msexcel";
            //FileStream fs = MyFile.Open(fileFullPath, FileMode.Open);
            //return File(fs, mimeType, Url.Encode(ReportName));
        }
示例#5
0
        public ActionResult GetAbnormalPODSearchToExcel(AbnormalPODSearchModel model)
        {
            var podCollection = new AKZOService().GetAbnormalPODSearchToExcel(new GetAbnormalPODSearchRequest()
            {
                SqlWhere = this.GetWhere(model)
            }).Result;

            this.GenQueryAbnormalPODSearchModel(model);
            long?customerID;

            if (model.Customers.Count() == 1)
            {
                customerID = model.Customers.First().Value.ObjectToInt64();
            }
            else
            {
                customerID = model.SearchCondition.CustomerID;
            }

            return(this.ExportPodsToExcel(podCollection, model.Config.ColumnCollection, customerID));
        }
示例#6
0
        public ActionResult AbnormalPODSearch()
        {
            AbnormalPODSearchModel model = new AbnormalPODSearchModel();

            return(View(model));
        }