示例#1
0
        /// <summary>
        /// 新增出库单
        /// </summary>
        /// <returns></returns>
        public ActionResult Create()
        {
            string                    CompanyID = WebUtil.GetFormValue <string>("CompanyID", string.Empty);
            OutStorageEntity          entity    = WebUtil.GetFormObject <OutStorageEntity>("Entity");
            List <OutStoDetailEntity> list      = WebUtil.GetFormObject <List <OutStoDetailEntity> >("List");

            entity.SnNum         = ConvertHelper.NewGuid();
            entity.ProductType   = (int)EProductType.Goods;
            entity.Status        = (int)EAudite.Wait;
            entity.IsDelete      = (int)EIsDelete.NotDelete;
            entity.CreateTime    = DateTime.Now;
            entity.CompanyID     = entity.CompanyID.IsEmpty() ? CompanyID : entity.CompanyID;
            entity.EquipmentNum  = "";
            entity.EquipmentCode = "";

            Bill <OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder(CompanyID);
            string     returnValue = bill.Create(entity, list);
            DataResult result      = new DataResult();

            if (EnumHelper.GetEnumDesc <EReturnStatus>(EReturnStatus.Success) == returnValue)
            {
                result.Code    = (int)EResponseCode.Success;
                result.Message = "出库单创建成功";
            }
            else
            {
                result.Code    = (int)EResponseCode.Exception;
                result.Message = "出库单创建失败";
            }
            return(Content(JsonHelper.SerializeObject(result)));
        }
示例#2
0
        public ActionResult Print()
        {
            string orderNum = WebUtil.GetQueryStringValue <string>("orderNum", string.Empty);
            Bill <OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder();
            OutStorageEntity entity = new OutStorageEntity();

            entity.OrderNum = orderNum;
            entity          = bill.GetOrder(entity);
            entity          = entity.IsNull() ? new OutStorageEntity() : entity;
            ViewBag.Entity  = entity;

            OutStoDetailEntity detail = new OutStoDetailEntity();

            detail.OrderNum = orderNum;
            List <OutStoDetailEntity> listResult = bill.GetOrderDetail(detail);

            listResult = listResult.IsNull() ? new List <OutStoDetailEntity>() : listResult;
            OrderProvider orderProvider = new OrderProvider();

            foreach (OutStoDetailEntity item in listResult)
            {
                OrderDetailEntity orderDetail = new OrderDetailEntity();
                orderDetail.Where(a => a.SnNum == item.ContractSn).And(a => a.OrderNum == item.ContractOrder);
                orderDetail = orderProvider.GetOrderDetail(orderDetail);
                if (orderDetail != null)
                {
                    item.Qty = orderDetail.Num;
                }
            }
            ViewBag.Detail = listResult;
            return(View());
        }
示例#3
0
        /// <summary>
        /// 设置出库单打印信息
        /// </summary>
        /// <returns></returns>
        public ActionResult Print()
        {
            string           CompanyID = WebUtil.GetFormValue <string>("CompanyID");
            string           SnNum     = WebUtil.GetFormValue <string>("SnNum");
            string           PrintUser = WebUtil.GetFormValue <string>("PrintUser");
            DateTime         PrintTime = WebUtil.GetFormValue <DateTime>("PrintTime", DateTime.Now);
            OutStorageEntity entity    = new OutStorageEntity();

            entity.SnNum     = SnNum;
            entity.CompanyID = CompanyID;
            entity.PrintUser = PrintUser;
            entity.PrintTime = PrintTime;

            Bill <OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder(CompanyID);

            string     returnValue = bill.Print(entity);
            DataResult result      = new DataResult();

            if (EnumHelper.GetEnumDesc <EReturnStatus>(EReturnStatus.Success) == returnValue)
            {
                result.Code    = (int)EResponseCode.Success;
                result.Message = "打印数据设置成功";
            }
            else
            {
                result.Code    = (int)EResponseCode.Exception;
                result.Message = "打印数据设置失败";
            }
            return(Content(JsonHelper.SerializeObject(result)));
        }
 public ActionResult Delete()
 {
     string OrderNum = WebUtil.GetFormValue<string>("OrderNum", string.Empty);
     OutStorageEntity entity = new OutStorageEntity();
     entity.OrderNum = OrderNum;
     Bill<OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder();
     string returnValue = bill.Delete(entity);
     this.ReturnJson.AddProperty("d", returnValue);
     return Content(this.ReturnJson.ToString());
 }
