Example #1
0
 /// <summary>
 /// 创建一个器具明细信息
 /// </summary>
 /// <param name="validationErrors">返回的错误信息</param>
 /// <param name="db">数据库上下文</param>
 /// <param name="entity">一个器具明细信息</param>
 /// <returns></returns>
 public bool Create(ref ValidationErrors validationErrors, APPLIANCE_DETAIL_INFORMATION entity)
 {
     try
     {
         repository.Create(entity);
         return(true);
     }
     catch (Exception ex)
     {
         validationErrors.Add(ex.Message);
         ExceptionsHander.WriteExceptions(ex);
     }
     return(false);
 }
        public ORDER_TASK_INFORMATIONShow UpdateDataByID(string id)
        {
            Common.Account account = GetCurrentAccount();
            string         UNDERTAKE_LABORATORYID  = string.Empty;
            string         ORDER_STATUS            = string.Empty;
            APPLIANCE_DETAIL_INFORMATION queryData = m_BLL.GetById(id);//查询器具明细表数据

            foreach (var item in queryData.APPLIANCE_LABORATORY)
            {
                UNDERTAKE_LABORATORYID += item.UNDERTAKE_LABORATORYID + ",";//实验室
                if (item.UNDERTAKE_LABORATORYID == account.UNDERTAKE_LABORATORYName)
                {
                    ORDER_STATUS = item.ORDER_STATUS;//器具状态
                }
            }
            ORDER_TASK_INFORMATIONShow ordershow = new ORDER_TASK_INFORMATIONShow();

            ordershow.ID = queryData.ORDER_TASK_INFORMATION.ID;                                                         //委托单id
            ordershow.ACCEPT_ORGNIZATION            = queryData.ORDER_TASK_INFORMATION.ACCEPT_ORGNIZATION;              //受理单位
            ordershow.INSPECTION_ENTERPRISE         = queryData.ORDER_TASK_INFORMATION.INSPECTION_ENTERPRISE;           //送检单位
            ordershow.INSPECTION_ENTERPRISE_ADDRESS = queryData.ORDER_TASK_INFORMATION.INSPECTION_ENTERPRISE_ADDRESS;   //送检单位地址
            ordershow.INSPECTION_ENTERPRISE_POST    = queryData.ORDER_TASK_INFORMATION.INSPECTION_ENTERPRISE_POST;      //送检单位邮政编码
            ordershow.CONTACTS                       = queryData.ORDER_TASK_INFORMATION.CONTACTS;                       //联系人
            ordershow.CONTACT_PHONE                  = queryData.ORDER_TASK_INFORMATION.CONTACT_PHONE;                  //联系电话
            ordershow.FAX                            = queryData.ORDER_TASK_INFORMATION.FAX;                            //传真
            ordershow.CERTIFICATE_ENTERPRISE         = queryData.ORDER_TASK_INFORMATION.CERTIFICATE_ENTERPRISE;         //证书单位
            ordershow.CERTIFICATE_ENTERPRISE_ADDRESS = queryData.ORDER_TASK_INFORMATION.CERTIFICATE_ENTERPRISE_ADDRESS; //证书单位地址
            ordershow.CERTIFICATE_ENTERPRISE_POST    = queryData.ORDER_TASK_INFORMATION.CERTIFICATE_ENTERPRISE_POST;    //证书单位邮政编码
            ordershow.CONTACTS2                      = queryData.ORDER_TASK_INFORMATION.CONTACTS2;                      //联系人2
            ordershow.CONTACT_PHONE2                 = queryData.ORDER_TASK_INFORMATION.CONTACT_PHONE2;                 //联系电话2
            ordershow.FAX2                           = queryData.ORDER_TASK_INFORMATION.FAX2;                           //传真2
            ordershow.CUSTOMER_SPECIFIC_REQUIREMENTS = queryData.ORDER_TASK_INFORMATION.CUSTOMER_SPECIFIC_REQUIREMENTS; //客户特殊要求
            ordershow.APPLIANCE_DETAIL_INFORMATIONShows.Add(new APPLIANCE_DETAIL_INFORMATIONShow()
            {
                ID                           = queryData.ID,                //器具明细id
                APPLIANCE_NAME               = queryData.APPLIANCE_NAME,    //器具名称
                VERSION                      = queryData.VERSION,           //型号
                FORMAT                       = queryData.FORMAT,            //规格
                FACTORY_NUM                  = queryData.FACTORY_NUM,       //出厂编号
                NUM                          = queryData.NUM,               //数量
                ATTACHMENT                   = queryData.ATTACHMENT,        //附件
                APPEARANCE_STATUS            = queryData.APPEARANCE_STATUS, //外观状态
                MAKE_ORGANIZATION            = queryData.MAKE_ORGANIZATION, //制造单位
                UNDERTAKE_LABORATORYIDString = UNDERTAKE_LABORATORYID,      //实验室
                REMARKS                      = queryData.REMARKS,           //备注
                ORDER_STATUS                 = ORDER_STATUS                 //状态
            });
            return(ordershow);
        }
        public Common.ClientResult.Result Post([FromBody] APPLIANCE_DETAIL_INFORMATION entity)
        {
            Common.ClientResult.Result result = new Common.ClientResult.Result();
            if (entity != null && ModelState.IsValid)
            {
                string currentPerson = GetCurrentPerson();
                entity.CREATETIME   = DateTime.Now;
                entity.CREATEPERSON = currentPerson;

                entity.ID = Result.GetNewId();
                string returnValue = string.Empty;
                if (m_BLL.Create(ref validationErrors, entity))
                {
                    LogClassModels.WriteServiceLog(Suggestion.InsertSucceed + ",器具明细信息的信息的Id为" + entity.ID, "器具明细信息"
                                                   );//写入日志
                    result.Code    = Common.ClientCode.Succeed;
                    result.Message = Suggestion.InsertSucceed;
                    return(result); //提示创建成功
                }
                else
                {
                    if (validationErrors != null && validationErrors.Count > 0)
                    {
                        validationErrors.All(a =>
                        {
                            returnValue += a.ErrorMessage;
                            return(true);
                        });
                    }
                    LogClassModels.WriteServiceLog(Suggestion.InsertFail + ",器具明细信息的信息," + returnValue, "器具明细信息"
                                                   );//写入日志
                    result.Code    = Common.ClientCode.Fail;
                    result.Message = Suggestion.InsertFail + returnValue;
                    return(result); //提示插入失败
                }
            }

            result.Code    = Common.ClientCode.FindNull;
            result.Message = Suggestion.InsertFail + ",请核对输入的数据的格式"; //提示输入的数据的格式不对
            return(result);
        }
        public Common.ClientResult.Result EditField([FromBody] APPLIANCE_DETAIL_INFORMATION entity)
        {
            Common.ClientResult.Result result = new Common.ClientResult.Result();
            if (entity != null && ModelState.IsValid)
            {   //数据校验
                string currentPerson = GetCurrentPerson();
                entity.UPDATETIME   = DateTime.Now;
                entity.UPDATEPERSON = currentPerson;

                string returnValue = string.Empty;
                if (m_BLL.EditField(ref validationErrors, entity))
                {
                    LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",器具明细信息信息的Id为" + entity.ID, "器具明细信息"
                                                   );//写入日志
                    result.Code    = Common.ClientCode.Succeed;
                    result.Message = Suggestion.UpdateSucceed;
                    return(result); //提示更新成功
                }
                else
                {
                    if (validationErrors != null && validationErrors.Count > 0)
                    {
                        validationErrors.All(a =>
                        {
                            returnValue += a.ErrorMessage;
                            return(true);
                        });
                    }
                    LogClassModels.WriteServiceLog(Suggestion.UpdateFail + ",器具明细信息信息的Id为" + entity.ID + "," + returnValue, "器具明细信息"
                                                   );//写入日志
                    result.Code    = Common.ClientCode.Fail;
                    result.Message = Suggestion.UpdateFail + returnValue;
                    return(result); //提示更新失败
                }
            }
            result.Code    = Common.ClientCode.FindNull;
            result.Message = Suggestion.UpdateFail + "请核对输入的数据的格式";
            return(result); //提示输入的数据的格式不对
        }
