mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
Add release (close) of vertical lift trays
* Rename methods that fetch a tray to prevent confusion * Add methods to release a tray * The Kardex method to fetch a tray has to send "0" in the carrier and carrierNext field * The pick and inventory screens release the tray only when there is no next line, because the release is implicit when we fetch the next line, the put screen releases everytime because the operator may take time to start the next line and we don't know if they are going to scan a next line or not. * Exiting the screen or switching screen between put/pick/put-away has to release the tray as well.
This commit is contained in:
committed by
Hai Lang
parent
b878102ca2
commit
c58d60a26d
@@ -63,12 +63,12 @@ class StockLocation(models.Model):
|
||||
shuttle = location.location_id.vertical_lift_shuttle_id
|
||||
location.vertical_lift_shuttle_id = shuttle
|
||||
|
||||
def _hardware_vertical_lift_tray(self, cell_location=None):
|
||||
payload = self._hardware_vertical_lift_tray_payload(cell_location)
|
||||
def _hardware_vertical_lift_fetch_tray(self, cell_location=None):
|
||||
payload = self._hardware_vertical_lift_fetch_tray_payload(cell_location)
|
||||
return self.vertical_lift_shuttle_id._hardware_send_message(payload)
|
||||
|
||||
def _hardware_vertical_lift_tray_payload(self, cell_location=None):
|
||||
"""Prepare the message to be sent to the vertical lift hardware
|
||||
def _hardware_vertical_lift_fetch_tray_payload(self, cell_location=None):
|
||||
"""Prepare "fetch" message to be sent to the vertical lift hardware
|
||||
|
||||
Private method, this is where the implementation actually happens.
|
||||
Addons can add their instructions based on the hardware used for
|
||||
@@ -118,7 +118,7 @@ class StockLocation(models.Model):
|
||||
raise NotImplementedError()
|
||||
|
||||
def fetch_vertical_lift_tray(self, cell_location=None):
|
||||
"""Send instructions to the vertical lift hardware
|
||||
"""Send instructions to the vertical lift hardware to fetch a tray
|
||||
|
||||
Public method to use for:
|
||||
* fetch the vertical lift tray and presenting it to the operator
|
||||
@@ -128,7 +128,7 @@ class StockLocation(models.Model):
|
||||
Depending on the hardware, the laser pointer may not be implemented.
|
||||
|
||||
The actual implementation of the method goes in the private method
|
||||
``_hardware_vertical_lift_tray()``.
|
||||
``_hardware_vertical_lift_fetch_tray()``.
|
||||
"""
|
||||
self.ensure_one()
|
||||
if self.vertical_lift_kind == "cell":
|
||||
@@ -139,7 +139,7 @@ class StockLocation(models.Model):
|
||||
tray = self.location_id
|
||||
tray.fetch_vertical_lift_tray(cell_location=self)
|
||||
elif self.vertical_lift_kind == "tray":
|
||||
self._hardware_vertical_lift_tray(cell_location=cell_location)
|
||||
self._hardware_vertical_lift_fetch_tray(cell_location=cell_location)
|
||||
else:
|
||||
raise exceptions.UserError(
|
||||
_("Cannot fetch a vertical lift tray on location %s") % (self.name,)
|
||||
@@ -151,3 +151,9 @@ class StockLocation(models.Model):
|
||||
if self.vertical_lift_kind in ("cell", "tray"):
|
||||
self.fetch_vertical_lift_tray()
|
||||
return True
|
||||
|
||||
def button_release_vertical_lift_tray(self):
|
||||
self.ensure_one()
|
||||
if self.vertical_lift_kind:
|
||||
self.vertical_lift_shuttle_id.release_vertical_lift_tray()
|
||||
return True
|
||||
|
||||
@@ -264,5 +264,7 @@ class VerticalLiftOperationInventory(models.Model):
|
||||
return
|
||||
self.next_step()
|
||||
if self.step() == "noop":
|
||||
# close the tray once everything is inventoried
|
||||
self.shuttle_id.release_vertical_lift_tray()
|
||||
# sorry not sorry
|
||||
return self._rainbow_man()
|
||||
|
||||
@@ -82,5 +82,9 @@ class VerticalLiftOperationPick(models.Model):
|
||||
"""Release the operation, go to the next"""
|
||||
super().button_release()
|
||||
if self.step() == "noop":
|
||||
# we don't need to release (close) the tray until we have reached
|
||||
# the last line: the release is implicit when a next line is
|
||||
# fetched
|
||||
self.shuttle_id.release_vertical_lift_tray()
|
||||
# sorry not sorry
|
||||
return self._rainbow_man()
|
||||
|
||||
@@ -172,6 +172,9 @@ class VerticalLiftOperationPut(models.Model):
|
||||
self.current_move_line_id.fetch_vertical_lift_tray_dest()
|
||||
|
||||
def button_release(self):
|
||||
# release (close) the tray each time, because for put-away, we
|
||||
# never know if the operator will scan another line or not
|
||||
self.shuttle_id.release_vertical_lift_tray()
|
||||
super().button_release()
|
||||
if self.count_move_lines_to_do_all() == 0:
|
||||
# sorry not sorry
|
||||
|
||||
@@ -178,6 +178,7 @@ class VerticalLiftShuttle(models.Model):
|
||||
}
|
||||
|
||||
def action_back_to_settings(self):
|
||||
self.release_vertical_lift_tray()
|
||||
action_xmlid = "stock_vertical_lift.vertical_lift_shuttle_action"
|
||||
action = self.env.ref(action_xmlid).read()[0]
|
||||
action["target"] = "main"
|
||||
@@ -195,16 +196,55 @@ class VerticalLiftShuttle(models.Model):
|
||||
# TODO: should the mode be changed on all the shuttles at the same time?
|
||||
def switch_pick(self):
|
||||
self.mode = "pick"
|
||||
self.release_vertical_lift_tray()
|
||||
return self.action_open_screen()
|
||||
|
||||
def switch_put(self):
|
||||
self.mode = "put"
|
||||
self.release_vertical_lift_tray()
|
||||
return self.action_open_screen()
|
||||
|
||||
def switch_inventory(self):
|
||||
self.mode = "inventory"
|
||||
self.release_vertical_lift_tray()
|
||||
return self.action_open_screen()
|
||||
|
||||
def _hardware_vertical_lift_release_tray_payload(self):
|
||||
"""Prepare "release" message to be sent to the vertical lift hardware
|
||||
|
||||
Private method, this is where the implementation actually happens.
|
||||
Addons can add their instructions based on the hardware used for
|
||||
this location.
|
||||
|
||||
The hardware used for a location can be found in:
|
||||
|
||||
``self.hardware``
|
||||
|
||||
Each addon can implement its own mechanism depending of this value
|
||||
and must call ``super``.
|
||||
|
||||
The method must send the command to the vertical lift to release (close)
|
||||
the tray.
|
||||
|
||||
Returns a message in bytes, that will be sent through
|
||||
``VerticalLiftShuttle._hardware_send_message()``.
|
||||
"""
|
||||
if self.hardware == "simulation":
|
||||
message = _("Releasing tray")
|
||||
return message.encode("utf-8")
|
||||
else:
|
||||
raise NotImplementedError()
|
||||
|
||||
def release_vertical_lift_tray(self):
|
||||
"""Send instructions to the vertical lift hardware to close trays
|
||||
|
||||
The actual implementation of the method goes in the private method
|
||||
``_hardware_vertical_lift_release_tray()``.
|
||||
"""
|
||||
self.ensure_one()
|
||||
payload = self._hardware_vertical_lift_release_tray_payload()
|
||||
return self._hardware_send_message(payload)
|
||||
|
||||
def _send_notification_refresh(self, success):
|
||||
"""Send a refresh notification to the current opened screen
|
||||
|
||||
|
||||
@@ -15,6 +15,15 @@
|
||||
icon="fa-hand-paper-o"
|
||||
attrs="{'invisible': [('vertical_lift_kind', 'not in', ('tray', 'cell'))]}"
|
||||
/>
|
||||
<button
|
||||
name="button_release_vertical_lift_tray"
|
||||
string="Release Shuttle Tray"
|
||||
type="object"
|
||||
groups="stock.group_stock_manager"
|
||||
class="oe_stat_button"
|
||||
icon="fa-hand-rock-o"
|
||||
attrs="{'invisible': [('vertical_lift_kind', 'not in', ('tray', 'cell'))]}"
|
||||
/>
|
||||
</div>
|
||||
<field name="return_location" position="after">
|
||||
<field
|
||||
|
||||
@@ -66,10 +66,25 @@
|
||||
<field name="name">vertical.lift.shuttle.view.form</field>
|
||||
<field name="model">vertical.lift.shuttle</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Operations">
|
||||
<form string="Shuttle">
|
||||
<header>
|
||||
<button
|
||||
name="release_vertical_lift_tray"
|
||||
string="Release tray"
|
||||
type="object"
|
||||
/>
|
||||
</header>
|
||||
<sheet>
|
||||
<div class="oe_button_box" name="button_box">
|
||||
</div>
|
||||
<div class="oe_title">
|
||||
<label class="oe_edit_only" for="name" />
|
||||
<h1>
|
||||
<field name="name" placeholder="Shuttle Name" />
|
||||
</h1>
|
||||
</div>
|
||||
<group name="main">
|
||||
<group name="left">
|
||||
<field name="name" />
|
||||
<field name="mode" />
|
||||
<field name="location_id" />
|
||||
<field name="hardware" />
|
||||
@@ -92,6 +107,7 @@
|
||||
</tree>
|
||||
</field>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user