| | |
| | | using System.Web; |
| | | using System.Web.Http; |
| | | using VueWebApi.DLL.BLL; |
| | | using VueWebApi.Models; |
| | | using VueWebApi.Tools; |
| | | |
| | | namespace VueWebApi.Controllers |
| | |
| | | /// <summary> |
| | | /// 设备类型新增 |
| | | /// </summary> |
| | | /// <param name="obj">提交数据对象</param> |
| | | /// <param name="json">提交数据对象</param> |
| | | /// <returns></returns> |
| | | [Route(template: "AddUpdateDeviceType")] |
| | | [HttpPost] |
| | | public HttpResponseMessage AddUpdateDeviceType([FromBody] JObject obj) |
| | | public HttpResponseMessage AddUpdateDeviceType(List<ObjectDataCont> json) |
| | | { |
| | | //string deviceid = obj["id"].ToString(); //设备类型id(主键) |
| | | string devicetypecode = obj["devicetypecode"].ToString(); //设备类型编码 |
| | | string devicetypename = obj["devicetypename"].ToString(); //设备类型名称 |
| | | string devicetypedescipt = obj["devicetypedescipt"].ToString(); //设备类型描述 |
| | | var usercode = HttpContext.Current.Request.Cookies["navTabId"].Value.ToString(); |
| | | mes = DeviceManagerBLL.AddUpdateDeviceType(devicetypecode, devicetypename, devicetypedescipt, usercode); |
| | | var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); |
| | | mes = DeviceManagerBLL.AddUpdateDeviceType(json, username); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | |
| | | /// <summary> |
| | | /// 设备类型删除 |
| | | /// </summary> |
| | | /// <param name="devicetypeid">设备类型ID</param> |
| | | /// <param name="devicetypecode">设备类型编码</param> |
| | | /// <returns></returns> |
| | | [Route(template: "DeleteDeviceType")] |
| | | [HttpPost] |
| | | public HttpResponseMessage DeleteDeviceType(string devicetypeid) |
| | | public HttpResponseMessage DeleteDeviceType(string devicetypecode) |
| | | { |
| | | mes = DeviceManagerBLL.DeleteDeviceType(devicetypeid); |
| | | mes = DeviceManagerBLL.DeleteDeviceType(devicetypecode); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region[设备类型下拉框接口] |
| | | /// <summary> |
| | | /// 设备类型下拉框接口 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [Route(template: "DeviceTypeSelect")] |
| | | [HttpGet] |
| | | public HttpResponseMessage DeviceTypeSelect() |
| | | { |
| | | try |
| | | { |
| | | mes = DeviceManagerBLL.DeviceTypeSelect(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.Message = e.Message; |
| | | } |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[设备组查询] |
| | | /// <summary> |
| | | /// 设备组查询 |
| | | /// </summary> |
| | | /// <param name="page">页码</param> |
| | | /// <param name="rows">每页显示条数</param> |
| | | /// <param name="prop">排序字段</param> |
| | | /// <param name="order">排序规则</param> |
| | | /// <returns></returns> |
| | | [Route(template: "DeviceGroupSearch")] |
| | | [HttpGet] |
| | | public HttpResponseMessage DeviceGroupSearch(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 = DeviceManagerBLL.DeviceGroupSearch(startNum, endNum, prop, order); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[设备组新增] |
| | | /// <summary> |
| | | /// 设备组新增 |
| | | /// </summary> |
| | | /// <param name="json">提交数据对象</param> |
| | | /// <returns></returns> |
| | | [Route(template: "AddUpdateDeviceGroup")] |
| | | [HttpPost] |
| | | public HttpResponseMessage AddUpdateDeviceGroup(List<ObjectDataCont> json) |
| | | { |
| | | var username = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); |
| | | mes = DeviceManagerBLL.AddUpdateDeviceGroup(json, username); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[设备组删除] |
| | | /// <summary> |
| | | /// 设备组删除 |
| | | /// </summary> |
| | | /// <param name="devicegroupcode">设备组编码</param> |
| | | /// <returns></returns> |
| | | [Route(template: "DeleteDeviceGroup")] |
| | | [HttpPost] |
| | | public HttpResponseMessage DeleteDeviceGroup(string devicegroupcode) |
| | | { |
| | | mes = DeviceManagerBLL.DeleteDeviceGroup(devicegroupcode); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region[设备类型查找设备组] |
| | | /// <summary> |
| | | /// 设备类型查找设备组 |
| | | /// </summary> |
| | | /// <param name="eqptypecode">设备类型编码</param> |
| | | /// <returns></returns> |
| | | [Route(template: "DeviceTypeSelectGroup")] |
| | | [HttpGet] |
| | | public HttpResponseMessage DeviceTypeSelectGroup(string eqptypecode) |
| | | { |
| | | try |
| | | { |
| | | mes = DeviceManagerBLL.DeviceTypeSelectGroup(eqptypecode); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.Message = e.Message; |
| | | } |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[所属车间下拉接口] |
| | | /// <summary> |
| | | /// 所属车间下拉接口 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | |
| | | [Route(template: "WorkShopSelect")] |
| | | [HttpGet] |
| | | public HttpResponseMessage WorkShopSelect() |
| | | { |
| | | mes = DeviceManagerBLL.WorkShopSelect(); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[设备清单查询] |
| | | /// <summary> |
| | |
| | | string deviceid = obj["id"].ToString(); //设备清单id(主键) |
| | | string devicecode = obj["devicecode"].ToString(); //设备编码 |
| | | string devicename = obj["devicename"].ToString(); //设备名称 |
| | | string devicetype = obj["devicetype"].ToString(); //设备类型 |
| | | string devicegroup = obj["devicegroup"].ToString(); //设备组 |
| | | string devicetype = obj["devicetypecode"].ToString(); //设备类型编码 |
| | | string devicegroup = obj["devicegroupcode"].ToString(); //设备组编码 |
| | | string importdate = obj["importdate"].ToString(); //投入日期 |
| | | string workshop = obj["workshop"].ToString(); //所属车间 |
| | | string workshop = obj["workshopcode"].ToString(); //所属车间编码 |
| | | string linecode = obj["linecode"].ToString(); //所属产线编码 |
| | | string status = obj["status"].ToString(); //使用状态 |
| | | string ratio = obj["ratio"].ToString(); //稼动率 |
| | | var usercode = HttpContext.Current.Request.Cookies["navTabId"].Value.ToString(); |
| | | var usercode = HttpContext.Current.Request.Cookies["admin"].Value.ToString(); |
| | | string OperType = obj["OperType"].ToString(); //操作类型 |
| | | mes = DeviceManagerBLL.AddUpdateDeviceManger(deviceid, devicecode, devicename, devicetype, devicegroup, importdate, workshop, status, ratio, usercode, OperType); |
| | | mes = DeviceManagerBLL.AddUpdateDeviceManger(deviceid, devicecode, devicename, devicetype, devicegroup, importdate, workshop, linecode, status, ratio, usercode, OperType); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | |
| | | /// <summary> |
| | | /// 设备清单删除 |
| | | /// </summary> |
| | | /// <param name="deviceid">设备ID</param> |
| | | /// <param name="devicecode">设备编码</param> |
| | | /// <returns></returns> |
| | | [Route(template: "DeleteDeviceManger")] |
| | | [HttpPost] |
| | | public HttpResponseMessage DeleteDeviceManger(string deviceid) |
| | | public HttpResponseMessage DeleteDeviceManger(string devicecode) |
| | | { |
| | | mes = DeviceManagerBLL.DeleteDeviceManger(deviceid); |
| | | mes = DeviceManagerBLL.DeleteDeviceManger(devicecode); |
| | | return TJson.toJson(mes); |
| | | } |
| | | #endregion |
| | | |
| | | } |
| | | } |