示例#1
0
        public IActionResult AddProjectInfo([FromBody] Entity.ProjectInfo projectInfo)
        {
            bool res        = false;
            int  project_id = 0;

            if (projectInfo.oven_id > 0)
            {
                //设定初始参数
                project_id = _projectInfoService.InsertReturnIdentity(projectInfo);
                List <HeatStep> heatSteps = new List <HeatStep>();
                for (int i = 0; i < 4; i++)
                {
                    HeatStep heatStep = new HeatStep();
                    heatStep.project_id  = project_id;
                    heatStep.order_id    = i + 1;
                    heatStep.temperature = 0;
                    heatStep.duration    = 0;
                    heatSteps.Add(heatStep);
                }
                List <TmSig> tmSigs = new List <TmSig>();
                for (int i = 0; i < 4; i++)
                {
                    TmSig tmSig = new TmSig();
                    tmSig.project_id = project_id;
                    tmSig.order_id   = i + 1;
                    tmSig.sout       = 0;
                    tmSig.ssn        = 0;
                    tmSig.stm        = 0;
                    tmSig.esn        = 0;
                    tmSig.etm        = 0;
                    tmSigs.Add(tmSig);
                }

                List <Pid> pids = new List <Pid>();
                for (int i = 0; i < 2; i++)
                {
                    Pid pid = new Pid();
                    pid.project_id = project_id;
                    pid.order_id   = i + 1;
                    pid.p          = 0;
                    pid.i          = 0;
                    pid.d          = 0;
                    pids.Add(pid);
                }

                res  = _heatStepService.Insert(heatSteps);
                res &= _tmSigService.Insert(tmSigs);
                res &= _pidService.Insert(pids);
            }

            return(Json(res));
        }