Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/优化agv和ftp
This commit is contained in:
@@ -131,6 +131,22 @@ patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', {
|
||||
dom.addClass('addRequired')
|
||||
}
|
||||
})
|
||||
try {
|
||||
const dom = this.tableRef.el
|
||||
if(dom ) {
|
||||
const tfoot = $(dom).children('tfoot')
|
||||
const tbooy = $(dom).children('tbody')
|
||||
if(tfoot.length) {
|
||||
const tfoot_tr = tfoot.children().eq(0)
|
||||
const tbody_tr = tbooy.children().eq(0)
|
||||
if(tfoot_tr.children().length < tbody_tr.children().length) {
|
||||
tfoot_tr.prepend('<td class="prepend">')
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -488,4 +488,7 @@ div:has(.o_required_modifier) > label::before {
|
||||
left: 0;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
.o_list_renderer .o_list_table tfoot .o_list_number {
|
||||
text-align: left;
|
||||
}
|
||||
@@ -496,3 +496,35 @@ class Manufacturing_Connect(http.Controller):
|
||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
|
||||
logging.info('AGVDownProduct error:%s' % e)
|
||||
return json.JSONEncoder().encode(res)
|
||||
|
||||
@http.route('/AutoDeviceApi/EquipmentBaseCoordinate', type='json', auth='none', methods=['GET', 'POST'], csrf=False,
|
||||
cors="*")
|
||||
def PutEquipmentBaseCoordinate(self, **kw):
|
||||
"""
|
||||
获取机床基坐标
|
||||
:param kw:
|
||||
:return:
|
||||
"""
|
||||
logging.info('PutEquipmentBaseCoordinate:%s' % kw)
|
||||
try:
|
||||
res = {'Succeed': True}
|
||||
datas = request.httprequest.data
|
||||
ret = json.loads(datas)
|
||||
if 'DeviceId' in ret:
|
||||
equipment = request.env['maintenance.equipment'].sudo().search('name', '=', ret['DeviceId'])
|
||||
if equipment:
|
||||
equipment.sudo().write({
|
||||
'base_coordinate_fixture_model_id': ret['base_coordinate_fixture_model_id'],
|
||||
'base_coordinate_g_coordinate': ret['base_coordinate_g_coordinate'],
|
||||
'base_coordinate_x': ret['base_coordinate_x'],
|
||||
'base_coordinate_y': ret['base_coordinate_y'],
|
||||
'base_coordinate_z': ret['base_coordinate_z'],
|
||||
})
|
||||
else:
|
||||
res = {'Succeed': False, 'ErrorCode': 203, 'Error': 'DeviceId为%s的设备不存在!' % ret['DeviceId']}
|
||||
else:
|
||||
res = {'Succeed': False, 'ErrorCode': 201, 'Error': '未传DeviceId字段'}
|
||||
except Exception as e:
|
||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
|
||||
logging.info('AGVDownProduct error:%s' % e)
|
||||
return json.JSONEncoder().encode(res)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import logging
|
||||
import requests
|
||||
import base64
|
||||
import hashlib
|
||||
import os
|
||||
@@ -892,6 +893,33 @@ class SfMaintenanceEquipmentAndProductTemplate(models.Model):
|
||||
vals.append(res)
|
||||
return vals[0]
|
||||
|
||||
base_coordinate_fixture_model_id = fields.Many2one('sf.fixture.model', '基坐标卡盘型号',
|
||||
domain=[('fixture_material_id', '=', '零点卡盘')])
|
||||
base_coordinate_g_coordinate = fields.Char('G坐标')
|
||||
base_coordinate_x = fields.Float('x轴', digits=(12, 3))
|
||||
base_coordinate_y = fields.Float('y轴', digits=(12, 3))
|
||||
base_coordinate_z = fields.Float('z轴', digits=(12, 3))
|
||||
|
||||
# ==========获取机床基坐标接口==========
|
||||
def get_equipment_base_coordinate(self):
|
||||
headers = {'Authorization': 'Ba F2CF5DCC-1A00-4234-9E95-65603F70CC8A'}
|
||||
crea_url = "https://x24467i973.zicp.fun/AutoDeviceApi/EquipmentBaseCoordinate"
|
||||
params = {"DeviceId": self.name}
|
||||
r = requests.get(crea_url, params=params, headers=headers)
|
||||
ret = r.json()
|
||||
logging.info('register_equipment_tool:%s' % ret)
|
||||
self.write({
|
||||
'base_coordinate_fixture_model_id': ret['base_coordinate_fixture_model_id'],
|
||||
'base_coordinate_g_coordinate': ret['base_coordinate_g_coordinate'],
|
||||
'base_coordinate_x': ret['base_coordinate_x'],
|
||||
'base_coordinate_y': ret['base_coordinate_y'],
|
||||
'base_coordinate_z': ret['base_coordinate_z'],
|
||||
})
|
||||
if ret['Succeed']:
|
||||
return "机床基坐标获取成功"
|
||||
else:
|
||||
raise ValidationError("机床基坐标获取失败")
|
||||
|
||||
|
||||
class SfMaintenanceEquipmentTool(models.Model):
|
||||
_name = 'maintenance.equipment.tool'
|
||||
|
||||
@@ -1,23 +1,38 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
|
||||
设备增加刀具库位table
|
||||
<!-- 设备增加刀具库位table-->
|
||||
<record id="sf_manufacturing_hr_equipment_view_form" model="ir.ui.view">
|
||||
<field name="name">sf_manufacturing_equipment.form</field>
|
||||
<field name="model">maintenance.equipment</field>
|
||||
<field name="inherit_id" ref="sf_maintenance.sf_hr_equipment_view_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//page[@name='sf_equipment']" position="after">
|
||||
<page string="标准刀库" name="sf_equipment_product_template"
|
||||
attrs="{'invisible': [('equipment_type', '!=', '机床')]}">
|
||||
<field name = 'product_template_ids' >
|
||||
<tree editable='bottom'>
|
||||
<field name="code"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<page string="机床基坐标" name="sf_equipment_base_coordinate"
|
||||
attrs="{'invisible': [('equipment_type', '!=', '机床')]}">
|
||||
<button name="get_equipment_base_coordinate" string="获取基坐标数据" type="object"
|
||||
class="oe_highlight"/>
|
||||
<separator invisible="0"/>
|
||||
<group>
|
||||
<group>
|
||||
<field name="base_coordinate_fixture_model_id" options="{'no_create': True}"/>
|
||||
<field name="base_coordinate_g_coordinate"/>
|
||||
<field name="base_coordinate_x"/>
|
||||
<field name="base_coordinate_y"/>
|
||||
<field name="base_coordinate_z"/>
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
<page string="标准刀库" name="sf_equipment_product_template"
|
||||
attrs="{'invisible': [('equipment_type', '!=', '机床')]}">
|
||||
<field name='product_template_ids'>
|
||||
<tree editable='bottom'>
|
||||
<field name="code"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
@@ -422,11 +422,12 @@ class FunctionalToolAssembly(models.Model):
|
||||
@api.depends('integral_freight_barcode')
|
||||
def _compute_integral_product_id(self):
|
||||
for item in self:
|
||||
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', item.integral_freight_barcode)])
|
||||
if location:
|
||||
item.integral_product_id = location.product_id.id
|
||||
else:
|
||||
item.integral_product_id = False
|
||||
if item.integral_freight_barcode:
|
||||
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', item.integral_freight_barcode)])
|
||||
if location:
|
||||
item.integral_product_id = location.product_id.id
|
||||
else:
|
||||
item.integral_product_id = False
|
||||
|
||||
# =================刀片型号=============
|
||||
blade_freight_barcode = fields.Char('刀片货位')
|
||||
@@ -441,11 +442,12 @@ class FunctionalToolAssembly(models.Model):
|
||||
@api.depends('blade_freight_barcode')
|
||||
def _compute_blade_product_id(self):
|
||||
for item in self:
|
||||
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', item.blade_freight_barcode)])
|
||||
if location:
|
||||
item.blade_product_id = location.product_id.id
|
||||
else:
|
||||
item.blade_product_id = False
|
||||
if item.integral_freight_barcode:
|
||||
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', item.blade_freight_barcode)])
|
||||
if location:
|
||||
item.blade_product_id = location.product_id.id
|
||||
else:
|
||||
item.blade_product_id = False
|
||||
|
||||
# ==============刀杆型号================
|
||||
bar_freight_barcode = fields.Char('刀杆货位')
|
||||
@@ -460,11 +462,12 @@ class FunctionalToolAssembly(models.Model):
|
||||
@api.depends('bar_freight_barcode')
|
||||
def _compute_bar_product_id(self):
|
||||
for item in self:
|
||||
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', item.bar_freight_barcode)])
|
||||
if location:
|
||||
item.bar_product_id = location.product_id.id
|
||||
else:
|
||||
item.bar_product_id = False
|
||||
if item.integral_freight_barcode:
|
||||
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', item.bar_freight_barcode)])
|
||||
if location:
|
||||
item.bar_product_id = location.product_id.id
|
||||
else:
|
||||
item.bar_product_id = False
|
||||
|
||||
# =============刀盘型号================
|
||||
pad_freight_barcode = fields.Char('刀盘货位')
|
||||
@@ -479,11 +482,12 @@ class FunctionalToolAssembly(models.Model):
|
||||
@api.depends('pad_freight_barcode')
|
||||
def _compute_pad_product_id(self):
|
||||
for item in self:
|
||||
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', item.pad_freight_barcode)])
|
||||
if location:
|
||||
item.pad_product_id = location.product_id.id
|
||||
else:
|
||||
item.pad_product_id = False
|
||||
if item.integral_freight_barcode:
|
||||
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', item.pad_freight_barcode)])
|
||||
if location:
|
||||
item.pad_product_id = location.product_id.id
|
||||
else:
|
||||
item.pad_product_id = False
|
||||
|
||||
# ==============刀柄型号==============
|
||||
handle_freight_rfid = fields.Char('刀柄Rfid', compute='_compute_handle_product_id', store=True)
|
||||
@@ -519,11 +523,12 @@ class FunctionalToolAssembly(models.Model):
|
||||
@api.depends('chuck_freight_barcode')
|
||||
def _compute_chuck_product_id(self):
|
||||
for item in self:
|
||||
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', item.chuck_freight_barcode)])
|
||||
if location:
|
||||
item.chuck_product_id = location.product_id.id
|
||||
else:
|
||||
item.chuck_product_id = False
|
||||
if item.integral_freight_barcode:
|
||||
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', item.chuck_freight_barcode)])
|
||||
if location:
|
||||
item.chuck_product_id = location.product_id.id
|
||||
else:
|
||||
item.chuck_product_id = False
|
||||
|
||||
# ==================待删除字段==================
|
||||
blade_name = fields.Char('')
|
||||
|
||||
@@ -129,16 +129,16 @@
|
||||
<form string="Shelf Location" create="0">
|
||||
<header>
|
||||
<button string="货位变更"
|
||||
name="%(sf_warehouse.sf_shelf_location_wizard_act)d"
|
||||
type="action"
|
||||
context="{'default_name':name,
|
||||
name="%(sf_warehouse.sf_shelf_location_wizard_act)d"
|
||||
type="action"
|
||||
context="{'default_name':name,
|
||||
'default_current_name':name,
|
||||
'default_current_shelf_id':shelf_id,
|
||||
'default_current_location_id':location_id,
|
||||
'default_current_barcode':barcode,
|
||||
'default_current_product_id':product_id,
|
||||
}"
|
||||
class="btn-primary"/>
|
||||
class="btn-primary" attrs="{'invisible':[('location_status','!=','占用')]}"/>
|
||||
<field name="location_status" invisible="1"/>
|
||||
<button string="禁用货位" name="action_location_status_disable" type="object"
|
||||
class="oe_highlight"
|
||||
@@ -245,6 +245,7 @@
|
||||
<field name="model">sf.shelf.location</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="货位">
|
||||
<field name="barcode"/>
|
||||
<searchpanel class="account_root">
|
||||
<!-- <field name="location_type" icon="fa-filter"/> -->
|
||||
<!-- <field name="location_id" select="multi" icon="fa-filter"/> -->
|
||||
|
||||
@@ -47,16 +47,16 @@ class ShelfLocationWizard(models.TransientModel):
|
||||
shelf_location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', self.current_barcode)])
|
||||
# 变更货位
|
||||
if self.destination_barcode_id and shelf_location:
|
||||
if self.destination_barcode_id.product_id and self.destination_barcode_id.product_id == shelf_location.current_product_id and not self.destination_barcode_id.product_sn_id:
|
||||
if self.destination_barcode_id.product_id and self.destination_barcode_id.product_id == shelf_location.product_id and not self.destination_barcode_id.product_sn_id:
|
||||
self.destination_barcode_id.product_num += shelf_location.product_num
|
||||
else:
|
||||
self.destination_barcode_id.product_sn_id = shelf_location.product_sn_id.id
|
||||
self.destination_barcode_id.product_id = shelf_location.product_id.id
|
||||
self.destination_barcode_id.product_num = shelf_location.product_num
|
||||
|
||||
shelf_location.product_sn_id = False
|
||||
shelf_location.product_id = False
|
||||
shelf_location.product_num = 0
|
||||
shelf_location.product_sn_id = False
|
||||
shelf_location.product_id = False
|
||||
shelf_location.product_num = 0
|
||||
else:
|
||||
raise ValidationError('目标货位出错,请联系管理员!')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user