Ejemplo n.º 1
0
 public static InStorage_CE ToCE(InStorageEntity item)
 {
     InStorage_CE target = new InStorage_CE();
     target.ID=item.ID;
     target.OrderNum=item.OrderNum;
     target.InType=item.InType;
     target.ProductType=item.ProductType;
     target.SupNum=item.SupNum;
     target.SupName=item.SupName;
     target.ContactName=item.ContactName;
     target.Phone=item.Phone;
     target.Address=item.Address;
     target.ContractOrder=item.ContractOrder;
     target.ContractType=item.ContractType;
     target.Status=item.Status;
     target.IsDelete=item.IsDelete;
     target.Num=item.Num;
     target.Amount=item.Amount;
     target.NetWeight=item.NetWeight;
     target.GrossWeight=item.GrossWeight;
     target.OrderTime=item.OrderTime;
     target.CreateTime=item.CreateTime;
     target.CreateUser=item.CreateUser;
     target.AuditUser=item.AuditUser;
     target.AuditeTime=item.AuditeTime;
     target.PrintUser=item.PrintUser;
     target.PrintTime=item.PrintTime;
     target.StoreKeeper=item.StoreKeeper;
     target.Reason=item.Reason;
     target.OperateType=item.OperateType;
     target.EquipmentNum=item.EquipmentNum;
     target.EquipmentCode=item.EquipmentCode;
     target.Remark=item.Remark;
     return target;
 }
 public ActionResult Delete()
 {
     string orderNum = WebUtil.GetFormValue<string>("OrderNum", string.Empty);
     if (!orderNum.IsEmpty())
     {
         Bill<InStorageEntity, InStorDetailEntity> bill = new InStorageOrder();
         InStorageEntity entity = new InStorageEntity();
         entity.OrderNum = orderNum;
         string returnValue = bill.Delete(entity);
         this.ReturnJson.AddProperty("d", returnValue);
     }
     return Content(this.ReturnJson.ToString());
 }
 public ActionResult DeleteBatch([ModelBinder(typeof(JsonBinder<List<string>>))] List<string> list)
 {
     if (!list.IsNullOrEmpty())
     {
         foreach (string orderNum in list)
         {
             Bill<InStorageEntity, InStorDetailEntity> bill = new InStorageOrder();
             InStorageEntity entity = new InStorageEntity();
             entity.OrderNum = orderNum;
             string returnValue = bill.Delete(entity);
             this.ReturnJson.AddProperty("d", returnValue);
         }
     }
     return Content(this.ReturnJson.ToString());
 }
 public ActionResult Audite()
 {
     string orderNum = WebUtil.GetFormValue<string>("OrderNum", string.Empty);
     int status = WebUtil.GetFormValue<int>("Status", 0);
     string reason = WebUtil.GetFormValue<string>("Reason", string.Empty);
     InStorageEntity entity = new InStorageEntity();
     entity.Status = status;
     entity.OrderNum = orderNum;
     entity.AuditUser = this.LoginUserCode;
     entity.OperateType = (int)EOpType.PC;
     entity.EquipmentCode = string.Empty;
     entity.EquipmentNum = string.Empty;
     entity.Remark = string.Empty;
     entity.Reason = reason;
     Bill<InStorageEntity, InStorDetailEntity> bill = new InStorageOrder();
     string returnValue = bill.Audite(entity);
     this.ReturnJson.AddProperty("d", returnValue);
     return Content(this.ReturnJson.ToString());
 }
