public void Save()
        {
            if (Mode == EditMode.CREATE)
            {
                Model.Company = null;//必须设为null,否则会先添加外键值到数据库后添加主键值
                var result = iKillCullService.InsertSingleKillCull(Model);
            }
            else if (Mode == EditMode.UPDATE)
            {
                iKillCullService.UpdateSingleKillCull(Model);
            }
            var win = GetView() as System.Windows.Window;

            if (win != null)
            {
                win.DialogResult = true;
                win.Close();
            }
        }
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public JsonResult SaveKillCullData(KillCullModel model)
        {
            var result = new ResultJson();

            try
            {
                CPRODUCTEPC96 pro96 = new CPRODUCTEPC96();
                //种植场号
                pro96.BusinessCode = UserManagement.CurrentUser.CompanyId.ToString();
                //批次号
                pro96.GoodsCode = model.KillBatchID.ToString();
                //生成日期
                pro96.TagDate = DateTime.Now.ToString("yyyy年MM月dd日");
                var maxId = _codeMaxService.GetMaxCode("KillCull");
                //序号
                pro96.SeqNo = maxId;
                //标签类型
                pro96.EpcType = "3";
                model.KillEpc = pro96.PackEpc();

                model.CompanyID = UserManagement.CurrentUser.CompanyId;
                var msg = new MessageModel();
                if (model.KillCullID == 0)
                {
                    msg = _killCullService.InsertSingleKillCull(model);
                }
                else
                {
                    msg = _killCullService.UpdateSingleKillCull(model);
                }
                if (msg.Status == MessageStatus.Success)
                {
                    result.IsSuccess = true;
                }
            }
            catch (Exception)
            {
            }

            return(Json(result));
        }