Example #5
0
        public ActionResult XuanZheFangAn(string id)
        {
            Common.Account account = GetCurrentAccount();
            string         Id      = string.Empty;                //预备方案表ID
            string         APPLIANCE_LABORATORYID = string.Empty; //器具明细信息_承接实验室ID
            APPLIANCE_DETAIL_INFORMATION appl     = m_BLL5.GetById(id);

            foreach (var item in appl.APPLIANCE_LABORATORY)
            {
                if (account.UNDERTAKE_LABORATORYName == item.UNDERTAKE_LABORATORYID)
                {
                    Id = item.PREPARE_SCHEMEID;
                    APPLIANCE_LABORATORYID = item.ID;
                }
            }
            ViewBag.Id = Id;
            ViewBag.APPLIANCE_LABORATORYID         = APPLIANCE_LABORATORYID;
            ViewBag.APPLIANCE_DETAIL_INFORMATIONID = id;//器具明细表id

            string erchizi = string.Empty;

            if (!string.IsNullOrEmpty(Id))
            {
                PREPARE_SCHEME prepare = m_BLL3.GetById(Id);//二次进入绑定数据
                erchizi             += "REPORT_CATEGORY*" + prepare.REPORT_CATEGORY + ",";
                erchizi             += "CERTIFICATE_CATEGORY*" + prepare.CERTIFICATE_CATEGORY + ",";
                erchizi             += "CONTROL_NUMBER*" + prepare.CONTROL_NUMBER + ",";
                erchizi             += "QUALIFICATIONS*" + prepare.QUALIFICATIONS + ",";
                erchizi             += "CERTIFICATE_CATEGORY*" + prepare.CERTIFICATE_CATEGORY + ",";
                erchizi             += "CERTIFICATION_AUTHORITY*" + prepare.CERTIFICATION_AUTHORITY + ",";
                erchizi             += "CNAS*" + prepare.CNAS;
                ViewBag.SBL          = erchizi;
                ViewBag.REPORTSTATUS = prepare.REPORTSTATUS; //报告状态(前段判断是否能修改)
                ViewBag.PACKAGETYPE  = prepare.PACKAGETYPE;  //判断报告类型是上传还是系统生成,用来判断启用上传报告还是建立方案
            }
            ViewBag.SYS = account.UNDERTAKE_LABORATORYName;  //实验室
            return(View());
        }
