public static CheckStock_CE ToCE(CheckStockEntity item) { CheckStock_CE target = new CheckStock_CE(); target.ID = item.ID; target.OrderNum = item.OrderNum; target.Type = item.Type; target.ProductType = item.ProductType; target.ContractOrder = item.ContractOrder; target.Status = item.Status; target.LocalQty = item.LocalQty; target.CheckQty = item.CheckQty; target.IsDelete = item.IsDelete; target.IsComplete = item.IsComplete; 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); }
/// <summary> /// 完成盘点 /// </summary> /// <param name="entity"></param> /// <returns></returns> public int CompleteCheck(CheckStockEntity entity) { entity.IncludeIsComplete(true).Where(a => a.OrderNum == entity.OrderNum); int line = this.CheckStock.Update(entity); return(line); }
public ActionResult Save() { int Type = WebUtil.GetFormValue <int>("Type", (int)ECheckType.Local); int ProductType = WebUtil.GetFormValue <int>("ProductType", (int)EProductType.Goods); string ContractOrder = WebUtil.GetFormValue <string>("ContractOrder", string.Empty); DateTime CreateTime = WebUtil.GetFormValue <DateTime>("CreateTime", DateTime.Now); string Remark = WebUtil.GetFormValue <string>("Remark", string.Empty); string TargetNum = WebUtil.GetFormValue <string>("TargetNum", string.Empty); CheckStockEntity entity = new CheckStockEntity(); string orderNum = SequenceProvider.GetSequence(typeof(CheckStockEntity)); entity.OrderNum = orderNum; entity.Type = Type; entity.ProductType = ProductType; entity.ContractOrder = ContractOrder; entity.Status = (int)EAudite.Wait; entity.IsDelete = (int)EIsDelete.NotDelete; entity.CreateTime = CreateTime; entity.CreateUser = this.LoginUser.UserCode; entity.OperateType = (int)EOpType.PC; entity.IsComplete = (int)EBool.No; entity.Remark = Remark; entity.StorageNum = this.DefaultStore; List <ProductEntity> ListProducts = Session[CacheKey.JOOSHOW_CHECKDETAIL_CACHE] as List <ProductEntity>; ListProducts = ListProducts.IsNull() ? new List <ProductEntity>() : ListProducts; List <CheckStockInfoEntity> listDetail = new List <CheckStockInfoEntity>(); string storageNum = this.DefaultStore; foreach (ProductEntity key in ListProducts) { CheckStockInfoEntity detail = new CheckStockInfoEntity(); detail.OrderNum = orderNum; detail.TargetNum = key.SnNum; detail.StorageNum = storageNum; detail.CreateTime = DateTime.Now; listDetail.Add(detail); } Bill <CheckStockEntity, CheckStockInfoEntity> bill = new CheckOrder(); string returnValue = bill.Create(entity, listDetail); if (returnValue == EnumHelper.GetEnumDesc <EReturnStatus>(EReturnStatus.Success)) { this.ReturnJson.AddProperty("Key", "1000"); this.ReturnJson.AddProperty("Value", "盘点单创建成功"); } return(Content(this.ReturnJson.ToString())); }
public ActionResult Delete() { string OrderNum = WebUtil.GetFormValue <string>("OrderNum", string.Empty); if (!OrderNum.IsEmpty()) { Bill <CheckStockEntity, CheckStockInfoEntity> bill = new CheckOrder(); CheckStockEntity entity = new CheckStockEntity(); entity.OrderNum = OrderNum; string returnValue = bill.Delete(entity); this.ReturnJson.AddProperty("d", returnValue); } return(Content(this.ReturnJson.ToString())); }
public ActionResult DeleteBatch([ModelBinder(typeof(JsonBinder <List <string> >))] List <string> list) { if (!list.IsNullOrEmpty()) { foreach (string orderNum in list) { Bill <CheckStockEntity, CheckStockInfoEntity> bill = new CheckOrder(); CheckStockEntity entity = new CheckStockEntity(); entity.OrderNum = orderNum; string returnValue = bill.Delete(entity); this.ReturnJson.AddProperty("d", returnValue); } } return(Content(this.ReturnJson.ToString())); }
public ActionResult Upload() { string orderNum = WebUtil.GetQueryStringValue <string>("OrderNum", string.Empty); Bill <CheckStockEntity, CheckStockInfoEntity> bill = new CheckOrder(); CheckStockEntity entity = new CheckStockEntity(); entity.OrderNum = orderNum; entity = bill.GetOrder(entity); if (entity.IsNull()) { return(Redirect("/Check/Product/List")); } entity.CheckTypeLable = EnumHelper.GetEnumDesc <ECheckType>(entity.Type); entity.ProductTypeLable = EnumHelper.GetEnumDesc <EProductType>(entity.ProductType); entity.StatusLable = EnumHelper.GetEnumDesc <EAudite>(entity.Status); ViewBag.Entity = entity; return(View()); }
public ActionResult Complete() { string OrderNum = WebUtil.GetFormValue <string>("OrderNum", string.Empty); CheckStockEntity entity = new CheckStockEntity(); entity.IsComplete = (int)EBool.Yes; entity.OrderNum = OrderNum; CheckDataProvider provider = new CheckDataProvider(); int line = provider.CompleteCheck(entity); if (line > 0) { if (line > 0) { this.ReturnJson.AddProperty("Key", "1000"); this.ReturnJson.AddProperty("Value", "操作完成"); } } return(Content(this.ReturnJson.ToString())); }
public ActionResult Audite() { string OrderNum = WebUtil.GetFormValue <string>("OrderNum", string.Empty); int Status = WebUtil.GetFormValue <int>("Status", 0); string Reason = WebUtil.GetFormValue <string>("Reason", string.Empty); CheckStockEntity entity = new CheckStockEntity(); entity.Status = Status; entity.OrderNum = OrderNum; entity.AuditUser = this.LoginUser.UserCode; entity.Reason = Reason; entity.OperateType = (int)EOpType.PC; entity.EquipmentNum = string.Empty; entity.EquipmentCode = string.Empty; Bill <CheckStockEntity, CheckStockInfoEntity> bill = new CheckOrder(); string returnValue = bill.Audite(entity); this.ReturnJson.AddProperty("d", returnValue); return(Content(this.ReturnJson.ToString())); }
public ActionResult Edit() { string orderNum = WebUtil.GetQueryStringValue <string>("OrderNum", string.Empty); Bill <CheckStockEntity, CheckStockInfoEntity> bill = new CheckOrder(); CheckStockEntity entity = new CheckStockEntity(); entity.OrderNum = orderNum; entity = bill.GetOrder(entity); if (entity.IsNull()) { return(Redirect("/Check/Product/List")); } string checkType = EnumHelper.GetOptions <ECheckType>(entity.Type); ViewBag.CheckType = checkType; ViewBag.ProductType = EnumHelper.GetOptions <EProductType>(entity.ProductType); ViewBag.Entity = entity; CheckStockInfoEntity info = new CheckStockInfoEntity(); info.OrderNum = orderNum; List <CheckStockInfoEntity> list = bill.GetOrderDetail(info); List <ProductEntity> ListProducts = new List <ProductEntity>(); List <ProductEntity> ListSource = new ProductProvider().GetListByCache(); if (!list.IsNullOrEmpty()) { Parallel.ForEach(list, item => { if (ListSource.Exists(a => a.SnNum == item.TargetNum)) { ProductEntity target = ListSource.FirstOrDefault(a => a.SnNum == item.TargetNum); ListProducts.Add(target); } }); } Session[CacheKey.JOOSHOW_CHECKDETAIL_CACHE] = ListProducts; return(View()); }
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); CheckStockEntity entity = new CheckStockEntity(); 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("CreateTime", ECondition.Between, ConvertHelper.ToType <DateTime>(beginTime, DateTime.Now.AddDays(-1)), ConvertHelper.ToType <DateTime>(endTime, DateTime.Now)); } entity.And(a => a.StorageNum == this.DefaultStore); int pageIndex = WebUtil.GetFormValue <int>("PageIndex", 1); int pageSize = WebUtil.GetFormValue <int>("PageSize", 10); PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize }; Bill <CheckStockEntity, CheckStockInfoEntity> bill = new CheckOrder(); List <CheckStockEntity> listResult = bill.GetList(entity, ref pageInfo); listResult = listResult.IsNull() ? new List <CheckStockEntity>() : listResult; string json = ConvertJson.ListToJson(listResult, "List"); this.ReturnJson.AddProperty("Data", json); this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount); 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); CheckStockEntity entity = new CheckStockEntity(); 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("CreateTime", ECondition.Between, ConvertHelper.ToType <DateTime>(beginTime, DateTime.Now.AddDays(-1)), ConvertHelper.ToType <DateTime>(endTime, DateTime.Now)); } entity.And(a => a.StorageNum == this.DefaultStore); PageInfo pageInfo = new PageInfo() { PageIndex = 1, PageSize = Int32.MaxValue }; Bill <CheckStockEntity, CheckStockInfoEntity> bill = new CheckOrder(); List <CheckStockEntity> listResult = bill.GetList(entity, ref pageInfo); listResult = listResult.IsNull() ? new List <CheckStockEntity>() : 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("创建时间")); foreach (CheckStockEntity t in listResult) { DataRow row = dt.NewRow(); row[0] = t.OrderNum; row[1] = EnumHelper.GetEnumDesc <ECheckType>(t.Type); row[2] = t.ContractOrder; row[3] = EnumHelper.GetEnumDesc <EAudite>(t.Status); row[4] = t.CreateUserName; row[5] = EnumHelper.GetEnumDesc <EOpType>(t.OperateType); row[6] = 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())); }