20210430
This commit is contained in:
@@ -0,0 +1,213 @@
|
||||
using System.Web.Http;
|
||||
using Model;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using BLL;
|
||||
|
||||
namespace Mvc.Controllers
|
||||
{
|
||||
public class CQMSConstructSolutionController : ApiController
|
||||
{
|
||||
//
|
||||
// 质量巡检
|
||||
// GET: /Draw/
|
||||
[HttpGet]
|
||||
public ResponseData<List<Solution_CQMSConstructSolution>> Index(string projectId, int index, int page, string name = null)
|
||||
{
|
||||
ResponseData<List<Solution_CQMSConstructSolution>> res = new ResponseData<List<Solution_CQMSConstructSolution>>();
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = BLL.CQMSConstructSolutionService.getListDataForApi(name, projectId, index, page);
|
||||
return res;
|
||||
}
|
||||
[HttpGet]
|
||||
public ResponseData<List<Solution_CQMSConstructSolution>> Search(string projectId, int index, int page, string unitId = "",string unitWork= "",string cNProfessionalCode="", string solutionType = "", string state = "")
|
||||
{
|
||||
ResponseData<List<Solution_CQMSConstructSolution>> res = new ResponseData<List<Solution_CQMSConstructSolution>>();
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = BLL.CQMSConstructSolutionService.getListDataForApi("", unitId , unitWork , cNProfessionalCode, solutionType , state, projectId, index, page);
|
||||
return res;
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据code获取详情
|
||||
/// </summary>
|
||||
/// <param name="CheckControlCode"></param>
|
||||
/// <returns></returns>
|
||||
public ResponseData<Solution_CQMSConstructSolution> GetSolution(string id)
|
||||
{
|
||||
ResponseData<Solution_CQMSConstructSolution> res = new ResponseData<Solution_CQMSConstructSolution>();
|
||||
Solution_CQMSConstructSolution checkControl = BLL.CQMSConstructSolutionService.GetConstructSolutionByConstructSolutionIdForApi(id);
|
||||
res.successful = true;
|
||||
res.resultValue = BeanUtil.CopyOjbect<Solution_CQMSConstructSolution>(checkControl, true);
|
||||
res.resultValue.Edition = checkControl.Edition;
|
||||
return res;
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据code获取 审核记录
|
||||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <returns></returns>
|
||||
public ResponseData<List<Solution_CQMSConstructSolutionApprove>> GetApproveById(string id,int edition)
|
||||
{
|
||||
ResponseData<List<Solution_CQMSConstructSolutionApprove>> res = new ResponseData<List<Solution_CQMSConstructSolutionApprove>>();
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = BLL.CQMSConstructSolutionApproveService.getListDataForApi(id);
|
||||
return res;
|
||||
}
|
||||
public ResponseData<Solution_CQMSConstructSolutionApprove> GetCurrApproveById(string id, string userId, int edition)
|
||||
{
|
||||
ResponseData<Solution_CQMSConstructSolutionApprove> res = new ResponseData<Solution_CQMSConstructSolutionApprove>();
|
||||
var approve = BLL.CQMSConstructSolutionApproveService.getCurrApproveForApi(id, userId, edition);
|
||||
res.successful = true;
|
||||
res.resultValue = BeanUtil.CopyOjbect<Solution_CQMSConstructSolutionApprove>(approve, true);
|
||||
if (approve != null)
|
||||
{
|
||||
res.resultValue.Edition = approve.Edition;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static void SaveAttachFile(string dataId, string menuId, string url)
|
||||
{
|
||||
Model.ToDoItem toDoItem = new Model.ToDoItem
|
||||
{
|
||||
MenuId = menuId,
|
||||
DataId = dataId,
|
||||
UrlStr = url,
|
||||
};
|
||||
APIUpLoadFileService.SaveAttachUrl(toDoItem);
|
||||
}
|
||||
/// <summary>
|
||||
/// 当前版次 会签人
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="edition"></param>
|
||||
/// <returns></returns>
|
||||
public ResponseData<List<Solution_CQMSConstructSolutionApprove>> GetConApproveById(string id, int edition)
|
||||
{
|
||||
ResponseData<List<Solution_CQMSConstructSolutionApprove>> res = new ResponseData<List<Solution_CQMSConstructSolutionApprove>>();
|
||||
res.successful = true;
|
||||
res.resultValue = BLL.CQMSConstructSolutionApproveService.getConApproveForApi(id, edition);
|
||||
return res;
|
||||
}
|
||||
[HttpPost]
|
||||
public ResponseData<string> AddApprove([FromBody]Model.Solution_CQMSConstructSolutionApprove approve)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
try
|
||||
{
|
||||
Model.Solution_CQMSConstructSolution CheckControl = new Model.Solution_CQMSConstructSolution();
|
||||
CheckControl.ConstructSolutionId = approve.ConstructSolutionId;
|
||||
CheckControl.State = approve.ApproveType;
|
||||
BLL.CQMSConstructSolutionService.UpdateConstructSolutionForApi(CheckControl);
|
||||
BLL.CQMSConstructSolutionApproveService.AddConstructSolutionApprove(approve);
|
||||
res.successful = true;
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
res.resultHint = e.StackTrace;
|
||||
res.successful = false;
|
||||
}
|
||||
return res;
|
||||
|
||||
}
|
||||
[HttpPost]
|
||||
public ResponseData<string> UpdateApprove([FromBody]Solution_CQMSConstructSolutionApprove approve)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
try
|
||||
{
|
||||
SaveAttachFile(approve.ConstructSolutionApproveId, BLL.Const.CQMSConstructSolutionMenuId, approve.AttachUrl);
|
||||
// Model.Check_CheckControlApprove approve1 = BLL.CheckControlApproveService.GetCheckControlApproveByCheckControlId(approve.CheckControlCode);
|
||||
approve.ApproveDate = DateTime.Now;
|
||||
approve = BLL.CQMSConstructSolutionApproveService.UpdateConstructSolutionApproveForApi(approve);
|
||||
var approves = BLL.CQMSConstructSolutionApproveService.getConApprovesForApi(approve.ConstructSolutionId, approve.Edition.Value);
|
||||
Solution_CQMSConstructSolutionApprove first = null;
|
||||
bool allAgree = true;
|
||||
bool hasFinish = true;
|
||||
foreach (Solution_CQMSConstructSolutionApprove a in approves)
|
||||
{
|
||||
if (a.ApproveType == "1")
|
||||
{
|
||||
first = a;
|
||||
}
|
||||
if (a.ApproveType == "2")
|
||||
{
|
||||
approve.ConstructSolutionId = a.ConstructSolutionId;
|
||||
if (a.IsAgree.HasValue && !a.IsAgree.Value)
|
||||
{
|
||||
allAgree = false;
|
||||
}
|
||||
if (!a.IsAgree.HasValue)
|
||||
{
|
||||
hasFinish = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!allAgree)
|
||||
{
|
||||
if (first != null && hasFinish)
|
||||
{
|
||||
Solution_CQMSConstructSolutionApprove approveReEdit = new Solution_CQMSConstructSolutionApprove();
|
||||
approveReEdit.ApproveType = "0";
|
||||
approveReEdit.ApproveMan = first.ApproveMan.Split('$')[0];
|
||||
approveReEdit.ConstructSolutionId = first.ConstructSolutionId;
|
||||
approveReEdit.Edition = first.Edition;
|
||||
BLL.CQMSConstructSolutionApproveService.AddConstructSolutionApproveForApi(approveReEdit);
|
||||
Model.Solution_CQMSConstructSolution CheckControl = new Model.Solution_CQMSConstructSolution();
|
||||
CheckControl.ConstructSolutionId = approveReEdit.ConstructSolutionId;
|
||||
CheckControl.State = approveReEdit.ApproveType;
|
||||
BLL.CQMSConstructSolutionService.UpdateConstructSolutionForApi(CheckControl);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (hasFinish)
|
||||
{
|
||||
Solution_CQMSConstructSolutionApprove approveReEdit = new Solution_CQMSConstructSolutionApprove();
|
||||
approveReEdit.ApproveType = "3";
|
||||
approveReEdit.ConstructSolutionId = approve.ConstructSolutionId;
|
||||
approveReEdit.Edition = approve.Edition;
|
||||
BLL.CQMSConstructSolutionApproveService.AddConstructSolutionApproveForApi(approveReEdit);
|
||||
Model.Solution_CQMSConstructSolution CheckControl = new Model.Solution_CQMSConstructSolution();
|
||||
CheckControl.ConstructSolutionId = approveReEdit.ConstructSolutionId;
|
||||
CheckControl.State = approveReEdit.ApproveType;
|
||||
BLL.CQMSConstructSolutionService.UpdateConstructSolutionForApi(CheckControl);
|
||||
}
|
||||
}
|
||||
if (first != null)
|
||||
{
|
||||
Solution_CQMSConstructSolutionApprove approveS = new Solution_CQMSConstructSolutionApprove();
|
||||
approveS.ApproveType = "S";
|
||||
approveS.ApproveMan = first.ApproveMan.Split('$')[0];
|
||||
approveS.ConstructSolutionId = first.ConstructSolutionId;
|
||||
approveS.Edition = first.Edition;
|
||||
BLL.CQMSConstructSolutionApproveService.AddConstructSolutionApproveForApi(approveS);
|
||||
}
|
||||
res.successful = true;
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
res.resultHint = e.StackTrace;
|
||||
res.successful = false;
|
||||
}
|
||||
return res;
|
||||
|
||||
}
|
||||
[HttpGet]
|
||||
public ResponseData<string> see(string dataId, string userId)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
res.successful = true;
|
||||
BLL.CQMSConstructSolutionApproveService.See(dataId, userId);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Http;
|
||||
using Model;
|
||||
using BLL;
|
||||
|
||||
namespace Mvc.Controllers
|
||||
{
|
||||
public class CheckEquipmentController : ApiController
|
||||
{
|
||||
//
|
||||
// GET: /CheckEquipment/
|
||||
[HttpGet]
|
||||
public ResponseData<List<Check_CheckEquipment>> Index(string projectId, int index, int page, string name = null)
|
||||
{
|
||||
ResponseData<List<Check_CheckEquipment>> res = new ResponseData<List<Check_CheckEquipment>>();
|
||||
if (name == null)
|
||||
name = "";
|
||||
res.successful = true;
|
||||
try
|
||||
{
|
||||
res.resultValue = BLL.CheckEquipmentService.getListByProject(name, projectId, index, page);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
res.resultHint = e.StackTrace;
|
||||
res.successful = false;
|
||||
}
|
||||
return res; ;
|
||||
}
|
||||
|
||||
// GET: /详情
|
||||
[HttpGet]
|
||||
public ResponseData<Check_CheckEquipment> GetCheckEquipmentById(string id)
|
||||
{
|
||||
ResponseData<Check_CheckEquipment> res = new ResponseData<Check_CheckEquipment>();
|
||||
//Check_CheckEquipment ce = BLL.CheckEquipmentService.GetCheckEquipmentByCheckEquipmentIdForApi(id);
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = BLL.CheckEquipmentService.GetCheckEquipmentByCheckEquipmentIdForApi(id);
|
||||
return res;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
// 获取当前办理状态
|
||||
public ResponseData<Check_CheckEquipmentApprove> GetCurrApproveByCheckEquipmentId(string code)
|
||||
{
|
||||
ResponseData<Check_CheckEquipmentApprove> res = new ResponseData<Check_CheckEquipmentApprove>();
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = BeanUtil.CopyOjbect<Check_CheckEquipmentApprove>(BLL.CheckEquipmentApproveService.CurrentApproveType(code), true);
|
||||
return res;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ResponseData<List<Check_CheckEquipmentApprove>> GetApproveByEquipmentId(string id)
|
||||
{
|
||||
ResponseData<List<Check_CheckEquipmentApprove>> res = new ResponseData<List<Check_CheckEquipmentApprove>>();
|
||||
res.successful = true;
|
||||
res.resultValue = BLL.CheckEquipmentApproveService.getListDataByEid(id);
|
||||
return res;
|
||||
}
|
||||
|
||||
// 保存提交的检实验信息
|
||||
[HttpPost]
|
||||
public ResponseData<string> AddEquipment([FromBody]Model.Check_CheckEquipment CheckEquipment)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(CheckEquipment.CheckEquipmentId))
|
||||
{
|
||||
CheckEquipment.CheckEquipmentId = Guid.NewGuid().ToString();
|
||||
BLL.CheckEquipmentService.AddCheckEquipment(CheckEquipment);
|
||||
SaveAttachFile(CheckEquipment.CheckEquipmentId, BLL.Const.CheckEquipmentMenuId, CheckEquipment.AttachUrl);
|
||||
res.resultValue = CheckEquipment.CheckEquipmentId;
|
||||
}else
|
||||
{
|
||||
BLL.CheckEquipmentService.UpdateCheckEquipment(CheckEquipment);
|
||||
SaveAttachFile(CheckEquipment.CheckEquipmentId, BLL.Const.CheckEquipmentMenuId, CheckEquipment.AttachUrl);
|
||||
res.resultValue = CheckEquipment.CheckEquipmentId;
|
||||
}
|
||||
res.successful = true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
res.resultHint = e.StackTrace;
|
||||
res.successful = false;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public static void SaveAttachFile(string dataId, string menuId, string url)
|
||||
{
|
||||
Model.ToDoItem toDoItem = new Model.ToDoItem
|
||||
{
|
||||
MenuId = menuId,
|
||||
DataId = dataId,
|
||||
UrlStr = url,
|
||||
};
|
||||
APIUpLoadFileService.SaveAttachUrl(toDoItem);
|
||||
}
|
||||
|
||||
// 更新
|
||||
[HttpPost]
|
||||
public ResponseData<string> UpdateApprove([FromBody]Model.Check_CheckEquipmentApprove approve)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
try
|
||||
{
|
||||
approve.ApproveDate = DateTime.Now;
|
||||
BLL.CheckEquipmentApproveService.UpdateCheckEquipmentApproveApi(approve);
|
||||
res.successful = true;
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
res.resultHint = e.StackTrace;
|
||||
res.successful = false;
|
||||
}
|
||||
return res;
|
||||
|
||||
}
|
||||
// 添加办理记录(提交)
|
||||
[HttpPost]
|
||||
public ResponseData<string> AddApprove([FromBody]Model.Check_CheckEquipmentApprove approve)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
try
|
||||
{
|
||||
|
||||
Model.Check_CheckEquipment CheckControl = new Model.Check_CheckEquipment();
|
||||
CheckControl.CheckEquipmentId = approve.CheckEquipmentId;
|
||||
CheckControl.State = approve.ApproveType;
|
||||
BLL.CheckEquipmentService.UpdateCheckEquipment(CheckControl);
|
||||
res.resultValue = BLL.CheckEquipmentApproveService.AddCheckEquipmentApproveApi(approve);
|
||||
res.successful = true;
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
res.resultHint = e.StackTrace;
|
||||
res.successful = false;
|
||||
}
|
||||
return res;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
using System.Web.Http;
|
||||
using Model;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using BLL;
|
||||
|
||||
namespace Mvc.Controllers
|
||||
{
|
||||
public class CheckListController : ApiController
|
||||
{
|
||||
//
|
||||
// 质量巡检
|
||||
// GET: /Draw/
|
||||
[HttpGet]
|
||||
public ResponseData<List<Check_CheckControl>> Index(string projectId, int index, int page, string state, string name)
|
||||
{
|
||||
ResponseData<List<Check_CheckControl>> res = new ResponseData<List<Check_CheckControl>>();
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = BLL.CheckControlService.GetListDataForApi(state, name, projectId, index, page);
|
||||
return res;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ResponseData<string> Conut(string projectId, string searchWord, string unitId = null, string unitWork = null, string problemType = null, string professional = null, string dateA = null, string dateZ = null)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
res.successful = true;
|
||||
res.resultValue = BLL.CheckControlService.GetListCountStr(projectId, searchWord, unitId, unitWork, problemType, professional, dateA, dateZ);
|
||||
return res;
|
||||
}
|
||||
[HttpGet]
|
||||
public ResponseData<List<Check_CheckControl>> Search(string state, string projectId, int index, int page, string unitId = null, string unitWork = null, string problemType = null, string professional = null, string dateA = null, string dateZ = null)
|
||||
{
|
||||
ResponseData<List<Check_CheckControl>> res = new ResponseData<List<Check_CheckControl>>();
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = BLL.CheckControlService.GetListDataForApi(state, unitId, unitWork, problemType, professional,dateA, dateZ, projectId, index, page);
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据code获取详情
|
||||
/// </summary>
|
||||
/// <param name="CheckControlCode"></param>
|
||||
/// <returns></returns>
|
||||
public ResponseData<Check_CheckControl> GetCheckControl(string code)
|
||||
{
|
||||
ResponseData<Check_CheckControl> res = new ResponseData<Check_CheckControl>();
|
||||
Check_CheckControl checkControl = BLL.CheckControlService.GetCheckControlForApi(code);
|
||||
res.successful = true;
|
||||
res.resultValue = BeanUtil.CopyOjbect<Check_CheckControl>(checkControl, true);
|
||||
return res;
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据code获取 审核记录
|
||||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <returns></returns>
|
||||
public ResponseData<List<Check_CheckControlApprove>> GetApproveByCode(string code)
|
||||
{
|
||||
ResponseData<List<Check_CheckControlApprove>> res = new ResponseData<List<Check_CheckControlApprove>>();
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = BLL.CheckControlApproveService.GetListDataByCodeForApi(code);
|
||||
return res;
|
||||
}
|
||||
public ResponseData<Check_CheckControlApprove> GetCurrApproveByCode(string code)
|
||||
{
|
||||
ResponseData<Check_CheckControlApprove> res = new ResponseData<Check_CheckControlApprove>();
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = BeanUtil.CopyOjbect<Check_CheckControlApprove>(BLL.CheckControlApproveService.getCurrApproveForApi(code), true);
|
||||
return res;
|
||||
}
|
||||
[HttpPost]
|
||||
public ResponseData<string> AddCheckControl([FromBody]Model.Check_CheckControl CheckControl)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(CheckControl.CheckControlCode))
|
||||
{
|
||||
if (string.IsNullOrEmpty(CheckControl.DocCode))
|
||||
{
|
||||
string prefix = BLL.ProjectService.GetProjectByProjectId(CheckControl.ProjectId).ProjectCode + "-06-CM03-XJ-";
|
||||
CheckControl.DocCode = BLL.SQLHelper.RunProcNewId("SpGetNewCode5", "dbo.Check_CheckControl", "DocCode", prefix);
|
||||
}
|
||||
CheckControl.CheckControlCode = Guid.NewGuid().ToString();
|
||||
BLL.CheckControlService.AddCheckControlForApi(CheckControl);
|
||||
//BLL.AttachFileService.updateAttachFile(CheckControl.ReAttachUrl, CheckControl.CheckControlCode+"r", Const.CheckListMenuId);
|
||||
//BLL.AttachFileService.updateAttachFile(CheckControl.AttachUrl, CheckControl.CheckControlCode, Const.CheckListMenuId);
|
||||
SaveAttachFile(CheckControl.CheckControlCode + "r", BLL.Const.CheckListMenuId, CheckControl.ReAttachUrl);
|
||||
SaveAttachFile(CheckControl.CheckControlCode, BLL.Const.CheckListMenuId, CheckControl.AttachUrl);
|
||||
res.resultValue = CheckControl.CheckControlCode;
|
||||
}
|
||||
else
|
||||
{
|
||||
BLL.CheckControlService.UpdateCheckControlForApi(CheckControl);
|
||||
//BLL.AttachFileService.updateAttachFile(CheckControl.ReAttachUrl, CheckControl.CheckControlCode + "r", Const.CheckListMenuId);
|
||||
//BLL.AttachFileService.updateAttachFile(CheckControl.AttachUrl, CheckControl.CheckControlCode, Const.CheckListMenuId);
|
||||
SaveAttachFile(CheckControl.CheckControlCode + "r", BLL.Const.CheckListMenuId, CheckControl.ReAttachUrl);
|
||||
SaveAttachFile(CheckControl.CheckControlCode, BLL.Const.CheckListMenuId, CheckControl.AttachUrl);
|
||||
res.resultValue = CheckControl.CheckControlCode;
|
||||
}
|
||||
|
||||
res.successful = true;
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
res.resultHint = e.StackTrace;
|
||||
res.successful = false;
|
||||
}
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static void SaveAttachFile(string dataId, string menuId, string url)
|
||||
{
|
||||
Model.ToDoItem toDoItem = new Model.ToDoItem
|
||||
{
|
||||
MenuId = menuId,
|
||||
DataId = dataId,
|
||||
UrlStr = url,
|
||||
};
|
||||
APIUpLoadFileService.SaveAttachUrl(toDoItem);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ResponseData<string> AddApprove([FromBody]Model.Check_CheckControlApprove approve)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
try
|
||||
{
|
||||
|
||||
Model.Check_CheckControl CheckControl = new Model.Check_CheckControl();
|
||||
CheckControl.CheckControlCode = approve.CheckControlCode;
|
||||
CheckControl.State=approve.ApproveType;
|
||||
BLL.CheckControlService.UpdateCheckControlForApi(CheckControl);
|
||||
res.resultValue = BLL.CheckControlApproveService.AddCheckControlApproveForApi(approve);
|
||||
res.successful = true;
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
res.resultHint = e.StackTrace;
|
||||
res.successful = false;
|
||||
}
|
||||
return res;
|
||||
|
||||
}
|
||||
[HttpPost]
|
||||
public ResponseData<string> UpdateApprove([FromBody]Model.Check_CheckControlApprove approve)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
try
|
||||
{
|
||||
// Model.Check_CheckControlApprove approve1 = BLL.CheckControlApproveService.GetCheckControlApproveByCheckControlId(approve.CheckControlCode);
|
||||
|
||||
approve.ApproveDate = DateTime.Now;
|
||||
BLL.CheckControlApproveService.UpdateCheckControlApproveForApi(approve);
|
||||
res.successful = true;
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
res.resultHint = e.StackTrace;
|
||||
res.successful = false;
|
||||
}
|
||||
return res;
|
||||
|
||||
}
|
||||
// GET: /Draw/
|
||||
[HttpGet]
|
||||
public ResponseData<string> see(string dataId, string userId)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
res.successful = true;
|
||||
BLL.CheckControlApproveService.See(dataId, userId);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,466 @@
|
||||
using System.Web;
|
||||
using System.Web.Http;
|
||||
using Model;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Configuration;
|
||||
using System;
|
||||
|
||||
namespace Mvc.Controllers
|
||||
{
|
||||
public class CommenInfoController : ApiController
|
||||
{
|
||||
//
|
||||
// GET: /CommenInfo/
|
||||
[HttpGet]
|
||||
public ResponseData<List<Base_Unit>> GetSubUnitList(string projectId, string unitType = "", string name = "")
|
||||
{
|
||||
ResponseData<List<Base_Unit>> res = new ResponseData<List<Base_Unit>>();
|
||||
if (string.IsNullOrEmpty(name)) name = "";
|
||||
if (string.IsNullOrEmpty(unitType)) unitType = "";
|
||||
List<Project_ProjectUnit> q = BLL.ProjectUnitService.GetProjectUnitListByProjectIdForApi(projectId, unitType, name);
|
||||
List<Base_Unit> a = new List<Base_Unit>();
|
||||
for (int i = 0; i < q.Count; i++)
|
||||
{
|
||||
var unit = q[i].Base_Unit;
|
||||
unit.UnitTypeId = q[i].UnitType;
|
||||
a.Add(BeanUtil.CopyOjbect<Base_Unit>(unit, true));
|
||||
}
|
||||
res.successful = true;
|
||||
res.resultValue = a;
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据项目Id和单位Id获取项目单位类型
|
||||
/// </summary>
|
||||
/// <param name="projectId"></param>
|
||||
/// <param name="unitId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public ResponseData<string> GetUnitType(string projectId, string unitId)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
string unitType = string.Empty;
|
||||
var projectUnit = BLL.ProjectUnitService.GetProjectUnitByUnitIdProjectId(projectId, unitId);
|
||||
if (projectUnit != null)
|
||||
{
|
||||
unitType = projectUnit.UnitType;
|
||||
}
|
||||
res.successful = true;
|
||||
res.resultValue = unitType;
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取质量问题类别
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public ResponseData<List<Base_QualityQuestionType>> GetQualityQuestionType()
|
||||
{
|
||||
ResponseData<List<Base_QualityQuestionType>> res = new ResponseData<List<Base_QualityQuestionType>>();
|
||||
List<Base_QualityQuestionType> q = BLL.QualityQuestionTypeService.GetList();
|
||||
List<Base_QualityQuestionType> a = new List<Base_QualityQuestionType>();
|
||||
for (int i = 0; i < q.Count; i++)
|
||||
{
|
||||
a.Add(BeanUtil.CopyOjbect<Base_QualityQuestionType>(q[i], true));
|
||||
}
|
||||
res.successful = true;
|
||||
res.resultValue = a;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
public ResponseData<List<ProjectData_MainItem>> GetMainItemList(string projectId, string unitWorks = "", string name = "")
|
||||
{
|
||||
ResponseData<List<ProjectData_MainItem>> res = new ResponseData<List<ProjectData_MainItem>>();
|
||||
if (string.IsNullOrEmpty(name)) name = "";
|
||||
if (string.IsNullOrEmpty(unitWorks)) unitWorks = "";
|
||||
res.resultValue = BLL.MainItemService.GetMainItemList(projectId, unitWorks, name);
|
||||
res.successful = true;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public ResponseData<List<WBS_UnitWork>> GetUnitWorkListByPid(string projectId)
|
||||
{
|
||||
ResponseData<List<WBS_UnitWork>> res = new ResponseData<List<WBS_UnitWork>>();
|
||||
List<WBS_UnitWork> a = BLL.UnitWorkService.GetUnitWorkListByPid(projectId);
|
||||
List<WBS_UnitWork> q = new List<WBS_UnitWork>();
|
||||
foreach (var u in a)
|
||||
{
|
||||
var temp = BeanUtil.CopyOjbect<WBS_UnitWork>(u, true);
|
||||
temp.UnitWorkId = u.UnitWorkId;
|
||||
temp.UnitWorkName = u.UnitWorkCode + "-" + u.UnitWorkName + BLL.UnitWorkService.GetProjectType(u.ProjectType);
|
||||
q.Add(temp);
|
||||
|
||||
}
|
||||
res.successful = true;
|
||||
res.resultValue = q;
|
||||
return res;
|
||||
}
|
||||
[HttpGet]
|
||||
public ResponseData<List<WBS_UnitWork>> GetUnitWorkListByPidAndPtype(string projectId, string projectType)
|
||||
{
|
||||
ResponseData<List<WBS_UnitWork>> res = new ResponseData<List<WBS_UnitWork>>();
|
||||
List<WBS_UnitWork> a = BLL.UnitWorkService.GetUnitWorkListByPidForApi(projectId, projectType);
|
||||
List<WBS_UnitWork> q = new List<WBS_UnitWork>();
|
||||
foreach (var u in a)
|
||||
{
|
||||
var temp = BeanUtil.CopyOjbect<WBS_UnitWork>(u, true);
|
||||
temp.UnitWorkId = u.UnitWorkId;
|
||||
temp.UnitWorkName = u.UnitWorkCode + "-" + u.UnitWorkName + BLL.UnitWorkService.GetProjectType(u.ProjectType);
|
||||
q.Add(temp);
|
||||
|
||||
}
|
||||
res.successful = true;
|
||||
res.resultValue = q;
|
||||
return res;
|
||||
}
|
||||
[HttpGet]
|
||||
public ResponseData<List<Base_CNProfessional>> GetCNProfessionalMainItem()
|
||||
{
|
||||
ResponseData<List<Base_CNProfessional>> res = new ResponseData<List<Base_CNProfessional>>();
|
||||
List<Base_CNProfessional> resList = new List<Base_CNProfessional>();
|
||||
var list = BLL.CNProfessionalService.GetList();
|
||||
if (list != null)
|
||||
{
|
||||
foreach (var item in list)
|
||||
{
|
||||
Base_CNProfessional main = new Base_CNProfessional();
|
||||
main.CNProfessionalCode = item.CNProfessionalId;
|
||||
main.SortIndex = item.SortIndex;
|
||||
main.ProfessionalName = item.ProfessionalName;
|
||||
resList.Add(main);
|
||||
}
|
||||
}
|
||||
res.successful = true;
|
||||
res.resultValue = resList;
|
||||
return res;
|
||||
}
|
||||
[HttpGet]
|
||||
public ResponseData<List<Base_DesignProfessional>> GetDesignProfessionalMainItem()
|
||||
{
|
||||
ResponseData<List<Base_DesignProfessional>> res = new ResponseData<List<Base_DesignProfessional>>();
|
||||
List<Base_DesignProfessional> resList = new List<Base_DesignProfessional>();
|
||||
var list = BLL.DesignProfessionalService.GetList();
|
||||
if (list != null)
|
||||
{
|
||||
foreach (var item in list)
|
||||
{
|
||||
Base_DesignProfessional main = new Base_DesignProfessional();
|
||||
main.DesignProfessionalId = item.DesignProfessionalId;
|
||||
main.SortIndex = item.SortIndex;
|
||||
main.ProfessionalName = item.ProfessionalName;
|
||||
resList.Add(main);
|
||||
}
|
||||
}
|
||||
res.successful = true;
|
||||
res.resultValue = resList;
|
||||
return res;
|
||||
}
|
||||
[HttpGet]
|
||||
public ResponseData<List<Sys_User>> FindAllUser()
|
||||
{
|
||||
ResponseData<List<Sys_User>> res = new ResponseData<List<Sys_User>>();
|
||||
List<Sys_User> list;
|
||||
|
||||
list = BLL.UserService.GetUserList();
|
||||
|
||||
List<Sys_User> users = new List<Sys_User>();
|
||||
foreach (var item in list)
|
||||
{
|
||||
users.Add(BeanUtil.CopyOjbect<Sys_User>(item, true));
|
||||
}
|
||||
res.successful = true;
|
||||
res.resultValue = users;
|
||||
return res;
|
||||
}
|
||||
[HttpGet]
|
||||
public ResponseData<List<Sys_User>> FindAllUser(string projectId, string name = "")
|
||||
{
|
||||
ResponseData<List<Sys_User>> res = new ResponseData<List<Sys_User>>();
|
||||
List<Sys_User> list;
|
||||
if (string.IsNullOrEmpty(name))
|
||||
name = "";
|
||||
|
||||
list = BLL.UserService.GetProjectUserListByProjectIdForApi(projectId, name);
|
||||
List<Sys_User> users = new List<Sys_User>();
|
||||
foreach (var item in list)
|
||||
{
|
||||
users.Add(BeanUtil.CopyOjbect<Sys_User>(item, true));
|
||||
}
|
||||
res.successful = true;
|
||||
res.resultValue = users;
|
||||
return res;
|
||||
}
|
||||
[HttpGet]
|
||||
public ResponseData<List<Sys_User>> FindUserByUnit(string projectId, string unitId = "", string unitType = "", string name = "")
|
||||
{
|
||||
ResponseData<List<Sys_User>> res = new ResponseData<List<Sys_User>>();
|
||||
List<Sys_User> list;
|
||||
if (string.IsNullOrEmpty(unitId))
|
||||
unitId = "";
|
||||
if (string.IsNullOrEmpty(unitType))
|
||||
unitType = "";
|
||||
if (string.IsNullOrEmpty(name))
|
||||
name = "";
|
||||
list = BLL.UserService.GetProjectUserListByProjectIdForApi(projectId, unitId, unitType, name);
|
||||
List<Sys_User> users = new List<Sys_User>();
|
||||
foreach (var item in list)
|
||||
{
|
||||
users.Add(BeanUtil.CopyOjbect<Sys_User>(item, true));
|
||||
}
|
||||
res.successful = true;
|
||||
res.resultValue = users;
|
||||
return res;
|
||||
}
|
||||
[HttpGet]
|
||||
public ResponseData<Sys_User> GetUserById(string userId)
|
||||
{
|
||||
ResponseData<Sys_User> res = new ResponseData<Sys_User>();
|
||||
Model.Sys_User u = BLL.UserService.GetUserByUserId(userId);
|
||||
Model.Sys_User tempu = BeanUtil.CopyOjbect<Sys_User>(u, true);
|
||||
if (u.Base_Unit != null)
|
||||
{
|
||||
tempu.UnitId = u.UnitId + u.Base_Unit.UnitName;
|
||||
}
|
||||
res.successful = true;
|
||||
res.resultValue = tempu;
|
||||
return res;
|
||||
}
|
||||
[HttpGet]
|
||||
public ResponseData<List<WBS_WorkPackage>> GetAllWorkPackage(string unitWorkId)
|
||||
{
|
||||
ResponseData<List<WBS_WorkPackage>> res = new ResponseData<List<WBS_WorkPackage>>();
|
||||
List<WBS_WorkPackage> list = new List<WBS_WorkPackage>();
|
||||
List<WBS_WorkPackage> pagelist = BLL.WorkPackageService.GetAllWorkPackagesByUnitWorkId(unitWorkId);
|
||||
foreach (WBS_WorkPackage w in pagelist)
|
||||
{
|
||||
WBS_WorkPackage temp = BeanUtil.CopyOjbect<WBS_WorkPackage>(w, true);
|
||||
temp.UnitWorkId = w.UnitWorkId;
|
||||
list.Add(temp);
|
||||
}
|
||||
res.resultValue = list;
|
||||
res.successful = true;
|
||||
return res;
|
||||
}
|
||||
[HttpGet]
|
||||
public ResponseData<List<WBS_ControlItemAndCycle>> GetControlItemAndCycle(string workPackageId)
|
||||
{
|
||||
ResponseData<List<WBS_ControlItemAndCycle>> res = new ResponseData<List<WBS_ControlItemAndCycle>>();
|
||||
List<WBS_ControlItemAndCycle> list = new List<WBS_ControlItemAndCycle>();
|
||||
List<WBS_ControlItemAndCycle> pagelist = BLL.ControlItemAndCycleService.GetListByWorkPackageIdForApi(workPackageId); ;
|
||||
foreach (WBS_ControlItemAndCycle w in pagelist)
|
||||
{
|
||||
var item = BeanUtil.CopyOjbect<WBS_ControlItemAndCycle>(w, true);
|
||||
item.CheckNum = w.CheckNum;
|
||||
list.Add(item);
|
||||
|
||||
}
|
||||
res.resultValue = list;
|
||||
res.successful = true;
|
||||
return res;
|
||||
}
|
||||
[HttpGet]
|
||||
public ResponseData<List<Base_Unit>> FindAllUnit(string projectId = "")
|
||||
{
|
||||
ResponseData<List<Base_Unit>> res = new ResponseData<List<Base_Unit>>();
|
||||
List<Base_Unit> list = BLL.UnitService.GetMainAndSubUnitByProjectIdList(projectId);
|
||||
List<Base_Unit> units = new List<Base_Unit>();
|
||||
foreach (var item in list)
|
||||
{
|
||||
units.Add(BeanUtil.CopyOjbect<Base_Unit>(item, true));
|
||||
}
|
||||
res.successful = true;
|
||||
res.resultValue = units;
|
||||
return res;
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /FileUpload/
|
||||
|
||||
/// <summary>
|
||||
/// 附件上传
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public String FileUploadForWX()
|
||||
{
|
||||
HttpFileCollection files = HttpContext.Current.Request.Files;
|
||||
string typeName = HttpContext.Current.Request["typeName"];
|
||||
if (string.IsNullOrEmpty(typeName))
|
||||
{
|
||||
typeName = "WebApi";
|
||||
}
|
||||
string reUrl = string.Empty;
|
||||
if (files != null && files.Count > 0)
|
||||
{
|
||||
string folderUrl = "FileUpLoad/" + typeName + "/" + DateTime.Now.ToString("yyyy-MM") + "/";
|
||||
string localRoot = ConfigurationManager.AppSettings["localRoot"] + folderUrl; //物理路径
|
||||
if (!Directory.Exists(localRoot))
|
||||
{
|
||||
Directory.CreateDirectory(localRoot);
|
||||
}
|
||||
foreach (string key in files.AllKeys)
|
||||
{
|
||||
HttpPostedFile file = files[key];//file.ContentLength文件长度
|
||||
if (!string.IsNullOrEmpty(file.FileName))
|
||||
{
|
||||
string fileName = Guid.NewGuid() + Path.GetExtension(file.FileName);
|
||||
file.SaveAs(localRoot + fileName);
|
||||
if (string.IsNullOrEmpty(reUrl))
|
||||
{
|
||||
reUrl += folderUrl + fileName;
|
||||
}
|
||||
else
|
||||
{
|
||||
reUrl += "," + folderUrl + fileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return reUrl;
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /FileUpload/
|
||||
|
||||
/// <summary>
|
||||
/// 附件上传
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public ResponseData<string> FileUpload()
|
||||
{
|
||||
HttpFileCollection files = HttpContext.Current.Request.Files;
|
||||
string typeName = HttpContext.Current.Request["typeName"];
|
||||
string fName = HttpContext.Current.Request["fileName"];
|
||||
if (string.IsNullOrEmpty(typeName))
|
||||
{
|
||||
typeName = "WebApi";
|
||||
}
|
||||
string reUrl = string.Empty;
|
||||
if (files != null && files.Count > 0)
|
||||
{
|
||||
string folderUrl = "FileUpLoad/" + typeName + "/" + DateTime.Now.ToString("yyyy-MM") + "/";
|
||||
string localRoot = ConfigurationManager.AppSettings["localRoot"] + folderUrl; //物理路径
|
||||
if (!Directory.Exists(localRoot))
|
||||
{
|
||||
Directory.CreateDirectory(localRoot);
|
||||
}
|
||||
foreach (string key in files.AllKeys)
|
||||
{
|
||||
HttpPostedFile file = files[key];//file.ContentLength文件长度
|
||||
if (!string.IsNullOrEmpty(file.FileName))
|
||||
{
|
||||
string fileName = Guid.NewGuid() + Path.GetExtension(file.FileName);
|
||||
|
||||
if (!string.IsNullOrEmpty(fName))
|
||||
fileName = Guid.NewGuid() + "_" + fName;// Path.GetExtension(file.FileName);
|
||||
file.SaveAs(localRoot + fileName);
|
||||
if (string.IsNullOrEmpty(reUrl))
|
||||
{
|
||||
reUrl += folderUrl + fileName;
|
||||
}
|
||||
else
|
||||
{
|
||||
reUrl += "," + folderUrl + fileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
res.successful = true;
|
||||
res.resultValue = reUrl;
|
||||
return res;
|
||||
//HttpFileCollection files = HttpContext.Current.Request.Files;
|
||||
//string typeName = HttpContext.Current.Request["typeName"];
|
||||
//string fName = HttpContext.Current.Request["fileName"];
|
||||
//if (string.IsNullOrEmpty(typeName))
|
||||
//{
|
||||
// typeName = "WebApi";
|
||||
//}
|
||||
//string reUrl = string.Empty;
|
||||
//if (files != null && files.Count > 0)
|
||||
//{
|
||||
// string folderUrl = "FileUpLoad/" + typeName + "/" + DateTime.Now.ToString("yyyy-MM") + "/";
|
||||
// string localRoot = ConfigurationManager.AppSettings["localRoot"] + folderUrl; //物理路径
|
||||
// if (!Directory.Exists(localRoot))
|
||||
// {
|
||||
// Directory.CreateDirectory(localRoot);
|
||||
// }
|
||||
// foreach (string key in files.AllKeys)
|
||||
// {
|
||||
// HttpPostedFile file = files[key];//file.ContentLength文件长度
|
||||
// if (!string.IsNullOrEmpty(file.FileName))
|
||||
// {
|
||||
// string fileName = Guid.NewGuid() + Path.GetExtension(file.FileName);
|
||||
// file.SaveAs(localRoot + fileName);
|
||||
// if (string.IsNullOrEmpty(reUrl))
|
||||
// {
|
||||
// reUrl += folderUrl + fileName;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// reUrl += "," + folderUrl + fileName;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//ResponseData<string> res = new ResponseData<string>();
|
||||
//res.successful = true;
|
||||
//res.resultValue = reUrl;
|
||||
//return res;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ResponseData<string> getDefaultCode(string projectId, string type)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
res.successful = true;
|
||||
switch (type)
|
||||
{
|
||||
case "checkList":
|
||||
{
|
||||
string prefix = BLL.ProjectService.GetProjectByProjectId(projectId).ProjectCode + "-06-CM03-XJ-";
|
||||
res.resultValue = BLL.SQLHelper.RunProcNewId("SpGetNewCode5", "dbo.Check_CheckControl", "DocCode", prefix);
|
||||
}
|
||||
break;
|
||||
case "jointCheck":
|
||||
{
|
||||
string prefix = BLL.ProjectService.GetProjectByProjectId(projectId).ProjectCode + "-GJ-";
|
||||
res.resultValue = BLL.SQLHelper.RunProcNewId("SpGetNewCode3", "dbo.Check_JointCheck", "JointCheckCode", prefix);
|
||||
}
|
||||
break;
|
||||
case "TechnicalContact":
|
||||
{
|
||||
res.resultValue = BLL.SQLHelper.RunProcNewId2("SpGetNewCode3ByProjectId", "dbo.Check_TechnicalContactList", "Code", projectId);
|
||||
}
|
||||
break;
|
||||
case "design":
|
||||
{
|
||||
res.resultValue = BLL.SQLHelper.RunProcNewId2("SpGetNewCode3ByProjectId", "dbo.Check_Design", "DesignCode", projectId);
|
||||
}
|
||||
break;
|
||||
case "contact":
|
||||
{
|
||||
res.resultValue = BLL.SQLHelper.RunProcNewId2("SpGetNewCode3ByProjectId", "dbo.Unqualified_WorkContact", "Code", projectId);
|
||||
}
|
||||
break;
|
||||
case "spotCheck":
|
||||
{
|
||||
string prefix = BLL.ProjectService.GetProjectByProjectId(projectId).ProjectCode + "-06-CM03-XJ-";
|
||||
res.resultValue = BLL.SQLHelper.RunProcNewId("SpGetNewCode5", "dbo.Check_SpotCheck", "DocCode", prefix);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,250 @@
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Http;
|
||||
using BLL;
|
||||
using Model;
|
||||
using System.Collections;
|
||||
|
||||
namespace Web.obj
|
||||
{
|
||||
public class ContactController : ApiController
|
||||
{
|
||||
[HttpGet]
|
||||
public ResponseData<List<Unqualified_WorkContact>> Index(string projectId, int index, int page, string name = "")
|
||||
{
|
||||
ResponseData<List<Unqualified_WorkContact>> res = new ResponseData<List<Unqualified_WorkContact>>();
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = BLL.WorkContactService.getListDataForApi(projectId, name, index, page);
|
||||
return res;
|
||||
}
|
||||
[HttpGet]
|
||||
public ResponseData<List<Unqualified_WorkContact>> Search(string projectId, int index, int page,string code="", string proposedUnitId = "", string mainSendUnitId = "", string cCUnitId = "", string cause = "", string contents = "", string dateA = "", string dateZ = "")
|
||||
{
|
||||
ResponseData<List<Unqualified_WorkContact>> res = new ResponseData<List<Unqualified_WorkContact>>();
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = BLL.WorkContactService.getListDataForApi( code , proposedUnitId , mainSendUnitId , cCUnitId , cause , contents , dateA , dateZ ,projectId, index, page);
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据id获取详情
|
||||
/// </summary>
|
||||
/// <param name="CheckControlCode"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public ResponseData<Unqualified_WorkContact> GetContactById(string id)
|
||||
{
|
||||
ResponseData<Unqualified_WorkContact> res = new ResponseData<Unqualified_WorkContact>();
|
||||
Unqualified_WorkContact technicalContactList = BLL.WorkContactService.GetWorkContactByWorkContactIdForApi(id);
|
||||
res.successful = true;
|
||||
res.resultValue = BeanUtil.CopyOjbect<Unqualified_WorkContact>(technicalContactList, true);
|
||||
return res;
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据code获取 审核记录
|
||||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public ResponseData<List<Unqualified_WorkContactApprove>> GetApproveById(string id)
|
||||
{
|
||||
ResponseData<List<Unqualified_WorkContactApprove>> res = new ResponseData<List<Unqualified_WorkContactApprove>>();
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = BLL.WorkContactApproveService.getListDataByIdForApi(id);
|
||||
return res;
|
||||
}
|
||||
public ResponseData<Unqualified_WorkContactApprove> GetCurrApproveById(string id)
|
||||
{
|
||||
ResponseData<Unqualified_WorkContactApprove> res = new ResponseData<Unqualified_WorkContactApprove>();
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = BeanUtil.CopyOjbect<Unqualified_WorkContactApprove>(BLL.WorkContactApproveService.getCurrApproveForApi(id), true);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
[HttpPost]
|
||||
public ResponseData<string> AddContact([FromBody]Model.Unqualified_WorkContact CheckControl)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
try
|
||||
{
|
||||
|
||||
if (string.IsNullOrEmpty(CheckControl.WorkContactId))
|
||||
{
|
||||
CheckControl.WorkContactId = Guid.NewGuid().ToString();
|
||||
CheckControl.CompileDate = DateTime.Now;
|
||||
BLL.WorkContactService.AddWorkContactForApi(CheckControl);
|
||||
res.resultValue = CheckControl.WorkContactId;
|
||||
|
||||
//BLL.AttachFileService.updateAttachFile(CheckControl.ReturnAttachUrl, CheckControl.WorkContactId + "r", BLL.Const.WorkContactMenuId);
|
||||
//BLL.AttachFileService.updateAttachFile(CheckControl.AttachUrl, CheckControl.WorkContactId, BLL.Const.WorkContactMenuId);
|
||||
SaveAttachFile(CheckControl.WorkContactId + "r", BLL.Const.WorkContactMenuId, CheckControl.ReturnAttachUrl);
|
||||
SaveAttachFile(CheckControl.WorkContactId, BLL.Const.WorkContactMenuId, CheckControl.AttachUrl);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
BLL.WorkContactService.UpdateWorkContactForApi(CheckControl);
|
||||
res.resultValue = CheckControl.WorkContactId;
|
||||
//BLL.AttachFileService.updateAttachFile(CheckControl.ReturnAttachUrl, CheckControl.WorkContactId + "r", BLL.Const.WorkContactMenuId);
|
||||
//BLL.AttachFileService.updateAttachFile(CheckControl.AttachUrl, CheckControl.WorkContactId, BLL.Const.WorkContactMenuId);
|
||||
SaveAttachFile(CheckControl.WorkContactId + "r", BLL.Const.WorkContactMenuId, CheckControl.ReturnAttachUrl);
|
||||
SaveAttachFile(CheckControl.WorkContactId, BLL.Const.WorkContactMenuId, CheckControl.AttachUrl);
|
||||
}
|
||||
res.successful = true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
res.resultHint = e.StackTrace;
|
||||
res.successful = false;
|
||||
}
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static void SaveAttachFile(string dataId, string menuId, string url)
|
||||
{
|
||||
Model.ToDoItem toDoItem = new Model.ToDoItem
|
||||
{
|
||||
MenuId = menuId,
|
||||
DataId = dataId,
|
||||
UrlStr = url,
|
||||
};
|
||||
APIUpLoadFileService.SaveAttachUrl(toDoItem);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ResponseData<string> AddApprove([FromBody]Model.Unqualified_WorkContactApprove approve)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
try
|
||||
{
|
||||
Model.Unqualified_WorkContact CheckControl = new Model.Unqualified_WorkContact();
|
||||
CheckControl.WorkContactId = approve.WorkContactId;
|
||||
CheckControl.State = approve.ApproveType;
|
||||
BLL.WorkContactService.UpdateWorkContactForApi(CheckControl);
|
||||
|
||||
res.resultValue = BLL.WorkContactApproveService.AddWorkContactApproveForApi(approve);
|
||||
res.successful = true;
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
res.resultHint = e.StackTrace;
|
||||
res.successful = false;
|
||||
}
|
||||
return res;
|
||||
|
||||
}
|
||||
[HttpPost]
|
||||
public ResponseData<string> UpdateApprove([FromBody]Model.Unqualified_WorkContactApprove approve)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
try
|
||||
{
|
||||
|
||||
approve.ApproveDate = DateTime.Now;
|
||||
switch (approve.ApproveType)
|
||||
{
|
||||
case "3":
|
||||
case "6":
|
||||
case "7":
|
||||
case "8":
|
||||
{
|
||||
Model.Unqualified_WorkContact contact = new Model.Unqualified_WorkContact();
|
||||
Model.Unqualified_WorkContactApprove approveTemp = WorkContactApproveService.GetWorkContactApproveById(approve.WorkContactApproveId);
|
||||
if (approveTemp != null)
|
||||
{
|
||||
contact.WorkContactId = approveTemp.WorkContactId;
|
||||
contact.ReOpinion = approve.ApproveIdea;
|
||||
BLL.WorkContactService.UpdateWorkContactForApi(contact);
|
||||
approve.ApproveIdea = null;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "2":
|
||||
{
|
||||
var temp = WorkContactApproveService.GetWorkContactApproveById(approve.WorkContactApproveId);
|
||||
if (temp != null)
|
||||
{
|
||||
Model.Unqualified_WorkContact workContact = WorkContactService.GetWorkContactByWorkContactIdForApi(temp.WorkContactId);
|
||||
|
||||
// Base_Unit unit = BLL.UnitService.GetUnitByUnitId(workContact.ProposedUnitId.Split('$')[0]);
|
||||
if (!string.IsNullOrEmpty(workContact.ProposedUnitId) && workContact.ProposedUnitId != "$$")
|
||||
{
|
||||
|
||||
if (workContact.ProposedUnitId.Split('$')[2] == BLL.Const.ProjectUnitType_1)
|
||||
{
|
||||
Model.Unqualified_WorkContactApprove approveTemp = WorkContactApproveService.GetWorkContactApproveById(approve.WorkContactApproveId);
|
||||
|
||||
Model.Unqualified_WorkContact contact = new Model.Unqualified_WorkContact();
|
||||
contact.WorkContactId = approveTemp.WorkContactId;
|
||||
contact.ReOpinion = approve.ApproveIdea;
|
||||
BLL.WorkContactService.UpdateWorkContactForApi(contact);
|
||||
approve.ApproveIdea = null;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "4":
|
||||
{
|
||||
|
||||
|
||||
Model.Unqualified_WorkContact workContact = WorkContactService.GetWorkContactByWorkContactIdForApi(WorkContactApproveService.GetWorkContactApproveById(approve.WorkContactApproveId).WorkContactId);
|
||||
if (!string.IsNullOrEmpty(workContact.ProposedUnitId) && workContact.ProposedUnitId != "$")
|
||||
{
|
||||
// Project_ProjectUnit unit1 = BLL.ProjectUnitService.GetProjectUnitByUnitIdProjectId(workContact.ProjectId, workContact.ProposedUnitId.Split('$')[0]);
|
||||
|
||||
// Base_Unit unit1 = BLL.UnitService.GetUnitByUnitId(workContact.ProposedUnitId.Split('$')[0]);
|
||||
if (workContact.ProposedUnitId.Split('$')[2] != BLL.Const.ProjectUnitType_1)
|
||||
{
|
||||
Model.Unqualified_WorkContactApprove approveTemp = WorkContactApproveService.GetWorkContactApproveById(approve.WorkContactApproveId);
|
||||
|
||||
Model.Unqualified_WorkContact contact = new Model.Unqualified_WorkContact();
|
||||
contact.WorkContactId = approveTemp.WorkContactId;
|
||||
contact.ReOpinion = approve.ApproveIdea;
|
||||
BLL.WorkContactService.UpdateWorkContactForApi(contact);
|
||||
approve.ApproveIdea = null;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
BLL.WorkContactApproveService.UpdateWorkContactApproveForApi(approve);
|
||||
res.successful = true;
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
res.resultHint = e.StackTrace;
|
||||
|
||||
res.successful = false;
|
||||
}
|
||||
return res;
|
||||
|
||||
}
|
||||
[HttpGet]
|
||||
public ResponseData<string> see(string dataId, string userId)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
res.successful = true;
|
||||
BLL.WorkContactApproveService.See(dataId, userId);
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Http;
|
||||
using BLL;
|
||||
using Model;
|
||||
using System.Collections;
|
||||
|
||||
namespace Mvc.Controllers
|
||||
{
|
||||
public class DesignController : ApiController
|
||||
{
|
||||
//
|
||||
// GET: /Draw/
|
||||
[HttpGet]
|
||||
public ResponseData<List<Check_Design>> Index(string projectId, int index, int page, string name = null)
|
||||
{
|
||||
ResponseData<List<Check_Design>> res = new ResponseData<List<Check_Design>>();
|
||||
if (name == null)
|
||||
name = "";
|
||||
res.successful = true;
|
||||
res.resultValue = BLL.DesignService.getListDataForApi( projectId, name, index, page);
|
||||
return res;
|
||||
} //
|
||||
// GET: /Draw/
|
||||
[HttpGet]
|
||||
public ResponseData<List<Check_Design>> Search(string projectId, int index, int page,string carryUnitIds,string state, string mainItemId = null, string cNProfessionalCode = null, string designType = null, string designDateA = null, string designDateZ = null)
|
||||
{
|
||||
ResponseData<List<Check_Design>> res = new ResponseData<List<Check_Design>>();
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = BLL.DesignService.getListDataForApi(carryUnitIds, state,mainItemId, cNProfessionalCode , designType , designDateA, designDateZ ,projectId, index, page);
|
||||
return res;
|
||||
}
|
||||
//
|
||||
// GET: /Draw/
|
||||
[HttpGet]
|
||||
public ResponseData<Check_Design> GetDesignById(string id)
|
||||
{
|
||||
ResponseData<Check_Design> res = new ResponseData<Check_Design>();
|
||||
Check_Design cd = BLL.DesignService.GetDesignByDesignIdForApi(id);
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = BeanUtil.CopyOjbect<Check_Design>(cd, true);
|
||||
res.resultValue.PlanDay = cd.PlanDay;
|
||||
return res;
|
||||
}
|
||||
[HttpGet]
|
||||
public ResponseData<List<Check_DesignApprove>>GetApproveById(string id)
|
||||
{
|
||||
ResponseData<List<Check_DesignApprove>> res = new ResponseData<List<Check_DesignApprove>>();
|
||||
res.successful = true;
|
||||
res.resultValue = BLL.DesignApproveService.getListDataByIdForApi(id);
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
public ResponseData<Check_DesignApprove> GetCurrApproveById(string id)
|
||||
{
|
||||
ResponseData<Check_DesignApprove> res = new ResponseData<Check_DesignApprove>();
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = BeanUtil.CopyOjbect<Check_DesignApprove>(BLL.DesignApproveService.getCurrApproveForApi(id), true);
|
||||
return res;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ResponseData<string> AddDesign([FromBody]Model.Check_Design CheckControl)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(CheckControl.DesignId))
|
||||
{
|
||||
CheckControl.DesignId = Guid.NewGuid().ToString();
|
||||
BLL.DesignService.AddDesignForApi(CheckControl);
|
||||
//BLL.AttachFileService.updateAttachFile(CheckControl.AttachUrl, CheckControl.DesignId, Const.DesignMenuId);
|
||||
SaveAttachFile(CheckControl.DesignId, BLL.Const.DesignMenuId, CheckControl.AttachUrl);
|
||||
res.resultValue = CheckControl.DesignId;
|
||||
res.successful = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
BLL.DesignService.UpdateDesignForApi(CheckControl);
|
||||
//BLL.AttachFileService.updateAttachFile(CheckControl.AttachUrl, CheckControl.DesignId, Const.DesignMenuId);
|
||||
SaveAttachFile(CheckControl.DesignId, BLL.Const.DesignMenuId, CheckControl.AttachUrl);
|
||||
res.resultValue = CheckControl.DesignId;
|
||||
res.successful = true;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
res.successful = false;
|
||||
res.resultHint = e.StackTrace;
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static void SaveAttachFile(string dataId, string menuId, string url)
|
||||
{
|
||||
Model.ToDoItem toDoItem = new Model.ToDoItem
|
||||
{
|
||||
MenuId = menuId,
|
||||
DataId = dataId,
|
||||
UrlStr = url,
|
||||
};
|
||||
APIUpLoadFileService.SaveAttachUrl(toDoItem);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ResponseData<string> AddApprove([FromBody]Model.Check_DesignApprove approve)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
try
|
||||
{
|
||||
Model.Check_Design CheckControl = new Model.Check_Design();
|
||||
CheckControl.DesignId = approve.DesignId;
|
||||
CheckControl.State = approve.ApproveType;
|
||||
BLL.DesignService.UpdateDesignForApi(CheckControl);
|
||||
|
||||
res.resultValue = BLL.DesignApproveService.AddDesignApproveForApi(approve);
|
||||
res.successful = true;
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
res.resultHint = e.StackTrace;
|
||||
res.successful = false;
|
||||
}
|
||||
return res;
|
||||
|
||||
}
|
||||
[HttpPost]
|
||||
public ResponseData<string> UpdateApprove([FromBody]Model.Check_DesignApprove approve)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
try
|
||||
{
|
||||
// Model.Check_DesignApprove approve1 = BLL.DesignApproveService.GetDesignApproveByDesignId(approve.DesignId);
|
||||
approve.ApproveDate = DateTime.Now;
|
||||
//approve1.ApproveIdea = approve.ApproveIdea;
|
||||
//approve1.IsAgree = approve.IsAgree;
|
||||
//approve1.AttachUrl = approve.AttachUrl;
|
||||
BLL.DesignApproveService.UpdateDesignApproveForApi(approve);
|
||||
res.successful = true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
res.resultHint = e.StackTrace;
|
||||
res.successful = false;
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Http;
|
||||
using Model;
|
||||
|
||||
namespace Mvc.Controllers
|
||||
{
|
||||
public class DrawController : ApiController
|
||||
{
|
||||
//
|
||||
// GET: /Draw/
|
||||
[HttpGet]
|
||||
public ResponseData<List<Check_Draw>> Index(string projectId, int index, int page,string name=null)
|
||||
{
|
||||
ResponseData<List<Check_Draw>> res = new ResponseData<List<Check_Draw>>();
|
||||
if (name == null)
|
||||
name = "";
|
||||
res.successful = true;
|
||||
res.resultValue = BLL.DrawService.GetDrawByProjectIdForApi(name,projectId, index, page); ;
|
||||
return res;
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /Draw/
|
||||
[HttpGet]
|
||||
public ResponseData<Check_Draw> GetDrawByDrawId(string id)
|
||||
{
|
||||
ResponseData<Check_Draw> res = new ResponseData<Check_Draw>();
|
||||
Check_Draw cd = BLL.DrawService.GetDrawByDrawId(id );
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = BeanUtil.CopyOjbect<Check_Draw>(cd, true);
|
||||
return res;
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据code获取详情
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public ResponseData<Check_Draw> GetDraw(string id)
|
||||
{
|
||||
ResponseData<Check_Draw> res = new ResponseData<Check_Draw>();
|
||||
Check_Draw checkControl = BLL.DrawService.GetDrawForApi(id);
|
||||
res.successful = true;
|
||||
res.resultValue = BeanUtil.CopyOjbect<Check_Draw>(checkControl, true);
|
||||
res.resultValue.Edition = checkControl.Edition;
|
||||
return res;
|
||||
}
|
||||
//
|
||||
// GET: /Draw/
|
||||
[HttpGet]
|
||||
public ResponseData<Check_Draw> responseData(string id)
|
||||
{
|
||||
ResponseData<Check_Draw> res = new ResponseData<Check_Draw>();
|
||||
Check_Draw cd = BLL.DrawService.GetDrawByDrawId(id);
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = BeanUtil.CopyOjbect<Check_Draw>(cd, true);
|
||||
return res;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ResponseData<string> see(string dataId, string userId)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
res.successful = true;
|
||||
BLL.DrawApproveService.See(dataId, userId);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
using Microsoft.Ajax.Utilities;
|
||||
using Model;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace Mvc.Controllers
|
||||
{
|
||||
public class IndexController : ApiController
|
||||
{
|
||||
//
|
||||
// GET: /Index/
|
||||
|
||||
[HttpGet]
|
||||
// 质量验收一次合格率
|
||||
public ResponseData<string> QuOnceNum(string projectId)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = "" + BLL.CheckControlService.GetOneCount(projectId);
|
||||
return res;
|
||||
}
|
||||
|
||||
// 项目施工资料同步率
|
||||
[HttpGet]
|
||||
public ResponseData<string> ConstructionNum(string projectId)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = "" + BLL.CheckControlService.GetConstruction(projectId);
|
||||
return res;
|
||||
}
|
||||
|
||||
// 项目质量问题整改完成率
|
||||
[HttpGet]
|
||||
public ResponseData<string> QuestionSuccess(string projectId)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = "" + BLL.CheckControlService.GetQuSuccess(projectId);
|
||||
return res;
|
||||
}
|
||||
|
||||
// 项目质量控制点统计完成率
|
||||
[HttpGet]
|
||||
public ResponseData<string> ControlSuccess(string projectId)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = "" + BLL.CheckControlService.GetConSuccess(projectId);
|
||||
return res;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ResponseData<string> CheckControlCount(string projectId)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = "" + BLL.CheckControlService.GetListCount(projectId);
|
||||
return res; ;
|
||||
}
|
||||
[HttpGet]
|
||||
public ResponseData<string> JointCheckCount(string projectId)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = "" + BLL.JointCheckService.GetListCount(projectId);
|
||||
return res; ;
|
||||
}
|
||||
[HttpGet]
|
||||
public ResponseData<string> WorkContactCount(string projectId)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = "" + BLL.WorkContactService.getListCount(projectId);
|
||||
return res; ;
|
||||
}
|
||||
[HttpGet]
|
||||
public ResponseData<string> TechnicalContactCount(string projectId)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = "" + BLL.TechnicalContactListService.getListCount(projectId);
|
||||
return res; ;
|
||||
}
|
||||
[HttpGet]
|
||||
public ResponseData<List<object>> todo(string projectId, string userId)
|
||||
{
|
||||
ResponseData<List<object>> res = new ResponseData<List<object>>();
|
||||
List<object> list = new List<object>();
|
||||
res.resultValue = list;
|
||||
SqlParameter[] val = new SqlParameter[]
|
||||
{
|
||||
new SqlParameter("@UserId", userId),
|
||||
new SqlParameter("@ProjectId", projectId)
|
||||
};
|
||||
|
||||
var dt = BLL.SQLHelper.GetDataTableRunProc("SpAuditingManageByProjectId", val).AsEnumerable().ToArray();
|
||||
foreach (var item in dt)
|
||||
{
|
||||
if (!item.ItemArray[1].ToString().Contains("工序资料验收"))
|
||||
{
|
||||
ToDoModel toDoModel = new ToDoModel();
|
||||
toDoModel.ID = item.ItemArray[0].ToString();
|
||||
toDoModel.Title = item.ItemArray[1].ToString();
|
||||
toDoModel.State = item.ItemArray[4].ToString();
|
||||
|
||||
list.Add(toDoModel);
|
||||
}
|
||||
}
|
||||
res.successful = true;
|
||||
return res;
|
||||
|
||||
}
|
||||
[HttpGet]
|
||||
public ResponseData<List<ToDoModel>> notice(string projectId, string userId)
|
||||
{
|
||||
ResponseData<List<ToDoModel>> res = new ResponseData<List<ToDoModel>>();
|
||||
List<ToDoModel> list = new List<ToDoModel>();
|
||||
|
||||
SqlParameter[] val = new SqlParameter[]
|
||||
{
|
||||
new SqlParameter("@UserId", userId),
|
||||
new SqlParameter("@ProjectId", projectId)
|
||||
};
|
||||
|
||||
var dt = BLL.SQLHelper.GetDataTableRunProc("SpNoticeByProjectId", val).AsEnumerable().ToArray();
|
||||
foreach (var item in dt)
|
||||
{
|
||||
if (!item.ItemArray[1].ToString().Contains("检试验设备及测量器具")&& !item.ItemArray[1].ToString().Contains("工序资料验收"))
|
||||
{
|
||||
ToDoModel toDoModel = new ToDoModel();
|
||||
toDoModel.ID = item.ItemArray[0].ToString();
|
||||
toDoModel.Title = item.ItemArray[1].ToString();
|
||||
list.Add(toDoModel);
|
||||
}
|
||||
}
|
||||
res.resultValue = list;
|
||||
res.successful = true;
|
||||
return res;
|
||||
|
||||
}
|
||||
[HttpGet]
|
||||
public ResponseData<List<object>> warning(string projectId, string userId)
|
||||
{
|
||||
ResponseData<List<object>> res = new ResponseData<List<object>>();
|
||||
List<object> list = new List<object>();
|
||||
SqlParameter[] val = new SqlParameter[]
|
||||
{
|
||||
new SqlParameter("@ProjectId", projectId),
|
||||
};
|
||||
|
||||
var dt = BLL.SQLHelper.GetDataTableRunProc("SpEnableCueQualityByPrject", val).AsEnumerable().ToArray();
|
||||
foreach (var item in dt)
|
||||
{
|
||||
ToDoModel toDoModel = new ToDoModel();
|
||||
toDoModel.ID = item.ItemArray[0].ToString();
|
||||
toDoModel.Title = item.ItemArray[1].ToString();
|
||||
list.Add(toDoModel);
|
||||
}
|
||||
res.resultValue = list;
|
||||
res.successful = true;
|
||||
return res;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,314 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web.Http;
|
||||
using BLL;
|
||||
using Model;
|
||||
|
||||
namespace Mvc.Controllers
|
||||
{
|
||||
public class JointCheckController : ApiController
|
||||
{
|
||||
|
||||
|
||||
//
|
||||
// 质量共检
|
||||
// GET: /Draw/
|
||||
[HttpGet]
|
||||
public ResponseData<List<Check_JointCheck>> Index(string projectId, int index, int page, string name = null)
|
||||
{
|
||||
ResponseData<List<Check_JointCheck>> res = new ResponseData<List<Check_JointCheck>>();
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = BLL.JointCheckService.GetListDataForApi(name, projectId, index, page);
|
||||
return res;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ResponseData<List<Check_JointCheck>> Search(string projectId, int index, int page, string name = null, string code = null, string unitId = null, string proposeUnitId = null, string type = null, string dateA = null, string dateZ = null, string state = null)
|
||||
{
|
||||
ResponseData<List<Check_JointCheck>> res = new ResponseData<List<Check_JointCheck>>();
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = BLL.JointCheckService.GetListDataForApi(name, code, unitId, proposeUnitId, type, dateA, dateZ, projectId, state, index, page);
|
||||
return res;
|
||||
}
|
||||
|
||||
//
|
||||
// 质量共检
|
||||
// GET: /Draw/
|
||||
[HttpGet]
|
||||
public ResponseData<Check_JointCheck> GetJointCheck(string id)
|
||||
{
|
||||
ResponseData<Check_JointCheck> res = new ResponseData<Check_JointCheck>();
|
||||
Check_JointCheck jc = BLL.JointCheckService.GetJointCheckForApi(id);
|
||||
res.successful = true;
|
||||
res.resultValue = BeanUtil.CopyOjbect<Check_JointCheck>(jc, true);
|
||||
return res;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ResponseData<List<Check_JointCheckApprove>> GetApproveByJcid(string id, string detailId)
|
||||
{
|
||||
ResponseData<List<Check_JointCheckApprove>> res = new ResponseData<List<Check_JointCheckApprove>>();
|
||||
res.successful = true;
|
||||
res.resultValue = BLL.JointCheckApproveService.getListDataByJcidForApi(id, detailId);
|
||||
return res;
|
||||
|
||||
}
|
||||
[HttpGet]
|
||||
public ResponseData<Check_JointCheckApprove> getCurrApproveByDetailId(string id)
|
||||
{
|
||||
ResponseData<Check_JointCheckApprove> res = new ResponseData<Check_JointCheckApprove>();
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = BeanUtil.CopyOjbect<Check_JointCheckApprove>(BLL.JointCheckApproveService.getCurrApproveByDetailIdForApi(id), true);
|
||||
return res;
|
||||
}
|
||||
[HttpGet]
|
||||
public ResponseData<List<Check_JointCheckApprove>> GetCurrApproveById(string id)
|
||||
{
|
||||
ResponseData<List<Check_JointCheckApprove>> res = new ResponseData<List<Check_JointCheckApprove>>();
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = BLL.JointCheckApproveService.getCurrApproveForApi(id);
|
||||
return res;
|
||||
}
|
||||
[HttpGet]
|
||||
public ResponseData<Check_JointCheckApprove> GetCurrApproveByJoinCheckId(string id)
|
||||
{
|
||||
ResponseData<Check_JointCheckApprove> res = new ResponseData<Check_JointCheckApprove>();
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = BLL.JointCheckApproveService.getCurrApproveByJoinCheckIdForApi(id);
|
||||
return res;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ResponseData<List<View_Check_JointCheckDetail>> GetJointCheckDetail(string id)
|
||||
{
|
||||
ResponseData<List<View_Check_JointCheckDetail>> res = new ResponseData<List<View_Check_JointCheckDetail>>();
|
||||
res.successful = true;
|
||||
res.resultValue = BLL.JointCheckDetailService.getListDataForApi(id);
|
||||
return res;
|
||||
|
||||
}
|
||||
[HttpGet]
|
||||
public ResponseData<string> delJointCheckDetail(string id)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
res.successful = true;
|
||||
BLL.JointCheckDetailService.DeleteJointCheckDetailById(id);
|
||||
res.resultValue = id;
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ResponseData<string> AddJointCheckDetail([FromBody]Model.Check_JointCheckDetail CheckControl)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(CheckControl.JointCheckDetailId))
|
||||
{
|
||||
|
||||
CheckControl.JointCheckDetailId = Guid.NewGuid().ToString();
|
||||
CheckControl.CreateDate = DateTime.Now;
|
||||
|
||||
BLL.JointCheckDetailService.AddJointCheckDetailForApi(CheckControl);
|
||||
|
||||
//BLL.AttachFileService.updateAttachFile(CheckControl.ReAttachUrl, CheckControl.JointCheckDetailId + "r", Const.JointCheckMenuId);
|
||||
//BLL.AttachFileService.updateAttachFile(CheckControl.AttachUrl, CheckControl.JointCheckDetailId, Const.JointCheckMenuId);
|
||||
SaveAttachFile(CheckControl.JointCheckDetailId + "r", BLL.Const.JointCheckMenuId, CheckControl.ReAttachUrl);
|
||||
SaveAttachFile(CheckControl.JointCheckDetailId, BLL.Const.JointCheckMenuId, CheckControl.AttachUrl);
|
||||
res.resultValue = CheckControl.JointCheckDetailId;
|
||||
|
||||
res.successful = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
BLL.JointCheckDetailService.UpdateJointCheckDetailForApi(CheckControl);
|
||||
res.resultValue = CheckControl.JointCheckDetailId;
|
||||
//BLL.AttachFileService.updateAttachFile(CheckControl.ReAttachUrl, CheckControl.JointCheckDetailId + "r", Const.JointCheckMenuId);
|
||||
//BLL.AttachFileService.updateAttachFile(CheckControl.AttachUrl, CheckControl.JointCheckDetailId, Const.JointCheckMenuId);
|
||||
SaveAttachFile(CheckControl.JointCheckDetailId + "r", BLL.Const.JointCheckMenuId, CheckControl.ReAttachUrl);
|
||||
SaveAttachFile(CheckControl.JointCheckDetailId, BLL.Const.JointCheckMenuId, CheckControl.AttachUrl);
|
||||
res.successful = true;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
res.resultHint = e.StackTrace;
|
||||
res.successful = false;
|
||||
}
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static void SaveAttachFile(string dataId, string menuId, string url)
|
||||
{
|
||||
Model.ToDoItem toDoItem = new Model.ToDoItem
|
||||
{
|
||||
MenuId = menuId,
|
||||
DataId = dataId,
|
||||
UrlStr = url,
|
||||
};
|
||||
APIUpLoadFileService.SaveAttachUrl(toDoItem);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
// 共检--添加
|
||||
public ResponseData<string> AddJointCheck([FromBody]Model.Check_JointCheck CheckControl)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(CheckControl.JointCheckId))
|
||||
{
|
||||
var project = BLL.ProjectService.GetProjectByProjectId(CheckControl.ProjectId);
|
||||
string projectCode = string.Empty;
|
||||
string prefix = string.Empty;
|
||||
if (project != null)
|
||||
{
|
||||
projectCode = project.ProjectCode;
|
||||
}
|
||||
prefix = projectCode + "-GJ-";
|
||||
CheckControl.JointCheckCode = BLL.SQLHelper.RunProcNewId("SpGetNewCode3", "dbo.Check_JointCheck", "JointCheckCode", prefix);
|
||||
CheckControl.JointCheckId = Guid.NewGuid().ToString();
|
||||
BLL.JointCheckService.AddJointCheckForApi(CheckControl);
|
||||
res.resultValue = CheckControl.JointCheckId;
|
||||
}
|
||||
else
|
||||
{
|
||||
BLL.JointCheckService.UpdateJointCheckForApi(CheckControl);
|
||||
res.resultValue = CheckControl.JointCheckId;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
res.successful = false;
|
||||
}
|
||||
res.successful = true;
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ResponseData<string> AddApprove([FromBody]Model.Check_JointCheckApprove approve)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
try
|
||||
{
|
||||
//Model.Check_JointCheck CheckControl = new Model.Check_JointCheck();
|
||||
//CheckControl.JointCheckId = approve.JointCheckId;
|
||||
//CheckControl.State = approve.ApproveType;
|
||||
//BLL.JointCheckService.UpdateJointCheckForApi(CheckControl);
|
||||
Check_JointCheckDetail joinCheckDetail = new Check_JointCheckDetail();// BLL.JointCheckDetailService.GetJointCheckDetailByJointCheckDetailIdForApi(approve.JointCheckDetailId);
|
||||
joinCheckDetail.State = approve.ApproveType;
|
||||
joinCheckDetail.HandleMan = approve.ApproveMan;
|
||||
joinCheckDetail.SaveHandleMan = "";
|
||||
joinCheckDetail.JointCheckDetailId = approve.JointCheckDetailId;
|
||||
BLL.JointCheckDetailService.UpdateJointCheckDetailForApi(joinCheckDetail);
|
||||
|
||||
var joinCheckDetailList = BLL.JointCheckDetailService.GetListsForApi(approve.JointCheckId);
|
||||
bool isFinished = true;
|
||||
bool isEditing = true;
|
||||
foreach (var item in joinCheckDetailList)
|
||||
{
|
||||
if ("6" != item.State) isFinished = false;
|
||||
if ("1" != item.State) isEditing = false;
|
||||
}
|
||||
|
||||
var joinCheck = BLL.JointCheckService.GetJointCheckForApi(approve.JointCheckId);
|
||||
Check_JointCheck cj = new Check_JointCheck();
|
||||
cj.JointCheckId = joinCheck.JointCheckId;
|
||||
if (approve.ApproveType != "1")
|
||||
{
|
||||
if (isFinished)
|
||||
{
|
||||
cj.State = "6";
|
||||
}
|
||||
else if (isEditing)
|
||||
{
|
||||
cj.State = "1";
|
||||
}
|
||||
else
|
||||
{
|
||||
cj.State = "Z";
|
||||
|
||||
}
|
||||
BLL.JointCheckService.UpdateJointCheckForApi(cj);
|
||||
} else
|
||||
{
|
||||
cj.State = "1";
|
||||
BLL.JointCheckService.UpdateJointCheckForApi(cj);
|
||||
}
|
||||
res.resultValue = BLL.JointCheckApproveService.AddJointCheckApproveForApi(approve);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
res.successful = false;
|
||||
res.resultValue = e.Message;
|
||||
}
|
||||
res.successful = true;
|
||||
return res;
|
||||
|
||||
}
|
||||
[HttpPost]
|
||||
public ResponseData<string> UpdateApprove([FromBody]Model.Check_JointCheckApprove approve)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
try
|
||||
{
|
||||
approve.ApproveDate = DateTime.Now;
|
||||
var resApprove = BLL.JointCheckApproveService.UpdateJointCheckApproveForApi(approve);
|
||||
|
||||
if (approve.ApproveType == "1")
|
||||
{
|
||||
var jointCheck = BLL.JointCheckService.GetJointCheckForApi(resApprove.JointCheckId);
|
||||
var jointCheckDetails = BLL.JointCheckDetailService.getListDataForApi(resApprove.JointCheckId);
|
||||
List<Model.Sys_User> seeUsers = new List<Model.Sys_User>();
|
||||
foreach (var a in jointCheckDetails)
|
||||
{
|
||||
a.JointCheckId = approve.JointCheckId;
|
||||
if (string.IsNullOrEmpty(approve.JointCheckId))
|
||||
{
|
||||
seeUsers.AddRange(BLL.UserService.GetSeeUserList2(jointCheck.ProjectId, jointCheck.UnitId, a.CNProfessionalCode, a.UnitWorkId.ToString(), approve.ApproveMan));
|
||||
}
|
||||
}
|
||||
if (string.IsNullOrEmpty(approve.JointCheckId))
|
||||
{
|
||||
seeUsers = seeUsers.Distinct().ToList();
|
||||
foreach (var seeUser in seeUsers)
|
||||
{
|
||||
Model.Check_JointCheckApprove approves = new Model.Check_JointCheckApprove();
|
||||
approves.JointCheckId = approve.JointCheckId;
|
||||
approves.ApproveMan = seeUser.UserId;
|
||||
approves.ApproveType = "S";
|
||||
BLL.JointCheckApproveService.AddJointCheckApproveForApi(approve);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
res.successful = false;
|
||||
}
|
||||
res.successful = true;
|
||||
return res;
|
||||
}
|
||||
[HttpGet]
|
||||
public ResponseData<string> see(string dataId, string userId)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
res.successful = true;
|
||||
BLL.JointCheckApproveService.See(dataId, userId);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,489 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Http;
|
||||
using BLL;
|
||||
using Model;
|
||||
|
||||
namespace Mvc.Controllers
|
||||
{
|
||||
public class SpotCheckController : ApiController
|
||||
{
|
||||
//
|
||||
// 质量共检
|
||||
// GET: /Draw/
|
||||
[HttpGet]
|
||||
public ResponseData<List<Check_SpotCheck>> Index(string projectId, int index, int page, string startTime = null, string endTime = null,string name = null)
|
||||
{
|
||||
ResponseData<List<Check_SpotCheck>> res = new ResponseData<List<Check_SpotCheck>>();
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = BLL.SpotCheckService.GetListDataForApi(name,"",startTime, endTime, projectId, index, page);
|
||||
return res;
|
||||
}
|
||||
[HttpGet]
|
||||
public ResponseData<List<Check_SpotCheck>> Search(string projectId, int index, int page, string startTime = null, string endTime = null, string name = null,string unitId=null)
|
||||
{
|
||||
ResponseData<List<Check_SpotCheck>> res = new ResponseData<List<Check_SpotCheck>>();
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = BLL.SpotCheckService.GetListDataForApi(name,unitId, startTime, endTime, projectId, index, page);
|
||||
return res;
|
||||
}
|
||||
|
||||
//
|
||||
// 质量共检
|
||||
// GET: /Draw/
|
||||
[HttpGet]
|
||||
public ResponseData<Check_SpotCheck> GetSpotCheck(string spotCheckCode)
|
||||
{
|
||||
ResponseData<Check_SpotCheck> res = new ResponseData<Check_SpotCheck>();
|
||||
Check_SpotCheck jc = BLL.SpotCheckService.GetSpotCheckForApi(spotCheckCode);
|
||||
res.successful = true;
|
||||
res.resultValue = BeanUtil.CopyOjbect<Check_SpotCheck>(jc, true);
|
||||
return res;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ResponseData<List<Check_SpotCheckApprove>> GetApproveBySpotCheckCode(string spotCheckCode)
|
||||
{
|
||||
ResponseData<List<Check_SpotCheckApprove>> res = new ResponseData<List<Check_SpotCheckApprove>>();
|
||||
res.successful = true;
|
||||
res.resultValue = BLL.SpotCheckApproveService.getListDataBySpotCheckCodeForApi(spotCheckCode);
|
||||
|
||||
return res;
|
||||
|
||||
}
|
||||
public ResponseData<Check_SpotCheckApprove> GetCurrApproveByCode(string spotCheckCode)
|
||||
{
|
||||
ResponseData<Check_SpotCheckApprove> res = new ResponseData<Check_SpotCheckApprove>();
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = BeanUtil.CopyOjbect<Check_SpotCheckApprove>(BLL.SpotCheckApproveService.getCurrApproveForApi(spotCheckCode), true);
|
||||
return res;
|
||||
}
|
||||
[HttpGet]
|
||||
public ResponseData<List<SpotCheckItem>> GetSpotCheckDetail(string spotCheckCode)
|
||||
{
|
||||
ResponseData<List<SpotCheckItem>> res = new ResponseData<List<SpotCheckItem>>();
|
||||
res.successful = true;
|
||||
// res.resultValue = BLL.JointCheckDetailService.getListData(id);
|
||||
|
||||
List<SpotCheckItem> spotCheckItem = new List<SpotCheckItem>();
|
||||
List<Check_SpotCheckDetail> spotCheckDetails = BLL.SpotCheckDetailService.GetSpotCheckDetailsForApi(spotCheckCode);
|
||||
foreach (Check_SpotCheckDetail d in spotCheckDetails)
|
||||
{
|
||||
SpotCheckItem item = new SpotCheckItem();
|
||||
item.SpotCheckDetail = d;
|
||||
item.controlItemAndCycle = BLL.ControlItemAndCycleService.GetControlItemAndCycleById(d.ControlItemAndCycleId) ;
|
||||
item.controlItemAndCycle = BeanUtil.CopyOjbect<WBS_ControlItemAndCycle>(item.controlItemAndCycle,true);
|
||||
item.controlItemAndCycle.AttachUrl = BLL.ControlItemAndCycleService.ConvertDetailName(item.controlItemAndCycle.ControlItemAndCycleId);
|
||||
if (item.controlItemAndCycle != null)
|
||||
{
|
||||
item.workPackage= BLL.WorkPackageService.GetWorkPackageByWorkPackageId(item.controlItemAndCycle.WorkPackageId);
|
||||
WBS_WorkPackage temp = BeanUtil.CopyOjbect<WBS_WorkPackage>(item.workPackage, true);
|
||||
temp.UnitWorkId = item.workPackage.UnitWorkId;
|
||||
item.workPackage = temp;
|
||||
|
||||
}
|
||||
if (item.workPackage != null)
|
||||
{
|
||||
// item.CNProfessional = BLL.CNProfessionalService.GetCNProfessional(item.workPackage.CNProfessionalCode);
|
||||
//item.CNProfessional = BeanUtil.CopyOjbect<WBS_CNProfessional>(item.CNProfessional, true);
|
||||
|
||||
}
|
||||
if (item.workPackage != null)
|
||||
{
|
||||
item.unitWork = BLL.UnitWorkService.getUnitWorkByUnitWorkId(item.workPackage.UnitWorkId.ToString()) ;
|
||||
item.unitWork = BeanUtil.CopyOjbect<WBS_UnitWork>(item.unitWork, true);
|
||||
|
||||
}
|
||||
|
||||
spotCheckItem.Add(item);
|
||||
}
|
||||
|
||||
|
||||
res.resultValue = spotCheckItem;
|
||||
|
||||
|
||||
|
||||
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
[HttpPost]
|
||||
public ResponseData<string> AddSpotCheck([FromBody]Model.Check_SpotCheck SpotControl)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(SpotControl.SpotCheckCode))
|
||||
{
|
||||
|
||||
SpotControl.SpotCheckCode = BLL.SQLHelper.GetNewID(typeof(Model.Check_SpotCheck));
|
||||
if (string.IsNullOrEmpty(SpotControl.DocCode))
|
||||
{
|
||||
string prefix = BLL.ProjectService.GetProjectByProjectId(SpotControl.ProjectId).ProjectCode + "-06-CM03-SJ-";
|
||||
SpotControl.DocCode = BLL.SQLHelper.RunProcNewId("SpGetNewIncentiveCode", "dbo.Check_CheckControl", "DocCode", prefix);
|
||||
}
|
||||
BLL.SpotCheckService.AddSpotCheckForApi(SpotControl);
|
||||
//BLL.AttachFileService.updateAttachFile(SpotControl.AttachUrl, SpotControl.SpotCheckCode, BLL.Const.SpotCheckMenuId);
|
||||
SaveAttachFile(SpotControl.SpotCheckCode, BLL.Const.SpotCheckMenuId, SpotControl.AttachUrl);
|
||||
res.resultValue = SpotControl.SpotCheckCode;
|
||||
res.successful = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
BLL.SpotCheckService.UpdateSpotCheckForUpdateForApi(SpotControl);
|
||||
//BLL.AttachFileService.updateAttachFile(SpotControl.AttachUrl, SpotControl.SpotCheckCode, BLL.Const.SpotCheckMenuId);
|
||||
SaveAttachFile(SpotControl.SpotCheckCode, BLL.Const.SpotCheckMenuId, SpotControl.AttachUrl);
|
||||
res.resultValue = SpotControl.SpotCheckCode;
|
||||
res.successful = true;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
res.resultHint = e.StackTrace;
|
||||
res.successful = false;
|
||||
}
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static void SaveAttachFile(string dataId, string menuId, string url)
|
||||
{
|
||||
Model.ToDoItem toDoItem = new Model.ToDoItem
|
||||
{
|
||||
MenuId = menuId,
|
||||
DataId = dataId,
|
||||
UrlStr = url,
|
||||
};
|
||||
APIUpLoadFileService.SaveAttachUrl(toDoItem);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ResponseData<string> AddSpotCheckDetail([FromBody]Model.Check_SpotCheckDetail SpotCheckDetail)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(SpotCheckDetail.SpotCheckDetailId))
|
||||
{
|
||||
SpotCheckDetail.SpotCheckDetailId = Guid.NewGuid().ToString();
|
||||
SpotCheckDetail.CreateDate = DateTime.Now;
|
||||
BLL.SpotCheckDetailService.AddSpotCheckDetailForApi(SpotCheckDetail);
|
||||
res.resultValue = SpotCheckDetail.SpotCheckDetailId;
|
||||
}
|
||||
else
|
||||
{
|
||||
BLL.SpotCheckDetailService.UpdateSpotCheckDetailForApi(SpotCheckDetail);
|
||||
res.resultValue = SpotCheckDetail.SpotCheckDetailId;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
res.successful = false;
|
||||
}
|
||||
res.successful = true;
|
||||
return res;
|
||||
|
||||
}
|
||||
[HttpGet]
|
||||
public ResponseData<string> DelSpotCheckDetail(string SpotCheckDetailId)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
try
|
||||
{
|
||||
if (!string.IsNullOrEmpty(SpotCheckDetailId))
|
||||
{
|
||||
BLL.SpotCheckDetailService.DeleteSpotCheckDetail(SpotCheckDetailId);
|
||||
res.resultValue =SpotCheckDetailId;
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
res.successful = false;
|
||||
}
|
||||
res.successful = true;
|
||||
return res;
|
||||
|
||||
}
|
||||
[HttpPost]
|
||||
public ResponseData<string> AddApprove([FromBody]Model.Check_SpotCheckApprove approve)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
try
|
||||
{
|
||||
Model.Check_SpotCheck spotCheck1 = BLL.SpotCheckService.GetSpotCheckBySpotCheckCodeForApi(approve.SpotCheckCode);
|
||||
|
||||
Model.Check_SpotCheck CheckControl = new Model.Check_SpotCheck();
|
||||
CheckControl.SpotCheckCode = approve.SpotCheckCode;
|
||||
CheckControl.State = approve.ApproveType;
|
||||
BLL.SpotCheckService.UpdateSpotCheckForApi(CheckControl);
|
||||
|
||||
|
||||
//总包专工确认时,通知相关人员
|
||||
if (approve.ApproveType == BLL.Const.SpotCheck_Audit3 || approve.ApproveType == BLL.Const.SpotCheck_Audit4)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(spotCheck1.JointCheckMans))
|
||||
{
|
||||
string[] seeUsers = spotCheck1.JointCheckMans.Split(',');
|
||||
foreach (var seeUser in seeUsers)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(seeUser))
|
||||
{
|
||||
Model.Check_SpotCheckApprove approve2 = new Model.Check_SpotCheckApprove();
|
||||
approve2.SpotCheckCode = approve.SpotCheckCode;
|
||||
approve2.ApproveMan = seeUser;
|
||||
approve2.ApproveType = "S";
|
||||
approve2.Sign = "1";
|
||||
BLL.SpotCheckApproveService.AddSpotCheckApproveForApi(approve2);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(spotCheck1.JointCheckMans2))
|
||||
{
|
||||
string[] seeUsers = spotCheck1.JointCheckMans2.Split(',');
|
||||
foreach (var seeUser in seeUsers)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(seeUser))
|
||||
{
|
||||
Model.Check_SpotCheckApprove approve2 = new Model.Check_SpotCheckApprove();
|
||||
approve2.SpotCheckCode = approve.SpotCheckCode;
|
||||
approve2.ApproveMan = seeUser;
|
||||
approve2.ApproveType = "S";
|
||||
approve2.Sign = "1";
|
||||
BLL.SpotCheckApproveService.AddSpotCheckApproveForApi(approve2);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(spotCheck1.JointCheckMans3))
|
||||
{
|
||||
string[] seeUsers = spotCheck1.JointCheckMans3.Split(',');
|
||||
foreach (var seeUser in seeUsers)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(seeUser))
|
||||
{
|
||||
Model.Check_SpotCheckApprove approve2 = new Model.Check_SpotCheckApprove();
|
||||
approve2.SpotCheckCode = approve.SpotCheckCode;
|
||||
approve2.ApproveMan = seeUser;
|
||||
approve2.ApproveType = "S";
|
||||
approve2.Sign = "1";
|
||||
BLL.SpotCheckApproveService.AddSpotCheckApproveForApi(approve2);
|
||||
}
|
||||
}
|
||||
}
|
||||
Model.Check_SpotCheckApprove ap = BLL.SpotCheckApproveService.GetComplieForApi(approve.SpotCheckCode);
|
||||
if (ap != null)
|
||||
{
|
||||
Model.Check_SpotCheckApprove approve2 = new Model.Check_SpotCheckApprove();
|
||||
approve2.SpotCheckCode = approve.SpotCheckCode;
|
||||
approve2.ApproveMan = ap.ApproveMan;
|
||||
approve2.ApproveType = "S";
|
||||
approve2.Sign = "1";
|
||||
BLL.SpotCheckApproveService.AddSpotCheckApproveForApi(approve2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (approve.ApproveType == BLL.Const.SpotCheck_Complete) //审批完成时,生成分包上传交工资料的办理记录
|
||||
{
|
||||
CheckControl.State2 = BLL.Const.SpotCheck_Audit5; //更新主表状态
|
||||
bool isShow = true; //判断主表是否需要上传资料
|
||||
var list = BLL.SpotCheckDetailService.GetOKSpotCheckDetailsForApi(CheckControl.SpotCheckCode);
|
||||
if (list.Count == 0) //没有合格项,则在上传资料页面不显示该主表记录
|
||||
{
|
||||
isShow = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool isExitForms = false;
|
||||
foreach (var item in list)
|
||||
{
|
||||
Model.WBS_ControlItemAndCycle c = BLL.ControlItemAndCycleService.GetControlItemAndCycleByIdForApi(item.ControlItemAndCycleId);
|
||||
if (c != null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(c.HGForms) || !string.IsNullOrEmpty(c.SHForms))
|
||||
{
|
||||
isExitForms = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isExitForms) //不存在有表格需上传的明细记录
|
||||
{
|
||||
isShow = false;
|
||||
}
|
||||
}
|
||||
CheckControl.IsShow = isShow;
|
||||
BLL.SpotCheckService.UpdateSpotCheckForApi(CheckControl);
|
||||
foreach (var item in list)
|
||||
{
|
||||
//更新明细记录
|
||||
//判断明细是否需要上传资料
|
||||
Model.WBS_ControlItemAndCycle c = BLL.ControlItemAndCycleService.GetControlItemAndCycleByIdForApi(item.ControlItemAndCycleId);
|
||||
if (c != null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(c.HGForms) && string.IsNullOrEmpty(c.SHForms))
|
||||
{
|
||||
item.IsShow = false;
|
||||
item.IsDataOK = "2"; //资料情况为不需要
|
||||
}
|
||||
else
|
||||
{
|
||||
item.IsShow = true;
|
||||
}
|
||||
}
|
||||
item.State = BLL.Const.SpotCheck_Audit5;
|
||||
item.HandleMan = spotCheck1.CreateMan;
|
||||
BLL.SpotCheckDetailService.UpdateSpotCheckDetailForApi(item);
|
||||
if (item.IsShow == true)
|
||||
{
|
||||
//新增待办记录
|
||||
Model.Check_SpotCheckApprove approve2 = new Model.Check_SpotCheckApprove();
|
||||
approve2.SpotCheckCode = CheckControl.SpotCheckCode;
|
||||
approve2.ApproveMan = spotCheck1.CreateMan;
|
||||
approve2.ApproveType = BLL.Const.SpotCheck_Audit5;
|
||||
approve2.Sign = "2";
|
||||
approve2.SpotCheckDetailId = item.SpotCheckDetailId;
|
||||
BLL.SpotCheckApproveService.AddSpotCheckApproveForApi(approve2);
|
||||
}
|
||||
}
|
||||
}
|
||||
res.resultValue = BLL.SpotCheckApproveService.AddSpotCheckApproveForApi(approve);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
res.successful = false;
|
||||
}
|
||||
res.successful = true;
|
||||
return res;
|
||||
|
||||
}
|
||||
[HttpPost]
|
||||
public ResponseData<string> UpdateApprove([FromBody]Model.Check_SpotCheckApprove approve)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
try
|
||||
{
|
||||
//Model.Check_JointCheckApprove approve1 = BLL.JointCheckApproveService.GetJointCheckApproveByJointCheckId(approve.JointCheckId);
|
||||
approve.ApproveDate = DateTime.Now;
|
||||
//approve1.ApproveIdea = approve.ApproveIdea;
|
||||
//approve1.IsAgree = approve.IsAgree;
|
||||
// approve1.AttachUrl = approve.AttachUrl;
|
||||
BLL.SpotCheckApproveService.UpdateSpotCheckApproveForApi(approve);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
res.successful = false;
|
||||
}
|
||||
res.successful = true;
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ResponseData<List<TreeNode>> getWBSTree(string projectId)
|
||||
{
|
||||
ResponseData<List<TreeNode>> res = new ResponseData<List<TreeNode>>();
|
||||
List<TreeNode> resList = new List<TreeNode>();
|
||||
res.successful = true;
|
||||
res.resultValue = resList;
|
||||
TreeNode t1 = new TreeNode();
|
||||
t1.ID = "1";
|
||||
t1.Depth = 1;
|
||||
t1.Title = "建筑工程";
|
||||
t1.Type = "projectType";
|
||||
resList.Add(t1);
|
||||
List<Model.WBS_UnitWork> works = BLL.UnitWorkService.GetUnitWorkListByPidForApi(projectId, "1");
|
||||
foreach(var item in works)
|
||||
{
|
||||
TreeNode tw = new TreeNode();
|
||||
tw.ID = item.UnitWorkId;
|
||||
tw.Title =item.UnitWorkName;
|
||||
tw.Depth = 2;
|
||||
tw.Type = "unitWork";
|
||||
if (t1.child == null)
|
||||
{
|
||||
t1.child = new List<TreeNode>();
|
||||
}
|
||||
t1.child.Add(tw);
|
||||
List<Model.WBS_WorkPackage> packages = BLL.WorkPackageService.GetApproveWorkPackages1sByUnitWorkId(item.UnitWorkId);
|
||||
foreach(var wp in packages)
|
||||
{
|
||||
if(tw.child == null)
|
||||
{
|
||||
tw.child = new List<TreeNode>();
|
||||
}
|
||||
tw.child.Add(GetTreeNode(wp,3));
|
||||
}
|
||||
}
|
||||
TreeNode t2 = new TreeNode();
|
||||
t2.ID = "2";
|
||||
t2.Title = "安装工程";
|
||||
t2.Type = "projectType";
|
||||
t2.Depth = 1;
|
||||
resList.Add(t2);
|
||||
List<Model.WBS_UnitWork> works2 = BLL.UnitWorkService.GetUnitWorkListByPidForApi(projectId, "2");
|
||||
foreach (var item in works2)
|
||||
{
|
||||
TreeNode tw = new TreeNode();
|
||||
tw.ID = item.UnitWorkId;
|
||||
tw.Title = item.UnitWorkName;
|
||||
tw.Depth = 2;
|
||||
tw.Type = "unitWork";
|
||||
if (t2.child == null)
|
||||
{
|
||||
t2.child = new List<TreeNode>();
|
||||
}
|
||||
t2.child.Add(tw);
|
||||
List<Model.WBS_WorkPackage> packages = BLL.WorkPackageService.GetApproveWorkPackages1sByUnitWorkId(item.UnitWorkId);
|
||||
foreach (var wp in packages)
|
||||
{
|
||||
if (tw.child == null)
|
||||
{
|
||||
tw.child = new List<TreeNode>();
|
||||
}
|
||||
tw.child.Add(GetTreeNode(wp,3));
|
||||
}
|
||||
}
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
private TreeNode GetTreeNode(WBS_WorkPackage package,int depth)
|
||||
{
|
||||
TreeNode node = new TreeNode();
|
||||
node.Title = package.PackageContent;
|
||||
node.ID = package.WorkPackageId;
|
||||
node.Type = "package";
|
||||
node.Depth = depth;
|
||||
List<Model.WBS_WorkPackage> packages = BLL.WorkPackageService.GetAllApproveWorkPackagesBySuperWorkPackageId(package.WorkPackageId);
|
||||
foreach (var wp in packages)
|
||||
{
|
||||
if (node.child == null)
|
||||
{
|
||||
node.child = new List<TreeNode>();
|
||||
}
|
||||
node.child.Add(GetTreeNode(wp, depth+1));
|
||||
}
|
||||
return node;
|
||||
|
||||
}
|
||||
[HttpGet]
|
||||
public ResponseData<string> see(string dataId, string userId)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
res.successful = true;
|
||||
BLL.SpotCheckApproveService.See(dataId, userId);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,546 @@
|
||||
using BLL;
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web.Http;
|
||||
using System.Web.UI.WebControls;
|
||||
using Aspose.Words;
|
||||
|
||||
namespace Mvc.Controllers
|
||||
{
|
||||
public class TechnicalContactController : ApiController
|
||||
{
|
||||
[HttpGet]
|
||||
public ResponseData<List<Check_TechnicalContactList>> Index(string projectId, int index, int page, string name = "")
|
||||
{
|
||||
ResponseData<List<Check_TechnicalContactList>> res = new ResponseData<List<Check_TechnicalContactList>>();
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = BLL.TechnicalContactListService.getListDataForApi(name, projectId, index, page);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public ResponseData<List<Check_TechnicalContactList>> Search(string projectId, int index, int page, string proposedUnitId = "", string unitWorkId = "", string mainSendUnit = "", string cCUnitIds = "", string professional = "", string state = "", string contactListType = "", string isReply = "", string dateA = "", string dateZ = "")
|
||||
{
|
||||
ResponseData<List<Check_TechnicalContactList>> res = new ResponseData<List<Check_TechnicalContactList>>();
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = BLL.TechnicalContactListService.getListDataForApi(state, contactListType, isReply, dateA, dateZ, proposedUnitId, unitWorkId, mainSendUnit, cCUnitIds, professional, projectId, index, page);
|
||||
return res;
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据id获取详情
|
||||
/// </summary>
|
||||
/// <param name="CheckControlCode"></param>
|
||||
/// <returns></returns>
|
||||
public ResponseData<Check_TechnicalContactList> GetContactById(string id)
|
||||
{
|
||||
ResponseData<Check_TechnicalContactList> res = new ResponseData<Check_TechnicalContactList>();
|
||||
Check_TechnicalContactList technicalContactList = BLL.TechnicalContactListService.GetTechnicalContactListByTechnicalContactListIdForApi(id);
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = BeanUtil.CopyOjbect<Check_TechnicalContactList>(technicalContactList, true);
|
||||
return res;
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据code获取 审核记录
|
||||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <returns></returns>
|
||||
public ResponseData<List<Check_TechnicalContactListApprove>> GetApproveById(string id)
|
||||
{
|
||||
ResponseData<List<Check_TechnicalContactListApprove>> res = new ResponseData<List<Check_TechnicalContactListApprove>>();
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = BLL.TechnicalContactListApproveService.GetListDataByIdForApi(id);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
public ResponseData<Check_TechnicalContactListApprove> GetCurrApproveById(string id)
|
||||
{
|
||||
ResponseData<Check_TechnicalContactListApprove> res = new ResponseData<Check_TechnicalContactListApprove>();
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = BeanUtil.CopyOjbect<Check_TechnicalContactListApprove>(BLL.TechnicalContactListApproveService.getCurrApproveForApi(id), true);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
[HttpPost]
|
||||
public ResponseData<string> AddTechnicalContact([FromBody]Model.Check_TechnicalContactList CheckControl)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(CheckControl.TechnicalContactListId))
|
||||
{
|
||||
CheckControl.TechnicalContactListId = Guid.NewGuid().ToString();
|
||||
CheckControl.CompileDate = DateTime.Now;
|
||||
BLL.TechnicalContactListService.AddTechnicalContactListForApi(CheckControl);
|
||||
//BLL.AttachFileService.updateAttachFile(CheckControl.ReturnAttachUrl, CheckControl.TechnicalContactListId + "r",BLL. Const.TechnicalContactListMenuId);
|
||||
//BLL.AttachFileService.updateAttachFile(CheckControl.AttachUrl, CheckControl.TechnicalContactListId, BLL.Const.TechnicalContactListMenuId);
|
||||
SaveAttachFile(CheckControl.TechnicalContactListId + "re", BLL.Const.TechnicalContactListMenuId, CheckControl.ReturnAttachUrl);
|
||||
SaveAttachFile(CheckControl.TechnicalContactListId + "r", BLL.Const.TechnicalContactListMenuId, CheckControl.ReAttachUrl);
|
||||
SaveAttachFile(CheckControl.TechnicalContactListId, BLL.Const.TechnicalContactListMenuId, CheckControl.AttachUrl);
|
||||
res.resultValue = CheckControl.TechnicalContactListId;
|
||||
}
|
||||
else
|
||||
{
|
||||
BLL.TechnicalContactListService.UpdateTechnicalContactListForApi(CheckControl);
|
||||
//BLL.AttachFileService.updateAttachFile(CheckControl.ReturnAttachUrl, CheckControl.TechnicalContactListId + "r", BLL.Const.TechnicalContactListMenuId);
|
||||
//BLL.AttachFileService.updateAttachFile(CheckControl.AttachUrl, CheckControl.TechnicalContactListId, BLL.Const.TechnicalContactListMenuId);
|
||||
SaveAttachFile(CheckControl.TechnicalContactListId + "re", BLL.Const.TechnicalContactListMenuId, CheckControl.ReturnAttachUrl);
|
||||
SaveAttachFile(CheckControl.TechnicalContactListId + "r", BLL.Const.TechnicalContactListMenuId, CheckControl.ReAttachUrl);
|
||||
SaveAttachFile(CheckControl.TechnicalContactListId, BLL.Const.TechnicalContactListMenuId, CheckControl.AttachUrl);
|
||||
res.resultValue = CheckControl.TechnicalContactListId;
|
||||
}
|
||||
res.successful = true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
res.resultHint = e.StackTrace;
|
||||
res.successful = false;
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static void SaveAttachFile(string dataId, string menuId, string url)
|
||||
{
|
||||
Model.ToDoItem toDoItem = new Model.ToDoItem
|
||||
{
|
||||
MenuId = menuId,
|
||||
DataId = dataId,
|
||||
UrlStr = url,
|
||||
};
|
||||
APIUpLoadFileService.SaveAttachUrl(toDoItem);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ResponseData<string> AddApprove([FromBody]Model.Check_TechnicalContactListApprove approve)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
try
|
||||
{
|
||||
Model.Check_TechnicalContactList CheckControl = new Model.Check_TechnicalContactList();
|
||||
CheckControl.TechnicalContactListId = approve.TechnicalContactListId;
|
||||
CheckControl.State = approve.ApproveType;
|
||||
BLL.TechnicalContactListService.UpdateTechnicalContactListForApi(CheckControl);
|
||||
Model.Check_TechnicalContactList technicalContactList = TechnicalContactListService.GetTechnicalContactListByTechnicalContactListId(approve.TechnicalContactListId);
|
||||
string unitType = string.Empty;
|
||||
Model.Project_ProjectUnit unit = ProjectUnitService.GetProjectUnitByUnitIdProjectId(technicalContactList.ProjectId, technicalContactList.ProposedUnitId);
|
||||
if (unit != null)
|
||||
{
|
||||
unitType = unit.UnitType;
|
||||
}
|
||||
if (unitType == BLL.Const.ProjectUnitType_1 && technicalContactList.IsReply == "2" && approve.ApproveType == Const.TechnicalContactList_Complete) //总包发起
|
||||
{
|
||||
List<Model.Sys_User> seeUsers = new List<Model.Sys_User>();
|
||||
seeUsers.AddRange(UserService.GetSeeUserList3(technicalContactList.ProjectId, technicalContactList.ProposedUnitId, technicalContactList.MainSendUnitId, technicalContactList.CCUnitIds, technicalContactList.CNProfessionalCode, technicalContactList.UnitWorkId.ToString()));
|
||||
seeUsers = seeUsers.Distinct().ToList();
|
||||
foreach (var seeUser in seeUsers)
|
||||
{
|
||||
Model.Check_TechnicalContactListApprove approveS = new Model.Check_TechnicalContactListApprove();
|
||||
approveS.TechnicalContactListId = approve.TechnicalContactListId;
|
||||
approveS.ApproveMan = seeUser.UserId;
|
||||
approveS.ApproveType = "S";
|
||||
TechnicalContactListApproveService.AddTechnicalContactListApprove(approveS);
|
||||
}
|
||||
}
|
||||
if (unitType == BLL.Const.ProjectUnitType_2 && technicalContactList.IsReply == "2" && approve.ApproveType == Const.TechnicalContactList_Complete) //分包发起
|
||||
{
|
||||
List<Model.Sys_User> seeUsers = new List<Model.Sys_User>();
|
||||
seeUsers.AddRange(UserService.GetSeeUserList3(technicalContactList.ProjectId, technicalContactList.ProposedUnitId, technicalContactList.MainSendUnitId, technicalContactList.CCUnitIds, technicalContactList.CNProfessionalCode, technicalContactList.UnitWorkId.ToString()));
|
||||
seeUsers = seeUsers.Distinct().ToList();
|
||||
foreach (var seeUser in seeUsers)
|
||||
{
|
||||
Model.Check_TechnicalContactListApprove approveS = new Model.Check_TechnicalContactListApprove();
|
||||
approveS.TechnicalContactListId = approve.TechnicalContactListId;
|
||||
approveS.ApproveMan = seeUser.UserId;
|
||||
approveS.ApproveType = "S";
|
||||
TechnicalContactListApproveService.AddTechnicalContactListApprove(approveS);
|
||||
}
|
||||
}
|
||||
res.resultValue = BLL.TechnicalContactListApproveService.AddTechnicalContactListApprove(approve);
|
||||
res.successful = true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
res.resultHint = e.StackTrace;
|
||||
res.successful = false;
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
}
|
||||
[HttpPost]
|
||||
public ResponseData<string> UpdateApprove([FromBody]Model.Check_TechnicalContactListApprove approve)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
try
|
||||
{
|
||||
Model.Check_TechnicalContactListApprove approve1 = BLL.TechnicalContactListApproveService.GetTechnicalContactListApproveByApproveIdForApi(approve.TechnicalContactListApproveId);
|
||||
|
||||
Check_TechnicalContactList technicalContactList = BLL.TechnicalContactListService.GetTechnicalContactListByTechnicalContactListId(approve1.TechnicalContactListId);
|
||||
|
||||
if (technicalContactList.IsReply == "1")
|
||||
{
|
||||
approve.ApproveDate = DateTime.Now;
|
||||
// approve1.ApproveIdea = approve.ApproveIdea;
|
||||
// approve1.IsAgree = approve.IsAgree;
|
||||
//approve1.AttachUrl = approve.AttachUrl;
|
||||
|
||||
switch (approve1.ApproveType)
|
||||
{
|
||||
case "5":
|
||||
case "7":
|
||||
case "F":
|
||||
case "Z":
|
||||
case "J":
|
||||
case "H":
|
||||
{
|
||||
Model.Check_TechnicalContactList CheckControl = new Model.Check_TechnicalContactList();
|
||||
CheckControl.TechnicalContactListId = approve1.TechnicalContactListId;
|
||||
CheckControl.ReOpinion = approve.ApproveIdea;
|
||||
BLL.TechnicalContactListService.UpdateTechnicalContactListForApi(CheckControl);
|
||||
approve.ApproveIdea = null;
|
||||
|
||||
}
|
||||
break;
|
||||
case "2":
|
||||
Project_ProjectUnit unit = BLL.ProjectUnitService.GetProjectUnitByUnitIdProjectId(technicalContactList.ProjectId, technicalContactList.ProposedUnitId);
|
||||
//Base_Unit unit = BLL.UnitService.GetUnitByUnitId(technicalContactList.ProposedUnitId);
|
||||
if (unit.UnitType == BLL.Const.ProjectUnitType_1)
|
||||
{
|
||||
Model.Check_TechnicalContactList CheckControl = new Model.Check_TechnicalContactList();
|
||||
CheckControl.TechnicalContactListId = approve1.TechnicalContactListId;
|
||||
CheckControl.ReOpinion = approve.ApproveIdea;
|
||||
BLL.TechnicalContactListService.UpdateTechnicalContactListForApi(CheckControl);
|
||||
approve.ApproveIdea = null;
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
case "4":
|
||||
Project_ProjectUnit unit1 = BLL.ProjectUnitService.GetProjectUnitByUnitIdProjectId(technicalContactList.ProjectId, technicalContactList.ProposedUnitId);
|
||||
|
||||
if (unit1.UnitType != BLL.Const.ProjectUnitType_1)
|
||||
{
|
||||
Model.Check_TechnicalContactList CheckControl = new Model.Check_TechnicalContactList();
|
||||
CheckControl.TechnicalContactListId = approve1.TechnicalContactListId;
|
||||
CheckControl.ReOpinion = approve.ApproveIdea;
|
||||
BLL.TechnicalContactListService.UpdateTechnicalContactListForApi(CheckControl);
|
||||
approve.ApproveIdea = null;
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
BLL.TechnicalContactListApproveService.UpdateTechnicalContactListApproveForApi(approve);
|
||||
res.successful = true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
res.resultHint = e.StackTrace;
|
||||
res.successful = false;
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
}
|
||||
[HttpGet]
|
||||
public ResponseData<string> see(string dataId, string userId)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
res.successful = true;
|
||||
BLL.TechnicalContactListApproveService.See(dataId, userId);
|
||||
return res;
|
||||
}
|
||||
/// <summary>
|
||||
/// 导出工程联络单
|
||||
/// </summary>
|
||||
/// <param name="CheckControlCode"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public ResponseData<string> UplodeTechnicalContact(string id)
|
||||
{
|
||||
ResponseData<string> res = new ResponseData<string>();
|
||||
try
|
||||
{
|
||||
Model.Check_TechnicalContactList technicalContactList = TechnicalContactListService.GetTechnicalContactListByTechnicalContactListId(id);
|
||||
string rootPath = ConfigurationManager.AppSettings["localRoot"];//物理路径
|
||||
string uploadfilepath = rootPath + Const.TechnicalContactListTemplateUrl;
|
||||
string path = "FileUpload\\TechnicalContactList\\" + DateTime.Now.ToString("yyyy-MM") + "\\工程联络单.doc";
|
||||
string newuploadfilepath = rootPath + path;
|
||||
string newUrl = newuploadfilepath.Replace(".doc", technicalContactList.Code + ".doc");
|
||||
string AttachPath = rootPath + "FileUpload\\TechnicalContactList\\" + DateTime.Now.ToString("yyyy-MM"); ///文件夹
|
||||
if (!Directory.Exists(AttachPath))
|
||||
{
|
||||
Directory.CreateDirectory(AttachPath);
|
||||
}
|
||||
if (File.Exists(newUrl))
|
||||
{
|
||||
File.Delete(newUrl);
|
||||
}
|
||||
File.Copy(uploadfilepath, newUrl);
|
||||
//更新书签内容
|
||||
var unit = UnitService.GetUnitByUnitId(technicalContactList.ProposedUnitId);
|
||||
string unitType = string.Empty;
|
||||
var projectUnit = ProjectUnitService.GetProjectUnitByUnitIdProjectId(technicalContactList.ProjectId, technicalContactList.ProposedUnitId);
|
||||
if (unit != null)
|
||||
{
|
||||
unitType = projectUnit.UnitType;
|
||||
}
|
||||
Document doc = new Aspose.Words.Document(newUrl);
|
||||
Bookmark bookmarkProjectName = doc.Range.Bookmarks["ProjectName"];
|
||||
if (bookmarkProjectName != null)
|
||||
{
|
||||
var project = ProjectService.GetProjectByProjectId(technicalContactList.ProjectId);
|
||||
if (project != null)
|
||||
{
|
||||
bookmarkProjectName.Text = project.ProjectName;
|
||||
}
|
||||
}
|
||||
Bookmark bookmarkCode = doc.Range.Bookmarks["Code"];
|
||||
if (bookmarkCode != null)
|
||||
{
|
||||
bookmarkCode.Text = technicalContactList.Code;
|
||||
}
|
||||
Bookmark bookmarkProposedUnit = doc.Range.Bookmarks["ProposedUnit"];
|
||||
if (bookmarkProposedUnit != null)
|
||||
{
|
||||
|
||||
if (unit != null)
|
||||
{
|
||||
bookmarkProposedUnit.Text = unit.UnitName;
|
||||
}
|
||||
|
||||
}
|
||||
Bookmark bookmarkUnitWork = doc.Range.Bookmarks["UnitWork"];
|
||||
if (bookmarkUnitWork != null)
|
||||
{
|
||||
bookmarkUnitWork.Text = UnitWorkService.GetUnitWorkName(technicalContactList.UnitWorkId);
|
||||
}
|
||||
Bookmark bookmarkCNProfessional = doc.Range.Bookmarks["CNProfessional"];
|
||||
if (bookmarkCNProfessional != null)
|
||||
{
|
||||
bookmarkCNProfessional.Text = CNProfessionalService.GetCNProfessionalNameByCode(technicalContactList.CNProfessionalCode);
|
||||
}
|
||||
Bookmark bookmarkMainSendUnit = doc.Range.Bookmarks["MainSendUnit"];
|
||||
if (bookmarkMainSendUnit != null)
|
||||
{
|
||||
bookmarkMainSendUnit.Text = UnitService.GetUnitNameByUnitId(technicalContactList.MainSendUnitId);
|
||||
}
|
||||
Bookmark bookmarkCCUnit = doc.Range.Bookmarks["CCUnit"];
|
||||
if (bookmarkCCUnit != null)
|
||||
{
|
||||
bookmarkCCUnit.Text = UnitService.GetUnitNameByUnitId(technicalContactList.CCUnitIds);
|
||||
}
|
||||
Bookmark bookmarkContactListType = doc.Range.Bookmarks["ContactListType"];
|
||||
if (bookmarkContactListType != null)
|
||||
{
|
||||
if (technicalContactList.ContactListType == "1")
|
||||
{
|
||||
bookmarkContactListType.Text = "■图纸类 □非图纸类";
|
||||
}
|
||||
else
|
||||
{
|
||||
bookmarkContactListType.Text = "□图纸类 ■非图纸类";
|
||||
}
|
||||
}
|
||||
Bookmark bookmarkIsReply = doc.Range.Bookmarks["IsReply"];
|
||||
if (bookmarkIsReply != null)
|
||||
{
|
||||
if (technicalContactList.IsReply == "1")
|
||||
{
|
||||
bookmarkIsReply.Text = "■需要回复 □不需回复";
|
||||
}
|
||||
else
|
||||
{
|
||||
bookmarkIsReply.Text = "□需要回复 ■不需回复";
|
||||
}
|
||||
}
|
||||
//☑
|
||||
Bookmark bookmarkCause = doc.Range.Bookmarks["Cause"];
|
||||
if (bookmarkCause != null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(technicalContactList.Cause))
|
||||
{
|
||||
bookmarkCause.Text = technicalContactList.Cause;
|
||||
}
|
||||
|
||||
}
|
||||
Bookmark bookmarkContents = doc.Range.Bookmarks["Contents"];
|
||||
if (bookmarkContents != null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(technicalContactList.Contents))
|
||||
{
|
||||
bookmarkContents.Text = technicalContactList.Contents;
|
||||
}
|
||||
|
||||
}
|
||||
Bookmark bookmarkAttachUrl = doc.Range.Bookmarks["AttachUrl"];
|
||||
if (bookmarkAttachUrl != null)
|
||||
{
|
||||
if (AttachFileService.Getfile(technicalContactList.TechnicalContactListId, Const.TechnicalContactListMenuId))
|
||||
{
|
||||
bookmarkAttachUrl.Text = "见附页";
|
||||
}
|
||||
else
|
||||
{
|
||||
bookmarkAttachUrl.Text = "无";
|
||||
}
|
||||
}
|
||||
Bookmark bookmarkCompileMan = doc.Range.Bookmarks["CompileMan"];
|
||||
if (bookmarkCompileMan != null)
|
||||
{
|
||||
Model.Sys_User user = UserService.GetUserByUserId(technicalContactList.CompileMan);
|
||||
var file = string.Empty;
|
||||
if (user != null)
|
||||
{
|
||||
file = user.SignatureUrl;
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(file))
|
||||
{
|
||||
string url = rootPath + file;
|
||||
DocumentBuilder builders = new DocumentBuilder(doc);
|
||||
builders.MoveToBookmark("CompileMan");
|
||||
if (!string.IsNullOrEmpty(url))
|
||||
{
|
||||
System.Drawing.Size JpgSize;
|
||||
float Wpx;
|
||||
float Hpx;
|
||||
UploadAttachmentService.getJpgSize(url, out JpgSize, out Wpx, out Hpx);
|
||||
double i = 1;
|
||||
i = JpgSize.Width / 50.0;
|
||||
if (File.Exists(url))
|
||||
{
|
||||
builders.InsertImage(url, JpgSize.Width / i, JpgSize.Height / i);
|
||||
}
|
||||
else
|
||||
{
|
||||
bookmarkCompileMan.Text = user.UserName;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bookmarkCompileMan.Text = UserService.GetUserNameByUserId(technicalContactList.CompileMan);
|
||||
}
|
||||
}
|
||||
Bookmark bookmarkAuditMan1 = doc.Range.Bookmarks["AuditMan1"];
|
||||
if (bookmarkAuditMan1 != null)
|
||||
{
|
||||
Model.Check_TechnicalContactListApprove approve = null;
|
||||
if (unitType == BLL.Const.ProjectUnitType_2) //施工分包发起
|
||||
{
|
||||
approve = TechnicalContactListApproveService.GetApprove(technicalContactList.TechnicalContactListId);
|
||||
}
|
||||
else
|
||||
{
|
||||
approve = TechnicalContactListApproveService.GetApprove2(technicalContactList.TechnicalContactListId);
|
||||
}
|
||||
if (approve != null)
|
||||
{
|
||||
Model.Sys_User user = UserService.GetUserByUserId(approve.ApproveMan);
|
||||
var file = user.SignatureUrl;
|
||||
if (!string.IsNullOrWhiteSpace(file))
|
||||
{
|
||||
string url = rootPath + file;
|
||||
DocumentBuilder builders = new DocumentBuilder(doc);
|
||||
builders.MoveToBookmark("AuditMan1");
|
||||
if (!string.IsNullOrEmpty(url))
|
||||
{
|
||||
System.Drawing.Size JpgSize;
|
||||
float Wpx;
|
||||
float Hpx;
|
||||
UploadAttachmentService.getJpgSize(url, out JpgSize, out Wpx, out Hpx);
|
||||
double i = 1;
|
||||
i = JpgSize.Width / 50.0;
|
||||
if (File.Exists(url))
|
||||
{
|
||||
builders.InsertImage(url, JpgSize.Width / i, JpgSize.Height / i);
|
||||
}
|
||||
else
|
||||
{
|
||||
bookmarkAuditMan1.Text = user.UserName;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bookmarkAuditMan1.Text = UserService.GetUserNameByUserId(approve.ApproveMan);
|
||||
}
|
||||
}
|
||||
}
|
||||
Bookmark bookmarkCompileDate = doc.Range.Bookmarks["CompileDate"];
|
||||
if (bookmarkCompileDate != null)
|
||||
{
|
||||
if (technicalContactList.CompileDate != null)
|
||||
{
|
||||
bookmarkCompileDate.Text = string.Format("{0:yyyy-MM-dd}", technicalContactList.CompileDate);
|
||||
}
|
||||
}
|
||||
Bookmark bookmarkApproveIdea = doc.Range.Bookmarks["ApproveIdea"];
|
||||
if (bookmarkApproveIdea != null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(technicalContactList.ReOpinion))
|
||||
{
|
||||
bookmarkApproveIdea.Text = technicalContactList.ReOpinion;
|
||||
}
|
||||
|
||||
}
|
||||
doc.Save(newUrl);
|
||||
//生成PDF文件
|
||||
string pdfUrl = newUrl.Replace(".doc", ".pdf");
|
||||
if (File.Exists(pdfUrl))
|
||||
{
|
||||
File.Delete(pdfUrl);
|
||||
}
|
||||
Document doc1 = new Aspose.Words.Document(newUrl);
|
||||
//验证参数
|
||||
if (doc1 == null) { throw new Exception("Word文件无效"); }
|
||||
doc1.Save(pdfUrl, Aspose.Words.SaveFormat.Pdf);//还可以改成其它格式
|
||||
//Microsoft.Office.Interop.Word.Document doc1 = new Microsoft.Office.Interop.Word.Document(newUrl);
|
||||
//object fontname = "Wingdings 2";
|
||||
//object uic = true;
|
||||
//doc1.Bookmarks["ApproveIdea"].Range.InsertSymbol(-4014, ref fontname, ref uic);
|
||||
string initTemplatePath = "FileUpload/TechnicalContactList/" + DateTime.Now.ToString("yyyy-MM") + "/工程联络单.doc";
|
||||
string filePath = initTemplatePath.Replace(".doc", technicalContactList.Code + ".pdf");
|
||||
//string fileName = Path.GetFileName(filePath);
|
||||
//FileInfo info = new FileInfo(pdfUrl);
|
||||
//long fileSize = info.Length;
|
||||
//System.Web.HttpContext.Current.Response.Clear();
|
||||
//System.Web.HttpContext.Current.Response.ContentType = "application/x-zip-compressed";
|
||||
//System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
||||
//System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString());
|
||||
//System.Web.HttpContext.Current.Response.TransmitFile(pdfUrl, 0, fileSize);
|
||||
//System.Web.HttpContext.Current.Response.Flush();
|
||||
res.successful = true;
|
||||
res.resultValue = filePath;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
res.successful = false;
|
||||
res.resultValue = e.StackTrace + e.Message;
|
||||
throw;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Http;
|
||||
using Model;
|
||||
using BLL;
|
||||
|
||||
namespace Mvc.Controllers
|
||||
{
|
||||
public class WBSController : ApiController
|
||||
{
|
||||
// GET: /WBSControlIer/
|
||||
[HttpGet]
|
||||
public ResponseData<List<View_WBS_ControlItemAndCycle>> Search(string projectId, int index, int page, string unitWorkId = "", string ControlItemContent = "", string ControlPoint = "", string ControlItemDef = "", string HGForms = "")
|
||||
{
|
||||
ResponseData<List<View_WBS_ControlItemAndCycle>> res = new ResponseData<List<View_WBS_ControlItemAndCycle>>();
|
||||
|
||||
res.successful = true;
|
||||
res.resultValue = BLL.WBSsearchService.getWBSlistForApi(projectId, index, page,unitWorkId, ControlItemContent, ControlPoint, ControlItemDef, HGForms);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user