Ejemplo n.º 5
0
        public ActionResult Detail()
        {
            string orderNum = WebUtil.GetQueryStringValue<string>("orderNum",string.Empty);
            string flag = WebUtil.GetQueryStringValue<string>("flag", "1");
            Bill<InStorageEntity, InStorDetailEntity> bill = new InStorageOrder();
            InStorageEntity entity = new InStorageEntity();
            entity.OrderNum = orderNum;
            entity = bill.GetOrder(entity);
            entity=entity==null ? new InStorageEntity(): entity;
            entity.InTypeLable = EnumHelper.GetEnumDesc<EInType>(entity.InType);
            entity.StatusLable = EnumHelper.GetEnumDesc<EAudite>(entity.Status);
            ViewBag.InStorage=entity;
            ViewBag.Flag = flag;

            InStorDetailEntity detail=new InStorDetailEntity();
            detail.OrderNum=orderNum;
            List<InStorDetailEntity> list=bill.GetOrderDetail(detail);
            list = list == null ? new List<InStorDetailEntity>() : list;
            ViewBag.Detail = list;
            return View();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 编辑入库单详细数量
        /// </summary>
        /// <param name="snNum"></param>
        /// <param name="num"></param>
        /// <returns></returns>
        public int EditInOrderNum(string snNum, double num)
        {
            InStorDetailEntity detail = new InStorDetailEntity();
            detail = new InStorDetailEntity();
            detail.Include(a => new { a.OrderNum, a.Num, a.InPrice });
            detail.Where(a => a.SnNum == snNum);
            detail = this.InStorDetail.GetSingle(detail);

            int line = 0;
            if (detail != null)
            {
                InStorDetailEntity editEntity = new InStorDetailEntity();
                editEntity.IncludeNum(true).IncludeAmount(true);
                editEntity.Num = num;
                editEntity.Amount = num * detail.InPrice;
                editEntity.Where(a => a.SnNum == snNum);
                line = this.InStorDetail.Update(editEntity);

                string orderNum = detail.OrderNum;
                detail = new InStorDetailEntity();
                detail.IncludeNum(true).IncludeAmount(true);
                detail.Where(a => a.OrderNum == orderNum);
                List<InStorDetailEntity> list = this.InStorDetail.GetList(detail);

                double total = list.Sum(a => a.Num);
                double amount = list.Sum(a => a.Amount);
                InStorageEntity entity = new InStorageEntity();
                entity.Num = total;
                entity.Amount=amount;
                entity.IncludeNum(true).IncludeAmount(true);
                entity.Where(a => a.OrderNum == orderNum);

                line += this.InStorage.Update(entity);
            }
            return line;
        }
Ejemplo n.º 7
0
 /// <summary>
 /// 获得某个供应商的所有订购产品数量
 /// </summary>
 /// <param name="supNum"></param>
 /// <param name="queryTime"></param>
 /// <param name="storageNum"></param>
 /// <returns></returns>
 public double GetNumBySupNum(string supNum, int queryTime, string storageNum)
 {
     InStorageEntity entity = new InStorageEntity();
     entity.IncludeNum(true);
     entity.Where("CreateTime", ECondition.Between, DateTime.Now.AddDays(-queryTime), DateTime.Now);
     entity.And("StorageNum", ECondition.Eth, storageNum);
     entity.And("SupNum", ECondition.Eth, supNum);
     entity.And("Status", ECondition.Eth, (int)EAudite.Pass);
     entity.And("IsDelete", ECondition.Eth, (int)EIsDelete.NotDelete);
     double allNum = 0;
     try
     {
         allNum = this.InStorage.Sum<double>(entity);
     }
     catch (Exception e)
     {
         allNum = 0;
         log.Info(e.Message);
     }
     return allNum;
 }
Ejemplo n.º 8
0
        public ActionResult InStorageReport()
        {
            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;

            InStorageEntity entity = new InStorageEntity();
            PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize };
            if (queryTime > 0)
            {
                entity.Where("CreateTime", ECondition.Between, DateTime.Now.AddDays(-queryTime), DateTime.Now);
            }
            if (storageNum.IsNotNull())
            {
                entity.Where("StorageNum", ECondition.Eth, storageNum);
            }
            Bill<InStorageEntity, InStorDetailEntity> bill = new InStorageOrder();
            List<InStorageEntity> listResult = bill.GetList(entity, ref pageInfo);
            listResult = listResult == null ? new List<InStorageEntity>() : listResult;
            string json = ConvertJson.ListToJson<InStorageEntity>(listResult, "List");
            this.ReturnJson.AddProperty("Data", new JsonObject(json));
            this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount);
            return Content(this.ReturnJson.ToString());
        }
