Пример #1
0
 public static ReturnOrder_CE ToCE(ReturnOrderEntity item)
 {
     ReturnOrder_CE target = new ReturnOrder_CE();
     target.ID=item.ID;
     target.OrderNum=item.OrderNum;
     target.ReturnType=item.ReturnType;
     target.ProductType=item.ProductType;
     target.CusNum=item.CusNum;
     target.CusName=item.CusName;
     target.Contact=item.Contact;
     target.Phone=item.Phone;
     target.Address=item.Address;
     target.ContractOrder=item.ContractOrder;
     target.Num=item.Num;
     target.Amount=item.Amount;
     target.Weight=item.Weight;
     target.Status=item.Status;
     target.IsDelete=item.IsDelete;
     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.Reason=item.Reason;
     target.OperateType=item.OperateType;
     target.EquipmentNum=item.EquipmentNum;
     target.EquipmentCode=item.EquipmentCode;
     target.Remark=item.Remark;
     return target;
 }
Пример #2
0
 /// <summary>
 /// 用于判断该订单是否已经正在出库
 /// </summary>
 /// <returns></returns>
 public ReturnOrderEntity CheckOrder(string orderNum)
 {
     ReturnDetailEntity entity = new ReturnDetailEntity() { ContractOrder = orderNum };
     ReturnOrderEntity order = new ReturnOrderEntity();
     order.Where(a => a.Status == (int)EAudite.Wait);
     order.IncludeAll();
     entity.Left<ReturnOrderEntity>(order, new Params<string, string>() { Item1 = "OrderNum", Item2 = "OrderNum" });
     order = this.ReturnOrder.GetSingle(order);
     return order;
 }
Пример #3
0
 public ActionResult Edit()
 {
     string orderNum = WebUtil.GetQueryStringValue<string>("OrderNum", string.Empty);
     Bill<ReturnOrderEntity, ReturnDetailEntity> bill = new ReturnOrder();
     ReturnOrderEntity entity = new ReturnOrderEntity();
     entity.OrderNum = orderNum;
     entity = bill.GetOrder(entity);
     entity = entity.IsNull() ? new ReturnOrderEntity() : entity;
     ViewBag.Entity = entity;
     ViewBag.ReturnType = EnumHelper.GetOptions<EReturnType>(entity.ReturnType, "请选择出库单类型");
     ViewBag.ProductType = EnumHelper.GetOptions<EProductType>(entity.ProductType, "请选择出库产品类型");
     return View();
 }
 public ActionResult Delete()
 {
     string orderNum = WebUtil.GetFormValue<string>("OrderNum", string.Empty);
     if (!orderNum.IsEmpty())
     {
         Bill<ReturnOrderEntity, ReturnDetailEntity> bill = new ReturnOrder();
         ReturnOrderEntity entity = new ReturnOrderEntity();
         entity.OrderNum = orderNum;
         string returnValue = bill.Delete(entity);
         this.ReturnJson.AddProperty("d", returnValue);
     }
     return Content(this.ReturnJson.ToString());
 }
Пример #5
0
 /// <summary>
 /// 获得所有退货数量
 /// </summary>
 /// <returns></returns>
 public int GetAllNum()
 {
     ReturnOrderEntity entity = new ReturnOrderEntity();
     entity.IncludeNum(true);
     entity.Where("Status", ECondition.Eth, (int)EAudite.Pass);
     entity.And("IsDelete", ECondition.Eth, (int)EIsDelete.NotDelete);
     int allNum = 0;
     try
     {
         allNum = this.ReturnOrder.Sum<int>(entity);
     }
     catch (Exception e)
     {
         allNum = 0;
         log.Info(e.Message);
     }
     return allNum;
 }
 public ActionResult Audit()
 {
     string OrderNum = WebUtil.GetFormValue<string>("OrderNum", string.Empty);
     int Status = WebUtil.GetFormValue<int>("Status");
     string Reason = WebUtil.GetFormValue<string>("Reason", string.Empty);
     ReturnOrderEntity entity = new ReturnOrderEntity();
     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<ReturnOrderEntity, ReturnDetailEntity> bill = new ReturnOrder();
     string returnValue = bill.Audite(entity);
     this.ReturnJson.AddProperty("d", returnValue);
     return Content(this.ReturnJson.ToString());
 }
