8032-devToTest_2440 #3009

Merged
alexm merged 262 commits from 8032-devToTest_2440 into test 2024-09-24 09:34:49 +00:00
5 changed files with 71 additions and 62 deletions
Showing only changes of commit ace4e6975d - Show all commits

View File

@ -19,8 +19,7 @@ BEGIN
CREATE OR REPLACE TEMPORARY TABLE tmp.filter CREATE OR REPLACE TEMPORARY TABLE tmp.filter
(INDEX (id)) (INDEX (id))
SELECT SELECT origin.ticketFk futureId,
origin.ticketFk futureId,
dest.ticketFk id, dest.ticketFk id,
dest.state, dest.state,
origin.futureState, origin.futureState,
@ -51,10 +50,10 @@ BEGIN
origin.warehouseFk futureWarehouseFk, origin.warehouseFk futureWarehouseFk,
origin.companyFk futureCompanyFk, origin.companyFk futureCompanyFk,
IFNULL(dest.nickname, origin.nickname) nickname, IFNULL(dest.nickname, origin.nickname) nickname,
dest.landed dest.landed,
dest.preparation
FROM ( FROM (
SELECT SELECT s.ticketFk,
s.ticketFk,
c.salesPersonFk workerFk, c.salesPersonFk workerFk,
t.shipped, t.shipped,
t.totalWithVat, t.totalWithVat,
@ -79,9 +78,10 @@ BEGIN
JOIN saleVolume sv ON sv.saleFk = s.id JOIN saleVolume sv ON sv.saleFk = s.id
JOIN item i ON i.id = s.itemFk JOIN item i ON i.id = s.itemFk
JOIN ticketState ts ON ts.ticketFk = t.id 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 JOIN agencyMode am ON t.agencyModeFk = am.id
JOIN zone z ON t.zoneFk = z.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 itemPackingType ipt ON ipt.code = i.itemPackingTypeFk
LEFT JOIN tmp.itemMinacum im ON im.itemFk = i.id LEFT JOIN tmp.itemMinacum im ON im.itemFk = i.id
AND im.warehouseFk = vWarehouseFk AND im.warehouseFk = vWarehouseFk
@ -91,8 +91,7 @@ BEGIN
GROUP BY t.id GROUP BY t.id
) origin ) origin
LEFT JOIN ( LEFT JOIN (
SELECT SELECT t.id ticketFk,
t.id ticketFk,
st.name state, st.name state,
GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) ipt, GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) ipt,
t.shipped, t.shipped,
@ -108,18 +107,25 @@ BEGIN
t.warehouseFk, t.warehouseFk,
t.companyFk, t.companyFk,
t.landed, 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 FROM ticket t
JOIN sale s ON s.ticketFk = t.id JOIN sale s ON s.ticketFk = t.id
JOIN saleVolume sv ON sv.saleFk = s.id JOIN saleVolume sv ON sv.saleFk = s.id
JOIN item i ON i.id = s.itemFk JOIN item i ON i.id = s.itemFk
JOIN ticketState ts ON ts.ticketFk = t.id 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 JOIN agencyMode am ON t.agencyModeFk = am.id
LEFT JOIN itemPackingType ipt ON ipt.code = i.itemPackingTypeFk 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) WHERE t.shipped BETWEEN vDateToAdvance AND util.dayend(vDateToAdvance)
AND t.warehouseFk = vWarehouseFk AND t.warehouseFk = vWarehouseFk
AND st.order <= 5 AND st.order <= tc.destinationOrder
GROUP BY t.id GROUP BY t.id
) dest ON dest.addressFk = origin.addressFk ) dest ON dest.addressFk = origin.addressFk
WHERE origin.hasStock; 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,
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( stmt = new ParameterizedSQL(
`CALL vn.ticket_canAdvance(?,?,?)`, `CALL vn.ticket_canAdvance(?,?,?)`,
[args.dateFuture, args.dateToAdvance, args.warehouseFk]); [args.dateFuture, args.dateToAdvance, args.warehouseFk]
);
stmts.push(stmt); stmts.push(stmt);
stmt = new ParameterizedSQL(` stmt = new ParameterizedSQL(`SELECT f.* FROM tmp.filter f`);
SELECT f.*
FROM tmp.filter f`);
stmt.merge(conn.makeWhere(filter.where)); stmt.merge(conn.makeWhere(filter.where));
@ -119,9 +118,7 @@ module.exports = Self => {
stmt.merge(conn.makeLimit(filter)); stmt.merge(conn.makeLimit(filter));
const ticketsIndex = stmts.push(stmt) - 1; const ticketsIndex = stmts.push(stmt) - 1;
stmts.push( stmts.push(`DROP TEMPORARY TABLE tmp.filter`);
`DROP TEMPORARY TABLE
tmp.filter`);
const sql = ParameterizedSQL.join(stmts, ';'); const sql = ParameterizedSQL.join(stmts, ';');
const result = await conn.executeStmt(sql, myOptions); const result = await conn.executeStmt(sql, myOptions);

View File

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

View File

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