Ejemplo n.º 1
0
        /// <summary>
        /// 审核单据
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public override string Audite(OutStorageEntity entity)
        {
            if (entity.Status == (int)EAudite.NotPass)
            {
                entity.IncludeStatus(true).IncludeReason(true).Where(a => a.OrderNum == entity.OrderNum);
                int line = this.OutStorage.Update(entity);
                return(line > 0 ? "1000" : string.Empty);
            }
            else if (entity.Status == (int)EAudite.Pass)
            {
                Proc_AuditeOutStorageEntity auditeEntity = new Proc_AuditeOutStorageEntity();
                auditeEntity.OrderNum      = entity.OrderNum;
                auditeEntity.Status        = entity.Status;
                auditeEntity.AuditUser     = entity.AuditUser;
                auditeEntity.Reason        = entity.Reason;
                auditeEntity.OperateType   = entity.OperateType;
                auditeEntity.EquipmentNum  = entity.EquipmentNum;
                auditeEntity.EquipmentCode = entity.EquipmentCode;
                auditeEntity.Remark        = entity.Remark;
                int line = this.Proc_AuditeOutStorage.ExecuteNonQuery(auditeEntity);

                /***
                 * 如果是销售订单则需要更改订单中的发货数量以及相应的状态
                 * 1. 查询出库单,判断出库单的类型
                 * 2. 查询出库单所有的内容详细,判断存在哪些订单
                 * 3. 统计相应的订单的出库总数量
                 * 4. 修改订单状态
                 * */
                OutStorageEntity outEntity = new OutStorageEntity();
                outEntity.IncludeAll();
                outEntity.Where(a => a.OrderNum == entity.OrderNum);
                outEntity = this.OutStorage.GetSingle(outEntity);
                OutStoDetailEntity detail = new OutStoDetailEntity();
                detail.Where(a => a.OrderNum == entity.OrderNum);
                detail.IncludeAll();
                List <OutStoDetailEntity> listDetail = this.OutStoDetail.GetList(detail);
                if (outEntity != null && !listDetail.IsNullOrEmpty())
                {
                    if (outEntity.OutType == (int)EOutType.Sell)
                    {
                        OutStorageProvider outProvider = new OutStorageProvider();
                        foreach (var item in listDetail.Where(a => !a.ContractOrder.IsEmpty() && !a.ContractSn.IsEmpty()).GroupBy(a => new { a.ContractOrder, a.ContractSn }))
                        {
                            OutStoDetailEntity tempOutDetail = new OutStoDetailEntity();
                            tempOutDetail.Where(a => a.ContractOrder == item.Key.ContractOrder).And(a => a.ContractSn == item.Key.ContractSn);
                            List <OutStoDetailEntity> list = outProvider.GetOrderDetail(tempOutDetail);
                            double value = list.Sum(a => a.Num);

                            OrderDetailEntity orderDetail = new OrderDetailEntity();
                            orderDetail.RealNum = value;
                            orderDetail.IncludeRealNum(true);
                            orderDetail.Where(a => a.SnNum == item.Key.ContractSn).And(a => a.OrderNum == item.Key.ContractOrder);
                            this.OrderDetail.Update(orderDetail);

                            orderDetail = new OrderDetailEntity();
                            orderDetail.IncludeAll();
                            orderDetail.And(a => a.OrderNum == item.Key.ContractOrder);
                            List <OrderDetailEntity> listOrderDetail = this.OrderDetail.GetList(orderDetail);
                            bool flag = true;
                            foreach (OrderDetailEntity detailItem in listOrderDetail)
                            {
                                if (detailItem.RealNum < detailItem.Num)
                                {
                                    flag = false;
                                }
                            }

                            OrdersEntity order = new OrdersEntity();
                            if (flag)
                            {
                                order.Status = (int)EOrderStatus.AllDelivery;
                            }
                            else
                            {
                                order.Status = (int)EOrderStatus.PartialDelivery;
                            }
                            order.IncludeStatus(true);
                            order.Where(a => a.OrderNum == item.Key.ContractOrder);
                            this.Orders.Update(order);
                        }
                    }
                }
                return(auditeEntity.ReturnValue);
            }
            return(string.Empty);
        }