示例#5
0
        /// <summary>
        /// 查询出库单详细分页
        /// </summary>
        /// <returns></returns>
        public ActionResult GetDetailList()
        {
            string CompanyID   = WebUtil.GetFormValue <string>("CompanyID");
            string OrderNum    = WebUtil.GetFormValue <string>("OrderNum");
            string BarCode     = WebUtil.GetFormValue <string>("BarCode");
            string ProductName = WebUtil.GetFormValue <string>("ProductName");
            string StorageNum  = WebUtil.GetFormValue <string>("StorageNum");
            string CusNum      = WebUtil.GetFormValue <string>("CusNum");
            string CusName     = WebUtil.GetFormValue <string>("CusName");
            string BeginTime   = WebUtil.GetFormValue <string>("BeginTime");
            string EndTime     = WebUtil.GetFormValue <string>("EndTime");
            int    Status      = WebUtil.GetFormValue <int>("Status", 0);
            int    OutType     = WebUtil.GetFormValue <int>("OutType", 0);
            string CarrierNum  = WebUtil.GetFormValue <string>("CarrierNum");
            string CarrierName = WebUtil.GetFormValue <string>("CarrierName");
            string LogisticsNo = WebUtil.GetFormValue <string>("LogisticsNo");

            int PageIndex = WebUtil.GetFormValue <int>("PageIndex", 1);
            int PageSize  = WebUtil.GetFormValue <int>("PageSize", 10);

            OutStoDetailEntity entity = new OutStoDetailEntity();

            entity.CompanyID   = CompanyID;
            entity.BarCode     = BarCode;
            entity.ProductName = ProductName;
            entity.StorageNum  = StorageNum;
            entity.CusNum      = CusNum;
            entity.CusName     = CusName;
            entity.BeginTime   = BeginTime;
            entity.EndTime     = EndTime;
            entity.Status      = Status;
            entity.OutType     = OutType;
            entity.OrderNum    = OrderNum;
            entity.CarrierNum  = CarrierNum;
            entity.CarrierName = CarrierName;
            entity.LogisticsNo = LogisticsNo;


            PageInfo pageInfo = new PageInfo()
            {
                PageIndex = PageIndex, PageSize = PageSize
            };
            Bill <OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder(CompanyID);
            List <OutStoDetailEntity>           listResult   = bill.GetDetailList(entity, ref pageInfo);
            DataListResult <OutStoDetailEntity> dataResult   = new DataListResult <OutStoDetailEntity>()
            {
                Code     = (int)EResponseCode.Success,
                Message  = "响应成功",
                Result   = listResult,
                PageInfo = pageInfo
            };

            return(Content(JsonHelper.SerializeObject(dataResult)));
        }
        public ActionResult Delete()
        {
            string           OrderNum = WebUtil.GetFormValue <string>("OrderNum", string.Empty);
            OutStorageEntity entity   = new OutStorageEntity();

            entity.OrderNum = OrderNum;
            Bill <OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder();
            string returnValue = bill.Delete(entity);

            this.ReturnJson.AddProperty("d", returnValue);
            return(Content(this.ReturnJson.ToString()));
        }
        public ActionResult Load()
        {
            string OrderNum = WebUtil.GetFormValue <string>("OrderNum", string.Empty);

            if (!OrderNum.IsEmpty())
            {
                ReturnProvider    provider   = new ReturnProvider();
                ReturnOrderEntity backEntity = provider.CheckOrder(OrderNum);
                if (backEntity != null && backEntity.Status == (int)EAudite.Wait)
                {
                    this.ReturnJson.AddProperty("d", "1001");
                    return(Content(this.ReturnJson.ToString()));
                }
                Bill <OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder();
                OutStorageEntity entity = new OutStorageEntity();
                entity.OrderNum = OrderNum;
                entity          = bill.GetOrder(entity);
                if (entity.IsNotNull())
                {
                    if (entity.Status != (int)EAudite.Pass)
                    {
                        this.ReturnJson.AddProperty("d", "1002");
                        return(Content(this.ReturnJson.ToString()));
                    }
                    this.ReturnJson.AddProperty("CusNum", entity.CusNum);
                    this.ReturnJson.AddProperty("CusName", entity.CusName);
                    this.ReturnJson.AddProperty("Address", entity.Address);
                    this.ReturnJson.AddProperty("Contact", entity.Contact);
                    this.ReturnJson.AddProperty("Phone", entity.Phone);
                    //加载详细内容
                    OutStoDetailEntity detail = new OutStoDetailEntity();
                    detail.OrderNum = OrderNum;
                    List <OutStoDetailEntity> list = bill.GetOrderDetail(detail);
                    list = list.IsNull() ? new List <OutStoDetailEntity>() : list;
                    //获得已经退货的数量
                    List <ReturnDetailEntity> listResult = provider.GetDetailByOrder(OrderNum);
                    if (!listResult.IsNullOrEmpty())
                    {
                        list.ForEach(a =>
                        {
                            double qty = listResult.Where(b => b.BarCode == a.BarCode && b.ProductNum == a.ProductNum && b.LocalNum == a.LocalNum && b.StorageNum == a.StorageNum && b.BatchNum == a.BatchNum).Sum(b => b.BackNum);
                            a.BackNum  = qty;
                        });
                    }
                    Session[CacheKey.TEMPDATE_CACHE_RETURNPRODUCTDETAIL] = list;
                    string json = ConvertJson.ListToJson <OutStoDetailEntity>(list, "List");
                    this.ReturnJson.AddProperty("data", json);
                }
            }
            return(Content(this.ReturnJson.ToString()));
        }
示例#8
0
        public ActionResult Detail()
        {
            string orderNum = WebUtil.GetQueryStringValue <string>("orderNum", string.Empty);
            string flag     = WebUtil.GetQueryStringValue <string>("flag", string.Empty);
            Bill <OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder();
            OutStorageEntity entity = new OutStorageEntity();

            entity.OrderNum = orderNum;
            entity          = bill.GetOrder(entity);
            entity          = entity.IsNull() ? new OutStorageEntity() : entity;
            ViewBag.Entity  = entity;
            ViewBag.OutType = EnumHelper.GetEnumDesc <EOutType>(entity.OutType);
            ViewBag.Status  = EnumHelper.GetEnumDesc <EAudite>(entity.Status);


            OutStoDetailEntity detail = new OutStoDetailEntity();

            detail.OrderNum = orderNum;
            List <OutStoDetailEntity> listResult = bill.GetOrderDetail(detail);

            listResult = listResult.IsNull() ? new List <OutStoDetailEntity>() : listResult;

            ProductProvider      provider = new ProductProvider();
            List <ProductEntity> list     = provider.GetListByCache();

            list = list.IsNull() ? new List <ProductEntity>() : list;
            listResult.ForEach(a =>
            {
                ProductEntity product = null;
                if (a.BarCode.IsEmpty())
                {
                    product = list.SingleOrDefault(b => b.SnNum == a.ProductNum);
                }
                else
                {
                    product = list.SingleOrDefault(b => b.SnNum == a.ProductNum && b.BarCode == a.BarCode);
                }
                if (product.IsNotNull())
                {
                    a.Size = product.Size.IsEmpty() ? "" : product.Size;
                }
                else
                {
                    a.Size = "";
                }
            });
            ViewBag.Detail = listResult;
            ViewBag.Flag   = flag;
            return(View());
        }
 public ActionResult DeleteBatch([ModelBinder(typeof(JsonBinder <List <string> >))] List <string> list)
 {
     if (!list.IsNullOrEmpty())
     {
         foreach (string orderNum in list)
         {
             OutStorageEntity entity = new OutStorageEntity();
             entity.OrderNum = orderNum;
             Bill <OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder();
             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)
         {
             OutStorageEntity entity = new OutStorageEntity();
             entity.OrderNum = orderNum;
             Bill<OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder();
             string returnValue = bill.Delete(entity);
             this.ReturnJson.AddProperty("d", returnValue);
         }
     }
     return Content(this.ReturnJson.ToString());
 }
