コード例 #1
0
        public void Save()
        {
            if (Mode == EditMode.CREATE)
            {
                iPlansBatchService.InsertSinglePlansBatch(Model);
            }
            else if (Mode == EditMode.UPDATE)
            {
                iPlansBatchService.UpdateSinglePlansBatch(Model);
            }
            var win = GetView() as System.Windows.Window;

            if (win != null)
            {
                win.DialogResult = true;
                win.Close();
            }
        }
コード例 #2
0
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public JsonResult SavePlanData(PlansBatchModel model)
        {
            var result = new ResultJson();

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

                var msg = new MessageModel();
                if (model.BatchID == 0)
                {
                    msg = _plansBatchService.InsertSinglePlansBatch(model);
                }
                else
                {
                    msg = _plansBatchService.UpdateSinglePlansBatch(model);
                }

                if (msg.Status == MessageStatus.Success)
                {
                    result.IsSuccess = true;
                }
            }
            catch (Exception)
            {
                throw;
            }


            return(Json(result));
        }