示例#1
0
 public static BadReport_CE ToCE(BadReportEntity item)
 {
     BadReport_CE target = new BadReport_CE();
     target.ID=item.ID;
     target.OrderNum=item.OrderNum;
     target.BadType=item.BadType;
     target.ProductType=item.ProductType;
     target.ContractOrder=item.ContractOrder;
     target.Status=item.Status;
     target.Num=item.Num;
     target.Amount=item.Amount;
     target.Weight=item.Weight;
     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;
 }
        public ActionResult BadReportList()
        {
            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;

            BadProvider provider = new BadProvider();
            BadReportEntity entity = new BadReportEntity();
            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);
            }

            entity.And(a => a.StorageNum == this.DefaultStore);

            List<BadReportEntity> listResult = provider.GetList(entity, ref pageInfo, storageNum);
            listResult = listResult == null ? new List<BadReportEntity>() : listResult;
            string json = ConvertJson.ListToJson<BadReportEntity>(listResult, "List");
            this.ReturnJson.AddProperty("Data", new JsonObject(json));
            this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount);
            return Content(this.ReturnJson.ToString());
        }
 public ActionResult Delete()
 {
     string orderNum = WebUtil.GetFormValue<string>("OrderNum", string.Empty);
     Bill<BadReportEntity, BadReportDetailEntity> bill = new BadOrder();
     BadReportEntity entity = new BadReportEntity();
     entity.OrderNum = orderNum;
     string result = bill.Delete(entity);
     this.ReturnJson.AddProperty("d", result);
     return Content(this.ReturnJson.ToString());
 }
 public ActionResult BatchDel([ModelBinder(typeof(JsonBinder<string[]>))] string[] OrderNumItems)
 {
     Bill<BadReportEntity, BadReportDetailEntity> bill = new BadOrder();
     string result = string.Empty;
     for (int i = 0; i < OrderNumItems.Length; i++)
     {
         BadReportEntity entity = new BadReportEntity();
         entity.OrderNum = OrderNumItems[i];
         result = bill.Delete(entity);
     }
     this.ReturnJson.AddProperty("d", result);
     return Content(this.ReturnJson.ToString());
 }
示例#5
0
 /// <summary>
 /// 获得所有报损数量
 /// </summary>
 /// <returns></returns>
 public int GetAllNum()
 {
     BadReportEntity entity = new BadReportEntity();
     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.BadReport.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", 0);
     string Reason = WebUtil.GetFormValue<string>("Reason", string.Empty);
     BadReportEntity entity = new BadReportEntity();
     entity.Status = Status;
     entity.OrderNum = OrderNum;
     entity.AuditUser = this.LoginUserCode;
     entity.OperateType = (int)EOpType.PC;
     entity.EquipmentCode = string.Empty;
     entity.EquipmentNum = string.Empty;
     entity.Reason = Reason;
     Bill<BadReportEntity, BadReportDetailEntity> bill = new BadOrder();
     string returnValue = bill.Audite(entity);
     this.ReturnJson.AddProperty("d", returnValue);
     return Content(this.ReturnJson.ToString());
 }
        public ActionResult Create()
        {
            int BadType = WebUtil.GetFormValue<int>("BadType",(int)EBadType.Bad);
            int ProductType = WebUtil.GetFormValue<int>("ProductType", (int)EProductType.Goods);
            string ContractOrder = WebUtil.GetFormValue<string>("ContractOrder", string.Empty);
            string CrateUser = WebUtil.GetFormValue<string>("CrateUser", string.Empty);
            DateTime OrderTime = WebUtil.GetFormValue<DateTime>("OrderTime", DateTime.Now);
            string Remark = WebUtil.GetFormValue<string>("Remark", string.Empty);
            BadReportEntity badEntity = new BadReportEntity();
            badEntity.OrderNum = SequenceProvider.GetSequence(typeof(BadReportEntity));
            badEntity.BadType = BadType;
            badEntity.ProductType = ProductType;
            badEntity.ContractOrder = ContractOrder;
            badEntity.Status = (int)EAudite.Wait;
            badEntity.Num = 0;
            badEntity.IsDelete = (int)EIsDelete.NotDelete;
            badEntity.CreateTime = OrderTime;
            badEntity.CreateUser = CrateUser;
            badEntity.OperateType = (int)EOpType.PC;
            badEntity.EquipmentNum = "";
            badEntity.EquipmentCode = "";
            badEntity.Remark = Remark;
            badEntity.StorageNum = this.DefaultStore;

            List<BadReportDetailEntity> ListProducts = Session[CacheKey.TEMPDATA_CACHE_BADPRODUCTDETAIL] as List<BadReportDetailEntity>;
            if (!ListProducts.IsNullOrEmpty())
            {
                foreach (BadReportDetailEntity item in ListProducts)
                {
                    item.OrderNum = badEntity.OrderNum;
                    badEntity.Num += item.Num;
                    badEntity.Amount += item.Amount;
                }
                Bill<BadReportEntity, BadReportDetailEntity> bill = new BadOrder();
                string returnValue = bill.Create(badEntity, ListProducts);
                this.ReturnJson.AddProperty("d", returnValue);
                Session[CacheKey.TEMPDATA_CACHE_BADPRODUCTDETAIL] = null;
            }
            else
            {
                this.ReturnJson.AddProperty("d", "");
            }
            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<BadReportEntity, BadReportDetailEntity> bill = new BadOrder();
            BadReportEntity entity = new BadReportEntity();
            entity.OrderNum = orderNum;
            entity = bill.GetOrder(entity);
            entity = entity.IsNull() ? new BadReportEntity() : entity;
            entity.StatusLable = EnumHelper.GetEnumDesc<EAudite>(entity.Status);
            ViewBag.BadReport = entity;

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

            ViewBag.Flag = flag;
            return View();
        }