示例#11
0
        public ActionResult Edit()
        {
            string orderNum = WebUtil.GetQueryStringValue <string>("orderNum", string.Empty);
            Bill <OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder();
            OutStorageEntity entity = new OutStorageEntity();

            entity.OrderNum     = orderNum;
            entity              = bill.GetOrder(entity);
            entity              = entity.IsNull() ? new OutStorageEntity() : entity;
            ViewBag.Entity      = entity;
            ViewBag.OutType     = EnumHelper.GetOptions <EInType>(entity.OutType, "请选择入库单类型");
            ViewBag.ProductType = EnumHelper.GetOptions <EProductType>(entity.ProductType, "请选择入库产品类型");

            OutStoDetailEntity detail = new OutStoDetailEntity();

            detail.OrderNum = orderNum;
            List <OutStoDetailEntity> listResult = bill.GetOrderDetail(detail);

            listResult = listResult.IsNull() ? new List <OutStoDetailEntity>() : listResult;

            ProductProvider      provider = new ProductProvider();
            List <ProductEntity> list     = provider.GetListByCache();

            list = list.IsNull() ? new List <ProductEntity>() : list;
            listResult.ForEach(a =>
            {
                ProductEntity product = null;
                if (a.BarCode.IsEmpty())
                {
                    product = list.SingleOrDefault(b => b.SnNum == a.ProductNum);
                }
                else
                {
                    product = list.SingleOrDefault(b => b.SnNum == a.ProductNum && b.BarCode == a.BarCode);
                }
                a.OutPrice = product != null ? product.OutPrice : 0;
                if (product != null)
                {
                    a.Size = product.Size.IsEmpty() ? "" : product.Size;
                }
                else
                {
                    a.Size = "";
                }
            });
            Session[CacheKey.TEMPDATA_CACHE_OUTSTORDETAIL] = listResult;
            return(View());
        }
示例#12
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()));
        }
示例#13
0
        /// <summary>
        /// 查询出库单的打印数据源
        /// </summary>
        /// <returns></returns>
        public ActionResult GetPrintDataSource()
        {
            string CompanyID = WebUtil.GetFormValue <string>("CompanyID");
            string SnNum     = WebUtil.GetFormValue <string>("SnNum");

            Bill <OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder(CompanyID);
            DataSet ds = bill.GetPrint(SnNum);

            DataResult <DataSet> dataResult = new DataResult <DataSet>();

            dataResult.Code    = (int)EResponseCode.Success;
            dataResult.Message = "响应成功";
            dataResult.Result  = ds;

            return(Content(JsonHelper.SerializeObject(dataResult)));
        }
示例#14
0
        public ActionResult Detail()
        {
            string orderNum = WebUtil.GetQueryStringValue<string>("orderNum", string.Empty);
            string flag = WebUtil.GetQueryStringValue<string>("flag", string.Empty);
            Bill<OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder();
            OutStorageEntity entity = new OutStorageEntity();
            entity.OrderNum = orderNum;
            entity = bill.GetOrder(entity);
            entity = entity.IsNull() ? new OutStorageEntity() : entity;
            ViewBag.Entity = entity;
            ViewBag.OutType = EnumHelper.GetEnumDesc<EOutType>(entity.OutType);
            ViewBag.Status = EnumHelper.GetEnumDesc<EAudite>(entity.Status);

            OutStoDetailEntity detail = new OutStoDetailEntity();
            detail.OrderNum = orderNum;
            List<OutStoDetailEntity> listResult = bill.GetOrderDetail(detail);
            listResult = listResult.IsNull() ? new List<OutStoDetailEntity>() : listResult;

            ProductProvider provider = new ProductProvider();
            List<ProductEntity> list = provider.GetListByCache();
            list = list.IsNull() ? new List<ProductEntity>() : list;
            listResult.ForEach(a =>
            {
                ProductEntity product = null;
                if (a.BarCode.IsEmpty())
                {
                    product = list.SingleOrDefault(b => b.SnNum == a.ProductNum);
                }
                else
                {
                    product = list.SingleOrDefault(b => b.SnNum == a.ProductNum && b.BarCode == a.BarCode);
                }
                if (product.IsNotNull())
                {
                    a.Size = product.Size.IsEmpty() ? "" : product.Size;
                }
                else
                {
                    a.Size = "";
                }
            });
            ViewBag.Detail = listResult;
            ViewBag.Flag = flag;
            return View();
        }
示例#15
0
        /// <summary>
        /// 审核出库单
        /// </summary>
        /// <returns></returns>
        public ActionResult Audite()
        {
            string SnNum         = WebUtil.GetFormValue <string>("SnNum");
            string CompanyID     = WebUtil.GetFormValue <string>("CompanyID", string.Empty);
            int    Status        = WebUtil.GetFormValue <int>("Status", (int)EAudite.NotPass);
            string AuditUser     = WebUtil.GetFormValue <string>("AuditUser", string.Empty);
            string Reason        = WebUtil.GetFormValue <string>("Reason", string.Empty);
            int    OperateType   = WebUtil.GetFormValue <int>("OperateType", 0);
            string EquipmentNum  = WebUtil.GetFormValue <string>("EquipmentNum");
            string EquipmentCode = WebUtil.GetFormValue <string>("EquipmentCode");
            string Remark        = WebUtil.GetFormValue <string>("Remark");

            OutStorageEntity entity = new OutStorageEntity();

            entity.SnNum         = SnNum;
            entity.CompanyID     = CompanyID;
            entity.Status        = Status;
            entity.AuditUser     = AuditUser;
            entity.Reason        = Reason;
            entity.OperateType   = OperateType;
            entity.EquipmentNum  = EquipmentNum;
            entity.EquipmentCode = EquipmentCode;
            entity.Remark        = Remark;

            Bill <OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder(CompanyID);
            string     returnValue = bill.Audite(entity);
            DataResult result      = new DataResult();

            if ("1000" == returnValue)
            {
                result.Code    = (int)EResponseCode.Success;
                result.Message = "操作成功";
            }
            else if ("1001" == returnValue)
            {
                result.Code    = (int)EResponseCode.Exception;
                result.Message = "出库单不存在";
            }
            else if ("1002" == returnValue)
            {
                result.Code    = (int)EResponseCode.Exception;
                result.Message = "出库单已经审核";
            }
            return(Content(JsonHelper.SerializeObject(result)));
        }