Example #6
0
        public Common.ClientResult.Result EditSENDBACK([FromBody] APPLIANCE_LABORATORY entity)
        {
            Common.ClientResult.Result result = new Common.ClientResult.Result();
            APPLIANCE_LABORATORY       aryOne = null;

            if (entity != null && ModelState.IsValid)
            {   //数据校验
                Common.Account account             = GetCurrentAccount();
                List <APPLIANCE_LABORATORY> appory = m_BLL.GetByRefAPPLIANCE_DETAIL_INFORMATIOID(entity.APPLIANCE_DETAIL_INFORMATION.ID);
                aryOne = appory.Find(f => f.UNDERTAKE_LABORATORYID == account.UNDERTAKE_LABORATORYName); //选择的器具
                if (!string.IsNullOrWhiteSpace(aryOne.PREPARE_SCHEMEID))
                {                                                                                        //如果有报告产生,就不能退回
                    result.Code    = Common.ClientCode.Fail;
                    result.Message = "已经生成报告编号,如果器具不能检测,请完成不合格报告。";
                    return(result);
                }

                var currentPerson = GetCurrentAccount();
                entity.BACKTIME   = DateTime.Now;
                entity.BACKPERSON = currentPerson.PersonName;
                string returnValue = string.Empty;
                //通过前端传过来的值来判断枚举中属于什么值给器具状态值赋值
                if (!string.IsNullOrEmpty(entity.ORDER_STATUS))
                {
                    if (Enum.IsDefined(typeof(Common.ORDER_STATUS), entity.ORDER_STATUS))
                    {
                        entity.EQUIPMENT_STATUS_VALUUMN = Enum.Parse(typeof(Common.ORDER_STATUS), entity.ORDER_STATUS).GetHashCode().ToString();
                    }
                }


                entity.ID = aryOne.ID;
                if (m_BLL.EditField(ref validationErrors, entity))
                {
                    if (entity.ORDER_STATUS == Common.ORDER_STATUS.已退回.ToString())  //退回
                    {
                        //获取委托单id
                        APPLIANCE_DETAIL_INFORMATION appl = m_BLL2.GetById(entity.APPLIANCE_DETAIL_INFORMATION.ID);
                        appl.ORDER_TASK_INFORMATION.ORDER_STATUS = Common.ORDER_STATUS_INFORMATION.退回.ToString();
                        m_BLL3.EditField(ref validationErrors, appl.ORDER_TASK_INFORMATION);
                        LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",器具退回的Id为" + entity.ID, "器具明细信息"
                                                       );//写入日志
                        result.Code    = Common.ClientCode.Succeed;
                        result.Message = "退回成功!";
                        return(result); //提示更新成功
                    }
                    else if (entity.ORDER_STATUS == Common.ORDER_STATUS.待入库.ToString())
                    {
                        entity.APPLIANCE_DETAIL_INFORMATION.STORAGEINSTRUCTIONS = entity.STORAGEINSTRUCTIONS.ToString(); //入库说明
                        if (m_BLL2.EditField(ref validationErrors, entity.APPLIANCE_DETAIL_INFORMATION))                 //修改器具明细表中的入库说明
                        {
                            if (appory.Remove(aryOne))
                            {
                                var aryTwo = appory.FirstOrDefault();
                                if (aryTwo != null)
                                {
                                    result.Message = "请通知" + aryTwo.UNDERTAKE_LABORATORYID + "该器具不能检测";
                                }
                                else
                                {
                                    result.Message = "退回成功!";
                                }
                            }
                            else
                            {
                                result.Message = Suggestion.UpdateSucceed;
                            }
                            LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",器具退回的Id为" + entity.ID, "器具明细信息"
                                                           );//写入日志
                            result.Code = Common.ClientCode.Succeed;

                            return(result); //提示更新成功
                        }
                    }
                }
                else
                {
                    if (validationErrors != null && validationErrors.Count > 0)
                    {
                        validationErrors.All(a =>
                        {
                            returnValue += a.ErrorMessage;
                            return(true);
                        });
                    }
                    LogClassModels.WriteServiceLog(Suggestion.UpdateFail + ",器具退回的Id为" + entity.ID + "," + returnValue, "器具明细信息"
                                                   );//写入日志
                    result.Code    = Common.ClientCode.Fail;
                    result.Message = Suggestion.UpdateFail + returnValue;
                    return(result); //提示更新失败
                }


                result.Code    = Common.ClientCode.FindNull;
                result.Message = Suggestion.UpdateFail + "请核对输入的数据的格式";
            }
            return(result); //提示输入的数据的格式不对
        }
