public Response <ChangeResponse> Change(Common.Entities.ChangeRequest model) { var uid = this.GetUserId(); var suc = this.GetSucursal(); return(this.Reply(() => _process.Change(model, uid, suc))); }
public void ChangeTest() { var request = new Common.Entities.ChangeRequest { Sucursal = "01", Folio = "422168", Items = new Common.Entities.ChangeItem[] { new Common.Entities.ChangeItem { OldItem = "0000003518445", NewItem = "0000003518435" }, new Common.Entities.ChangeItem { OldItem = "0000003583185", NewItem = "0000003579528" }, new Common.Entities.ChangeItem { OldItem = "0000003584922", NewItem = "0000003584920" } } }; var ctx = new DataAccess.SirCoDataContext(); ctx.UpdateSerieStatus("0000003518435", Status.CA, Status.AC, 0); ctx.UpdateSerieStatus("0000003579528", Status.CA, Status.AC, 0); ctx.UpdateSerieStatus("0000003584920", Status.CA, Status.AC, 0); var res = _context.Change(request, 0, request.Sucursal); Assert.AreEqual("027852", res.Devolucion); Assert.AreEqual("434054", res.Venta); }
public void ReturnMismaCorrida() { /* * ('0000003391871', 'venta') * ,('0000003391872', 'misma corrida') * ,('0000003485731', 'dif corrida, mismo precio') * ,('0000003556980', 'dif corrida, precio mayor') */ var model = new Common.Entities.SaleRequest() { Sucursal = "01", VendedorId = 132 }; model.Productos = new Common.Entities.SerieFormasPago[] { new Common.Entities.SerieFormasPago { Serie = "0000003391871", FormasPago = new Common.Constants.FormaPago[] { Common.Constants.FormaPago.EF } } }; model.Pagos = new Common.Entities.Pago[] { new Common.Entities.Pago { FormaPago = Common.Constants.FormaPago.EF, Importe = 329 } }; _context.RequestProducto("0000003391871", 0); Common.Entities.SaleResponse folio = null; using (ShimsContext.Create()) { System.Fakes.ShimDateTime.NowGet = () => { return(DateTime.Parse("2019-03-06")); }; folio = _context.Sale(model, 0); } Assert.AreEqual("434054", folio.Folio); var crequest = new Common.Entities.ChangeRequest { Sucursal = "01", Folio = "434054", Items = new Common.Entities.ChangeItem[] { new Common.Entities.ChangeItem { OldItem = "0000003391871", NewItem = "0000003391872" } } }; _context.RequestProducto("0000003391872", 0); Common.Entities.ChangeResponse cres = null; using (ShimsContext.Create()) { System.Fakes.ShimDateTime.NowGet = () => { return(DateTime.Parse("2019-03-07")); }; cres = _context.Change(crequest, 0, "08"); } Assert.AreEqual("295595", cres.Venta); Assert.AreEqual("023287", cres.Devolucion); var ctx = new DataAccess.SirCoPVDataContext(); var dev = ctx.Devoluciones.Where(i => i.sucursal == "08" && i.devolvta == "023287").Single(); Assert.AreEqual(0, dev.disponible); }
public void CancelFormaPago_DV() { /* * 1 NULL 0000003678429 AC 539.00 CTA 682 16- A 15 17 324 * 2 NULL 0000003522471 AC 539.00 CTA 682 15 A 15 17 324 * 3 NULL 0000003776476 AC 589.00 CTA 682 19- B 17- 21 324 * 4 NULL 0000003776472 AC 589.00 CTA 682 18- B 17- 21 324 * 5 NULL 0000003678238 AC 649.00 CTA 682 24 C 21- 26 324 * 6 NULL 0000003676610 AC 649.00 CTA 682 25 C 21- 26 324 */ var model = new Common.Entities.SaleRequest() { Sucursal = "01", VendedorId = 132 }; model.Productos = new Common.Entities.SerieFormasPago[] { new Common.Entities.SerieFormasPago { Serie = "0000003678429", FormasPago = new Common.Constants.FormaPago[] { Common.Constants.FormaPago.EF } } }; model.Pagos = new Common.Entities.Pago[] { new Common.Entities.Pago { FormaPago = Common.Constants.FormaPago.EF, Importe = 539 } }; _context.RequestProducto("0000003678429", 0); Common.Entities.SaleResponse folio = null; using (ShimsContext.Create()) { System.Fakes.ShimDateTime.NowGet = () => { return(DateTime.Parse("2019-03-06")); }; folio = _context.Sale(model, 0); } Assert.AreEqual("434054", folio.Folio); var crequest = new Common.Entities.ChangeRequest { Sucursal = "01", Folio = "434054", Items = new Common.Entities.ChangeItem[] { new Common.Entities.ChangeItem { OldItem = "0000003678429", NewItem = "0000003522471" } } }; _context.RequestProducto("0000003522471", 0); Common.Entities.ChangeResponse cres = null; using (ShimsContext.Create()) { System.Fakes.ShimDateTime.NowGet = () => { return(DateTime.Parse("2019-03-07")); }; cres = _context.Change(crequest, 0, "08"); } Assert.AreEqual("295595", cres.Venta); Assert.AreEqual("023287", cres.Devolucion); var ctx = new DataAccess.SirCoPVDataContext(); var dev = ctx.Devoluciones.Where(i => i.sucursal == "08" && i.devolvta == "023287").Single(); Assert.AreEqual(0, dev.disponible); var cancel = new Common.Entities.CancelSaleRequest { Sucursal = "08", Folio = "295595" }; using (ShimsContext.Create()) { System.Fakes.ShimDateTime.NowGet = () => { return(DateTime.Parse("2019-03-07")); }; _context.CancelSale(cancel, 0); } ctx.Entry(dev).Reload(); Assert.AreEqual(539, dev.disponible); }