示例#16
0
        /// <summary>
        /// 根据出库单唯一编号查询出库单详细列表
        /// </summary>
        /// <returns></returns>
        public ActionResult GetDetail()
        {
            string             SnNum     = WebUtil.GetFormValue <string>("SnNum");
            string             CompanyID = WebUtil.GetFormValue <string>("CompanyID", string.Empty);
            OutStoDetailEntity entity    = new OutStoDetailEntity();

            entity.OrderSnNum = SnNum;
            entity.CompanyID  = CompanyID;
            Bill <OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder(CompanyID);
            List <OutStoDetailEntity> list = bill.GetOrderDetail(entity);

            DataResult <List <OutStoDetailEntity> > dataResult = new DataResult <List <OutStoDetailEntity> >();

            dataResult.Code    = (int)EResponseCode.Success;
            dataResult.Message = "响应成功";
            dataResult.Result  = list;
            return(Content(JsonHelper.SerializeObject(dataResult)));
        }
 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);
     OutStorageEntity entity = new OutStorageEntity();
     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<OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder();
     string returnValue = bill.Audite(entity);
     this.ReturnJson.AddProperty("d", returnValue);
     return Content(this.ReturnJson.ToString());
 }
示例#18
0
        /// <summary>
        /// 编辑出库单主体信息
        /// </summary>
        /// <returns></returns>
        public ActionResult EditOrder()
        {
            string           CompanyID = WebUtil.GetFormValue <string>("CompanyID", string.Empty);
            OutStorageEntity entity    = WebUtil.GetFormObject <OutStorageEntity>("Entity");
            Bill <OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder(CompanyID);
            string     returnValue = bill.EditOrder(entity);
            DataResult result      = new DataResult();

            if (EnumHelper.GetEnumDesc <EReturnStatus>(EReturnStatus.Success) == returnValue)
            {
                result.Code    = (int)EResponseCode.Success;
                result.Message = "出库单主体编辑成功";
            }
            else
            {
                result.Code    = (int)EResponseCode.Exception;
                result.Message = "出库单主体编辑失败";
            }
            return(Content(JsonHelper.SerializeObject(result)));
        }
        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);
            OutStorageEntity entity   = new OutStorageEntity();

            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 <OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder();
            string returnValue = bill.Audite(entity);

            this.ReturnJson.AddProperty("d", returnValue);
            return(Content(this.ReturnJson.ToString()));
        }
示例#20
0
        /// <summary>
        /// 查询数据集
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="list"></param>
        /// <returns></returns>
        public DataSet GetDataSource(ReportsEntity entity, List <ReportParamsEntity> list, int orderType, string orderNum)
        {
            DataSet ds = null;

            if (entity.ReportType == (int)EReportType.Report)
            {
                ds = this.Reports.GetDataSource(entity, list);
            }
            else
            {
                if (orderType == (int)EReportType.InBill)
                {
                    Bill <InStorageEntity, InStorDetailEntity> bill = new InStorageOrder(this.CompanyID);
                    ds = bill.GetPrint(orderNum);
                }
                else if (orderType == (int)EReportType.OutBill)
                {
                    Bill <OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder(this.CompanyID);
                    ds = bill.GetPrint(orderNum);
                }
                else if (orderType == (int)EReportType.User)
                {
                    AdminProvider provider = new AdminProvider(this.CompanyID);
                    ds = provider.GetPrint(orderNum);
                }
            }
            if (ds != null)
            {
                foreach (DataTable table in ds.Tables)
                {
                    if (table.Rows.Count == 0)
                    {
                        DataRow row = table.NewRow();
                        table.Rows.Add(row);
                    }
                }
            }
            return(ds);
        }
示例#21
0
        /// <summary>
        /// 查询统计的数据行
        /// </summary>
        /// <returns></returns>
        public ActionResult GetCount()
        {
            string CompanyID     = WebUtil.GetFormValue <string>("CompanyID");
            string OrderNum      = WebUtil.GetFormValue <string>("OrderNum");
            int    OutType       = WebUtil.GetFormValue <int>("OutType", 0);
            string CusName       = WebUtil.GetFormValue <string>("CusName");
            string CusNum        = WebUtil.GetFormValue <string>("CusNum");
            string Phone         = WebUtil.GetFormValue <string>("Phone");
            string ContractOrder = WebUtil.GetFormValue <string>("ContractOrder");
            int    Status        = WebUtil.GetFormValue <int>("Status", 0);
            string BeginTime     = WebUtil.GetFormValue <string>("BeginTime");
            string EndTime       = WebUtil.GetFormValue <string>("EndTime");
            string StorageNum    = WebUtil.GetFormValue <string>("StorageNum");

            OutStorageEntity entity = new OutStorageEntity();

            entity.CompanyID     = CompanyID;
            entity.OrderNum      = OrderNum;
            entity.OutType       = OutType;
            entity.CusName       = CusName;
            entity.CusNum        = CusNum;
            entity.Phone         = Phone;
            entity.ContractOrder = ContractOrder;
            entity.Status        = Status;
            entity.BeginTime     = BeginTime;
            entity.EndTime       = EndTime;
            entity.StorageNum    = StorageNum;

            Bill <OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder(CompanyID);
            int Count = bill.GetCount(entity);

            DataResult <int> dataResult = new DataResult <int>();

            dataResult.Code    = (int)EResponseCode.Success;
            dataResult.Message = "响应成功";
            dataResult.Result  = Count;

            return(Content(JsonHelper.SerializeObject(dataResult)));
        }
