1
This commit is contained in:
@@ -152,5 +152,61 @@ namespace WebAPI.Controllers
|
||||
}
|
||||
return responeData;
|
||||
}
|
||||
|
||||
|
||||
#region 根据id删除专项检查明细
|
||||
|
||||
/// <summary>
|
||||
/// 根据id删除专项检查明细
|
||||
/// </summary>
|
||||
/// <param name="newItem">专项检查</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public Model.ResponeData deleteCheckSpecialDetailById(string checkSpecialDetailId)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
Check_CheckSpecialDetailService.DeleteCheckSpecialDetailById(checkSpecialDetailId);
|
||||
responeData.message = "删除成功!";
|
||||
responeData.code = 1;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
|
||||
return responeData;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 保存专项检查 Check_CheckSpecial
|
||||
|
||||
/// <summary>
|
||||
/// 保存专项检查 Check_CheckSpecial
|
||||
/// </summary>
|
||||
/// <param name="newItem">专项检查</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public Model.ResponeData SaveCheckSpecialNew([FromBody] Model.CheckSpecialItem newItem)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
responeData.message = APICheckSpecialService.SaveCheckSpecialNew(newItem);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
|
||||
return responeData;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,219 @@
|
||||
using BLL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Http;
|
||||
|
||||
|
||||
namespace WebAPI.Controllers.HSSE
|
||||
{
|
||||
public class MaterialInAndOutRecordController : ApiController
|
||||
{
|
||||
#region 获取物资列表提供选择
|
||||
|
||||
//获取物资列表提供选择
|
||||
public Model.ResponeData GetGoodsCategoryList(string goodsCategoryName, int pageIndex = 0)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
List<Model.Base_GoodsCategory> result = GoodsCategoryService.GetGoodsCategoryList();
|
||||
if (!string.IsNullOrEmpty(goodsCategoryName))
|
||||
{
|
||||
result = result.Where(x => x.GoodsCategoryName.Contains(goodsCategoryName)).ToList();
|
||||
}
|
||||
|
||||
int resultCount = result.Count();
|
||||
if (resultCount > 0 && pageIndex > 0)
|
||||
{
|
||||
result = result.Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList();
|
||||
}
|
||||
|
||||
responeData.data = result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
|
||||
return responeData;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 获取物资单位列表提供选择
|
||||
|
||||
//获取物资列表提供选择
|
||||
public Model.ResponeData GetMaterialUnitList(string materialUnitName, int pageIndex = 0)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
List<Model.Base_MaterialUnit> result = MaterialUnitService.GetMaterialUnitList();
|
||||
if (!string.IsNullOrEmpty(materialUnitName))
|
||||
{
|
||||
result = result.Where(x => x.MaterialUnitName.Contains(materialUnitName)).ToList();
|
||||
}
|
||||
|
||||
int resultCount = result.Count();
|
||||
if (resultCount > 0 && pageIndex > 0)
|
||||
{
|
||||
result = result.Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList();
|
||||
}
|
||||
|
||||
responeData.data = result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
|
||||
return responeData;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 保存物资进出记录
|
||||
|
||||
//保存物资进出记录
|
||||
[HttpPost]
|
||||
public Model.ResponeData SaveMaterialInAndOutRecord(Model.MaterialInAndOutRecord materialInAndOutRecord)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
if (!string.IsNullOrEmpty(materialInAndOutRecord.Id))
|
||||
{
|
||||
//编辑
|
||||
MaterialInAndOutRecordService.UpdateMaterialInAndOutRecord(materialInAndOutRecord);
|
||||
}
|
||||
else
|
||||
{
|
||||
//新增
|
||||
materialInAndOutRecord.Id = SQLHelper.GetNewID(typeof(Model.MaterialInAndOutRecord));
|
||||
materialInAndOutRecord.CompileDate = DateTime.Now;
|
||||
MaterialInAndOutRecordService.AddMaterialInAndOutRecord(materialInAndOutRecord);
|
||||
}
|
||||
|
||||
responeData.data = "保存成功";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
|
||||
return responeData;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 根据id删除物资进出记录
|
||||
|
||||
//根据id删除物资进出记录
|
||||
[HttpPost]
|
||||
public Model.ResponeData DelMaterialInAndOutRecordById(string id)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
MaterialInAndOutRecordService.DeleteMaterialInAndOutRecordById(id);
|
||||
responeData.data = "删除成功";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
|
||||
return responeData;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 根据id获取物资进出记录
|
||||
|
||||
//根据id获取物资进出记录
|
||||
public Model.ResponeData GetMaterialInAndOutRecordById(string id)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
var result = (from record in Funs.DB.MaterialInAndOutRecord
|
||||
join materialUnit in Funs.DB.Base_MaterialUnit on record.MaterialUnitId equals materialUnit
|
||||
.MaterialUnitId into MaterialUnitGroup
|
||||
from materialUnit in MaterialUnitGroup.DefaultIfEmpty()
|
||||
join unit in Funs.DB.Base_Unit on record.UnitId equals unit.UnitId into UnitGroup
|
||||
from unit in UnitGroup.DefaultIfEmpty()
|
||||
join users in Funs.DB.Sys_User on record.CompileMan equals users.UserId into UsersGroup
|
||||
from users in UsersGroup.DefaultIfEmpty()
|
||||
where record.Id == id
|
||||
select new
|
||||
{
|
||||
record.Id,
|
||||
record.ProjectId,
|
||||
record.GoodsCategoryId,
|
||||
record.GoodsCategoryName,
|
||||
record.MaterialModel,
|
||||
record.InOutDate,
|
||||
record.InOrOut,
|
||||
record.Number,
|
||||
record.UnitId,
|
||||
record.Remark,
|
||||
record.CompileMan,
|
||||
record.CompileDate,
|
||||
record.MaterialUnitId,
|
||||
MaterialUnitName = materialUnit != null ? materialUnit.MaterialUnitName : null,
|
||||
UnitName = unit != null ? unit.UnitName : null,
|
||||
CompileManName = users != null ? users.UserName : null
|
||||
}).FirstOrDefault();
|
||||
responeData.data = result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
|
||||
return responeData;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 获取物资进出记录列表
|
||||
|
||||
//获取物资进出记录列表
|
||||
public Model.ResponeData GetMaterialInAndOutRecordList(int pageIndex = 0)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
var data = MaterialInAndOutRecordService.GetMaterialInAndOutRecordList();
|
||||
int dataCount = data.Count();
|
||||
if (dataCount > 0 && pageIndex > 0)
|
||||
{
|
||||
data = data.Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList();
|
||||
}
|
||||
|
||||
responeData.data = data;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = ex.Message;
|
||||
}
|
||||
|
||||
return responeData;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -92,13 +92,18 @@ namespace WebAPI.Controllers
|
||||
/// <param name="projectId"></param>
|
||||
/// <param name="unitId"></param>
|
||||
/// <param name="pageIndex"></param>
|
||||
/// <param name="personName"></param>
|
||||
/// <returns></returns>
|
||||
public Model.ResponeData getPersonByProjectIdUnitId(string projectId, string unitId, int pageIndex)
|
||||
public Model.ResponeData getPersonByProjectIdUnitId(string projectId, string unitId, int pageIndex, string personName = "")
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
try
|
||||
{
|
||||
var getDataList = APIPersonService.getPersonByProjectIdUnitId(projectId, unitId);
|
||||
if (!string.IsNullOrEmpty(personName))
|
||||
{
|
||||
getDataList = getDataList.Where(x => x.PersonName.Contains(personName)).ToList();
|
||||
}
|
||||
int pageCount = getDataList.Count;
|
||||
if (pageCount > 0 && pageIndex > 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user