Merge branch 'master' into 8222-refactorDeleteZone2
gitea/salix/pipeline/pr-master This commit looks good Details

This commit is contained in:
Alex Moreno 2024-12-02 12:53:00 +00:00
commit bf9f7d45bf
5 changed files with 38 additions and 10 deletions

View File

@ -0,0 +1,32 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`buy_getLastWithoutInventory`(
vItemFk INT,
vWarehouseFk INT
)
RETURNS int(11)
DETERMINISTIC
BEGIN
/**
* Retorna la última compra que no sea inventario.
*
* @param vItemFk Id del artículo
* @param vWarehouseFk Id del almacén
* @return Id de compra
*/
DECLARE vBuyFk INT;
SELECT b.id INTO vBuyFk
FROM buy b
JOIN entry e ON e.id = b.entryFk
JOIN travel t ON t.id = e.travelFk
WHERE e.id <> (SELECT defaultEntry FROM entryConfig)
AND e.supplierFk <> (SELECT supplierFk FROM inventoryConfig)
AND e.typeFk <> 'inventory'
AND b.itemFk = vItemFk
AND (t.warehouseInFk = vWarehouseFk OR t.warehouseInFk IS NULL)
ORDER BY ABS(DATEDIFF(util.VN_CURDATE(), t.landed)), e.created DESC
LIMIT 1;
RETURN vBuyFk;
END$$
DELIMITER ;

View File

@ -51,7 +51,7 @@ module.exports = Self => {
JOIN vn.productionConfig pc
WHERE sh.code = ? AND s.code = pc.sectorFromCode
), tItemInSector AS (
SELECT is2.itemFk, is2.created, is2.shelvingFk
SELECT is2.itemFk, is2.created, sh.code
FROM vn.itemShelving is2
JOIN vn.shelving sh ON sh.id = is2.shelvingFk
JOIN vn.parking p ON p.id = sh.parkingFk
@ -59,7 +59,7 @@ module.exports = Self => {
JOIN vn.productionConfig pc
WHERE sh.code <> ?
AND s.code = pc.sectorFromCode)
SELECT ti.itemFK, tis.shelvingFk
SELECT ti.itemFK, tis.code shelvingFk
FROM tItemShelving ti
JOIN tItemInSector tis ON tis.itemFk = ti.itemFk
JOIN vn.productionConfig pc

View File

@ -387,10 +387,10 @@ class Controller extends Section {
}
newOrderFromTicket() {
this.$http.post(`Orders/newFromTicket`, {ticketFk: this.ticket.id}).then(res => {
const path = this.$state.href('order.card.catalog', {id: res.data});
window.open(path, '_blank');
this.$http.post(`Orders/newFromTicket`, {ticketFk: this.ticket.id}).then(async res => {
const path = await this.vnApp.getUrl(`order/${res.data}/catalog`);
window.open(path, '_blank');
this.vnApp.showSuccess(this.$t('Order created'));
});
}

View File

@ -567,14 +567,10 @@ describe('Ticket', () => {
const expectedResponse = {id: 123};
window.open = jasmine.createSpy('open');
controller.$state.href = jasmine.createSpy('href')
.and.returnValue('/somePath');
$httpBackend.expect('POST', `Orders/newFromTicket`, expectedParams).respond(expectedResponse);
controller.newOrderFromTicket();
$httpBackend.flush();
expect(window.open).toHaveBeenCalledWith('/somePath', '_blank');
});
});

View File

@ -20,7 +20,7 @@ module.exports = {
xmlDocument: document,
format: 'code128',
displayValue: false,
width: 3.8,
width: 3.5,
height: 75,
margin: 0
});