Пример #1
0
        public tLabelsxModel AddtLabelsxModel(W_LabelStorage w_LabelStorage, AddtLabelx addtLabelx, int ResulCode, string ResultStatus, string Errorinfo = "")
        {
            tLabelsxModel tLabelsxModel = new tLabelsxModel();

            tLabelsxModel.QRCode       = addtLabelx.QRCode;
            tLabelsxModel.Aname        = addtLabelx.DealersName;
            tLabelsxModel.OrderNumbel  = addtLabelx.OrderNumbels;
            tLabelsxModel.ResulCode    = ResulCode;
            tLabelsxModel.ResultStatus = ResultStatus;
            tLabelsxModel.Errorinfo    = Errorinfo;
            tLabelsxModel.tLabels_X    = w_LabelStorage;
            return(tLabelsxModel);
        }
Пример #2
0
        /// <summary>
        /// 添加数据
        /// </summary>
        /// <param name="addtLabelx"></param>
        /// <returns></returns>
        public tLabelsxModel AddtLabelX(AddtLabelx addtLabelx)
        {
            tLabelsxModel tLabelsxModel = new tLabelsxModel();
            var           tlabelx       = new W_LabelStorage()
            {
                QRCode        = addtLabelx.QRCode,
                OrderTime     = addtLabelx.OrderTime,
                OutTime       = DateTime.Now,
                Dealers       = addtLabelx.Dealers,
                Adminaccount  = addtLabelx.Adminaccount,
                OutType       = addtLabelx.OutType,
                OrderNumbels  = addtLabelx.OrderNumbels,
                ExtensionName = addtLabelx.ExtensionName,
            };

            try
            {
                //var re = DbEntities.tLabels_X.AsNoTracking().Where(w=>w.QRCode.Contains(addtLabelx.QRCode)).Select(s=>s.QRCode).FirstOrDefault();
                //if(re!=null)
                //{
                //    return AddtLabelsxModel(tlabelx, addtLabelx, 200, "重复发货");
                //}

                DbEntities.W_LabelStorage.Add(tlabelx);
                int i = DbEntities.SaveChanges();
                if (i > 0)
                {
                    return(AddtLabelsxModel(tlabelx, addtLabelx, 200, "出库成功"));
                }
                else
                {
                    return(AddtLabelsxModel(tlabelx, addtLabelx, 400, "出库失败"));
                }
            }
            catch (Exception ex)
            {
                string strinfo = ex.InnerException.InnerException.Message;
                return(AddtLabelsxModel(tlabelx, addtLabelx, 404, "系统错误", strinfo));
            }
        }