Ejemplo n.º 2
0
        public ActionResult OutStorageReportDetail()
        {
            int queryTime = WebUtil.GetFormValue<int>("QueryTime", 0);
            int pageIndex = WebUtil.GetFormValue<int>("pageIndex", 0);
            int pageSize = WebUtil.GetFormValue<int>("pageSize", 0);
            string storageNum = this.DefaultStore;

            PageInfo procPageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize };
            OutStorageProvider provider = new OutStorageProvider();
            List<Proc_OutStorageReportEntity> detailList = provider.GetList(queryTime, ref procPageInfo, storageNum);
            detailList = detailList == null ? new List<Proc_OutStorageReportEntity>() : detailList;
            detailList.ForEach(a =>
            {
                a.Amount = a.Amount / 10000;
            });
            string jsonDetail = ConvertJson.ListToJson<Proc_OutStorageReportEntity>(detailList, "List");
            this.ReturnJson.AddProperty("Data", new JsonObject(jsonDetail));
            this.ReturnJson.AddProperty("RowCount", procPageInfo.RowCount);
            return Content(this.ReturnJson.ToString());
        }
Ejemplo n.º 3
0
        public ActionResult ProductInOutReportList()
        {
            int queryTime = WebUtil.GetFormValue<int>("QueryTime", 0);
            string storageNum = this.DefaultStore;
            int pageIndex = WebUtil.GetFormValue<int>("pageIndex", 0);
            int pageSize = WebUtil.GetFormValue<int>("pageSize", 0);

            string Key = "InOutReprt" + DateTime.Now.AddDays(-queryTime).ToString("yyMMdd") + DateTime.Now.ToString("yyMMdd") + storageNum;
            List<ProductEntity> listResult = CacheHelper.Get(Key) as List<ProductEntity>;
            if (listResult.IsNullOrEmpty())
            {
                listResult = new List<ProductEntity>();
                InStorageProvider inProvider = new InStorageProvider();
                List<ReportChart> listInSource = inProvider.GetChartTop((int)EAudite.Pass, this.DefaultStore, DateTime.Now.AddDays(-queryTime), DateTime.Now);
                if (!listInSource.IsNullOrEmpty())
                {
                    foreach (ReportChart chart in listInSource)
                    {
                        ProductEntity entity = new ProductEntity();
                        entity.SnNum = chart.ProductNum;
                        entity.BarCode = chart.BarCode;
                        entity.ProductName = chart.ProductName;
                        entity.InStorageNum = chart.Num;
                        entity.Size = chart.Size.IsEmpty() ? "" : chart.Size;
                        listResult.Add(entity);
                    }
                }
                OutStorageProvider outProvider = new OutStorageProvider();
                List<ReportChart> listOutSource = listInSource = outProvider.GetChartTop((int)EAudite.Pass, this.DefaultStore, DateTime.Now.AddDays(-queryTime), DateTime.Now);
                if (!listOutSource.IsNullOrEmpty())
                {
                    foreach (ReportChart chart in listOutSource)
                    {
                        if (listResult.Exists(a => a.SnNum == chart.ProductNum))
                        {
                            ProductEntity entity = listResult.First(a => a.SnNum == chart.ProductNum);
                            entity.OutStorageNum = chart.Num;
                        }
                        else
                        {
                            ProductEntity entity = new ProductEntity();
                            entity.SnNum = chart.ProductNum;
                            entity.BarCode = chart.BarCode;
                            entity.ProductName = chart.ProductName;
                            entity.OutStorageNum = chart.Num;
                            entity.Size = chart.Size.IsEmpty() ? "" : chart.Size;
                            listResult.Add(entity);
                        }
                    }
                }
                if (!listResult.IsNullOrEmpty())
                {
                    double inTotalNum = listResult.Sum(a => a.InStorageNum);
                    double outTotalNum = listResult.Sum(a => a.OutStorageNum);
                    listResult.ForEach(a =>
                    {
                        a.InStorageNumPCT = inTotalNum > 0 ? a.InStorageNum*100 / inTotalNum : 0;
                        a.OutStorageNumPCT = outTotalNum > 0 ? a.OutStorageNum*100 / outTotalNum : 0;
                    });
                    CacheHelper.Insert(Key, listResult, null, DateTime.Now.AddMinutes(30));
                }
            }
            int rowCount = listResult.Count;
            listResult = listResult.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList();
            string json = ConvertJson.ListToJson<ProductEntity>(listResult, "List");
            this.ReturnJson.AddProperty("Data", new JsonObject(json));
            this.ReturnJson.AddProperty("RowCount", rowCount);
            return Content(this.ReturnJson.ToString());
        }
