1、新增功能刀具出入库
This commit is contained in:
@@ -30,7 +30,7 @@ class FunctionalCuttingToolEntity(models.Model):
|
|||||||
coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')], string='粗/中/精', readonly=True)
|
coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')], string='粗/中/精', readonly=True)
|
||||||
new_former = fields.Selection([('0', '新'), ('1', '旧')], string='新/旧', readonly=True)
|
new_former = fields.Selection([('0', '新'), ('1', '旧')], string='新/旧', readonly=True)
|
||||||
tool_loading_length = fields.Float(string='总长度(mm)', readonly=True, digits=(10, 3))
|
tool_loading_length = fields.Float(string='总长度(mm)', readonly=True, digits=(10, 3))
|
||||||
handle_length = fields.Float(string='刀柄长度(mm)',readonly=True, digits=(10, 3))
|
handle_length = fields.Float(string='刀柄长度(mm)', readonly=True, digits=(10, 3))
|
||||||
functional_tool_length = fields.Float(string='伸出长(mm)', readonly=True, digits=(10, 3))
|
functional_tool_length = fields.Float(string='伸出长(mm)', readonly=True, digits=(10, 3))
|
||||||
effective_length = fields.Float(string='有效长(mm)', readonly=True)
|
effective_length = fields.Float(string='有效长(mm)', readonly=True)
|
||||||
tool_room_num = fields.Integer(string='刀具房数量', readonly=True)
|
tool_room_num = fields.Integer(string='刀具房数量', readonly=True)
|
||||||
@@ -75,6 +75,48 @@ class FunctionalCuttingToolEntity(models.Model):
|
|||||||
record.line_edge_knife_library_num = 0
|
record.line_edge_knife_library_num = 0
|
||||||
record.machine_knife_library_num = 0
|
record.machine_knife_library_num = 0
|
||||||
|
|
||||||
|
def tool_in_out_stock_location(self, location_id):
|
||||||
|
for item in self:
|
||||||
|
if item:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
if location_id.product_sn_id:
|
||||||
|
tool = self.env['sf.functional.cutting.tool.entity'].search(
|
||||||
|
['barcode_id', '=', location_id.product_sn_id.id])
|
||||||
|
if tool.current_location == '线边刀库':
|
||||||
|
pass
|
||||||
|
|
||||||
|
def create_stock_move(self):
|
||||||
|
# 创建库存移动记录
|
||||||
|
stock_move_id = self.env['stock.move'].sudo().create({
|
||||||
|
'name': name,
|
||||||
|
'product_id': self.barcode_id.product_id.id,
|
||||||
|
'location_id': location_inventory_id.id,
|
||||||
|
'location_dest_id': stock_location_id.id,
|
||||||
|
'product_uom_qty': 1.00,
|
||||||
|
'state': 'done'
|
||||||
|
})
|
||||||
|
|
||||||
|
# 创建移动历史记录
|
||||||
|
stock_move_line_id = self.env['stock.move.line'].sudo().create({
|
||||||
|
'product_id': self.barcode_id.product_id.id,
|
||||||
|
'functional_tool_name_id': functional_tool_assembly_id,
|
||||||
|
'lot_id': self.id,
|
||||||
|
'move_id': stock_move_id.id,
|
||||||
|
'install_tool_time': fields.Datetime.now(),
|
||||||
|
'qty_done': 1.0,
|
||||||
|
'state': 'done',
|
||||||
|
'functional_tool_type_id': False if not obj else obj.functional_tool_type_id.id,
|
||||||
|
'diameter': None if not obj else obj.after_assembly_functional_tool_diameter,
|
||||||
|
'knife_tip_r_angle': None if not obj else obj.after_assembly_knife_tip_r_angle,
|
||||||
|
'code': '' if not obj else obj.code,
|
||||||
|
'rfid': '' if not obj else obj.rfid,
|
||||||
|
'functional_tool_name': '' if not obj else obj.after_assembly_functional_tool_name,
|
||||||
|
'tool_groups_id': False if not tool_groups_id else tool_groups_id.id
|
||||||
|
})
|
||||||
|
return stock_move_id, stock_move_line_id
|
||||||
|
|
||||||
|
|
||||||
def get_location_num(self):
|
def get_location_num(self):
|
||||||
"""
|
"""
|
||||||
计算库存位置数量
|
计算库存位置数量
|
||||||
|
|||||||
@@ -86,7 +86,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<group>
|
<group>
|
||||||
<group>
|
<group>
|
||||||
<field name="barcode_id" invisible="1"/>
|
<field name="barcode_id" invisible="0"/>
|
||||||
<field name="rfid" readonly="1"
|
<field name="rfid" readonly="1"
|
||||||
attrs="{'invisible': [('functional_tool_status', '=', '已拆除')]}"/>
|
attrs="{'invisible': [('functional_tool_status', '=', '已拆除')]}"/>
|
||||||
<field name="rfid_dismantle" readonly="1"
|
<field name="rfid_dismantle" readonly="1"
|
||||||
|
|||||||
@@ -95,17 +95,31 @@ class MrsShelfLocationDataSync(models.Model):
|
|||||||
return code_pair[0]
|
return code_pair[0]
|
||||||
return None # 如果没有找到对应的值,返回None或适当的默认值
|
return None # 如果没有找到对应的值,返回None或适当的默认值
|
||||||
|
|
||||||
|
# 定时更新所有设备机床刀库信息
|
||||||
|
equipment_ids = self.env['maintenance.equipment'].search([('equipment_type', '=', '机床')])
|
||||||
|
for equipment_id in equipment_ids:
|
||||||
|
if equipment_id:
|
||||||
|
equipment_id.register_equipment_tool()
|
||||||
|
|
||||||
shelfinfo = self.env['sf.shelf.location'].get_sf_shelf_location_info()
|
shelfinfo = self.env['sf.shelf.location'].get_sf_shelf_location_info()
|
||||||
print('shelfinfo:', shelfinfo)
|
print('shelfinfo:', shelfinfo)
|
||||||
for item in shelfinfo:
|
for item in shelfinfo:
|
||||||
shelf_barcode = find_our_code(item['Postion'], total_data)
|
shelf_barcode = find_our_code(item['Postion'], total_data)
|
||||||
location_id = self.env['sf.shelf.location'].search([('barcode', '=', shelf_barcode)], limit=1)
|
location_id = self.env['sf.shelf.location'].search([('barcode', '=', shelf_barcode)], limit=1)
|
||||||
if location_id:
|
if location_id:
|
||||||
stock_lot_obj = self.env['stock.lot'].search([('rfid', '=', item['RfidCode'])], limit=1)
|
if 'Tool' in item['Postion']:
|
||||||
if stock_lot_obj:
|
tool = self.env['sf.functional.cutting.tool.entity'].search(['rfid', '=', item['RfidCode']])
|
||||||
location_id.product_sn_id = stock_lot_obj.id
|
tool.tool_in_out_stock_location(location_id)
|
||||||
|
if tool:
|
||||||
|
location_id.product_sn_id = tool.barcode_id.id
|
||||||
|
else:
|
||||||
|
location_id.product_sn_id = False
|
||||||
else:
|
else:
|
||||||
location_id.product_sn_id = False
|
stock_lot_obj = self.env['stock.lot'].search([('rfid', '=', item['RfidCode'])], limit=1)
|
||||||
|
if stock_lot_obj:
|
||||||
|
location_id.product_sn_id = stock_lot_obj.id
|
||||||
|
else:
|
||||||
|
location_id.product_sn_id = False
|
||||||
|
|
||||||
logging.info('货架已获取信息:%s' % item)
|
logging.info('货架已获取信息:%s' % item)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user