目录
1、 PurchaseorderController
1.1、 //审核采购单
1.2、 //反审核采购单
1.3、 //查询采购明细数据
1.4、 //删除采购订单
using QXQPS.Models;
using QXQPS.Vo;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace QXQPS.Areas.AccessoriessalesManagment.Controllers
{
public class PurchaseorderController : Controller
{
QXQPEntities myModels = new Models.QXQPEntities();
// GET: AccessoriessalesManagment/Purchaseorder
public ActionResult SelectProDetail(int ProcurementID)
{
var listDetail = (from tbProcurDetail in myModels.SYS_ProcurementDetail
join tbFittingsInfo in myModels.SYS_FittingsInfo on tbProcurDetail.FittingsInfoID equals tbFittingsInfo.FittingsInfoID
join tbFittingsType in myModels.SYS_FittingsType on tbFittingsInfo.FittingsTypeID equals tbFittingsType.FittingsTypeID
join tbVehicleTypes in myModels.SYS_VehicleType on tbFittingsInfo.VehicleTypeID equals tbVehicleTypes.VehicleTypeID
join tbSystemUnites in myModels.SYS_SystemUnit on tbFittingsInfo.SystemUnitID equals tbSystemUnites.SystemUnitID
where tbProcurDetail.ProcurementID == ProcurementID
select new ProDetailVo
{
ProcurementDetailID = tbProcurDetail.ProcurementDetailID,
FittingsInfoID = tbFittingsInfo.FittingsInfoID,
FittingsCode = tbFittingsInfo.FittingsCode.Trim(),
FittingsTypeName = tbFittingsType.FittingsTypeName.Trim(),
FittingsName = tbFittingsInfo.FittingsName.Trim(),
Specification = tbFittingsInfo.Specification.Trim(),
VehicleType = tbVehicleTypes.VehicleType.Trim(),
SystemUnit = tbSystemUnites.SystemUnit.Trim(),
Quantity = tbProcurDetail.Quantity,
UnitPrice = tbProcurDetail.UnitPrice,
Discount = tbProcurDetail.Discount,
Amount = tbProcurDetail.Amount,
FirmQuantity=tbProcurDetail.FirmQuantity
}).ToList();
return Json(listDetail, JsonRequestBehavior.AllowGet);
}
public ActionResult DeleteProcurement(int ProcurementID)
{
try
{
var listProcur = myModels.PW_Procurement.Where(m => m.ProcurementID == ProcurementID).Single();
var listproDetail = myModels.SYS_ProcurementDetail.Where(m => m.ProcurementID == ProcurementID).ToList();
myModels.PW_Procurement.Remove(listProcur);
myModels.SYS_ProcurementDetail.RemoveRange(listproDetail);
myModels.SaveChanges();
}
catch (Exception)
{
return Json(false, JsonRequestBehavior.AllowGet);
}
return Json(true, JsonRequestBehavior.AllowGet);
}
}
}