Пример #1
0
        public ReturnValueInfo InsertRecord(MaintainPlan_mtp_Info reasonInfo)
        {
            ReturnValueInfo returnValue = new ReturnValueInfo();

            if (reasonInfo != null)
            {
                try
                {
                    using (MainDBDataContext db = new MainDBDataContext())
                    {
                        LinqToSQLModel.MaintainPlan_mtp newTab = Common.General.CopyObjectValue<Model.HBPMS.Master.MaintainPlan_mtp_Info, LinqToSQLModel.MaintainPlan_mtp>(reasonInfo);
                        newTab.mtp_dAddDate = DateTime.Now;
                        db.MaintainPlan_mtp.InsertOnSubmit(newTab);
                        db.SubmitChanges();

                        returnValue.boolValue = true;
                        returnValue.isError = false;
                        returnValue.ValueObject = newTab;
                        returnValue.messageText = "保存成功";
                    }
                }
                catch (Exception Ex)
                {
                    throw Ex;
                }
            }
            else
            {
                returnValue.boolValue = false;
                returnValue.isError = true;
                returnValue.messageText = "保存的對象為空";
            }

            return returnValue;
        }
Пример #2
0
        /// <summary>
        /// 檢查工程更多資料數據是否完整
        /// </summary>
        /// <param name="departmentCode">機台所屬科組編號</param>
        /// <param name="projectAdditional">工程更多資料數據對象</param>
        /// <returns></returns>
        public override ReturnValueInfo CheckProjectAdditionalDataFull(string departmentCode,ProjectAdditionalInformation projectAdditional)
        {
            // 檢查工程更多資料數據是否完整

            try
            {
                ReturnValueInfo result = new ReturnValueInfo();

                //if (projectAdditional == null)
                //{
                //    return result;
                //}

                bool isFull = true;
                //ProjectAdditionalInformation paiInfo = projectAdditional;

                //if (paiInfo.pai_iFrontProcessDefectiveQty < 0)
                //{
                //    isFull = false;
                //}

                //if (paiInfo.pai_iFrontProcessWasteQty < 0)
                //{
                //    isFull = false;
                //}

                //if (paiInfo.pai_iRevolution < 1)
                //{
                //    isFull = false;
                //}

                if (departmentCode.Trim() == CustEnum.Department.HBIM.ToString().Trim())
                {

                }

                result.boolValue = isFull;

                return result;
            }
            catch (Exception ex) { throw ex; }
        }