Ejemplo n.º 4
0
        public ActionResult OutStorageAmpie()
        {
            int queryTime = WebUtil.GetFormValue<int>("QueryTime", 0);
            int pageIndex = WebUtil.GetFormValue<int>("pageIndex", 0);
            int pageSize = 10;
            string storageNum = this.DefaultStore;

            PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize };
            OutStorageProvider provider = new OutStorageProvider();
            List<Proc_OutStorageReportEntity> detailList = provider.GetList(queryTime, ref pageInfo, storageNum);
            detailList = detailList == null ? new List<Proc_OutStorageReportEntity>() : detailList;

            StringBuilder sb = new StringBuilder();
            sb.Append("<chart>");
            sb.Append("<series>");
            int index = 0;
            detailList.ForEach(a =>
            {
                //日期
                sb.AppendFormat("<value xid=\"{0}\">{1}</value>", index.ToString(), a.CreateTime.ToString("MM-dd"));
                index++;
            });
            index = 0;
            sb.Append("</series>");
            sb.Append("<graphs>");
            sb.Append("<graph gid=\"1\">");
            detailList.ForEach(a =>
            {
                //数量
                sb.AppendFormat("<value xid=\"{0}\">{1}</value>", index.ToString(), a.Num.ToString());
                index++;
            });
            index = 0;
            sb.Append("</graph>");
            sb.Append("<graph gid=\"2\">");
            detailList.ForEach(a =>
            {
                //数量
                sb.AppendFormat("<value xid=\"{0}\">{1}</value>", index.ToString(), (a.Amount / 10000).ToString());
                index++;
            });
            sb.Append("</graph>");
            sb.Append("</graphs>");
            sb.Append("</chart>");
            this.ReturnJson.AddProperty("OutStorageData", sb.ToString());
            this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount);
            return Content(this.ReturnJson.ToString());
        }
Ejemplo n.º 5
0
        public ActionResult CustomerReportTOP10()
        {
            int queryTime = WebUtil.GetFormValue<int>("QueryTime", 0);
            int pageIndex = 1;
            int pageSize = 10;
            string storageNum = this.DefaultStore;

            OutStorageProvider provider = new OutStorageProvider();
            OutStorageEntity entity = new OutStorageEntity();
            PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize };

            List<OutStorageEntity> listResult = provider.GetListTOP10(queryTime, storageNum);
            listResult = listResult.IsNull() ? new List<OutStorageEntity>() : listResult;
            CustomerProvider cusProvider = new CustomerProvider();
            foreach (OutStorageEntity item in listResult)
            {
                CustomerEntity tempItem = cusProvider.GetSingleCustomer(item.CusNum);
                item.CusName = tempItem.CusName;
                item.CusType = tempItem.CusType;
            }
            /*******************************************订单数量排名前十的客户饼图数据****************************************************/
            StringBuilder sb = new StringBuilder();
            sb.Append("<pie>");
            listResult.ForEach(a =>
            {
                if (a.Num > 0)
                {
                    sb.AppendFormat("<slice title=\"{0}\">{1}</slice>", a.CusName, a.Num.ToString());
                }
            });
            sb.Append("</pie>");
            this.ReturnJson.AddProperty("InStorageData", sb.ToString());
            string json = ConvertJson.ListToJson<OutStorageEntity>(listResult, "List");
            this.ReturnJson.AddProperty("Data", new JsonObject(json));
            this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount);
            return Content(this.ReturnJson.ToString());
        }