Пример #7
0
        public ActionResult Detail()
        {
            string orderNum = WebUtil.GetQueryStringValue<string>("OrderNum", string.Empty);
            string flag = WebUtil.GetQueryStringValue<string>("flag", string.Empty);
            Bill<ReturnOrderEntity, ReturnDetailEntity> bill = new ReturnOrder();
            ReturnOrderEntity entity = new ReturnOrderEntity();
            entity.OrderNum = orderNum;
            entity = bill.GetOrder(entity);
            entity = entity.IsNull() ? new ReturnOrderEntity() : entity;
            ViewBag.Entity = entity;
            ViewBag.ReturnType = EnumHelper.GetEnumDesc<EReturnType>(entity.ReturnType);
            ViewBag.Status = EnumHelper.GetEnumDesc<EAudite>(entity.Status);

            ReturnDetailEntity detail = new ReturnDetailEntity();
            detail.OrderNum = orderNum;
            List<ReturnDetailEntity> list = bill.GetOrderDetail(detail);
            list = list.IsNull() ? new List<ReturnDetailEntity>() : list;
            ViewBag.Detail = list;
            ViewBag.Flag = flag;
            return View();
        }
Пример #8
0
        public ActionResult ReturnReportList()
        {
            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;

            ReturnProvider provider = new ReturnProvider();
            ReturnOrderEntity entity = new ReturnOrderEntity();
            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);
            }
            List<ReturnOrderEntity> listResult = provider.GetList(entity, ref pageInfo);
            listResult = listResult == null ? new List<ReturnOrderEntity>() : listResult;
            string json = ConvertJson.ListToJson<ReturnOrderEntity>(listResult, "List");
            this.ReturnJson.AddProperty("Data", new JsonObject(json));
            this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount);
            return Content(this.ReturnJson.ToString());
        }
Пример #9
0
        public ActionResult Create([ModelBinder(typeof(JsonBinder<List<ReturnDetailEntity>>))] List<ReturnDetailEntity> list)
        {
            string OrderNum = WebUtil.GetFormValue<string>("OrderNum", string.Empty);
            int ReturnType = WebUtil.GetFormValue<int>("ReturnType", (int)EReturnType.Sell);
            int ProductType = WebUtil.GetFormValue<int>("ProductType", (int)EProductType.Goods);
            string ContractOrder = WebUtil.GetFormValue<string>("ContractOrder", string.Empty);
            string CusNum = WebUtil.GetFormValue<string>("CusNum", string.Empty);
            string CusName = WebUtil.GetFormValue<string>("CusName", string.Empty);
            string Contact = WebUtil.GetFormValue<string>("Contact", string.Empty);
            string Phone = WebUtil.GetFormValue<string>("Phone", string.Empty);
            string Address = WebUtil.GetFormValue<string>("Address", string.Empty);
            DateTime CreateTime = WebUtil.GetFormValue<DateTime>("CreateTime", DateTime.Now);
            string Remark = WebUtil.GetFormValue<string>("Remark", string.Empty);

            ReturnOrderEntity entity = new ReturnOrderEntity();
            entity.OrderNum = OrderNum.IsEmpty() ? SequenceProvider.GetSequence(typeof(ReturnOrderEntity)) : OrderNum;
            List<OutStoDetailEntity> listOrder = Session[CacheKey.TEMPDATE_CACHE_RETURNPRODUCTDETAIL] as List<OutStoDetailEntity>;
            string StorageNum = ResourceManager.GetSettingEntity("STORE_DEFAULT_PRODUCT").Value;
            if (!list.IsNullOrEmpty() && !listOrder.IsNullOrEmpty())
            {
                list.ForEach(a =>
                {
                    OutStoDetailEntity detail = listOrder.SingleOrDefault(b => b.ProductNum == a.ProductNum && b.BarCode == a.BarCode && b.LocalNum == a.LocalNum && b.StorageNum == StorageNum && b.BatchNum==a.BatchNum);
                    if (detail != null)
                    {
                        a.ProductName = detail.ProductName;
                        a.BatchNum = detail.BatchNum;
                        a.OutPrice = detail.OutPrice;
                        a.Num = detail.Num;
                        a.Amount = detail.Amount;
                        a.BackAmount = a.OutPrice * a.BackNum;
                        a.CreateTime = DateTime.Now;
                        a.StorageNum = StorageNum;
                        a.ContractOrder = ContractOrder;
                    }
                    a.SnNum = SequenceProvider.GetSequence(typeof(ReturnDetailEntity));
                });
                entity.ReturnType = ReturnType;
                entity.ProductType = ProductType;
                entity.CusNum = CusNum;
                entity.CusName = CusName;
                entity.Phone = Phone;
                entity.Contact = Contact;
                entity.Address = Address;
                entity.Num = list.Sum(a => a.BackNum);
                entity.Amount = list.Sum(a => a.BackAmount);
                entity.Status = (int)EAudite.Wait;
                entity.IsDelete = (int)EIsDelete.NotDelete;
                entity.CreateTime = CreateTime;
                entity.CreateUser = this.LoginUser.UserCode;
                entity.OperateType = (int)EOpType.PC;
                entity.EquipmentNum = string.Empty;
                entity.EquipmentCode = string.Empty;
                entity.Remark = Remark;
                entity.ContractOrder = ContractOrder;
                entity.StorageNum = this.DefaultStore;

                Bill<ReturnOrderEntity, ReturnDetailEntity> bill = new ReturnOrder();
                //如果单号不存在则为创建
                if (OrderNum.IsEmpty())
                {
                    string returnValue = bill.Create(entity, list);
                    if (returnValue == EnumHelper.GetEnumDesc<EReturnStatus>(EReturnStatus.Success))
                    {
                        this.ReturnJson.AddProperty("d", "1000");
                    }
                    else
                    {
                        this.ReturnJson.AddProperty("d", "1001");
                    }
                }
                else
                {
                    string returnValue = bill.EditOrder(entity, list);
                    this.ReturnJson.AddProperty("d", returnValue);
                }
            }
            else
            {
                this.ReturnJson.AddProperty("d", "1005");
            }
            return Content(this.ReturnJson.ToString());
        }
