WYB
2021-04-14 a09e6870ba5aedd996a8c3f401b715c922f4b780
WebAPI/Controllers/WebAPIController.cs
@@ -855,6 +855,55 @@
        }
        /// <summary>
        /// 获取工序列表
        /// <summary>
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("Web/GetProcList_Json")]
        [HttpGet]
        public object GetProcList_Json(string sWhere)
        {
            DataSet ds;
            //sWhere = " Where HStopFlag=0  and HEndFlag=1";
            //sWhere = " Where HStopFlag=0  and HEndFlag=1  and HUSEORGID = " + DBUtility.ClsPub.HORGANIZATIONSID.ToString();
            if (sWhere != "")
            {
                sWhere = sWhere + " and ( HNumber like '%" + sWhere + "%' or HName like '%" + sWhere + "%' ) ";
            }
            try
            {
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                ds = oCN.RunProcReturn("Select HItemID,HNumber 工序代码,HName 工序 from Gy_Process where HStopflag=0 " + sWhere + " Order by HItemID ", "Gy_Process");
                if (ds == null || ds.Tables[0].Rows.Count <= 0)
                {
                    objjson.code = "0";
                    objjson.count = 0;
                    objjson.Message = "获取失败";
                    objjson.data = null;
                    return objjson;
                }
                else
                {
                    objjson.code = "0";
                    objjson.count = 1;
                    objjson.Message = "获取成功!";
                    objjson.data = ds.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>
@@ -884,6 +933,128 @@
                return objjson; ;
            }
        }
        /// <summary>
        /// 获取不良原因列表
        /// </summary>
        /// <returns></returns>
        [Route("Web/GetBadReasonList_Json")]
        [HttpGet]
        public object GetBadReasonList_Json(string BadReason)
        {
            //sWhere = " Where HStopFlag=0  and HEndFlag=1";
            //sWhere = " Where HStopFlag=0  and HEndFlag=1  and HUSEORGID = " + DBUtility.ClsPub.HORGANIZATIONSID.ToString();
            if (BadReason != "")
            {
                sWhere = sWhere + " and ( HNumber like '%" + BadReason + "%' or HName like '%" + BadReason + "%' ) ";
            }
            try
            {
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("Select HItemID,HNumber ,HName  from Gy_BadReason where HStopflag=0 Order by HItemID ", "Gy_BadReason");
                }
                else
                {
                    string sql1 = "Select HItemID,HNumber ,HName  from Gy_BadReason where HStopflag=0 and HEndFlag=1 ";
                    string sql = sql1 + sWhere;
                    ds = oCN.RunProcReturn(sql, "Gy_BadReason");
                }
                //ds = webserver.GetUnitList(sWhere, ref DBUtility.ClsPub.sErrInfo);
                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>
        //[Route("Web/GetPlanList_Json")]
        //[HttpGet]
        //public object GetPlanList_Json(string Billno)
        //{
        //    //sWhere = " Where HStopFlag=0  and HEndFlag=1";
        //    //sWhere = " Where HStopFlag=0  and HEndFlag=1  and HUSEORGID = " + DBUtility.ClsPub.HORGANIZATIONSID.ToString();
        //    if (Billno != "")
        //    {
        //        sWhere = sWhere + " and ( 单据号 like '%" + Billno + "%' ) ";
        //    }
        //    try
        //    {
        //        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        //        if (sWhere == null || sWhere.Equals(""))
        //        {
        //            ds = oCN.RunProcReturn("Select HItemID,HNumber ,HName  from h_v_Sc_ProcessPlanList where HStopflag=0 Order by HItemID ", "Gy_BadReason");
        //        }
        //        else
        //        {
        //            string sql1 = "Select HItemID,HNumber ,HName  from Gy_BadReason where HStopflag=0 and HEndFlag=1 ";
        //            string sql = sql1 + sWhere;
        //            ds = oCN.RunProcReturn(sql, "Gy_BadReason");
        //        }
        //        //ds = webserver.GetUnitList(sWhere, ref DBUtility.ClsPub.sErrInfo);
        //        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;
        //    }
        //}
        #endregion
    }