Ejemplo n.º 9
0
        public ActionResult Create()
        {
            int InType = WebUtil.GetFormValue<int>("InType", 0);
            int ProductType = WebUtil.GetFormValue<int>("ProductType", 0);
            string ContractOrder = WebUtil.GetFormValue<string>("ContractOrder", string.Empty);
            string SupNum = WebUtil.GetFormValue<string>("SupNum", string.Empty);
            string SupName = WebUtil.GetFormValue<string>("SupName", string.Empty);
            string ContactName = WebUtil.GetFormValue<string>("ContactName", string.Empty);
            string Phone = WebUtil.GetFormValue<string>("Phone", string.Empty);
            DateTime OrderTime = WebUtil.GetFormValue<DateTime>("OrderTime", DateTime.Now);
            string Remark = WebUtil.GetFormValue<string>("Remark", string.Empty);

            InStorageEntity entity = new InStorageEntity();
            entity.OrderNum = SequenceProvider.GetSequence(typeof(InStorageEntity));
            entity.InType = InType;
            entity.ProductType = ProductType;
            entity.SupNum = SupNum;
            entity.SupName = SupName;
            entity.ContactName = ContactName;
            entity.Phone = Phone;
            entity.Address = "";
            entity.ContractOrder = ContractOrder;
            entity.Status = (int)EAudite.Wait;
            entity.IsDelete = (int)EIsDelete.NotDelete;
            entity.OrderTime = OrderTime;
            entity.CreateTime = DateTime.Now;
            entity.CreateUser = this.LoginUserCode;
            entity.AuditUser = string.Empty;
            entity.AuditeTime = DateTime.MinValue;
            entity.PrintUser = string.Empty;
            entity.PrintTime = DateTime.MinValue;
            entity.Reason = string.Empty;
            entity.OperateType = (int)EOpType.PC;
            entity.EquipmentNum = string.Empty;
            entity.EquipmentCode = string.Empty;
            entity.Remark = Remark;
            entity.StorageNum = this.DefaultStore;

            List<InStorDetailEntity> list = Session[CacheKey.TEMPDATA_CACHE_INSTORDETAIL] as List<InStorDetailEntity>;
            if (list.IsNullOrEmpty())
            {
                this.ReturnJson.AddProperty("Key", "1001");
                this.ReturnJson.AddProperty("Value", "请选择要入库的产品以及数量");
                return Content(this.ReturnJson.ToString());
            }
            entity.Num = list.Sum(a => a.Num);
            entity.Amount = list.Sum(a => a.Amount);
            Bill<InStorageEntity, InStorDetailEntity> bill = new InStorageOrder();
            string returnValue = bill.Create(entity, list);
            if (returnValue == EnumHelper.GetEnumDesc<EReturnStatus>(EReturnStatus.Success))
            {
                Session[CacheKey.TEMPDATA_CACHE_INSTORDETAIL] = null;
                this.ReturnJson.AddProperty("Key", "1000");
                this.ReturnJson.AddProperty("Value", "入库单创建成功");
            }
            return Content(this.ReturnJson.ToString());
        }
