|  |  | 
 |  |  | using Newtonsoft.Json.Linq; | 
 |  |  | using SQLHelper; | 
 |  |  | using System; | 
 |  |  | using System.Text; | 
 |  |  | using System.Collections.Generic; | 
 |  |  | using System.Data; | 
 |  |  | using System.IO; | 
 |  |  | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 根据时间获取产量汇报单集合 | 
 |  |  |         /// </summary> | 
 |  |  | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 string sErrMsg = ""; | 
 |  |  |                 oSystemParameter.ShowBill(ref sErrMsg); | 
 |  |  |                 DataSet ds = null; | 
 |  |  |                 ClsCN oCnLoc = new ClsCN(); | 
 |  |  |                 DAL.ClsUser oUser = new DAL.ClsUser(); | 
 |  |  | 
 |  |  |                     return objjson; | 
 |  |  |                 } | 
 |  |  |                 //判断用户数是否大于客户账号数 | 
 |  |  |                 DataSet ds1 = oCN.RunProcReturn("Exec h_p_Xt_BaseInfo ", "h_p_Xt_BaseInfo");                | 
 |  |  |                 DataSet ds1 = oCN.RunProcReturn("Exec h_p_Xt_BaseInfo ", "h_p_Xt_BaseInfo"); | 
 |  |  |                 if (DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HBack"]) != "0") | 
 |  |  |                 { | 
 |  |  |                     objjson.code = "0"; | 
 |  |  | 
 |  |  |                 string sql = string.Format(@" select a.* from Gy_UserByOrgRelation a | 
 |  |  |                                               where a.HUserID = '{0}' and a.HOrgID = '{1}'", UserName, HOrgName); | 
 |  |  |                 DataSet _ds = oCnLoc.RunProcReturn(sql, "h_p_Xt_UserRelationOrg_Check"); | 
 |  |  |                 //if (_ds == null || _ds.Tables[0].Rows.Count == 0) | 
 |  |  |                 //{ | 
 |  |  |                 //    objjson.code = "0"; | 
 |  |  |                 //    objjson.count = 0; | 
 |  |  |                 //    objjson.Message = "用户" + UserName + "没有该组织权限"; | 
 |  |  |                 //    objjson.data = null; | 
 |  |  |                 //    return objjson; | 
 |  |  |                 //} | 
 |  |  |  | 
 |  |  |                 if (oSystemParameter.omodel.WMS_CampanyName == "杭州斯莫尔") | 
 |  |  |                 { | 
 |  |  |                     if (_ds == null || _ds.Tables[0].Rows.Count == 0) | 
 |  |  |                     { | 
 |  |  |                         objjson.code = "0"; | 
 |  |  |                         objjson.count = 0; | 
 |  |  |                         objjson.Message = "用户" + UserName + "没有该组织权限"; | 
 |  |  |                         objjson.data = null; | 
 |  |  |                         return objjson; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 objjson.code = "0"; | 
 |  |  |                 objjson.count = 1; | 
 |  |  | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("Web/GetXGPassword")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object GetXGPassword(string UserName, string oldPassword, string PassWord, string Repassword,string HCloudUserName,string HCloudUserPsd) | 
 |  |  |         public object GetXGPassword(string UserName, string oldPassword, string PassWord, string Repassword, string HCloudUserName, string HCloudUserPsd) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 ClsCN oCn = new ClsCN(); | 
 |  |  |                 DataSet oDs = new DataSet(); | 
 |  |  |                 //========== | 
 |  |  |                  | 
 |  |  |                 if(PassWord!=null) | 
 |  |  |  | 
 |  |  |                 if (PassWord != null) | 
 |  |  |                 { | 
 |  |  |                     oDs = oCn.RunProcReturn("select Czmm from  Gy_Czygl where Czybm='" + UserName + "'", "Gy_Czygl"); | 
 |  |  |                     if (PassWord.Trim() != Repassword.Trim()) | 
 |  |  | 
 |  |  |                         objjson.data = null; | 
 |  |  |                         return objjson; ; | 
 |  |  |                     } | 
 |  |  |                     oCn.RunProc("update  Gy_Czygl set Czmm='" + ClsPub.StrToPsd(PassWord.Trim()) + "',HCloudUserName = '" + HCloudUserName+ "',HCloudUserPsd = '" + HCloudUserPsd+ "' where Czybm='" + UserName.Trim() + "'"); | 
 |  |  |                     oCn.RunProc("update  Gy_Czygl set Czmm='" + ClsPub.StrToPsd(PassWord.Trim()) + "',HCloudUserName = '" + HCloudUserName + "',HCloudUserPsd = '" + HCloudUserPsd + "' where Czybm='" + UserName.Trim() + "'"); | 
 |  |  |                     objjson.code = "0"; | 
 |  |  |                     objjson.count = 1; | 
 |  |  |                     objjson.Message = "* 密码修改成功!"; | 
 |  |  |                     objjson.data = null; | 
 |  |  |                     return objjson;  | 
 |  |  |                     return objjson; | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  | 
 |  |  |                 return objjson; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |       | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 获取仓位列表 | 
 |  |  |         /// </summary> | 
 |  |  | 
 |  |  |         public object Gy_EnvironmentTestSchemeBillList_Json(string sWhere) | 
 |  |  |         { | 
 |  |  |             DataSet ds; | 
 |  |  |             | 
 |  |  |  | 
 |  |  |             if (sWhere != "") | 
 |  |  |             { | 
 |  |  |                 sWhere = " and ( 生产部门 like '%" + sWhere + "%' or 工作中心 like '%" + sWhere + "%' or 工序名称 like '%" + sWhere + "%' or 检测项目 like '%" + sWhere + "%' ) "; | 
 |  |  | 
 |  |  |                     } | 
 |  |  |                     //查询数据中是否存在重复代码 | 
 |  |  |  | 
 |  |  |                     ds = oCN.RunProcReturn("select * from  Gy_BadReason where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_BadReason"); | 
 |  |  |                     ds = oCN.RunProcReturn("select * from  Gy_BadReason where  HNumber='" + oItem.HNumber.Trim() + "' and HUSEORGID='" + oItem.HUSEORGID + "'", "Gy_BadReason"); | 
 |  |  |                     if (oItem.HNumber.Trim() == "") | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  | 
 |  |  |                         { | 
 |  |  |                             objJsonResult.code = "0"; | 
 |  |  |                             objJsonResult.count = 0; | 
 |  |  |                             objJsonResult.Message = "保存失败!代码重复!"; | 
 |  |  |                             objJsonResult.Message = "保存失败!相同使用组织下代码不能重复!"; | 
 |  |  |                             objJsonResult.data = 1; | 
 |  |  |                             return objJsonResult; | 
 |  |  |                         } | 
 |  |  | 
 |  |  |                                 return objJsonResult; | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                         if (ds.Tables[0].Rows.Count > 1) | 
 |  |  |                         { | 
 |  |  |                             objJsonResult.code = "0"; | 
 |  |  |                             objJsonResult.count = 0; | 
 |  |  |                             objJsonResult.Message = "保存失败!相同使用组织下代码不能重复!"; | 
 |  |  |                             objJsonResult.data = 1; | 
 |  |  |                             return objJsonResult; | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                     //已审核的不允许保存 | 
 |  |  |                     if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "单据已审核!不能进行保存!"; | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                     //得到短代码 | 
 |  |  |                     string sShortNumber; | 
 |  |  | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 1; | 
 |  |  |                     objJsonResult.Message = "保存成功!";; | 
 |  |  |                     objJsonResult.Message = "保存成功!"; ; | 
 |  |  |                     objJsonResult.data = 1; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; ; | 
 |  |  |                 } | 
 |  |  |                 //var HStopflag = Convert.ToBoolean(ds.Tables[0].Rows[0]["HStopflag"]); | 
 |  |  |                 //if (HStopflag) | 
 |  |  |                 //{ | 
 |  |  |                 //    oCN.RollBack();//回滚事务 | 
 |  |  |                 //    objJsonResult.code = "0"; | 
 |  |  |                 //    objJsonResult.count = 0; | 
 |  |  |                 //    objJsonResult.Message = "数据已删除无法再次删除!"; | 
 |  |  |                 //    objJsonResult.data = null; | 
 |  |  |                 //    return objJsonResult; | 
 |  |  |                 //} | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                 if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "单据已审核!不能进行删除!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "") | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "单据已禁用!不能进行删除!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 //删除前控制=========================================       | 
 |  |  |                 string sql1 = "exec h_p_Gy_BadReason_BeforeDelCtrl " + HItemID + ",'" + user + "'"; | 
 |  |  |                 ds = oCN.RunProcReturn(sql1, "h_p_Gy_BadReason_BeforeDelCtrl"); | 
 |  |  | 
 |  |  |                 } | 
 |  |  |                 //==================================================================================  | 
 |  |  |  | 
 |  |  |                 | 
 |  |  |  | 
 |  |  |                 oCN.Commit();//提交事务 | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  | 
 |  |  |  | 
 |  |  |                     if (ds.Tables[0].Rows.Count == 0) | 
 |  |  |                     { | 
 |  |  |                         oCN.RunProc("Insert into "  + "Gy_BadReason " + | 
 |  |  |                         oCN.RunProc("Insert into " + "Gy_BadReason " + | 
 |  |  |                         " (HNumber,HName,HHelpCode,HShortNumber,HParentID" + | 
 |  |  |                         ",HDeptID,HProcID" + | 
 |  |  |                         ",HLevel,HEndFlag,HStopflag,HRemark,HBadTypeID) " + | 
 |  |  | 
 |  |  |                     } | 
 |  |  |                     else | 
 |  |  |                     { | 
 |  |  |                         oCN.RunProc("Update Gy_BadReason"+ " set " + | 
 |  |  |                         oCN.RunProc("Update Gy_BadReason" + " set " + | 
 |  |  |                         "HName='" + HName + "'" + | 
 |  |  |                         ",HShortNumber='" + sShortNumber + "'" + | 
 |  |  |                         ",HHelpCode='" + HHelpCode + "'" + | 
 |  |  | 
 |  |  |                     } | 
 |  |  |                     //查询数据中是否存在重复代码 | 
 |  |  |  | 
 |  |  |                     ds = oCN.RunProcReturn("select * from  Gy_BadType where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_BadType"); | 
 |  |  |                     ds = oCN.RunProcReturn("select * from  Gy_BadType where  HNumber='" + oItem.HNumber.Trim() + "' and HUSEORGID= '" + oItem.HUSEORGID + "' ", "Gy_BadType"); | 
 |  |  |                     if (oItem.HNumber.Trim() == "") | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  | 
 |  |  |                         { | 
 |  |  |                             objJsonResult.code = "0"; | 
 |  |  |                             objJsonResult.count = 0; | 
 |  |  |                             objJsonResult.Message = "保存失败!代码重复!"; | 
 |  |  |                             objJsonResult.Message = "保存失败!相同使用组织下代码不能重复!"; | 
 |  |  |                             objJsonResult.data = 1; | 
 |  |  |                             return objJsonResult; | 
 |  |  |                         } | 
 |  |  | 
 |  |  |                                 return objJsonResult; | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                         if (ds.Tables[0].Rows.Count > 1) | 
 |  |  |                         { | 
 |  |  |                             objJsonResult.code = "0"; | 
 |  |  |                             objJsonResult.count = 0; | 
 |  |  |                             objJsonResult.Message = "保存失败!相同使用组织下代码不能重复!"; | 
 |  |  |                             objJsonResult.data = 1; | 
 |  |  |                             return objJsonResult; | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |                     //已审核的不允许保存 | 
 |  |  |                     if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "单据已审核!不能进行保存!"; | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |                     //得到短代码 | 
 |  |  |                     string sShortNumber; | 
 |  |  |                     sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim()); | 
 |  |  | 
 |  |  |         public object DeltetGy_BadType(string HItemID, string user) | 
 |  |  |         { | 
 |  |  |             DataSet ds; | 
 |  |  |             //string ModRightNameCheck = "Sc_ProcessReport_check"; | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 //删除权限 | 
 |  |  | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; ; | 
 |  |  |                 } | 
 |  |  |                 //var HStopflag = Convert.ToBoolean(ds.Tables[0].Rows[0]["HStopflag"]); | 
 |  |  |                 //if (HStopflag) | 
 |  |  |                 //{ | 
 |  |  |                 //    oCN.RollBack();//回滚事务 | 
 |  |  |                 //    objJsonResult.code = "0"; | 
 |  |  |                 //    objJsonResult.count = 0; | 
 |  |  |                 //    objJsonResult.Message = "数据已删除无法再次删除!"; | 
 |  |  |                 //    objJsonResult.data = null; | 
 |  |  |                 //    return objJsonResult; | 
 |  |  |                 //} | 
 |  |  |  | 
 |  |  |                 if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "单据已审核!不能进行删除!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "") | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "单据已禁用!不能进行删除!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 //删除前控制=========================================       | 
 |  |  |                 string sql1 = "exec h_p_Gy_BadType_BeforeDelCtrl " + HItemID + ",'" + user + "'"; | 
 |  |  |                 ds = oCN.RunProcReturn(sql1, "h_p_Gy_BadType_BeforeDelCtrl"); | 
 |  |  | 
 |  |  |                 } | 
 |  |  |                 //==================================================================================  | 
 |  |  |  | 
 |  |  |                | 
 |  |  |  | 
 |  |  |                 oCN.Commit();//提交事务 | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  | 
 |  |  |                         { | 
 |  |  |                             tb2.Rows[i]["HOrgID"] = ds.Tables[0].Rows[0]["HItemID"].ToString(); | 
 |  |  |                         } | 
 |  |  |                         if(HGroupNumber != "") | 
 |  |  |                         if (HGroupNumber != "") | 
 |  |  |                         { | 
 |  |  |                             //查询班组 | 
 |  |  |                             ds = oCN.RunProcReturn("select * from Gy_Group where  HNumber='" + HGroupNumber + "' and Hname='" + HGroupName + "'", "Gy_Group"); | 
 |  |  | 
 |  |  |  | 
 |  |  |                     if (ds.Tables[0].Rows.Count == 0) | 
 |  |  |                     { | 
 |  |  |                             oCN.RunProc("Insert into Gy_BadType" + " " + | 
 |  |  |                         " (HNumber,HName,HHelpCode,HShortNumber,HParentID" + | 
 |  |  |                         ",HGroupID" + | 
 |  |  |                         ",HLevel,HEndFlag,HStopflag,HRemark,HUSEORGID,HCREATEORGID,HUseFlag,HMakeEmp,HMakeTime) " + | 
 |  |  |                         " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + sShortNumber + "'," + 0 + | 
 |  |  |                         "," + HGroupID.ToString() + | 
 |  |  |                         "," + HLevel.ToString() + "," + HEndFlag + "," + 0 + ",'" + HRemark + "'," + HOrgID + "," + HOrgID + ",'" + "未检测" + "','" + user + "',getdate())", ref DBUtility.ClsPub.sExeReturnInfo); | 
 |  |  |                         oCN.RunProc("Insert into Gy_BadType" + " " + | 
 |  |  |                     " (HNumber,HName,HHelpCode,HShortNumber,HParentID" + | 
 |  |  |                     ",HGroupID" + | 
 |  |  |                     ",HLevel,HEndFlag,HStopflag,HRemark,HUSEORGID,HCREATEORGID,HUseFlag,HMakeEmp,HMakeTime) " + | 
 |  |  |                     " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + sShortNumber + "'," + 0 + | 
 |  |  |                     "," + HGroupID.ToString() + | 
 |  |  |                     "," + HLevel.ToString() + "," + HEndFlag + "," + 0 + ",'" + HRemark + "'," + HOrgID + "," + HOrgID + ",'" + "未检测" + "','" + user + "',getdate())", ref DBUtility.ClsPub.sExeReturnInfo); | 
 |  |  |  | 
 |  |  |                     } | 
 |  |  |                     else | 
 |  |  | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |                     //已审核的不允许保存 | 
 |  |  |                     if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "单据已审核!不能进行保存!"; | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |                     //得到短代码 | 
 |  |  |                     string sShortNumber; | 
 |  |  |                     sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim()); | 
 |  |  | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 1; | 
 |  |  |                     objJsonResult.Message = "保存成功!"; | 
 |  |  |                     //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); | 
 |  |  |                     objJsonResult.data = 1; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  | 
 |  |  |                     } | 
 |  |  |                     //查询数据中是否存在重复代码 | 
 |  |  |  | 
 |  |  |                     ds = oCN.RunProcReturn("select * from  Gy_BadResult where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_BadResult"); | 
 |  |  |                     ds = oCN.RunProcReturn("select * from  Gy_BadResult where   HNumber='" + oItem.HNumber.Trim() + "' and HUSEORGID= '" + oItem.HUSEORGID + "'  ", "Gy_BadResult"); | 
 |  |  |                     if (oItem.HNumber.Trim() == "") | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  | 
 |  |  |                         objJsonResult.data = 1; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |                     //新增时判断 | 
 |  |  |                     if (oItem.HItemID == 0) | 
 |  |  |                     { | 
 |  |  | 
 |  |  |                         { | 
 |  |  |                             objJsonResult.code = "0"; | 
 |  |  |                             objJsonResult.count = 0; | 
 |  |  |                             objJsonResult.Message = "保存失败!代码重复!"; | 
 |  |  |                             objJsonResult.Message = "保存失败!相同使用组织下代码不能重复!"; | 
 |  |  |                             objJsonResult.data = 1; | 
 |  |  |                             return objJsonResult; | 
 |  |  |                         } | 
 |  |  | 
 |  |  |                                 return objJsonResult; | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                         if (ds.Tables[0].Rows.Count > 1) | 
 |  |  |                         { | 
 |  |  |                             objJsonResult.code = "0"; | 
 |  |  |                             objJsonResult.count = 0; | 
 |  |  |                             objJsonResult.Message = "保存失败!相同使用组织下代码不能重复!"; | 
 |  |  |                             objJsonResult.data = 1; | 
 |  |  |                             return objJsonResult; | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |                     //已审核的不允许保存 | 
 |  |  |                     if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "单据已审核!不能进行保存!"; | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |                     //得到短代码 | 
 |  |  |                     string sShortNumber; | 
 |  |  |                     sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim()); | 
 |  |  | 
 |  |  |                 //保存完毕后处理 | 
 |  |  |                 bool bResult; | 
 |  |  |                 if (oBill.oModel.HItemID == 0) | 
 |  |  |                 {                     | 
 |  |  |                 { | 
 |  |  |                     bResult = oBill.AddNew(ref DBUtility.ClsPub.sExeReturnInfo); | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 1; | 
 |  |  |                     objJsonResult.Message = "保存成功!"; | 
 |  |  |                     //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); | 
 |  |  |                     objJsonResult.data = 1; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; ; | 
 |  |  |                 } | 
 |  |  |                 //var HStopflag = Convert.ToBoolean(ds.Tables[0].Rows[0]["HStopflag"]); | 
 |  |  |                 //if (HStopflag) | 
 |  |  |                 //{ | 
 |  |  |                 //    oCN.RollBack();//回滚事务 | 
 |  |  |                 //    objJsonResult.code = "0"; | 
 |  |  |                 //    objJsonResult.count = 0; | 
 |  |  |                 //    objJsonResult.Message = "数据已删除无法再次删除!"; | 
 |  |  |                 //    objJsonResult.data = null; | 
 |  |  |                 //    return objJsonResult; | 
 |  |  |                 //} | 
 |  |  |  | 
 |  |  |                 if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "单据已审核!不能进行删除!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "") | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "单据已禁用!不能进行删除!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 //删除前控制=========================================       | 
 |  |  |                 string sql1 = "exec h_p_Gy_BadResult_BeforeDelCtrl " + HItemID + ",'" + user + "'"; | 
 |  |  | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 //==================================================================================  | 
 |  |  |                 | 
 |  |  |  | 
 |  |  |                 oCN.Commit();//提交事务 | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  | 
 |  |  |  | 
 |  |  |                     if (ds.Tables[0].Rows.Count == 0) | 
 |  |  |                     { | 
 |  |  |                         oCN.RunProc("Insert into Gy_BadResult"  + | 
 |  |  |                         oCN.RunProc("Insert into Gy_BadResult" + | 
 |  |  |                         " (HNumber,HName,HHelpCode,HShortNumber,HParentID" + | 
 |  |  |                         ",HLevel,HEndFlag,HStopflag,HRemark,HMakeTime,HUSEORGID,HUseFlag,HMakeEmp,HISsystemSet,HCREATEORGID,HERPItemID) " + | 
 |  |  |                         " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + sShortNumber + "'," + 0 + | 
 |  |  | 
 |  |  |                     } | 
 |  |  |                     //查询数据中是否存在重复代码 | 
 |  |  |  | 
 |  |  |                     ds = oCN.RunProcReturn("select * from  Gy_InspectValue where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_InspectValue"); | 
 |  |  |                     ds = oCN.RunProcReturn("select * from  Gy_InspectValue where  HNumber='" + oItem.HNumber.Trim() + "' and HUSEORGID='" + oItem.HUSEORGID + "'", "Gy_InspectValue"); | 
 |  |  |                     if (oItem.HNumber.Trim() == "") | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  | 
 |  |  |                         { | 
 |  |  |                             objJsonResult.code = "0"; | 
 |  |  |                             objJsonResult.count = 0; | 
 |  |  |                             objJsonResult.Message = "保存失败!代码重复!"; | 
 |  |  |                             objJsonResult.Message = "保存失败!相同使用组织下代码不能重复!"; | 
 |  |  |                             objJsonResult.data = 1; | 
 |  |  |                             return objJsonResult; | 
 |  |  |                         } | 
 |  |  | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                     if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "保存失败!已审核不允许修改!"; | 
 |  |  |                         objJsonResult.data = 1; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                     //得到短代码 | 
 |  |  |                     string sShortNumber; | 
 |  |  |                     sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim()); | 
 |  |  | 
 |  |  |                 string sExeReturnInfo = ""; | 
 |  |  |                 if (oBill.oModel.HItemID == 0) | 
 |  |  |                 { | 
 |  |  |                     // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); | 
 |  |  |                     bResult = oBill.AddNew(ref sExeReturnInfo); | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 1; | 
 |  |  |                     objJsonResult.Message = "保存成功!"; | 
 |  |  |                     //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); | 
 |  |  |                     objJsonResult.data = 1; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; ; | 
 |  |  |                 } | 
 |  |  |                 //var HStopflag = Convert.ToBoolean(ds.Tables[0].Rows[0]["HStopflag"]); | 
 |  |  |                 //if (HStopflag) | 
 |  |  |                 //{ | 
 |  |  |                 //    oCN.RollBack();//回滚事务 | 
 |  |  |                 //    objJsonResult.code = "0"; | 
 |  |  |                 //    objJsonResult.count = 0; | 
 |  |  |                 //    objJsonResult.Message = "数据已删除无法再次删除!"; | 
 |  |  |                 //    objJsonResult.data = null; | 
 |  |  |                 //    return objJsonResult; | 
 |  |  |                 //} | 
 |  |  |                 if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "基础资料已审核!不能进行删除!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "") | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "基础资料已禁用!不能进行删除!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                 //删除前控制========================================= | 
 |  |  | 
 |  |  |                     } | 
 |  |  |                     //查询数据中是否存在重复代码 | 
 |  |  |  | 
 |  |  |                     ds = oCN.RunProcReturn("select * from  Gy_InspectMethod where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_InspectMethod"); | 
 |  |  |                     ds = oCN.RunProcReturn("select * from  Gy_InspectMethod where  HNumber='" + oItem.HNumber.Trim() + "' and HUSEORGID='" + oItem.HUSEORGID + "'", "Gy_InspectMethod"); | 
 |  |  |                     if (oItem.HNumber.Trim() == "") | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  | 
 |  |  |                         { | 
 |  |  |                             objJsonResult.code = "0"; | 
 |  |  |                             objJsonResult.count = 0; | 
 |  |  |                             objJsonResult.Message = "保存失败!代码重复!"; | 
 |  |  |                             objJsonResult.Message = "保存失败!相同使用组织下代码不能重复!"; | 
 |  |  |                             objJsonResult.data = 1; | 
 |  |  |                             return objJsonResult; | 
 |  |  |                         } | 
 |  |  | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                     if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "保存失败!已审核不允许修改!"; | 
 |  |  |                         objJsonResult.data = 1; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                     //得到短代码 | 
 |  |  |                     string sShortNumber; | 
 |  |  |                     sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim()); | 
 |  |  | 
 |  |  |                 bool bResult; | 
 |  |  |                 if (oBill.oModel.HItemID == 0) | 
 |  |  |                 { | 
 |  |  |                     // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); | 
 |  |  |                     bResult = oBill.AddNew(); | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 1; | 
 |  |  |                     objJsonResult.Message = "保存成功!"; | 
 |  |  |                     //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); | 
 |  |  |                     objJsonResult.data = 1; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; ; | 
 |  |  |                 } | 
 |  |  |                 //var HStopflag = Convert.ToBoolean(ds.Tables[0].Rows[0]["HStopflag"]); | 
 |  |  |                 //if (HStopflag) | 
 |  |  |                 //{ | 
 |  |  |                 //    oCN.RollBack();//回滚事务 | 
 |  |  |                 //    objJsonResult.code = "0"; | 
 |  |  |                 //    objJsonResult.count = 0; | 
 |  |  |                 //    objJsonResult.Message = "数据已删除无法再次删除!"; | 
 |  |  |                 //    objJsonResult.data = null; | 
 |  |  |                 //    return objJsonResult; | 
 |  |  |                 //} | 
 |  |  |                 if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "基础资料已审核!不能进行删除!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "") | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "基础资料已禁用!不能进行删除!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 oCN.RunProc("delete Gy_InspectMethod where HItemID=" + HItemID); | 
 |  |  |                 oCN.Commit();//提交事务 | 
 |  |  | 
 |  |  |                     } | 
 |  |  |                     //查询数据中是否存在重复代码 | 
 |  |  |  | 
 |  |  |                     ds = oCN.RunProcReturn("select * from  Gy_QualityStd where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_QualityStd"); | 
 |  |  |                     ds = oCN.RunProcReturn("select * from  Gy_QualityStd where  HNumber='" + oItem.HNumber.Trim() + "' and HUSEORGID='" + oItem.HUSEORGID + "'", "Gy_QualityStd"); | 
 |  |  |                     if (oItem.HNumber.Trim() == "") | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  | 
 |  |  |                         { | 
 |  |  |                             objJsonResult.code = "0"; | 
 |  |  |                             objJsonResult.count = 0; | 
 |  |  |                             objJsonResult.Message = "保存失败!代码重复!"; | 
 |  |  |                             objJsonResult.Message = "保存失败!相同组织下代码不能重复!"; | 
 |  |  |                             objJsonResult.data = 1; | 
 |  |  |                             return objJsonResult; | 
 |  |  |                         } | 
 |  |  | 
 |  |  |                                 return objJsonResult; | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |                     //已审核不允许保存 | 
 |  |  |                     if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "保存失败!已审核不允许修改!"; | 
 |  |  |                         objJsonResult.data = 1; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                     //得到短代码 | 
 |  |  |                     string sShortNumber; | 
 |  |  | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; ; | 
 |  |  |                 } | 
 |  |  |                 //var HStopflag = Convert.ToBoolean(ds.Tables[0].Rows[0]["HStopflag"]); | 
 |  |  |                 //if (HStopflag) | 
 |  |  |                 //{ | 
 |  |  |                 //    oCN.RollBack();//回滚事务 | 
 |  |  |                 //    objJsonResult.code = "0"; | 
 |  |  |                 //    objJsonResult.count = 0; | 
 |  |  |                 //    objJsonResult.Message = "数据已删除无法再次删除!"; | 
 |  |  |                 //    objJsonResult.data = null; | 
 |  |  |                 //    return objJsonResult; | 
 |  |  |                 //} | 
 |  |  |                 if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "基础资料已审核!不能进行删除!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "") | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "基础资料已禁用!不能进行删除!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 oCN.RunProc("delete Gy_QualityStd where HItemID=" + HItemID); | 
 |  |  |                 oCN.Commit();//提交事务 | 
 |  |  | 
 |  |  |                     } | 
 |  |  |                     //查询数据中是否存在重复代码 | 
 |  |  |  | 
 |  |  |                     ds = oCN.RunProcReturn("select * from  Gy_InspectInstruMent where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_InspectInstruMent"); | 
 |  |  |                     ds = oCN.RunProcReturn("select * from  Gy_InspectInstruMent where  HNumber='" + oItem.HNumber.Trim() + "' and HUSEORGID='" + oItem.HUSEORGID + "'", "Gy_InspectInstruMent"); | 
 |  |  |                     if (oItem.HNumber.Trim() == "") | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  | 
 |  |  |                         { | 
 |  |  |                             objJsonResult.code = "0"; | 
 |  |  |                             objJsonResult.count = 0; | 
 |  |  |                             objJsonResult.Message = "保存失败!代码重复!"; | 
 |  |  |                             objJsonResult.Message = "保存失败!相同使用组织下代码不能重复!"; | 
 |  |  |                             objJsonResult.data = 1; | 
 |  |  |                             return objJsonResult; | 
 |  |  |                         } | 
 |  |  | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |                     if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "保存失败!已审核不允许修改!"; | 
 |  |  |                         objJsonResult.data = 1; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |                     //得到短代码 | 
 |  |  |                     string sShortNumber; | 
 |  |  |                     sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim()); | 
 |  |  | 
 |  |  |                 string sExeReturnInfo = ""; | 
 |  |  |                 if (oBill.oModel.HItemID == 0) | 
 |  |  |                 { | 
 |  |  |                     // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); | 
 |  |  |                     bResult = oBill.AddNew(ref sExeReturnInfo); | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 1; | 
 |  |  |                     objJsonResult.Message = "保存成功!"; | 
 |  |  |                     //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); | 
 |  |  |                     objJsonResult.data = 1; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; ; | 
 |  |  |                 } | 
 |  |  |                 //var HStopflag = Convert.ToBoolean(ds.Tables[0].Rows[0]["HStopflag"]); | 
 |  |  |                 //if (HStopflag) | 
 |  |  |                 //{ | 
 |  |  |                 //    oCN.RollBack();//回滚事务 | 
 |  |  |                 //    objJsonResult.code = "0"; | 
 |  |  |                 //    objJsonResult.count = 0; | 
 |  |  |                 //    objJsonResult.Message = "数据已删除无法再次删除!"; | 
 |  |  |                 //    objJsonResult.data = null; | 
 |  |  |                 //    return objJsonResult; | 
 |  |  |                 //} | 
 |  |  |                 if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "基础资料已审核!不能进行删除!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "") | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "基础资料已禁用!不能进行删除!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 //删除前控制========================================= | 
 |  |  |                 ds = oCN.RunProcReturn("Exec h_p_Gy_InspectInstruMent_BeforeDelCtrl " + HItemID + ",'" + User + "'", "h_p_Gy_InspectInstruMent_BeforeDelCtrl"); | 
 |  |  | 
 |  |  |                     } | 
 |  |  |                     //查询数据中是否存在重复代码 | 
 |  |  |  | 
 |  |  |                     ds = oCN.RunProcReturn("select * from  Gy_InspectBasis where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_InspectBasis"); | 
 |  |  |                     ds = oCN.RunProcReturn("select * from  Gy_InspectBasis where  HNumber='" + oItem.HNumber.Trim() + "' and HUSEORGID='" + oItem.HUSEORGID + "'", "Gy_InspectBasis"); | 
 |  |  |                     if (oItem.HNumber.Trim() == "") | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  | 
 |  |  |                         { | 
 |  |  |                             objJsonResult.code = "0"; | 
 |  |  |                             objJsonResult.count = 0; | 
 |  |  |                             objJsonResult.Message = "保存失败!代码重复!"; | 
 |  |  |                             objJsonResult.Message = "保存失败!相同组织下代码不能重复!"; | 
 |  |  |                             objJsonResult.data = 1; | 
 |  |  |                             return objJsonResult; | 
 |  |  |                         } | 
 |  |  | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                     if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "保存失败!已审核不允许修改!"; | 
 |  |  |                         objJsonResult.data = 1; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                     //得到短代码 | 
 |  |  |                     string sShortNumber; | 
 |  |  |                     sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim()); | 
 |  |  | 
 |  |  |                 bool bResult; | 
 |  |  |                 if (oBill.oModel.HItemID == 0) | 
 |  |  |                 { | 
 |  |  |                     // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); | 
 |  |  |  | 
 |  |  |                     bResult = oBill.AddNew(); | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 1; | 
 |  |  |                     objJsonResult.Message = "保存成功!"; | 
 |  |  |                     //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); | 
 |  |  |                     objJsonResult.data = 1; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; ; | 
 |  |  |                 } | 
 |  |  |                 //var HStopflag = Convert.ToBoolean(ds.Tables[0].Rows[0]["HStopflag"]); | 
 |  |  |                 //if (HStopflag) | 
 |  |  |                 //{ | 
 |  |  |                 //    oCN.RollBack();//回滚事务 | 
 |  |  |                 //    objJsonResult.code = "0"; | 
 |  |  |                 //    objJsonResult.count = 0; | 
 |  |  |                 //    objJsonResult.Message = "数据已删除无法再次删除!"; | 
 |  |  |                 //    objJsonResult.data = null; | 
 |  |  |                 //    return objJsonResult; | 
 |  |  |                 //} | 
 |  |  |                 if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "基础资料已审核!不能进行删除!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "") | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "基础资料已禁用!不能进行删除!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 oCN.RunProc("delete Gy_InspectBasis where HItemID=" + HItemID); | 
 |  |  |                 oCN.Commit();//提交事务 | 
 |  |  | 
 |  |  |                     } | 
 |  |  |                     else//编辑时判断 | 
 |  |  |                     { | 
 |  |  |                         //已审核不允许修改 | 
 |  |  |                         DataSet dss; | 
 |  |  |                         dss = oCN.RunProcReturn("select * from Gy_PostSkill where HItemID=" + oItem.HItemID, "Gy_Group"); | 
 |  |  |                         //判断是否可编辑 | 
 |  |  |                         if (dss.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") | 
 |  |  |                         { | 
 |  |  |                             objJsonResult.code = "0"; | 
 |  |  |                             objJsonResult.count = 0; | 
 |  |  |                             objJsonResult.Message = "此单据状态已经审核,不允许修改!"; | 
 |  |  |                             objJsonResult.data = null; | 
 |  |  |                             return objJsonResult; | 
 |  |  |                         } | 
 |  |  |                         //检查父级是否存在 | 
 |  |  |                         string sParent; | 
 |  |  |                         sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim()); | 
 |  |  | 
 |  |  |         [HttpGet] | 
 |  |  |         public object DeltetGy_PostSkill(string HItemID, string user) | 
 |  |  |         { | 
 |  |  |             DataSet ds;            | 
 |  |  |             DataSet ds; | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 //删除权限 | 
 |  |  | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 //==================================================================================  | 
 |  |  |                  | 
 |  |  |  | 
 |  |  |                 oCN.Commit();//提交事务 | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  | 
 |  |  |                         } | 
 |  |  |                         string HORGid = ds.Tables[0].Rows[0]["HItemID"].ToString(); | 
 |  |  |                         //查询岗位 | 
 |  |  |                         ds = oCN.RunProcReturn("select * from Gy_Post where  HNumber='" + HPostNumber + "' and Hname='" + HPostName + "' and HUSEORGID = "+ HORGid, "Gy_Post"); | 
 |  |  |                         ds = oCN.RunProcReturn("select * from Gy_Post where  HNumber='" + HPostNumber + "' and Hname='" + HPostName + "' and HUSEORGID = " + HORGid, "Gy_Post"); | 
 |  |  |  | 
 |  |  |                         if (ds.Tables[0].Rows.Count == 0) | 
 |  |  |                         { | 
 |  |  | 
 |  |  |                     } | 
 |  |  |                     else//编辑时判断 | 
 |  |  |                     { | 
 |  |  |                         //已审核不允许修改 | 
 |  |  |                         DataSet dss; | 
 |  |  |                         dss = oCN.RunProcReturn("select * from Gy_Post where HItemID=" + oItem.HItemID, "Gy_Post"); | 
 |  |  |                         //判断是否可编辑 | 
 |  |  |                         if (dss.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") | 
 |  |  |                         { | 
 |  |  |                             objJsonResult.code = "0"; | 
 |  |  |                             objJsonResult.count = 0; | 
 |  |  |                             objJsonResult.Message = "此单据状态已经审核,不允许修改!"; | 
 |  |  |                             objJsonResult.data = null; | 
 |  |  |                             return objJsonResult; | 
 |  |  |                         } | 
 |  |  |                         //检查父级是否存在 | 
 |  |  |                         string sParent; | 
 |  |  |                         sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim()); | 
 |  |  | 
 |  |  |                 } | 
 |  |  |                 //==================================================================================  | 
 |  |  |  | 
 |  |  |                 | 
 |  |  |  | 
 |  |  |                 oCN.Commit();//提交事务 | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  | 
 |  |  |  | 
 |  |  |                     if (ds.Tables[0].Rows.Count == 0) | 
 |  |  |                     { | 
 |  |  |                             oCN.RunProc("Insert into "  + "Gy_SupType " + | 
 |  |  |                         " (HNumber,HName,HHelpCode,HShortNumber,HParentID" + | 
 |  |  |                         ",HLevel,HEndFlag,HStopflag,HRemark,HMakeTime,HUSEORGID,HUseFlag,HMakeEmp,HCREATEORGID) " + | 
 |  |  |                         " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + sShortNumber + "'," + 0 + | 
 |  |  |                         "," + HLevel.ToString() + "," + HEndFlag + "," + 0 + ",'" + HRemark + "','" + DateTime.Now + "','" + HOrgID + "','" + "未检测" + "','" + user + "','" + HOrgID + "')", ref DBUtility.ClsPub.sExeReturnInfo); | 
 |  |  |                         oCN.RunProc("Insert into " + "Gy_SupType " + | 
 |  |  |                     " (HNumber,HName,HHelpCode,HShortNumber,HParentID" + | 
 |  |  |                     ",HLevel,HEndFlag,HStopflag,HRemark,HMakeTime,HUSEORGID,HUseFlag,HMakeEmp,HCREATEORGID) " + | 
 |  |  |                     " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + sShortNumber + "'," + 0 + | 
 |  |  |                     "," + HLevel.ToString() + "," + HEndFlag + "," + 0 + ",'" + HRemark + "','" + DateTime.Now + "','" + HOrgID + "','" + "未检测" + "','" + user + "','" + HOrgID + "')", ref DBUtility.ClsPub.sExeReturnInfo); | 
 |  |  |                     } | 
 |  |  |                     else | 
 |  |  |                     { | 
 |  |  | 
 |  |  |                 } | 
 |  |  |                 //==================================================================================  | 
 |  |  |  | 
 |  |  |                | 
 |  |  |  | 
 |  |  |                 oCN.Commit();//提交事务 | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  | 
 |  |  |                 //保存完毕后处理 | 
 |  |  |                 bool bResult; | 
 |  |  |                 if (oBill.oModel.HItemID == 0) | 
 |  |  |                 {                    | 
 |  |  |                 { | 
 |  |  |                     bResult = oBill.AddNew(); | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 //==================================================================================  | 
 |  |  |                 | 
 |  |  |  | 
 |  |  |                 oCN.Commit();//提交事务 | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  | 
 |  |  |  | 
 |  |  |                     if (ds.Tables[0].Rows.Count == 0) | 
 |  |  |                     { | 
 |  |  |                         oCN.RunProc("Insert into "  + "Gy_ErrMsgBackType " + | 
 |  |  |                         oCN.RunProc("Insert into " + "Gy_ErrMsgBackType " + | 
 |  |  |                     " (HNumber,HName,HHelpCode,HShortNumber,HParentID" + | 
 |  |  |                     ",HLevel,HEndFlag,HStopflag,HRemark,HMakeTime,HUSEORGID,HUseFlag,HMakeEmp,HCREATEORGID) " + | 
 |  |  |                     " Values('" + HProcessNum + "','" + HProcessName + "','" +  "','" + sShortNumber + "'," + 0 + | 
 |  |  |                     " Values('" + HProcessNum + "','" + HProcessName + "','" + "','" + sShortNumber + "'," + 0 + | 
 |  |  |                     "," + HLevel + "," + HEndFlag + "," + 0 + ",'" + HRemark + "','" + DateTime.Now + "','" + HOrgID + "','" + "未检测" + "','" + user + "','" + HOrgID + "')"); | 
 |  |  |                     } | 
 |  |  |                     else | 
 |  |  | 
 |  |  |                     } | 
 |  |  |                     //查询数据中是否存在重复代码 | 
 |  |  |  | 
 |  |  |                     ds = oCN.RunProcReturn("select * from  Gy_BadPhenomena where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_BadPhenomena"); | 
 |  |  |                     ds = oCN.RunProcReturn("select * from  Gy_BadPhenomena where  HNumber='" + oItem.HNumber.Trim() + "'  and HUSEORGID= '" + oItem.HUSEORGID + "' ", "Gy_BadPhenomena"); | 
 |  |  |                     if (oItem.HNumber.Trim() == "") | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  | 
 |  |  |                         objJsonResult.data = 1; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |                     //新增时判断 | 
 |  |  |                     if (oItem.HItemID == 0) | 
 |  |  |                     { | 
 |  |  | 
 |  |  |                         { | 
 |  |  |                             objJsonResult.code = "0"; | 
 |  |  |                             objJsonResult.count = 0; | 
 |  |  |                             objJsonResult.Message = "保存失败!代码重复!"; | 
 |  |  |                             objJsonResult.Message = "保存失败!相同使用组织下代码不能重复!"; | 
 |  |  |                             objJsonResult.data = 1; | 
 |  |  |                             return objJsonResult; | 
 |  |  |                         } | 
 |  |  | 
 |  |  |                                 return objJsonResult; | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |  | 
 |  |  |                         if (ds.Tables[0].Rows.Count > 1) | 
 |  |  |                         { | 
 |  |  |                             objJsonResult.code = "0"; | 
 |  |  |                             objJsonResult.count = 0; | 
 |  |  |                             objJsonResult.Message = "保存失败!相同使用组织下代码不能重复!"; | 
 |  |  |                             objJsonResult.data = 1; | 
 |  |  |                             return objJsonResult; | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |                     //已审核的不允许保存 | 
 |  |  |                     if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "单据已审核!不能进行保存!"; | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |                     //得到短代码 | 
 |  |  |                     string sShortNumber; | 
 |  |  |                     sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim()); | 
 |  |  | 
 |  |  |                 bool bResult; | 
 |  |  |                 if (oBill.oModel.HItemID == 0) | 
 |  |  |                 { | 
 |  |  |                     // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); | 
 |  |  |                     bResult = oBill.AddNew(ref DBUtility.ClsPub.sExeReturnInfo); | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     bResult = oBill.ModifyByID(oBill.oModel.HItemID,ref DBUtility.ClsPub.sExeReturnInfo); | 
 |  |  |                     bResult = oBill.ModifyByID(oBill.oModel.HItemID, ref DBUtility.ClsPub.sExeReturnInfo); | 
 |  |  |                 } | 
 |  |  |                 if (bResult) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 1; | 
 |  |  |                     objJsonResult.Message = "保存成功!"; | 
 |  |  |                     //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); | 
 |  |  |                     objJsonResult.data = 1; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  | 
 |  |  |                 } | 
 |  |  |                 //==================================================================================  | 
 |  |  |  | 
 |  |  |                | 
 |  |  |  | 
 |  |  |                 oCN.Commit();//提交事务 | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  | 
 |  |  |                     } | 
 |  |  |                     //查询数据中是否存在重复代码 | 
 |  |  |  | 
 |  |  |                     ds = oCN.RunProcReturn("select * from  Gy_PreventErrMould where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_PreventErrMould"); | 
 |  |  |                     //ds = oCN.RunProcReturn("select * from  Gy_PreventErrMould where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_PreventErrMould"); | 
 |  |  |                     if (oItem.HNumber.Trim() == "") | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  | 
 |  |  |                         objJsonResult.data = 1; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                     //查询数据中是否存在重复代码 | 
 |  |  |                     ds = oCN.RunProcReturn("Select HItemID from Gy_PreventErrMould  Where HItemID<>" + oItem.HItemID + " and HNumber='" + oItem.HNumber.Trim() + "' and HUSEORGID=" + oItem.HUSEORGID, "Gy_PreventErrMould"); | 
 |  |  |  | 
 |  |  |                     if (ds.Tables[0].Rows.Count > 0) | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "保存失败!代码重复!"; | 
 |  |  |                         objJsonResult.data = 1; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                     //新增时判断 | 
 |  |  |                     if (oItem.HItemID == 0) | 
 |  |  |                     { | 
 |  |  |                         if (ds == null || ds.Tables[0].Rows.Count == 0) | 
 |  |  |                         { | 
 |  |  |                         //if (ds == null || ds.Tables[0].Rows.Count == 0) | 
 |  |  |                         //{ | 
 |  |  |  | 
 |  |  |                         } | 
 |  |  |                         else | 
 |  |  |                         { | 
 |  |  |                             objJsonResult.code = "0"; | 
 |  |  |                             objJsonResult.count = 0; | 
 |  |  |                             objJsonResult.Message = "保存失败!代码重复!"; | 
 |  |  |                             objJsonResult.data = 1; | 
 |  |  |                             return objJsonResult; | 
 |  |  |                         } | 
 |  |  |                         //} | 
 |  |  |                         //else | 
 |  |  |                         //{ | 
 |  |  |                         //    objJsonResult.code = "0"; | 
 |  |  |                         //    objJsonResult.count = 0; | 
 |  |  |                         //    objJsonResult.Message = "保存失败!代码重复!"; | 
 |  |  |                         //    objJsonResult.data = 1; | 
 |  |  |                         //    return objJsonResult; | 
 |  |  |                         //} | 
 |  |  |                         //检查父级是否存在 | 
 |  |  |                         string sParent; | 
 |  |  |                         sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim()); | 
 |  |  | 
 |  |  |                     } | 
 |  |  |                     else//编辑时判断 | 
 |  |  |                     { | 
 |  |  |                         //已审核不允许修改 | 
 |  |  |                         DataSet dss; | 
 |  |  |                         dss = oCN.RunProcReturn("select * from Gy_PreventErrMould where HItemID=" + oItem.HItemID, "Gy_PreventErrMould"); | 
 |  |  |                         //判断是否可编辑 | 
 |  |  |                         if (dss.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") | 
 |  |  |                         { | 
 |  |  |                             objJsonResult.code = "0"; | 
 |  |  |                             objJsonResult.count = 0; | 
 |  |  |                             objJsonResult.Message = "此单据状态已经审核,不允许修改!"; | 
 |  |  |                             objJsonResult.data = null; | 
 |  |  |                             return objJsonResult; | 
 |  |  |                         } | 
 |  |  |                         //检查父级是否存在 | 
 |  |  |                         string sParent; | 
 |  |  |                         sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim()); | 
 |  |  | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 //==================================================================================  | 
 |  |  |                 | 
 |  |  |  | 
 |  |  |                 oCN.Commit();//提交事务 | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  | 
 |  |  |         [Route("DeltetGy_MaintainLev")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object DeltetGy_MaintainLev(string HItemID, string user) | 
 |  |  |         {             | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 //删除权限 | 
 |  |  | 
 |  |  |                     } | 
 |  |  |                     //查询数据中是否存在重复代码 | 
 |  |  |  | 
 |  |  |                     ds = oCN.RunProcReturn("select * from  Gy_CheckNoteItem where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_CheckNoteItem"); | 
 |  |  |                     //ds = oCN.RunProcReturn("select * from  Gy_CheckNoteItem where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_CheckNoteItem"); | 
 |  |  |                     if (oItem.HNumber.Trim() == "") | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  | 
 |  |  |                         objJsonResult.data = 1; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                     //查询数据中是否存在重复代码 | 
 |  |  |                     ds = oCN.RunProcReturn("Select HItemID from Gy_CheckNoteItem  Where HItemID<>" + oItem.HItemID + " and HNumber='" + oItem.HNumber.Trim() + "' and HUSEORGID=" + oItem.HUSEORGID, "Gy_CheckNoteItem"); | 
 |  |  |  | 
 |  |  |                     if (ds.Tables[0].Rows.Count > 0) | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "保存失败!代码重复!"; | 
 |  |  |                         objJsonResult.data = 1; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                     //新增时判断 | 
 |  |  |                     if (oItem.HItemID == 0) | 
 |  |  |                     { | 
 |  |  |                         if (ds == null || ds.Tables[0].Rows.Count == 0) | 
 |  |  |                         { | 
 |  |  |  | 
 |  |  |                         } | 
 |  |  |                         else | 
 |  |  |                         { | 
 |  |  |                             objJsonResult.code = "0"; | 
 |  |  |                             objJsonResult.count = 0; | 
 |  |  |                             objJsonResult.Message = "保存失败!代码重复!"; | 
 |  |  |                             objJsonResult.data = 1; | 
 |  |  |                             return objJsonResult; | 
 |  |  |                         } | 
 |  |  |                         //检查父级是否存在 | 
 |  |  |                         string sParent; | 
 |  |  |                         sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim()); | 
 |  |  | 
 |  |  |                     } | 
 |  |  |                     else//编辑时判断 | 
 |  |  |                     { | 
 |  |  |                         //已审核不允许修改 | 
 |  |  |                         DataSet dss; | 
 |  |  |                         dss = oCN.RunProcReturn("select * from Gy_CheckNoteItem where HItemID=" + oItem.HItemID, "Gy_CheckNoteItem"); | 
 |  |  |                         //判断是否可编辑 | 
 |  |  |                         if (dss.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") | 
 |  |  |                         { | 
 |  |  |                             objJsonResult.code = "0"; | 
 |  |  |                             objJsonResult.count = 0; | 
 |  |  |                             objJsonResult.Message = "此单据状态已经审核,不允许修改!"; | 
 |  |  |                             objJsonResult.data = null; | 
 |  |  |                             return objJsonResult; | 
 |  |  |                         } | 
 |  |  |                         //检查父级是否存在 | 
 |  |  |                         string sParent; | 
 |  |  |                         sParent = DBUtility.ClsPub.GetParentCode(oItem.HNumber.Trim()); | 
 |  |  | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 //==================================================================================  | 
 |  |  |                 | 
 |  |  |  | 
 |  |  |                 oCN.Commit();//提交事务 | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  | 
 |  |  |  | 
 |  |  |                     if (ds.Tables[0].Rows.Count == 0) | 
 |  |  |                     { | 
 |  |  |                         oCN.RunProc("Insert into " + "Gy_CheckNoteItem" +  | 
 |  |  |                         oCN.RunProc("Insert into " + "Gy_CheckNoteItem" + | 
 |  |  |                     " (HNumber,HName,HHelpCode,HShortNumber,HParentID" + | 
 |  |  |                     ",HLevel,HEndFlag,HStopflag,HRemark,HMakeTime,HUSEORGID,HUseFlag,HMakeEmp,HCREATEORGID,HCheckPostID) " + | 
 |  |  |                     " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "'," + 0 + | 
 |  |  | 
 |  |  |                     else | 
 |  |  |                     { | 
 |  |  |                         oCN.RunProc("Update " + "Gy_CheckNoteItem" + " set " + | 
 |  |  |                          | 
 |  |  |  | 
 |  |  |                         "HName='" + HName + "'" + | 
 |  |  |                         ",HShortNumber='" + HShortNumber + "'" + | 
 |  |  |                         ",HHelpCode='" + HHelpCode + "'" + | 
 |  |  | 
 |  |  |                     // 定义星期几的中文映射关系 | 
 |  |  |                     Dictionary<DayOfWeek, string> chineseDayOfWeek = new Dictionary<DayOfWeek, string> | 
 |  |  |                     { | 
 |  |  |                         { DayOfWeek.Sunday, "星期日" },                       | 
 |  |  |                         { DayOfWeek.Sunday, "星期日" }, | 
 |  |  |                         { DayOfWeek.Saturday, "星期六" } | 
 |  |  |                     }; | 
 |  |  |  | 
 |  |  | 
 |  |  |  | 
 |  |  |             JObject msgObj = JObject.Parse(msg1); | 
 |  |  |             string HYear = msgObj["HYear"].ToString(); | 
 |  |  |             string HNumber1 = msgObj["HDeptNumber"].ToString()+'-' + msgObj["HOrgNumber"].ToString(); | 
 |  |  |             string HName1 = msgObj["HDeptName"].ToString()+'-'+msgObj["HOrgName"].ToString(); | 
 |  |  |             string HNumber1 = msgObj["HDeptNumber"].ToString() + '-' + msgObj["HOrgNumber"].ToString(); | 
 |  |  |             string HName1 = msgObj["HDeptName"].ToString() + '-' + msgObj["HOrgName"].ToString(); | 
 |  |  |             string HOrgID = msgObj["HOrgID"].ToString(); | 
 |  |  |             string HDeptID = msgObj["HDeptID"].ToString();    | 
 |  |  |             string HDeptID = msgObj["HDeptID"].ToString(); | 
 |  |  |             bool HStopflag = bool.Parse(msgObj["HStopflag"].ToString()); | 
 |  |  |             string HRemark= msgObj["HRemark"].ToString(); | 
 |  |  |             string HUSEORGID= msgObj["HUSEORGID"].ToString(); | 
 |  |  |             string HHelpCode= msgObj["HHelpCode"].ToString(); | 
 |  |  |             string HRemark = msgObj["HRemark"].ToString(); | 
 |  |  |             string HUSEORGID = msgObj["HUSEORGID"].ToString(); | 
 |  |  |             string HHelpCode = msgObj["HHelpCode"].ToString(); | 
 |  |  |             string HMakeEmp = msg2; //创建人 | 
 |  |  |             bool Sunday = Convert.ToBoolean(msgObj["Sunday"]); | 
 |  |  |             bool Saturday = Convert.ToBoolean(msgObj["Saturday"]); | 
 |  |  |             List<Tuple<DateTime, string>> sundaysInYear = GetSundaysInYear(Convert.ToInt32(HYear),  Sunday,  Saturday); | 
 |  |  |             List<Tuple<DateTime, string>> sundaysInYear = GetSundaysInYear(Convert.ToInt32(HYear), Sunday, Saturday); | 
 |  |  |  | 
 |  |  |             foreach (var oItem in sundaysInYear) | 
 |  |  |             { | 
 |  |  | 
 |  |  |                 string HNumber = ""; | 
 |  |  |                 string HName = ""; | 
 |  |  |                 HNumber = HNumber1 + '-' + HDate; | 
 |  |  |                | 
 |  |  |                  HName = HName1 + '-' + HDate; | 
 |  |  |  | 
 |  |  |                 HName = HName1 + '-' + HDate; | 
 |  |  |                 //先查看数据库有没有 | 
 |  |  |                 ds = oCN.RunProcReturn("select * from Gy_RestDay where HRestDay='" + HRestDay + "' and HOrgID='" + HOrgID + "' and HDeptID='" + HDeptID + "'", "Gy_RestDay"); | 
 |  |  |                 if (ds.Tables[0].Rows.Count<1) | 
 |  |  |                 if (ds.Tables[0].Rows.Count < 1) | 
 |  |  |                 { | 
 |  |  |                     oCN.RunProc("Insert into Gy_RestDay " + | 
 |  |  |                    " (HNumber,HName,HHelpCode,HShortNumber,HParentID" + | 
 |  |  | 
 |  |  |                    " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "',''," + 0 + | 
 |  |  |                    "," + 0 + "," + 0 + "," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "','" + DateTime.Now + "','" + HUSEORGID + "',' 未检测','" + HMakeEmp + "','" + HUSEORGID + "'" + | 
 |  |  |                    ",'" + HOrgID.ToString() + "','" + HDeptID.ToString() + "','" + HRestDay.ToString() + "','" + HWeekDay.ToString() + "')"); | 
 |  |  |                 }                 | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |             objJsonResult.code = "0"; | 
 |  |  |             objJsonResult.count = 1; | 
 |  |  | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         //获取一年中的周六,周日或者两个同时获取 | 
 |  |  |         public List<Tuple<DateTime, string>> GetSundaysInYear(int HYear, bool Sunday,bool Saturday) | 
 |  |  |         public List<Tuple<DateTime, string>> GetSundaysInYear(int HYear, bool Sunday, bool Saturday) | 
 |  |  |         { | 
 |  |  |             List<Tuple<DateTime, string>> Days = new List<Tuple<DateTime, string>>(); | 
 |  |  |             DateTime startDate = new DateTime(HYear, 1, 1); | 
 |  |  | 
 |  |  |                         { | 
 |  |  |                             weekdayChinese = "星期天"; | 
 |  |  |                             Days.Add(Tuple.Create(startDate, weekdayChinese)); | 
 |  |  |                         }                        | 
 |  |  |                         } | 
 |  |  |                         else if (startDate.DayOfWeek == DayOfWeek.Saturday) | 
 |  |  |                         { | 
 |  |  |                             weekdayChinese = "星期六"; | 
 |  |  |                             Days.Add(Tuple.Create(startDate, weekdayChinese)); | 
 |  |  |                         }                        | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                     startDate = startDate.AddDays(1); | 
 |  |  |                 } | 
 |  |  |             }                      | 
 |  |  |             } | 
 |  |  |             return Days; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  | 
 |  |  |                     } | 
 |  |  |                     //查询数据中是否存在重复代码 | 
 |  |  |  | 
 |  |  |                     ds = oCN.RunProcReturn("select * from  Gy_EnvironmentTestItem where HStopflag=0 and HNumber='" + oItem.HNumber.Trim() + "'", "Gy_EnvironmentTestItem"); | 
 |  |  |                     ds = oCN.RunProcReturn("select * from  Gy_EnvironmentTestItem where  HNumber='" + oItem.HNumber.Trim() + "' and HUSEORGID='" + oItem.HUSEORGID + "'", "Gy_EnvironmentTestItem"); | 
 |  |  |                     if (oItem.HNumber.Trim() == "") | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  | 
 |  |  |                         { | 
 |  |  |                             objJsonResult.code = "0"; | 
 |  |  |                             objJsonResult.count = 0; | 
 |  |  |                             objJsonResult.Message = "保存失败!代码重复!"; | 
 |  |  |                             objJsonResult.Message = "保存失败!相同组织下代码不能重复!"; | 
 |  |  |                             objJsonResult.data = 1; | 
 |  |  |                             return objJsonResult; | 
 |  |  |                         } | 
 |  |  | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                     //已审核不允许修改 | 
 |  |  |                     if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "保存失败!已审核不允许修改!"; | 
 |  |  |                         objJsonResult.data = 1; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |                     //得到短代码 | 
 |  |  |                     string sShortNumber; | 
 |  |  |                     sShortNumber = DBUtility.ClsPub.GetShortNumber(oItem.HNumber.Trim()); | 
 |  |  | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; ; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "基础资料已审核!不能进行删除!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "") | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "基础资料已禁用!不能进行删除!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 //删除前控制=========================================       | 
 |  |  |                 string sql1 = "exec h_p_Gy_EnvironmentTestItem_BeforeDelCtrl " + HItemID + ",'" + user + "'"; | 
 |  |  |                 ds = oCN.RunProcReturn(sql1, "h_p_Gy_EnvironmentTestItem_BeforeDelCtrl"); | 
 |  |  | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 //==================================================================================  | 
 |  |  |                 | 
 |  |  |  | 
 |  |  |                 oCN.Commit();//提交事务 | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  | 
 |  |  |  | 
 |  |  |                 oCN.RunProc("delete from EqiupMaterWorkTimes where HItemID=" + HItemID); | 
 |  |  |  | 
 |  |  |                           | 
 |  |  |  | 
 |  |  |                 oCN.Commit();//提交事务 | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         #region 白标基础信息表 设置列表/保存/编辑/删除方法 | 
 |  |  |         /// <summary> | 
 |  |  |         /// 保存白标基础信息表 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <param name="msg"></param> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("SaveSc_PackUnionBillBarCode_tempList")] | 
 |  |  |         [HttpPost] | 
 |  |  |         public object SaveSc_PackUnionBillBarCode_tempList([FromBody] JObject msg) | 
 |  |  |         { | 
 |  |  |             DataSet ds; | 
 |  |  |             var _value = msg["msg"].ToString(); | 
 |  |  |             string msg3 = _value.ToString(); | 
 |  |  |             string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); | 
 |  |  |             string msg1 = sArray[0].ToString(); | 
 |  |  |             string msg2 = sArray[1].ToString(); | 
 |  |  |  | 
 |  |  |             //查看权限 | 
 |  |  |             if (!DBUtility.ClsPub.Security_Log("Sc_PackUnionBillBarCode_temp_Edit", 1, false, msg2)) | 
 |  |  |             { | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 0; | 
 |  |  |                 objJsonResult.Message = "无保存权限!"; | 
 |  |  |                 objJsonResult.data = null; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             Int64 HItemID = 0; | 
 |  |  |             SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
 |  |  |             | 
 |  |  |             ListModels oListModels = new ListModels(); | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 WebAPI.DLL.ClsSc_PackUnionBillBarCode_temp_Ctl oBill = new WebAPI.DLL.ClsSc_PackUnionBillBarCode_temp_Ctl(); | 
 |  |  |                 List<Model.ClsSc_PackUnionBillBarCode_temp_Model> lsmain = new List<Model.ClsSc_PackUnionBillBarCode_temp_Model>(); | 
 |  |  |                 msg1 = msg1.Replace("\\", ""); | 
 |  |  |                 msg1 = msg1.Replace("\n", "");  //\n | 
 |  |  |                 lsmain = oListModels.getObjectByJson_Sc_PackUnionBillBarCode_temp(msg1); | 
 |  |  |                 foreach (Model.ClsSc_PackUnionBillBarCode_temp_Model oItem in lsmain) | 
 |  |  |                 { | 
 |  |  |                     if (oItem.HMaterNumber.Trim() == "") | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "保存失败!代码不能为空!"; | 
 |  |  |                         objJsonResult.data = 1; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                     if (oItem.HMaterName.Trim() == "") | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "保存失败!名称不能为空!"; | 
 |  |  |                         objJsonResult.data = 1; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                     if (!DBUtility.ClsPub.AllowNumber(oItem.HMaterNumber.Trim())) | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "保存失败!代码中不能出现连续‘.’并且首位末位不能为‘.’!"; | 
 |  |  |                         objJsonResult.data = 1; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                     //查询数据中是否存在重复代码 | 
 |  |  |  | 
 |  |  |                     ds = oCN.RunProcReturn("select * from  Sc_PackUnionBillBarCode_temp where   HMaterNumber='" + oItem.HMaterNumber.Trim() + "' and HUSEORGID= '" + oItem.HUSEORGID + "'  ", "Sc_PackUnionBillBarCode_temp"); | 
 |  |  |                     if (oItem.HMaterNumber.Trim() == "") | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "保存失败!代码为空!"; | 
 |  |  |                         objJsonResult.data = 1; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |                     //已审核的不允许保存 | 
 |  |  |                     if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "单据已审核!不能进行保存!"; | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                     oItem.HMakeEmp = msg2; //创建人 | 
 |  |  |  | 
 |  |  |                     oBill.oModel = oItem; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 //保存 | 
 |  |  |                 //保存完毕后处理 | 
 |  |  |                 bool bResult; | 
 |  |  |                 if (oBill.oModel.HInterID == 0) | 
 |  |  |                 { | 
 |  |  |                     bResult = oBill.AddNew(ref DBUtility.ClsPub.sExeReturnInfo); | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     bResult = oBill.ModifyByID(oBill.oModel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); | 
 |  |  |                 } | 
 |  |  |                 if (bResult) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 1; | 
 |  |  |                     objJsonResult.Message = "保存成功!"; | 
 |  |  |                     objJsonResult.data = 1; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo; | 
 |  |  |                     objJsonResult.data = 1; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  |             { | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 0; | 
 |  |  |                 objJsonResult.Message = "保存失败!" + e.ToString(); | 
 |  |  |                 objJsonResult.data = 1; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 白标基础信息表获取信息 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("GetSc_PackUnionBillBarCode_tempDetail")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public ApiResult<DataSet> GetSc_PackUnionBillBarCode_tempDetail(string HID) | 
 |  |  |         { | 
 |  |  |             var model = LuBaoSevice.GetSc_PackUnionBillBarCode_tempBillDetail(HID); | 
 |  |  |             return model; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 白标基础信息表 删除功能 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("DeltetSc_PackUnionBillBarCode_temp")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object DeltetSc_PackUnionBillBarCode_temp(string HItemID, string user) | 
 |  |  |         { | 
 |  |  |             DataSet ds; | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 //删除权限 | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log("Sc_PackUnionBillBarCode_temp_Drop", 1, false, user)) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "无删除权限!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
 |  |  |                 if (string.IsNullOrWhiteSpace(HItemID)) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "HItemID为空!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 oCN.BeginTran();//开始事务 | 
 |  |  |                 ds = oCN.RunProcReturn("select * from Sc_PackUnionBillBarCode_temp where HInterID=" + HItemID, "Sc_PackUnionBillBarCode_temp"); | 
 |  |  |                 if (ds == null || ds.Tables[0].Rows.Count == 0) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "没有数据,无法删除!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; ; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "单据已审核!不能进行删除!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "") | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "单据已禁用!不能进行删除!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                 oCN.RunProc("delete from Sc_PackUnionBillBarCode_temp where HInterID=" + HItemID); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                 oCN.Commit();//提交事务 | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  |                 objJsonResult.Message = "数据删除成功!"; | 
 |  |  |                 objJsonResult.data = null; | 
 |  |  |                 return objJsonResult; ; | 
 |  |  |  | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  |             { | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 0; | 
 |  |  |                 objJsonResult.Message = "删除失败!" + e.ToString(); | 
 |  |  |                 objJsonResult.data = null; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |  | 
 |  |  | 
 |  |  |                 ClsCN oCn = new ClsCN(); | 
 |  |  |                 DataSet oDs = new DataSet(); | 
 |  |  |                 //========== | 
 |  |  |                 oDs = oCn.RunProcReturn("select HItemID ID,Hname Name,HStopflag Stopflag from Xt_ORGANIZATIONS", "Xt_ORGANIZATIONS"); | 
 |  |  |                 oDs = oCn.RunProcReturn("select HItemID ID,Hname Name,HStopflag Stopflag from Xt_ORGANIZATIONS with(nolock)", "Xt_ORGANIZATIONS"); | 
 |  |  |                 objjson.code = "1"; | 
 |  |  |                 objjson.count = 1; | 
 |  |  |                 objjson.Message = "获取成功!"; | 
 |  |  | 
 |  |  |                     objjson.data = ds.Tables[0]; | 
 |  |  |                     return objjson; | 
 |  |  |                 } | 
 |  |  |             }catch(Exception e) | 
 |  |  |             } catch (Exception e) | 
 |  |  |             { | 
 |  |  |                 objjson.code = "0"; | 
 |  |  |                 objjson.count = 0; | 
 |  |  | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 根据模具仓库编号获取模具数据 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <param name="sWhere">筛选条件</param> | 
 |  |  |         /// <param name="user">操作用户</param> | 
 |  |  |         /// <param name="Organization">组织</param> | 
 |  |  |         /// <returns>模具数据清单</returns> | 
 |  |  |         [Route("Web/Get_Sc_MouldStatusAnalysisList")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object Get_Sc_MouldStatusAnalysisList(string sWhere, string user, string Organization) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
 |  |  |                 if (sWhere == null || sWhere.Equals("")) | 
 |  |  |                 { | 
 |  |  |                     ds = oCN.RunProcReturn("Select * from h_v_Sc_MouldStatusAnalysisList where 1=1 Order by HInterID DESC", "h_v_Sc_MouldStatusAnalysisList"); | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     string sql1 = "Select * from h_v_Sc_MouldStatusAnalysisList where 1=1  "; | 
 |  |  |                     string sql = sql1 + sWhere + " Order by HInterID DESC"; | 
 |  |  |                     ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldStatusAnalysisList"); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                 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 = "0"; | 
 |  |  |                     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> | 
 |  |  |         /// 获取器具列表 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <returns></returns> | 
 |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 获取巡检项目列表 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("Web/GetPatrolCheckItemList_Json")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object GetPatrolCheckItemList_Json(string CheckItem) | 
 |  |  |         { | 
 |  |  |             DataSet ds; | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 sWhere = " Where HStopFlag=0 and HEndFlag=1"; | 
 |  |  |                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
 |  |  |                 if (CheckItem != "" && CheckItem != null) | 
 |  |  |                 { | 
 |  |  |                     sWhere = sWhere + " and ( HNumber like '%" + CheckItem + "%' or HName like '%" + CheckItem + "%' ) "; | 
 |  |  |                 } | 
 |  |  |                 ds = oCN.RunProcReturn("Select HItemID,HNumber,HName  from Gy_PatrolCheck " + sWhere + " Order by HItemID ", "Gy_DotCheck"); | 
 |  |  |                 if (ds == null) | 
 |  |  |                 { | 
 |  |  |                     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> | 
 |  |  | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("Web/GetSc_ProcessExchangeBillListView")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object GetSc_ProcessExchangeBillListView(string ICMOBill, int OrganizationID) | 
 |  |  |         public object GetSc_ProcessExchangeBillListView(string sWhere, int OrganizationID) | 
 |  |  |         { | 
 |  |  |             if (ICMOBill != "" & ICMOBill != null) | 
 |  |  |             { | 
 |  |  |                 sWhere = " where 1=1 and 单据号 like '%" + ICMOBill + "%' "; | 
 |  |  |             } | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
 |  |  |                 if (sWhere == null || sWhere.Equals("")) | 
 |  |  |                 { | 
 |  |  |                     ds = oCN.RunProcReturn("select top 500 * from h_v_Sc_ProcessExchangeBillList where 1=1  order by 单据号 desc,hsubid", "h_v_Sc_ProcessExchangeBillList"); | 
 |  |  |                     ds = oCN.RunProcReturn("select top 300 * from h_v_Sc_ProcessExchangeBillList_PDA where 1=1  order by 单据号 desc,hsubid", "h_v_Sc_ProcessExchangeBillList_PDA"); | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     string sql = "select * from h_v_Sc_ProcessExchangeBillList " + sWhere + " order by 单据号 desc,hsubid "; | 
 |  |  |                     ds = oCN.RunProcReturn(sql, "h_v_Sc_ProcessExchangeBillList"); | 
 |  |  |                     string sql = "select * from h_v_Sc_ProcessExchangeBillList_PDA  where 1=1 " + sWhere + " order by 单据号 desc,hsubid "; | 
 |  |  |                     ds = oCN.RunProcReturn(sql, "h_v_Sc_ProcessExchangeBillList_PDA"); | 
 |  |  |                 } | 
 |  |  |                 if (ds == null || ds.Tables[0].Rows.Count <= 0) | 
 |  |  |                 { | 
 |  |  | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("Web/GetCheckItemID")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object GetCheckItemID(string HName,string HProName,string HSourceID) | 
 |  |  |         {          | 
 |  |  |         public object GetCheckItemID(string HName, string HProName, string HSourceID) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
 |  |  |                 ds = oCN.RunProcReturn("select  top 1 * from h_v_Gy_QCCheckProjectList_Main where 物料名称='"+HName+ "' and 工序名称='" + HProName + "' and HSourceID='" + HSourceID + "'   order by 日期 desc ", "h_v_Gy_QCCheckProjectList_Main"); | 
 |  |  |                 ds = oCN.RunProcReturn("select  top 1 * from h_v_Gy_QCCheckProjectList_Main where 物料名称='" + HName + "' and 工序名称='" + HProName + "' and HSourceID='" + HSourceID + "'   order by 日期 desc ", "h_v_Gy_QCCheckProjectList_Main"); | 
 |  |  |                 if (ds == null || ds.Tables[0].Rows.Count <= 0) | 
 |  |  |                 { | 
 |  |  |                     ds = oCN.RunProcReturn("select  top 1 * from h_v_Gy_QCCheckProjectList_Main where 物料名称='" + HName + "' and 工序名称 ='" + HProName + "'  order by 日期 desc ", "h_v_Gy_QCCheckProjectList_Main"); | 
 |  |  | 
 |  |  |                 { | 
 |  |  |                     objjson.code = "0"; | 
 |  |  |                     objjson.count = 0; | 
 |  |  |                     objjson.Message = "获取失败" + DBUtility.ClsPub.sErrInfo; | 
 |  |  |                     objjson.Message = "获取失败,未设置默认检验方案"; | 
 |  |  |                     objjson.data = null; | 
 |  |  |                     return objjson; | 
 |  |  |                 } | 
 |  |  | 
 |  |  |                 { | 
 |  |  |                     objjson.code = "0"; | 
 |  |  |                     objjson.count = 0; | 
 |  |  |                     objjson.Message = "获取失败,查无数据" + DBUtility.ClsPub.sErrInfo; | 
 |  |  |                     objjson.Message = "获取失败,明细查无数据"; | 
 |  |  |                     objjson.data = null; | 
 |  |  |                     return objjson; | 
 |  |  |                 } | 
 |  |  | 
 |  |  |                         break; | 
 |  |  |                     case "QD": | 
 |  |  |                         HView = "h_v_Sb_EquipRepairSignBillList"; | 
 |  |  |                         break; | 
 |  |  |                     case "XJ": | 
 |  |  |                         HView = "h_v_Sb_EquipPatrolCheckBillList"; | 
 |  |  |                         break; | 
 |  |  |                     default: | 
 |  |  |                         objjson.code = "0"; | 
 |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 获取选单号的源单类型 通过选单号单据类型 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("Web/GetHSourceBillTypeByBillType")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object GetHSourceBillTypeByBillType(string HBillType, int Num) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 ClsCN oCn = new ClsCN(); | 
 |  |  |                 DataSet oDs = new DataSet(); | 
 |  |  |                 //有的单子源单分为红蓝单  0代表蓝单  1代表红单 | 
 |  |  |                 if (Num == 0) | 
 |  |  |                 {           //源单为蓝单 | 
 |  |  |                     oDs = oCn.RunProcReturn("select * from  Xt_BillSourceSet where HNumber='" + HBillType + "'and  HRedBlueFlag ='" + Num + "' ", "Xt_BillSourceSet"); | 
 |  |  |                 } | 
 |  |  |                 else if (Num == 1) | 
 |  |  |                 {          //源单为红单 | 
 |  |  |                     oDs = oCn.RunProcReturn("select * from  Xt_BillSourceSet where HNumber='" + HBillType + "' and  HRedBlueFlag ='" + Num + "' ", "Xt_BillSourceSet"); | 
 |  |  |                 } | 
 |  |  |                 else if (Num == 2) | 
 |  |  |                 {       //不分红蓝单 | 
 |  |  |                     oDs = oCn.RunProcReturn("select * from  Xt_BillSourceSet where HNumber='" + HBillType + "'", "Xt_BillSourceSet"); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 objjson.code = "1"; | 
 |  |  |                 objjson.count = 1; | 
 |  |  |                 objjson.Message = "获取成功!"; | 
 |  |  |                 objjson.data = oDs.Tables[0]; | 
 |  |  |                 return objjson; ; | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  |             { | 
 |  |  |  | 
 |  |  |                 objjson.code = "0"; | 
 |  |  |                 objjson.count = 0; | 
 |  |  |                 objjson.Message = "获取失败!异常" + e.ToString(); | 
 |  |  |                 objjson.data = null; | 
 |  |  |                 return objjson; ; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         /// <summary> | 
 |  |  |         /// 获取选单号的源单类型 | 
 |  |  |         /// </summary> | 
 |  |  |         /// <returns></returns> | 
 |  |  | 
 |  |  |                 return objjson; ; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         #region [从数据库加载菜单 APP] | 
 |  |  |  | 
 |  |  |         public class AppMenuLoad | 
 |  |  |         { | 
 |  |  |             public string HitemID { get; set; } // 主键 | 
 |  |  |             public string HPartentID { get; set; } = "0"; // 父节点ID | 
 |  |  |             public string HEntryID { get; set; } // 菜单节点id | 
 |  |  |             public string HIndex { get; set; } | 
 |  |  |             public string HName { get; set; } | 
 |  |  |             public string HMenuName { get; set; } | 
 |  |  |             public string HPicNum { get; set; } | 
 |  |  |             public string HShowMode { get; set; } | 
 |  |  |             public string HTranslationText_English { get; set; } | 
 |  |  |             public string HTranslationText_Spain { get; set; } | 
 |  |  |             public string HMaker { get; set; } | 
 |  |  |             public List<MenuLoad> childMenus { get; set; } | 
 |  |  |         } | 
 |  |  |         [Route("Web/MenuList_APP")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object MenuList_APP(string HMaker, string HType, string HMenuListName) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 DataSet ds = oCN.RunProcReturn("exec [h_p_Gy_MenuDefineSet_APP_Get] " + | 
 |  |  |                     "@HMaker = N'" + HMaker + "'," + | 
 |  |  |                     "@HType = N'" + HType + "'," +  | 
 |  |  |                     "@HMenuListName = N'" + HMenuListName + "'" | 
 |  |  |                     , "h_p_Gy_MenuDefineSet_APP_Get"); | 
 |  |  |  | 
 |  |  |                 if ((bool)ds.Tables[0].Rows[0]["returnType"] == true) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "1"; | 
 |  |  |                     objJsonResult.count = 1; | 
 |  |  |                     objJsonResult.Message = ds.Tables[0].Rows[0]["mesg"].ToString(); | 
 |  |  |                     objJsonResult.data = ds.Tables[1]; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = ds.Tables[0].Rows[0]["mesg"].ToString(); | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  |             { | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 0; | 
 |  |  |                 objJsonResult.Message = e.ToString(); | 
 |  |  |                 objJsonResult.data = null; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         [Route("Web/SetMenuList_APP")] | 
 |  |  |         [HttpPost] | 
 |  |  |         public object SetMenuList_APP([FromBody] JObject oMain) | 
 |  |  |         { | 
 |  |  |             var _value = oMain["oMain"].ToString(); | 
 |  |  |             string msg1 = _value.ToString(); | 
 |  |  |             string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 string msg2 = sArray[0]; | 
 |  |  |                 string user = sArray[1].ToString(); | 
 |  |  |                 string MenuName = sArray[2].ToString(); | 
 |  |  |                 string type = sArray[3].ToString(); | 
 |  |  |  | 
 |  |  |                 if (String.Equals(type, "APP", StringComparison.InvariantCultureIgnoreCase)) | 
 |  |  |                 { | 
 |  |  |                     oCN.BeginTran(); | 
 |  |  |                     List<AppMenuLoad> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<AppMenuLoad>>(msg2); | 
 |  |  |                     string sql1 = "delete from Gy_MenuDefineSet_APP where HMenuName = '" + MenuName + "' and HMaker = '" + user + "'"; | 
 |  |  |                     oCN.RunProcReturn(sql1, "Gy_MenuDefineSet_APP"); | 
 |  |  |                     list.ForEach(one => | 
 |  |  |                     { | 
 |  |  |                         string sql2 = "insert into Gy_MenuDefineSet_APP( HEntryID, HIndex, HName, HMenuName, HPicNum, HShowMode, HMaker)" + | 
 |  |  |                        "Values('" + one.HEntryID + "','" + one.HIndex + "','" + one.HName + "','" + MenuName + "','"  | 
 |  |  |                        + one.HPicNum + "','" + one.HShowMode + "','" + user + "')"; | 
 |  |  |                         oCN.RunProcReturn(sql2, "Gy_MenuDefineSet_APP"); | 
 |  |  |                     }); | 
 |  |  |  | 
 |  |  |                     oCN.Commit(); | 
 |  |  |  | 
 |  |  |                     objJsonResult.code = "1"; | 
 |  |  |                     objJsonResult.count = 1; | 
 |  |  |                     objJsonResult.Message = "设置成功!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "暂不支持该平台设置自定义菜单!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  |             { | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 0; | 
 |  |  |                 objJsonResult.Message = e.ToString(); | 
 |  |  |                 objJsonResult.data = null; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         #region [从数据库加载菜单] | 
 |  |  |         public class MenuLoad | 
 |  |  | 
 |  |  |                     ds = oCn.RunProcReturn(sql1, "Gy_MenuDefineSet");        //查询用户绑定的角色 是否设置菜单信息 取角色名称最短的一个 | 
 |  |  |                     if ((ds.Tables[0] == null || ds.Tables[0].Rows.Count == 0)) | 
 |  |  |                     { | 
 |  |  |                         sql = "Select HitemID,HNumber,HName,HPartentID,HLevel,Hurl,HShowMode,isnull(HTranslationText_English,HName) HTranslationText_English,isnull(HTranslationText_Spain,HName) HTranslationText_Spain,HPicNum from Gy_Menu_1 where HType = '" + HType + "' Order by HPosition,len(HitemID),HitemID  "; | 
 |  |  |                         ds = oCn.RunProcReturn(sql, "Gy_Menu_1"); | 
 |  |  |                         sql1 = "select HItemID,HPartentID,HNumber,HName,HLevel,Hurl,HType,HPicNum,HShowMode,isnull(HTranslationText_English,HName) HTranslationText_English,isnull(HTranslationText_Spain,HName) HTranslationText_Spain  from Gy_MenuDefineSet where HMakeName = 'admin' and HType = '" + HType + "' order by HPosition"; | 
 |  |  |                         ds = oCn.RunProcReturn(sql1, "Gy_MenuDefineSet");   //查询admin 是否设置菜单信息 | 
 |  |  |                         if ((ds.Tables[0] == null || ds.Tables[0].Rows.Count == 0)) | 
 |  |  |                         { | 
 |  |  |                             sql = "Select HitemID,HNumber,HName,HPartentID,HLevel,Hurl,HShowMode,isnull(HTranslationText_English,HName) HTranslationText_English,isnull(HTranslationText_Spain,HName) HTranslationText_Spain,HPicNum from Gy_Menu_1 where HType = '" + HType + "' Order by HPosition,len(HitemID),HitemID  "; | 
 |  |  |                             ds = oCn.RunProcReturn(sql, "Gy_Menu_1"); | 
 |  |  |                         } | 
 |  |  |                              | 
 |  |  |                     }                  | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         //获取所有模块页面 | 
 |  |  |         [Route("Web/ModePageList")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object ModePageList(string HMakeName, string HType) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 | 
 |  |  |                 SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                 string sql = "select *  from Gy_MenuDefineSet where HMakeName = '" + HMakeName + "' and HType = '" + HType + "' and isnull(Hurl,'')  like'%html%' order by HPosition"; | 
 |  |  |                 ds = oCn.RunProcReturn(sql, "Gy_MenuDefineSet");        //查询当前用户的自定义菜单数据 | 
 |  |  |                 if (ds.Tables[0] == null || ds.Tables[0].Rows.Count == 0) //判断当前用户是否有设置过自定义信息,若记录数为0,则没有设置过,加载所有的菜单信息 | 
 |  |  |                 { | 
 |  |  |                     string sql1 = "select * from Gy_MenuDefineSet  where HMakeName=" + | 
 |  |  |                         "(select   top 1 c.GroupName  from Gy_Czygl a left join System_UserGroupInfo b on a.Czybm = b.UserId  " + | 
 |  |  |                         "left join System_UserGroup c on b.GroupId = c.GroupID  where a.Czymc ='" + HMakeName + "' order by len(c.GroupName )) and isnull(Hurl,'')  like'%html%'"; | 
 |  |  |                     ds = oCn.RunProcReturn(sql1, "Gy_MenuDefineSet");        //查询用户绑定的角色 是否设置菜单信息 取角色名称最短的一个 | 
 |  |  |                     if ((ds.Tables[0] == null || ds.Tables[0].Rows.Count == 0)) | 
 |  |  |                     { | 
 |  |  |                         sql = "Select * from h_v_Gy_Menu_1   Order by HPosition,len(HitemID),HitemID  "; | 
 |  |  |                         ds = oCn.RunProcReturn(sql, "Gy_Menu_1"); | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                 //ds = oCn.RunProcReturn("Select * from Gy_Menu_1 where isnull(Hurl,'')  like'%html%'  Order by HItemID ", "Gy_Menu_1");     //获取Gy_Menu_1中的所有菜单信息,用于为menuInitList列表充 | 
 |  |  |  | 
 |  |  |                 objJsonResult.code = "1"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  |                 objJsonResult.Message = "查询成功!"; | 
 |  |  |                 objJsonResult.data = ds.Tables[0]; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  |             { | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 0; | 
 |  |  |                 objJsonResult.Message = "查询失败!"; | 
 |  |  |                 objJsonResult.data = e.ToString(); | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         #region 保存自定义数据 | 
 |  |  | 
 |  |  |         //快捷方式自定义菜单:获取树组件数据 | 
 |  |  |         [Route("Web/Xt_UserFastMenu_Display")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object Xt_UserFastMenu_Display(string HMakeName, string HType) | 
 |  |  |         public object Xt_UserFastMenu_Display(string HMakeName, string HType,string HModelAtributos) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  | 
 |  |  |                     menuInit.HSelected = false; | 
 |  |  |  | 
 |  |  |                     //判断用户是否选中显示该菜单 | 
 |  |  |                     String sql = "Select * from Xt_UserFastMenu where HSubFuncID = '" + ds.Tables[0].Rows[i]["HItemID"] + "' and HUserID='" + HMakeName + "'"; | 
 |  |  |                     String sql = "Select * from Xt_UserFastMenu where HSubFuncID = '" + ds.Tables[0].Rows[i]["HItemID"] + "' and HUserID='" + HMakeName + "' and HModelAtributos='" + HModelAtributos + "'"; | 
 |  |  |                     ds1 = oCn.RunProcReturn(sql, "Xt_UserFastMenu"); | 
 |  |  |                     if (ds1.Tables[0].Rows.Count > 0)                           //对于Gy_Menu_1表中的菜单节点,通过检索在Gy_MenuDefineSet表中对应用户是否存在该节点的信息,判断该用户是否选中该节点需要加载显示在侧菜单栏 | 
 |  |  |                     { | 
 |  |  | 
 |  |  |                 string HMakeName = sArray[1].ToString(); | 
 |  |  |                 string saveData = sArray[0].ToString(); | 
 |  |  |                 string HTypes = sArray[2].ToString(); | 
 |  |  |                 string HModelAtributos = sArray[3].ToString(); | 
 |  |  |                 List<SaveDefineMenu> saveDataList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SaveDefineMenu>>(saveData); | 
 |  |  |  | 
 |  |  |                 //声明数据库操作工具 | 
 |  |  | 
 |  |  |                 oCN.BeginTran(); | 
 |  |  |  | 
 |  |  |                 //删除当前用户的自定义数据 | 
 |  |  |                 string sql = "delete from Xt_UserFastMenu where HUserID = '" + HMakeName + "' and HType = '" + HTypes + "'"; | 
 |  |  |                 string sql = "delete from Xt_UserFastMenu where HUserID = '" + HMakeName + "' and HType = '" + HTypes + "' and HModelAtributos = '" + HModelAtributos + "'"; | 
 |  |  |                 oCN.RunProc(sql); | 
 |  |  |  | 
 |  |  |                 //插入当前用户最新的自定义数据 | 
 |  |  | 
 |  |  |                             string HCaption = ds.Tables[0].Rows[0]["HName"].ToString(); | 
 |  |  |                             string HType = ds.Tables[0].Rows[0]["HType"].ToString(); | 
 |  |  |  | 
 |  |  |                             sql = "insert into Xt_UserFastMenu(HUserID,HSubFuncID,HCaption,HType) values('" + HUserID + "','" + HSubFuncID + "','" + HCaption + "','" + HType + "')"; | 
 |  |  |                             sql = "insert into Xt_UserFastMenu(HUserID,HSubFuncID,HCaption,HType,HModelAtributos) values('" + HUserID + "','" + HSubFuncID + "','" + HCaption + "','" + HType + "','"+ HModelAtributos + "')"; | 
 |  |  |                             oCN.RunProc(sql); | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  | 
 |  |  |         //快捷方式自定义菜单:获取树组件数据 | 
 |  |  |         [Route("Web/Xt_UserFastMenu_Init")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object Xt_UserFastMenu_Init(string HMakeName, string HType) | 
 |  |  |         public object Xt_UserFastMenu_Init(string HMakeName, string HType,string HModelAtributos) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); | 
 |  |  |                 string sql = "select a.HSubFuncID, a.HCaption,a.HPicNum,b.Hurl,isnull(HTranslationText_English,HName) HTranslationText_English,isnull(HTranslationText_Spain,HName) HTranslationText_Spain from Xt_UserFastMenu as a join Gy_Menu_1 as b on a.HSubFuncID = b.HItemID  where a.HUserID = '" + HMakeName + "' and b.HType = '" + HType + "' Order by a.HItemID"; | 
 |  |  |                 string sql = "select a.HSubFuncID, a.HCaption,a.HPicNum,b.Hurl,isnull(HTranslationText_English,HName) HTranslationText_English,isnull(HTranslationText_Spain,HName) HTranslationText_Spain from Xt_UserFastMenu as a join Gy_Menu_1 as b on a.HSubFuncID = b.HItemID  where a.HUserID = '" + HMakeName + "' and b.HType = '" + HType + "'  and a.HModelAtributos = '" + HModelAtributos + "' Order by a.HItemID"; | 
 |  |  |                 ds = oCn.RunProcReturn(sql, "Xt_UserFastMenu");     //获取Xt_UserFastMenu中该用户设置的自定义菜单信息,用于在前端加载 | 
 |  |  |  | 
 |  |  |                 if (ds == null || ds.Tables[0].Rows.Count == 0) | 
 |  |  |                 { | 
 |  |  |                     sql = "select a.HSubFuncID, a.HCaption,a.HPicNum,b.Hurl,isnull(HTranslationText_English,HName) HTranslationText_English,isnull(HTranslationText_Spain,HName) HTranslationText_Spain from Xt_UserFastMenu as a join Gy_Menu_1 as b on a.HSubFuncID = b.HItemID  where a.HUserID = 'admin' and b.HType = '" + HType + "' Order by a.HItemID"; | 
 |  |  |                     sql = "select a.HSubFuncID, a.HCaption,a.HPicNum,b.Hurl,isnull(HTranslationText_English,HName) HTranslationText_English,isnull(HTranslationText_Spain,HName) HTranslationText_Spain from Xt_UserFastMenu as a join Gy_Menu_1 as b on a.HSubFuncID = b.HItemID  where a.HUserID = 'admin' and b.HType = '" + HType + "' and a.HModelAtributos = '" + HModelAtributos + "' Order by a.HItemID"; | 
 |  |  |                     ds = oCn.RunProcReturn(sql, "Xt_UserFastMenu");     //获取Xt_UserFastMenu中该用户设置的自定义菜单信息,用于在前端加载 | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } |