public Object Get(string ActionType, string CardNo, string ProductClass, string ProductModel,
                   string BatchNo, string Customer)
 {
     using (SqlConnection con = new SqlConnection(conString))
     {
         string         strWhere = "";
         CardInfo       item     = new CardInfo();
         BllProductCard Bll      = new BllProductCard(con);
         if (ActionType == "First")
         {
             if (CardNo.StartsWith("BH"))
             {
                 strWhere = " where chrOrderId='" + CardNo + "' ";
             }
             else if (CardNo.StartsWith("ZD"))
             {
                 strWhere = " where chrID='" + CardNo + "' ";
             }
             else if (CardNo.StartsWith("LB"))
             {
                 strWhere = " where chrId='" + CardNo + "' ";
             }
         }
         //else if(ActionType=="FeedBackToControl")
         //{
         //    if (CardNo.StartsWith("BH"))
         //    {
         //        strWhere = " where chrOrderId='" + CardNo + "' "
         //            + "' and chritemid like '%" + ProductModel
         //                + "' and chrLot='" + BatchNo + "'";
         //    }
         //    else if (CardNo.StartsWith("ZD"))
         //    {
         //        strWhere = " where chrID='" + CardNo + "' "
         //            + "' and chrGHXH1 like '%" + ProductModel
         //                + "' and chrLOT='" + BatchNo + "' ";
         //    }
         //    else if (CardNo.StartsWith("LB"))
         //    {
         //        strWhere = " where chrId='" + CardNo + "' "
         //            + "' and chrItemId='" + ProductModel
         //            + "' and  chrLot='" + BatchNo + "'";
         //    }
         //}
         else
         {
             if (CardNo.StartsWith("BH"))
             {
                 strWhere = " where chrOrderId='" + CardNo + "' and chrkind='"
                            + ProductClass + "' and chritemid like '%" + ProductModel
                            + "' and chrLot='" + BatchNo + "'";
             }
             else if (CardNo.StartsWith("ZD"))
             {
                 strWhere = " where chrID='" + CardNo + "' and chrGHXH1 like '%" + ProductModel
                            + "' and left(chrGHXH1,2)='" + ProductClass
                            + "' and chrKHName='" + Customer + "' and chrLOT='" + BatchNo + "' ";
             }
             else if (CardNo.StartsWith("LB"))
             {
                 strWhere = " where chrId='" + CardNo + "' and chrItemId='" + ProductModel
                            + "' and chrQualityType='" + ProductClass + "' and chrLot='" + BatchNo + "'";
             }
         }
         if (CardNo.StartsWith("BH"))
         {
             ProductCard.BraidStockCard BraidStockCard = Bll.GetBraidStockCard(strWhere);
             if (BraidStockCard != null)
             {
                 item.cardNo       = CardNo;
                 item.tempAmount   = BraidStockCard.decBraidQuanty;
                 item.batchNo      = BraidStockCard.chrLot;
                 item.cardNo       = BraidStockCard.chrOrderId;
                 item.tempmodel    = BraidStockCard.chrItem;
                 item.productModel = (BraidStockCard.chritemid).Substring(2, (BraidStockCard.chritemid).Length - 2);
                 item.tempClass    = BraidStockCard.chrType;
                 item.batchNo      = BraidStockCard.chrLot;
                 item.productClass = BraidStockCard.chrkind;
             }
         }
         else if (CardNo.StartsWith("ZD"))
         {
             ProductCard.InvoiceCard InvoiceCard = Bll.InvoiceCard(strWhere);
             if (InvoiceCard != null)
             {
                 item.cardNo       = CardNo;
                 item.orderNo      = InvoiceCard.chrOrderID;
                 item.customer     = InvoiceCard.chrKHName;
                 item.tempClass    = InvoiceCard.chrKHType;
                 item.tempmodel    = InvoiceCard.chrKHXH;
                 item.productModel = (InvoiceCard.chrGHXH1).Substring(4, (InvoiceCard.chrGHXH1).Length - 4);
                 item.tempAmount   = InvoiceCard.intBH;
                 item.batchNo      = InvoiceCard.chrLOT;
                 item.productClass = InvoiceCard.chrGHXH1.Substring(0, 2);
             }
         }
         else if (CardNo.StartsWith("LB"))
         {
             ProductCard.PacketBraidCard PacketBraidCard = Bll.PacketBraidCard(strWhere);
             if (PacketBraidCard != null)
             {
                 item.cardNo       = CardNo;
                 item.tempAmount   = PacketBraidCard.decBraidQuantity;
                 item.amount       = PacketBraidCard.decQuantity;
                 item.cardNo       = PacketBraidCard.chrId;
                 item.tempmodel    = PacketBraidCard.chrPlanItemid;
                 item.productModel = PacketBraidCard.chrItemId;
                 item.tempClass    = PacketBraidCard.chrPlanQualityType;
                 item.productClass = PacketBraidCard.chrQualityType;
                 item.batchNo      = PacketBraidCard.chrLot;
             }
         }
         return(item);
     }
 }
        public Object AddFeedback([FromBody] FeedbackData PostData)
        {
            ResultData result = new ResultData();

            using (SqlConnection sqlconnection = new SqlConnection(conString))
            {
                bool flag = true;
                FeedbackBaseService service  = new FeedbackBaseService(sqlconnection);
                List <FeedbackBase> BaseList = service.GetOrderInfoByWhere(" where OrderNo='" + PostData.OrderNo + "'");
                if (sqlconnection.State == ConnectionState.Closed)
                {
                    sqlconnection.Open();
                }
                SqlTransaction transaction = sqlconnection.BeginTransaction();
                try
                {
                    FeedbackBase feedbackbase = new FeedbackBase();
                    feedbackbase.OrderNo     = PostData.OrderNo;
                    feedbackbase.Model       = PostData.Model;
                    feedbackbase.FeedbackMan = PostData.FeedbackMan;
                    //feedbackbase.FeedbackTime = DateTime.Now;
                    feedbackbase.Qty           = PostData.Qty;
                    feedbackbase.WorkProcedure = PostData.WorkProcedure;
                    feedbackbase.BatchNo       = PostData.BatchNo;
                    feedbackbase.EquipmentName = PostData.EquipmentName;
                    feedbackbase.EquipmentNo   = PostData.EquipmentNo;
                    feedbackbase.ProductClass  = PostData.ProductClass;
                    if (PostData.FeedbackTime == "")
                    {
                        feedbackbase.FeedbackTime = DateTime.Now;
                    }
                    else
                    {
                        feedbackbase.FeedbackTime = Convert.ToDateTime(PostData.FeedbackTime);
                    }

                    feedbackbase.Status       = PostData.Status;
                    feedbackbase.ProblemLevel = PostData.ProblemLevel;
                    //FeedbackBaseService service = new FeedbackBaseService(sqlconnection);
                    //List<FeedbackBase> BaseList= service.GetOrderInfoByWhere(" where OrderNo='" + PostData.OrderNo + "'",transaction);
                    if (BaseList != null && BaseList.Count > 0)
                    {
                        flag = service.Delete(PostData.OrderNo, transaction);
                    }
                    if (!Directory.Exists(SavePath))
                    {
                        Directory.CreateDirectory(SavePath);
                    }
                    if (service.AddFeedbackBase(feedbackbase, transaction))
                    {
                        FeedbackExProblemService PService = new FeedbackExProblemService(sqlconnection);
                        FeedbackExReasonService  RService = new FeedbackExReasonService(sqlconnection);
                        BllProductCard           BllCard  = new BllProductCard(sqlconnection);
                        FeedbackExProblem        Problem  = new FeedbackExProblem();
                        FeedbackExReason         Reason   = new FeedbackExReason();
                        foreach (var list in PostData.ReasonData)
                        {
                            if (list.ReasonType != "" && list.ReasonDetails != "")
                            {
                                Reason.ReasonType    = list.ReasonType;
                                Reason.ReasonDetails = list.ReasonDetails;
                                Reason.OrderNo       = PostData.OrderNo;
                                if (!RService.AddReason(Reason, transaction))
                                {
                                    flag = false;
                                    break;
                                }
                            }
                        }
                        foreach (var list in PostData.ProblemData)
                        {
                            if (list.CodeString != "" || list.PicturePath != "" || list.ProblemDetails != "")
                            {
                                Problem.CodeString = list.CodeString;
                                Problem.OrderNo    = PostData.OrderNo;
                                string PicturePath = list.PicturePath;
                                string filePath    = "";
                                if (PicturePath != "" && PicturePath != null)
                                {
                                    var chrPath = PicturePath.Split('|');
                                    for (int iPath = 0; iPath < chrPath.Length; iPath++)
                                    {
                                        if (chrPath[iPath].Contains("base64"))
                                        {
                                            SaveImage save     = new SaveImage();
                                            string    fileName = DateTime.Now.Ticks.ToString();
                                            save.SaveInageForBase(chrPath[iPath].Split(',')[1], SavePath, fileName);
                                            filePath = filePath + "ProblemPicture/" + fileName + ".png" + ",";
                                        }
                                        else if (chrPath[iPath] != "")
                                        {
                                            string tempPath = "";
                                            for (var i = 0; i < chrPath[iPath].Split('/').Length; i++)
                                            {
                                                if (i >= 3)
                                                {
                                                    tempPath = tempPath + chrPath[iPath].Split('/')[i] + "/";
                                                }
                                            }
                                            if (tempPath != "")
                                            {
                                                tempPath = tempPath.Substring(0, tempPath.LastIndexOf("/"));
                                                filePath = filePath + tempPath + ",";
                                            }
                                        }
                                    }
                                }
                                if (filePath != "")
                                {
                                    filePath = filePath.Substring(0, filePath.LastIndexOf(","));
                                }

                                Problem.PicturePath    = filePath;
                                Problem.ProblemDetails = list.ProblemDetails;
                                if (!PService.AddProblem(Problem, transaction))
                                {
                                    flag = false;
                                    break;
                                }
                            }
                        }
                        foreach (var list in PostData.CardList)
                        {
                            list.FKOrderNo = PostData.OrderNo;
                            if (!BllCard.InsertCard(list, transaction))
                            {
                                flag = false;
                                break;
                            }
                        }
                        if (PostData.IfQC)
                        {
                            FeedbackExHandleService BllHandler = new FeedbackExHandleService(sqlconnection);
                            FeedbackExHandle        Handler    = new FeedbackExHandle();
                            Handler.HandleMan        = PostData.HandleMan;
                            Handler.HandleNote       = PostData.HandleNote;
                            Handler.HandleSuggestion = PostData.HandleSuggestion;
                            Handler.HandleTime       = DateTime.Now;
                            Handler.QualityClass     = PostData.QualityClass;
                            Handler.OrderNo          = PostData.OrderNo;
                            if (!BllHandler.AddHandle(Handler, transaction))
                            {
                                flag = false;
                            }
                        }
                        if (flag)
                        {
                            transaction.Commit();
                            result.ErrMsg = "";
                            result.Result = true;
                            return(result);
                        }
                        else
                        {
                            transaction.Rollback();
                            result.ErrMsg = "反馈失败";
                            result.Result = false;
                            return(result);
                        }
                    }
                    else
                    {
                        transaction.Rollback();
                        result.ErrMsg = "反馈失败";
                        result.Result = false;
                        return(result);
                    }
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    result.Result = false;
                    if (ex.Message.Contains("重复键"))
                    {
                        result.ErrMsg = "已存在相同的单号,编码不能重复添加";
                    }
                    else
                    {
                        result.ErrMsg = ex.Message;
                    }
                    return(result);
                }
            }
        }
