Esempio n. 1
0
        public void Search()
        {
            this._toDoProjectListBase.DataGridViewProjectSelect.AutoGenerateColumns = false;
            ScheduleProjectData cond = new ScheduleProjectData();
            #region 初始化查詢條件
            if (this._toDoProjectListBase.ComboBoxMachineSelect.SelectedValue != null)
            {
                cond.swl_cMachineNO = this._toDoProjectListBase.ComboBoxMachineSelect.SelectedValue.ToString();
                cond.swl_cPlanMachineNO = this._toDoProjectListBase.ComboBoxMachineSelect.SelectedValue.ToString();
            }

            cond.swl_cSONO = this._toDoProjectListBase.TextBoxSONO_search.Text.Trim();
            cond.swl_cItemNO = this._toDoProjectListBase.TextBoxItemNO_Search.Text.Trim();
            cond.swl_cProjectNO = this._toDoProjectListBase.TextBoxProjectNo_search.Text.Trim();
            cond.swl_cProdName = this._toDoProjectListBase.TextBoxProdName_search.Text.Trim();

            #endregion

            try
            {
                mProjectList = this._baseDataSynchronismManager.GetLocalScheduleProjectData(cond);

                this._toDoProjectListBase.PagingMain.SetDataSource<ScheduleProjectData>(mProjectList);
            }
            catch (Exception ex)
            {
                ShowErrorMessage(ErrorMessage.U0001, ex);
            }
        }
Esempio n. 2
0
 public void ShowProjectInfo(ScheduleProjectData scheduleProject)
 {
     if (scheduleProject != null)
     {
         this.txtcProjectNo.Text = scheduleProject.swl_cProjectNO;
         this.txtSONO.Text = scheduleProject.swl_cSONO;
         this.txtItemNO.Text = scheduleProject.swl_cItemNO;
         this.txtEdition.Text = scheduleProject.swl_cEdition;
         this.txtItemName.Text = scheduleProject.swl_cItemName;
         this.txtProductName.Text = scheduleProject.swl_cProdName;
     }
 }
Esempio n. 3
0
 public void StartProject(ScheduleProjectData scheduleProject)
 {
     if (this.InvokeRequired)
     {
         ShowProjectInfoDelegate show = new ShowProjectInfoDelegate(ShowProjectInfo);
         this.Invoke(show, new object[] { scheduleProject });
     }
     else
     {
         this.ShowProjectInfo(scheduleProject);
     }
 }
