目录
1、 AccessoriesqueryController
1.1、 库存配件查询
1.2、 查询仓库
1.2.1、 //把数据库数据加到表格:跟默认然一行数据进行合并
1.3、 /// 查询
1.3.1、 配件编码查询
1.3.2、 配件名称查询
1.3.3、 配件类型查询
using QXQPS.Vo;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace QXQPS.Areas.InventoryManagment.Controllers
{
public class AccessoriesqueryController : Controller
{
Models.QXQPEntities myModels = new Models.QXQPEntities();
// GET: InventoryManagment/Accessoriesquery
public ActionResult query()//库存配件查询
{
return View();
}
public ActionResult SelectWarehouse()//
{
List<SelectVo> listWarehouse = (from tbWarehouse in myModels.SYS_Warehouse
select new SelectVo
{
id = tbWarehouse.WarehouseID,
text = tbWarehouse.WarehouseName.Trim()
}).ToList();
-
-
- //把数据库数据加到表格:跟默认然一行数据进行合并
-
listWarehouse = Common.Tools.SetSelectJson(listWarehouse);//设置selectjson
return Json(listWarehouse, JsonRequestBehavior.AllowGet);
}
/// <summary>
-
- /// 查询
/// </summary>
/// <returns></returns>
public ActionResult SelectQuery(BsgridPage bsgridPage, string FittingsCode, string FittingsName, string FittingsType, int WarehouseID)
{
var lingItem = (from tbQuery in myModels.SYS_Inventory
join tbWarehouse in myModels.SYS_Warehouse on tbQuery.WarehouseID equals tbWarehouse.WarehouseID
select new QueryVo
{
InventoryID = tbQuery.InventoryID,//库存ID
WarehouseID = tbWarehouse.WarehouseID,//仓库ID
WarehouseName = tbWarehouse.WarehouseName,//仓库名称
FittingsTypeName = tbQuery.FittingsType.Trim() ,//所属类型
FittingsCode = tbQuery.FittingsCode,//配件编码
FittingsName = tbQuery.FittingsName,//配件名称
VehicleType = tbQuery.VehicleType,//车型
SystemUnit = tbQuery.SystemUnit,//单位
InvenQuan = tbQuery.InvenQuan,//库存量
NewIntake = tbQuery.NewIntake,//最新进价
WholePrice = tbQuery.WholePrice,//批发价
SalePrice = tbQuery.SalePrice,//销售价
MinInventory = tbQuery.MinInventory,//最低库存
Position = tbQuery.Position,//仓位
}).ToList();
#region
if (!string.IsNullOrEmpty(FittingsCode))
{
lingItem = lingItem.Where(m => m.FittingsCode.Contains(FittingsCode)).ToList();//
}
if (!string.IsNullOrEmpty(FittingsName))
{
lingItem = lingItem.Where(m => m.FittingsName.Contains(FittingsName)).ToList();//
}
if (!string.IsNullOrEmpty(FittingsType))
{
lingItem = lingItem.Where(m => m.FittingsTypeName.Contains(FittingsType)).ToList();//
}
if (WarehouseID > 0)
{
lingItem = lingItem.Where(m => m.WarehouseID == WarehouseID).ToList();
}
#endregion
int count = lingItem.Count();
List<QueryVo> listQuery = lingItem.OrderByDescending(m => m.InventoryID).Skip(bsgridPage.GetStartIndex()).Take(bsgridPage.pageSize).ToList();
Bsgrid<QueryVo> bsgrid = new Bsgrid<QueryVo>()
{
success = true,
totalRows = count,
curPage = bsgridPage.curPage,
data = listQuery,
};
return Json(bsgrid, JsonRequestBehavior.AllowGet);
}
/// <summary>