Пример #10
0
        public ActionResult Edit()
        {
            //退货单号
            string OrderNum = WebUtil.GetFormValue<string>("OrderNum", string.Empty);
            if (!OrderNum.IsEmpty())
            {
                //退货单部分
                Bill<ReturnOrderEntity, ReturnDetailEntity> bill = new ReturnOrder();
                ReturnOrderEntity entity = new ReturnOrderEntity();
                entity.OrderNum = OrderNum;
                entity = bill.GetOrder(entity);
                if (entity.Status != (int)EAudite.Wait)
                {
                    this.ReturnJson.AddProperty("d", "1001");
                    return Content(this.ReturnJson.ToString());
                }
                ReturnDetailEntity detail = new ReturnDetailEntity();
                detail.OrderNum = OrderNum;
                List<ReturnDetailEntity> listDetails = bill.GetOrderDetail(detail);
                //出货单部分
                Bill<OutStorageEntity, OutStoDetailEntity> provider = new OutStorageOrder();
                OutStoDetailEntity items = new OutStoDetailEntity();
                items.OrderNum = entity.ContractOrder;
                List<OutStoDetailEntity> list = provider.GetOrderDetail(items);

                //已经退货部分
                ReturnProvider returnProvider = new ReturnProvider();
                List<ReturnDetailEntity> listResult = returnProvider.GetDetailByOrder(entity.ContractOrder);

                if (!list.IsNullOrEmpty())
                {
                    list.ForEach(a =>
                    {
                        ReturnDetailEntity item = listDetails.FirstOrDefault(b => b.BarCode == a.BarCode && b.ProductNum == a.ProductNum && b.LocalNum == a.LocalNum && b.StorageNum == a.StorageNum);
                        if (item != null)
                        {
                            a.Qty = item.BackNum;
                        }
                        a.BackNum = listResult.Where(b => b.BarCode == a.BarCode && b.ProductNum == a.ProductNum && b.LocalNum == a.LocalNum && b.StorageNum == a.StorageNum).Sum(b => b.BackNum);
                    });
                }
                Session[CacheKey.TEMPDATE_CACHE_RETURNPRODUCTDETAIL] = list;
                string json = ConvertJson.ListToJson<OutStoDetailEntity>(list, "List");
                this.ReturnJson.AddProperty("data", json);
            }
            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<ReturnOrderEntity, ReturnDetailEntity> bill = new ReturnOrder();
             ReturnOrderEntity entity = new ReturnOrderEntity();
             entity.OrderNum = orderNum;
             string returnValue = bill.Delete(entity);
             this.ReturnJson.AddProperty("d", returnValue);
         }
     }
     return Content(this.ReturnJson.ToString());
 }
        public ActionResult ToExcel()
        {
            int status = WebUtil.GetFormValue<int>("Status", 0);
            string orderNum = WebUtil.GetFormValue<string>("OrderNum", string.Empty);
            string beginTime = WebUtil.GetFormValue<string>("beginTime", string.Empty);
            string endTime = WebUtil.GetFormValue<string>("endTime", string.Empty);
            int pageSize = Int32.MaxValue;
            int pageIndex = WebUtil.GetFormValue<int>("PageIndex", 1);
            PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize };
            ReturnOrderEntity entity = new ReturnOrderEntity();
            if (status > 0)
            {
                entity.Where(a => a.Status == status);
            }
            if (!orderNum.IsEmpty())
            {
                entity.Where("OrderNum", ECondition.Like, "%" + orderNum + "%");
            }
            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);
            Bill<ReturnOrderEntity, ReturnDetailEntity> bill = new ReturnOrder();
            List<ReturnOrderEntity> listResult = bill.GetList(entity, ref pageInfo);
            listResult = listResult == null ? new List<ReturnOrderEntity>() : listResult;

            if (!listResult.IsNullOrEmpty())
            {
                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("创建时间"));
                foreach (ReturnOrderEntity t in listResult)
                {
                    DataRow row = dt.NewRow();
                    row[0] = t.OrderNum;
                    row[1] = EnumHelper.GetEnumDesc<ECheckType>(t.ReturnType);
                    row[2] = t.Num;
                    row[3] = t.ContractOrder;
                    row[4] = EnumHelper.GetEnumDesc<EAudite>(t.Status);
                    row[5] = t.CreateUserName;
                    row[6] = EnumHelper.GetEnumDesc<EOpType>(t.OperateType);
                    row[7] = t.CreateTime.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());
            }
            else
            {
                this.ReturnJson.AddProperty("d", "无数据导出!");
            }
            return Content(this.ReturnJson.ToString());
        }
 public ActionResult GetList()
 {
     int status = WebUtil.GetFormValue<int>("Status", 0);
     string orderNum = WebUtil.GetFormValue<string>("OrderNum", 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);
     PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize };
     ReturnOrderEntity entity = new ReturnOrderEntity();
     if (status > 0)
     {
         entity.Where(a => a.Status == status);
     }
     if (!orderNum.IsEmpty())
     {
         entity.Where("OrderNum", ECondition.Like, "%" + orderNum + "%");
     }
     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);
     Bill<ReturnOrderEntity, ReturnDetailEntity> bill = new ReturnOrder();
     List<ReturnOrderEntity> listResult = bill.GetList(entity, ref pageInfo);
     listResult = listResult == null ? new List<ReturnOrderEntity>() : listResult;
     string json = ConvertJson.ListToJson<ReturnOrderEntity>(listResult, "List");
     this.ReturnJson.AddProperty("Data", json);
     this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount);
     return Content(this.ReturnJson.ToString());
 }
