Пример #1
0
        /// <summary>
        /// 為品檢記錄添加一個品檢問題記錄
        /// </summary>
        /// <param name="qcRecord">品檢記錄</param>
        /// <param name="WasteQty">廢品數量</param>
        /// <param name="DefectiveQty">次品數量</param>
        /// <param name="ProblemID">問題ID</param>
        private void AddQCIssueRecord(ProjectQCRecord qcRecord, int WasteQty, int DefectiveQty, int ProblemID)
        {
            int iMaxSeq = 0;
            if (qcRecord.QCProblems == null)
            {
                qcRecord.QCProblems = new List<ProjectQCRecordProblem>();
            }
            else
            {
                if (qcRecord.QCProblems.Count > 0)
                {
                    ProjectQCRecordProblem emptyProblem = qcRecord.QCProblems.Where(x => x.RecordID == Guid.Empty).FirstOrDefault();
                    if (emptyProblem != null)
                    {
                        qcRecord.QCProblems.Remove(emptyProblem);
                    }

                    ProjectQCRecordProblem problemOrderByMax = qcRecord.QCProblems.OrderByDescending(x => x.pqcp_iSeq).FirstOrDefault();
                    if (problemOrderByMax != null)
                    {
                        iMaxSeq = problemOrderByMax.pqcp_iSeq + 1;
                    }
                    else
                    {
                        iMaxSeq = 1;
                    }
                }
                else
                {
                    iMaxSeq = 1;
                }
            }
            ProjectQCRecordProblem problem = new ProjectQCRecordProblem();
            problem.RecordID = Guid.NewGuid();
            problem.pqcp_iWasteQty = WasteQty;
            problem.pqcp_iDefectiveQty = DefectiveQty;
            problem.pqcp_iProblemID = ProblemID;
            problem.pqcp_iSeq = iMaxSeq;
            problem.RecordEditStatus = 1;
            qcRecord.QCProblems.Add(problem);
        }
Пример #2
0
 /// <summary>
 /// 為品檢記錄添加一個空的品檢問題記錄
 /// </summary>
 /// <param name="qcRecord">品檢記錄</param>
 private void AddEmptyQCIssueRecord(ProjectQCRecord qcRecord)
 {
     if (qcRecord.QCProblems == null)
     {
         qcRecord.QCProblems = new List<ProjectQCRecordProblem>();
     }
     ProjectQCRecordProblem problem = new ProjectQCRecordProblem();
     problem.RecordID = Guid.Empty;
     problem.pqcp_iDefectiveQty = 0;
     problem.pqcp_iProblemID = -1;
     problem.pqcp_iSeq = 1;
     problem.pqcp_iWasteQty = 0;
     problem.RecordEditStatus = 1;
     qcRecord.QCProblems.Add(problem);
 }