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;
                }
            }
        }
Пример #2
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();
                    }
                }
            }
        }