Example #1
0
        /// <summary>
        /// 填充數據到控件(機器主)
        /// </summary>
        /// <param name="source"></param>
        protected void FillData()
        {
            lock (this.snyObj)
            {

                MachineMasterBL MachineMaster = new MachineMasterBL();

                var listMachine = MachineMaster.SearchRecords(new MachineMaster_mmt_Info());

                if (listMachine == null)
                    return;
                this.lvMachineMain.Clear();
                this.lvReadyAll.Clear();
                this.lvReadySelect.Clear();
                this.lvMachineMain.BeginUpdate();

                initMachineMain();
                initReadyAll();
                initReadySelect();

                foreach (MachineMaster_mmt_Info t in listMachine)
                {

                    ListViewItem item = new ListViewItem();

                    item.Tag = t.mmt_cMachineID.ToString();
                    item.SubItems[0].Text = t.mmt_cMachineID.ToString(); ;
                    item.SubItems.Add(t.mmt_cMachineID.ToString());
                    item.SubItems.Add(t.mmt_cPressCode.ToString());
                    item.SubItems.Add(t.mmt_cMachineName.ToString());
                    item.SubItems.Add(t.mmt_cMachineType.ToString());
                    item.SubItems.Add(t.cAreaName.ToString());
                    item.SubItems.Add(t.mmt_cLocation);
                    item.SubItems.Add(t.cAreaCode.ToString());

                    this.lvMachineMain.Items.Add(item);
                }

                this.lvMachineMain.EndUpdate();
            }
        }
Example #2
0
        private void lvReadyMain_SelectedIndexChanged(object sender, EventArgs e)
        {
            Guid PIPFID = Guid.Empty;
            //int iMachineType = -1;
            if (lvReadyMain.SelectedItems.Count > 0)
            {
                if (recordPIPFID != Guid.Empty && recordPIPFID != new Guid(lvReadyMain.SelectedItems[0].SubItems[0].Text.ToString()))
                {
                    if (btnSave.Enabled == true)
                    {
                        if (MessageBox.Show("是否確認保存?", " 保存提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                        {
                            btnSave_Click(null, null);
                        }
                        else
                        {
                            btnSave.Enabled = false;
                            recordPIPFID = Guid.Empty;
                        }
                    }
                }

                this.lvMachineAll.Clear();
                this.lvMachineSelect.Clear();
                PIPFID = new Guid(lvReadyMain.SelectedItems[0].SubItems[0].Text.ToString());
                recordPIPFID = PIPFID;

                IPrepareProjectMasterBL PPM = MasterBLLFactory.GetBLL<IPrepareProjectMasterBL>(MasterBLLFactory.PrepareProjectMaster_ppm);
                List<Model.HBPMS.Management.RunningManagement.PrepareProjectMaster_ppm_Info> listReadyAll = PPM.GetAllProjects();

                //listAllMachine = manager.ShowAllMachineByMachineType(iMachineType);

                MachineMasterBL MachineMaster = new MachineMasterBL();

                var listAllMachine = MachineMaster.SearchRecords(new MachineMaster_mmt_Info()).ToList();

                List<MachinePrepareItem_mpit_Info> listReadySelect = _MachineReadyPlanBL.GetPrepareProjectsByProjectID(recordPIPFID.ToString());

                if (listReadySelect != null)
                {
                    foreach (MachinePrepareItem_mpit_Info selected in listReadySelect)
                    {
                        foreach (MachineMaster_mmt_Info all in listAllMachine)
                        {

                            if (selected.mpit_cDCMPID == all.mmt_cMachineID)
                            {
                                listAllMachine.Remove(all);
                                break;
                            }
                        }
                    }
                }

                FillMachineAll(listAllMachine);
                FillMachineSelect(listReadySelect);
            }
        }
Example #3
0
        private void lvStopReasonsMain_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;

            if (lvStopReasonsMain.SelectedItems.Count > 0)
            {
                if (CheckIsSave())
                {
                    ShowDialogSaveData();
                }
                StopReasonMaster_srm_Info srp = lvStopReasonsMain.SelectedItems[0].Tag as StopReasonMaster_srm_Info;
                mSelectedReasonID = srp.srm_iRecordID;

                MachineMasterBL machineMaster = new MachineMasterBL();
                MachineMaster_mmt_Info cond = new MachineMaster_mmt_Info();
                cond.mmt_cMachineType = srp.srm_cMachineType;
                var vmachines = machineMaster.SearchRecords(cond);

                IList<MachineStopReasonProfile_msrp_Info> machineStopReasonProfile = _MachineStopReasonBL.GetStopReasonByReasonID(mSelectedReasonID);

                if (machineStopReasonProfile != null)
                {
                    m_MachineStopReasonProfile = machineStopReasonProfile.ToList();
                }
                else
                {
                    m_MachineStopReasonProfile = new List<MachineStopReasonProfile_msrp_Info>();
                }

                List<MachineMaster_mmt_Info> machines = new List<MachineMaster_mmt_Info>();

                foreach (MachineMaster_mmt_Info item in vmachines)
                {
                    machines.Add(item);
                }

                List<MachineMaster_mmt_Info> selectedMachines = new List<MachineMaster_mmt_Info>();
                List<MachineMaster_mmt_Info> unSelectedMachines = new List<MachineMaster_mmt_Info>();
                foreach (MachineStopReasonProfile_msrp_Info item in m_MachineStopReasonProfile)
                {
                    MachineMaster_mmt_Info obj = machines.Find(s => s.mmt_cMachineID.ToUpper().Trim() == item.msrp_cMachineID.ToUpper().Trim());
                    if (obj != null)
                    {
                        selectedMachines.Add(obj);
                    }
                }
                foreach (MachineMaster_mmt_Info item in machines)
                {
                    if (!selectedMachines.Contains(item))
                        unSelectedMachines.Add(item);
                }

                FillMachineData(unSelectedMachines, lvUnSelectedMachines2, true);
                FillMachineData(selectedMachines, lvSelectedMachines2, true);
                //ClearData();
                tsbAdd.Enabled = false;
                m_SelectedMainObject = srp;
            }

            this.Cursor = Cursors.Default;
        }
Example #4
0
        private void BindMachines()
        {
            MachineMasterBL MachineMaster = new MachineMasterBL();

            var vlistMachine = MachineMaster.SearchRecords(new MachineMaster_mmt_Info());

            List<MachineMaster_mmt_Info> listMachine = new List<MachineMaster_mmt_Info>();

            foreach (MachineMaster_mmt_Info item in vlistMachine)
            {
                listMachine.Add(item);
            }

            FillMachineData(listMachine, lvMachinesMain, true);
        }