Exemplo n.º 3
0
        public Object InsertOrder(OrderInfo PostData)
        {
            ResultData    result = new ResultData();//返回数据类型
            SqlConnection con    = new SqlConnection(conString);

            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }
            //验证是否已存在该单号的单据,存在删除,再添加,不存在直接添加
            bool   Delete  = false;//false:不存在,true:存在
            string OrderNo = PostData.OrderNo != null? PostData.OrderNo:"";

            OrderNo = OrderNo.Trim();
            FeedbackBaseService BllBase = new FeedbackBaseService(con);
            Guid NewID = BllBase.GetNewID();

            FeedbackBase Base = BllBase.GetOrderInfoByWhere(" where OrderNo='" + OrderNo + "'").FirstOrDefault();

            if (Base != null)
            {
                Delete = true;
            }
            SqlTransaction tran = con.BeginTransaction();

            try
            {
                if (Delete)
                {
                    if (!BllBase.Delete(OrderNo, tran))//删除旧单据
                    {
                        result.ErrMsg = "提交失败,原因:删除原始信息异常";
                        result.Result = false;
                        return(result);
                    }
                }
                //定义保存的数据

                string       EmployeeID = PostData.EmployeeID;
                FeedbackBase Domain     = new FeedbackBase();
                Domain.ID            = NewID;
                Domain.OrderNo       = OrderNo;//单号,控制表以KZ开头,反馈单已FK开头
                Domain.BatchNo       = PostData.BatchNo;
                Domain.Model         = PostData.Model;
                Domain.Qty           = PostData.Qty;
                Domain.Status        = "0";//默认T1顺序审批人
                Domain.WorkProcedure = PostData.WorkProcedure;
                Domain.EquipmentName = PostData.EquipmentName;
                Domain.EquipmentNo   = PostData.EquipmentNo;
                Domain.FeedbackMan   = PostData.FeedbackMan;
                Domain.ProblemLevel  = PostData.ProblemLevel;//审批流程代号
                Domain.ImageList     = PostData.ImageList;
                Domain.ImageHtml     = PostData.ImageHtml;

                if (PostData.FeedbackTime == null || PostData.FeedbackTime == "")
                {
                    PostData.FeedbackTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
                }
                Domain.FeedbackTime = Convert.ToDateTime(PostData.FeedbackTime);
                Domain.ProductClass = PostData.ProductClass;
                int OrderType  = 0;
                int FlowTempId = 1;
                if (OrderNo.StartsWith("FK"))
                {
                    FlowTempId = 0;
                    OrderType  = 0;
                }
                else
                {
                    FlowTempId = 1;
                    OrderType  = 1;
                }
                Domain.OrderType  = OrderType;
                Domain.Measure    = PostData.Measure != null ? PostData.Measure : "";
                Domain.Report     = PostData.Report != null ? PostData.Report : "";
                Domain.EmployeeID = EmployeeID;
                List <ProductCard.CardInfo> CardList    = PostData.CardList;
                List <OrderReason>          ReasonData  = PostData.ReasonData;
                List <OrderProblem>         ProblemData = PostData.ProblemData;

                #region ======Post请求:录入审批系统=====
                //GeneralMethod Method = new GeneralMethod();
                string title = "";
                if (FlowTempId == 1)
                {
                    title = "质量控制流程(" + OrderNo + ")";
                }
                else
                {
                    title = "质量反馈流程(" + OrderNo + ")";
                }

                string urls = new ConfigurationBuilder()
                              .SetBasePath(Directory.GetCurrentDirectory())
                              .AddJsonFile("host.json", optional: true).Build().GetSection("ApprovalPostAddress").Value;
                using (HttpClient Client = new HttpClient())
                {
                    var values = new List <KeyValuePair <string, string> >();
                    values.Add(new KeyValuePair <string, string>("Title", title));
                    values.Add(new KeyValuePair <string, string>("InstanceID", NewID.ToString()));
                    values.Add(new KeyValuePair <string, string>("FlowID", "D3BBCCBF-8968-4833-8A0F-CE5B19B718E2"));
                    values.Add(new KeyValuePair <string, string>("Account", EmployeeID));
                    values.Add(new KeyValuePair <string, string>("WorkProcedure", PostData.WorkProcedure));
                    var content  = new FormUrlEncodedContent(values);
                    var response = Client.PostAsync(urls, content);
                    response.Wait();

                    HttpResponseMessage resp = response.Result;

                    var res2 = resp.Content.ReadAsStringAsync();
                    res2.Wait();
                    string  Message = res2.Result;
                    JObject Robj    = JObject.Parse(Message);
                    if (Robj["result"].ToString() == "1")
                    {
                        Domain.TechnologistMembers = Robj["msg"].ToString();
                    }
                    else
                    {
                        Exception ex = new Exception(Robj["msg"] + "(远端接入失败)");
                        throw ex;
                    }
                }
                #endregion



                if (BllBase.Insert(Domain, tran))
                {
                    FeedbackExProblemService BllProblem = new FeedbackExProblemService(con);
                    FeedbackExReasonService  BllReason  = new FeedbackExReasonService(con);
                    BllProductCard           BllCard    = new BllProductCard(con);
                    for (int i = 0; i < ProblemData.Count; i++)
                    {
                        FeedbackExProblem Problem = new FeedbackExProblem();
                        Problem.OrderNo        = OrderNo;
                        Problem.CodeString     = ProblemData[i].codeString;
                        Problem.TopClass       = ProblemData[i].topClass;
                        Problem.RoomName       = ProblemData[i].roomName;
                        Problem.Problem        = ProblemData[i].problem;
                        Problem.TypeName       = ProblemData[i].typeName;
                        Problem.Present        = ProblemData[i].present;
                        Problem.ProblemDetails = ProblemData[i].problemDetails;
                        Problem.Suggestion     = ProblemData[i].suggestion;
                        Problem.QualityClass   = ProblemData[i].qualityClass;
                        Problem.ProblemLevel   = ProblemData[i].problemLevel;
                        if (ProblemData[i].suggestion != "" && ProblemData[i].suggestion != null && ProblemData[i].suggestion.Contains("suggestion"))
                        {
                            JArray JList = JArray.Parse(ProblemData[i].suggestion);
                            foreach (var node in JList)
                            {
                                string suggestion = node["suggestion"].ToString();
                                if (!BllBase.InsertOrderSuggestion(tran, suggestion, OrderNo, ProblemData[i].codeString))
                                {
                                    Exception ex = new Exception("提交失败,原因:保存质量问题编码处理意见失败");
                                    throw ex;
                                }
                            }
                        }

                        if (!BllProblem.AddProblem(Problem, tran))
                        {
                            Exception ex = new Exception("提交失败,原因:质量问题提交异常");
                            throw ex;
                        }
                    }
                    for (int i = 0; i < ReasonData.Count; i++)
                    {
                        FeedbackExReason Reason = new FeedbackExReason();
                        Reason.OrderNo       = OrderNo;
                        Reason.ReasonDetails = ReasonData[i].reasonDetails;
                        Reason.ReasonType    = ReasonData[i].reasonType;
                        if (!BllReason.AddReason(Reason, tran))
                        {
                            Exception ex = new Exception("提交失败,原因:原因分析提交异常");
                            throw ex;
                        }
                    }
                    foreach (var node in CardList)
                    {
                        node.FKOrderNo = OrderNo;
                        if (!BllCard.InsertCard(node, tran))
                        {
                            Exception ex = new Exception("提交失败,原因:客户信息提交异常");
                            throw ex;
                        }
                    }

                    tran.Commit();
                    result.Result = true;
                    result.ErrMsg = "提交成功";
                }
                else
                {
                    result.Result = false;
                    result.ErrMsg = "提交失败,原因:基础信息提交异常";
                    BllBase.DeleteWorkFlowTask(NewID.ToString(), tran);
                    tran.Commit();
                }
                return(result);
            }
            catch (Exception ex)
            {
                tran.Rollback();
                tran.Dispose();
                try
                {
                    BllBase.DeleteWorkFlowTask(NewID.ToString());
                }
                catch (Exception ex2)
                {
                }
                result.Result = false;
                result.ErrMsg = ex.Message;
                return(result);
            }
            finally
            {
                con.Close();
            }
        }
        public Object GetQualityOrder(long PageIndex, long PageSize, string OrderNo,
            string WorkProcedure, string BatchNo, string Model, string EquipmentNo,
            string FeedbackMan, string StartTime, string EndTime, string Status)
        {
            using (SqlConnection con = new SqlConnection(_ConString))
            {
                try
                {
                    OrderNo = IsNull(OrderNo);WorkProcedure = IsNull(WorkProcedure);
                    BatchNo = IsNull(BatchNo);Model = IsNull(Model);
                    EquipmentNo = IsNull(EquipmentNo);FeedbackMan = IsNull(FeedbackMan);
                    StartTime = IsNull(StartTime);EndTime = IsNull(EndTime);
                    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 != "" &&  EndTime != "" )
                    {
                        strWhere += " and FeedbackTime between '" + StartTime + "' and '" + EndTime + " 23:59:59'";
                    }
                    if (Status == "T1")
                    {
                        //待处理
                        strWhere += " and Status!='P' ";
                    }
                    else if (Status == "P")
                    {
                        //已完成
                        strWhere += " and Status='P' ";
                    }
                    else if (Status == "B")
                    {
                        //待审批
                        strWhere += " and Status='B'";
                    }
                    BllApprovalStream Bll = new BllApprovalStream(con);
                    FeedbackBaseService BllBase = new FeedbackBaseService(con);
                    FeedbackExReasonService BllReason = new FeedbackExReasonService(con);
                    FeedbackExProblemService BllPro = new FeedbackExProblemService(con);
                    BllProductCard BllCard = new BllProductCard(con);
                    List<ReturnData> RequestList = new List<ReturnData>();
                    long RowCount = 0, PageCount = 0;
                    List<FeedbackBase> BaseList = BllBase.GetQualityOrder(PageIndex,PageSize,strWhere,out RowCount);

                    foreach(var node in BaseList)
                    {
                        ReturnData Request = new ReturnData();
                        //①基础信息
                        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.ProductClass = node.ProductClass;
                        //②原因信息
                        Request.ReasonList = BllReason.GetReasonByWhere(" where OrderNo='" + Request_OrderNo + "'");
                        //③问题
                        List<FeedbackExProblem> ProList = BllPro.GetProblemByWhere("  where OrderNo = '" + Request_OrderNo + "'");
                        Request.ProblemList = GetProblemList(ProList, con);
                        //④处理
                        Request.ApStream = Bll.GetStream(" where OrderNo='" + node.OrderNo + "'");
                        //⑤客户列表
                        Request.CardList = BllCard.GetCard(" where FKOrderNo='" + node.OrderNo + "'");
                        Request.RowCount = RowCount;
                        RequestList.Add(Request);
                    }
                    return RequestList;
                }
                catch (Exception ex)
                {
                    throw;
                }
            }
        }
