refactor(cqms): 整理检查模块并迁移 WBS 服务
清理旧检查页面、服务和接口,补充 WBS 检查服务及数据库脚本,同步工程引用与菜单配置,收敛 CQMS 检查功能的代码组织。
This commit is contained in:
@@ -1,150 +0,0 @@
|
||||
using BLL;
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Http;
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,193 +0,0 @@
|
||||
using BLL;
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Http;
|
||||
|
||||
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))
|
||||
{
|
||||
string id = CheckControl.WorkPackageId;
|
||||
|
||||
CheckControl.WorkPackageName = WorkPackageService.getWorkPageNamesByControlItemAndCycle(id, null);
|
||||
CheckControl.WorkPackageId = WorkPackageService.getWorkPageIdsByControlItemAndCycle(id, null);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -420,44 +420,5 @@ namespace Mvc.Controllers
|
||||
//return res;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ResponseData<string> getDefaultCode(string projectId, string type, string unitId)
|
||||
{
|
||||
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 "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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,162 +0,0 @@
|
||||
using BLL;
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Http;
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
using Model;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Http;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,167 +0,0 @@
|
||||
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> 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;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,321 +0,0 @@
|
||||
using BLL;
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace Mvc.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 质量共检
|
||||
/// </summary>
|
||||
public class JointCheckController : ApiController
|
||||
{
|
||||
/// <summary>
|
||||
/// 质量共检
|
||||
/// </summary>
|
||||
/// <param name="projectId"></param>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="page"></param>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
[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.SitePerson_Person> seeUsers = new List<Model.SitePerson_Person>();
|
||||
foreach (var a in jointCheckDetails)
|
||||
{
|
||||
a.JointCheckId = approve.JointCheckId;
|
||||
if (string.IsNullOrEmpty(approve.JointCheckId))
|
||||
{
|
||||
seeUsers.AddRange(SitePerson_PersonService.GetSeeUserList2(jointCheck.ProjectId, jointCheck.UnitId, a.CNProfessionalCode, a.UnitWorkId.ToString(), approve.ApproveMan, string.Empty));
|
||||
}
|
||||
}
|
||||
if (string.IsNullOrEmpty(approve.JointCheckId))
|
||||
{
|
||||
seeUsers = seeUsers.Distinct().ToList();
|
||||
foreach (var seeUser in seeUsers)
|
||||
{
|
||||
Model.Check_JointCheckApprove approves = new Model.Check_JointCheckApprove
|
||||
{
|
||||
JointCheckId = approve.JointCheckId,
|
||||
ApproveMan = seeUser.PersonId,
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,537 +0,0 @@
|
||||
using BLL;
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Http;
|
||||
|
||||
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);
|
||||
Model.WBS_ControlItemInit cInit = BLL.ControlItemInitService.GetControlItemInitByCode(c.InitControlItemCode);
|
||||
bool isJDItem = false;
|
||||
if (cInit != null && cInit.IsJDItem.HasValue)
|
||||
{
|
||||
isJDItem = cInit.IsJDItem.Value;
|
||||
}
|
||||
if (c != null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(c.HGForms) && string.IsNullOrEmpty(c.SHForms))
|
||||
{
|
||||
item.IsShow = false;
|
||||
item.IsDataOK = "2"; //资料情况为不需要
|
||||
}
|
||||
else
|
||||
{
|
||||
item.IsShow = true;
|
||||
}
|
||||
//处理工作包实际完成时间
|
||||
if (c.CheckNum != null && c.CheckNum != 0) //检查次数为0表示一直检查
|
||||
{
|
||||
if (c.CheckNum == 1) //检查一次
|
||||
{
|
||||
c.RealEndDate = DateTime.Now;
|
||||
BLL.ControlItemAndCycleService.UpdateControlItemAndCycle(c);
|
||||
if (isJDItem) //进度完成项
|
||||
{
|
||||
BLL.WorkPackageService.UpdateWorkPackageRealEndDate2(c.WorkPackageId);
|
||||
}
|
||||
else //非进度完成项
|
||||
{
|
||||
Model.WBS_WorkPackage workPackage = BLL.WorkPackageService.GetWorkPackageByWorkPackageId(c.WorkPackageId);
|
||||
if (workPackage.RealEndDate == null) //分部分项还未生成实际完成时间
|
||||
{
|
||||
BLL.WorkPackageService.UpdateWorkPackageRealEndDate(c.WorkPackageId);
|
||||
}
|
||||
}
|
||||
}
|
||||
else //检查多次
|
||||
{
|
||||
List<Model.Check_SpotCheckDetail> details = BLL.SpotCheckDetailService.GetSpotCheckDetailsByControlItemAndCycleId(c.ControlItemAndCycleId);
|
||||
if (details.Count == c.CheckNum) //检查次数已达到最大值
|
||||
{
|
||||
c.RealEndDate = DateTime.Now;
|
||||
BLL.ControlItemAndCycleService.UpdateControlItemAndCycle(c);
|
||||
if (isJDItem) //进度完成项
|
||||
{
|
||||
BLL.WorkPackageService.UpdateWorkPackageRealEndDate2(c.WorkPackageId);
|
||||
}
|
||||
else //非进度完成项
|
||||
{
|
||||
Model.WBS_WorkPackage workPackage = BLL.WorkPackageService.GetWorkPackageByWorkPackageId(c.WorkPackageId);
|
||||
if (workPackage.RealEndDate == null) //分部分项还未生成实际完成时间
|
||||
{
|
||||
BLL.WorkPackageService.UpdateWorkPackageRealEndDate(c.WorkPackageId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,548 +0,0 @@
|
||||
using Aspose.Words;
|
||||
using BLL;
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.IO;
|
||||
using System.Web.Http;
|
||||
|
||||
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="id"></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
|
||||
{
|
||||
TechnicalContactListId = approve.TechnicalContactListId,
|
||||
State = approve.ApproveType
|
||||
};
|
||||
BLL.TechnicalContactListService.UpdateTechnicalContactListForApi(CheckControl);
|
||||
var getTCL = TechnicalContactListService.GetTechnicalContactListByTechnicalContactListId(approve.TechnicalContactListId);
|
||||
string unitType = string.Empty;
|
||||
var unit = ProjectUnitService.GetProjectUnitByUnitIdProjectId(getTCL.ProjectId, getTCL.ProposedUnitId);
|
||||
if (unit != null)
|
||||
{
|
||||
unitType = unit.UnitType;
|
||||
}
|
||||
if (unitType == BLL.Const.ProjectUnitType_1 && getTCL.IsReply == "2" && approve.ApproveType == Const.TechnicalContactList_Complete) //总包发起
|
||||
{
|
||||
string unitIds = getTCL.ProposedUnitId + "," + getTCL.MainSendUnitId + "," + getTCL.CCUnitIds;
|
||||
var getPersons = SitePerson_PersonService.GetSeeUserList2(getTCL.ProjectId, unitIds, getTCL.CNProfessionalCode, getTCL.UnitWorkId, string.Empty, string.Empty);
|
||||
foreach (var seeUser in getPersons)
|
||||
{
|
||||
Model.Check_TechnicalContactListApprove approveS = new Model.Check_TechnicalContactListApprove
|
||||
{
|
||||
TechnicalContactListId = approve.TechnicalContactListId,
|
||||
ApproveMan = seeUser.PersonId,
|
||||
ApproveType = "S"
|
||||
};
|
||||
TechnicalContactListApproveService.AddTechnicalContactListApprove(approveS);
|
||||
}
|
||||
}
|
||||
if (unitType == BLL.Const.ProjectUnitType_2 && getTCL.IsReply == "2" && approve.ApproveType == Const.TechnicalContactList_Complete) //分包发起
|
||||
{
|
||||
string unitIds = getTCL.ProposedUnitId + "," + getTCL.MainSendUnitId + "," + getTCL.CCUnitIds;
|
||||
var getPersons = SitePerson_PersonService.GetSeeUserList2(getTCL.ProjectId, unitIds, getTCL.CNProfessionalCode, getTCL.UnitWorkId, string.Empty, string.Empty);
|
||||
foreach (var seeUser in getPersons)
|
||||
{
|
||||
Model.Check_TechnicalContactListApprove approveS = new Model.Check_TechnicalContactListApprove
|
||||
{
|
||||
TechnicalContactListId = approve.TechnicalContactListId,
|
||||
ApproveMan = seeUser.PersonId,
|
||||
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)
|
||||
{
|
||||
var user = Person_PersonsService.GetPerson_PersonsById(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.PersonName;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bookmarkCompileMan.Text = Person_PersonsService.GetPersonsNameById(technicalContactList.CompileMan);
|
||||
}
|
||||
}
|
||||
Bookmark bookmarkAuditMan1 = doc.Range.Bookmarks["AuditMan1"];
|
||||
if (bookmarkAuditMan1 != null)
|
||||
{
|
||||
Model.Check_TechnicalContactListApprove approve = null;
|
||||
if (unitType == BLL.Const.ProjectUnitType_2 || unitType == BLL.Const.ProjectUnitType_6) //施工分包发起
|
||||
{
|
||||
approve = TechnicalContactListApproveService.GetApprove(technicalContactList.TechnicalContactListId);
|
||||
}
|
||||
else
|
||||
{
|
||||
approve = TechnicalContactListApproveService.GetApprove2(technicalContactList.TechnicalContactListId);
|
||||
}
|
||||
if (approve != null)
|
||||
{
|
||||
var user = Person_PersonsService.GetPerson_PersonsById(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.PersonName;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bookmarkAuditMan1.Text = Person_PersonsService.GetPersonsNameById(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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user