示例#22
0
        /// <summary>
        /// 查询数据集
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="list"></param>
        /// <returns></returns>
        public DataSet GetDataSource(ReportsEntity entity, List <ReportParamsEntity> list, int orderType, string orderNum)
        {
            DataSet ds = null;

            if (entity.ReportType == (int)EReportType.Report)
            {
                ds = this.Reports.GetDataSource(entity, list);
            }
            else
            {
                if (orderType == (int)EOrder.InOrder)
                {
                    Bill <InStorageEntity, InStorDetailEntity> bill = new InStorageOrder();
                    ds = bill.GetPrint(orderNum);
                }
                else if (orderType == (int)EOrder.OutOrder)
                {
                    Bill <OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder();
                    ds = bill.GetPrint(orderNum);
                }
            }
            return(ds);
        }
示例#23
0
        /// <summary>
        /// 取消出库单
        /// </summary>
        /// <returns></returns>
        public ActionResult Cancel()
        {
            string           SnNum     = WebUtil.GetFormValue <string>("SnNum");
            string           CompanyID = WebUtil.GetFormValue <string>("CompanyID", string.Empty);
            OutStorageEntity entity    = new OutStorageEntity();

            entity.SnNum     = SnNum;
            entity.CompanyID = CompanyID;
            Bill <OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder(CompanyID);
            string     returnValue = bill.Cancel(entity);
            DataResult result      = new DataResult();

            if (EnumHelper.GetEnumDesc <EReturnStatus>(EReturnStatus.Success) == returnValue)
            {
                result.Code    = (int)EResponseCode.Success;
                result.Message = "操作成功";
            }
            else
            {
                result.Code    = (int)EResponseCode.Exception;
                result.Message = "操作失败";
            }
            return(Content(JsonHelper.SerializeObject(result)));
        }
        public ActionResult ToExcel()
        {
            int Status = WebUtil.GetFormValue<int>("Status", 0);
            string OrderNum = WebUtil.GetFormValue<string>("OrderNum", string.Empty);
            string CusName = WebUtil.GetFormValue<string>("CusName", string.Empty);
            string beginTime = WebUtil.GetFormValue<string>("beginTime", string.Empty);
            string endTime = WebUtil.GetFormValue<string>("endTime", string.Empty);

            PageInfo pageInfo = new PageInfo() { PageIndex = 1, PageSize = int.MaxValue };
            OutStorageEntity entity = new OutStorageEntity();
            if (Status > 0)
            {
                entity.Where(a => a.Status == Status);
            }
            if (!OrderNum.IsEmpty())
            {
                entity.Where("OrderNum", ECondition.Like, "%" + OrderNum + "%");
            }
            if (!CusName.IsEmpty())
            {
                entity.Begin<OutStorageEntity>()
                    .And<OutStorageEntity>("CusNum", ECondition.Like, "%" + CusName + "%")
                    .Or<OutStorageEntity>("CusName", ECondition.Like, "%" + CusName + "%")
                    .End<OutStorageEntity>()
                    ;
            }
            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<OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder();
            List<OutStorageEntity> listResult = bill.GetList(entity, ref pageInfo);
            listResult = listResult == null ? new List<OutStorageEntity>() : listResult;
            if (listResult.IsNotNull())
            {
                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("操作方式"));
                dt.Columns.Add(new DataColumn("创建时间"));
                int count = 1;
                foreach (OutStorageEntity t in listResult)
                {
                    DataRow row = dt.NewRow();
                    row[0] = count;
                    row[1] = t.OrderNum;
                    row[2] = EnumHelper.GetEnumDesc<EOutType>(t.OutType);
                    row[3] = t.CusName;
                    row[4] = t.ContractOrder;
                    row[5] = t.Num;
                    row[6] = t.Amount;
                    row[7] = EnumHelper.GetEnumDesc<EAudite>(t.Status);
                    row[8] = t.CreateUserName;
                    row[9] = EnumHelper.GetEnumDesc<EOpType>(t.OperateType);
                    row[10] = t.CreateTime.ToString("yyyy-MM-dd");
                    dt.Rows.Add(row);
                    count++;
                }
                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());
        }
示例#25
0
        public ActionResult OutStorageReport()
        {
            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;

            ProductProvider provider = new ProductProvider();
            OutStorageEntity entity = new OutStorageEntity();
            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<OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder();
            List<OutStorageEntity> listResult = bill.GetList(entity, ref pageInfo);
            listResult = listResult == null ? new List<OutStorageEntity>() : listResult;
            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());
        }