Ejemplo n.º 6
0
        public ActionResult CustomerDetailList()
        {
            int queryTime = WebUtil.GetFormValue<int>("QueryTime", 0);
            int pageIndex = WebUtil.GetFormValue<int>("pageIndex", 0);
            int pageSize = WebUtil.GetFormValue<int>("pageSize", 0);
            string storageNum = this.DefaultStore;

            CustomerProvider provider = new CustomerProvider();
            CustomerEntity entity = new CustomerEntity();
            PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize };
            List<CustomerEntity> listResult = provider.GetCustomerList(entity, ref pageInfo);
            listResult = listResult.IsNull() ? new List<CustomerEntity>() : listResult;
            OutStorageProvider outProvider = new OutStorageProvider();
            foreach (CustomerEntity item in listResult)
            {
                item.Num = outProvider.GetNumByCusNum(item.CusNum, queryTime, storageNum);
            }
            string json = ConvertJson.ListToJson<CustomerEntity>(listResult, "List");
            this.ReturnJson.AddProperty("Data", new JsonObject(json));
            this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount);
            return Content(this.ReturnJson.ToString());
        }
Ejemplo n.º 7
0
        public ActionResult BindPieData()
        {
            int queryTime = WebUtil.GetFormValue<int>("QueryTime", 0);
            string storageNum = this.DefaultStore;
            InStorageProvider inProvider = new InStorageProvider();
            List<ReportChart> listInSource = inProvider.GetChartTop((int)EAudite.Pass, this.DefaultStore, DateTime.Now.AddDays(-queryTime), DateTime.Now);
            StringBuilder sbInStorage = new StringBuilder();
            sbInStorage.Append("<pie>");
            listInSource.ForEach(a =>
            {
                sbInStorage.AppendFormat("<slice title=\"{0}\">{1}</slice>", a.ProductName, a.Num);
            });
            sbInStorage.Append("</pie>");

            OutStorageProvider outProvider = new OutStorageProvider();
            listInSource = outProvider.GetChartTop((int)EAudite.Pass, this.DefaultStore, DateTime.Now.AddDays(-queryTime), DateTime.Now);
            StringBuilder sbOutStorage = new StringBuilder();
            sbOutStorage.Append("<pie>");
            listInSource.ForEach(a =>
            {
                sbOutStorage.AppendFormat("<slice title=\"{0}\">{1}</slice>", a.ProductName, a.Num);
            });
            sbOutStorage.Append("</pie>");
            this.ReturnJson.AddProperty("InStorageData", sbInStorage.ToString());
            this.ReturnJson.AddProperty("OutStorageData", sbOutStorage.ToString());
            return Content(this.ReturnJson.ToString());
        }
Ejemplo n.º 8
0
 public ActionResult EditNum()
 {
     string snNum = WebUtil.GetFormValue<string>("SnNum", string.Empty);
     double num = WebUtil.GetFormValue<double>("num", 0);
     OutStorageProvider provider = new OutStorageProvider();
     int line = provider.EditInOrderNum(snNum, num);
     List<OutStoDetailEntity> list = Session[CacheKey.TEMPDATA_CACHE_OUTSTORDETAIL] as List<OutStoDetailEntity>;
     if (!list.IsNullOrEmpty())
     {
         if (list.Exists(a => a.SnNum == snNum))
         {
             OutStoDetailEntity detail = list.First(a => a.SnNum == snNum);
             detail.Num = num;
             detail.Amount = detail.OutPrice * detail.Num;
         }
     }
     return Content(string.Empty);
 }