Пример #1
0
        //public ReturnValueInfo DeleteRecord_Sqlite(ProjectQCRecord_pqc_Info model)
        //{
        //    using (DBContext uow = DBContext.Begin())
        //    {
        //        try
        //        {
        //            ReturnValueInfo rvInfo = new ReturnValueInfo();
        //            //ReturnValueInfo rvInfoRecord = new ReturnValueInfo();
        //            if (model.ListProblemRecords != null)
        //            {
        //                foreach (ProjectQCProblem_pqcp_Info problemItem in model.ListProblemRecords)
        //                {
        //                    uow.CurrentSession.Delete(problemItem);
        //                }
        //            }
        //            //rvInfoRecord = this._IProjectQCRecordDA_Sqlite.Delete(model);
        //            //if (!rvInfoRecord.boolValue || rvInfoRecord.isError)
        //            //{
        //            //    return rvInfoRecord;
        //            //}
        //            rvInfo.boolValue = true;
        //            return rvInfo;
        //        }
        //        catch (Exception ex)
        //        {
        //            throw ex;
        //        }
        //    }
        //}
        public bool AddQCBlankRecord(ProjectQCRecord_pqc_Info pqcRecord, CustEnum.RecordType recordType)
        {
            try
            {
                using (DBContext uow = DBContext.Begin())
                {
                    int maxRecord = 0;
                    QCPloblemView_qcpv_Info lastRec = uow.CurrentSession.QueryOver<QCPloblemView_qcpv_Info>().And(d => d.pqc_SPLID == pqcRecord.pqc_SPLID).OrderBy(d => d.pqc_iQCTimes).Desc.Take(1).SingleOrDefault();
                    if (lastRec != null)
                    {
                        maxRecord = lastRec.pqc_iQCTimes;
                    }

                    ProjectQCRecord_pqc_Info pqc = new ProjectQCRecord_pqc_Info();
                    pqc.pqc_RecordID = Guid.NewGuid();
                    pqc.pqc_iQCQTY = 0;
                    pqc.pqc_iProdQTY = pqcRecord.pqc_iProdQTY;
                    pqc.pqc_iQCTimes = maxRecord + 1;
                    pqc.pqc_cMode = CustEnum.RecordMode.MANUAL.ToString();
                    pqc.pqc_cType = recordType.ToString();
                    pqc.pqc_dAddDate = DateTime.Now;
                    pqc.pqc_SPLID = pqcRecord.pqc_SPLID;
                    uow.CurrentSession.Save(pqc);

                    uow.CurrentSession.CreateQuery("update ShiftProjList_spl_Info set spl_iQCTimes=:spl_iQCTimes where spl_RecordID=:spl_RecordID").SetInt32("spl_iQCTimes", pqc.pqc_iQCTimes).SetGuid("spl_RecordID", pqcRecord.pqc_SPLID).ExecuteUpdate();

                    uow.CurrentSession.Flush();
                    return true;
                }

            }
            catch (Exception ex)
            {

                return false;
                throw ex;
            }
        }
Пример #2
0
 public ReturnValueInfo UpdateRecord(ProjectQCRecord_pqc_Info model)
 {
     throw new NotImplementedException();
 }
Пример #3
0
        public ReturnValueInfo QCPass(ProjectQCRecord_pqc_Info pqc, PrintProject_ppj_Info project, ShiftProjList_spl_Info shiftProject)
        {
            ReturnValueInfo result = new ReturnValueInfo();

            try
            {
                if (pqc == null || pqc.pqc_iQCQTY == 0)
                {
                    result.boolValue = false;
                    result.messageText = "抽查數量不能為零。";
                    return result;
                }
                else
                {
                    if (pqc.pqc_SPLID == null || pqc.pqc_SPLID == Guid.Empty)
                    {
                        result.boolValue = false;
                        result.messageText = "抽查數量不能為零。";
                        return result;
                    }

                    using (DBContext uow = DBContext.Begin())
                    {

                        ProjectQCRecord_pqc_Info pqc_old = uow.CurrentSession.Get<ProjectQCRecord_pqc_Info>(pqc.pqc_RecordID);
                        pqc_old.pqc_iQCQTY = pqc.pqc_iQCQTY;
                        pqc_old.pqc_dLastDate = DateTime.Now;
                        pqc_old.pqc_dQCEndTime = DateTime.Now;
                        uow.CurrentSession.Update(pqc_old);
                        //CountSPLQCInfo(uow, project, shiftProject);

                    }

                    result.boolValue = true;
                }
            }
            catch (Exception ex)
            {
                result.boolValue = false;
                result.messageText = ex.Message;
            }

            return result;
        }
Пример #4
0
 public List<ProjectQCRecord_pqc_Info> SearchRecord(ProjectQCRecord_pqc_Info searchInfo)
 {
     throw new NotImplementedException();
 }
Пример #5
0
        /// <summary>
        /// 開始QC
        /// </summary>
        /// <returns></returns>
        public ReturnValueInfo QCBegin(ProjectQCRecord_pqc_Info pqc)
        {
            ReturnValueInfo result = new ReturnValueInfo();

            try
            {
                if (pqc.pqc_SPLID == Guid.Empty)
                {
                    result.boolValue = false;
                    result.messageText = "QC記錄沒有設置班次內工程ID,不能開始QC。";
                    return result;
                }
                if (pqc.pqc_dQCEndTime != null)
                {
                    result.boolValue = false;
                    result.messageText = "QC記錄已結束,不能開始。";
                }
                else
                {

                    using (DBContext uow = DBContext.Begin())
                    {

                        ProjectQCRecord_pqc_Info pqc_old = uow.CurrentSession.Get<ProjectQCRecord_pqc_Info>(pqc.pqc_RecordID);

                        if (pqc.pqc_RecordID == Guid.Empty)
                        {
                            pqc_old.pqc_RecordID = Guid.NewGuid();
                            pqc_old.pqc_dAddDate = DateTime.Now;

                        }
                        pqc_old.pqc_dLastDate = DateTime.Now;
                        if (pqc.pqc_dQCBeginTime == null)
                        {
                            pqc_old.pqc_dQCBeginTime = DateTime.Now;
                            pqc_old.pqc_iProdQTY = pqc.pqc_iProdQTY;
                        }
                        pqc_old.pqc_iQCQTY = pqc.pqc_iQCQTY;
                        uow.CurrentSession.SaveOrUpdate(pqc_old);

                    }
                    result.boolValue = true;
                }

            }
            catch (Exception ex)
            {
                result.boolValue = false;
                result.messageText = ex.Message;
            }

            return result;
        }