public HttpResponseMessage Put(Pallet e)
        {
            var item = PalletRepository.UpdatePallet(e);
            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, item);

            return(response);
        }
        public HttpResponseMessage Post(List <Pallet> e)
        {
            HttpResponseMessage response = null;

            try
            {
                var inventory = new List <Pallet>();


                inventory = PalletRepository.InsertPallet(e);
                response  = Request.CreateResponse(HttpStatusCode.OK, inventory);
            }
            catch (Exception x)
            {
                string error = x.ToString();
                if (error.Equals("An error occurred while updating the entries. See the inner exception for details."))
                {
                    return(new HttpResponseMessage(HttpStatusCode.NotModified));
                }
                else
                {
                    return(new HttpResponseMessage(HttpStatusCode.Forbidden));
                }
            }


            return(response);
        }
        public HttpResponseMessage GetItemsBySalesOrder(String salesOrder)
        {
            var employees = PalletRepository.GetPalletBySalesOrder(salesOrder);
            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, employees);

            return(response);
        }
        public HttpResponseMessage GetItemsByDate(DateTime date)
        {
            var employees = PalletRepository.GetPalletByDate(date);
            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, employees);

            return(response);
        }
        public HttpResponseMessage Get()
        {
            var employees = PalletRepository.GetAllPallets();
            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, employees);

            return(response);
        }
Beispiel #6
0
        public void AñadirNuevoPallet()
        {
            var newPallet = new Pallet
            {
                Code = 3,
                Line = _line
            };

            newPallet = PalletRepository.SaveOrUpdate(newPallet);
            Assert.AreEqual(newPallet.Code, 1);
        }
Beispiel #7
0
 public static Pallet GetByCode(int code)
 {
     try
     {
         return(PalletRepository.GetByCode(code));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #8
0
        public static Pallet SaveOrUpdate(Pallet pallet)
        {
            try
            {
                if (pallet.Code == 0)
                {
                    new Exception("El código de estación no puede ser 0");
                }

                PalletRepository.SaveOrUpdate(pallet);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(pallet);
        }
Beispiel #9
0
        public string Add(Pallet palletAdd)
        {
            string resultMsg = "";
            Pallet pallet    = new Pallet();
            var    pall      = PalletRepository.GetQueryable().FirstOrDefault(p => p.PalletID == palletAdd.PalletID);

            if (pall != null)
            {
                try
                {
                    pall.WmsUUID  = palletAdd.WmsUUID;
                    pall.UUID     = palletAdd.UUID;
                    pall.TicketNo = palletAdd.TicketNo;
                    if (palletAdd.OperateDate > Convert.ToDateTime("0002-1-1"))
                    {
                        pall.OperateDate = palletAdd.OperateDate;
                    }
                    pall.OperateType    = palletAdd.OperateType;
                    pall.BarCodeType    = palletAdd.BarCodeType;
                    pall.RfidAntCode    = palletAdd.RfidAntCode;
                    pall.PieceCigarCode = palletAdd.PieceCigarCode;
                    pall.BoxCigarCode   = palletAdd.BoxCigarCode;
                    pall.CigaretteName  = palletAdd.CigaretteName;
                    pall.Quantity       = palletAdd.Quantity;
                    pall.ScanTime       = palletAdd.ScanTime;

                    PalletRepository.SaveChanges();
                    return(resultMsg = "");
                }
                catch (Exception e)
                {
                    resultMsg = "发送失败:" + e.Message;
                    return(resultMsg);
                }
            }
            else
            {
                try
                {
                    pallet.PalletID = palletAdd.PalletID;
                    pallet.WmsUUID  = palletAdd.WmsUUID;
                    pallet.UUID     = palletAdd.UUID;
                    pallet.TicketNo = palletAdd.TicketNo;
                    if (palletAdd.OperateDate > Convert.ToDateTime("0002-1-1"))
                    {
                        pallet.OperateDate = palletAdd.OperateDate;
                    }
                    pallet.OperateType    = palletAdd.OperateType;
                    pallet.BarCodeType    = palletAdd.BarCodeType;
                    pallet.RfidAntCode    = palletAdd.RfidAntCode;
                    pallet.PieceCigarCode = palletAdd.PieceCigarCode;
                    pallet.BoxCigarCode   = palletAdd.BoxCigarCode;
                    pallet.CigaretteName  = palletAdd.CigaretteName;
                    pallet.Quantity       = palletAdd.Quantity;
                    pallet.ScanTime       = palletAdd.ScanTime;

                    PalletRepository.Add(pallet);
                    PalletRepository.SaveChanges();
                    return(resultMsg = "");
                }
                catch (Exception e)
                {
                    resultMsg = "发送失败:" + e.Message;
                    return(resultMsg);
                }
            }
        }