示例#9
0
 public ActionResult Edit()
 {
     string orderNum = WebUtil.GetQueryStringValue<string>("orderNum",string.Empty);
     if (orderNum.IsEmpty())
     {
         Response.Redirect("/Bad/Product/List");
     }
     Bill<BadReportEntity, BadReportDetailEntity> bill = new BadOrder();
     BadReportEntity entity = new BadReportEntity();
     entity.OrderNum = orderNum;
     entity = bill.GetOrder(entity);
     if (entity.IsNull())
     {
         Response.Redirect("/Bad/Product/List");
     }
     ViewBag.BadType = EnumHelper.GetOptions<EBadType>(entity.BadType, "请选择报损类型");
     ViewBag.ProductType = EnumHelper.GetOptions<EProductType>(entity.ProductType, "请选择入库产品类型");
     ViewBag.Entity = entity;
     BadReportDetailEntity detail = new BadReportDetailEntity();
     detail.OrderNum = orderNum;
     List<BadReportDetailEntity> listDetail = bill.GetOrderDetail(detail);
     Session[CacheKey.TEMPDATA_CACHE_BADPRODUCTDETAIL] = listDetail;
     return View();
 }
示例#10
0
 /// <summary>
 /// 查询单据分页
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="pageInfo"></param>
 /// <param name="storageNum"></param>
 /// <returns></returns>
 public List<BadReportEntity> GetList(BadReportEntity entity, ref PageInfo pageInfo, string storageNum)
 {
     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);
     BadReportDetailEntity badDetail = new BadReportDetailEntity();
     badDetail.Include(a => new { ProductName = a.ProductName, BarCode = a.BarCode, ProductNum = a.ProductNum });
     badDetail.Where(a => a.StorageNum == storageNum);
     entity.Left<BadReportDetailEntity>(badDetail, new Params<string, string>() { Item1 = "OrderNum", Item2 = "OrderNum" });
     int rowCount = 0;
     List<BadReportEntity> listResult = this.BadReport.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount);
     int allNum = GetAllNum();
     if (!listResult.IsNullOrEmpty())
     {
         foreach (BadReportEntity item in listResult)
         {
             item.NumPCT = (item.Num * 100.00f) / allNum;
         }
     }
     pageInfo.RowCount = rowCount;
     return listResult;
 }
 public ActionResult DeleteBatch([ModelBinder(typeof(JsonBinder<List<string>>))] List<string> list)
 {
     if (!list.IsNullOrEmpty())
     {
         foreach (string orderNum in list)
         {
             Bill<BadReportEntity, BadReportDetailEntity> bill = new BadOrder();
             BadReportEntity entity = new BadReportEntity();
             entity.OrderNum = orderNum;
             string result = bill.Delete(entity);
             this.ReturnJson.AddProperty("d", result);
         }
     }
     return Content(this.ReturnJson.ToString());
 }
 public ActionResult ToExcel()
 {
     int Status = WebUtil.GetFormValue<int>("Status", 0);
     string OrderNum = WebUtil.GetFormValue<string>("OrderNum", string.Empty);
     string BadType = WebUtil.GetFormValue<string>("BadType", string.Empty);
     string ProductType = WebUtil.GetFormValue<string>("ProductType", 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 };
     BadReportEntity entity = new BadReportEntity();
     if (Status > 0)
     {
         entity.Where(a => a.Status == Status);
     }
     if (!OrderNum.IsEmpty())
     {
         entity.Where("OrderNum", ECondition.Like, "%" + OrderNum + "%");
     }
     if (!ProductType.IsEmpty())
     {
         entity.Where("ProductType", ECondition.Eth, ProductType);
     }
     if (!BadType.IsEmpty())
     {
         entity.Where("BadType", ECondition.Eth, BadType);
     }
     if (!beginTime.IsEmpty() && !endTime.IsEmpty())
     {
         entity.Where("CreateTime", ECondition.Between, ConvertHelper.ToType<DateTime>(beginTime), ConvertHelper.ToType<DateTime>(endTime));
     }
     entity.And(a => a.StorageNum == this.DefaultStore);
     Bill<BadReportEntity, BadReportDetailEntity> bill = new BadOrder();
     List<BadReportEntity> listResult = bill.GetList(entity, ref pageInfo);
     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("创建人"));
         dt.Columns.Add(new DataColumn("创建时间"));
         int count = 1;
         foreach (BadReportEntity t in listResult)
         {
             DataRow row = dt.NewRow();
             row[0] = count;
             row[1] = t.OrderNum;
             row[2] = EnumHelper.GetEnumDesc<EBadType>(t.BadType);
             row[3] = t.ContractOrder;
             row[4] = t.Num;
             row[5] = EnumHelper.GetEnumDesc<EAudite>(t.Status);
             row[6] = EnumHelper.GetEnumDesc<EOpType>(t.OperateType);
             row[7] = t.CreateUser;
             row[8] = 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());
 }
 public ActionResult GetList()
 {
     int Status = WebUtil.GetFormValue<int>("Status", 0);
     string OrderNum = WebUtil.GetFormValue<string>("OrderNum", string.Empty);
     string BadType = WebUtil.GetFormValue<string>("BadType", string.Empty);
     string ProductType = WebUtil.GetFormValue<string>("ProductType", 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 };
     BadReportEntity entity = new BadReportEntity();
     if (Status > 0)
     {
         entity.Where(a => a.Status == Status);
     }
     if (!OrderNum.IsEmpty())
     {
         entity.Where("OrderNum", ECondition.Like, "%" + OrderNum + "%");
     }
     if (!ProductType.IsEmpty())
     {
         entity.Where("ProductType", ECondition.Eth, ProductType);
     }
     if (!BadType.IsEmpty())
     {
         entity.Where("BadType", ECondition.Eth, BadType);
     }
     if (!beginTime.IsEmpty() && !endTime.IsEmpty())
     {
         entity.Where("CreateTime", ECondition.Between, ConvertHelper.ToType<DateTime>(beginTime), ConvertHelper.ToType<DateTime>(endTime));
     }
     entity.And(a => a.StorageNum == this.DefaultStore);
     Bill<BadReportEntity, BadReportDetailEntity> bill = new BadOrder();
     List<BadReportEntity> listResult = bill.GetList(entity, ref pageInfo);
     listResult = listResult == null ? new List<BadReportEntity>() : listResult;
     string json = ConvertJson.ListToJson<BadReportEntity>(listResult, "List");
     this.ReturnJson.AddProperty("Data", json);
     this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount);
     return Content(this.ReturnJson.ToString());
 }