public ActionResult Edit() { Session[CacheKey.TEMPDATA_CACHE_INSTORDETAIL] = null; string orderNum = WebUtil.GetQueryStringValue <string>("orderNum", string.Empty); Bill <InStorageEntity, InStorDetailEntity> bill = new InStorageOrder(); InStorageEntity entity = new InStorageEntity(); entity.OrderNum = orderNum; entity = bill.GetOrder(entity); entity = entity == null ? new InStorageEntity() : entity; entity.InTypeLable = EnumHelper.GetEnumDesc <EInType>(entity.InType); entity.StatusLable = EnumHelper.GetEnumDesc <EAudite>(entity.Status); ViewBag.InStorage = entity; ViewBag.InType = EnumHelper.GetOptions <EInType>(entity.InType, "请选择入库单类型"); ViewBag.ProductType = EnumHelper.GetOptions <EProductType>(entity.Status, "请选择入库产品类型"); InStorDetailEntity detail = new InStorDetailEntity(); detail.OrderNum = orderNum; List <InStorDetailEntity> list = bill.GetOrderDetail(detail); list = list == null ? new List <InStorDetailEntity>() : list; if (list.IsNullOrEmpty() == false) { foreach (InStorDetailEntity item in list) { item.Size = item.Size.IsEmpty() ? "" : item.Size; item.Amount = item.Amount == 0 ? item.InPrice * item.Num : item.Amount; item.TotalPrice = item.Amount; } Session[CacheKey.TEMPDATA_CACHE_INSTORDETAIL] = list; } ViewBag.Detail = list; return(View()); }
/// <summary> /// 入库单打印的数据写入 /// </summary> /// <returns></returns> public ActionResult Print() { string CompanyID = WebUtil.GetFormValue <string>("CompanyID"); string PrintUser = WebUtil.GetFormValue <string>("PrintUser"); DateTime PrintTime = WebUtil.GetFormValue <DateTime>("PrintTime"); string SnNum = WebUtil.GetFormValue <string>("SnNum"); InStorageEntity entity = new InStorageEntity(); entity.SnNum = SnNum; entity.PrintUser = PrintUser; entity.PrintTime = PrintTime; entity.CompanyID = CompanyID; Bill <InStorageEntity, InStorDetailEntity> bill = new InStorageOrder(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))); }
/// <summary> /// 根据唯一编号删除入库单 /// </summary> /// <returns></returns> public ActionResult DeleteSingle() { string CompanyID = WebUtil.GetFormValue <string>("CompanyID", string.Empty); string SnNum = WebUtil.GetFormValue <string>("SnNum", string.Empty); InStorageEntity entity = new InStorageEntity(); entity.CompanyID = CompanyID; entity.SnNum = SnNum; Bill <InStorageEntity, InStorDetailEntity> bill = new InStorageOrder(CompanyID); string returnValue = bill.Delete(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))); }
/// <summary> /// 新增入库单 /// </summary> /// <returns></returns> public ActionResult Create() { string CompanyID = WebUtil.GetFormValue <string>("CompanyID", string.Empty); InStorageEntity entity = WebUtil.GetFormObject <InStorageEntity>("Entity"); List <InStorDetailEntity> list = WebUtil.GetFormObject <List <InStorDetailEntity> >("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 <InStorageEntity, InStorDetailEntity> bill = new InStorageOrder(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))); }
public ActionResult Create() { int InType = WebUtil.GetFormValue <int>("InType", 0); int ProductType = WebUtil.GetFormValue <int>("ProductType", 0); string ContractOrder = WebUtil.GetFormValue <string>("ContractOrder", string.Empty); string SupNum = WebUtil.GetFormValue <string>("SupNum", string.Empty); string SupName = WebUtil.GetFormValue <string>("SupName", string.Empty); string ContactName = WebUtil.GetFormValue <string>("ContactName", string.Empty); string Phone = WebUtil.GetFormValue <string>("Phone", string.Empty); DateTime OrderTime = WebUtil.GetFormValue <DateTime>("OrderTime", DateTime.Now); string Remark = WebUtil.GetFormValue <string>("Remark", string.Empty); InStorageEntity entity = new InStorageEntity(); entity.OrderNum = SequenceProvider.GetSequence(typeof(InStorageEntity)); entity.InType = InType; entity.ProductType = ProductType; entity.SupNum = SupNum; entity.SupName = SupName; entity.ContactName = ContactName; entity.Phone = Phone; entity.Address = ""; entity.ContractOrder = ContractOrder; entity.Status = (int)EAudite.Wait; entity.IsDelete = (int)EIsDelete.NotDelete; entity.OrderTime = OrderTime; entity.CreateTime = DateTime.Now; entity.CreateUser = this.LoginUserCode; entity.AuditUser = string.Empty; entity.AuditeTime = DateTime.MinValue; entity.PrintUser = string.Empty; entity.PrintTime = DateTime.MinValue; entity.Reason = string.Empty; entity.OperateType = (int)EOpType.PC; entity.EquipmentNum = string.Empty; entity.EquipmentCode = string.Empty; entity.Remark = Remark; entity.StorageNum = this.DefaultStore; List <InStorDetailEntity> list = Session[CacheKey.TEMPDATA_CACHE_INSTORDETAIL] as List <InStorDetailEntity>; if (list.IsNullOrEmpty()) { this.ReturnJson.AddProperty("Key", "1001"); this.ReturnJson.AddProperty("Value", "请选择要入库的产品以及数量"); return(Content(this.ReturnJson.ToString())); } entity.Num = list.Sum(a => a.Num); entity.Amount = list.Sum(a => a.Amount); Bill <InStorageEntity, InStorDetailEntity> bill = new InStorageOrder(); string returnValue = bill.Create(entity, list); if (returnValue == EnumHelper.GetEnumDesc <EReturnStatus>(EReturnStatus.Success)) { Session[CacheKey.TEMPDATA_CACHE_INSTORDETAIL] = null; this.ReturnJson.AddProperty("Key", "1000"); this.ReturnJson.AddProperty("Value", "入库单创建成功"); } return(Content(this.ReturnJson.ToString())); }
public ActionResult GetList() { int status = WebUtil.GetFormValue <int>("Status", 0); string orderNum = WebUtil.GetFormValue <string>("OrderNum", string.Empty); string supName = WebUtil.GetFormValue <string>("SupName", string.Empty); string beginTime = WebUtil.GetFormValue <string>("beginTime", string.Empty); string endTime = WebUtil.GetFormValue <string>("endTime", string.Empty); int pageSize = WebUtil.GetFormValue <int>("PageSize", 10); int pageIndex = WebUtil.GetFormValue <int>("PageIndex", 1); int InType = WebUtil.GetFormValue <int>("InType", 0); string planNum = WebUtil.GetFormValue <string>("planNum", string.Empty); PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize }; InStorageEntity entity = new InStorageEntity(); if (status > 0) { entity.Where(a => a.Status == status); } if (!orderNum.IsEmpty()) { entity.Where("OrderNum", ECondition.Like, "%" + orderNum + "%"); } if (!supName.IsEmpty()) { entity.AndBegin <InStorageEntity>() .And <InStorageEntity>("SupNum", ECondition.Like, "%" + supName + "%") .Or <InStorageEntity>("SupName", ECondition.Like, "%" + supName + "%") .End <InStorageEntity>() ; } if (!beginTime.IsEmpty() && !endTime.IsEmpty()) { entity.Where("OrderTime", ECondition.Between, ConvertHelper.ToType <DateTime>(beginTime), ConvertHelper.ToType <DateTime>(endTime)); } entity.And(a => a.StorageNum == this.DefaultStore); if (InType > 0) { entity.And(a => a.InType == InType); } if (!planNum.IsEmpty()) { entity.And("ContractOrder", ECondition.Like, "%" + planNum + "%"); } Bill <InStorageEntity, InStorDetailEntity> bill = new InStorageOrder(); List <InStorageEntity> listResult = bill.GetList(entity, ref pageInfo); listResult = listResult == null ? new List <InStorageEntity>() : listResult; string json = ConvertJson.ListToJson <InStorageEntity>(listResult, "List"); this.ReturnJson.AddProperty("Data", json); this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount); return(Content(this.ReturnJson.ToString())); }
public ActionResult Delete() { string orderNum = WebUtil.GetFormValue<string>("OrderNum", string.Empty); if (!orderNum.IsEmpty()) { Bill<InStorageEntity, InStorDetailEntity> bill = new InStorageOrder(); InStorageEntity entity = new InStorageEntity(); entity.OrderNum = orderNum; string returnValue = bill.Delete(entity); this.ReturnJson.AddProperty("d", returnValue); } return Content(this.ReturnJson.ToString()); }
public ActionResult Delete() { string orderNum = WebUtil.GetFormValue <string>("OrderNum", string.Empty); if (!orderNum.IsEmpty()) { Bill <InStorageEntity, InStorDetailEntity> bill = new InStorageOrder(); InStorageEntity entity = new InStorageEntity(); entity.OrderNum = orderNum; string returnValue = bill.Delete(entity); this.ReturnJson.AddProperty("d", returnValue); } return(Content(this.ReturnJson.ToString())); }
/// <summary> /// 根据唯一编号查询入库单明细数据行 /// </summary> /// <returns></returns> public ActionResult GetDetailInfo() { string SnNum = WebUtil.GetFormValue <string>("SnNum"); string CompanyID = WebUtil.GetFormValue <string>("CompanyID", string.Empty); Bill <InStorageEntity, InStorDetailEntity> bill = new InStorageOrder(CompanyID); InStorDetailEntity entity = bill.GetDetail(SnNum); DataResult <InStorDetailEntity> dataResult = new DataResult <InStorDetailEntity>(); dataResult.Code = (int)EResponseCode.Success; dataResult.Message = "响应成功"; dataResult.Result = entity; return(Content(JsonHelper.SerializeObject(dataResult))); }
public ActionResult DeleteBatch([ModelBinder(typeof(JsonBinder <List <string> >))] List <string> list) { if (!list.IsNullOrEmpty()) { foreach (string orderNum in list) { Bill <InStorageEntity, InStorDetailEntity> bill = new InStorageOrder(); InStorageEntity entity = new InStorageEntity(); entity.OrderNum = orderNum; string returnValue = bill.Delete(entity); this.ReturnJson.AddProperty("d", returnValue); } } return(Content(this.ReturnJson.ToString())); }
public ActionResult DeleteBatch([ModelBinder(typeof(JsonBinder<List<string>>))] List<string> list) { if (!list.IsNullOrEmpty()) { foreach (string orderNum in list) { Bill<InStorageEntity, InStorDetailEntity> bill = new InStorageOrder(); InStorageEntity entity = new InStorageEntity(); entity.OrderNum = orderNum; string returnValue = bill.Delete(entity); this.ReturnJson.AddProperty("d", returnValue); } } return Content(this.ReturnJson.ToString()); }
/// <summary> /// 查询入库当详细分页 /// </summary> /// <returns></returns> public ActionResult GetDetailList() { string CompanyID = WebUtil.GetFormValue <string>("CompanyID"); string BarCode = WebUtil.GetFormValue <string>("BarCode"); string OrderNum = WebUtil.GetFormValue <string>("OrderNum"); string ProductName = WebUtil.GetFormValue <string>("ProductName"); string StorageNum = WebUtil.GetFormValue <string>("StorageNum"); string SupNum = WebUtil.GetFormValue <string>("SupNum"); string SupName = WebUtil.GetFormValue <string>("SupName"); string BeginTime = WebUtil.GetFormValue <string>("BeginTime"); string EndTime = WebUtil.GetFormValue <string>("EndTime"); string ContractOrder = WebUtil.GetFormValue <string>("ContractOrder", string.Empty); int Status = WebUtil.GetFormValue <int>("Status", 0); int InType = WebUtil.GetFormValue <int>("InType", 0); int PageIndex = WebUtil.GetFormValue <int>("PageIndex", 1); int PageSize = WebUtil.GetFormValue <int>("PageSize", 10); InStorDetailEntity entity = new InStorDetailEntity(); entity.CompanyID = CompanyID; entity.BarCode = BarCode; entity.OrderNum = OrderNum; entity.ProductName = ProductName; entity.StorageNum = StorageNum; entity.SupNum = SupNum; entity.SupName = SupName; entity.BeginTime = BeginTime; entity.EndTime = EndTime; entity.Status = Status; entity.InType = InType; entity.ContractOrder = ContractOrder; PageInfo pageInfo = new PageInfo() { PageIndex = PageIndex, PageSize = PageSize }; Bill <InStorageEntity, InStorDetailEntity> bill = new InStorageOrder(CompanyID); List <InStorDetailEntity> listResult = bill.GetDetailList(entity, ref pageInfo); DataListResult <InStorDetailEntity> dataResult = new DataListResult <InStorDetailEntity>() { Code = (int)EResponseCode.Success, Message = "响应成功", Result = listResult, PageInfo = pageInfo }; return(Content(JsonHelper.SerializeObject(dataResult))); }
/// <summary> /// 查询打印的数据集合 /// </summary> /// <returns></returns> public ActionResult GetPrintSource() { string CompanyID = WebUtil.GetFormValue <string>("CompanyID"); string SnNum = WebUtil.GetFormValue <string>("SnNum"); Bill <InStorageEntity, InStorDetailEntity> bill = new InStorageOrder(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))); }
/// <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"); InStorageEntity entity = new InStorageEntity(); 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 <InStorageEntity, InStorDetailEntity> bill = new InStorageOrder(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))); }
public ActionResult Audite() { string orderNum = WebUtil.GetFormValue<string>("OrderNum", string.Empty); int status = WebUtil.GetFormValue<int>("Status", 0); string reason = WebUtil.GetFormValue<string>("Reason", string.Empty); InStorageEntity entity = new InStorageEntity(); entity.Status = status; entity.OrderNum = orderNum; entity.AuditUser = this.LoginUserCode; entity.OperateType = (int)EOpType.PC; entity.EquipmentCode = string.Empty; entity.EquipmentNum = string.Empty; entity.Remark = string.Empty; entity.Reason = reason; Bill<InStorageEntity, InStorDetailEntity> bill = new InStorageOrder(); string returnValue = bill.Audite(entity); this.ReturnJson.AddProperty("d", returnValue); return Content(this.ReturnJson.ToString()); }
/// <summary> /// 编辑入库单的详细项 /// </summary> /// <returns></returns> public ActionResult EditDetail() { string CompanyID = WebUtil.GetFormValue <string>("CompanyID", string.Empty); InStorDetailEntity entity = WebUtil.GetFormObject <InStorDetailEntity>("Detail"); Bill <InStorageEntity, InStorDetailEntity> bill = new InStorageOrder(CompanyID); string returnValue = bill.EditDetail(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 Detail() { string orderNum = WebUtil.GetQueryStringValue<string>("orderNum",string.Empty); string flag = WebUtil.GetQueryStringValue<string>("flag", "1"); Bill<InStorageEntity, InStorDetailEntity> bill = new InStorageOrder(); InStorageEntity entity = new InStorageEntity(); entity.OrderNum = orderNum; entity = bill.GetOrder(entity); entity=entity==null ? new InStorageEntity(): entity; entity.InTypeLable = EnumHelper.GetEnumDesc<EInType>(entity.InType); entity.StatusLable = EnumHelper.GetEnumDesc<EAudite>(entity.Status); ViewBag.InStorage=entity; ViewBag.Flag = flag; InStorDetailEntity detail=new InStorDetailEntity(); detail.OrderNum=orderNum; List<InStorDetailEntity> list=bill.GetOrderDetail(detail); list = list == null ? new List<InStorDetailEntity>() : list; ViewBag.Detail = list; return View(); }
public ActionResult Audite() { string orderNum = WebUtil.GetFormValue <string>("OrderNum", string.Empty); int status = WebUtil.GetFormValue <int>("Status", 0); string reason = WebUtil.GetFormValue <string>("Reason", string.Empty); InStorageEntity entity = new InStorageEntity(); entity.Status = status; entity.OrderNum = orderNum; entity.AuditUser = this.LoginUserCode; entity.OperateType = (int)EOpType.PC; entity.EquipmentCode = string.Empty; entity.EquipmentNum = string.Empty; entity.Remark = string.Empty; entity.Reason = reason; Bill <InStorageEntity, InStorDetailEntity> bill = new InStorageOrder(); string returnValue = bill.Audite(entity); this.ReturnJson.AddProperty("d", returnValue); return(Content(this.ReturnJson.ToString())); }
/// <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); }
/// <summary> /// 统计入库单数据行 /// </summary> /// <returns></returns> public ActionResult GetCount() { string CompanyID = WebUtil.GetFormValue <string>("CompanyID"); string OrderNum = WebUtil.GetFormValue <string>("OrderNum"); int InType = WebUtil.GetFormValue <int>("InType", 0); string SupNum = WebUtil.GetFormValue <string>("SupNum"); string SupName = WebUtil.GetFormValue <string>("SupName"); string Phone = WebUtil.GetFormValue <string>("Phone"); string StorageNum = WebUtil.GetFormValue <string>("StorageNum"); 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"); InStorageEntity entity = new InStorageEntity(); entity.CompanyID = CompanyID; entity.OrderNum = OrderNum; entity.InType = InType; entity.SupNum = SupNum; entity.SupName = SupName; entity.Phone = Phone; entity.StorageNum = StorageNum; entity.ContractOrder = ContractOrder; entity.Status = Status; entity.BeginTime = BeginTime; entity.EndTime = EndTime; Bill <InStorageEntity, InStorDetailEntity> bill = new InStorageOrder(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))); }
/// <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); }
public ActionResult Detail() { string orderNum = WebUtil.GetQueryStringValue <string>("orderNum", string.Empty); string flag = WebUtil.GetQueryStringValue <string>("flag", "1"); Bill <InStorageEntity, InStorDetailEntity> bill = new InStorageOrder(); InStorageEntity entity = new InStorageEntity(); entity.OrderNum = orderNum; entity = bill.GetOrder(entity); entity = entity == null ? new InStorageEntity(): entity; entity.InTypeLable = EnumHelper.GetEnumDesc <EInType>(entity.InType); entity.StatusLable = EnumHelper.GetEnumDesc <EAudite>(entity.Status); ViewBag.InStorage = entity; ViewBag.Flag = flag; InStorDetailEntity detail = new InStorDetailEntity(); detail.OrderNum = orderNum; List <InStorDetailEntity> list = bill.GetOrderDetail(detail); list = list == null ? new List <InStorDetailEntity>() : list; ViewBag.Detail = list; return(View()); }
/// <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; }
public ActionResult GetList() { int status = WebUtil.GetFormValue<int>("Status", 0); string orderNum = WebUtil.GetFormValue<string>("OrderNum", string.Empty); string supName = WebUtil.GetFormValue<string>("SupName", string.Empty); string beginTime = WebUtil.GetFormValue<string>("beginTime", string.Empty); string endTime = WebUtil.GetFormValue<string>("endTime", string.Empty); int pageSize = WebUtil.GetFormValue<int>("PageSize", 10); int pageIndex = WebUtil.GetFormValue<int>("PageIndex", 1); int InType = WebUtil.GetFormValue<int>("InType", 0); string planNum = WebUtil.GetFormValue<string>("planNum", string.Empty); PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize }; InStorageEntity entity = new InStorageEntity(); if (status > 0) { entity.Where(a => a.Status == status); } if (!orderNum.IsEmpty()) { entity.Where("OrderNum", ECondition.Like, "%" + orderNum + "%"); } if (!supName.IsEmpty()) { entity.AndBegin<InStorageEntity>() .And<InStorageEntity>("SupNum", ECondition.Like, "%" + supName + "%") .Or<InStorageEntity>("SupName", ECondition.Like, "%" + supName + "%") .End<InStorageEntity>() ; } if (!beginTime.IsEmpty() && !endTime.IsEmpty()) { entity.Where("OrderTime", ECondition.Between, ConvertHelper.ToType<DateTime>(beginTime), ConvertHelper.ToType<DateTime>(endTime)); } entity.And(a => a.StorageNum == this.DefaultStore); if (InType > 0) { entity.And(a => a.InType == InType); } if (!planNum.IsEmpty()) { entity.And("ContractOrder", ECondition.Like, "%" + planNum + "%"); } Bill<InStorageEntity, InStorDetailEntity> bill = new InStorageOrder(); List<InStorageEntity> listResult = bill.GetList(entity, ref pageInfo); listResult = listResult == null ? new List<InStorageEntity>() : listResult; string json = ConvertJson.ListToJson<InStorageEntity>(listResult, "List"); this.ReturnJson.AddProperty("Data", json); this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount); return Content(this.ReturnJson.ToString()); }
/// <summary> /// 导出Excel /// </summary> /// <returns></returns> public ActionResult ToExcel() { int status = WebUtil.GetFormValue<int>("Status", 0); string orderNum = WebUtil.GetFormValue<string>("OrderNum", string.Empty); string supName = WebUtil.GetFormValue<string>("SupName", string.Empty); string beginTime = WebUtil.GetFormValue<string>("beginTime", string.Empty); string endTime = WebUtil.GetFormValue<string>("endTime", string.Empty); int pageSize = Int32.MaxValue; int pageIndex = 1; PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize }; InStorageEntity entity = new InStorageEntity(); if (status > 0) { entity.Where(a => a.Status == status); } if (!orderNum.IsEmpty()) { entity.Where("OrderNum", ECondition.Like, "%" + orderNum + "%"); } if (!supName.IsEmpty()) { entity.AndBegin<InStorageEntity>() .And<InStorageEntity>("SupNum", ECondition.Like, "%" + supName + "%") .Or<InStorageEntity>("SupName", ECondition.Like, "%" + supName + "%") .End<InStorageEntity>() ; } if (!beginTime.IsEmpty() && !endTime.IsEmpty()) { entity.Where("OrderTime", ECondition.Between, ConvertHelper.ToType<DateTime>(beginTime), ConvertHelper.ToType<DateTime>(endTime)); } Bill<InStorageEntity, InStorDetailEntity> bill = new InStorageOrder(); List<InStorageEntity> listResult = bill.GetList(entity, ref pageInfo); listResult = listResult == null ? new List<InStorageEntity>() : listResult; DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("入库单单号")); dt.Columns.Add(new DataColumn("入库类型")); dt.Columns.Add(new DataColumn("供应商")); dt.Columns.Add(new DataColumn("关联单号")); dt.Columns.Add(new DataColumn("货品总数")); dt.Columns.Add(new DataColumn("总金额")); dt.Columns.Add(new DataColumn("状态")); dt.Columns.Add(new DataColumn("制单人")); dt.Columns.Add(new DataColumn("操作方式")); dt.Columns.Add(new DataColumn("创建时间")); foreach (InStorageEntity t in listResult) { DataRow row = dt.NewRow(); row[0] = t.OrderNum; row[1] = EnumHelper.GetEnumDesc<EInType>(t.InType); row[2] = t.SupName; row[3] = t.ContractOrder; row[4] = t.Num; row[5] = t.Amount.ToString("0.00")+" 元"; row[6] = EnumHelper.GetEnumDesc<EAudite>(t.Status); row[7] = t.CreateUserName; row[8] = EnumHelper.GetEnumDesc<EOpType>(t.OperateType); row[9] = t.OrderTime.ToString("yyyy-MM-dd"); dt.Rows.Add(row); } string filePath = Server.MapPath("~/UploadFiles/"); if (!System.IO.Directory.Exists(filePath)) { System.IO.Directory.CreateDirectory(filePath); } string filename = string.Format("入库单{0}.xls", DateTime.Now.ToString("yyyyMMddHHmmss")); NPOIExcel excel = new NPOIExcel("入库管理", "入库单", System.IO.Path.Combine(filePath, filename)); excel.ToExcel(dt); this.ReturnJson.AddProperty("Path", ("/UploadFiles/" + filename).Escape()); return Content(this.ReturnJson.ToString()); }
/// <summary> /// 导出Excel /// </summary> /// <returns></returns> public ActionResult ToExcel() { int status = WebUtil.GetFormValue <int>("Status", 0); string orderNum = WebUtil.GetFormValue <string>("OrderNum", string.Empty); string supName = WebUtil.GetFormValue <string>("SupName", string.Empty); string beginTime = WebUtil.GetFormValue <string>("beginTime", string.Empty); string endTime = WebUtil.GetFormValue <string>("endTime", string.Empty); int pageSize = Int32.MaxValue; int pageIndex = 1; PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize }; InStorageEntity entity = new InStorageEntity(); if (status > 0) { entity.Where(a => a.Status == status); } if (!orderNum.IsEmpty()) { entity.Where("OrderNum", ECondition.Like, "%" + orderNum + "%"); } if (!supName.IsEmpty()) { entity.AndBegin <InStorageEntity>() .And <InStorageEntity>("SupNum", ECondition.Like, "%" + supName + "%") .Or <InStorageEntity>("SupName", ECondition.Like, "%" + supName + "%") .End <InStorageEntity>() ; } if (!beginTime.IsEmpty() && !endTime.IsEmpty()) { entity.Where("OrderTime", ECondition.Between, ConvertHelper.ToType <DateTime>(beginTime), ConvertHelper.ToType <DateTime>(endTime)); } Bill <InStorageEntity, InStorDetailEntity> bill = new InStorageOrder(); List <InStorageEntity> listResult = bill.GetList(entity, ref pageInfo); listResult = listResult == null ? new List <InStorageEntity>() : listResult; DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("入库单单号")); dt.Columns.Add(new DataColumn("入库类型")); dt.Columns.Add(new DataColumn("供应商")); dt.Columns.Add(new DataColumn("关联单号")); dt.Columns.Add(new DataColumn("货品总数")); dt.Columns.Add(new DataColumn("总金额")); dt.Columns.Add(new DataColumn("状态")); dt.Columns.Add(new DataColumn("制单人")); dt.Columns.Add(new DataColumn("操作方式")); dt.Columns.Add(new DataColumn("创建时间")); foreach (InStorageEntity t in listResult) { DataRow row = dt.NewRow(); row[0] = t.OrderNum; row[1] = EnumHelper.GetEnumDesc <EInType>(t.InType); row[2] = t.SupName; row[3] = t.ContractOrder; row[4] = t.Num; row[5] = t.Amount.ToString("0.00") + " 元"; row[6] = EnumHelper.GetEnumDesc <EAudite>(t.Status); row[7] = t.CreateUserName; row[8] = EnumHelper.GetEnumDesc <EOpType>(t.OperateType); row[9] = t.OrderTime.ToString("yyyy-MM-dd"); dt.Rows.Add(row); } string filePath = Server.MapPath("~/UploadFiles/"); if (!System.IO.Directory.Exists(filePath)) { System.IO.Directory.CreateDirectory(filePath); } string filename = string.Format("入库单{0}.xls", DateTime.Now.ToString("yyyyMMddHHmmss")); NPOIExcel excel = new NPOIExcel("入库管理", "入库单", System.IO.Path.Combine(filePath, filename)); excel.ToExcel(dt); this.ReturnJson.AddProperty("Path", ("/UploadFiles/" + filename).Escape()); return(Content(this.ReturnJson.ToString())); }
public ActionResult Edit() { Session[CacheKey.TEMPDATA_CACHE_INSTORDETAIL] = null; string orderNum = WebUtil.GetQueryStringValue<string>("orderNum", string.Empty); Bill<InStorageEntity, InStorDetailEntity> bill = new InStorageOrder(); InStorageEntity entity = new InStorageEntity(); entity.OrderNum = orderNum; entity = bill.GetOrder(entity); entity = entity == null ? new InStorageEntity() : entity; entity.InTypeLable = EnumHelper.GetEnumDesc<EInType>(entity.InType); entity.StatusLable = EnumHelper.GetEnumDesc<EAudite>(entity.Status); ViewBag.InStorage = entity; ViewBag.InType = EnumHelper.GetOptions<EInType>(entity.InType, "请选择入库单类型"); ViewBag.ProductType = EnumHelper.GetOptions<EProductType>(entity.Status, "请选择入库产品类型"); InStorDetailEntity detail = new InStorDetailEntity(); detail.OrderNum = orderNum; List<InStorDetailEntity> list = bill.GetOrderDetail(detail); list = list == null ? new List<InStorDetailEntity>() : list; if (list.IsNullOrEmpty() == false) { foreach (InStorDetailEntity item in list) { item.Size = item.Size.IsEmpty() ? "" : item.Size; item.Amount = item.Amount == 0 ? item.InPrice * item.Num : item.Amount; item.TotalPrice = item.Amount; } Session[CacheKey.TEMPDATA_CACHE_INSTORDETAIL] = list; } ViewBag.Detail = list; return View(); }
public ActionResult InStorageReport() { int queryTime = WebUtil.GetFormValue<int>("QueryTime", 0); int pageIndex = WebUtil.GetFormValue<int>("pageIndex", 0); int pageSize = WebUtil.GetFormValue<int>("pageSize", 0); string storageNum = this.DefaultStore; InStorageEntity entity = new InStorageEntity(); PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize }; if (queryTime > 0) { entity.Where("CreateTime", ECondition.Between, DateTime.Now.AddDays(-queryTime), DateTime.Now); } if (storageNum.IsNotNull()) { entity.Where("StorageNum", ECondition.Eth, storageNum); } Bill<InStorageEntity, InStorDetailEntity> bill = new InStorageOrder(); List<InStorageEntity> listResult = bill.GetList(entity, ref pageInfo); listResult = listResult == null ? new List<InStorageEntity>() : listResult; string json = ConvertJson.ListToJson<InStorageEntity>(listResult, "List"); this.ReturnJson.AddProperty("Data", new JsonObject(json)); this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount); return Content(this.ReturnJson.ToString()); }
public ActionResult Create() { int InType = WebUtil.GetFormValue<int>("InType", 0); int ProductType = WebUtil.GetFormValue<int>("ProductType", 0); string ContractOrder = WebUtil.GetFormValue<string>("ContractOrder", string.Empty); string SupNum = WebUtil.GetFormValue<string>("SupNum", string.Empty); string SupName = WebUtil.GetFormValue<string>("SupName", string.Empty); string ContactName = WebUtil.GetFormValue<string>("ContactName", string.Empty); string Phone = WebUtil.GetFormValue<string>("Phone", string.Empty); DateTime OrderTime = WebUtil.GetFormValue<DateTime>("OrderTime", DateTime.Now); string Remark = WebUtil.GetFormValue<string>("Remark", string.Empty); InStorageEntity entity = new InStorageEntity(); entity.OrderNum = SequenceProvider.GetSequence(typeof(InStorageEntity)); entity.InType = InType; entity.ProductType = ProductType; entity.SupNum = SupNum; entity.SupName = SupName; entity.ContactName = ContactName; entity.Phone = Phone; entity.Address = ""; entity.ContractOrder = ContractOrder; entity.Status = (int)EAudite.Wait; entity.IsDelete = (int)EIsDelete.NotDelete; entity.OrderTime = OrderTime; entity.CreateTime = DateTime.Now; entity.CreateUser = this.LoginUserCode; entity.AuditUser = string.Empty; entity.AuditeTime = DateTime.MinValue; entity.PrintUser = string.Empty; entity.PrintTime = DateTime.MinValue; entity.Reason = string.Empty; entity.OperateType = (int)EOpType.PC; entity.EquipmentNum = string.Empty; entity.EquipmentCode = string.Empty; entity.Remark = Remark; entity.StorageNum = this.DefaultStore; List<InStorDetailEntity> list = Session[CacheKey.TEMPDATA_CACHE_INSTORDETAIL] as List<InStorDetailEntity>; if (list.IsNullOrEmpty()) { this.ReturnJson.AddProperty("Key", "1001"); this.ReturnJson.AddProperty("Value", "请选择要入库的产品以及数量"); return Content(this.ReturnJson.ToString()); } entity.Num = list.Sum(a => a.Num); entity.Amount = list.Sum(a => a.Amount); Bill<InStorageEntity, InStorDetailEntity> bill = new InStorageOrder(); string returnValue = bill.Create(entity, list); if (returnValue == EnumHelper.GetEnumDesc<EReturnStatus>(EReturnStatus.Success)) { Session[CacheKey.TEMPDATA_CACHE_INSTORDETAIL] = null; this.ReturnJson.AddProperty("Key", "1000"); this.ReturnJson.AddProperty("Value", "入库单创建成功"); } return Content(this.ReturnJson.ToString()); }
/// <summary> /// 根据采购订单转化为入库单 /// 1: 采购订单生成入库单成功 /// 1001:采购订单不存在 /// 1002:采购订单已经全部入库,请勿重新入库 /// 1003: 订单已经被取消,不能入库 /// 1004: 采购订单中不存在入库物品 /// 1005: 存在不在采购单内的货品 /// </summary> /// <param name="SnNum">采购订单唯一编号</param> /// <param name="list">要入库的内容</param> /// <param name="StorageNum">仓库编号</param> /// <param name="CreateUser">操作人编号</param> /// <returns></returns> public DataResult ToInStorage(string SnNum, List <PurchaseDetailEntity> list, string StorageNum, string CreateUser) { PurchaseEntity entity = new PurchaseEntity(); entity.SnNum = SnNum; entity = this.GetOrder(entity); DataResult result = new DataResult(); if (entity == null) { result.Code = 1001; result.Message = "采购订单不存在"; return(result); } if (entity.Status < (int)EPurchaseStatus.InTheStock) { result.Code = 1001; result.Message = "采购订单审核流程不正确,不能生成入库单"; return(result); } if (entity.Status == (int)EPurchaseStatus.AllIn) { result.Code = 1002; result.Message = "采购订单已经全部入库,请勿重新入库"; return(result); } if (entity.Status == (int)EPurchaseStatus.OrderCancel) { result.Code = 1003; result.Message = "订单已经被取消,不能入库"; return(result); } PurchaseDetailEntity detailEntity = new PurchaseDetailEntity(); detailEntity.OrderSnNum = SnNum; List <PurchaseDetailEntity> listSource = this.GetOrderDetail(detailEntity); if (listSource.IsNullOrEmpty()) { result.Code = 1004; result.Message = "采购订单中不存在入库物品"; return(result); } //检查入库产品是否在采购单内 List <PurchaseDetailEntity> listExists = new List <PurchaseDetailEntity>(); foreach (PurchaseDetailEntity item in list) { if (!listSource.Exists(a => a.SnNum == item.SnNum)) { //不存在添加到集合 listExists.Add(item); } } if (!listExists.IsNullOrEmpty()) { string content = listExists.Select(a => string.Format("[{0}]{1}", a.BarCode, a.ProductName)).ToArray().ToString(); result.Code = 1005; result.Message = content + " 不在采购订单[" + entity.OrderNum + "]中,请重新确认再入库"; return(result); } InStorageEntity InEntity = new InStorageEntity(); InEntity.SnNum = ConvertHelper.NewGuid(); InEntity.InType = (int)EInType.Purchase; InEntity.ProductType = (int)EProductType.Goods; InEntity.StorageNum = StorageNum; InEntity.SupNum = entity.SupNum; InEntity.SupSnNum = entity.SupSnNum; InEntity.SupName = entity.SupName; InEntity.ContactName = entity.Contact; InEntity.Phone = entity.Phone; InEntity.Address = entity.Address; InEntity.ContractOrder = entity.SnNum; //0 无关联 1 采购 2 出库 3退货 InEntity.ContractType = 1; InEntity.Status = (int)EAudite.Wait; InEntity.IsDelete = (int)EIsDelete.NotDelete; InEntity.CreateTime = DateTime.Now; InEntity.OrderTime = DateTime.Now; InEntity.CreateUser = CreateUser; InEntity.CompanyID = this.CompanyID; List <InStorDetailEntity> listDetail = new List <InStorDetailEntity>(); foreach (PurchaseDetailEntity item in list) { InStorDetailEntity InDetail = new InStorDetailEntity(); InDetail.SnNum = ConvertHelper.NewGuid(); InDetail.OrderSnNum = InEntity.SnNum; InDetail.ProductNum = item.ProductNum; InDetail.ProductName = item.ProductName; InDetail.BarCode = item.BarCode; InDetail.BatchNum = item.BatchNum; InDetail.Num = item.Qty; InDetail.InPrice = item.Price; InDetail.Amount = item.Qty * item.Price; InDetail.ContractOrder = item.SnNum; InDetail.CreateTime = DateTime.Now; InDetail.LocalNum = item.LocalNum; InDetail.StorageNum = StorageNum; InDetail.CreateUser = CreateUser; InDetail.CompanyID = this.CompanyID; listDetail.Add(InDetail); } string returnValue = string.Empty; using (TransactionScope ts = new TransactionScope()) { Bill <InStorageEntity, InStorDetailEntity> bill = new InStorageOrder(this.CompanyID); returnValue = bill.Create(InEntity, listDetail); if (EnumHelper.GetEnumDesc <EReturnStatus>(EReturnStatus.Success) == returnValue) { foreach (PurchaseDetailEntity item in list) { if (item.RealNum + item.Qty >= item.Num) { item.Status = (int)EPurchaseStatus.AllIn; item.RealNum += item.Qty; } else if ((item.RealNum + item.Qty) < item.Num && (item.RealNum + item.Qty) > 0) { item.Status = (int)EPurchaseStatus.PartialIn; item.RealNum += item.Qty; } item.Include(a => new { a.RealNum, a.Status }); item.Where(a => a.SnNum == item.SnNum); this.PurchaseDetail.Update(item); } //再次查询校验状态 detailEntity = new PurchaseDetailEntity(); detailEntity.OrderSnNum = SnNum; listSource = this.GetOrderDetail(detailEntity); if (!listSource.IsNullOrEmpty()) { if (listSource.Count(a => a.Status == (int)EPurchaseStatus.PartialIn) > 0 || (listSource.Count(a => a.Status == (int)EPurchaseStatus.AllIn) < listSource.Count() && listSource.Count(a => a.Status == (int)EPurchaseStatus.AllIn) > 0) ) { entity.Status = (int)EPurchaseStatus.PartialIn; } else if (listSource.Count(a => a.Status == (int)EPurchaseStatus.AllIn) == listSource.Count()) { entity.Status = (int)EPurchaseStatus.AllIn; } entity.IncludeStatus(true); entity.Where(a => a.SnNum == entity.SnNum); this.Purchase.Update(entity); } result.Code = (int)EResponseCode.Success; result.Message = "入库单创建成功"; } else { result.Code = (int)EResponseCode.Exception; result.Message = "入库单创建失败"; } ts.Complete(); } return(result); }