Ejemplo n.º 10
0
        public ActionResult Edit()
        {
            Session[CacheKey.TEMPDATA_CACHE_INSTORDETAIL] = null;
            string orderNum = WebUtil.GetQueryStringValue<string>("orderNum", string.Empty);
            Bill<InStorageEntity, InStorDetailEntity> bill = new InStorageOrder();
            InStorageEntity entity = new InStorageEntity();
            entity.OrderNum = orderNum;
            entity = bill.GetOrder(entity);
            entity = entity == null ? new InStorageEntity() : entity;
            entity.InTypeLable = EnumHelper.GetEnumDesc<EInType>(entity.InType);
            entity.StatusLable = EnumHelper.GetEnumDesc<EAudite>(entity.Status);
            ViewBag.InStorage = entity;
            ViewBag.InType = EnumHelper.GetOptions<EInType>(entity.InType, "请选择入库单类型");
            ViewBag.ProductType = EnumHelper.GetOptions<EProductType>(entity.Status, "请选择入库产品类型");

            InStorDetailEntity detail = new InStorDetailEntity();
            detail.OrderNum = orderNum;
            List<InStorDetailEntity> list = bill.GetOrderDetail(detail);
            list = list == null ? new List<InStorDetailEntity>() : list;
            if (list.IsNullOrEmpty() == false)
            {
                foreach (InStorDetailEntity item in list)
                {
                    item.Size = item.Size.IsEmpty() ? "" : item.Size;
                    item.Amount = item.Amount == 0 ? item.InPrice * item.Num : item.Amount;
                    item.TotalPrice = item.Amount;
                }
                Session[CacheKey.TEMPDATA_CACHE_INSTORDETAIL] = list;
            }
            ViewBag.Detail = list;
            return View();
        }
        public ActionResult GetList()
        {
            int status = WebUtil.GetFormValue<int>("Status", 0);
            string orderNum = WebUtil.GetFormValue<string>("OrderNum", string.Empty);
            string supName = WebUtil.GetFormValue<string>("SupName", string.Empty);
            string beginTime = WebUtil.GetFormValue<string>("beginTime", string.Empty);
            string endTime = WebUtil.GetFormValue<string>("endTime", string.Empty);
            int pageSize = WebUtil.GetFormValue<int>("PageSize", 10);
            int pageIndex = WebUtil.GetFormValue<int>("PageIndex", 1);
            int InType = WebUtil.GetFormValue<int>("InType", 0);
            string planNum = WebUtil.GetFormValue<string>("planNum", string.Empty);

            PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize };
            InStorageEntity entity = new InStorageEntity();
            if (status > 0)
            {
                entity.Where(a => a.Status == status);
            }
            if (!orderNum.IsEmpty())
            {
                entity.Where("OrderNum", ECondition.Like, "%" + orderNum + "%");
            }
            if (!supName.IsEmpty())
            {
                entity.AndBegin<InStorageEntity>()
                    .And<InStorageEntity>("SupNum", ECondition.Like, "%" + supName + "%")
                    .Or<InStorageEntity>("SupName", ECondition.Like, "%" + supName + "%")
                    .End<InStorageEntity>()
                    ;
            }
            if (!beginTime.IsEmpty() && !endTime.IsEmpty())
            {
                entity.Where("OrderTime", ECondition.Between, ConvertHelper.ToType<DateTime>(beginTime), ConvertHelper.ToType<DateTime>(endTime));
            }
            entity.And(a => a.StorageNum == this.DefaultStore);
            if (InType > 0)
            {
                entity.And(a => a.InType == InType);
            }
            if (!planNum.IsEmpty())
            {
                entity.And("ContractOrder", ECondition.Like, "%" + planNum + "%");
            }

            Bill<InStorageEntity, InStorDetailEntity> bill = new InStorageOrder();
            List<InStorageEntity> listResult = bill.GetList(entity, ref pageInfo);
            listResult = listResult == null ? new List<InStorageEntity>() : listResult;
            string json = ConvertJson.ListToJson<InStorageEntity>(listResult, "List");
            this.ReturnJson.AddProperty("Data", json);
            this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount);
            return Content(this.ReturnJson.ToString());
        }
        /// <summary>
        /// 导出Excel
        /// </summary>
        /// <returns></returns>
        public ActionResult ToExcel()
        {
            int status = WebUtil.GetFormValue<int>("Status", 0);
            string orderNum = WebUtil.GetFormValue<string>("OrderNum", string.Empty);
            string supName = WebUtil.GetFormValue<string>("SupName", string.Empty);
            string beginTime = WebUtil.GetFormValue<string>("beginTime", string.Empty);
            string endTime = WebUtil.GetFormValue<string>("endTime", string.Empty);
            int pageSize = Int32.MaxValue;
            int pageIndex = 1;
            PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize };
            InStorageEntity entity = new InStorageEntity();
            if (status > 0)
            {
                entity.Where(a => a.Status == status);
            }
            if (!orderNum.IsEmpty())
            {
                entity.Where("OrderNum", ECondition.Like, "%" + orderNum + "%");
            }
            if (!supName.IsEmpty())
            {
                entity.AndBegin<InStorageEntity>()
                    .And<InStorageEntity>("SupNum", ECondition.Like, "%" + supName + "%")
                    .Or<InStorageEntity>("SupName", ECondition.Like, "%" + supName + "%")
                    .End<InStorageEntity>()
                    ;
            }
            if (!beginTime.IsEmpty() && !endTime.IsEmpty())
            {
                entity.Where("OrderTime", ECondition.Between, ConvertHelper.ToType<DateTime>(beginTime), ConvertHelper.ToType<DateTime>(endTime));
            }
            Bill<InStorageEntity, InStorDetailEntity> bill = new InStorageOrder();
            List<InStorageEntity> listResult = bill.GetList(entity, ref pageInfo);
            listResult = listResult == null ? new List<InStorageEntity>() : listResult;
            DataTable dt = new DataTable();
            dt.Columns.Add(new DataColumn("入库单单号"));
            dt.Columns.Add(new DataColumn("入库类型"));
            dt.Columns.Add(new DataColumn("供应商"));
            dt.Columns.Add(new DataColumn("关联单号"));
            dt.Columns.Add(new DataColumn("货品总数"));
            dt.Columns.Add(new DataColumn("总金额"));
            dt.Columns.Add(new DataColumn("状态"));
            dt.Columns.Add(new DataColumn("制单人"));
            dt.Columns.Add(new DataColumn("操作方式"));
            dt.Columns.Add(new DataColumn("创建时间"));
            foreach (InStorageEntity t in listResult)
            {
                DataRow row = dt.NewRow();
                row[0] = t.OrderNum;
                row[1] = EnumHelper.GetEnumDesc<EInType>(t.InType);
                row[2] = t.SupName;
                row[3] = t.ContractOrder;
                row[4] = t.Num;
                row[5] = t.Amount.ToString("0.00")+" 元";
                row[6] = EnumHelper.GetEnumDesc<EAudite>(t.Status);
                row[7] = t.CreateUserName;
                row[8] = EnumHelper.GetEnumDesc<EOpType>(t.OperateType);
                row[9] = t.OrderTime.ToString("yyyy-MM-dd");
                dt.Rows.Add(row);
            }
            string filePath = Server.MapPath("~/UploadFiles/");
            if (!System.IO.Directory.Exists(filePath))
            {
                System.IO.Directory.CreateDirectory(filePath);
            }
            string filename = string.Format("入库单{0}.xls", DateTime.Now.ToString("yyyyMMddHHmmss"));
            NPOIExcel excel = new NPOIExcel("入库管理", "入库单", System.IO.Path.Combine(filePath, filename));
            excel.ToExcel(dt);
            this.ReturnJson.AddProperty("Path", ("/UploadFiles/" + filename).Escape());

            return Content(this.ReturnJson.ToString());
        }