Пример #14
0
 /// <summary>
 /// 根据关联单号查询已经退货的的情况
 /// </summary>
 /// <param name="orderNum"></param>
 /// <returns></returns>
 public List<ReturnDetailEntity> GetDetailByOrder(string orderNum)
 {
     ReturnDetailEntity entity = new ReturnDetailEntity();
     entity.IncludeAll();
     ReturnOrderEntity order = new ReturnOrderEntity();
     entity.Left<ReturnOrderEntity>(order, new Params<string, string>() { Item1 = "OrderNum", Item2 = "OrderNum" });
     order.Where(a => a.Status == (int)EAudite.Pass);
     order.Where(a => a.ContractOrder == orderNum);
     List<ReturnDetailEntity> list = this.ReturnDetail.GetList(entity);
     return list;
 }
Пример #15
0
 /// <summary>
 /// 查询单据分页
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="pageInfo"></param>
 /// <returns></returns>
 public List<ReturnOrderEntity> GetList(ReturnOrderEntity entity, ref PageInfo pageInfo)
 {
     entity.IncludeAll();
     entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete);
     entity.And("Status", ECondition.Eth, (int)EAudite.Pass);
     entity.OrderBy(a => a.ID, EOrderBy.DESC);
     ReturnDetailEntity detail = new ReturnDetailEntity();
     detail.Include(a => new { ProductName = a.ProductName, BarCode = a.BarCode, ProductNum = a.ProductNum });
     entity.Left<ReturnDetailEntity>(detail, new Params<string, string>() { Item1 = "OrderNum", Item2 = "OrderNum" });
     int rowCount = 0;
     List<ReturnOrderEntity> listResult = this.ReturnOrder.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount);
     int allNum = GetAllNum();
     if (!listResult.IsNullOrEmpty())
     {
         foreach (ReturnOrderEntity item in listResult)
         {
             item.NumPCT = ((float)item.Num * 100.00f) / allNum;
         }
     }
     pageInfo.RowCount = rowCount;
     return listResult;
 }