Пример #3
0
        public ReturnValueInfo DeleteRecord(int ID)
        {
            ReturnValueInfo returnValue = new ReturnValueInfo();
            try
            {
                using (MainDBDataContext db = new MainDBDataContext())
                {
                    var query = db.MaintainRecord_mtr.SingleOrDefault(t => t.mtr_iPlanID == ID);
                    if (query != null)
                    {
                        returnValue.boolValue = false;
                        returnValue.isError = true;
                        returnValue.messageText = "該計劃已存在使用記錄,不能刪除,如有需要請設為無效。";
                    }
                    else
                    {
                        var plan = from mtp in db.MaintainPlan_mtp where mtp.mtp_iRecordID == ID select mtp;

                        if (plan.Count() > 0)
                        {
                            db.MaintainPlan_mtp.DeleteAllOnSubmit(plan);
                            db.SubmitChanges();
                        }

                        returnValue.boolValue = true;
                        returnValue.isError = false;
                        returnValue.ValueObject = plan;
                        returnValue.messageText = "刪除成功";
                    }
                }
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
            return returnValue;
        }
Пример #4
0
        /// <summary>
        /// 驗證人員的工作時間合理性
        /// </summary>
        /// <param name="staff">人員信息</param>
        /// <returns></returns>
        ReturnValueInfo CheckShiftStaffWorkTimeInformation(MachineStaffInfo staff)
        {
            ReturnValueInfo returnInfo = new ReturnValueInfo();

            returnInfo.boolValue = true;

            if (staff != null)
            {
                if (staff.StartTime != null && staff.EndTime != null)
                {
                    if (staff.StartTime >= staff.EndTime)
                    {
                        returnInfo.boolValue = false;
                        returnInfo.messageText = staff.StaffNameNo + "  工作開始時間不能大於工作結束時間!";
                        return returnInfo;
                    }

                    if (staff.StartTime < this.CurrentMachineShiftInfo.sifo_dBeginTime || staff.StartTime > this.CurrentMachineShiftInfo.sifo_dEndTime)
                    {
                        returnInfo.boolValue = false;
                        returnInfo.messageText = staff.StaffNameNo + "  工作開始時間不能超出本班次的時間範圍!";
                        return returnInfo;
                    }

                    if (staff.EndTime < this.CurrentMachineShiftInfo.sifo_dBeginTime || staff.EndTime > this.CurrentMachineShiftInfo.sifo_dEndTime)
                    {
                        returnInfo.boolValue = false;
                        returnInfo.messageText = staff.StaffNameNo + "  工作開始時間不能超出本班次的時間範圍!";
                        return returnInfo;
                    }
                }
            }

            return returnInfo;
        }
Пример #5
0
        public override ReturnValueInfo MaintainRecordDelete(MaintainRecordView maintainInfo)
        {
            ReturnValueInfo result = new ReturnValueInfo();

            result.boolValue=true;

            if (maintainInfo == null)
            {
                return result;
            }

            if (this.MachineMaintainRecords == null)
            {
                return result;
            }

            MachineMaintainRecord tmpMaintainInfo = this.MachineMaintainRecords.SingleOrDefault(c => c.RecordID == maintainInfo.RecordID);
            if (tmpMaintainInfo == null)
            {
                return result;
            }

            MachineMaintainPlanInfo tmpPlan = null;

            if (this.MachineMaintainPlanInfos != null)
            {
                tmpPlan = this.MachineMaintainPlanInfos.SingleOrDefault(c => c.Code == tmpMaintainInfo.mtr_iPlanID.ToString().Trim());
            }

            if (tmpPlan == null)//非计划
            {
                if (tmpMaintainInfo.mtr_cStatus != 0)
                {
                    result.messageText="不能刪除已開始的保養項目!";
                    result.boolValue = false;

                    return result;
                }
            }
            else
            {
                result.messageText = "不能刪除计划保養項目!";
                result.boolValue = false;

                return result;
            }

            tmpMaintainInfo.RecordEditStatus = 4;
            this.MachineMaintainRecords.Remove(tmpMaintainInfo);

            this.OnProductionChanged(tmpMaintainInfo);

            this.SetMaintainRecordViews();

            this.OnProductionDataUpdate();

            return result;
        }
Пример #6
0
        public ReturnValueInfo UpdateRecord(MaintainPlan_mtp_Info reasonInfo)
        {
            ReturnValueInfo returnValue = new ReturnValueInfo();
            if (reasonInfo != null)
            {
                try
                {
                    using (MainDBDataContext db = new MainDBDataContext())
                    {
                        MaintainPlan_mtp query = db.MaintainPlan_mtp.SingleOrDefault(t => t.mtp_iRecordID == reasonInfo.mtp_iRecordID);

                        if (query != null)
                        {
                            query.mtp_iPeriodType = reasonInfo.mtp_iPeriodType;
                            query.mtp_dWorkTime = reasonInfo.mtp_dWorkTime;
                            query.mtp_dLastDate = reasonInfo.mtp_dLastDate;
                            query.mtp_dBeginDate = reasonInfo.mtp_dBeginDate;
                            query.mtp_dExpireTime = reasonInfo.mtp_dExpireTime;
                            query.mtp_cLast = reasonInfo.mtp_cLast;
                            query.mtp_cDateIndex = reasonInfo.mtp_cDateIndex;
                            query.mtp_lIsAtive = reasonInfo.mtp_lIsAtive;

                            db.SubmitChanges();
                        }

                        returnValue.boolValue = true;
                        returnValue.isError = false;
                        returnValue.ValueObject = query;
                        returnValue.messageText = "保存成功";
                    }
                }
                catch (Exception Ex)
                {
                    throw Ex;
                }
            }
            return returnValue;
        }
        //------------------->>>Begin Temp Remark By DonaldHuang 20150807
        /* *
         *
        void VirtualMachine_ProductionQtyEvent(object sender, EventBaseInfo<PLCEventArgs> e)
        {
            if (e != null)
            {
                this.MachineEquipment_OnPLCEvent(e.ObjectInformation);
            }
        }

        void VirtualMachine_ExceptionEvent(object sender, EventArgs e)
        {
            this.MachineEquipment_OnErrorPLCEvent(null);
        }

        void VirtualMachine_StopSignalEvent(object sender, EventArgs e)
        {
            this.MachineEquipment_OnStopPLCEvent(null);
        }
         *
         * */
        //-------------------<<<End Temp Remark By DonaldHuang 20150807
        /// <summary>
        /// 檢查工程更多資料數據是否完整
        /// </summary>
        /// <returns></returns>
        ReturnValueInfo IsSaveProjectAdditionalInformation(ProjectAdditionalInformation paiInfo)
        {
            ReturnValueInfo result = null;

            if (paiInfo == null)
            {
                return result;
            }

            result = new ReturnValueInfo();

            result.boolValue = true;

            return result;
        }
        /// <summary>
        /// 檢查工程更多資料數據是否完整
        /// </summary>
        /// <returns></returns>
        private ReturnValueInfo IsProjectAdditionalInformationFull()
        {
            ReturnValueInfo result = new ReturnValueInfo();

            if (this.ProductionData == null || this.ProductionData.ProjectMProductionData == null)
            {
                result.boolValue = true;
                return result;
            }

            if (this.ProductionData.ProjectMProductionData.AdditionalInformation == null)
            {
                result.boolValue = true;
                return result;
            }

            result = base.ShiftProductionDataManager.CheckProjectAdditionalDataFull(this.MachineBaseInfo.DepartmentCode, this.ProductionData.ProjectMProductionData.AdditionalInformation);

            return result;
        }
        /// <summary>
        /// 設置每次啤的張數
        /// </summary>
        /// <param name="perQty">每次啤的張數</param>
        public override ReturnValueInfo SetPerQty(int perQty)
        {
            ReturnValueInfo info = new ReturnValueInfo();

            info.boolValue = true;

            if (perQty < 1)
            {
                info.boolValue = false;
                info.messageText = "【每次啤的張數】不可以小於1!";

                return info;
            }

            if (this.ProductionData != null && this.ProductionData.ProjectMProductionData != null)
            {
                this.ProductionData.ProjectMProductionData.ppj_iPertimeProdNum = perQty;

                this.OnProductionChanged(null);
            }

            return info;
        }
        /// <summary>
        /// 工程結束請求,“工程狀態界面”進行調用,並返回工程數據資料殘缺類型,如果數據資料完整時調用“工程結束界面”,否則調用相關的模塊進行資料補充。
        /// </summary>
        /// <param name="projectFinishType">工程結束類型--“結束”或“抽起”</param>
        /// <returns></returns>
        public override ReturnValueInfo ProjectFinishRequest(CommonDefine.ProjectFinishType projectFinishType)
        {
            CommonDefine.ProjectDataType projectDataType = CommonDefine.ProjectDataType.DataFull;
            ReturnValueInfo result = new ReturnValueInfo();

            try
            {
                projectDataType = this.ShiftProductionDataManager.CheckProjectProductionDataFull(this.MachineBaseInfo.DepartmentCode, CustEnum.ProjectStatus.STOP, this.MachineShiftInfo, this.ProductionData);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            if (projectDataType == CommonDefine.ProjectDataType.MachineHaltRecord || projectDataType == CommonDefine.ProjectDataType.ProjectQC || projectDataType == CommonDefine.ProjectDataType.ShiftStaff || projectDataType == CommonDefine.ProjectDataType.DataFull)
            {
                if (projectDataType == CommonDefine.ProjectDataType.DataFull)
                {
                    base.OnProjectFinishTypeEvent(projectFinishType);
                }

                this.OnDataIncompleteInform(projectDataType);
                result.boolValue = true;
            }

            if (projectDataType == CommonDefine.ProjectDataType.ProjectAdditionalInformation)
            {
                result.messageText = CommonDefine.SystemMessageText.MessageText_W_ProjectAdditionalImperfect;
                result.boolValue = false;
            }

            if (projectDataType == CommonDefine.ProjectDataType.ProjectGrade)
            {
                result.messageText = CommonDefine.SystemMessageText.MessageText_W_ProjectGradeImperfect;
                result.boolValue = false;
            }

            return result;
        }
Пример #11
0
        public ReturnValueInfo UpdateRecord(NoticeManage_Info reasonInfo)
        {
            ReturnValueInfo returnValue = new ReturnValueInfo();
            if(reasonInfo != null)
            {
                try
                {
                    using (MainDBDataContext db = new MainDBDataContext())
                    {

                        NoticeManage_not query = db.NoticeManage_not.SingleOrDefault(t => t.not_RecordID == reasonInfo.not_RecordID);
                        if (query != null)
                        {
                            query.not_cContent = reasonInfo.not_cContent;
                            query.not_cDateIndex = reasonInfo.not_cDateIndex;
                            query.not_dLastDate = System.DateTime.Now;
                            query.not_dValidFrom = reasonInfo.not_dValidFrom;
                            query.not_dValidTo = reasonInfo.not_dValidTo;
                            query.not_iPeriodType = reasonInfo.not_iPeriodType;
                            query.not_iScrollSpeed = reasonInfo.not_iScrollSpeed;
                            query.not_lSync = reasonInfo.not_lSync;
                            query.not_lValid = reasonInfo.not_lValid;
                            db.SubmitChanges();
                        }

                        var ret = from notm in db.NoticeMachine_notm where notm.notm_NOTID == reasonInfo.not_RecordID select notm;

                        if(ret.Count() > 0)
                        {
                            db.NoticeMachine_notm.DeleteAllOnSubmit(ret);
                            db.SubmitChanges();
                        }

                        if (reasonInfo.NoticeMachineList != null && reasonInfo.NoticeMachineList.Count > 0)
                        {
                            foreach (NoticeToMachine noticeMachine in reasonInfo.NoticeMachineList)
                            {
                                noticeMachine.notm_NOTID = reasonInfo.not_RecordID;

                                LinqToSQLModel.NoticeMachine_notm machine = Common.General.CopyObjectValue<Model.HBPMS.Master.NoticeToMachine, LinqToSQLModel.NoticeMachine_notm>(noticeMachine);
                                db.NoticeMachine_notm.InsertOnSubmit(machine);
                            }
                            db.SubmitChanges();
                        }

                        returnValue.boolValue = true;
                        returnValue.isError = false;
                        returnValue.ValueObject = query;
                        returnValue.messageText = "保存成功";
                    }
                }
                catch (Exception Ex)
                {
                    throw Ex;
                }
            }

            return returnValue;
        }
Пример #12
0
        public ReturnValueInfo InsertRecord(NoticeManage_Info reasonInfo)
        {
            ReturnValueInfo returnValue = new ReturnValueInfo();

            if (reasonInfo != null)
            {
                try
                {
                    using (MainDBDataContext db = new MainDBDataContext())
                    {
                        reasonInfo.not_RecordID = Guid.NewGuid();

                        LinqToSQLModel.NoticeManage_not newTab = Common.General.CopyObjectValue<Model.HBPMS.Master.NoticeManage_Info, LinqToSQLModel.NoticeManage_not>(reasonInfo);
                        db.NoticeManage_not.InsertOnSubmit(newTab);
                        db.SubmitChanges();

                        if (reasonInfo.NoticeMachineList != null && reasonInfo.NoticeMachineList.Count > 0)
                        {
                            foreach (NoticeToMachine noticeMachine in reasonInfo.NoticeMachineList)
                            {
                                noticeMachine.notm_NOTID = reasonInfo.not_RecordID;

                                LinqToSQLModel.NoticeMachine_notm machine = Common.General.CopyObjectValue<Model.HBPMS.Master.NoticeToMachine, LinqToSQLModel.NoticeMachine_notm>(noticeMachine);
                                db.NoticeMachine_notm.InsertOnSubmit(machine);
                            }
                            db.SubmitChanges();
                        }

                        returnValue.boolValue = true;
                        returnValue.isError = false;
                        returnValue.ValueObject = newTab;
                        returnValue.messageText = "保存成功";
                    }
                }
                catch (Exception Ex)
                {
                    throw Ex;
                }
            }
            else
            {
                returnValue.boolValue = false;
                returnValue.isError = true;
                returnValue.messageText = "保存的對象為空";
            }

            return returnValue;
        }