using BLL; using System; using System.Collections.Generic; using System.Linq; using System.Web.Http; namespace WebAPI.Controllers { /// /// /// public class PipeJointController : ApiController { /// /// 根据单位工程获取管线列表 /// /// /// public Model.ResponeData getPipelineListByUnitWrokId(string unitWrokId) { var responeData = new Model.ResponeData(); try { responeData.data = APIPipeJointService.getPipelineList(unitWrokId); } catch (Exception ex) { responeData.code = 0; responeData.message = ex.Message; } return responeData; } /// /// 根据管线号查找pipelinid /// /// /// /// /// /// public Model.ResponeData GetPipelineidListByCode(string pipelineCode, string projectid,int pageindex, int pageSize) { var responeData = new Model.ResponeData(); try { var pipelineidList = APIPipeJointService.GetPipelineidListByCode(pipelineCode,projectid); int pageCount = pipelineidList.Count; if (pageCount > 0 && pageindex > 0 && pageSize > 0) { pipelineidList = pipelineidList.Skip(pageSize * (pageindex - 1)).Take(pageSize).ToList(); } responeData.data = new { pageCount, pipelineidList }; } catch (Exception ex) { responeData.code = 0; responeData.message = ex.Message; } return responeData; } /// /// 根据管线ID获取未焊接的焊口信息 /// /// /// public Model.ResponeData getWeldJointListByPipeLineId(string pipeLineId) { var responeData = new Model.ResponeData(); try { responeData.data = APIPipeJointService.GetWeldJointList(pipeLineId); } catch (Exception ex) { responeData.code = 0; responeData.message = ex.Message; } return responeData; } /// /// 根据管线ID获取所有的焊口列表 /// /// /// public Model.ResponeData GetAllWeldJointList(string pipeLineId) { var responeData = new Model.ResponeData(); try { responeData.data = APIPipeJointService.GetAllWeldJointList(pipeLineId); } catch (Exception ex) { responeData.code = 0; responeData.message = ex.Message; } return responeData; } /// /// 获取焊工列表 /// /// /// public Model.ResponeData getWelderListByUnitWorkId(string unitWorkId, string weldJointId) { var responeData = new Model.ResponeData(); try { responeData.data = APIPipeJointService.getWelderList(unitWorkId, weldJointId); } catch (Exception ex) { responeData.code = 0; responeData.message = ex.Message; } return responeData; } /// /// 根据焊口ID获取焊口信息 /// /// /// public Model.ResponeData getWeldJointInfoById(string weldJointId) { var responeData = new Model.ResponeData(); try { responeData.data = APIPipeJointService.getWeldJointInfo(weldJointId); } catch (Exception ex) { responeData.code = 0; responeData.message = ex.Message; } return responeData; } #region 根据焊口标识获取焊口详细信息 /// /// 根据焊口标识获取焊口详细信息 /// /// /// public Model.ResponeData getWeldJointByIdentify(string weldJointIdentify) { var responeData = new Model.ResponeData(); try { responeData.data = APIPipeJointService.getWeldJointByIdentify(weldJointIdentify); } catch (Exception ex) { responeData.code = 0; responeData.message = ex.Message; } return responeData; } /// /// 根据焊口ID获取焊口详细信息 /// /// /// public Model.ResponeData getWeldJointByWeldJointId(string WeldJointId) { var responeData = new Model.ResponeData(); try { responeData.data = APIPipeJointService.GetHJGL_WeldJoint(WeldJointId); } catch (Exception ex) { responeData.code = 0; responeData.message = ex.Message; } return responeData; } #endregion #region 保存管线焊口信息 /// /// 保存管线焊口信息 /// /// 管线焊口项 /// [HttpPost] public Model.ResponeData PostSavePipeWeldJoint([FromBody] Model.WeldJointItem addItem) { var responeData = new Model.ResponeData(); try { APIPipeJointService.SavePipeWeldJoint(addItem); } catch (Exception ex) { responeData.code = 0; responeData.message = ex.Message; } return responeData; } #endregion #region 批量保存管线焊口信息 /// /// 批量保存管线焊口信息 /// /// 管线焊口项 /// [HttpPost] public Model.ResponeData PostSavePipeWeldJointList([FromBody] List addItems) { var responeData = new Model.ResponeData(); try { APIPipeJointService.SavePipeWeldJointList(addItems); } catch (Exception ex) { responeData.code = 0; responeData.message = ex.Message; } return responeData; } #endregion #region 保存预焊接日报 /// /// 保存预焊接日报 /// /// /// [HttpPost] public Model.ResponeData PostSavePreWeldingDaily([FromBody] Model.WeldJointItem addItem) { var responeData = new Model.ResponeData(); try { APIPipeJointService.SavePreWeldingDaily(addItem); } catch (Exception ex) { responeData.code = 0; responeData.message = ex.Message; } return responeData; } #endregion } }