public Object Get(string OrderNo, string BatchNo, string WorkProcedure, string StartTime, string EndTime) { string strWhere = ""; if (OrderNo == null) { OrderNo = ""; } if (BatchNo == null) { BatchNo = ""; } if (WorkProcedure == null) { WorkProcedure = ""; } strWhere = " where OrderNo not in (select OrderNo from ZL_FeedbackExHandle ) and OrderNo like '%" + OrderNo + "%' and BatchNo like '%" + BatchNo + "%'"; if (WorkProcedure != "") { strWhere += " and WorkProcedure='" + WorkProcedure + "'"; } if (StartTime != null && StartTime != "" && EndTime != null && EndTime != "") { strWhere += " and FeedbackTime between '" + StartTime + "' and '" + EndTime + " 23:59:59'"; } strWhere += " order by FeedbackTime desc"; using (SqlConnection sqlconnection = new SqlConnection(_connectionString)) { FeedbackBaseService bllBase = new FeedbackBaseService(sqlconnection); FeedbackExReasonService bllReason = new FeedbackExReasonService(sqlconnection); FeedbackExProblemService bllPro = new FeedbackExProblemService(sqlconnection); CodeService bllCode = new CodeService(sqlconnection); List <FeedbackBase> baseList = bllBase.GetOrderInfoByWhere(strWhere); List <FeedInfo> InfoList = new List <FeedInfo>(); if (baseList != null && baseList.Count > 0) { for (int i = 0; i < baseList.Count; i++) { FeedInfo info = new FeedInfo(); info.OrderNo = baseList[i].OrderNo; info.WorkProcedure = baseList[i].WorkProcedure; info.Model = baseList[i].Model; info.BatchNo = baseList[i].BatchNo; info.Qty = baseList[i].Qty; info.EquipmentName = baseList[i].EquipmentName; info.EquipmentNo = baseList[i].EquipmentNo; info.FeedbackMan = baseList[i].FeedbackMan; info.FeedbackTime = baseList[i].FeedbackTime.ToString("yyyy-MM-dd HH:mm"); List <FeedbackExReason> reason = bllReason.GetReasonByWhere(" where OrderNo='" + baseList[i].OrderNo + "'"); info.ReasonList = reason; List <FeedbackExProblem> problem = bllPro.GetProblemByWhere(" where OrderNo='" + baseList[i].OrderNo + "'"); List <Problem> problemList = new List <Problem>(); if (problem != null && problem.Count > 0) { for (int j = 0; j < problem.Count; j++) { Problem newProblem = new Problem(); string QualityClass = ""; string Suggestion = ""; string CodeString = problem[j].CodeString; Code code = bllCode.GetCodeByWhere(" where CodeString='" + CodeString + "'").FirstOrDefault(); newProblem.code = code; if (code != null) { QualityClass = code.QualityClass; Suggestion = code.Suggestion; } newProblem.QualityClass = QualityClass; newProblem.Suggestion = Suggestion; newProblem.CodeString = CodeString; newProblem.OrderNo = baseList[i].OrderNo; newProblem.PicturePath = problem[j].PicturePath; newProblem.ProblemDetails = problem[j].ProblemDetails; newProblem.ProblemID = problem[j].ProblemID; problemList.Add(newProblem); } } info.ProblemList = problemList; InfoList.Add(info); } } return(InfoList); } }
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(); } } } }
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; } } }
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(); } } } }