Beispiel #1
0
        public IActionResult AddOrUpdate([FromForm] Wms_delivery model, [FromForm] string id)
        {
            var validator = new DeliveryFluent();
            var results   = validator.Validate(model);
            var success   = results.IsValid;

            if (!success)
            {
                string msg = results.Errors.Aggregate("", (current, item) => (current + item.ErrorMessage + "</br>"));
                return(BootJsonH((PubEnum.Failed.ToInt32(), msg)));
            }
            if (id.IsEmptyZero())
            {
                if (!model.TrackingNo.IsEmpty())
                {
                    if (_deliveryServices.IsAny(c => c.TrackingNo == model.TrackingNo))
                    {
                        return(BootJsonH((false, PubConst.Delivery3)));
                    }
                }
                model.DeliveryId = PubId.SnowflakeId;
                model.CreateBy   = UserDtoCache.UserId;
                bool flag = _deliveryServices.Delivery(model);
                return(BootJsonH(flag ? (flag, PubConst.Add1) : (flag, PubConst.Add2)));
            }
            else
            {
                model.DeliveryId   = id.ToInt64();
                model.ModifiedBy   = UserDtoCache.UserId;
                model.ModifiedDate = DateTimeExt.DateTime;
                var flag = _deliveryServices.Update(model);
                return(BootJsonH(flag ? (flag, PubConst.Update1) : (flag, PubConst.Update2)));
            }
        }
Beispiel #2
0
        public IActionResult Add(string id, string stockOutId)
        {
            var model = new Wms_delivery();

            if (id.IsEmpty())
            {
                model.StockOutId = stockOutId.ToInt64();
                return(View(model));
            }
            else
            {
                model = _deliveryServices.QueryableToEntity(c => c.DeliveryId == SqlFunc.ToInt64(id));
                return(View(model));
            }
        }