前一单点击触发事件

在日常项目中,总会有很多单子,有时候为了方便查找,就做了一个查询功能,但是,这里讲的是一个前一单后一单的点击事件,在单子少的时候查找十分的方便,在查找两个相邻的单子时,很好做对比。

首先要查到所有的单子信息,这个相对于比较简单
再查询是维修后单和前单的信息
//查询维修单后一单
public ActionResult SelectWeiXiuWeiTuoDanHouDan(int i)
{
try
{
var list = (from tbMaintenanceOrder in myModels.YW_MaintenanceOrder
join tbCarType in myModels.JC_CarType on tbMaintenanceOrder.CarTypeID equals tbCarType.CarTypeID //维修单车型ID对应
join tbBrand in myModels.JC_Brand on tbMaintenanceOrder.BrandID equals tbBrand.BrandID
join tbCarClass in myModels.JC_CarClass on tbMaintenanceOrder.CarClassID equals tbCarClass.CarClassID //维修单车类ID
join tbConnectCarMemberID in myModels.JC_ConnectCarMember on tbMaintenanceOrder.ConnectCarMemberID equals tbConnectCarMemberID.ConnectCarMemberID
join tbBusinessClass in myModels.JC_BusinessClass on tbMaintenanceOrder.BusinessClassID
equals tbBusinessClass.BusinessClassID //业务类ID
join tbServiceType in myModels.JC_ServiceType on tbMaintenanceOrder.ServiceTypeID equals tbServiceType.ServiceTypeID //维修类ID
join tbOilMeter in myModels.JC_OilMeter on tbMaintenanceOrder.OilMeterID equals tbOilMeter.OilMeterID //油表ID
join tbSettleAccountsVerifyState in myModels.JC_SettleAccountsVerifyState on tbMaintenanceOrder.SettleAccountsVerifyStateID equals tbSettleAccountsVerifyState.SettleAccountsVerifyStateID
join tbCarHost in myModels.JC_CarHost on tbMaintenanceOrder.CarHostID equals tbCarHost.CarHostID
where tbMaintenanceOrder.MaintenanceOrderID == i
select new
{
MaintenanceOrderID = tbMaintenanceOrder.MaintenanceOrderID,//维修单ID
CarHostID = tbCarHost.CarHostID,//车主ID
CarTypeID = tbCarType.CarTypeID,//车型ID
BrandID = tbBrand.BrandID,//厂牌ID
CarClassID = tbCarClass.CarClassID,//车类ID
ConnectCarMemberID = tbConnectCarMemberID.ConnectCarMemberID,//接车员ID
OilMeterID = tbOilMeter.OilMeterID,//油表ID
BusinessClassID = tbBusinessClass.BusinessClassID,//业务类ID
ServiceTypeID = tbServiceType.ServiceTypeID,//维修类ID
MaintenanceOrderNumber = tbMaintenanceOrder.MaintenanceOrderNumber,//维修单号
CarFrameNumber = tbCarHost.CarFrameNumber,//车架号
EngineNumber = tbCarHost.EngineNumber,//引擎号
EnterFactoryDate = tbMaintenanceOrder.EnterFactoryDate.Value.ToString(),
PlanCompleteDate = tbMaintenanceOrder.PlanCompleteDate.ToString(),//计划完成
EnterMillInside = tbMaintenanceOrder.EnterMillInside,//进厂里
FittingsDiscount = tbMaintenanceOrder.FittingsDiscount.ToString(),//配件折扣
ManageFee = tbMaintenanceOrder.ManageFee.ToString(),//管理费
PreferentialAmount = tbMaintenanceOrder.PreferentialAmount.ToString(),//优惠
TotalMoney = tbMaintenanceOrder.TotalMoney.ToString(), //合计金额
ReceivableMoney = tbMaintenanceOrder.ReceivableMoney.ToString(), //实收金额
OneselfNumber = tbMaintenanceOrder.OneselfNumber, //自编号
SettleAccountsTime = tbMaintenanceOrder.SettleAccountsTime.ToString().Trim(),
CarBoardNumber = tbCarHost.CarBoardNumber,//车牌号
CarHost = tbCarHost.CarHost,//车主
Linkman = tbCarHost.Linkman,//联系人
Phone = tbCarHost.Phone,//电话
MobilePhone = tbCarHost.MobilePhone,//手机
Location = tbCarHost.Location,//地址
}).Single();
return Json(list, JsonRequestBehavior.AllowGet);
}
catch (Exception e)
{
Console.Write(e);
return Json(“MeiShuJu”, JsonRequestBehavior.AllowGet);
}
}
//查询维修单前一单
public ActionResult SelectWeiXiuWeiTuoDanQianDan(int i)
{
try
{
var list = (from tbMaintenanceOrder in myModels.YW_MaintenanceOrder
join tbCarType in myModels.JC_CarType on tbMaintenanceOrder.CarTypeID equals tbCarType.CarTypeID //维修单车型ID对应
join tbBrand in myModels.JC_Brand on tbMaintenanceOrder.BrandID equals tbBrand.BrandID
join tbCarClass in myModels.JC_CarClass on tbMaintenanceOrder.CarClassID equals tbCarClass.CarClassID //维修单车类ID
join tbConnectCarMemberID in myModels.JC_ConnectCarMember on tbMaintenanceOrder.ConnectCarMemberID equals tbConnectCarMemberID.ConnectCarMemberID
join tbBusinessClass in myModels.JC_BusinessClass on tbMaintenanceOrder.BusinessClassID
equals tbBusinessClass.BusinessClassID //业务类ID
join tbServiceType in myModels.JC_ServiceType on tbMaintenanceOrder.ServiceTypeID equals tbServiceType.ServiceTypeID //维修类ID
join tbOilMeter in myModels.JC_OilMeter on tbMaintenanceOrder.OilMeterID equals tbOilMeter.OilMeterID //油表ID
join tbSettleAccountsVerifyState in myModels.JC_SettleAccountsVerifyState on tbMaintenanceOrder.SettleAccountsVerifyStateID equals tbSettleAccountsVerifyState.SettleAccountsVerifyStateID
join tbCarHost in myModels.JC_CarHost on tbMaintenanceOrder.CarHostID equals tbCarHost.CarHostID
where tbMaintenanceOrder.MaintenanceOrderID == i
select new
{
MaintenanceOrderID = tbMaintenanceOrder.MaintenanceOrderID,//维修单ID
CarHostID = tbCarHost.CarHostID,//车主ID
CarTypeID = tbCarType.CarTypeID,//车型ID
BrandID = tbBrand.BrandID,//厂牌ID
CarClassID = tbCarClass.CarClassID,//车类ID
ConnectCarMemberID = tbConnectCarMemberID.ConnectCarMemberID,//接车员ID
OilMeterID = tbOilMeter.OilMeterID,//油表ID
BusinessClassID = tbBusinessClass.BusinessClassID,//业务类ID
ServiceTypeID = tbServiceType.ServiceTypeID,//维修类ID
MaintenanceOrderNumber = tbMaintenanceOrder.MaintenanceOrderNumber,//维修单
CarFrameNumber = tbCarHost.CarFrameNumber,//车架号
EngineNumber = tbCarHost.EngineNumber,//引擎号
EnterFactoryDate = tbMaintenanceOrder.EnterFactoryDate.Value.ToString(),
PlanCompleteDate = tbMaintenanceOrder.PlanCompleteDate.ToString(),//计划完成
EnterMillInside = tbMaintenanceOrder.EnterMillInside,//进厂里
FittingsDiscount = tbMaintenanceOrder.FittingsDiscount.ToString(),//配件折扣
ManageFee = tbMaintenanceOrder.ManageFee.ToString(),//管理费
PreferentialAmount = tbMaintenanceOrder.PreferentialAmount.ToString(),//优惠
TotalMoney = tbMaintenanceOrder.TotalMoney.ToString(), //合计金额
ReceivableMoney = tbMaintenanceOrder.ReceivableMoney.ToString(), //实收金额
OneselfNumber = tbMaintenanceOrder.OneselfNumber, //自编号
SettleAccountsTime = tbMaintenanceOrder.SettleAccountsTime.ToString().Trim(),
CarBoardNumber = tbCarHost.CarBoardNumber,//车牌号
CarHost = tbCarHost.CarHost,//车主
Linkman = tbCarHost.Linkman,//联系人
Phone = tbCarHost.Phone,//电话
MobilePhone = tbCarHost.MobilePhone,//手机
Location = tbCarHost.Location,//地址
}).Single();
return Json(list, JsonRequestBehavior.AllowGet);
}
catch (Exception e)
{
Console.Write(e);
return Json("", JsonRequestBehavior.AllowGet);
}
}
--------------------- 

posted on 2019-08-01 19:13  激流勇进1  阅读(137)  评论(0编辑  收藏  举报