Esempio n. 1
0
        private void butWorkOrder_Click(object sender, EventArgs e)
        {
            HeaderContent = new PackingOrderModel();
            PlanningHeadModel plan = new PlanningHeadModel();
            plan.Plant = epiSession.PlantID;
            plan.Completed = 1; //Completed.
            plan.GenSerialFlag = 1;  //Serial has created.
            plan.OperationState = 1; //Stay on production operation.

            var result = _repo.GetWorkAll(plan);
            using (WorkEntryDialog frm = new WorkEntryDialog(epiSession, result))
            {
                frm.ShowDialog();
                if (frm._selected != null)
                {
                    HeaderContent.WorkOrderId = frm._selected.WorkOrderID;
                    HeaderContent.WorkOrderNum = frm._selected.WorkOrderNum;
                    if (!_repo.PackOrderExist(HeaderContent.WorkOrderId))
                    {
                        PackingOrderModel model = new PackingOrderModel();
                        model.WorkOrderId = HeaderContent.WorkOrderId;
                        model.PackOrderNum = "PKG-" + HeaderContent.WorkOrderNum;
                        model.Remark = "";
                        model.CompleteFlag = 0;

                        if (_repo.SavePackOrder(epiSession, model, out HeaderContent))
                        {
                            var styles = _repo.GetPackStyleByWorkOrder(HeaderContent.WorkOrderId, HeaderContent.Id);
                            if (_repo.SavePackStyles(epiSession, styles))
                            {
                                var resultStyle = _repo.GetPackStyleByPackOrder(HeaderContent.WorkOrderId).ToList();
                                foreach (var item in resultStyle)
                                {
                                    var savingSn = _repo.GetSerialForFirstDefault(item);
                                    _repo.SaveSerialByStyle(epiSession, savingSn);
                                }
                            }
                        }
                    }

                    HeaderContent = _repo.GetPackOrderByID(HeaderContent.WorkOrderId);
                }
            }

            BindingContentsHeader(HeaderContent);

            ListPackingStyleToGrid(HeaderContent.PackStyles);
            string styleId = dgvPackStyle.CurrentRow.Cells["styleid"].Value.GetString();
            ListSerialCuttingToGrid(HeaderContent.SerialLines.Where(i => i.PackStyleId == Convert.ToInt32(styleId)));
            ListSkidWithinSerial(HeaderContent.SkidPacks.Where(i => i.PackStyleId == Convert.ToInt32(styleId)));
        }
Esempio n. 2
0
        private void tbutNew_Click(object sender, EventArgs e)
        {
            HeaderContent = new ProductionHeadModel();
            SetHeadContent(HeaderContent);
            SetTimeControl("Normal");

            PlanningHeadModel plan = new PlanningHeadModel();
            plan.Plant = epiSession.PlantID;
            plan.Completed = 1; //Completed.
            plan.GenSerialFlag = 1;  //Serial has created.
            plan.OperationState = 1; //Stay on planing operation.

            var result = _repoPlan.GetWorkAll(plan);
            using (WorkEntryDialog frm = new WorkEntryDialog(epiSession, result))
            {
                frm.ShowDialog();
                if (frm._selected != null)
                {
                    HeaderContent.OperationState = frm._selected.OperationState;
                    HeaderContent.WorkOrderID = frm._selected.WorkOrderID;
                    HeaderContent.WorkOrderNum = frm._selected.WorkOrderNum;
                    HeaderContent.ProcessLines = frm._selected.Resources.ToList();
                    HeaderContent.ProcessLineID = frm._selected.ProcessLineId;
                    HeaderContent.SerialLines = _repo.GetAllSerialByWorkOrder(HeaderContent.WorkOrderID).ToList();
                    HeaderContent.Materials = frm._selected.Materials.ToList();
                    HeaderContent.Reasons = _repo.GetAllReasonAll().ToList();
                    //Set content and list Material was add from dialog.
                    SetHeadContent(HeaderContent);
                }
                else
                {
                    SetTimeControl("Normal");
                    return;
                }
            }

            if (HeaderContent.OperationState == 3 || HeaderContent.OperationState == 4)
            {
                SetTimeControl("Lock");
            }
            else
            {
                SetTimeControl("Ready");
            }
        }
Esempio n. 3
0
 private void butWorkOrder_Click_1(object sender, EventArgs e)
 {
     using (WorkEntryDialog frm = new WorkEntryDialog(epiSession))
     {
         frm.ShowDialog();
         if (frm._selected != null)
         {
             HeaderContent = frm._selected;
             HeaderContent.FormState = 3;
             SetFormState();
             //Summaries using weight
             HeaderContent.SumUsingWeight(HeaderContent.Materials);
             //Set content and list Material was add from dialog.
             SetHeadContent(HeaderContent);
             //Set Material Grid.
             try
             {
                 ListMaterialGrid(HeaderContent.Materials);
                 ListCuttingGrid(HeaderContent.CuttingDesign);
                 ListCoilBackGrid(HeaderContent.CoilBacks);
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.ToString());
             }
         }
     }
 }