using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Web; using System.Web.Http; using VueWebApi.DLL.BLL; using VueWebApi.Models; using VueWebApi.Tools; namespace VueWebApi.Controllers { [RoutePrefix(prefix: "api/QualityManagement")] [ControllerGroup("质量管理", "在线接口")] [ChannelActionFilter] public class QualityManagementController : ApiController { //定义全局信息返回变量 ToMessage mes = new ToMessage(); RedisHelper redis = new RedisHelper(); #region[质量管理,缺陷定义查询列表] /// /// 质量管理,缺陷定义查询列表 /// /// 缺陷代码 /// 缺陷名称 /// 缺陷描述 /// 页码 /// 每页显示条数 /// 排序字段 /// 排序规则 /// [Route(template: "DedectSearch")] [HttpGet] public HttpResponseMessage DedectSearch(string defectcode = null, string defectname = null, string defectdescr = null, int page = 0, int rows = 0, string prop = null, string order = null) { int startNum = rows * (page - 1) + 1; //起始记录rowNum int endNum = rows * page; //结束记录 rowNum mes = QualityManagementBLL.DedectSearch(defectcode, defectname, defectdescr, startNum, endNum, prop, order); return TJson.toJson(mes); } #endregion #region[质量管理,缺陷定义新增、编辑提交] /// /// 质量管理,缺陷定义新增、编辑提交 /// /// 提交数据 /// [Route(template: "AddUpdateDedect")] [HttpPost] public HttpResponseMessage AddUpdateDedect([FromBody] JObject obj) { string defectcode = obj["defectcode"].ToString(); //缺陷代码 string defectname = obj["defectname"].ToString(); //缺陷名称 string defectdescr = obj["defectdescr"].ToString(); //缺陷描述 string opertype = obj["OperType"].ToString(); //操作类型 var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //操作人员 mes = QualityManagementBLL.AddUpdateDedect(defectcode, defectname, defectdescr, opertype, username); return TJson.toJson(mes); } #endregion #region[质量管理,缺陷定义删除] /// /// 质量管理,缺陷定义删除 /// /// 缺陷代码 /// [Route(template: "DeleteDedect")] [HttpPost] public HttpResponseMessage DeleteDedect(string defectcode) { mes = QualityManagementBLL.DeleteDedect(defectcode); return TJson.toJson(mes); } #endregion #region[工序检验标准列表查询] /// /// 工序检验标准列表查询 /// /// 标准代码 /// 标准名称 /// 标准描述 /// 页码 /// 每页显示条数 /// 排序字段 /// 排序规格 /// [Route(template: "StepCheckStanedSearch")] [HttpGet] public HttpResponseMessage StepCheckStanedSearch(string stanedcode = null, string stanedname = null, string staneddescr = null, int page = 0, int rows = 0, string prop = null, string order = null) { int startNum = rows * (page - 1) + 1; //起始记录rowNum int endNum = rows * page; //结束记录 rowNum mes = QualityManagementBLL.StepCheckStanedSearch(stanedcode, stanedname, staneddescr, startNum, endNum, prop, order); return TJson.toJson(mes); } #endregion #region[工序检验标准编辑获取数据] /// /// 工序检验标准编辑获取数据 /// /// 工序检验标准编码 /// [Route(template: "EditStepCheckStanedSearch")] [HttpPost] public HttpResponseMessage EditStepCheckStanedSearch(string defectcode) { mes = QualityManagementBLL.EditStepCheckStanedSearch(defectcode); return TJson.toJson(mes); } #endregion #region[工序检验标准新增、编辑获取检验项目下拉列表] /// /// 工序检验标准新增、编辑获取检验项目下拉列表 /// /// [Route(template: "StepCheckItemSelect")] [HttpGet] public HttpResponseMessage StepCheckItemSelect() { mes = QualityManagementBLL.StepCheckItemSelect(); return TJson.toJson(mes); } #endregion #region[工序检验标准删除] /// /// 工序检验标准删除 /// /// 工序检验标准删除 /// [Route(template: "DeleteStepCheckStaned")] [HttpPost] public HttpResponseMessage DeleteStepCheckStaned(string stanedcode) { mes = QualityManagementBLL.DeleteStepCheckStaned(stanedcode); return TJson.toJson(mes); } #endregion #region[工序检验标准新增、编辑提交] /// /// 工序检验标准新增、编辑提交 /// /// 操作类型 /// 提交数据 /// [Route(template: "AddUpdateStepCheckStaned")] [HttpPost] public HttpResponseMessage AddUpdateStepCheckStaned(string opertype, RoutEdit json) { var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //操作人员 mes = QualityManagementBLL.AddUpdateStepCheckStaned(opertype, json, username); return TJson.toJson(mes); } #endregion #region[工序检验项目列表查询] /// /// 工序检验项目列表查询 /// /// 检验项目编码 /// 检验项目名称 /// 检验项目描述 /// 页码 /// 每页显示条数 /// 排序字段 /// 排序规则 /// [Route(template: "StepCheckItemSearch")] [HttpGet] public HttpResponseMessage StepCheckItemSearch(string itemcode = null, string itemname = null, string itemdescr = null, int page = 0, int rows = 0, string prop = null, string order = null) { int startNum = rows * (page - 1) + 1; //起始记录rowNum int endNum = rows * page; //结束记录 rowNum mes = QualityManagementBLL.StepCheckItemSearch(itemcode, itemname, itemdescr, startNum, endNum, prop, order); return TJson.toJson(mes); } #endregion #region[工序检验项目新增、编辑提交] /// /// 工序检验项目新增、编辑提交 /// /// 提交数据 /// [Route(template: "AddUpdateStepCheckItem")] [HttpPost] public HttpResponseMessage AddUpdateStepCheckItem([FromBody] JObject obj) { string checkitemcode = obj["checkitemcode"].ToString(); //工序检验项目代码 string checkitemname = obj["checkitemname"].ToString(); //工序检验项目名称 string checkitemdescr = obj["checkitemdescr"].ToString(); //工序检验项目描述 string opertype = obj["OperType"].ToString(); //操作类型 var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); //操作人员 mes = QualityManagementBLL.AddUpdateStepCheckItem(checkitemcode, checkitemname, checkitemdescr, opertype, username); return TJson.toJson(mes); } #endregion #region[工序检验项目删除] /// /// 工序检验项目删除 /// /// 检验项目代码 /// [Route(template: "DeleteStepCheckItem")] [HttpPost] public HttpResponseMessage DeleteStepCheckItem(string checkitemcode) { mes = QualityManagementBLL.DeleteStepCheckItem(checkitemcode); return TJson.toJson(mes); } #endregion #region[工序检验记录列表查询] /// /// 工序检验记录列表查询 /// /// 工单编号 /// 产品编码 /// 产品名称 /// 产品名称 /// 产品名称 /// 产品名称 /// 检验类型编码 /// 检验结果 /// 页码 /// 每页显示条数 /// 排序字段 /// 排序规则 /// [Route(template: "StepCheckTableSearch")] [HttpGet] public HttpResponseMessage StepCheckTableSearch(string wocode = null, string partcode = null, string partname = null, string partapec = null, string stepname = null,string standname=null, string checktype = null, string checkresult = null, int page = 0, int rows = 0, string prop = null, string order = null) { int startNum = rows * (page - 1) + 1; //起始记录rowNum int endNum = rows * page; //结束记录 rowNum mes = QualityManagementBLL.StepCheckTableSearch(wocode, partcode, partname,partapec,stepname,standname,checktype,checkresult, startNum, endNum, prop, order); return TJson.toJson(mes); } #endregion #region[工序检验记录列表明细查询] /// /// 工序检验记录列表查询 /// /// 主表id /// [Route(template: "StepCheckTableSubSearch")] [HttpGet] public HttpResponseMessage StepCheckTableSubSearch(string id) { mes = QualityManagementBLL.StepCheckTableSubSearch(id); return TJson.toJson(mes); } #endregion #region[工序检验记录导出] /// /// 工序检验记录导出 /// /// 工单编号 /// 产品编码 /// 产品名称 /// 产品名称 /// 产品名称 /// 产品名称 /// 检验类型编码 /// 检验结果 /// 排序字段 /// 排序规则 /// [Route(template: "StepCheckTableOutExcel")] [HttpGet] public HttpResponseMessage StepCheckTableOutExcel(string wocode = null, string partcode = null, string partname = null, string partapec = null, string stepname = null, string standname = null, string checktype = null, string checkresult = null,string prop = null, string order = null) { mes = QualityManagementBLL.StepCheckTableOutExcel(wocode, partcode, partname, partapec, stepname, standname, checktype, checkresult, prop, order); return TJson.toJson(mes); } #endregion } }