| | |
| | | #endregion |
| | | |
| | | #region 校验项目列表 文件上传 |
| | | [Route("Gy_CheckItem/Gy_Process_Excel")] |
| | | [Route("Gy_CheckItem/Gy_CheckItem_Excel")] |
| | | [HttpPost] |
| | | public json Gy_Process_Excel() |
| | | public json Gy_CheckItem_Excel() |
| | | { |
| | | json res = new json(); |
| | | try |
| | |
| | | |
| | | //模板缺少列 但需要从数据库中查询出来显示在页面的字段 |
| | | provisional.Columns.Add("HOrgID", typeof(Int32));//组织ID |
| | | provisional.Columns.Add("HDeptID", typeof(Int32));//部门ID |
| | | provisional.Columns.Add("HQCCheckClassID", typeof(Int32));//检验项目分类ID |
| | | |
| | | //添加数据 |
| | | for (int i = 1; i < ExcelDs.Tables[0].Rows.Count; i++) |
| | |
| | | |
| | | for (int i = 0; i <= provisional.Rows.Count - 1; i++) |
| | | { |
| | | string HNumber = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["代码"].ToString()); |
| | | string HUSEORGID = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["组织代码"].ToString()); |
| | | string HQCCheckClassID = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["检验项目类别代码"].ToString()); |
| | | string HQCCheckClassName = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["检验项目类别名称"].ToString()); |
| | | string HName = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["名称"].ToString()); |
| | | string HCheckItemName = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["检验项目"].ToString()); |
| | | string HCheckItemNumber = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["检验项目代码"].ToString()); |
| | | string HQCCheckClassName = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["检验项目分类"].ToString()); |
| | | string HQCCheckClassNumber = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["检验项目分类代码"].ToString()); |
| | | string HORGNumber = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["组织代码"].ToString()); |
| | | string HORGName = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["组织名称"].ToString()); |
| | | string HHelpCode = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["助记码"]); |
| | | string HRemark = DBUtility.ClsPub.isStrNull(provisional.Rows[i]["备注"].ToString()); |
| | | |
| | | //获取真实行数 |
| | | int line = i + 1; |
| | | |
| | | if (HUSEORGID != "") |
| | | if (HORGNumber != "") |
| | | { |
| | | //查询组织 |
| | | ds = oCN.RunProcReturn("select * from Xt_ORGANIZATIONS where HNumber='" + HUSEORGID + "' and Hname='" + HORGName + "'", "Xt_ORGANIZATIONS"); |
| | | ds = oCN.RunProcReturn("select * from Xt_ORGANIZATIONS where HNumber='" + HORGNumber + "' and Hname='" + HORGName + "'", "Xt_ORGANIZATIONS"); |
| | | |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | |
| | | } |
| | | string HORGid = ds.Tables[0].Rows[0]["HItemID"].ToString(); |
| | | |
| | | //查询检验项目是否存在 |
| | | DataSet checkClass = oCN.RunProcReturn("select * from Gy_QCCheckClass where HNumber = '" + HQCCheckClassID + "' and HName = '" + HQCCheckClassName + "'", "Gy_QCCheckClass"); |
| | | //查询检验项目分类是否存在 |
| | | DataSet checkClass = oCN.RunProcReturn("select * from Gy_QCCheckClass where HNumber = '" + HQCCheckClassNumber + "' and HName = '" + HQCCheckClassName + "'", "Gy_QCCheckClass"); |
| | | if (checkClass.Tables[0].Rows.Count == 0) |
| | | { |
| | | res.code = CodeConstant.FAIL; |
| | |
| | | res.Message = "第" + line + "行,检验项目不存在!"; |
| | | res.data = null; |
| | | return res; |
| | | } |
| | | else |
| | | { |
| | | provisional.Rows[i]["HQCCheckClassID"] = ds.Tables[0].Rows[0]["HItemID"].ToString(); |
| | | } |
| | | } |
| | | else |
| | |
| | | if (!provisional.Columns.Contains("组织代码")) |
| | | error += "没有找到【组织代码】的标题,"; |
| | | |
| | | if(!provisional.Columns.Contains("检验项目类别名称")) |
| | | error += "没有找到【检验项目类别名称】的标题,"; |
| | | if(!provisional.Columns.Contains("检验项目分类代码")) |
| | | error += "没有找到【检验项目分类代码】的标题,"; |
| | | |
| | | if (!provisional.Columns.Contains("组织名称")) |
| | | error += "没有找到【组织名称】的标题,"; |
| | | |
| | | if (!provisional.Columns.Contains("检验项目分类")) |
| | | error += "没有找到【检验项目分类】的标题,"; |
| | | |
| | | if (!provisional.Columns.Contains("检验项目")) |
| | | error += "没有找到【检验项目】的标题,"; |
| | | |
| | | if (!provisional.Columns.Contains("检验项目代码")) |
| | | error += "没有找到【检验项目代码】的标题,"; |
| | | |
| | | if (!provisional.Columns.Contains("助记码")) |
| | | error += "没有找到【助记码】的标题,"; |
| | | |
| | | if (!provisional.Columns.Contains("备注")) |
| | | error += "没有找到【备注】的标题,"; |
| | | return error; |
| | | } |
| | | #endregion |
| | | |
| | | #region 校验项目列表 导入(保存) |
| | | [Route("Gy_CheckItem/Gy_Process_btnSave")] |
| | | [Route("Gy_CheckItem/Gy_CheckItem_btnSave")] |
| | | [HttpPost] |
| | | public object Gy_Group_btnSave([FromBody] JObject sMainSub) |
| | | { |
| | |
| | | string user = sArray[1].ToString(); |
| | | try |
| | | { |
| | | if (!DBUtility.ClsPub.Security_Log("Gy_Group_Edit", 1, false, user)) |
| | | if (!DBUtility.ClsPub.Security_Log("Gy_QCCheckItem_Edit", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | |
| | | int i = 1; |
| | | foreach (Dictionary<string, string> item in list) |
| | | { |
| | | string HNumber = item["代码"].ToString(); |
| | | string HUSEORGID = item["组织代码"].ToString(); |
| | | string HName = item["名称"].ToString(); |
| | | string HORGName = item["组织名称"].ToString(); |
| | | string HNumber = item["检验项目代码"].ToString(); |
| | | string HUSEORGID = item["HOrgID"].ToString(); |
| | | string HName = item["检验项目"].ToString(); |
| | | string HHelpCode = item["助记码"]; |
| | | string HQCCheckClassID = item["检验项目类别代码"]; |
| | | string HQCCheckClassID = item["HQCCheckClassID"]; |
| | | string HRemark = item["备注"].ToString(); |
| | | |
| | | string sShortNumber; |