Ejemplo n.º 1
0
        public ActionResult peAppWvYieldChecks_Update([DataSourceRequest] DataSourceRequest request, peAppWvYieldCheck peAppWvYieldCheck)
        {
            if (ModelState.IsValid)
            {
                var entity = new peAppWvYieldCheck
                {
                    Id         = peAppWvYieldCheck.Id,
                    inputdate  = peAppWvYieldCheck.inputdate,
                    inputclass = peAppWvYieldCheck.inputclass,
                    name1      = peAppWvYieldCheck.name1,
                    name2      = peAppWvYieldCheck.name2,
                    name3      = peAppWvYieldCheck.name3,
                    machineno  = peAppWvYieldCheck.machineno,
                    gfno       = peAppWvYieldCheck.gfno,
                    itemname   = peAppWvYieldCheck.itemname,
                    value1     = peAppWvYieldCheck.value1,
                    value2     = peAppWvYieldCheck.value2,
                    Audit      = peAppWvYieldCheck.Audit,
                    //                    remark = peAppWvYieldCheck.remark,
                    //                    input_time = peAppWvYieldCheck.input_time,
                    WorkerType = peAppWvYieldCheck.WorkerType
                };

                wvmDb.peAppWvYieldChecks.Attach(entity);
                wvmDb.Entry(entity).State = EntityState.Modified;
                wvmDb.SaveChanges();
            }

            return(Json(new[] { peAppWvYieldCheck }.ToDataSourceResult(request, ModelState)));
        }
Ejemplo n.º 2
0
        public IHttpActionResult AddYieldCheck([FromBody] WvYieldCheckBindingModel yieldCheck)
        {
            if (yieldCheck == null)
            {
                return(NotFound());
            }
            var addYield = new peAppWvYieldCheck()
            {
                inputdate  = yieldCheck.inputdate.AsDateTime(),
                inputclass = yieldCheck.inputclass,
                name1      = yieldCheck.name1,
                name2      = yieldCheck.name2,
                name3      = yieldCheck.name3,
                machineno  = yieldCheck.machineno,
                gfno       = yieldCheck.gfno,
                itemname   = yieldCheck.itemname.Substring(5),// 截取“加产 - ”后的字符串写入数据库
                value1     = yieldCheck.value1,
                value2     = yieldCheck.value2,
                Audit      = "待审",
                remark     = yieldCheck.Remark,
                WorkerType = yieldCheck.WorkerType
            };

            wvmDb.peAppWvYieldChecks.Add(addYield);
            wvmDb.SaveChanges();
            return(Ok());
        }