Example #7
0
        public Common.ClientResult.Result LINGQU([FromBody] APPLIANCE_LABORATORY entity)
        {
            Common.ClientResult.Result result = new Common.ClientResult.Result();
            string returnValue = string.Empty;
            string id          = entity.APPLIANCE_DETAIL_INFORMATIONID.TrimEnd(',');

            string[] deleteId = id.Split(',');//截取id
            if (deleteId != null && deleteId.Length > 0)
            {
                Common.Account account = GetCurrentAccount();
                bool           qu      = false;
                foreach (var item in deleteId)
                {
                    if (GetISRECEIVE(item))
                    {
                        qu = true;
                    }
                    else
                    {
                        qu = false;
                        break;
                    }
                }
                if (qu)
                {
                    foreach (var item2 in deleteId)//修改器具状态
                    {
                        APPLIANCE_DETAIL_INFORMATION appion = new APPLIANCE_DETAIL_INFORMATION();
                        APPLIANCE_DETAIL_INFORMATION adi    = m_BLL2.GetById(item2);
                        List <APPLIANCE_LABORATORY>  listry = m_BLL.GetByRefAPPLIANCE_DETAIL_INFORMATIOID(item2);
                        foreach (var item3 in listry)
                        {
                            APPLIANCE_LABORATORY app = new APPLIANCE_LABORATORY();

                            if (item3.UNDERTAKE_LABORATORYID == account.UNDERTAKE_LABORATORYName)
                            {
                                app.ORDER_STATUS             = Common.ORDER_STATUS.已领取.ToString();
                                app.EQUIPMENT_STATUS_VALUUMN = Common.ORDER_STATUS.已领取.GetHashCode().ToString();
                                app.RECEIVEPERSON            = account.PersonName;
                                app.RECEIVETIME = DateTime.Now;
                            }
                            app.ID = item3.ID;


                            app.ISRECEIVE = Common.ISRECEIVE.否.ToString();
                            if (m_BLL.EditField(ref validationErrors, app))
                            {
                                LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",器具明细信息_承接实验室的Id为" + appion.ID, "器具领取状态修改");//写入日志
                                result.Code    = Common.ClientCode.Succeed;
                                result.Message = Suggestion.UpdateSucceed;
                            }
                            else
                            {
                                if (validationErrors != null && validationErrors.Count > 0)
                                {
                                    validationErrors.All(a =>
                                    {
                                        returnValue += a.ErrorMessage;
                                        return(true);
                                    });
                                }
                                LogClassModels.WriteServiceLog(Suggestion.UpdateFail + ",器具明细信息_承接实验室的Id为" + appion.ID + "," + returnValue, "器具领取状态修改");//写入日志
                                result.Code    = Common.ClientCode.Fail;
                                result.Message = Suggestion.UpdateFail + returnValue;
                                return(result); //提示更新失败
                            }
                        }
                        appion.ID = item2;
                        if (adi.APPLIANCE_RECIVE == "是")
                        {
                            appion.APPLIANCE_PROGRESS = account.UNDERTAKE_LABORATORYName;
                        }
                        if (m_BLL2.EditField(ref validationErrors, appion))
                        {
                            LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",器具明细信息信息的Id为" + appion.ID, "器具领取所在实验室修改");//写入日志
                            result.Code    = Common.ClientCode.Succeed;
                            result.Message = Suggestion.UpdateSucceed;
                        }
                        else
                        {
                            if (validationErrors != null && validationErrors.Count > 0)
                            {
                                validationErrors.All(a =>
                                {
                                    returnValue += a.ErrorMessage;
                                    return(true);
                                });
                            }
                            LogClassModels.WriteServiceLog(Suggestion.UpdateFail + ",器具明细信息信息的Id为" + appion.ID + "," + returnValue, "器具领取所在实验室修改");//写入日志
                            result.Code    = Common.ClientCode.Fail;
                            result.Message = Suggestion.UpdateFail + returnValue;
                            return(result); //提示更新失败
                        }
                    }
                }
            }
            return(result); //提示输入的数据的格式不对
        }
 public Common.ClientResult.Result PutSTORAGEINSTRUCTI_STATU(string id)
 {
     Common.ClientResult.Result result = new Common.ClientResult.Result();
     if (id != null && ModelState.IsValid)
     {   //数据校验
         APPLIANCE_DETAIL_INFORMATION app   = null;
         APPLIANCE_LABORATORY         appry = null;
         foreach (var item in id.TrimEnd(',').Split(','))
         {
             app                        = new APPLIANCE_DETAIL_INFORMATION();
             appry                      = new APPLIANCE_LABORATORY();
             app.UPDATEPERSON           = GetCurrentPerson();
             app.UPDATETIME             = DateTime.Now;
             app.ID                     = item;
             app.STORAGEINSTRUCTI_STATU = Common.ORDER_STATUS.器具已入库.ToString(); //入库状态
             app.APPLIANCE_PROGRESS     = "库房";                                 //记录器具所在位置
             //器具明细信息_承接实验室表修改器具状态
             List <APPLIANCE_LABORATORY> list = m_BLL3.GetByRefAPPLIANCE_DETAIL_INFORMATIOID(item);
             appry.ORDER_STATUS             = Common.ORDER_STATUS.器具已入库.ToString();               //器具状态
             appry.EQUIPMENT_STATUS_VALUUMN = Common.ORDER_STATUS.器具已入库.GetHashCode().ToString(); //器具状态值
             foreach (var ps in list)
             {
                 string returnValue = string.Empty;
                 appry.ID = ps.ID;
                 if (m_BLL3.EditField(ref validationErrors, appry))
                 {
                     LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",器具明细信息_承接实验室的Id为" + appry.ID, "器具明细信息_承接实验室信息"
                                                    );//写入日志
                     result.Code    = Common.ClientCode.Succeed;
                     result.Message = Suggestion.UpdateSucceed;
                 }
                 else
                 {
                     if (validationErrors != null && validationErrors.Count > 0)
                     {
                         validationErrors.All(a =>
                         {
                             returnValue += a.ErrorMessage;
                             return(true);
                         });
                     }
                     LogClassModels.WriteServiceLog(Suggestion.UpdateFail + ",器具明细信息_承接实验室的Id为" + app.ID + "," + returnValue, "器具明细信息_承接实验室信息"
                                                    );//写入日志
                     result.Code    = Common.ClientCode.Fail;
                     result.Message = Suggestion.UpdateFail + returnValue;
                     return(result); //提示更新失败
                 }
             }
             //器具明细信息表的入库状态修改
             string returnValue2 = string.Empty;
             if (m_BLL.EditField(ref validationErrors, app))
             {
                 LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",器具明细信息信息的Id为" + app.ID, "器具明细信息"
                                                );//写入日志
                 result.Code    = Common.ClientCode.Succeed;
                 result.Message = Suggestion.UpdateSucceed;
                 continue;
             }
             else
             {
                 if (validationErrors != null && validationErrors.Count > 0)
                 {
                     validationErrors.All(a =>
                     {
                         returnValue2 += a.ErrorMessage;
                         return(true);
                     });
                 }
                 LogClassModels.WriteServiceLog(Suggestion.UpdateFail + ",器具明细信息信息的Id为" + app.ID + "," + returnValue2, "器具明细信息"
                                                );//写入日志
                 result.Code    = Common.ClientCode.Fail;
                 result.Message = Suggestion.UpdateFail + returnValue2;
                 return(result); //提示更新失败
             }
         }
         return(result);
     }
     result.Code    = Common.ClientCode.FindNull;
     result.Message = Suggestion.UpdateFail + "请核对输入的数据的格式";
     return(result); //提示输入的数据的格式不对
 }
