public Object UpdatePrint([FromBody] Completed_Request OrderNo)
 {
     using (SqlConnection con = new SqlConnection(_connectionString))
     {
         Completed_Reuslt result = new Completed_Reuslt();
         try
         {
             FeedbackBaseService BllBase = new FeedbackBaseService(con);
             if (BllBase.UpdatePrint(OrderNo.OrderNo))
             {
                 result.Result    = true;
                 result.ResultMsg = "";
             }
             else
             {
                 result.Result    = false;
                 result.ResultMsg = "系统输入失败";
             }
             return(result);
         }
         catch (Exception ex)
         {
             result.Result    = false;
             result.ResultMsg = ex.Message;
             return(result);
         }
     }
 }
        public Object Get(string OrderNo, string WorkProcedure, string BatchNo, string Model, string EquipmentNo,
                          string FeedbackMan, string StartTime, string EndTime, string HPrint, string Status)
        {
            OrderNo       = IsNull(OrderNo);
            WorkProcedure = IsNull(WorkProcedure);
            BatchNo       = IsNull(BatchNo);
            Model         = IsNull(Model);
            EquipmentNo   = IsNull(EquipmentNo);
            FeedbackMan   = IsNull(FeedbackMan);
            StartTime     = IsNull(StartTime);
            EndTime       = IsNull(EndTime);
            HPrint        = IsNull(HPrint);
            Status        = IsNull(Status);
            string strWhere = @" where OrderNo like '%{0}%' and WorkProcedure like
 '%{1}%' and BatchNo like '%{2}%' and Model like '%{3}%' and EquipmentNo like '%{4}%' and FeedbackMan like '%{5}%'  ";

            strWhere = string.Format(strWhere, OrderNo, WorkProcedure, BatchNo, Model, EquipmentNo, FeedbackMan);
            if (StartTime != "" && StartTime != null & EndTime != "" && EndTime != null)
            {
                strWhere += " and FeedbackTime between '" + StartTime + "' and '" + EndTime + " 23:59:59'";
            }
            if (HPrint == "0")
            {
                strWhere += " and (HPrint=0 or HPrint is null)";
            }
            else if (HPrint == "1")
            {
                strWhere += " and HPrint=1 ";
            }
            if (Status == "T1")
            {
                //待处理
                strWhere += " and Status!='P' ";
            }
            else if (Status == "P")
            {
                //已完成
                strWhere += " and Status='P' ";
            }
            else if (Status == "2")
            {
                //待审批
                strWhere += " and Status!='P'";
            }
            strWhere += " order by FeedbackTime desc";
            using (SqlConnection con = new SqlConnection(_connectionString))
            {
                try
                {
                    BllApprovalStream        Bll         = new BllApprovalStream(con);
                    FeedbackBaseService      BllBase     = new FeedbackBaseService(con);
                    FeedbackExReasonService  BllReason   = new FeedbackExReasonService(con);
                    FeedbackExProblemService BllPro      = new FeedbackExProblemService(con);
                    FeedbackExHandleService  BllHandle   = new FeedbackExHandleService(con);
                    List <FeedbackBase>      BaseList    = BllBase.GetOrderInfoByWhere(strWhere);
                    List <Completed_Request> RequestList = new List <Completed_Request>();
                    if (BaseList != null && BaseList.Count > 0)
                    {
                        foreach (var node in BaseList)
                        {
                            Completed_Request Request = new Completed_Request();
                            //①基础信息
                            string Request_OrderNo = node.OrderNo;
                            Request.OrderNo       = Request_OrderNo;
                            Request.BatchNo       = node.BatchNo;
                            Request.WorkProcedure = node.WorkProcedure;
                            Request.Model         = node.Model;
                            Request.FeedbackMan   = node.FeedbackMan;
                            Request.FeedbackTime  = node.FeedbackTime.ToString("yyyy-MM-dd HH:mm");
                            Request.EquipmentName = node.EquipmentName;
                            Request.EquipmentNo   = node.EquipmentNo;
                            Request.Qty           = node.Qty;
                            Request.Status        = node.Status;

                            //②原因信息
                            Request.ReasonList = BllReason.GetReasonByWhere(" where OrderNo='" + Request_OrderNo + "'");
                            //③问题
                            List <FeedbackExProblem> ProList = BllPro.GetProblemByWhere("  where OrderNo = '" + Request_OrderNo + "'");
                            Request.ProblemList = GetProblemList(ProList, con);
                            //④处理
                            FeedbackExHandle feedbackExHandle = BllHandle.GetHandler(" where OrderNo='" + Request_OrderNo + "'").FirstOrDefault();
                            ExHandle         ExHandle         = new ExHandle();
                            if (feedbackExHandle != null)
                            {
                                ExHandle.HandleMan        = feedbackExHandle.HandleMan;
                                ExHandle.HandleTime       = feedbackExHandle.HandleTime.ToString("yyyy-MM-dd HH:mm");
                                ExHandle.HandleSuggestion = feedbackExHandle.HandleSuggestion;
                                ExHandle.QualityClass     = feedbackExHandle.QualityClass;
                                ExHandle.HandleNote       = feedbackExHandle.HandleNote;
                            }
                            Request.Handler  = ExHandle;
                            Request.ApStream = Bll.GetStream(" where OrderNo='" + node.OrderNo + "'");


                            //⑤关联
                            //循环找出最顶层的批号
                            string Loop = node.BatchNo;
                            bool   flag = true;
                            while (flag)
                            {
                                string strsql = "select ParentNo from ZL_ParentTable where ChildNo='" + Loop + "' ";
                                Parent parent = con.Query <Parent>(strsql).FirstOrDefault();
                                if (parent != null)
                                {
                                    Loop = parent.ParentNo;
                                }
                                else
                                {
                                    flag = false;
                                }
                            }
                            //根据最顶层批号进行递归算法,查找相关的批号
                            string strJson = "{\"ParentNo\":\"" + Loop + "\",\"ChildNo\":[" + GetJson(Loop, con) + "]}";
                            Request.Relate = strJson;
                            RequestList.Add(Request);
                        }
                    }
                    return(RequestList);
                }
                catch (Exception ex)
                {
                    string ErrMsg = ex.Message;
                    return("");
                }
                finally
                {
                    if (con.State != ConnectionState.Closed)
                    {
                        con.Close();
                    }
                }
            }
        }