refs #6156 new field #1718

Merged
jsegarra merged 13 commits from 6156-advanceTicketsNewField into dev 2024-09-11 10:27:07 +00:00
5 changed files with 71 additions and 62 deletions

View File

@ -19,8 +19,7 @@ BEGIN
CREATE OR REPLACE TEMPORARY TABLE tmp.filter
(INDEX (id))
SELECT
origin.ticketFk futureId,
SELECT origin.ticketFk futureId,

esto no me gusta porque esta como repetido de otros procs, o de las vistas entryIn, que lo revise @pablone

esto no me gusta porque esta como repetido de otros procs, o de las vistas entryIn, que lo revise @pablone

commit con las correcciones 92f305b9fd

commit con las correcciones 92f305b9fd5458f13291e8f8ff5b86bdb6e864f5
dest.ticketFk id,
dest.state,
origin.futureState,
@ -51,48 +50,48 @@ BEGIN
origin.warehouseFk futureWarehouseFk,
origin.companyFk futureCompanyFk,
IFNULL(dest.nickname, origin.nickname) nickname,
dest.landed
dest.landed,
dest.preparation
FROM (
SELECT
s.ticketFk,
c.salesPersonFk workerFk,
t.shipped,
t.totalWithVat,
st.name futureState,
am.name futureAgency,
count(s.id) futureLines,
GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) futureIpt,
CAST(SUM(litros) AS DECIMAL(10,0)) futureLiters,
SUM(s.quantity <= (IFNULL(il.stock,0) + IFNULL(im.amount, 0))) hasStock,
z.id futureZoneFk,
z.name futureZoneName,
st.classColor,
t.clientFk,
t.nickname,
t.addressFk,
t.warehouseFk,
t.companyFk,
t.agencyModeFk
FROM ticket t
JOIN client c ON c.id = t.clientFk
JOIN sale s ON s.ticketFk = t.id
JOIN saleVolume sv ON sv.saleFk = s.id
JOIN item i ON i.id = s.itemFk
JOIN ticketState ts ON ts.ticketFk = t.id
JOIN state st ON st.id = ts.stateFk
JOIN agencyMode am ON t.agencyModeFk = am.id
JOIN zone z ON t.zoneFk = z.id
LEFT JOIN itemPackingType ipt ON ipt.code = i.itemPackingTypeFk
LEFT JOIN tmp.itemMinacum im ON im.itemFk = i.id
AND im.warehouseFk = vWarehouseFk
LEFT JOIN tmp.itemList il ON il.itemFk = i.id
WHERE t.shipped BETWEEN vDateFuture AND util.dayend(vDateFuture)
AND t.warehouseFk = vWarehouseFk
GROUP BY t.id
SELECT s.ticketFk,
c.salesPersonFk workerFk,
t.shipped,
t.totalWithVat,
st.name futureState,
am.name futureAgency,
count(s.id) futureLines,
GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) futureIpt,
CAST(SUM(litros) AS DECIMAL(10,0)) futureLiters,
SUM(s.quantity <= (IFNULL(il.stock,0) + IFNULL(im.amount, 0))) hasStock,
z.id futureZoneFk,
z.name futureZoneName,
st.classColor,
t.clientFk,
t.nickname,
t.addressFk,
t.warehouseFk,
t.companyFk,
t.agencyModeFk
FROM ticket t
JOIN client c ON c.id = t.clientFk
JOIN sale s ON s.ticketFk = t.id
JOIN saleVolume sv ON sv.saleFk = s.id
JOIN item i ON i.id = s.itemFk
JOIN ticketState ts ON ts.ticketFk = t.id
JOIN `state` st ON st.id = ts.stateFk
JOIN agencyMode am ON t.agencyModeFk = am.id
JOIN `zone` z ON t.zoneFk = z.id
LEFT JOIN zoneClosure zc ON zc.zoneFk = t.zoneFk
LEFT JOIN itemPackingType ipt ON ipt.code = i.itemPackingTypeFk
LEFT JOIN tmp.itemMinacum im ON im.itemFk = i.id
AND im.warehouseFk = vWarehouseFk
LEFT JOIN tmp.itemList il ON il.itemFk = i.id
WHERE t.shipped BETWEEN vDateFuture AND util.dayend(vDateFuture)
AND t.warehouseFk = vWarehouseFk
GROUP BY t.id
) origin
LEFT JOIN (
SELECT
t.id ticketFk,
SELECT t.id ticketFk,
jgallego marked this conversation as resolved Outdated

CONCAT_WS(':',
COALESCE(HOUR(t.shipped), HOUR(zc.hour), HOUR(z.hour)),
COALESCE(MINUTE(t.shipped), MINUTE(zc.hour), MINUTE(z.hour))
) AS preparation

mira a vore si açò es lo mateix es mes compacte

CONCAT_WS(':', COALESCE(HOUR(t.shipped), HOUR(zc.hour), HOUR(z.hour)), COALESCE(MINUTE(t.shipped), MINUTE(zc.hour), MINUTE(z.hour)) ) AS preparation mira a vore si açò es lo mateix es mes compacte
615f57b2e6d5fd2951bee7f5cd9822f61af87ee5
st.name state,
GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) ipt,
t.shipped,
@ -108,18 +107,25 @@ BEGIN
t.warehouseFk,
t.companyFk,
t.landed,
t.agencyModeFk
t.agencyModeFk,
SEC_TO_TIME(
COALESCE(HOUR(t.shipped), HOUR(zc.hour), HOUR(z.hour)) * 3600 +
COALESCE(MINUTE(t.shipped), MINUTE(zc.hour), MINUTE(z.hour)) * 60
) preparation
FROM ticket t
JOIN sale s ON s.ticketFk = t.id
JOIN saleVolume sv ON sv.saleFk = s.id
JOIN item i ON i.id = s.itemFk
jgallego marked this conversation as resolved Outdated