Example #9
0
        public ActionResult JianLiFangAn(string id)
        {
            //id = "161008163205467348401f1aec5a1|161008162529892766577f2f96359";
            Common.Account account          = GetCurrentAccount();
            string[]       bs               = id.Split('|');
            string         PREPARE_SCHEMEID = bs[0];                                                                 //预备方案id
            string         APPLIANCE_DETAIL_INFORMATIONID = bs[1];                                                   //器具明细id
            APPLIANCE_DETAIL_INFORMATION    appion        = m_BLL5.GetById(APPLIANCE_DETAIL_INFORMATIONID);          //器具明细表
            List <METERING_STANDARD_DEVICE> mete          = m_BLL3.GetRefMETERING_STANDARD_DEVICE(PREPARE_SCHEMEID); //标准装置/计量标准器信息表
            PREPARE_SCHEME     prme     = m_BLL3.GetById(PREPARE_SCHEMEID);                                          //预备方案表
            PREPARE_SCHEMEShow prepShow = new PREPARE_SCHEMEShow();                                                  //预备方案类

            if (prme != null && prme.SCHEME != null)
            {
                //为什么获取不到SCHEME这个对象
                prepShow.SCHEMENAME = prme.SCHEME.NAME; //  选择方案模板
                prepShow.SCHEMEID   = prme.SCHEME.ID;   //  选择方案模板
            }
            if (prme != null && prme.STANDARDCHOICE != null)
            {
                foreach (var item in prme.STANDARDCHOICE)
                {
                    //rows[i].ID + "*" + rows[i].GROUPS + "*A*" + rows[i].CERTIFICATE_NUM
                    prepShow.METERING_STANDARD_DEVICEID += item.ID + "*" + item.METERING_STANDARD_DEVICEID + "*" + item.GROUPS + "*" + item.TYPE + "*" + item.NAMES + "&" + item.NAMES + "^";
                }
            }
            foreach (var item in prme.APPLIANCE_LABORATORY)
            {
                if (item.RECYCLING != null)
                {
                    prepShow.REPORTNUMBER = item.RECYCLING;
                }
                else
                {
                    prepShow.REPORTNUMBER = m_BLL3.GetSerialNumber(PREPARE_SCHEMEID);//报告编号
                }
            }
            prepShow.APPLIANCE_DETAIL_INFORMATIONShows.APPLIANCE_NAME = appion.APPLIANCE_NAME;       //器具名称
            prepShow.APPLIANCE_DETAIL_INFORMATIONShows.VERSION        = appion.VERSION;              //器具型号
            prepShow.APPLIANCE_DETAIL_INFORMATIONShows.FORMAT         = appion.FORMAT;               //器具规格
            prepShow.APPLIANCE_DETAIL_INFORMATIONShows.FACTORY_NUM    = appion.FACTORY_NUM;          //出厂编号
            prepShow.ACCURACY_GRADE  = prme.ACCURACY_GRADE;                                          //准确度等级
            prepShow.RATED_FREQUENCY = prme.RATED_FREQUENCY;                                         //额定频率
            prepShow.PULSE_CONSTANT  = prme.PULSE_CONSTANT;                                          //脉冲常数
            prepShow.APPLIANCE_DETAIL_INFORMATIONShows.MAKE_ORGANIZATION = appion.MAKE_ORGANIZATION; //制造单位
            prepShow.TEMPERATURE      = prme.TEMPERATURE;                                            //环境温度
            prepShow.HUMIDITY         = prme.HUMIDITY;                                               //相对湿度
            prepShow.CHECK_PLACE      = prme.CHECK_PLACE;                                            //检定/校准地点
            prepShow.CALIBRATION_DATE = prme.CALIBRATION_DATE;                                       //检定/校准日期
            prepShow.DETECTERID       = prme.DETECTERID;                                             //核验员
            prepShow.OTHER            = prme.OTHER;                                                  //其他
            prepShow.ID = prme.ID;                                                                   //id

            ViewBag.CERTIFICATE_CATEGORY      = prme.CERTIFICATE_CATEGORY;                           //证书类别
            ViewBag.UNDERTAKE_LABORATORY_NAME = account.UNDERTAKE_LABORATORYName;                    //实验室
            foreach (var item in prme.APPLIANCE_LABORATORY)
            {
                if (item.UNDERTAKE_LABORATORYID == account.UNDERTAKE_LABORATORYName)
                {
                    ViewBag.ORDER_STATUS = item.ORDER_STATUS;//器具状态
                }
            }
            ViewBag.ACCEPT_ORGNIZATION = appion.ORDER_TASK_INFORMATION.ACCEPT_ORGNIZATION;//受理单位
            return(View(prepShow));
        }
Example #10
0
        public Common.ClientResult.Result Put(string baogaoid, string qijuid, string yemian)
        {
            Common.ClientResult.Result result = new Common.ClientResult.Result();
            if (baogaoid != null || qijuid != null)
            {   //数据校验
                string currentPerson = GetCurrentPerson();
                string returnValue   = string.Empty;
                #region 报告领取操作
                if (!string.IsNullOrWhiteSpace(baogaoid))
                {
                    foreach (var item in baogaoid.Split('|'))
                    {
                        PREPARE_SCHEME prep = new PREPARE_SCHEME();//预备方案
                        if (!string.IsNullOrEmpty(item))
                        {
                            prep.ID             = item.Split('~')[0];
                            prep.REPORTSTATUS   = Common.REPORTSTATUS.报告已领取.ToString();               //报告领取状态
                            prep.REPORTSTATUSZI = Common.REPORTSTATUS.报告已领取.GetHashCode().ToString(); //报告领取状态
                            if (m_BLL5.EditField(ref validationErrors, prep))
                            {
                                result.Code    = Common.ClientCode.Succeed;
                                result.Message = Suggestion.InsertSucceed;
                            }
                            else
                            {
                                if (validationErrors != null && validationErrors.Count > 0)
                                {
                                    validationErrors.All(a =>
                                    {
                                        returnValue += a.ErrorMessage;
                                        return(true);
                                    });
                                }
                                result.Code    = Common.ClientCode.Fail;
                                result.Message = Suggestion.InsertFail + returnValue;
                                return(result); //提示创建失败
                            }
                        }
                    }
                }
                #endregion
                #region 器具领取操作
                if (!string.IsNullOrWhiteSpace(qijuid))
                {
                    foreach (var item in qijuid.Split('|'))
                    {
                        APPLIANCE_LABORATORY         appry  = new APPLIANCE_LABORATORY();         //器具明细信息_承接实验室
                        APPLIANCE_DETAIL_INFORMATION appion = new APPLIANCE_DETAIL_INFORMATION(); //器具明细
                        if (!string.IsNullOrEmpty(item))
                        {
                            appion.APPLIANCE_PROGRESS = null;                                                                 //所在实验室
                            appion.ID = item.Split('~')[0];                                                                   //id
                            if (!m_BLL6.EditField(ref validationErrors, appion))                                              //修改器具所在实验室数据
                            {
                                LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",器具明细信息的Id为" + appion.ID, "器具领取"); //写入日志
                                result.Code    = Common.ClientCode.Succeed;
                                result.Message = Suggestion.UpdateFail;
                                return(result); //提示创建失败
                            }

                            List <APPLIANCE_LABORATORY> list = m_BLL4.GetByRefAPPLIANCE_DETAIL_INFORMATIOID(item.Split('~')[0]);
                            foreach (var item2 in list)
                            {
                                appry.ID                       = item2.ID;
                                appry.ORDER_STATUS             = Common.ORDER_STATUS.器具已领取.ToString();
                                appry.EQUIPMENT_STATUS_VALUUMN = Common.ORDER_STATUS.器具已领取.GetHashCode().ToString();
                                if (!m_BLL4.EditField(ref validationErrors, appry))
                                {
                                    LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",器具明细信息_承接实验室的Id为" + appry.ID, "器具领取");//写入日志
                                    result.Code    = Common.ClientCode.Succeed;
                                    result.Message = Suggestion.UpdateFail;
                                    return(result); //提示创建失败
                                }
                            }
                        }
                    }
                }
                #endregion
                return(result);
            }
            result.Code    = Common.ClientCode.FindNull;
            result.Message = Suggestion.InsertFail + "请核对输入的数据的格式";
            return(result); //提示输入的数据的格式不对
        }
        /// <summary>
        /// 根据ID获取数据模型
        /// </summary>
        /// <param name="id">编号</param>
        /// <returns></returns>
        public APPLIANCE_DETAIL_INFORMATION Get(string id)
        {
            APPLIANCE_DETAIL_INFORMATION item = m_BLL.GetById(id);

            return(item);
        }
        public Common.ClientResult.Result SheIsPi([FromBody] PREPARE_SCHEME entity)
        {
            Common.ClientResult.OrderTaskGong result = new Common.ClientResult.OrderTaskGong();
            if (entity != null && ModelState.IsValid)
            {   //数据校验
                Common.Account account       = GetCurrentAccount();
                string         currentPerson = GetCurrentPerson();
                entity.UPDATETIME   = DateTime.Now;
                entity.UPDATEPERSON = currentPerson;
                string returnValue = string.Empty;
                List <APPLIANCE_LABORATORY> APPlist      = m_BLL2.GetByRefAPPLIANCE_DETAIL_INFORMATIOID(entity.APPLIANCE_DETAIL_INFORMATIONID);
                THEREVIEWPROCESS            SH           = new THEREVIEWPROCESS();   //审核操作记录
                THEAPPROVALPROCESS          SP           = new THEAPPROVALPROCESS(); //审批操作记录
                APPLIANCE_LABORATORY        applianceOne = APPlist.Find(f => f.PREPARE_SCHEMEID == entity.ID);
                APPLIANCE_LABORATORY        applianceTwo = null;
                if (APPlist.Remove(applianceOne))
                {
                    applianceTwo = APPlist.FirstOrDefault();
                }
                APPLIANCE_DETAIL_INFORMATION adi = m_BLL3.GetById(applianceOne.APPLIANCE_DETAIL_INFORMATIONID);
                if (entity.SHPI == "H")
                {
                    entity.AUDITTIME     = DateTime.Now;//审核时间
                    entity.AUDITTEPERSON = currentPerson;
                    if (entity.ISAGGREY == "不同意")
                    {
                        entity.REPORTSTATUS   = Common.REPORTSTATUS.审核驳回.ToString();
                        entity.REPORTSTATUSZI = Common.REPORTSTATUS.审核驳回.GetHashCode().ToString();

                        if (applianceTwo != null)
                        {
                            applianceOne.ISRECEIVE = Common.ISRECEIVE.是.ToString();
                            m_BLL2.EditField(ref validationErrors, applianceOne);
                            applianceTwo.ISRECEIVE = Common.ISRECEIVE.否.ToString();
                            m_BLL2.EditField(ref validationErrors, applianceTwo);
                        }
                        else
                        {
                            applianceOne.ISRECEIVE = Common.ISRECEIVE.是.ToString();
                            m_BLL2.EditField(ref validationErrors, applianceOne);
                        }
                    }
                    else if (entity.ISAGGREY == "同意")
                    {
                        entity.REPORTSTATUS   = Common.REPORTSTATUS.待批准.ToString();
                        entity.REPORTSTATUSZI = Common.REPORTSTATUS.待批准.GetHashCode().ToString();
                        if (adi.APPLIANCE_RECIVE == "是")
                        {
                            applianceOne.ORDER_STATUS             = Common.ORDER_STATUS.试验完成.ToString();               //自己改变状态
                            applianceOne.EQUIPMENT_STATUS_VALUUMN = Common.ORDER_STATUS.试验完成.GetHashCode().ToString(); //自己改变状态
                        }
                        if (applianceTwo != null)
                        {
                            applianceOne.ISRECEIVE = Common.ISRECEIVE.否.ToString();
                            m_BLL2.EditField(ref validationErrors, applianceOne);
                            applianceTwo.ISRECEIVE = Common.ISRECEIVE.是.ToString();
                            m_BLL2.EditField(ref validationErrors, applianceTwo);
                        }
                        else
                        {
                            applianceOne.ISRECEIVE = Common.ISRECEIVE.否.ToString();
                            m_BLL2.EditField(ref validationErrors, applianceOne);
                        }
                    }
                    #region 审核过程记录
                    SH.ID                 = Result.GetNewId();   //id
                    SH.CREATEPERSON       = account.PersonName;  //审核者
                    SH.CREATETIME         = DateTime.Now;        //审核时间
                    SH.REVIEWCONCLUSION   = entity.ISAGGREY;
                    SH.REVIEWCONCLUSIONZI = entity.AUDITOPINION; //审核意见
                    SH.PREPARE_SCHEMEID   = entity.ID;
                    if (!m_BLL4.Create(ref validationErrors, SH))
                    {
                        if (validationErrors != null && validationErrors.Count > 0)
                        {
                            validationErrors.All(a =>
                            {
                                returnValue += a.ErrorMessage;
                                return(true);
                            });
                        }
                        LogClassModels.WriteServiceLog(Suggestion.UpdateFail + ",预备方案信息的Id为" + entity.ID, "审核过程记录");//写入日志
                    }
                    #endregion
                }
                else if (entity.SHPI == "P")
                {
                    entity.APPROVALDATE    = DateTime.Now;
                    entity.APPROVALEPERSON = currentPerson;
                    if (entity.APPROVALISAGGREY == "不同意")
                    {
                        entity.REPORTSTATUS   = Common.REPORTSTATUS.批准驳回.ToString();
                        entity.REPORTSTATUSZI = Common.REPORTSTATUS.批准驳回.GetHashCode().ToString();
                        if (applianceTwo != null)
                        {
                            if (applianceTwo.ORDER_STATUS == Common.ORDER_STATUS.已分配.ToString())
                            {
                                applianceOne.ISRECEIVE = Common.ISRECEIVE.是.ToString();
                                applianceTwo.ISRECEIVE = Common.ISRECEIVE.否.ToString();
                            }
                            else if (applianceTwo.ORDER_STATUS == Common.ORDER_STATUS.已领取.ToString())
                            {
                                applianceOne.ISRECEIVE = Common.ISRECEIVE.否.ToString();
                                applianceTwo.ISRECEIVE = Common.ISRECEIVE.是.ToString();
                            }
                            else if (applianceTwo.PREPARE_SCHEME.REPORTSTATUS == Common.REPORTSTATUS.待批准.ToString())
                            {
                                applianceOne.ISRECEIVE = Common.ISRECEIVE.是.ToString();
                                applianceTwo.ISRECEIVE = Common.ISRECEIVE.否.ToString();
                            }
                            else if (applianceTwo.PREPARE_SCHEME.REPORTSTATUS == Common.REPORTSTATUS.已批准.ToString())
                            {
                                applianceOne.ISRECEIVE = Common.ISRECEIVE.是.ToString();
                                applianceTwo.ISRECEIVE = Common.ISRECEIVE.否.ToString();
                            }
                            else if (applianceTwo.PREPARE_SCHEME.REPORTSTATUS == Common.REPORTSTATUS.批准驳回.ToString())
                            {
                                applianceOne.ISRECEIVE = Common.ISRECEIVE.否.ToString();
                                applianceTwo.ISRECEIVE = Common.ISRECEIVE.是.ToString();
                            }
                            m_BLL2.EditField(ref validationErrors, applianceOne);
                            m_BLL2.EditField(ref validationErrors, applianceTwo);
                        }
                        else
                        {
                            applianceOne.ISRECEIVE = Common.ISRECEIVE.是.ToString();
                            m_BLL2.EditField(ref validationErrors, applianceOne);
                        }
                    }
                    else if (entity.APPROVALISAGGREY == "同意")
                    {
                        entity.REPORTSTATUS   = Common.REPORTSTATUS.已批准.ToString();
                        entity.REPORTSTATUSZI = Common.REPORTSTATUS.已批准.GetHashCode().ToString();
                        if (adi != null)
                        {
                            if (adi.APPLIANCE_RECIVE == "是")
                            {
                                applianceOne.ORDER_STATUS             = Common.ORDER_STATUS.待入库.ToString();
                                applianceOne.EQUIPMENT_STATUS_VALUUMN = Common.ORDER_STATUS.待入库.GetHashCode().ToString();
                            }
                            else
                            {
                                applianceOne.ORDER_STATUS             = Common.ORDER_STATUS.器具未收.ToString();
                                applianceOne.EQUIPMENT_STATUS_VALUUMN = Common.ORDER_STATUS.器具未收.GetHashCode().ToString();
                            }
                        }

                        applianceOne.ISRECEIVE = Common.ISRECEIVE.否.ToString();
                        m_BLL2.EditField(ref validationErrors, applianceOne);
                    }
                    #region 审批过程记录
                    SP.ID                   = Result.GetNewId(); //id
                    SP.CREATEPERSON         = account.Name;      //审核者
                    SP.CREATETIME           = DateTime.Now;      //审核时间
                    SP.APPROVALCONCLUSION   = entity.APPROVALISAGGREY;
                    SP.PREPARE_SCHEMEID     = entity.ID;
                    SP.APPROVALCONCLUSIONZI = entity.APPROVAL;//审批意见
                    if (!m_BLL5.Create(ref validationErrors, SP))
                    {
                        if (validationErrors != null && validationErrors.Count > 0)
                        {
                            validationErrors.All(a =>
                            {
                                returnValue += a.ErrorMessage;
                                return(true);
                            });
                        }
                        LogClassModels.WriteServiceLog(Suggestion.UpdateFail + ",预备方案信息的Id为" + entity.ID, "审批过程记录");//写入日志
                    }

                    #endregion
                }


                bool HE = false;
                if (!string.IsNullOrEmpty(applianceOne.ORDER_STATUS) || !string.IsNullOrEmpty(entity.REPORTSTATUS))
                {
                    HE = m_BLL.EditField(ref validationErrors, entity);//器具明细修改
                }
                try
                {
                    if (entity.REPORTSTATUS == Common.REPORTSTATUS.待批准.ToString() || entity.REPORTSTATUS == Common.REPORTSTATUS.已批准.ToString())
                    {
                        Langben.Report.ReportBLL rBLL = new Langben.Report.ReportBLL();
                        string err = "";
                        rBLL.AddQianMing(entity.ID, entity.REPORTSTATUS, out err);
                    }
                }
                catch (Exception ex)
                {
                }
                if (HE)
                {
                    LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",预备方案信息的Id为" + entity.ID, "预备方案"
                                                   );//写入日志
                    result.Code    = Common.ClientCode.Succeed;
                    result.Message = Suggestion.UpdateSucceed;
                    result.Id      = entity.ID;
                    return(result); //提示更新成功
                }
                else
                {
                    if (validationErrors != null && validationErrors.Count > 0)
                    {
                        validationErrors.All(a =>
                        {
                            returnValue += a.ErrorMessage;
                            return(true);
                        });
                    }
                    LogClassModels.WriteServiceLog(Suggestion.UpdateFail + ",预备方案信息的Id为" + entity.ID + "," + returnValue, "预备方案"
                                                   );//写入日志
                    result.Code    = Common.ClientCode.Fail;
                    result.Message = Suggestion.UpdateFail + returnValue;
                    return(result); //提示更新失败
                }
            }
            result.Code    = Common.ClientCode.FindNull;
            result.Message = Suggestion.UpdateFail + "请核对输入的数据的格式";
            return(result); //提示输入的数据的格式不对
        }