Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("ProductionProcessId,ProductionProcess1")] ProductionProcess productionProcess)
        {
            if (id != productionProcess.ProductionProcessId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(productionProcess);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProductionProcessExists(productionProcess.ProductionProcessId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(productionProcess));
        }
Exemplo n.º 2
0
        // GET: ProductionProcesses/Create
        public ActionResult Create()
        {
            ProductionProcess productionProcess = new ProductionProcess();

            //set default value
            return(View(productionProcess));
        }
Exemplo n.º 3
0
        public void ImportDataTable(System.Data.DataTable datatable)
        {
            Dictionary <string, ProductionProcess> processlist = new Dictionary <string, ProductionProcess>();

            foreach (DataRow row in datatable.Rows)
            {
                ProcessStep item = new ProcessStep();
                item.ObjectState = Repository.Pattern.Infrastructure.ObjectState.Added;
                ProductionProcess process = null;
                foreach (DataColumn col in datatable.Columns)
                {
                    var sourcefieldname = col.ColumnName;
                    var mapping         = _mappingservice.FindMapping("ProcessStep", sourcefieldname);
                    if (mapping != null && row[sourcefieldname] != DBNull.Value)
                    {
                        if (col.ColumnName == "工序名称")
                        {
                            string name = row[sourcefieldname].ToString();
                            process = this._processservice.Queryable().Where(x => x.Name == name).FirstOrDefault();
                            if (process == null)
                            {
                                if (!processlist.ContainsKey(name))
                                {
                                    process = new ProductionProcess()
                                    {
                                        Name = name
                                    };
                                    process.ObjectState = Repository.Pattern.Infrastructure.ObjectState.Added;
                                    processlist.Add(process.Name, process);
                                }
                                else
                                {
                                    process = processlist[name];
                                }
                            }
                            item.ProductionProcessId = process.Id;
                            item.ProductionProcess   = process;

                            process.ProcessSteps.Add(item);
                        }
                        else
                        {
                            Type         processsteptype = item.GetType();
                            PropertyInfo propertyInfo    = processsteptype.GetProperty(mapping.FieldName);
                            propertyInfo.SetValue(item, Convert.ChangeType(row[sourcefieldname], propertyInfo.PropertyType), null);
                        }
                    }
                }
            }
            this._processservice.InsertGraphRange(processlist.Values);

            //foreach (var item in processlist.Values)
            //    this._processservice.Insert(new ProductionProcess() { Name = item.Name });
            //this._processservice.InsertOrUpdateGraph(item);
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Create([Bind("ProductionProcessId,ProductionProcess1")] ProductionProcess productionProcess)
        {
            if (ModelState.IsValid)
            {
                _context.Add(productionProcess);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(productionProcess));
        }
 private string GetOPTypeString(ProductionProcess obj)
 {
     return(WebQueryHelper.GetOPResultLinkHtml2(this.languageComponent1, obj.Action, obj.RCard, obj.RCardSequence, obj.MOCode,
                                                string.Format(
                                                    "FITProductionProcessQP.aspx?RCARD={0}&RCARDSEQ={1}&MOCODE={2}",
                                                    this.txtSN.Value,
                                                    int.Parse(this.txtSeq.Value),
                                                    this.txtMO.Value
                                                    )
                                                ));
 }
Exemplo n.º 6
0
        //[ValidateAntiForgeryToken]
        public ActionResult DeleteConfirmed(int id)
        {
            ProductionProcess productionProcess = _productionProcessService.Find(id);

            _productionProcessService.Delete(productionProcess);
            _unitOfWork.SaveChanges();
            if (Request.IsAjaxRequest())
            {
                return(Json(new { success = true }, JsonRequestBehavior.AllowGet));
            }
            DisplaySuccessMessage("Has delete a ProductionProcess record");
            return(RedirectToAction("Index"));
        }
Exemplo n.º 7
0
        // GET: ProductionProcesses/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ProductionProcess productionProcess = _productionProcessService.Find(id);

            if (productionProcess == null)
            {
                return(HttpNotFound());
            }
            return(View(productionProcess));
        }
Exemplo n.º 8
0
 public async Task <ProductionProcessResponse> UpdateAsync(ProductionProcess productionProcess)
 {
     try
     {
         return(new ProductionProcessResponse(_context.ProductionProcesses
                                              .FromSqlRaw("EXEC dbo.UpdateProductionProcess {0}, {1}, {2}", productionProcess.Id,
                                                          productionProcess.Name, productionProcess.ProducedProductId)
                                              .AsEnumerable()
                                              .FirstOrDefault()));
     }
     catch (SqlException exception)
     {
         var messages = HandlingError(exception);
         return(new ProductionProcessResponse(messages));
     }
     catch (Exception exception)
     {
         throw;
     }
 }
        private static IProcess DummyProcess()
        {
            var product = new DummyType()
            {
                Id       = 42,
                Name     = "Bob",
                Foo      = 1337,
                Bobs     = new[] { 1, 3, 7, 42, 1337 },
                Identity = new ProductIdentity("123456", 01),
                Part     = new ProductPartLink <DummyType>(2)
                {
                    Product = new DummyType
                    {
                        Identity = new ProductIdentity("654321", 01),
                        Name     = "Thomas",
                        Foo      = 42
                    }
                }
            };
            var process = new ProductionProcess
            {
                Id     = 42,
                Recipe = new DummyRecipe
                {
                    Id          = 42,
                    Name        = "AwesomeRecipe",
                    OrderNumber = "123321",
                    Product     = product,
                    Config      = new Dictionary <string, string> {
                        { "Foo", "Blah" }
                    }
                },
                ProductInstance = product.CreateInstance()
            };

            process.ProductInstance.Id = 42;
            ((DummyInstance)process.ProductInstance).Blah = (float)0.815;

            return(process);
        }
Exemplo n.º 10
0
        //[ValidateAntiForgeryToken]
        public ActionResult Create([Bind(Include = "Id,Name,Description,ElapsedTime,ProductionLine,Status,CreatedUserId,CreatedDateTime,LastEditUserId,LastEditDateTime")] ProductionProcess productionProcess)
        {
            if (ModelState.IsValid)
            {
                _productionProcessService.Insert(productionProcess);
                _unitOfWork.SaveChanges();
                if (Request.IsAjaxRequest())
                {
                    return(Json(new { success = true }, JsonRequestBehavior.AllowGet));
                }
                DisplaySuccessMessage("Has append a ProductionProcess record");
                return(RedirectToAction("Index"));
            }

            if (Request.IsAjaxRequest())
            {
                var modelStateErrors = String.Join("", this.ModelState.Keys.SelectMany(key => this.ModelState[key].Errors.Select(n => n.ErrorMessage)));
                return(Json(new { success = false, err = modelStateErrors }, JsonRequestBehavior.AllowGet));
            }
            DisplayErrorMessage();
            return(View(productionProcess));
        }
 public async Task <ProductionProcessResponse> UpdateAsync(ProductionProcess productionProcess)
 {
     return(await _productionProcesses.UpdateAsync(productionProcess));
 }