示例#26
0
        public ActionResult Print()
        {
            string orderNum = WebUtil.GetQueryStringValue<string>("orderNum", string.Empty);
            Bill<OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder();
            OutStorageEntity entity = new OutStorageEntity();
            entity.OrderNum = orderNum;
            entity = bill.GetOrder(entity);
            entity = entity.IsNull() ? new OutStorageEntity() : entity;
            ViewBag.Entity = entity;

            OutStoDetailEntity detail = new OutStoDetailEntity();
            detail.OrderNum = orderNum;
            List<OutStoDetailEntity> listResult = bill.GetOrderDetail(detail);
            listResult = listResult.IsNull() ? new List<OutStoDetailEntity>() : listResult;
            OrderProvider orderProvider = new OrderProvider();
            foreach (OutStoDetailEntity item in listResult)
            {
                OrderDetailEntity orderDetail = new OrderDetailEntity();
                orderDetail.Where(a => a.SnNum == item.ContractSn).And(a => a.OrderNum == item.ContractOrder);
                orderDetail = orderProvider.GetOrderDetail(orderDetail);
                if (orderDetail != null)
                {
                    item.Qty = orderDetail.Num;
                }
            }
            ViewBag.Detail = listResult;
            return View();
        }
 public ActionResult Load()
 {
     string OrderNum = WebUtil.GetFormValue<string>("OrderNum", string.Empty);
     if (!OrderNum.IsEmpty())
     {
         ReturnProvider provider = new ReturnProvider();
         ReturnOrderEntity backEntity = provider.CheckOrder(OrderNum);
         if (backEntity != null && backEntity.Status == (int)EAudite.Wait)
         {
             this.ReturnJson.AddProperty("d", "1001");
             return Content(this.ReturnJson.ToString());
         }
         Bill<OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder();
         OutStorageEntity entity = new OutStorageEntity();
         entity.OrderNum = OrderNum;
         entity = bill.GetOrder(entity);
         if (entity.IsNotNull())
         {
             if (entity.Status != (int)EAudite.Pass)
             {
                 this.ReturnJson.AddProperty("d", "1002");
                 return Content(this.ReturnJson.ToString());
             }
             this.ReturnJson.AddProperty("CusNum", entity.CusNum);
             this.ReturnJson.AddProperty("CusName", entity.CusName);
             this.ReturnJson.AddProperty("Address", entity.Address);
             this.ReturnJson.AddProperty("Contact", entity.Contact);
             this.ReturnJson.AddProperty("Phone", entity.Phone);
             //加载详细内容
             OutStoDetailEntity detail = new OutStoDetailEntity();
             detail.OrderNum = OrderNum;
             List<OutStoDetailEntity> list = bill.GetOrderDetail(detail);
             list = list.IsNull() ? new List<OutStoDetailEntity>() : list;
             //获得已经退货的数量
             List<ReturnDetailEntity> listResult = provider.GetDetailByOrder(OrderNum);
             if (!listResult.IsNullOrEmpty())
             {
                 list.ForEach(a =>
                 {
                     double qty = listResult.Where(b => b.BarCode == a.BarCode && b.ProductNum == a.ProductNum && b.LocalNum == a.LocalNum && b.StorageNum == a.StorageNum && b.BatchNum==a.BatchNum).Sum(b => b.BackNum);
                     a.BackNum = qty;
                 });
             }
             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 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 GetList()
 {
     int Status = WebUtil.GetFormValue<int>("Status", 0);
     string OrderNum = WebUtil.GetFormValue<string>("OrderNum", string.Empty);
     string CusName = WebUtil.GetFormValue<string>("CusName", string.Empty);
     string beginTime = WebUtil.GetFormValue<string>("beginTime", string.Empty);
     string endTime = WebUtil.GetFormValue<string>("endTime", string.Empty);
     string order = WebUtil.GetFormValue<string>("order", string.Empty);
     int OutType = WebUtil.GetFormValue<int>("OutType", 0);
     string planNum = WebUtil.GetFormValue<string>("planNum");
     int pageSize = WebUtil.GetFormValue<int>("PageSize", 10);
     int pageIndex = WebUtil.GetFormValue<int>("PageIndex", 1);
     PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize };
     OutStorageEntity entity = new OutStorageEntity();
     if (Status > 0)
     {
         entity.Where(a => a.Status == Status);
     }
     if (!OrderNum.IsEmpty())
     {
         entity.Where("OrderNum", ECondition.Like, "%" + OrderNum + "%");
     }
     if (!CusName.IsEmpty())
     {
         entity.Begin<OutStorageEntity>()
             .And<OutStorageEntity>("CusNum", ECondition.Like, "%" + CusName + "%")
             .Or<OutStorageEntity>("CusName", ECondition.Like, "%" + CusName + "%")
             .End<OutStorageEntity>()
             ;
     }
     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 (!order.IsEmpty())
     {
         OrderProvider orderProvider = new OrderProvider();
         List<string> listContractOrder = orderProvider.GetOrderPlan(order);
         listContractOrder = listContractOrder.IsNull() ? new List<string>() : listContractOrder;
         if (listContractOrder.Count == 0)
         {
             listContractOrder.Add(order);
         }
         entity.And("ContractOrder", ECondition.In, listContractOrder.ToArray());
     }
     if (OutType > 0)
     {
         entity.And(a => a.OutType == OutType);
     }
     if (!planNum.IsEmpty())
     {
         OutStoDetailEntity detail = new OutStoDetailEntity();
         detail.Where("ContractOrder", ECondition.Like, "%" + planNum + "%");
         entity.Left<OutStoDetailEntity>(detail, new Params<string, string>() { Item1 = "OrderNum", Item2 = "OrderNum" });
     }
     Bill<OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder();
     List<OutStorageEntity> listResult = bill.GetList(entity, ref pageInfo);
     listResult = listResult == null ? new List<OutStorageEntity>() : listResult;
     string json = ConvertJson.ListToJson<OutStorageEntity>(listResult, "List");
     this.ReturnJson.AddProperty("Data", json);
     this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount);
     return Content(this.ReturnJson.ToString());
 }
示例#30
0
        public ActionResult Create()
        {
            string   OrderNum      = WebUtil.GetFormValue <string>("OrderNum", string.Empty);
            int      OutType       = WebUtil.GetFormValue <int>("OutType", 0);
            int      ProductType   = WebUtil.GetFormValue <int>("ProductType", 0);
            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   Address       = WebUtil.GetFormValue <string>("Address", string.Empty);
            string   ContactName   = WebUtil.GetFormValue <string>("ContactName", string.Empty);
            string   Phone         = WebUtil.GetFormValue <string>("Phone", string.Empty);
            DateTime SendDate      = WebUtil.GetFormValue <DateTime>("SendDate", DateTime.Now);
            string   Remark        = WebUtil.GetFormValue <string>("Remark", string.Empty);
            string   UserName      = WebUtil.GetFormValue <string>("UserName", string.Empty);
            string   UserID        = WebUtil.GetFormValue <string>("UserID", string.Empty);
            string   DeptName      = WebUtil.GetFormValue <string>("DeptName", string.Empty);

            OutStorageEntity entity = new OutStorageEntity();

            entity.OrderNum      = OrderNum.IsEmpty() ? SequenceProvider.GetSequence(typeof(OutStorageEntity)) : OrderNum;
            entity.OutType       = OutType;
            entity.ProductType   = ProductType;
            entity.CusNum        = CusNum;
            entity.CusName       = CusName;
            entity.Contact       = ContactName;
            entity.Phone         = Phone;
            entity.Address       = Address;
            entity.ContractOrder = ContractOrder;
            entity.Status        = (int)EAudite.Wait;
            entity.IsDelete      = (int)EIsDelete.NotDelete;
            entity.SendDate      = SendDate;
            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.UserID        = UserID;
            entity.UserName      = UserName;
            entity.DeptName      = DeptName;
            entity.StorageNum    = this.DefaultStore;

            List <OutStoDetailEntity> list = Session[CacheKey.TEMPDATA_CACHE_OUTSTORDETAIL] as List <OutStoDetailEntity>;

            if (list.IsNullOrEmpty())
            {
                this.ReturnJson.AddProperty("Key", "1001");
                this.ReturnJson.AddProperty("Value", "请选择要出库的产品以及数量");
                return(Content(this.ReturnJson.ToString()));
            }
            list.ForEach(a => { a.OrderNum = entity.OrderNum; });
            Bill <OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder();

            if (OrderNum.IsEmpty())
            {
                string returnValue = bill.Create(entity, list);
                if (returnValue == EnumHelper.GetEnumDesc <EReturnStatus>(EReturnStatus.Success))
                {
                    Session[CacheKey.TEMPDATA_CACHE_OUTSTORDETAIL] = null;
                    this.ReturnJson.AddProperty("Key", "1000");
                    this.ReturnJson.AddProperty("Value", "出库单创建成功");
                }
            }
            else
            {
                string returnValue = bill.EditOrder(entity, list);
                if (returnValue == EnumHelper.GetEnumDesc <EReturnStatus>(EReturnStatus.Success))
                {
                    Session[CacheKey.TEMPDATA_CACHE_OUTSTORDETAIL] = null;
                    this.ReturnJson.AddProperty("Key", "1000");
                    this.ReturnJson.AddProperty("Value", "出库单编辑成功");
                }
            }
            return(Content(this.ReturnJson.ToString()));
        }
        public ActionResult GetList()
        {
            int      Status    = WebUtil.GetFormValue <int>("Status", 0);
            string   OrderNum  = WebUtil.GetFormValue <string>("OrderNum", string.Empty);
            string   CusName   = WebUtil.GetFormValue <string>("CusName", string.Empty);
            string   beginTime = WebUtil.GetFormValue <string>("beginTime", string.Empty);
            string   endTime   = WebUtil.GetFormValue <string>("endTime", string.Empty);
            string   order     = WebUtil.GetFormValue <string>("order", string.Empty);
            int      OutType   = WebUtil.GetFormValue <int>("OutType", 0);
            string   planNum   = WebUtil.GetFormValue <string>("planNum");
            int      pageSize  = WebUtil.GetFormValue <int>("PageSize", 10);
            int      pageIndex = WebUtil.GetFormValue <int>("PageIndex", 1);
            PageInfo pageInfo  = new PageInfo()
            {
                PageIndex = pageIndex, PageSize = pageSize
            };
            OutStorageEntity entity = new OutStorageEntity();

            if (Status > 0)
            {
                entity.Where(a => a.Status == Status);
            }
            if (!OrderNum.IsEmpty())
            {
                entity.Where("OrderNum", ECondition.Like, "%" + OrderNum + "%");
            }
            if (!CusName.IsEmpty())
            {
                entity.Begin <OutStorageEntity>()
                .And <OutStorageEntity>("CusNum", ECondition.Like, "%" + CusName + "%")
                .Or <OutStorageEntity>("CusName", ECondition.Like, "%" + CusName + "%")
                .End <OutStorageEntity>()
                ;
            }
            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 (!order.IsEmpty())
            {
                OrderProvider orderProvider     = new OrderProvider();
                List <string> listContractOrder = orderProvider.GetOrderPlan(order);
                listContractOrder = listContractOrder.IsNull() ? new List <string>() : listContractOrder;
                if (listContractOrder.Count == 0)
                {
                    listContractOrder.Add(order);
                }
                entity.And("ContractOrder", ECondition.In, listContractOrder.ToArray());
            }
            if (OutType > 0)
            {
                entity.And(a => a.OutType == OutType);
            }
            if (!planNum.IsEmpty())
            {
                OutStoDetailEntity detail = new OutStoDetailEntity();
                detail.Where("ContractOrder", ECondition.Like, "%" + planNum + "%");
                entity.Left <OutStoDetailEntity>(detail, new Params <string, string>()
                {
                    Item1 = "OrderNum", Item2 = "OrderNum"
                });
            }
            Bill <OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder();
            List <OutStorageEntity> listResult = bill.GetList(entity, ref pageInfo);

            listResult = listResult == null ? new List <OutStorageEntity>() : listResult;
            string json = ConvertJson.ListToJson <OutStorageEntity>(listResult, "List");

            this.ReturnJson.AddProperty("Data", json);
            this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount);
            return(Content(this.ReturnJson.ToString()));
        }
        public ActionResult Create()
        {
            string OrderNum = WebUtil.GetFormValue<string>("OrderNum", string.Empty);
            int OutType = WebUtil.GetFormValue<int>("OutType", 0);
            int ProductType = WebUtil.GetFormValue<int>("ProductType", 0);
            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 Address = WebUtil.GetFormValue<string>("Address", string.Empty);
            string ContactName = WebUtil.GetFormValue<string>("ContactName", string.Empty);
            string Phone = WebUtil.GetFormValue<string>("Phone", string.Empty);
            DateTime SendDate = WebUtil.GetFormValue<DateTime>("SendDate", DateTime.Now);
            string Remark = WebUtil.GetFormValue<string>("Remark", string.Empty);

            OutStorageEntity entity = new OutStorageEntity();
            entity.OrderNum = OrderNum.IsEmpty() ? SequenceProvider.GetSequence(typeof(OutStorageEntity)) : OrderNum;
            entity.OutType = OutType;
            entity.ProductType = ProductType;
            entity.CusNum = CusNum;
            entity.CusName = CusName;
            entity.Contact = ContactName;
            entity.Phone = Phone;
            entity.Address = Address;
            entity.ContractOrder = ContractOrder;
            entity.Status = (int)EAudite.Wait;
            entity.IsDelete = (int)EIsDelete.NotDelete;
            entity.SendDate = SendDate;
            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<OutStoDetailEntity> list = Session[CacheKey.TEMPDATA_CACHE_OUTSTORDETAIL] as List<OutStoDetailEntity>;
            if (list.IsNullOrEmpty())
            {
                this.ReturnJson.AddProperty("Key", "1001");
                this.ReturnJson.AddProperty("Value", "请选择要出库的产品以及数量");
                return Content(this.ReturnJson.ToString());
            }
            list.ForEach(a => { a.OrderNum = entity.OrderNum; });
            Bill<OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder();
            if (OrderNum.IsEmpty())
            {
                string returnValue = bill.Create(entity, list);
                if (returnValue == EnumHelper.GetEnumDesc<EReturnStatus>(EReturnStatus.Success))
                {
                    Session[CacheKey.TEMPDATA_CACHE_OUTSTORDETAIL] = null;
                    this.ReturnJson.AddProperty("Key", "1000");
                    this.ReturnJson.AddProperty("Value", "出库单创建成功");
                }
            }
            else
            {
                string returnValue = bill.EditOrder(entity, list);
                if (returnValue == EnumHelper.GetEnumDesc<EReturnStatus>(EReturnStatus.Success))
                {
                    Session[CacheKey.TEMPDATA_CACHE_OUTSTORDETAIL] = null;
                    this.ReturnJson.AddProperty("Key", "1000");
                    this.ReturnJson.AddProperty("Value", "出库单编辑成功");
                }
            }
            return Content(this.ReturnJson.ToString());
        }
        public ActionResult ToExcel()
        {
            int    Status    = WebUtil.GetFormValue <int>("Status", 0);
            string OrderNum  = WebUtil.GetFormValue <string>("OrderNum", string.Empty);
            string CusName   = WebUtil.GetFormValue <string>("CusName", string.Empty);
            string beginTime = WebUtil.GetFormValue <string>("beginTime", string.Empty);
            string endTime   = WebUtil.GetFormValue <string>("endTime", string.Empty);

            PageInfo pageInfo = new PageInfo()
            {
                PageIndex = 1, PageSize = int.MaxValue
            };
            OutStorageEntity entity = new OutStorageEntity();

            if (Status > 0)
            {
                entity.Where(a => a.Status == Status);
            }
            if (!OrderNum.IsEmpty())
            {
                entity.Where("OrderNum", ECondition.Like, "%" + OrderNum + "%");
            }
            if (!CusName.IsEmpty())
            {
                entity.Begin <OutStorageEntity>()
                .And <OutStorageEntity>("CusNum", ECondition.Like, "%" + CusName + "%")
                .Or <OutStorageEntity>("CusName", ECondition.Like, "%" + CusName + "%")
                .End <OutStorageEntity>()
                ;
            }
            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 <OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder();
            List <OutStorageEntity> listResult = bill.GetList(entity, ref pageInfo);

            listResult = listResult == null ? new List <OutStorageEntity>() : listResult;
            if (listResult.IsNotNull())
            {
                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("操作方式"));
                dt.Columns.Add(new DataColumn("创建时间"));
                int count = 1;
                foreach (OutStorageEntity t in listResult)
                {
                    DataRow row = dt.NewRow();
                    row[0]  = count;
                    row[1]  = t.OrderNum;
                    row[2]  = EnumHelper.GetEnumDesc <EOutType>(t.OutType);
                    row[3]  = t.CusName;
                    row[4]  = t.ContractOrder;
                    row[5]  = t.Num;
                    row[6]  = t.Amount;
                    row[7]  = EnumHelper.GetEnumDesc <EAudite>(t.Status);
                    row[8]  = t.CreateUserName;
                    row[9]  = EnumHelper.GetEnumDesc <EOpType>(t.OperateType);
                    row[10] = t.CreateTime.ToString("yyyy-MM-dd");
                    dt.Rows.Add(row);
                    count++;
                }
                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()));
        }
