/// <summary>
 /// 工程生產數據查詢
 /// </summary>
 /// <param name="searchCondition">查詢條件</param>
 /// <returns></returns>
 public override List<ProjectProductionDataInfo_Query> SearchProjectProductionDatas(ProjectProductionDataInfo_Query_Search searchCondition)
 {
     try
     {
         List<ProjectProductionDataInfo_Query> lst = null;
         ProjectProductionDataQueryBLL bll = new ProjectProductionDataQueryBLL();
         lst = bll.SearchProjectProductionDatas(searchCondition);
         return lst;
     }
     catch (Exception ex)
     {
         this.OnException(mc_strClassName, "SearchProjectProductionDatas", ex.Message);
         throw;
     }
 }
        /// <summary>
        /// 工程生產數據查詢
        /// </summary>
        /// <param name="searchCondition">查詢條件</param>
        /// <returns></returns>
        public List<ProjectProductionDataInfo_Query> SearchProjectProductionDatas(ProjectProductionDataInfo_Query_Search searchCondition)
        {
            try
            {
                List<ProjectProductionDataInfo_Query> lst = new List<ProjectProductionDataInfo_Query>();

                string l_strSQL = string.Empty;
                string l_strWhere = string.Empty;

                if (!string.IsNullOrEmpty(searchCondition.SearchMachineID))
                {
                    l_strWhere += " And ppj.ppj_cMachineNO = '" + Common.General.HandleSqlSingle(searchCondition.SearchMachineID) + "' " + Environment.NewLine;
                }
                if (!string.IsNullOrEmpty(searchCondition.SearchProjectNO))
                {
                    l_strWhere += " And swl.swl_cProjectNO like '" + Common.General.HandleSqlSingle(searchCondition.SearchProjectNO) + "%' " + Environment.NewLine;
                }
                if (!string.IsNullOrEmpty(searchCondition.SearchSONO))
                {
                    l_strWhere += " And swl.swl_cSONO like '" + Common.General.HandleSqlSingle(searchCondition.SearchSONO) + "%' " + Environment.NewLine;
                }
                if (!string.IsNullOrEmpty(searchCondition.SearchItemNO))
                {
                    l_strWhere += " And swl.swl_cItemNO like '" + Common.General.HandleSqlSingle(searchCondition.SearchItemNO) + "%' " + Environment.NewLine;
                }
                if (!string.IsNullOrEmpty(searchCondition.SearchProdName))
                {
                    l_strWhere += " And swl.swl_cProdName like '" + Common.General.HandleSqlSingle(searchCondition.SearchProdName) + "%' " + Environment.NewLine;
                }
                if (!string.IsNullOrEmpty(searchCondition.SearchItemName))
                {
                    l_strWhere += " And swl.swl_cItemName like '" + Common.General.HandleSqlSingle(searchCondition.SearchItemName) + "%' " + Environment.NewLine;
                }
                if (!string.IsNullOrEmpty(searchCondition.SearchProjStatus))
                {
                    l_strWhere += " And swl.swl_cProjStatus = '" + Common.General.HandleSqlSingle(searchCondition.SearchProjStatus) + "' " + Environment.NewLine;
                }
                if (searchCondition.SearchDateBegin != DateTime.MinValue)
                {
                    l_strWhere += " And ppj.ppj_dProjBeginTime >= " + Common.General.HandleSqlFormatDateTime(searchCondition.SearchDateBegin) + " " + Environment.NewLine;
                }
                if (searchCondition.SearchDateEnd != DateTime.MinValue)
                {
                    l_strWhere += " And ppj.ppj_dProjBeginTime <= " + Common.General.HandleSqlFormatDateTime(searchCondition.SearchDateEnd.AddDays(1)) + " " + Environment.NewLine;
                }

                l_strSQL = l_strSQL + " Select" + Environment.NewLine;
                l_strSQL = l_strSQL + " cProjectNO = swl.swl_cProjectNO," + Environment.NewLine;
                l_strSQL = l_strSQL + " cSONO = swl.swl_cSONO," + Environment.NewLine;
                l_strSQL = l_strSQL + " cRefSONo = ''," + Environment.NewLine;
                l_strSQL = l_strSQL + " cDCSheetNO = swl.swl_cItemNO," + Environment.NewLine;
                l_strSQL = l_strSQL + " cProductDesc = swl.swl_cProdName," + Environment.NewLine;
                l_strSQL = l_strSQL + " cDCSheetName = swl.swl_cItemName," + Environment.NewLine;
                l_strSQL = l_strSQL + " cProductType =swl.swl_cNature," + Environment.NewLine;
                l_strSQL = l_strSQL + " cEditionDesc = swl.swl_cEdition," + Environment.NewLine;
                l_strSQL = l_strSQL + " iSheetProdQty = swl.swl_iSheetProdQty," + Environment.NewLine;
                l_strSQL = l_strSQL + " iPlanProdQty = swl.swl_iPlanProdQty," + Environment.NewLine;
                l_strSQL = l_strSQL + " iRealYield = ppj.ppj_iActualProdNum," + Environment.NewLine;
                l_strSQL = l_strSQL + " iWADQTY = 0," + Environment.NewLine;
                l_strSQL = l_strSQL + " iAccountWastageQty = 0," + Environment.NewLine;
                l_strSQL = l_strSQL + " iAccountDefectiveQty = ppj.ppj_iCountDefectiveQty," + Environment.NewLine;
                l_strSQL = l_strSQL + " iAccountWasteQty = ppj.ppj_iCountWastNum," + Environment.NewLine;
                l_strSQL = l_strSQL + " iFrontProcessDefectiveQty = 0," + Environment.NewLine;
                l_strSQL = l_strSQL + " iAccountEligibleQty = ppj.ppj_iActualProdNum - ppj.ppj_iCountDefectiveQty - ppj.ppj_iCountWastNum," + Environment.NewLine;
                //Begin Add By DonaldHuang 03/11/2015
                //紙袋
                l_strSQL = l_strSQL + " cPaperBagName = swl.swl_cPaperBagName," + Environment.NewLine;
                l_strSQL = l_strSQL + " cPaperBagModel = swl.swl_cPaperBagModel," + Environment.NewLine;
                l_strSQL = l_strSQL + " fPaperBagSizeW = swl.swl_fPaperBagSizeW," + Environment.NewLine;
                l_strSQL = l_strSQL + " fPaperBagSizeH = swl.swl_fPaperBagSizeH," + Environment.NewLine;
                l_strSQL = l_strSQL + " fPaperBagSizeG = swl.swl_fPaperBagSizeG," + Environment.NewLine;
                l_strSQL = l_strSQL + " cPaperBagSizeUnit = swl.swl_cPaperBagSizeUnit," + Environment.NewLine;
                l_strSQL = l_strSQL + " cPaperBagQuality = swl.swl_cPaperBagQuality," + Environment.NewLine;
                //End Add By DonaldHuang 03/11/2015

                l_strSQL = l_strSQL + " dBeginTime = ppj.ppj_dProjBeginTime," + Environment.NewLine;
                l_strSQL = l_strSQL + " dProductBeginTime = ppj.ppj_dProdBeginTime," + Environment.NewLine;
                l_strSQL = l_strSQL + " dEndTime = ppj.ppj_dProdEndTime," + Environment.NewLine;
                l_strSQL = l_strSQL + " cTotalRunTime = ''," + Environment.NewLine;
                l_strSQL = l_strSQL + " cTotalStopTime = ''," + Environment.NewLine;
                l_strSQL = l_strSQL + " cTotalReadyTime = ''," + Environment.NewLine;
                l_strSQL = l_strSQL + " iProjRunTime = ppj.ppj_iProjRunTime," + Environment.NewLine;
                l_strSQL = l_strSQL + " iStopTime = ppj.ppj_iStopTime," + Environment.NewLine;
                l_strSQL = l_strSQL + " iActualPrepairTime = ppj.ppj_iActualPrepairTime" + Environment.NewLine;
                l_strSQL = l_strSQL + " From PrintProject_ppj ppj" + Environment.NewLine;
                l_strSQL = l_strSQL + " Inner join ScheduleProjList_swl swl on ppj.ppj_SWLID = swl.swl_RecordID" + Environment.NewLine;

                if (l_strWhere != "")
                {
                    l_strSQL = l_strSQL + " Where 1=1 " + l_strWhere + Environment.NewLine;
                }

                l_strSQL = l_strSQL + " Order By ppj.ppj_dProjBeginTime" + Environment.NewLine;

                using (IDataReader dataReader = DbHelperSQL.ExecuteReader(l_strSQL))
                {
                    while (dataReader.Read())
                    {
                        ProjectProductionDataInfo_Query model = new ProjectProductionDataInfo_Query();
                        object ojb;
                        model.cProjectNO = dataReader["cProjectNO"].ToString();
                        model.cSONO = dataReader["cSONO"].ToString();
                        model.cRefSONo = "";
                        model.cDCSheetNO = dataReader["cDCSheetNO"].ToString();
                        model.cProductDesc = dataReader["cProductDesc"].ToString();
                        model.cDCSheetName = dataReader["cDCSheetName"].ToString();
                        model.cProductType = dataReader["cProductType"].ToString();
                        model.cEditionDesc = dataReader["cEditionDesc"].ToString();
                        //Begin Add By DonaldHuang 03/11/2015
                        model.cPaperBagName = dataReader["cPaperBagName"].ToString();
                        model.cPaperBagModel = dataReader["cPaperBagModel"].ToString();
                        model.fPaperBagSizeW = float.Parse(dataReader["fPaperBagSizeW"].ToString());
                        model.fPaperBagSizeH = float.Parse(dataReader["fPaperBagSizeH"].ToString());
                        model.fPaperBagSizeG = float.Parse(dataReader["fPaperBagSizeG"].ToString());
                        model.cPaperBagSizeUnit = dataReader["cPaperBagSizeUnit"].ToString();
                        model.cPaperBagQuality = dataReader["cPaperBagQuality"].ToString();
                        //End Add By DonaldHuang 03/11/2015

                        ojb = dataReader["iSheetProdQty"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.iSheetProdQty = (int)ojb;
                        }
                        ojb = dataReader["iPlanProdQty"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.iPlanProdQty = (int)ojb;
                        }
                        ojb = dataReader["iRealYield"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.iRealYield = (int)ojb;
                        }
                        model.iWADQTY = 0;
                        model.iAccountWastageQty = 0;
                        ojb = dataReader["iAccountDefectiveQty"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.iAccountDefectiveQty = (int)ojb;
                        }
                        ojb = dataReader["iAccountWasteQty"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.iAccountWasteQty = (int)ojb;
                        }
                        model.iFrontProcessDefectiveQty = 0;
                        ojb = dataReader["iAccountEligibleQty"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.iAccountEligibleQty = (int)ojb;
                        }
                        ojb = dataReader["dBeginTime"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.dBeginTime = (DateTime)ojb;
                        }
                        ojb = dataReader["dProductBeginTime"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.dProductBeginTime = (DateTime)ojb;
                        }
                        ojb = dataReader["dEndTime"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.dEndTime = (DateTime)ojb;
                        }

                        ojb = dataReader["iProjRunTime"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.iProjRunTime = (int)ojb;
                            model.cTotalRunTime = Common.Util.DateUtil.Convert(model.iProjRunTime.Value);
                        }
                        else
                        {
                            model.cTotalRunTime = "";
                        }

                        ojb = dataReader["iStopTime"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.iStopTime = (int)ojb;
                            model.cTotalStopTime = Common.Util.DateUtil.Convert(model.iStopTime.Value);
                        }
                        else
                        {
                            model.cTotalStopTime = "";
                        }

                        ojb = dataReader["iActualPrepairTime"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.iActualPrepairTime = (int)ojb;
                            model.cTotalReadyTime = Common.Util.DateUtil.Convert(model.iActualPrepairTime.Value);
                        }
                        else
                        {
                            model.cTotalReadyTime = "";
                        }

                        lst.Add(model);
                    }
                    dataReader.Close();
                }

                int indexvalue = 1;
                foreach (ProjectProductionDataInfo_Query oEarchRecord in lst)
                {
                    oEarchRecord.iIndex = indexvalue;
                    indexvalue++;
                }

                return lst;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #3
0
        private ProjectProductionDataInfo_Query_Search GetSearchInfo()
        {
            ProjectProductionDataInfo_Query_Search oReturn = new ProjectProductionDataInfo_Query_Search();

            if (this.m_frmProjectCommonQueryBase.ComboBoxMachines.Text != "")
            {
                oReturn.SearchMachineID = this.m_frmProjectCommonQueryBase.ComboBoxMachines.SelectedValue.ToString();
            }

            if (this.m_frmProjectCommonQueryBase.TextBoxProjectNo.Text.Trim() != "")
            {
                oReturn.SearchProjectNO = this.m_frmProjectCommonQueryBase.TextBoxProjectNo.Text.Trim();
            }

            if (this.m_frmProjectCommonQueryBase.TextBoxSONo.Text.Trim() != "")
            {
                oReturn.SearchSONO = this.m_frmProjectCommonQueryBase.TextBoxSONo.Text.Trim();
            }

            if (this.m_frmProjectCommonQueryBase.TextBoxItemNo.Text.Trim() != "")
            {
                oReturn.SearchItemNO = this.m_frmProjectCommonQueryBase.TextBoxItemNo.Text.Trim();
            }
            if (this.m_frmProjectCommonQueryBase.TextBoxProdName.Text.Trim() != "")
            {
                oReturn.SearchProdName = this.m_frmProjectCommonQueryBase.TextBoxProdName.Text.Trim();
            }
            if (this.m_frmProjectCommonQueryBase.TextBoxItemName.Text.Trim() != "")
            {
                oReturn.SearchItemName = this.m_frmProjectCommonQueryBase.TextBoxItemName.Text.Trim();
            }
            if (this.m_frmProjectCommonQueryBase.ComboBoxProdStatus.Text.Trim() != "")
            {
                oReturn.SearchProjStatus = this.m_frmProjectCommonQueryBase.ComboBoxProdStatus.SelectedValue.ToString();
            }
            if (this.m_frmProjectCommonQueryBase.DateTimePickerProdBeginMin.Checked == true)
            {
                oReturn.SearchDateBegin = this.m_frmProjectCommonQueryBase.DateTimePickerProdBeginMin.Value.Date;
            }
            if (this.m_frmProjectCommonQueryBase.DateTimePickerProdBeginMax.Checked == true)
            {
                oReturn.SearchDateEnd = this.m_frmProjectCommonQueryBase.DateTimePickerProdBeginMax.Value.Date;
            }

            return oReturn;
        }
 /// <summary>
 /// 工程生產數據查詢
 /// </summary>
 /// <param name="searchCondition">查詢條件</param>
 /// <returns></returns>
 public abstract List<ProjectProductionDataInfo_Query> SearchProjectProductionDatas(ProjectProductionDataInfo_Query_Search searchCondition);
 /// <summary>
 /// 工程生產數據查詢
 /// </summary>
 /// <param name="searchCondition">查詢條件</param>
 /// <returns></returns>
 public List<ProjectProductionDataInfo_Query> SearchProjectProductionDatas(ProjectProductionDataInfo_Query_Search searchCondition)
 {
     ProjectProductionDataQueryDAL dal = new ProjectProductionDataQueryDAL();
     return  dal.SearchProjectProductionDatas(searchCondition);
 }