!= 0 es redundant, a mes en tot cas seria FALSE, jo el deixaria com estava

!= 0 es redundant, a mes en tot cas seria FALSE, jo el deixaria com estava
c407dde7a021c3defe5ca8003758dbf163995159
JOIN ticketState ts ON ts.ticketFk = t.id
JOIN state st ON st.id = ts.stateFk
JOIN `state` st ON st.id = ts.stateFk
JOIN agencyMode am ON t.agencyModeFk = am.id
LEFT JOIN itemPackingType ipt ON ipt.code = i.itemPackingTypeFk
LEFT JOIN `zone` z ON z.id = t.zoneFk
LEFT JOIN zoneClosure zc ON zc.zoneFk = t.zoneFk
JOIN ticketCanAdvanceConfig tc
WHERE t.shipped BETWEEN vDateToAdvance AND util.dayend(vDateToAdvance)
AND t.warehouseFk = vWarehouseFk
AND st.order <= 5
AND st.order <= tc.destinationOrder
GROUP BY t.id
) dest ON dest.addressFk = origin.addressFk
WHERE origin.hasStock;

View File

@ -0,0 +1,9 @@
-- Place your SQL code here
CREATE TABLE IF NOT EXISTS vn.ticketCanAdvanceConfig (
id int(10) unsigned NOT NULL,
jgallego marked this conversation as resolved Outdated

copia l'estructura d eles taules config. no deu ser autoincrement i crec que tenen triggers o algo

copia l'estructura d eles taules config. no deu ser autoincrement i crec que tenen triggers o algo

Este código está hecho de hace 1 año, lo reviso

Este código está hecho de hace 1 año, lo reviso

Tienen diferente configuración:
db/versions/11175-pinkChico/00-firstScript.sql
db/versions/11194-orangeOrchid/00-firstScript.sql

Cual aplico?

Tienen diferente configuración: db/versions/11175-pinkChico/00-firstScript.sql db/versions/11194-orangeOrchid/00-firstScript.sql Cual aplico?
773933ca3c32bec8745457afd9e23fb80d96c0fe
destinationOrder INT NULL,
PRIMARY KEY (`id`),
CONSTRAINT `ticketCanAdvanceConfig_check` CHECK (`id` = 1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
INSERT INTO vn.ticketCanAdvanceConfig SET id =1, destinationOrder = 5;

View File

@ -105,13 +105,12 @@ module.exports = Self => {
stmt = new ParameterizedSQL(
`CALL vn.ticket_canAdvance(?,?,?)`,
[args.dateFuture, args.dateToAdvance, args.warehouseFk]);
[args.dateFuture, args.dateToAdvance, args.warehouseFk]
);
stmts.push(stmt);
stmt = new ParameterizedSQL(`
SELECT f.*
FROM tmp.filter f`);
stmt = new ParameterizedSQL(`SELECT f.* FROM tmp.filter f`);
stmt.merge(conn.makeWhere(filter.where));
@ -119,9 +118,7 @@ module.exports = Self => {
stmt.merge(conn.makeLimit(filter));
const ticketsIndex = stmts.push(stmt) - 1;
stmts.push(
`DROP TEMPORARY TABLE
tmp.filter`);
stmts.push(`DROP TEMPORARY TABLE tmp.filter`);
const sql = ParameterizedSQL.join(stmts, ';');
const result = await conn.executeStmt(sql, myOptions);

View File

@ -39,14 +39,8 @@
<thead>
<tr second-header>
<td></td>
<th colspan="7">
<span translate>Destination</span>
{{model.userParams.dateToAdvance| date: 'dd/MM/yyyy'}}
</th>
<th colspan="11">
<span translate>Origin</span>
{{model.userParams.dateFuture | date: 'dd/MM/yyyy'}}
</th>
<th colspan="9" translate>Destination</th>
<th colspan="11" translate>Origin</th>
</tr>
<tr>
<th shrink>
@ -56,14 +50,16 @@
check-field="checked">
</vn-multi-check>
</th>
<th shrink>
</th>
<th shrink></th>
<th field="id">
<span translate>ID</span>
</th>
<th field="ipt" title="{{'Item Packing Type' | translate}}">
<span>IPT</span>
</th>
<th field="preparation">
<span translate>Preparation</span>
</th>
<th field="state">
<span translate>State</span>
</th>
@ -125,6 +121,7 @@
</span>
</td>
<td>{{::ticket.ipt | dashIfEmpty}}</td>
<td>{{::ticket.preparation | dashIfEmpty}}</td>
<td>
<span
class="chip {{ticket.classColor}}">
@ -165,7 +162,6 @@
{{::(ticket.futureTotalWithVat ? ticket.futureTotalWithVat : 0) | currency: 'EUR': 2}}
</span>
</td>
</tr>
</tbody>
</table>

View File

@ -14,3 +14,4 @@ Success: Tickets movidos correctamente
IPT: Encajado
Origin Date: Fecha origen
Destination Date: Fecha destino
Preparation: Preparación