Exemplo n.º 5
0
        public Object GetOrderInfo(long PageIndex, long PageSize, string OrderNo,
                                   string WorkProcedure, string BatchNo, string Model, string EquipmentNo,
                                   string FeedbackMan, string StartTime, string EndTime, string Status, int OrderType)
        {
            OrderNo       = OrderNo != null ? OrderNo : "";
            WorkProcedure = WorkProcedure != null ? WorkProcedure : "";
            BatchNo       = BatchNo != null ? BatchNo : "";
            Model         = Model != null ? Model : "";
            EquipmentNo   = EquipmentNo != null ? EquipmentNo : "";;
            FeedbackMan   = FeedbackMan != null ? FeedbackMan : "";
            StartTime     = StartTime != null ? StartTime : "";
            EndTime       = EndTime != null ? EndTime : "";
            Status        = Status != null ? Status : "";
            string strWhere = @"   OrderNo like '%{0}%' and isnull(WorkProcedure,'') like
 '%{1}%' and isnull(BatchNo,'') like '%{2}%' and isnull(Model,'') like '%{3}%' and  isnull(EquipmentNo,'') like '%{4}%' and isnull(FeedbackMan,'') like '%{5}%'  ";

            strWhere = string.Format(strWhere, OrderNo, WorkProcedure, BatchNo, Model, EquipmentNo, FeedbackMan);
            if (StartTime != "" & EndTime != "")
            {
                strWhere += " and FeedbackTime between '" + StartTime + "' and '" + EndTime + " 23:59:59'";
            }

            /*
             *  Status表示订单状态,该值存在以下几种情况: Null:全部,E:待处理;W:待确认;T:处理中;P:已完成;B:已退单;
             *  W状态下:b.Status=0&&b.StepID=私有公共变量WaitConfirmStepID
             *  E状态下: b.Status=0&&b.StepID=私有公共变量WaitHandleStepID,即QC所在步骤StepID
             *  T状态下: b.Status=0
             *  P状态下:b.Status=2
             *  B状态下:b.Status=3
             */
            switch (Status)
            {
            case "E":
                strWhere += @" and (b.Status=0 and b.StepID='" + WaitHandleStepID + "')";
                break;

            case "W":
                strWhere += @" and (b.Status=0 and b.StepID='" + WaitConfirmStepID + "')";
                break;

            case "T":
                strWhere += @" and (b.Status=0)";
                break;

            case "P":
                strWhere += @" and (b.Status=2)";
                break;

            case "B":
                strWhere += @" and (b.Status=3)";
                break;

            default:
                break;
            }
            strWhere += " and OrderType=" + OrderType + "  ";
            using (SqlConnection con = new SqlConnection(conString))
            {
                try
                {
                    BllApprovalStream        BllStream = new BllApprovalStream(con);
                    FeedbackBaseService      BllBase = new FeedbackBaseService(con);
                    FeedbackExReasonService  BllReason = new FeedbackExReasonService(con);
                    FeedbackExProblemService BllPro = new FeedbackExProblemService(con);
                    BllProductCard           BllCard = new BllProductCard(con);
                    long RowCount = 0, PageCount = 0;
                    List <FeedbackBase> BaseList  = BllBase.GetOrderByWorkFlowTaskOnPage(PageIndex, PageSize, strWhere, out RowCount);
                    List <OrderInfo>    OrderList = new List <OrderInfo>();
                    if (BaseList != null && BaseList.Count > 0)
                    {
                        foreach (var node in BaseList)
                        {
                            OrderInfo Item = new OrderInfo();
                            //①基础信息
                            Item.OrderNo       = node.OrderNo;
                            Item.BatchNo       = node.BatchNo;
                            Item.Model         = node.Model;
                            Item.Qty           = node.Qty;
                            Item.ProductClass  = node.ProductClass;
                            Item.WorkProcedure = node.WorkProcedure;
                            Item.EquipmentName = node.EquipmentName;
                            Item.EquipmentNo   = node.EquipmentNo;
                            Item.FeedbackMan   = node.FeedbackMan;
                            Item.FeedbackTime  = node.FeedbackTime.ToString("yyyy-MM-dd HH:mm");
                            Item.ProblemLevel  = node.ProblemLevel;
                            Item.Report        = node.Report;
                            Item.Measure       = node.Measure;
                            //Item.Status= node.Status;
                            Item.Status     = node.ProvalStatus.ToString();
                            Item.EmployeeID = node.EmployeeID;
                            Item.StepID     = node.StepID;
                            Item.StepName   = node.StepName;
                            Item.ID         = (node.ID).ToString();
                            Item.PrevStatus = node.PrevStatus;
                            Item.IsControl  = node.IsControl;
                            Item.ImageList  = node.ImageList;



                            //②质量问题
                            List <FeedbackExProblem> Problem      = BllPro.GetProblemByWhere(" where OrderNo='" + node.OrderNo + "'");
                            List <OrderProblem>      OrderProblem = new List <OrderProblem>();
                            foreach (var list in Problem)
                            {
                                OrderProblem Obj_Problem = new OrderProblem();
                                Obj_Problem.codeString     = list.CodeString;
                                Obj_Problem.topClass       = list.TopClass;
                                Obj_Problem.roomName       = list.RoomName;
                                Obj_Problem.typeName       = list.TypeName;
                                Obj_Problem.present        = list.Present;
                                Obj_Problem.problem        = list.Problem;
                                Obj_Problem.suggestion     = list.Suggestion;
                                Obj_Problem.problemDetails = list.ProblemDetails;
                                Obj_Problem.qualityClass   = list.QualityClass;
                                Obj_Problem.problemLevel   = list.ProblemLevel;
                                OrderProblem.Add(Obj_Problem);
                            }
                            Item.ProblemData = OrderProblem;
                            //③原因分析
                            List <FeedbackExReason> Reason      = BllReason.GetReasonByWhere(" where OrderNo='" + node.OrderNo + "'");
                            List <OrderReason>      OrderReason = new List <OrderController.OrderReason>();
                            foreach (var list in Reason)
                            {
                                OrderReason Obj_Reason = new OrderReason();
                                Obj_Reason.reasonType    = list.ReasonType;
                                Obj_Reason.reasonDetails = list.ReasonDetails;
                                Obj_Reason.orderNo       = list.OrderNo;
                                OrderReason.Add(Obj_Reason);
                            }
                            Item.ReasonData = OrderReason;
                            //④客户信息
                            Item.CardList = BllCard.GetCard(" where FKOrderNo='" + node.OrderNo + "' and CardNo <>''");
                            //⑤反馈单处理意见
                            Item.ApprovalStream = BllStream.GetStream(" where OrderNo='" + node.OrderNo + "' and StreamType=0");
                            if (OrderType == 1)
                            {
                                //⑥控制表处理意见
                                Item.ControlStream = BllStream.GetStream(" where OrderNo='" + node.OrderNo + "' and StreamType=1");
                            }
                            Item.RowCount = RowCount;
                            OrderList.Add(Item);
                        }
                    }
                    return(OrderList);
                }
                catch (Exception ex)
                {
                    string ErrMsg = ex.Message;
                    return("");
                }
                finally
                {
                    if (con.State != ConnectionState.Closed)
                    {
                        con.Close();
                    }
                }
            }
        }