Esempio n. 4
0
 private void ShowScheProj(ScheduleProjectData swl)
 {
     this._toDoProjectListBase.TextBoxSONo.Text = swl.swl_cSONO; //銷售單編號
     this._toDoProjectListBase.TextBoxItemQty.Text = swl.swl_iSheetProdQty.ToString();    //印張數量
     this._toDoProjectListBase.TextBoxPlanQty.Text = swl.swl_iPlanProdQty.ToString();      //預計生產數量
     this._toDoProjectListBase.TextBoxItemNo.Text = swl.swl_cItemNO;//啤張編號
     this._toDoProjectListBase.TextBoxItemName.Text = swl.swl_cItemName;//啤張內容
     this._toDoProjectListBase.TextBoxProdName.Text = swl.swl_cProdName;//產品名稱
     this._toDoProjectListBase.TextBoxEdition.Text = swl.swl_cEdition;//版本
     this._toDoProjectListBase.TextBoxProjectNO.Text = swl.swl_cProjectNO;//工程單編號
     this._toDoProjectListBase.TextBoxNature.Text = swl.swl_cNature;//啤張性質
     //Begin Add By DonaldHuang 03/11/2015
     this._toDoProjectListBase.TextBoxPaperBagName.Text = swl.swl_cPaperBagName;//紙袋名
     this._toDoProjectListBase.TextBoxPaperBagModel.Text = swl.swl_cPaperBagModel;//袋型
     this._toDoProjectListBase.TextBoxPaperBagQuality.Text = swl.swl_cPaperBagQuality;//紙袋品質
     this._toDoProjectListBase.TextBoxPaperBagSizeW.Text = swl.swl_fPaperBagSizeW.ToString();//紙袋尺寸W
     this._toDoProjectListBase.TextBoxPaperBagSizeH.Text = swl.swl_fPaperBagSizeH.ToString();//紙袋尺寸H
     this._toDoProjectListBase.TextBoxPaperBagSizeG.Text = swl.swl_fPaperBagSizeG.ToString();//紙袋尺寸G
     this._toDoProjectListBase.TextBoxPaperBagSizeUnit.Text = swl.swl_cPaperBagSizeUnit;//紙袋尺寸單位
     //End Add By DonaldHuang 03/11/2015
 }
 /// <summary>
 /// 新工程開始時獲取新的班次內工程生產數據
 /// </summary>
 /// <param name="newShiftInfo">新的班次信息</param>
 /// <param name="scheduleProject">排期工程</param>
 /// <param name="projectBaseData">機台生產工程下的基本資料</param>
 /// <param name="spareStatusID">空閒狀態記錄ID</param>
 public abstract ProjectProductionData GetShiftProjectProductionData(MachineShiftData newShiftInfo, ScheduleProjectData scheduleProject, ProjectBaseData projectBaseData, Guid spareStatusID);
 /// <summary>
 /// 設置當前生產工程
 /// </summary>
 /// <param name="ProjectData"></param>
 public override void SetCurrentProductionProject(ScheduleProjectData ProjectData)
 {
     OnProjectStartProduction(ProjectData);
 }
        /// <summary>
        /// 用戶選擇一個工程準備進行生產時的事件,通知控制中心
        /// </summary>
        /// <param name="scheduleProject"></param>
        public override ReturnValueInfo OnUserSelectedProject(ScheduleProjectData scheduleProject)
        {
            if (scheduleProject == null)
            {
                return null;
            }

            ReturnValueInfo result = new ReturnValueInfo();
            ScheduleProjectData project = null;

            lock (this._scheduleProjectListLock)
            {
                if (this.ScheduleProjectList != null && this.ScheduleProjectList.Count>0)
                {
                    try
                    {
                        project = this.ScheduleProjectList.Where(t => t.RecordID == scheduleProject.RecordID).FirstOrDefault();

                        this.ScheduleProjectList.RemoveAll(t => t.RecordID == scheduleProject.RecordID);
                    }
                    catch (Exception ex)
                    {
                        this.OnException(ex);
                    }
                }
            }

            if (project != null)
            {
                this.OnBackupScheduleProject(this.ScheduleProjectList);

                base.OnUserSelectedProject(project);

                result.boolValue = true;
            }
            else
            {
                result.boolValue = false;
                result.messageText = "此工程不能在此機台上進行生產,可能已經在其他的機台上進行生產!";
            }

            return result;
        }
        /// <summary>
        /// 獲取本地記錄集中的待生產工程
        /// </summary>
        /// <param name="cond"></param>
        /// <returns></returns>
        public override List<ScheduleProjectData> GetLocalScheduleProjectData(ScheduleProjectData cond)
        {
            List<ScheduleProjectData> recordList = null;

            if (this.ScheduleProjectList == null)
            {
                return recordList;
            }

            if (cond != null)
            {
                lock (this._scheduleProjectListLock)
                {
                    recordList = this.ScheduleProjectList.Where(t => t.swl_cPlanMachineNO.Trim() == cond.swl_cMachineNO.Trim()).ToList();
                }
                if (recordList == null)
                {
                    return recordList;
                }

                if (cond.swl_cSONO.Trim().Length > 0)
                {
                    recordList = recordList.Where(t => t.swl_cSONO.ToUpper().Contains(cond.swl_cSONO.ToUpper())).ToList();
                }

                if (cond.swl_cProdName.Trim().Length > 0)
                {
                    recordList = recordList.Where(t => t.swl_cProdName.ToUpper().Contains(cond.swl_cProdName.ToUpper())).ToList();
                }

                if (cond.swl_cItemNO.Trim().Length > 0)
                {
                    recordList = recordList.Where(t => t.swl_cItemNO.ToUpper().Contains(cond.swl_cItemNO.ToUpper())).ToList();
                }

                if (cond.swl_cProjectNO.Trim().Length > 0)
                {
                    recordList = recordList.Where(t => t.swl_cProjectNO.ToUpper().Contains(cond.swl_cProjectNO.ToUpper())).ToList();
                }
            }
            else
            {
                recordList = this.ScheduleProjectList;
            }

            return recordList;
        }
