| | |
| | | List<object> columnNameList = new List<object>(); |
| | | |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | string sql = "Select * from h_v_Gy_GetSampleSchemeListView where 1 = 1 " + sWhere + "Order by hmainid "; |
| | | string sql = "Select * from h_v_Gy_GetSampleSchemeListView where 1 = 1 and HUSEORGID = "+OrganizationID + sWhere + "Order by hmainid "; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Gy_GetSampleSchemeListView"); |
| | | |
| | | //添加列名 |
| | |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | string sql = "exec h_p_Gy_GetQCCheckItemByProject " + CheckProjectID + "," + HBatchQty + "," + HMaterID + ",'" + HBillType + "'"; |
| | | ds = oCN.RunProcReturn(sql, "h_p_Gy_GetQCCheckItemByProject"); |
| | | if (ds == null || ds.Tables[0].Rows.Count <= 0) |
| | | { |
| | | objjson.code = "0"; |
| | | objjson.count = 0; |
| | | objjson.Message = "获取失败" + DBUtility.ClsPub.sErrInfo; |
| | | objjson.data = null; |
| | | return objjson; |
| | | } |
| | | else |
| | | { |
| | | objjson.code = "1"; |
| | | objjson.count = 1; |
| | | objjson.Message = "获取成功!"; |
| | | objjson.data = ds.Tables[0]; |
| | | return objjson; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | objjson.code = "0"; |
| | | objjson.count = 0; |
| | | objjson.Message = "获取失败" + ex.ToString(); |
| | | objjson.data = null; |
| | | return objjson; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据检验方案主内码获取检验项目,前面的会把先获取物料的默认质检方案,APP只根据检验方案ID获取对应检验项目 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [Route("Web/GetCheckItemByCheckProjectID_Sec")] |
| | | [HttpGet] |
| | | public object GetCheckItemByCheckProjectID_Sec(int CheckProjectID, int HBatchQty, int HMaterID, string HBillType) |
| | | { |
| | | //if (CheckProjectID <= 0) |
| | | //{ |
| | | // objjson.code = "0"; |
| | | // objjson.count = 0; |
| | | // objjson.Message = "检验方案未选择"; |
| | | // objjson.data = null; |
| | | // return objjson; |
| | | //} |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | string sql = "exec h_p_Gy_GetQCCheckItemByProject_Sec " + CheckProjectID + "," + HBatchQty + "," + HMaterID + ",'" + HBillType + "'"; |
| | | ds = oCN.RunProcReturn(sql, "h_p_Gy_GetQCCheckItemByProject_Sec"); |
| | | if (ds == null || ds.Tables[0].Rows.Count <= 0) |
| | | { |
| | | objjson.code = "0"; |
| | |
| | | } |
| | | } |
| | | |
| | | #region |
| | | [Route("Web/GetMouldBillsList")] |
| | | [HttpGet] |
| | | public object GetMouldBillsList(string sWhere, string Type, string user) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | string HView = ""; |
| | | switch (Type) |
| | | { |
| | | case "RC": // 模具维修检验单 |
| | | HView = "h_v_Sc_MouldRepairCheckBillList"; |
| | | break; |
| | | case "PG": // 模具维修派工单 |
| | | HView = "h_v_Sc_MouldRepairSendWorkBill"; |
| | | break; |
| | | default: |
| | | objjson.code = "0"; |
| | | objjson.count = 0; |
| | | objjson.Message = "设备模块类型错误!"; |
| | | objjson.data = null; |
| | | return objjson; |
| | | } |
| | | |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | |
| | | ds = oCN.RunProcReturn("select ManagerFlag from gy_czygl where czymc='" + user.Trim() + "'", "gy_czygl"); |
| | | if (!(bool)ds.Tables[0].Rows[0]["ManagerFlag"]) //是否管理员 |
| | | { |
| | | //不是管理员 |
| | | sWhere += " and 制单人 = '" + user + "'"; |
| | | } |
| | | |
| | | |
| | | string sql = string.Format(@"select * from " + HView + " where 1 = 1 " + sWhere + " order by 日期 desc, hmainid desc"); |
| | | ds = oCN.RunProcReturn(sql, HView); |
| | | //添加列名 |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | | { |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | if (ds == null || ds.Tables[0].Rows.Count <= 0) |
| | | { |
| | | objjson.code = "1"; |
| | | objjson.count = 1; |
| | | objjson.Message = "获取失败,查无数据"; |
| | | objjson.data = null; |
| | | objjson.list = columnNameList; |
| | | return objjson; |
| | | } |
| | | else |
| | | { |
| | | objjson.code = "1"; |
| | | objjson.count = 1; |
| | | objjson.Message = "获取成功!"; |
| | | objjson.data = ds.Tables[0]; |
| | | objjson.list = columnNameList; |
| | | return objjson; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | objjson.code = "0"; |
| | | objjson.count = 0; |
| | | objjson.Message = "获取失败" + ex.ToString(); |
| | | objjson.data = null; |
| | | return objjson; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// 查询各类设备单据列表(设备点检,设备维修,设备保养......) |
| | | /// </summary> |
| | |
| | | case "XJ": |
| | | HView = "h_v_Sb_EquipPatrolCheckBillList"; |
| | | break; |
| | | case "PG": // 设备维修派工单 |
| | | HView = "h_v_Sb_EquipRepairSendWorkBillList"; |
| | | break; |
| | | default: |
| | | objjson.code = "0"; |
| | | objjson.count = 0; |
| | |
| | | } |
| | | |
| | | |
| | | string sql = string.Format(@"select * from " + HView + " where 1 = 1 " + sWhere); |
| | | string sql = string.Format(@"select * from " + HView + " where 1 = 1 " + sWhere + " order by 日期 desc, hmainid desc"); |
| | | ds = oCN.RunProcReturn(sql, HView); |
| | | //添加列名 |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 用于连接的健康度检验,只要能访问通这个接口,则表明连接可用 |
| | | [Route("Health")] |
| | | [HttpGet] |
| | | public IHttpActionResult CheckHealth() |
| | | { |
| | | // 返回 200 状态码 确认健康状态 |
| | | return Ok(); |
| | | } |
| | | #endregion |
| | | |
| | | #region 登录用户与设备ClientID 的关系 写入数据库 |
| | | [Route("Web/SetGy_UserClientIdConnection")] |
| | | [HttpPost] |
| | | public object SetGy_UserClientIdConnection([FromBody] JObject msg) |
| | | { |
| | | DataSet ds; |
| | | oCN.BeginTran(); |
| | | try |
| | | { |
| | | LogService.Write($@"exec h_p_SetGy_UserClientIdRelation |
| | | @HUserbm=N'{msg["HUserbm"].ToString()}', |
| | | @HUserName=N'{msg["HUserName"].ToString()}', |
| | | @HClientID=N'{msg["HClientID"].ToString()}', |
| | | @HOnline={msg["HOnline"].ToString()} |
| | | ", "h_p_SetGy_UserClientIdRelation"); |
| | | ds = oCN.RunProcReturn($@"exec h_p_SetGy_UserClientIdRelation |
| | | @HUserbm=N'{msg["HUserbm"].ToString()}', |
| | | @HUserName=N'{msg["HUserName"].ToString()}', |
| | | @HClientID=N'{msg["HClientID"].ToString()}', |
| | | @HOnline={msg["HOnline"].ToString()} |
| | | ", "h_p_SetGy_UserClientIdRelation"); |
| | | |
| | | if(ds.Tables[0].Rows[0]["HStatus"].ToString() == "1") |
| | | { |
| | | oCN.Commit(); |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "保存设备信息成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存设备信息失败!" + ds.Tables[0].Rows[0]["msg"]; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | }catch(Exception e) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存设备信息失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | } |
| | | } |