Пример #1
0
        List<ProductCollect_Info> IProductCollectBL.GetShiftProjectSummary(ProductCollect_Info oInfo)
        {
            List<ProductCollect_Info> resultList = new List<ProductCollect_Info>();

            try
            {
                NHibernateTransaction.DBContext trans = new NHibernateTransaction.DBContext();

                ShiftTypeMaster_stm_Info shiftType = (from stm in trans.CurrentSession.QueryOver<ShiftTypeMaster_stm_Info>()
                                                      where stm.stm_iRecordID == oInfo.ShiftTypeID
                                                      select stm).SingleOrDefault<ShiftTypeMaster_stm_Info>();

                DateTime nextDate = oInfo.SearchDate.AddDays(1);
                var oResult = from spl in trans.CurrentSession.QueryOver<ShiftProjList_spl_Info>().Where(d => d.spl_dBeginTime >= oInfo.SearchDate && d.spl_dBeginTime < nextDate).List()
                              join ppj in trans.CurrentSession.QueryOver<PrintProject_ppj_Info>().List() on spl.spl_PPJID equals ppj.ppj_RecordID
                              join swl in trans.CurrentSession.QueryOver<ScheduleProjList_swl_Info>().List() on ppj.ppj_SWLID equals swl.swl_RecordID
                              join sifo in trans.CurrentSession.QueryOver<ShiftInfo_sifo_Info>().List() on spl.spl_SIFOID equals sifo.sifo_RecordID
                              orderby spl.spl_dBeginTime
                              select new ProductCollect_Info
                              {

                                  SONO = swl.swl_cSONO,
                                  ItemNO = swl.swl_cItemNO,
                                  ProdName = swl.swl_cProdName,
                                  ItemName = swl.swl_cItemName,
                                  Edition=swl.swl_cEdition,
                                  SheetProdQty=swl.swl_iSheetProdQty,
                                  PlanProdQty=swl.swl_iPlanProdQty,
                                  ActualProdNum=spl.spl_iQTY,
                                  CountDefectiveQty=spl.spl_iDefectiveQty,
                                  CountWastNum=spl.spl_iWastQTY,
                                  QualifiedNum=spl.spl_iQTY-spl.spl_iWastQTY-spl.spl_iDefectiveQty,
                                  BeginTime = spl.spl_dBeginTime,
                                  EndTime = spl.spl_dEndTime,
                                  ProjRunTime = spl.spl_iRunTime,
                                  StopTime = spl.spl_iStopTime,
                                  ActualPrepairTime = spl.spl_iPrepairTime,
                                  NextGroup=swl.swl_cNextGroup,
                                  NextArea=swl.swl_cNextArea,
                                  ShiftTypeID=sifo.sifo_iSTMID,
                                  ProdDate = sifo.sifo_dProdDate,
                                  MachineNO = swl.swl_cMachineNO

                              };

                if (shiftType == null)
                {
                    oResult = oResult.Where(d => d.BeginTime >= oInfo.SearchDate.Date && d.EndTime == null ? true : d.EndTime <= oInfo.SearchDate.Date.AddDays(1));
                }
                else
                {
                    oResult = oResult.Where(d => d.ShiftTypeID == oInfo.ShiftTypeID);
                }
                oResult = oResult.Where(d => d.ProdDate == oInfo.SearchDate);
                oResult = oResult.Where(d => d.MachineNO == oInfo.MachineNO);
                if (oResult != null)
                {
                    int indexNum = 1;
                    foreach (ProductCollect_Info oEarchResult in oResult)
                    {
                        oEarchResult.Index = indexNum;
                        resultList.Add(oEarchResult);
                        indexNum++;
                    }
                }

                return resultList;

            }
            catch (Exception ex)
            {

                mLogger.Error(ex);
            }
            return resultList;
        }
Пример #2
0
        List<ProductCollect_Info> IProductCollectBL.SearchRecord(ProductCollect_Info oInfo)
        {
            List<ProductCollect_Info> oReturn = mProductCollectDA.SearchRecord(oInfo);

            int indexvalue = 1;
            foreach (ProductCollect_Info oEarchRecord in oReturn)
            {
                oEarchRecord.Index = indexvalue;
                indexvalue++;
            }

            return oReturn;
        }