Esempio n. 9
0
        /// <summary>
        /// 獲取指定条件的工程資料
        /// </summary>
        /// <param name="searchInfo">篩選條件</param>
        /// <param name="isProdIn">是否篩選為待生產工程</param>
        /// <returns>工程資料列表</returns>
        public List<ScheduleProjectData> GetSpecifiedProjects(ScheduleProjectData searchInfo, bool isProdIn)
        {
            List<ScheduleProjectData> listRtnProjs = new List<ScheduleProjectData>();
            StringBuilder strSQL = new StringBuilder();
            strSQL.AppendLine("select ");
            strSQL.AppendLine("swl_RecordID,swl_cMachineNO,swl_cProjStatus,swl_dStatusChange,swl_cItemNO,swl_cItemName,swl_cEdition,swl_cSONO ");
            strSQL.AppendLine(",swl_cDataForm,swl_cProdName,swl_iProductionSeq,swl_dAddDate,swl_dLastDate");
            strSQL.AppendLine(",swl_iSheetProdQty,swl_iPlanProdQty,swl_cPlanMachineNO,swl_cShitDesc ");
            strSQL.AppendLine(",swl_cProjectNO,swl_iIsMergeSplit,swl_iCompletedQty,swl_cNature ");
            //Begin Add By DonaldHuang 30/10/2015
            //增加紙袋心電圖專有欄位:袋名,袋型,袋尺寸W,袋尺寸H,袋尺寸G,尺寸單位,品質
            strSQL.AppendLine(" ,swl_cPaperBagName,swl_cPaperBagModel,swl_fPaperBagSizeW,swl_fPaperBagSizeH");
            strSQL.AppendLine(" ,swl_fPaperBagSizeG,swl_cPaperBagSizeUnit,swl_cPaperBagQuality");
            //End Add By DonaldHuang 30/10/2015
            strSQL.AppendLine("from ScheduleProjList_swl with(nolock) where 1=1 ");
            if (isProdIn)
            {
                strSQL.AppendLine("and (swl_cProjStatus='" + Common.CustEnum.ProjectStatus.SCHEDULE.ToString() + "' ");
                strSQL.AppendLine("or swl_cProjStatus='" + Common.CustEnum.ProjectStatus.STOP.ToString() + "') ");
            }

            if (searchInfo != null)
            {
                #region 篩選條件

                if (searchInfo.RecordID != Guid.Empty)
                {
                    strSQL.AppendLine(" and swl_RecordID='" + searchInfo.RecordID.ToString() + "'");
                }

                if (!string.IsNullOrEmpty(searchInfo.swl_cProjStatus))
                {
                    strSQL.AppendLine(" and swl_cProjStatus='" + searchInfo.swl_cMachineNO.ToString().Trim() + "'");
                }

                if (!string.IsNullOrEmpty(searchInfo.swl_cItemNO))
                {
                    strSQL.AppendLine(" and swl_cItemNO='" + searchInfo.swl_cItemNO.ToString().Trim() + "'");
                }
                if (!string.IsNullOrEmpty(searchInfo.swl_cItemName))
                {
                    strSQL.AppendLine(" and swl_cItemName like N'%" + searchInfo.swl_cItemName.ToString().Trim() + "%'");
                }
                if (!string.IsNullOrEmpty(searchInfo.swl_cEdition))
                {
                    strSQL.AppendLine(" and swl_cEdition=N'" + searchInfo.swl_cEdition.ToString().Trim() + "'");
                }
                if (!string.IsNullOrEmpty(searchInfo.swl_cSONO))
                {
                    strSQL.AppendLine(" and swl_cSONO='" + searchInfo.swl_cSONO.ToString().Trim() + "'");
                }

                if (!string.IsNullOrEmpty(searchInfo.swl_cProdName))
                {
                    strSQL.AppendLine(" and swl_cProdName like N'" + searchInfo.swl_cProdName.ToString().Trim() + "'");
                }
                if (searchInfo.swl_iProductionSeq != 0)
                {
                    strSQL.AppendLine(" and swl_iProductionSeq=" + searchInfo.swl_iProductionSeq.ToString());
                }

                if (!string.IsNullOrEmpty(searchInfo.swl_cPlanMachineNO))
                {
                    strSQL.AppendLine(" and swl_cPlanMachineNO='" + searchInfo.swl_cPlanMachineNO.ToString().Trim() + "'");
                }

                if (!string.IsNullOrEmpty(searchInfo.swl_cShitDesc))
                {
                    strSQL.AppendLine(" and swl_cShitDesc like N'%" + searchInfo.swl_cShitDesc.ToString().Trim() + "%'");
                }

                //Begin Add By DonaldHuang 30/10/2015

                if (!string.IsNullOrEmpty(searchInfo.swl_cPaperBagName))
                {
                    strSQL.AppendLine(" and swl_cPaperBagName like N'%" + searchInfo.swl_cPaperBagName.Trim() + "%'");
                }

                if (!string.IsNullOrEmpty(searchInfo.swl_cPaperBagModel))
                {
                    strSQL.AppendLine(" and swl_cPaperBagModel =N'" + searchInfo.swl_cPaperBagModel.Trim() + "'");
                }

                if (!string.IsNullOrEmpty(searchInfo.swl_cPaperBagSizeUnit))
                {
                    strSQL.AppendLine(" and swl_cPaperBagSizeUnit =N'" + searchInfo.swl_cPaperBagSizeUnit.Trim() + "'");
                }

                if (!string.IsNullOrEmpty(searchInfo.swl_cPaperBagQuality))
                {
                    strSQL.AppendLine(" and swl_cPaperBagQuality =N'" + searchInfo.swl_cPaperBagQuality.Trim() + "'");
                }

                //End Add By DonaldHuang 30/10/2015

                #endregion
            }

            try
            {
                using (SqlDataReader reader = DbHelperSQL.ExecuteReader(strSQL.ToString()))
                {
                    while (reader.Read())
                    {
                        ScheduleProjectData projData = new ScheduleProjectData();
                        if (reader["swl_RecordID"] != null && !string.IsNullOrEmpty(reader["swl_RecordID"].ToString()))
                        {
                            projData.RecordID = new Guid(reader["swl_RecordID"].ToString().Trim());
                        }
                        if (reader["swl_cMachineNO"] != null && !string.IsNullOrEmpty(reader["swl_cMachineNO"].ToString()))
                        {
                            projData.swl_cMachineNO = reader["swl_cMachineNO"].ToString().Trim();
                        }
                        if (reader["swl_cProjStatus"] != null && !string.IsNullOrEmpty(reader["swl_cProjStatus"].ToString()))
                        {
                            projData.swl_cProjStatus = reader["swl_cProjStatus"].ToString().Trim();
                        }
                        if (reader["swl_dStatusChange"] != null && !string.IsNullOrEmpty(reader["swl_dStatusChange"].ToString()))
                        {
                            projData.swl_dStatusChange = DateTime.Parse(reader["swl_dStatusChange"].ToString().Trim());
                        }
                        if (reader["swl_cItemNO"] != null && !string.IsNullOrEmpty(reader["swl_cItemNO"].ToString()))
                        {
                            projData.swl_cItemNO = reader["swl_cItemNO"].ToString().Trim();
                        }
                        if (reader["swl_cItemName"] != null && !string.IsNullOrEmpty(reader["swl_cItemName"].ToString()))
                        {
                            projData.swl_cItemName = reader["swl_cItemName"].ToString().Trim();
                        }
                        if (reader["swl_cEdition"] != null && !string.IsNullOrEmpty(reader["swl_cEdition"].ToString()))
                        {
                            projData.swl_cEdition = reader["swl_cEdition"].ToString().Trim();
                        }
                        if (reader["swl_cSONO"] != null && !string.IsNullOrEmpty(reader["swl_cSONO"].ToString()))
                        {
                            projData.swl_cSONO = reader["swl_cSONO"].ToString().Trim();
                        }
                        if (reader["swl_cDataForm"] != null && !string.IsNullOrEmpty(reader["swl_cDataForm"].ToString()))
                        {
                            projData.swl_cDataForm = reader["swl_cDataForm"].ToString().Trim();
                        }

                        if (reader["swl_cProdName"] != null && !string.IsNullOrEmpty(reader["swl_cProdName"].ToString()))
                        {
                            projData.swl_cProdName = reader["swl_cProdName"].ToString().Trim();
                        }
                        if (reader["swl_iProductionSeq"] != null && !string.IsNullOrEmpty(reader["swl_iProductionSeq"].ToString()))
                        {
                            projData.swl_iProductionSeq = Convert.ToInt32(reader["swl_iProductionSeq"].ToString().Trim());
                        }
                        if (reader["swl_dAddDate"] != null && !string.IsNullOrEmpty(reader["swl_dAddDate"].ToString()))
                        {
                            projData.AddDate = DateTime.Parse(reader["swl_dAddDate"].ToString().Trim());
                        }
                        if (reader["swl_dLastDate"] != null && !string.IsNullOrEmpty(reader["swl_dLastDate"].ToString()))
                        {
                            projData.LastDate = DateTime.Parse(reader["swl_dLastDate"].ToString().Trim());
                        }
                        if (reader["swl_cProjectNO"] != null && !string.IsNullOrEmpty(reader["swl_cProjectNO"].ToString()))
                        {
                            projData.swl_cProjectNO = reader["swl_cProjectNO"].ToString().Trim();
                        }
                        if (reader["swl_cNature"] != null && !string.IsNullOrEmpty(reader["swl_cNature"].ToString()))
                        {
                            projData.swl_cNature = reader["swl_cNature"].ToString().Trim();
                        }
                        if (reader["swl_iSheetProdQty"] != null && !string.IsNullOrEmpty(reader["swl_iSheetProdQty"].ToString()))
                        {
                            projData.swl_iSheetProdQty = Convert.ToInt32(reader["swl_iSheetProdQty"].ToString().Trim());
                        }
                        if (reader["swl_iPlanProdQty"] != null && !string.IsNullOrEmpty(reader["swl_iPlanProdQty"].ToString()))
                        {
                            projData.swl_iPlanProdQty = Convert.ToInt32(reader["swl_iPlanProdQty"].ToString().Trim());
                        }
                        if (reader["swl_cPlanMachineNO"] != null && !string.IsNullOrEmpty(reader["swl_cPlanMachineNO"].ToString()))
                        {
                            projData.swl_cPlanMachineNO = reader["swl_cPlanMachineNO"].ToString().Trim();
                        }

                        if (reader["swl_cShitDesc"] != null && !string.IsNullOrEmpty(reader["swl_cShitDesc"].ToString()))
                        {
                            projData.swl_cShitDesc = reader["swl_cShitDesc"].ToString().Trim();
                        }

                        if (reader["swl_iIsMergeSplit"] != null && !string.IsNullOrEmpty(reader["swl_iIsMergeSplit"].ToString()))
                        {
                            if (reader["swl_iIsMergeSplit"].ToString().Trim() == "1" || reader["swl_iIsMergeSplit"].ToString().Trim().ToLower() == "true")
                            {
                                projData.swl_iIsMergeSplit = true;
                            }
                            else
                            {
                                projData.swl_iIsMergeSplit = false;
                            }
                        }

                        if (reader["swl_iCompletedQty"] != null && !string.IsNullOrEmpty(reader["swl_iCompletedQty"].ToString()))
                        {
                            projData.swl_iCompletedQty = Convert.ToInt32(reader["swl_iCompletedQty"].ToString().Trim());
                        }

                        //Begin Add By DonaldHuang 30/10/2015

                        if (reader["swl_cPaperBagName"] != null && !string.IsNullOrEmpty(reader["swl_cPaperBagName"].ToString()))
                        {
                            projData.swl_cPaperBagName = reader["swl_cPaperBagName"].ToString().Trim();
                        }

                        if (reader["swl_cPaperBagModel"] != null && !string.IsNullOrEmpty(reader["swl_cPaperBagModel"].ToString()))
                        {
                            projData.swl_cPaperBagModel = reader["swl_cPaperBagModel"].ToString().Trim();
                        }

                        if (reader["swl_fPaperBagSizeW"] != null && !string.IsNullOrEmpty(reader["swl_fPaperBagSizeW"].ToString()))
                        {
                            projData.swl_fPaperBagSizeW = float.Parse(reader["swl_fPaperBagSizeW"].ToString().Trim());
                        }

                        if (reader["swl_fPaperBagSizeH"] != null && !string.IsNullOrEmpty(reader["swl_fPaperBagSizeH"].ToString()))
                        {
                            projData.swl_fPaperBagSizeH = float.Parse(reader["swl_fPaperBagSizeH"].ToString().Trim());
                        }

                        if (reader["swl_fPaperBagSizeG"] != null && !string.IsNullOrEmpty(reader["swl_fPaperBagSizeG"].ToString()))
                        {
                            projData.swl_fPaperBagSizeG = float.Parse(reader["swl_fPaperBagSizeG"].ToString().Trim());
                        }

                        if (reader["swl_cPaperBagSizeUnit"] != null && !string.IsNullOrEmpty(reader["swl_cPaperBagSizeUnit"].ToString()))
                        {
                            projData.swl_cPaperBagSizeUnit = reader["swl_cPaperBagSizeUnit"].ToString().Trim();
                        }

                        if (reader["swl_cPaperBagQuality"] != null && !string.IsNullOrEmpty(reader["swl_cPaperBagQuality"].ToString()))
                        {
                            projData.swl_cPaperBagQuality = reader["swl_cPaperBagQuality"].ToString().Trim();
                        }

                        //End Add By DonaldHuang 30/10/2015

                        listRtnProjs.Add(projData);
                    }
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
            return listRtnProjs;
        }
 /// <summary>
 /// 工程開始生產事件,供控制中心調用通知界面,界面進行控件狀態設置
 /// </summary>
 /// <param name="scheduleProject">已開始生產的排期工程對象</param>
 protected void OnProjectStartProduction(ScheduleProjectData scheduleProject)
 {
     if (this.ProjectStartProductionEvent != null)
     {
         EventBaseInfo<ScheduleProjectData> eventInfo = new EventBaseInfo<ScheduleProjectData>();
         eventInfo.ObjectInformation = scheduleProject;
         this.ProjectStartProductionEvent(this, eventInfo);
     }
 }
 /// <summary>
 /// 設置當前生產工程
 /// </summary>
 /// <param name="ProjectData"></param>
 public abstract void SetCurrentProductionProject(ScheduleProjectData ProjectData);
        /// <summary>
        /// 用戶選擇一個工程準備進行生產時的事件,通知控制中心
        /// </summary>
        /// <param name="scheduleProject"></param>
        public virtual ReturnValueInfo OnUserSelectedProject(ScheduleProjectData scheduleProject)
        {
            ReturnValueInfo result= new ReturnValueInfo();

            result.boolValue = true;

            if (this.UserSelectedProjectEvent != null)
            {
                EventBaseInfo<ScheduleProjectData> eventInfo = new EventBaseInfo<ScheduleProjectData>();
                eventInfo.ObjectInformation = scheduleProject;
                this.UserSelectedProjectEvent(this, eventInfo);
            }

            return result;
        }
 /// <summary>
 /// 獲取Local 待生產工程
 /// </summary>
 /// <param name="machineID"></param>
 /// <param name="sono"></param>
 /// <param name="prodName"></param>
 /// <param name="itemNo"></param>
 /// <param name="itemName"></param>
 /// <returns></returns>
 /// <remarks >Add by Jerryxiao</remarks>
 public abstract List<ScheduleProjectData> GetLocalScheduleProjectData(ScheduleProjectData cond);
 /// <summary>
 /// 設置已抽起的工程,將已抽起的工程重新添加到排期工程列表中
 /// </summary>
 /// <param name="ProjectData"></param>
 public abstract void EndProject(ScheduleProjectData ProjectData);
Esempio n. 15
0
        /// <summary>
        /// 对象实体绑定数据(ScheduleProjectData)
        /// </summary>
        private ScheduleProjectData ReaderBind_SWL(IDataReader dataReader)
        {
            ScheduleProjectData model = new ScheduleProjectData();
            object ojb;
            ojb = dataReader["swl_RecordID"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.RecordID = new Guid(ojb.ToString());
            }
            model.swl_cMachineNO = dataReader["swl_cMachineNO"].ToString();
            model.swl_cProjStatus = dataReader["swl_cProjStatus"].ToString();
            ojb = dataReader["swl_dStatusChange"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.swl_dStatusChange = (DateTime)ojb;
            }
            model.swl_cItemNO = dataReader["swl_cItemNO"].ToString();
            model.swl_cItemName = dataReader["swl_cItemName"].ToString();
            model.swl_cEdition = dataReader["swl_cEdition"].ToString();
            model.swl_cSONO = dataReader["swl_cSONO"].ToString();
            model.swl_cDataForm = dataReader["swl_cDataForm"].ToString();
            model.swl_cProdName = dataReader["swl_cProdName"].ToString();
            ojb = dataReader["swl_iProductionSeq"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.swl_iProductionSeq = (int)ojb;
            }

            ojb = dataReader["swl_dAddDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.AddDate = (DateTime)ojb;
            }
            ojb = dataReader["swl_dLastDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.LastDate = (DateTime)ojb;
            }

            model.swl_cProjectNO = dataReader["swl_cProjectNO"].ToString();
            ojb = dataReader["swl_iSheetProdQty"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.swl_iSheetProdQty = (int)ojb;
            }
            ojb = dataReader["swl_iPlanProdQty"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.swl_iPlanProdQty = (int)ojb;
            }
            model.swl_cPlanMachineNO = dataReader["swl_cPlanMachineNO"].ToString();
            model.swl_cShitDesc = dataReader["swl_cShitDesc"].ToString();
            model.swl_cNature = dataReader["swl_cNature"].ToString();
            ojb = dataReader["swl_iIsMergeSplit"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.swl_iIsMergeSplit = (bool)ojb;
            }
            model.swl_cScheduleUser = dataReader["swl_cScheduleUser"].ToString();
            ojb = dataReader["swl_iCompletedQty"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.swl_iCompletedQty = (int)ojb;
            }
            return model;
        }
        /// <summary>
        /// 設置已抽起的工程,將已抽起的工程重新添加到排期工程列表中
        /// </summary>
        /// <param name="ProjectData"></param>
        public override void EndProject(ScheduleProjectData projectData)
        {
            if (projectData == null)
            {
                return;
            }

            if (projectData.swl_cProjStatus.Trim() == Common.CustEnum.ProjectStatus.STOP.ToString().Trim())
            {
                lock (this._scheduleProjectListLock)
                {
                    if (this.ScheduleProjectList != null)
                    {
                        this.ScheduleProjectList.Add(projectData);
                    }
                }

                this.OnBackupScheduleProject(this.ScheduleProjectList);
            }

            base.OnProjectEndProduction(projectData);
        }
Esempio n. 17
0
        /// <summary>
        /// 新增生產工程的基本資料
        /// </summary>
        /// <param name="model">model</param>
        /// <param name="tran">SqlTransaction</param>
        /// <returns></returns>
        public bool AddScheduleProjListData(ScheduleProjectData model, SqlTransaction tran)
        {
            try
            {
                MappingHelper.HandleNullProperty(model);

                StringBuilder strSql = new StringBuilder();
                strSql.Append("insert into ScheduleProjList_swl(");
                strSql.Append("swl_RecordID,swl_cMachineNO,swl_cProjStatus,swl_dStatusChange,swl_cItemNO,swl_cItemName,swl_cEdition,swl_cSONO,swl_cDataForm,swl_iPredictChangeTime,swl_cProdName,swl_iProductionSeq,swl_lSync,swl_dAddDate,swl_dLastDate,swl_iConvolution,swl_cProcessingMethod,swl_iSheetProdQty,swl_iPlanProdQty,swl_cPlanMachineNO,swl_dRequestCompleteDate,swl_cShitDesc,swl_dDateOfShipment,swl_cNextGroup,swl_cNextArea,swl_cRemark,swl_iIsMergeSplit,swl_cPlanCapability,swl_cScheduleUser,swl_iIsByModify,swl_iCompletedQty)");
                strSql.Append(" values (");
                strSql.Append("@swl_RecordID,@swl_cMachineNO,@swl_cProjStatus,@swl_dStatusChange,@swl_cItemNO,@swl_cItemName,@swl_cEdition,@swl_cSONO,@swl_cDataForm,@swl_iPredictChangeTime,@swl_cProdName,@swl_iProductionSeq,@swl_lSync,@swl_dAddDate,@swl_dLastDate,@swl_iConvolution,@swl_cProcessingMethod,@swl_iSheetProdQty,@swl_iPlanProdQty,@swl_cPlanMachineNO,@swl_dRequestCompleteDate,@swl_cShitDesc,@swl_dDateOfShipment,@swl_cNextGroup,@swl_cNextArea,@swl_cRemark,@swl_iIsMergeSplit,@swl_cPlanCapability,@swl_cScheduleUser,@swl_iIsByModify,@swl_iCompletedQty)");
                SqlParameter[] parameters = {
                    DbHelperSQL.MakeInParam("@swl_RecordID", SqlDbType.UniqueIdentifier,16, model.RecordID),
                    DbHelperSQL.MakeInParam("@swl_cMachineNO", SqlDbType.NVarChar,20, model.swl_cMachineNO),
                    DbHelperSQL.MakeInParam("@swl_cProjStatus", SqlDbType.NVarChar,20, model.swl_cProjStatus),
                    DbHelperSQL.MakeInParam("@swl_dStatusChange", SqlDbType.DateTime, 0, model.swl_dStatusChange),
                    DbHelperSQL.MakeInParam("@swl_cItemNO", SqlDbType.NVarChar,50, model.swl_cItemNO),
                    DbHelperSQL.MakeInParam("@swl_cItemName", SqlDbType.NVarChar,260, model.swl_cItemName),
                    DbHelperSQL.MakeInParam("@swl_cEdition", SqlDbType.NVarChar,50, model.swl_cEdition),
                    DbHelperSQL.MakeInParam("@swl_cSONO", SqlDbType.NVarChar,255, model.swl_cSONO),
                    DbHelperSQL.MakeInParam("@swl_cDataForm", SqlDbType.NVarChar,100, model.swl_cDataForm),
                    DbHelperSQL.MakeInParam("@swl_cProdName", SqlDbType.NVarChar,260, model.swl_cProdName),
                    DbHelperSQL.MakeInParam("@swl_iProductionSeq", SqlDbType.Int,4, model.swl_iProductionSeq),
                    DbHelperSQL.MakeInParam("@swl_lSync", SqlDbType.Bit,1,  0),
                    DbHelperSQL.MakeInParam("@swl_dAddDate", SqlDbType.DateTime, 0, DateTime.Now),
                    DbHelperSQL.MakeInParam("@swl_dLastDate", SqlDbType.DateTime, 0, DateTime.Now),
                    DbHelperSQL.MakeInParam("@swl_cProjectNO", SqlDbType.NVarChar,200, model.swl_cProjectNO),
                    DbHelperSQL.MakeInParam("@swl_iSheetProdQty", SqlDbType.Int,4, model.swl_iSheetProdQty),
                    DbHelperSQL.MakeInParam("@swl_iPlanProdQty", SqlDbType.Int,4, model.swl_iPlanProdQty),
                    DbHelperSQL.MakeInParam("@swl_cPlanMachineNO", SqlDbType.NVarChar,20, model.swl_cPlanMachineNO),
                    DbHelperSQL.MakeInParam("@swl_cShitDesc", SqlDbType.NVarChar,40, model.swl_cShitDesc),
                    DbHelperSQL.MakeInParam("@swl_cNature", SqlDbType.NVarChar,50, model.swl_cNature),
                    DbHelperSQL.MakeInParam("@swl_iIsMergeSplit", SqlDbType.Bit,1, model.swl_iIsMergeSplit),
                    DbHelperSQL.MakeInParam("@swl_cScheduleUser", SqlDbType.NVarChar,50, model.swl_cScheduleUser),
                    DbHelperSQL.MakeInParam("@swl_iIsByModify", SqlDbType.Bit,1, 1),
                    DbHelperSQL.MakeInParam("@swl_iCompletedQty", SqlDbType.Int,4, model.swl_iCompletedQty)};

                DbHelperSQL.ExecuteNonQuery(tran, CommandType.Text, strSql.ToString(), parameters);

                return true;
            }
            catch (Exception ex) { throw ex; }
        }
        /// <summary>
        /// 新工程開始時獲取新的班次內生產數據
        /// </summary>
        /// <param name="newShiftInfo">新的班次信息</param>
        /// <param name="scheduleProject">排期工程</param>
        /// <param name="projectBaseData">機台生產工程下的基本資料</param>
        /// <param name="spareStatusID">空閒狀態記錄ID</param>
        public override ProjectProductionData GetShiftProjectProductionData(MachineShiftData newShiftInfo, ScheduleProjectData scheduleProject, ProjectBaseData projectBaseData, Guid spareStatusID)
        {
            try
            {
                Guid l_gSWL_ID = scheduleProject.RecordID; //排期工程ID(待印刷工程ID)
                Guid l_gPPJ_ID = Guid.NewGuid();    //工程機台生產ID
                Guid l_gSPL_ID = Guid.NewGuid();   //班次內工程生產ID
                Guid l_gSIFO_ID = newShiftInfo.RecordID; //班次ID
                string l_cMachineNo = newShiftInfo.sifo_cMachineNO;

                scheduleProject.swl_cMachineNO = l_cMachineNo;

                //■■■創建新的“工程生產數據資料”對象■■■
                ProjectProductionData objProjectProductionData = new ProjectProductionData();
                objProjectProductionData.MachineNo = l_cMachineNo;
                objProjectProductionData.ScheduleProjectID = l_gSWL_ID;
                objProjectProductionData.ProjectMachineProductionID = l_gPPJ_ID;
                objProjectProductionData.ShiftProjectID = l_gSPL_ID;
                objProjectProductionData.ProjectBaseData = scheduleProject;
                //===============================================================================//

                //■■■“抽起原因”對象地址■■■
                objProjectProductionData.ExtractionReason = new ProjectExtractionReason();
                objProjectProductionData.ExtractionReason.RecordID = Guid.NewGuid();
                objProjectProductionData.ExtractionReason.psr_SWLID = l_gSWL_ID;
                objProjectProductionData.ExtractionReason.ExtractionReasonIems = new List<ProjectExtractionReasonIem>();
                //===============================================================================//

                //■■■“準備工作項列表” 對象地址■■■
                objProjectProductionData.PrepareJobItems = new List<ProjectPrepareJobItem>();
                //===============================================================================//

                //■■■“工程機台生產數據”對象■■■
                objProjectProductionData.ProjectMProductionData = new ProjectMachineProductionData();
                objProjectProductionData.ProjectMProductionData.RecordID = l_gPPJ_ID;
                objProjectProductionData.ProjectMProductionData.ppj_SWLID = l_gSWL_ID;
                objProjectProductionData.ProjectMProductionData.ppj_cMachineNo = l_cMachineNo;
                objProjectProductionData.ProjectMProductionData.ppj_dProjBeginTime = DateTime.Now;
                objProjectProductionData.ProjectMProductionData.ppj_iQCInterval = projectBaseData.ProjectQCInervalTime;
                objProjectProductionData.ProjectMProductionData.ppj_iSpeed = projectBaseData.TargetSpeed;
                objProjectProductionData.ProjectMProductionData.ppj_iPertimeProdNum = 1;
                //“生產工程更多資料”對象
                objProjectProductionData.ProjectMProductionData.AdditionalInformation = new ProjectAdditionalInformation();
                objProjectProductionData.ProjectMProductionData.AdditionalInformation.RecordID = Guid.NewGuid();
                objProjectProductionData.ProjectMProductionData.AdditionalInformation.pai_PPJRecordID = l_gPPJ_ID;
                //===============================================================================//

                //■■■“班次內工程生產數據” 對象■■■
                objProjectProductionData.ShiftProjectData = new ShiftProjectProductionData();
                objProjectProductionData.ShiftProjectData.RecordID = l_gSPL_ID;
                objProjectProductionData.ShiftProjectData.spl_PPJID = l_gPPJ_ID;
                objProjectProductionData.ShiftProjectData.spl_SIFOID = l_gSIFO_ID;
                objProjectProductionData.ShiftProjectData.spl_dBeginTime = DateTime.Now;
                objProjectProductionData.ShiftProjectData.spl_SpareStatusID = spareStatusID;
                //班次內工程準備工作”對象地址
                objProjectProductionData.ShiftProjectData.PrepareJob = new ProjectPrepareJob();
                objProjectProductionData.ShiftProjectData.PrepareJob.PPJID = l_gPPJ_ID;
                objProjectProductionData.ShiftProjectData.PrepareJob.SPLID = l_gSPL_ID;
                objProjectProductionData.ShiftProjectData.PrepareJob.BeginDatetime = DateTime.Now;
                //“工程相關物料列表” 對象地址
                objProjectProductionData.ShiftProjectData.ProjectMaterials = new List<ProjectMaterial>();
                //工程停機記錄列表” 對象地址
                objProjectProductionData.ShiftProjectData.MachineHaltRecords = new List<ProjectMachineHaltRecord>();
                //“工程品檢記錄列表” 對象地址
                objProjectProductionData.ShiftProjectData.QCRecords = new List<ProjectQCRecord>();
                //“班次內工程消數、糾數記錄列表” 對象地址
                objProjectProductionData.ShiftProjectData.CorrectRecords = new List<ProjectCorrectRecord>();
                //===============================================================================//

                return objProjectProductionData;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }