Exemple #1
0
        public string AddCirculationRecord(string barCode, string sOperator, string currentPosition, string reason, string accessToKen)
        {
            try
            {
                if (!ToKenHelper.CheckAccessToKen(accessToKen))
                {
                    return(ToolsLib.Utility.CommonUtils.JsonSerialize(new { Msg = commonErrorMsg }));
                }

                InstrumentModel instrumentModel = ServiceProvider.InstrumentService.GetByBarCode(barCode);
                if (instrumentModel == null)
                {
                    return(ToolsLib.Utility.CommonUtils.JsonSerialize(new { Msg = "不存在该设备!" }));
                }
                Global.Common.Models.UserModel user = Global.Business.ServiceProvider.UserService.GetByLoginName(sOperator);
                if (user == null)
                {
                    return("用户不存在!");
                }
                InstrumentFlowModel model = new InstrumentFlowModel();
                model.Creator      = user.UserName;
                model.Flow_Type    = 1;
                model.InstrumentId = instrumentModel.InstrumentId;
                model.Place        = currentPosition;
                model.Reason       = reason;

                ServiceProvider.InstrumentFlowService.Save(model);
                return(ToolsLib.Utility.CommonUtils.JsonSerialize(new { Msg = "OK" }));
            }
            catch (Exception ex)
            {
                log.Error(ex);
                return(ToolsLib.Utility.CommonUtils.JsonSerialize(new { Msg = ex.Message }));
            }
        }
Exemple #2
0
 /// <summary>
 /// 保存实体数据.
 /// </summary>
 public void Save(InstrumentFlowModel model)
 {
     if (model.FlowId == 0)
     {
         DBProvider.InstrumentFlowDao.Add(model);
     }
     else
     {
         DBProvider.InstrumentFlowDao.Update(model);
     }
 }
        public ActionResult Save(string barCode, InstrumentFlowModel model)
        {
            Instrument.Common.Models.InstrumentModel instrument = ServiceProvider.InstrumentService.GetByBarCode(barCode);
            if (instrument == null)
            {
                return(Json(new { Msg = "Not Found" }));
            }
            string InstrumentInfo = "<b>仪器名称:</b>" + instrument.InstrumentName + " | <b>仪器型号:</b>" + instrument.Specification + " | <b>出厂编号:</b>" + instrument.SerialNo + " | <b>管理编号:</b>" + instrument.ManageNo;

            model.InstrumentId = instrument.InstrumentId;
            model.Creator      = LoginHelper.LoginUser.UserName;
            model.Place        = "";
            ServiceProvider.InstrumentFlowService.Save(model);
            return(Json(new { Msg = "OK", InstrumentInfo = InstrumentInfo, InstrumentId = UtilsHelper.Encrypt(instrument.InstrumentId.ToString()) }, JsonRequestBehavior.AllowGet));
        }
 /// <summary>
 /// 更新一条数据.
 /// </summary>
 public void Update(InstrumentFlowModel model)
 {
     DBProvider.dbMapper.Update("Instrument_Flow.Update", model);
 }
 /// <summary>
 /// 增加一条数据.
 /// </summary>
 public void Add(InstrumentFlowModel model)
 {
     DBProvider.dbMapper.Insert("Instrument_Flow.Insert", model);
 }