Ejemplo n.º 1
0
        private void butSimulate_Click(object sender, EventArgs e)
        {
            if (HeaderContent.ProcessLine.ResourceGrpID == "S")
            {
                SimulateActionModel simModel = new SimulateActionModel();
                simModel.WorkOrderID = HeaderContent.WorkOrderID;
                simModel.WorkOrderNum = HeaderContent.WorkOrderNum;
                simModel.MaterialWeight = HeaderContent.InputWeight;
                simModel.ProductWeight = HeaderContent.OutputWeight;
                simModel.Yield = HeaderContent.Yield;
                simModel.TrimWeight = HeaderContent.CuttingDesign.Where(i => i.Status.Equals("S")).Sum(i => i.TotalWeight);
                simModel.Cuttings = _repo.GetSimulateAll(HeaderContent.WorkOrderID).ToList();
                simModel.Materials = HeaderContent.Materials.ToList();
                using (SimulateEntry frm = new SimulateEntry(epiSession, HeaderContent, simModel))
                {
                    frm.ShowDialog();
                    HeaderContent = frm.HeadModel;
                }
            }

            SetHeadContent(HeaderContent);
            ListMaterialGrid(HeaderContent.Materials);
            ListCuttingGrid(HeaderContent.CuttingDesign);
            ListCoilBackGrid(HeaderContent.CoilBacks);
            dgvMaterial.EndEdit();
        }
Ejemplo n.º 2
0
        private void tbutSimulate_Click(object sender, EventArgs e)
        {
            if (HeaderContent.Completed == 1)
            {
                MessageBox.Show("This work order has completed process, can't re-simulate.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (HeaderContent.GenSerialFlag == 1)
            {
                MessageBox.Show("This work order has generated serial, can't re-simulate.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (HeaderContent.ProcessLine.ResourceGrpID == "S")
            {
                //Simulated Complete.
                var resExisting = _repo.GetSimulateAll(HeaderContent.WorkOrderID);
                if (resExisting.ToList().Count > 0)
                {
                    DialogResult diaResult = MessageBox.Show("Simulate line has already, are you sure to clear all.", "Question.", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (diaResult == DialogResult.Yes)
                    {
                        _repo.ClearSimulateLines(HeaderContent.WorkOrderID);
                    }
                    else
                    {
                        return;
                    }
                }
                SimulateActionModel simModel = new SimulateActionModel();
                simModel.WorkOrderID = HeaderContent.WorkOrderID;
                simModel.WorkOrderNum = HeaderContent.WorkOrderNum;
                simModel.MaterialWeight = HeaderContent.InputWeight;
                simModel.ProductWeight = HeaderContent.OutputWeight;
                simModel.RewindWeight = HeaderContent.RewindWeight;
                simModel.Yield = HeaderContent.Yield;
                simModel.TrimWeight = HeaderContent.CuttingDesign.Where(i => i.Status.Equals("S")).Sum(i => i.TotalWeight);

                simModel.Cuttings = _repo.InsertSimulate(epiSession, HeaderContent).ToList();
                simModel.Materials = HeaderContent.Materials.ToList();
                using (SimulateEntry frm = new SimulateEntry(epiSession, HeaderContent, simModel))
                {
                    frm.ShowDialog();
                    HeaderContent = frm.HeadModel;
                }

                SetHeadContent(HeaderContent);
                ListMaterialGrid(HeaderContent.Materials);
                ListCuttingGrid(HeaderContent.CuttingDesign);
                ListCoilBackGrid(HeaderContent.CoilBacks);
                tbutCalculate_Click(sender, e);
                //tbutSave_Click(sender, e);
                HeaderContent.SimulateFlag = 1;
            }
            else if (HeaderContent.ProcessLine.ResourceGrpID == "R")
            {
                SimulateReshearHeadModel simModel = new SimulateReshearHeadModel();
                simModel.Materials = HeaderContent.Materials.ToList();
                simModel.Cuttings = HeaderContent.CuttingDesign.ToList();
                simModel.WorkOrderID = HeaderContent.WorkOrderID;
                simModel.WorkOrderNum = HeaderContent.WorkOrderNum;

                using (SimulateReShear frm = new SimulateReShear(epiSession, HeaderContent, simModel))
                {
                    frm.ShowDialog();
                    HeaderContent = frm.HeadModel;
                }
            }
        }