示例#34
0
 /// <summary>
 /// 查询数据集
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="list"></param>
 /// <returns></returns>
 public DataSet GetDataSource(ReportsEntity entity, List<ReportParamsEntity> list,int orderType,string orderNum)
 {
     DataSet ds = null;
     if (entity.ReportType == (int)EReportType.Report)
     {
         ds = this.Reports.GetDataSource(entity, list);
     }
     else
     {
         if (orderType == (int)EOrder.InOrder)
         {
             Bill<InStorageEntity, InStorDetailEntity> bill = new InStorageOrder();
             ds = bill.GetPrint(orderNum);
         }
         else if (orderType == (int)EOrder.OutOrder)
         {
             Bill<OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder();
             ds = bill.GetPrint(orderNum);
         }
     }
     return ds;
 }
示例#35
0
        public ActionResult Edit()
        {
            string orderNum = WebUtil.GetQueryStringValue<string>("orderNum", string.Empty);
            Bill<OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder();
            OutStorageEntity entity = new OutStorageEntity();
            entity.OrderNum = orderNum;
            entity = bill.GetOrder(entity);
            entity = entity.IsNull() ? new OutStorageEntity() : entity;
            ViewBag.Entity = entity;
            ViewBag.OutType = EnumHelper.GetOptions<EInType>(entity.OutType, "请选择入库单类型");
            ViewBag.ProductType = EnumHelper.GetOptions<EProductType>(entity.ProductType, "请选择入库产品类型");

            OutStoDetailEntity detail = new OutStoDetailEntity();
            detail.OrderNum = orderNum;
            List<OutStoDetailEntity> listResult = bill.GetOrderDetail(detail);
            listResult = listResult.IsNull() ? new List<OutStoDetailEntity>() : listResult;

            ProductProvider provider = new ProductProvider();
            List<ProductEntity> list = provider.GetListByCache();
            list = list.IsNull() ? new List<ProductEntity>() : list;
            listResult.ForEach(a =>
            {
                ProductEntity product = null;
                if (a.BarCode.IsEmpty())
                {
                    product = list.SingleOrDefault(b => b.SnNum == a.ProductNum);
                }
                else
                {
                    product = list.SingleOrDefault(b => b.SnNum == a.ProductNum && b.BarCode == a.BarCode);
                }
                a.OutPrice = product != null ? product.OutPrice : 0;
                if (product != null)
                {
                    a.Size = product.Size.IsEmpty() ? "" : product.Size;
                }
                else
                {
                    a.Size = "";
                }
            });
            Session[CacheKey.TEMPDATA_CACHE_OUTSTORDETAIL] = listResult;
            return View();
        }