Skip to content

Commit

Permalink
Merge release 2024-R3.2 into master (#810)
Browse files Browse the repository at this point in the history
* LIMS-1319: Show dose for all data collection types (#791)

* LIMS-954: Add ability to edit manufacturer serial no on dewars (#652)

* LIMS-1276: Add printed date to shipping labels (#755)

* LIMS-902: Clear sessionId from containers when requesting a dewar transfer (#673)

* LIMS-277: Fix sample changer view scaling (#794)

* LIMS-121: Allow use of VMXm Gridboxes and Cartridges (#732)

* LIMS-1257: Allow population of source fields (#769)

* LIMS-1382: Add message to users about using the shipping service (#801)

---------

Co-authored-by: Mark Williams <[email protected]>
Co-authored-by: Guilherme Francisco <[email protected]>
  • Loading branch information
3 people authored Jul 23, 2024
1 parent da53c52 commit ed7962d
Show file tree
Hide file tree
Showing 21 changed files with 130 additions and 58 deletions.
25 changes: 16 additions & 9 deletions api/assets/pdf/shipment_label.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@
<ol>
<li><span class="bold">Dewar Label:</span> affix this label to your dewar which ensures it can be identified at all times at the facility</li>
<li><span class="bold">Outbound Address label:</span> To be attached to the outside of your transport container for shipment to facility</li>
<li><span class="bold">Return Address Label:</span> The return address for your shipment (Please include this in your shipment, e.g. put it behind the outward bound address or in the transport container)</li>
<li><span class="bold">Return Address Label:</span> The return address for your shipment (Please include this in your shipment, e.g. put it behind the outbound label or in the transport container)</li>
</ol>
Please remove old paperwork immediately after you receive your dewar back from Diamond.
</div>


<br />
<br />

<p class="ca bold red">1. Dewar Tracking Label</p>
Expand Down Expand Up @@ -49,10 +48,6 @@
<td class="grey px150">Safety Level</td>
<td><?php echo $ship['SAFETYLEVEL'] ?></td>
</tr>
<tr>
<td class="grey px150">No. Parcels</td>
<td><?php echo sizeof($dewars) ?></td>
</tr>
</table>

<table class="center px500">
Expand All @@ -68,6 +63,10 @@
<td class="grey px150">Local Contact</td>
<td><?php echo $d['BEAMLINEOPERATOR'] ?></td>
</tr>
<tr>
<td class="grey px150">Printed on</td>
<td><?php echo date('j M o') ?></td>
</tr>
</table>

<div class="float-left px150 title-wrapper">
Expand All @@ -79,7 +78,7 @@
<?php foreach(explode(',', $d['CONTAINERSBARCODE']) as $bar_code) { ?>
<div class="container-item"><?php echo strlen($bar_code) > 15 ? substr($bar_code,0,14).'+' : $bar_code ?></div>
<?php }?>
<?php if ($d['CONTAINERS'] > 10) { ?>
<?php if ($d['CONTAINERS'] > count(explode(',', $d['CONTAINERSBARCODE']))) { ?>
<div class="container-item"><?php echo " plus " . ($d['CONTAINERS'] - count(explode(',', $d['CONTAINERSBARCODE']))) . " more" ?></div>
<?php }?>
</div>
Expand Down Expand Up @@ -158,6 +157,10 @@
<td class="grey px150">Local Contact</td>
<td><?php echo $d['BEAMLINEOPERATOR'] ?></td>
</tr>
<tr>
<td class="grey px150">Printed on</td>
<td><?php echo date('j M o') ?></td>
</tr>
</table>

<div class="left" style="width: 70px">FROM:</div>
Expand Down Expand Up @@ -250,6 +253,10 @@
<td class="grey px150">Transport Value</td>
<td><?php echo $d['TRANSPORTVALUE'] ?></td>
</tr>
<tr>
<td class="grey px150">Printed on</td>
<td><?php echo date('j M o') ?></td>
</tr>
</table>

<div class="left" style="width: 70px">FROM:</div>
Expand All @@ -267,4 +274,4 @@
<?php endif; ?>


<?php endforeach; ?>
<?php endforeach; ?>
4 changes: 2 additions & 2 deletions api/assets/pdf/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ table {
}

ol {
margin-left: 25px;
margin-left: 10px;
}

.bold {
Expand Down Expand Up @@ -185,4 +185,4 @@ ol {

.float-left {
float: left;
}
}
2 changes: 1 addition & 1 deletion api/src/Page/PDF.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ function _shipment_label()

$this->ship = $ship;

$this->dewars = $this->db->pq("SELECT bl.beamlinename, bl.beamlineoperator, TO_CHAR(bl.startdate, 'DD-MM-YYYY') as st, d.transportvalue, d.customsvalue, d.code, d.barcode, count(cq.containerqueueid) as auto, count(c.containerid) as containers, GROUP_CONCAT(COALESCE(cr.barCode, c.code) LIMIT 10) as containersBarCode
$this->dewars = $this->db->pq("SELECT bl.beamlinename, bl.beamlineoperator, TO_CHAR(bl.startdate, 'DD-MM-YYYY') as st, d.transportvalue, d.customsvalue, d.code, d.barcode, count(cq.containerqueueid) as auto, count(c.containerid) as containers, GROUP_CONCAT(COALESCE(cr.barCode, c.code) LIMIT 8) as containersBarCode
FROM dewar d
LEFT OUTER JOIN blsession bl ON d.firstexperimentid = bl.sessionid
LEFT OUTER JOIN container c ON c.dewarid = d.dewarid
Expand Down
14 changes: 9 additions & 5 deletions api/src/Page/Sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ class Sample extends Page
'MONOCHROMATOR' => '\w+',
'PRESET' => '\d',
'BEAMLINENAME' => '[\w\-]+',
'SOURCE' => '[\w\-]+',

'queued' => '\d',
'UNQUEUE' => '\d',
Expand Down Expand Up @@ -1342,8 +1343,10 @@ function _update_sample_components($initial, $final, $amounts, $crystalid)

function _add_sample()
{
if (!$this->has_arg('prop'))
$this->_error('No proposal specified');
if (!$this->has_arg('prop')) {
$this->_output(array());
return;
}

// Register entire container
if ($this->has_arg('collection')) {
Expand Down Expand Up @@ -1465,7 +1468,8 @@ function _prepare_sample_args($s = null)
'SAMPLEGROUP',
'STRATEGYOPTION',
'MINIMUMRESOLUTION',
'INITIALSAMPLEGROUP'
'INITIALSAMPLEGROUP',
'SOURCE'
) as $f) {
if ($s)
$a[$f] = array_key_exists($f, $s) ? $s[$f] : null;
Expand Down Expand Up @@ -1516,8 +1520,8 @@ function _do_add_sample($s)
}

$this->db->pq(
"INSERT INTO blsample (blsampleid,crystalid,diffractionplanid,containerid,location,comments,name,code,blsubsampleid,screencomponentgroupid,volume,packingfraction,dimension1,dimension2,dimension3,shape,looptype) VALUES (s_blsample.nextval,:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14,:15,:16) RETURNING blsampleid INTO :id",
array($crysid, $did, $a['CONTAINERID'], $a['LOCATION'], $a['COMMENTS'], $a['NAME'], $a['CODE'], $a['BLSUBSAMPLEID'], $a['SCREENCOMPONENTGROUPID'], $a['VOLUME'], $a['PACKINGFRACTION'], $a['DIMENSION1'], $a['DIMENSION2'], $a['DIMENSION3'], $a['SHAPE'], $a['LOOPTYPE'])
"INSERT INTO blsample (blsampleid,crystalid,diffractionplanid,containerid,location,comments,name,code,blsubsampleid,screencomponentgroupid,volume,packingfraction,dimension1,dimension2,dimension3,shape,looptype,source) VALUES (s_blsample.nextval,:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14,:15,:16,IFNULL(:17,CURRENT_USER)) RETURNING blsampleid INTO :id",
array($crysid, $did, $a['CONTAINERID'], $a['LOCATION'], $a['COMMENTS'], $a['NAME'], $a['CODE'], $a['BLSUBSAMPLEID'], $a['SCREENCOMPONENTGROUPID'], $a['VOLUME'], $a['PACKINGFRACTION'], $a['DIMENSION1'], $a['DIMENSION2'], $a['DIMENSION3'], $a['SHAPE'], $a['LOOPTYPE'], $a['SOURCE'])
);
$sid = $this->db->id();

Expand Down
53 changes: 32 additions & 21 deletions api/src/Page/Shipment.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class Shipment extends Page
'STATUS' => '[\w|\s|\-]+',

'PURCHASEDATE' => '\d+-\d+-\d+',
'MANUFACTURERSERIALNUMBER' => '.*',
'LABCONTACTID' => '\d+',
'REPORT' => '.*',

Expand Down Expand Up @@ -126,6 +127,7 @@ class Shipment extends Page
'PUCK' => '\d',
'PROCESSINGPIPELINEID' => '\d+',
'OWNERID' => '\d+',
'SOURCE' => '[\w\-]+',

'CONTAINERREGISTRYID' => '\d+',
'PROPOSALID' => '\d+',
Expand Down Expand Up @@ -620,7 +622,7 @@ function _dewar_registry()
$args = array($this->proposalid);
$where = 'p.proposalid=:1';

$fields = "r.dewarregistryid, max(CONCAT(p.proposalcode, p.proposalnumber)) as prop, r.facilitycode, TO_CHAR(r.purchasedate, 'DD-MM-YYYY') as purchasedate, ROUND(TIMESTAMPDIFF('DAY',r.purchasedate, CURRENT_TIMESTAMP)/30.42,1) as age, r.labcontactid, count(distinct d.dewarid) as dewars, GROUP_CONCAT(distinct CONCAT(p.proposalcode,p.proposalnumber) SEPARATOR ', ') as proposals, r.bltimestamp, TO_CHAR(max(d.bltimestamp),'DD-MM-YYYY') as lastuse, count(dr.dewarreportid) as reports";
$fields = "r.dewarregistryid, max(CONCAT(p.proposalcode, p.proposalnumber)) as prop, r.facilitycode, TO_CHAR(r.purchasedate, 'DD-MM-YYYY') as purchasedate, ROUND(TIMESTAMPDIFF('DAY',r.purchasedate, CURRENT_TIMESTAMP)/30.42,1) as age, r.labcontactid, count(distinct d.dewarid) as dewars, GROUP_CONCAT(distinct CONCAT(p.proposalcode,p.proposalnumber) SEPARATOR ', ') as proposals, r.bltimestamp, TO_CHAR(max(d.bltimestamp),'DD-MM-YYYY') as lastuse, count(dr.dewarreportid) as reports, r.manufacturerserialnumber";
$group = "r.facilitycode";

if ($this->has_arg('all') && $this->staff) {
Expand Down Expand Up @@ -712,7 +714,8 @@ function _add_dewar_registry()
}

$purchase = $this->has_arg('PURCHASEDATE') ? $this->arg('PURCHASEDATE') : '';
$this->db->pq("INSERT INTO dewarregistry (facilitycode, purchasedate, bltimestamp) VALUES (:1, TO_DATE(:2, 'DD-MM-YYYY'), SYSDATE)", array($fc, $purchase));
$serial = $this->has_arg('MANUFACTURERSERIALNUMBER') ? $this->arg('MANUFACTURERSERIALNUMBER') : '';
$this->db->pq("INSERT INTO dewarregistry (facilitycode, purchasedate, bltimestamp, manufacturerserialnumber) VALUES (:1, TO_DATE(:2, 'DD-MM-YYYY'), SYSDATE, :3)", array($fc, $purchase, $serial));

$this->_output(array('FACILITYCODE' => $fc, 'DEWARREGISTRYID' => $this->db->id()));
}
Expand All @@ -734,7 +737,7 @@ function _update_dewar_registry()
else
$dew = $dew[0];

$fields = array('PURCHASEDATE');
$fields = array('PURCHASEDATE', 'MANUFACTURERSERIALNUMBER');
if ($this->staff)
array_push($fields, 'NEWFACILITYCODE');
foreach ($fields as $f) {
Expand Down Expand Up @@ -915,26 +918,25 @@ function _transfer_dewar()
if (!$this->has_arg('LOCATION'))
$this->_error('No location specified');

$dew = $this->db->pq("SELECT d.dewarid,s.shippingid
$dew = $this->db->pq("SELECT d.dewarid,s.shippingid,c.containerid
FROM dewar d
INNER JOIN shipping s ON s.shippingid = d.shippingid
INNER JOIN proposal p ON p.proposalid = s.proposalid
LEFT JOIN container c ON d.dewarid = c.dewarid
WHERE d.dewarid=:1 and p.proposalid=:2", array($this->arg('DEWARID'), $this->proposalid));

if (!sizeof($dew))
$this->_error('No such dewar');
else
$dew = $dew[0];


$this->db->pq(
"INSERT INTO dewartransporthistory (dewartransporthistoryid,dewarid,dewarstatus,storagelocation,arrivaldate)
VALUES (s_dewartransporthistory.nextval,:1,'transfer-requested',:2,CURRENT_TIMESTAMP) RETURNING dewartransporthistoryid INTO :id",
array($dew['DEWARID'], $this->arg('LOCATION'))
array($this->arg('DEWARID'), $this->arg('LOCATION'))
);

// Update dewar status to transfer-requested to keep consistent with history
$this->db->pq("UPDATE dewar set dewarstatus='transfer-requested' WHERE dewarid=:1", array($dew['DEWARID']));
$this->db->pq("UPDATE dewar set dewarstatus='transfer-requested' WHERE dewarid=:1", array($this->arg('DEWARID')));

if ($this->has_arg('NEXTVISIT')) {
$sessions = $this->db->pq(
Expand All @@ -947,7 +949,13 @@ function _transfer_dewar()

$sessionId = !empty($sessions) ? $sessions[0]['SESSIONID'] : NULL;

$this->db->pq("UPDATE dewar SET firstexperimentid=:1 WHERE dewarid=:2", array($sessionId, $dew['DEWARID']));
$this->db->pq("UPDATE dewar SET firstexperimentid=:1 WHERE dewarid=:2", array($sessionId, $this->arg('DEWARID')));

if (is_null($sessionId)) {
foreach ($dew as $container) {
$this->db->pq("UPDATE container SET sessionid=:1 WHERE containerid=:2", array($sessionId, $container['CONTAINERID']));
}
}
}

$email = new Email('dewar-transfer', '*** Dewar ready for internal transfer ***');
Expand Down Expand Up @@ -1550,16 +1558,17 @@ function _add_dewar()
$fc = $this->has_arg('FACILITYCODE') ? $this->arg('FACILITYCODE') : '';
$wg = $this->has_arg('WEIGHT') ? $this->arg('WEIGHT') : $dewar_weight;
$exp = null;
$source = $this->has_arg('SOURCE') ? $this->arg('SOURCE') : null;

if ($this->has_arg('FIRSTEXPERIMENTID')) {
$experimentId = $this->arg('FIRSTEXPERIMENTID');
$exp = !empty($experimentId) ? $this->arg('FIRSTEXPERIMENTID') : NULL;
}

$this->db->pq(
"INSERT INTO dewar (dewarid,code,trackingnumbertosynchrotron,trackingnumberfromsynchrotron,shippingid,bltimestamp,dewarstatus,firstexperimentid,facilitycode,weight)
VALUES (s_dewar.nextval,:1,:2,:3,:4,CURRENT_TIMESTAMP,'opened',:5,:6,:7) RETURNING dewarid INTO :id",
array($this->arg('CODE'), $to, $from, $this->arg('SHIPPINGID'), $exp, $fc, $wg)
"INSERT INTO dewar (dewarid,code,trackingnumbertosynchrotron,trackingnumberfromsynchrotron,shippingid,bltimestamp,dewarstatus,firstexperimentid,facilitycode,weight,source)
VALUES (s_dewar.nextval,:1,:2,:3,:4,CURRENT_TIMESTAMP,'opened',:5,:6,:7,IFNULL(:8,CURRENT_USER)) RETURNING dewarid INTO :id",
array($this->arg('CODE'), $to, $from, $this->arg('SHIPPINGID'), $exp, $fc, $wg, $source)
);

$id = $this->db->id();
Expand Down Expand Up @@ -2185,11 +2194,12 @@ function _add_container()
$crid = $this->has_arg('CONTAINERREGISTRYID') ? $this->arg('CONTAINERREGISTRYID') : null;

$pipeline = $this->has_arg('PROCESSINGPIPELINEID') ? $this->arg('PROCESSINGPIPELINEID') : null;
$source = $this->has_arg('SOURCE') ? $this->arg('SOURCE') : null;

$this->db->pq(
"INSERT INTO container (containerid,dewarid,code,bltimestamp,capacity,containertype,scheduleid,screenid,ownerid,requestedimagerid,comments,barcode,experimenttype,storagetemperature,containerregistryid,prioritypipelineid)
VALUES (s_container.nextval,:1,:2,CURRENT_TIMESTAMP,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14) RETURNING containerid INTO :id",
array($this->arg('DEWARID'), $this->arg('NAME'), $cap, $this->arg('CONTAINERTYPE'), $sch, $scr, $own, $rid, $com, $bar, $ext, $tem, $crid, $pipeline)
"INSERT INTO container (containerid,dewarid,code,bltimestamp,capacity,containertype,scheduleid,screenid,ownerid,requestedimagerid,comments,barcode,experimenttype,storagetemperature,containerregistryid,prioritypipelineid,source)
VALUES (s_container.nextval,:1,:2,CURRENT_TIMESTAMP,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14,IFNULL(:15,CURRENT_USER)) RETURNING containerid INTO :id",
array($this->arg('DEWARID'), $this->arg('NAME'), $cap, $this->arg('CONTAINERTYPE'), $sch, $scr, $own, $rid, $com, $bar, $ext, $tem, $crid, $pipeline, $source)
);

$cid = $this->db->id();
Expand Down Expand Up @@ -2665,6 +2675,7 @@ function _add_shipment()
$rt = $this->has_arg('READYBYTIME') ? $this->arg('READYBYTIME') : null;
$ct = $this->has_arg('CLOSETIME') ? $this->arg('CLOSETIME') : null;
$loc = $this->has_arg('PHYSICALLOCATION') ? $this->arg('PHYSICALLOCATION') : null;
$source = $this->has_arg('SOURCE') ? $this->arg('SOURCE') : null;

$hard_drive_enclosed = null;
if ($this->has_arg('ENCLOSEDHARDDRIVE')) {
Expand Down Expand Up @@ -2727,9 +2738,9 @@ function _add_shipment()
$extra = json_encode($extra_array);

$this->db->pq(
"INSERT INTO shipping (shippingid, proposalid, shippingname, deliveryagent_agentname, deliveryagent_agentcode, deliveryagent_shippingdate, deliveryagent_deliverydate, bltimestamp, creationdate, comments, sendinglabcontactid, returnlabcontactid, shippingstatus, safetylevel, readybytime, closetime, physicallocation)
VALUES (s_shipping.nextval,:1,:2,:3,:4,TO_DATE(:5,'DD-MM-YYYY'), TO_DATE(:6,'DD-MM-YYYY'),CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,:7,:8,:9,'opened',:10, :11, :12, :13) RETURNING shippingid INTO :id",
array($this->proposalid, $this->arg('SHIPPINGNAME'), $an, $ac, $sd, $dd, $com, $this->arg('SENDINGLABCONTACTID'), $this->arg('RETURNLABCONTACTID'), $this->arg('SAFETYLEVEL'), $rt, $ct, $loc)
"INSERT INTO shipping (shippingid, proposalid, shippingname, deliveryagent_agentname, deliveryagent_agentcode, deliveryagent_shippingdate, deliveryagent_deliverydate, bltimestamp, creationdate, comments, sendinglabcontactid, returnlabcontactid, shippingstatus, safetylevel, readybytime, closetime, physicallocation, source)
VALUES (s_shipping.nextval,:1,:2,:3,:4,TO_DATE(:5,'DD-MM-YYYY'), TO_DATE(:6,'DD-MM-YYYY'),CURRENT_TIMESTAMP,CURRENT_TIMESTAMP,:7,:8,:9,'opened',:10, :11, :12, :13, IFNULL(:14,CURRENT_USER)) RETURNING shippingid INTO :id",
array($this->proposalid, $this->arg('SHIPPINGNAME'), $an, $ac, $sd, $dd, $com, $this->arg('SENDINGLABCONTACTID'), $this->arg('RETURNLABCONTACTID'), $this->arg('SAFETYLEVEL'), $rt, $ct, $loc, $source)
);

$sid = $this->db->id();
Expand All @@ -2756,9 +2767,9 @@ function _add_shipment()
$n = $fc ? $fc : ('Dewar' . ($i + 1));

$this->db->pq(
"INSERT INTO dewar (dewarid,code,shippingid,bltimestamp,dewarstatus,firstexperimentid,facilitycode,weight)
VALUES (s_dewar.nextval,:1,:2,CURRENT_TIMESTAMP,'opened',:3,:4,$dewar_weight) RETURNING dewarid INTO :id",
array($n, $sid, $exp, $fc)
"INSERT INTO dewar (dewarid,code,shippingid,bltimestamp,dewarstatus,firstexperimentid,facilitycode,weight,source)
VALUES (s_dewar.nextval,:1,:2,CURRENT_TIMESTAMP,'opened',:3,:4,:5,IFNULL(:6,CURRENT_USER)) RETURNING dewarid INTO :id",
array($n, $sid, $exp, $fc, $dewar_weight, $source)
);

$id = $this->db->id();
Expand Down
Binary file added client/src/images/block-4_no_labels_470x470.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/src/images/cartridge_no_labels_470x470.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/src/images/gridbox_no_labels_470x470.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions client/src/js/modules/dc/views/samplechanger.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ define(['marionette', 'utils/canvas', 'utils',
this.rpad = 0 //pad - 25

var sw = 18
this.aspectratio = (sw/this.positions) - (this.positions <= 10 ? 0.3 : 0)
this.aspectratio = (this.positions <= 10 ? 1.5 : 0.4)
this.contwidth = (this.positions * sw) + this.pad + this.rpad + 15
console.log('sc width', this.contwidth, this.aspectratio)
if (!this.getOption('fullScreen')) {
Expand Down Expand Up @@ -230,4 +230,4 @@ define(['marionette', 'utils/canvas', 'utils',
})


})
})
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ export default {
// This is the current logic to determine the plate type
// Anything other than Box, Puck or PCRStrip
// TODO - get container types from data base
let is_plate = ['box', 'puck', 'pcrstrip', 'block-4', null].indexOf(containerType) == -1 && containerType.indexOf('puck') == -1
let puckTypes = ['cartridge', 'box', 'puck', 'pcrstrip', 'block-4']
let is_plate = containerType !== null && (!puckTypes.some(v => containerType.includes(v)))
return is_plate
},
Expand Down
Loading

0 comments on commit ed7962d

Please sign in to comment.