Merge branch refs/heads/develop into refs/heads/feature/前端样式修改
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
# 'jikimo_frontend/static/src/list/custom_import.js',
|
||||
# 'jikimo_frontend/static/src/list/custom_width.js',
|
||||
'jikimo_frontend/static/src/views/list_nums/extent_purchase.xml',
|
||||
# 'jikimo_frontend/static/src/css/list_border_styles.css',
|
||||
'jikimo_frontend/static/src/css/list_border_styles.css',
|
||||
|
||||
],
|
||||
|
||||
|
||||
@@ -106,6 +106,7 @@ class MachineTool(models.Model):
|
||||
lead_screw = fields.Char('丝杆')
|
||||
workbench_L = fields.Char('工作台长度(mm)')
|
||||
workbench_W = fields.Char('工作台宽度(mm)')
|
||||
workbench_H = fields.Char('工作台高度(mm)')
|
||||
guide_rail = fields.Char('导轨')
|
||||
machine_tool_L = fields.Char('机床长度(mm)')
|
||||
machine_tool_W = fields.Char('机床宽度(mm)')
|
||||
@@ -193,6 +194,7 @@ class MachineTool(models.Model):
|
||||
item.lead_screw = item.type_id.lead_screw
|
||||
item.workbench_L = item.type_id.workbench_L
|
||||
item.workbench_W = item.type_id.workbench_W
|
||||
item.workbench_H = item.type_id.workbench_H
|
||||
item.guide_rail = item.type_id.guide_rail
|
||||
item.machine_tool_L = item.type_id.machine_tool_L
|
||||
item.machine_tool_W = item.type_id.machine_tool_W
|
||||
@@ -280,6 +282,7 @@ class MachineToolType(models.Model):
|
||||
workpiece_load = fields.Char('工件最大负载(kg)')
|
||||
workbench_L = fields.Char('工作台长度(mm)')
|
||||
workbench_W = fields.Char('工作台宽度(mm)')
|
||||
workbench_H = fields.Char('工作台高度(mm)')
|
||||
machine_tool_L = fields.Char('机床长度(mm)')
|
||||
machine_tool_W = fields.Char('机床宽度(mm)')
|
||||
machine_tool_H = fields.Char('机床高度(mm)')
|
||||
@@ -295,8 +298,9 @@ class MachineToolType(models.Model):
|
||||
x_axis = fields.Integer('X轴')
|
||||
y_axis = fields.Integer('Y轴')
|
||||
z_axis = fields.Integer('Z轴')
|
||||
b_axis = fields.Integer('B轴')
|
||||
c_axis = fields.Integer('C轴')
|
||||
a_axis = fields.Char('a轴')
|
||||
b_axis = fields.Char('B轴')
|
||||
c_axis = fields.Char('C轴')
|
||||
remark = fields.Char('备注')
|
||||
control_system_id = fields.Many2one('sf.machine.control_system',
|
||||
string="控制系统")
|
||||
@@ -309,7 +313,7 @@ class MachineToolType(models.Model):
|
||||
default="", string="轴数")
|
||||
|
||||
# 1212新增字段
|
||||
a_axis = fields.Integer('a轴')
|
||||
|
||||
function_type = fields.Selection(
|
||||
[("ZXJGZX", "钻铣加工中心"), ("CXJGZX", "车削加工中心"), ("FHJGZX", "复合加工中心")],
|
||||
default="", string="功能类型")
|
||||
@@ -335,23 +339,23 @@ class MachineToolType(models.Model):
|
||||
straight_cutting_feed_rate = fields.Char('直线切削进给速度(mm/min)')
|
||||
rotary_cutting_feed_rate = fields.Char('回转切削进给速度(mm/min)')
|
||||
|
||||
X_precision = fields.Float('X轴定位精度(mm)', digits=(12, 3))
|
||||
X_precision_repeat = fields.Float('X轴重复定位精度(mm)', digits=(12, 3))
|
||||
Y_precision = fields.Float('Y轴定位精度(mm)', digits=(12, 3))
|
||||
Y_precision_repeat = fields.Float('Y轴重复定位精度(mm)', digits=(12, 3))
|
||||
Z_precision = fields.Float('Z轴定位精度(mm)', digits=(12, 3))
|
||||
Z_precision_repeat = fields.Float('Z轴重复定位精度(mm)', digits=(12, 3))
|
||||
a_precision = fields.Float('a轴定位精度(mm)', digits=(12, 3))
|
||||
a_precision_repeat = fields.Float('a轴重复定位精度(mm)', digits=(12, 3))
|
||||
b_precision = fields.Float('b轴定位精度(mm)', digits=(12, 3))
|
||||
b_precision_repeat = fields.Float('b轴重复定位精度(mm)', digits=(12, 3))
|
||||
c_precision = fields.Float('c轴定位精度(mm)', digits=(12, 3))
|
||||
c_precision_repeat = fields.Float('c轴重复定位精度(mm)', digits=(12, 3))
|
||||
X_precision = fields.Char('X轴定位精度(mm)')
|
||||
X_precision_repeat = fields.Char('X轴重复定位精度(mm)')
|
||||
Y_precision = fields.Char('Y轴定位精度(mm)')
|
||||
Y_precision_repeat = fields.Char('Y轴重复定位精度(mm)')
|
||||
Z_precision = fields.Char('Z轴定位精度(mm)')
|
||||
Z_precision_repeat = fields.Char('Z轴重复定位精度(mm)')
|
||||
a_precision = fields.Char('a轴定位精度(mm)')
|
||||
a_precision_repeat = fields.Char('a轴重复定位精度(mm)')
|
||||
b_precision = fields.Char('b轴定位精度(mm)')
|
||||
b_precision_repeat = fields.Char('b轴重复定位精度(mm)')
|
||||
c_precision = fields.Char('c轴定位精度(mm)')
|
||||
c_precision_repeat = fields.Char('c轴重复定位精度(mm)')
|
||||
|
||||
tool_full_diameter_max = fields.Float('刀具满刀最大直径(mm)')
|
||||
tool_perimeter_diameter_max = fields.Float('刀具邻空刀最大直径(mm)')
|
||||
T_tool_time = fields.Integer('T-T换刀时间(s)')
|
||||
C_tool_time = fields.Integer('C-C换刀时间(s)')
|
||||
T_tool_time = fields.Float('T-T换刀时间(s)', digits=(12, 1))
|
||||
C_tool_time = fields.Float('C-C换刀时间(s)', digits=(12, 1))
|
||||
|
||||
jg_image_id = fields.Many2many('maintenance.equipment.image', 'jg_equipment_id', string='加工能力',
|
||||
domain="[('type', '=', '加工能力')]")
|
||||
|
||||
@@ -73,9 +73,11 @@ access_sf_cutting_speed,sf_cutting_speed,model_sf_cutting_speed,base.group_user,
|
||||
access_sf_cutting_speed_admin,sf_cutting_speed_admin,model_sf_cutting_speed,base.group_system,1,1,1,0
|
||||
access_sf_cutting_speed_group_purchase_director,sf_cutting_speed_group_purchase_director,model_sf_cutting_speed,sf_base.group_purchase_director,1,1,1,0
|
||||
access_sf_cutting_speed_group_sale_director,sf_cutting_speed_group_sale_director,model_sf_cutting_speed,sf_base.group_sale_director,1,1,1,0
|
||||
access_sf_cutting_speed_group_plan_dispatch,sf_cutting_speed_group_plan_dispatch,model_sf_cutting_speed,sf_base.group_plan_dispatch,1,0,0,0
|
||||
access_sf_cutting_speed_group_plan_director,sf_cutting_speed_group_plan_director,model_sf_cutting_speed,sf_base.group_plan_director,1,1,1,0
|
||||
access_sf_feed_per_tooth_group_purchase_director,sf_feed_per_tooth_group_purchase_director,model_sf_feed_per_tooth,sf_base.group_purchase_director,1,1,0,0
|
||||
access_sf_feed_per_tooth_group_sale_director,sf_feed_per_tooth_group_sale_director,model_sf_feed_per_tooth,sf_base.group_sale_director,1,1,0,0
|
||||
access_sf_feed_per_tooth_group_plan_dispatch,sf_feed_per_tooth_group_plan_dispatch,model_sf_feed_per_tooth,sf_base.group_plan_dispatch,1,0,0,0
|
||||
access_sf_feed_per_tooth_group_plan_director,sf_feed_per_tooth_group_plan_director,model_sf_feed_per_tooth,sf_base.group_plan_director,1,1,0,0
|
||||
access_sf_feed_per_tooth_group_sale_salemanager,sf_feed_per_tooth_group_sale_salemanager,model_sf_feed_per_tooth,sf_base.group_sale_salemanager,1,0,0,0
|
||||
access_sf_feed_per_tooth,sf_feed_per_tooth,model_sf_feed_per_tooth,base.group_user,1,1,1,0
|
||||
|
||||
|
@@ -173,6 +173,10 @@
|
||||
<label for="workbench_W" string="宽"/>
|
||||
<field name="workbench_W" class="o_address_zip" required="1"
|
||||
options="{'format': false}"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="workbench_H" string="高"/>
|
||||
<field name="workbench_H" class="o_address_zip" required="1"
|
||||
options="{'format': false}"/>
|
||||
</div>
|
||||
<field name="workpiece_load"/>
|
||||
<label for="machine_tool_L" string="机床尺寸(mm)"/>
|
||||
@@ -239,15 +243,15 @@
|
||||
attrs="{'invisible': [('number_of_axles', '=', '三轴')]}"
|
||||
options="{'format': false}"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="b_axis" string="b"
|
||||
<label for="c_axis" string="c"
|
||||
attrs="{'invisible': [('number_of_axles', 'in', ['三轴','四轴'])]}"/>
|
||||
<field name="b_axis" class="o_address_zip"
|
||||
<field name="c_axis" class="o_address_zip"
|
||||
attrs="{'invisible': [('number_of_axles', 'in', ['三轴','四轴'])]}"
|
||||
options="{'format': false}"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="c_axis" string="c"
|
||||
<label for="b_axis" string="b"
|
||||
attrs="{'invisible': [('number_of_axles', 'in', ['三轴','四轴','五轴'])]}"/>
|
||||
<field name="c_axis" class="o_address_zip"
|
||||
<field name="b_axis" class="o_address_zip"
|
||||
attrs="{'invisible': [('number_of_axles', 'in', ['三轴','四轴','五轴'])]}"
|
||||
options="{'format': false}"/>
|
||||
</div>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<field name="inherit_id" ref="sf_sale.view_product_template_form_inherit_sf"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="invoice_policy" position="after">
|
||||
<field name='categ_id' attrs="{'readonly': [('id', '!=', False)]}"/>
|
||||
<field name='categ_id' class="custom_required" attrs="{'readonly': [('id', '!=', False)]}"/>
|
||||
<field name='is_bfm' invisible="1"/>
|
||||
<field name='categ_type' invisible="1"/>
|
||||
<field name="upload_model_file"
|
||||
|
||||
@@ -47,7 +47,7 @@ class SfMaintenanceEquipment(models.Model):
|
||||
default="", string="轴数")
|
||||
|
||||
# 1212新增字段
|
||||
a_axis = fields.Integer('a轴')
|
||||
|
||||
function_type = fields.Selection(
|
||||
[("ZXJGZX", "钻铣加工中心"), ("CXJGZX", "车削加工中心"), ("FHJGZX", "复合加工中心")],
|
||||
default="", string="功能类型")
|
||||
@@ -73,23 +73,23 @@ class SfMaintenanceEquipment(models.Model):
|
||||
straight_cutting_feed_rate = fields.Char('直线切削进给速度(mm/min)')
|
||||
rotary_cutting_feed_rate = fields.Char('回转切削进给速度(mm/min)')
|
||||
|
||||
X_precision = fields.Float('X轴定位精度(mm)', digits=(12, 3))
|
||||
X_precision_repeat = fields.Float('X轴重复定位精度(mm)', digits=(12, 3))
|
||||
Y_precision = fields.Float('Y轴定位精度(mm)', digits=(12, 3))
|
||||
Y_precision_repeat = fields.Float('Y轴重复定位精度(mm)', digits=(12, 3))
|
||||
Z_precision = fields.Float('Z轴定位精度(mm)', digits=(12, 3))
|
||||
Z_precision_repeat = fields.Float('Z轴重复定位精度(mm)', digits=(12, 3))
|
||||
a_precision = fields.Float('a轴定位精度(mm)', digits=(12, 3))
|
||||
a_precision_repeat = fields.Float('a轴重复定位精度(mm)', digits=(12, 3))
|
||||
b_precision = fields.Float('b轴定位精度(mm)', digits=(12, 3))
|
||||
b_precision_repeat = fields.Float('b轴重复定位精度(mm)', digits=(12, 3))
|
||||
c_precision = fields.Float('c轴定位精度(mm)', digits=(12, 3))
|
||||
c_precision_repeat = fields.Float('c轴重复定位精度(mm)', digits=(12, 3))
|
||||
X_precision = fields.Char('X轴定位精度(mm)')
|
||||
X_precision_repeat = fields.Char('X轴重复定位精度(mm)')
|
||||
Y_precision = fields.Char('Y轴定位精度(mm)')
|
||||
Y_precision_repeat = fields.Char('Y轴重复定位精度(mm)')
|
||||
Z_precision = fields.Char('Z轴定位精度(mm)')
|
||||
Z_precision_repeat = fields.Char('Z轴重复定位精度(mm)')
|
||||
a_precision = fields.Char('a轴定位精度(mm)')
|
||||
a_precision_repeat = fields.Char('a轴重复定位精度(mm)')
|
||||
b_precision = fields.Char('b轴定位精度(mm)')
|
||||
b_precision_repeat = fields.Char('b轴重复定位精度(mm)')
|
||||
c_precision = fields.Char('c轴定位精度(mm)')
|
||||
c_precision_repeat = fields.Char('c轴重复定位精度(mm)')
|
||||
|
||||
tool_full_diameter_max = fields.Float('刀具满刀最大直径(mm)')
|
||||
tool_perimeter_diameter_max = fields.Float('刀具邻空刀最大直径(mm)')
|
||||
T_tool_time = fields.Integer('T-T换刀时间(s)')
|
||||
C_tool_time = fields.Integer('C-C换刀时间(s)')
|
||||
T_tool_time = fields.Float('T-T换刀时间(s)', digits=(12, 1))
|
||||
C_tool_time = fields.Float('C-C换刀时间(s)', digits=(12, 1))
|
||||
|
||||
# 待删除字段
|
||||
precision_min = fields.Float('X轴定位精度min(mm)', digits=(12, 3))
|
||||
@@ -164,11 +164,12 @@ class SfMaintenanceEquipment(models.Model):
|
||||
number_of_knife_library = fields.Integer('刀库数量(把)')
|
||||
rotate_speed = fields.Integer('转速')
|
||||
# 加工进程
|
||||
a_axis = fields.Char('a轴')
|
||||
x_axis = fields.Integer('X轴')
|
||||
y_axis = fields.Integer('Y轴')
|
||||
z_axis = fields.Integer('Z轴')
|
||||
b_axis = fields.Integer('B轴')
|
||||
c_axis = fields.Integer('C轴')
|
||||
b_axis = fields.Char('B轴')
|
||||
c_axis = fields.Char('C轴')
|
||||
remark = fields.Char('备注')
|
||||
is_binding = fields.Boolean('是否绑定机床', default=False)
|
||||
control_system_id = fields.Many2one('sf.machine.control_system',
|
||||
@@ -191,6 +192,7 @@ class SfMaintenanceEquipment(models.Model):
|
||||
workpiece_load = fields.Char('工件最大负载(kg)')
|
||||
workbench_L = fields.Char('工作台长度(mm)')
|
||||
workbench_W = fields.Char('工作台宽度(mm)')
|
||||
workbench_H = fields.Char('工作台高度(mm)')
|
||||
machine_tool_L = fields.Char('机床长度(mm)')
|
||||
machine_tool_W = fields.Char('机床宽度(mm)')
|
||||
machine_tool_H = fields.Char('机床高度(mm)')
|
||||
@@ -518,6 +520,7 @@ class SfMaintenanceEquipment(models.Model):
|
||||
'lead_screw': item.lead_screw,
|
||||
'workbench_L': item.workbench_L,
|
||||
'workbench_W': item.workbench_W,
|
||||
'workbench_H': item.workbench_H,
|
||||
'guide_rail': item.guide_rail,
|
||||
'machine_tool_L': item.machine_tool_L,
|
||||
'machine_tool_W': item.machine_tool_W,
|
||||
|
||||
@@ -27,6 +27,7 @@ access_sf_maintenance_logs_group_plan_dispatch,sf_maintenance_logs,model_sf_main
|
||||
access_maintenance_standard_image_group_plan_dispatch,maintenance_standard_image,model_maintenance_standard_image,sf_base.group_plan_dispatch,1,0,0,0
|
||||
access_equipment_maintenance_standards_group_plan_dispatch,equipment_maintenance_standards,model_equipment_maintenance_standards,sf_base.group_plan_dispatch,1,0,0,0
|
||||
access_maintenance_standards_group_plan_dispatch,maintenance_standards,model_maintenance_standards,sf_base.group_plan_dispatch,1,0,0,0
|
||||
access_maintenance_equipment_agv_log_group_plan_dispatch,maintenance.equipment.agv.log,model_maintenance_equipment_agv_log,sf_base.group_plan_dispatch,1,0,0,0
|
||||
|
||||
access_sf_robot_axis_num_group_plan_dispatch,sf.robot.axis.num,model_sf_robot_axis_num,sf_base.group_plan_dispatch,1,0,0,0
|
||||
|
||||
|
||||
|
@@ -85,6 +85,11 @@
|
||||
<field name="workbench_W" class="o_address_zip"
|
||||
attrs="{'required': [('equipment_type', '=', '机床')]}"
|
||||
options="{'format': false}"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="workbench_H" string="高"/>
|
||||
<field name="workbench_H" class="o_address_zip"
|
||||
attrs="{'required': [('equipment_type', '=', '机床')]}"
|
||||
options="{'format': false}"/>
|
||||
</div>
|
||||
<field name="workpiece_load"/>
|
||||
<label for="machine_tool_L" string="机床尺寸(mm)"/>
|
||||
@@ -155,15 +160,15 @@
|
||||
attrs="{'invisible': [('number_of_axles', '=', '三轴')]}"
|
||||
options="{'format': false}"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="b_axis" string="b"
|
||||
<label for="c_axis" string="c"
|
||||
attrs="{'invisible': [('number_of_axles', 'in', ['三轴','四轴'])]}"/>
|
||||
<field name="b_axis" class="o_address_zip"
|
||||
<field name="c_axis" class="o_address_zip"
|
||||
attrs="{'invisible': [('number_of_axles', 'in', ['三轴','四轴'])]}"
|
||||
options="{'format': false}"/>
|
||||
<span>&nbsp;</span>
|
||||
<label for="c_axis" string="c"
|
||||
<label for="b_axis" string="b"
|
||||
attrs="{'invisible': [('number_of_axles', 'in', ['三轴','四轴','五轴'])]}"/>
|
||||
<field name="c_axis" class="o_address_zip"
|
||||
<field name="b_axis" class="o_address_zip"
|
||||
attrs="{'invisible': [('number_of_axles', 'in', ['三轴','四轴','五轴'])]}"
|
||||
options="{'format': false}"/>
|
||||
</div>
|
||||
|
||||
@@ -96,6 +96,8 @@ class MrpProduction(models.Model):
|
||||
# production.state = 'completed'
|
||||
elif production.state == 'pending_processing' and production.schedule_state == '已完成':
|
||||
production.state = 'completed'
|
||||
elif production.state == 'progress' and production.schedule_state == '已完成':
|
||||
production.state = 'completed'
|
||||
|
||||
def action_check(self):
|
||||
"""
|
||||
|
||||
@@ -134,6 +134,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
workpiece_delivery_ids = fields.One2many('sf.workpiece.delivery', 'workorder_id', '工件配送')
|
||||
is_delivery = fields.Boolean('是否配送完成', default=False)
|
||||
rfid_code = fields.Char('RFID码')
|
||||
rfid_code_old = fields.Char('RFID码(已解除)')
|
||||
production_line_id = fields.Many2one('sf.production.line', related='production_id.production_line_id',
|
||||
string='生产线', store=True)
|
||||
production_line_state = fields.Selection(related='production_id.production_line_state',
|
||||
@@ -624,6 +625,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
is_production_id = False
|
||||
if is_production_id == True and self.name == '解除装夹':
|
||||
for workorder in self.production_id.workorder_ids:
|
||||
workorder.rfid_code_old = workorder.rfid_code
|
||||
workorder.rfid_code = None
|
||||
for move_raw_id in self.production_id.move_raw_ids:
|
||||
move_raw_id.quantity_done = move_raw_id.product_uom_qty
|
||||
|
||||
@@ -275,10 +275,10 @@
|
||||
<button name="action_open_wizard" type="object" icon="fa-external-link" class="oe_edit_only"
|
||||
title="Open Work Order"
|
||||
context="{'default_workcenter_id': workcenter_id}" groups="sf_base.group_sf_mrp_user"/>
|
||||
=======
|
||||
<button name="button_start" type="object" string="开始" class="btn-success"
|
||||
attrs="{'invisible': ['|', '|', '|', ('production_state','in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'), ('state', 'in', ('done', 'cancel')), ('is_user_working', '!=', False)]}"
|
||||
groups="sf_base.group_sf_mrp_user"/>
|
||||
<!-- ======= -->
|
||||
<!-- <button name="button_start" type="object" string="开始" class="btn-success" -->
|
||||
<!-- attrs="{'invisible': ['|', '|', '|', ('production_state','in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'), ('state', 'in', ('done', 'cancel')), ('is_user_working', '!=', False)]}" -->
|
||||
<!-- groups="sf_base.group_sf_mrp_user"/> -->
|
||||
</xpath>
|
||||
<xpath expr="//tree//button[@name='button_pending']" position="replace">
|
||||
<button name="button_pending" type="object" string="暂停" class="btn-warning"
|
||||
|
||||
@@ -183,7 +183,9 @@
|
||||
attrs='{"invisible": [("routing_type","!=","装夹预调")]}'/>
|
||||
<field name="functional_fixture_type_id"
|
||||
attrs='{"invisible": [("routing_type","!=","装夹预调")]}'/>
|
||||
<field name="rfid_code" force_save="1" readonly="1" class="customRFID"/>
|
||||
<field name="rfid_code" force_save="1" readonly="1" class="customRFID"
|
||||
attrs="{'invisible': [('rfid_code_old', '!=', False)]}"/>
|
||||
<field name="rfid_code_old" readonly="1" attrs="{'invisible': [('rfid_code_old', '=', False)]}"/>
|
||||
<script src="/sf_manufacturing/static/src/js/customRFID.js"></script>
|
||||
</group>
|
||||
<!-- <group>-->
|
||||
|
||||
@@ -657,6 +657,7 @@ class MachineToolType(models.Model):
|
||||
# "lead_screw": item['lead_screw'],
|
||||
"workbench_L": item['workbench_L'],
|
||||
"workbench_W": item['workbench_W'],
|
||||
"workbench_H": item['workbench_H'],
|
||||
# "guide_rail": item['guide_rail'],
|
||||
"machine_tool_L": item['machine_tool_L'],
|
||||
"machine_tool_W": item['machine_tool_W'],
|
||||
@@ -739,6 +740,7 @@ class MachineToolType(models.Model):
|
||||
# "lead_screw": item['lead_screw'],
|
||||
"workbench_L": item['workbench_L'],
|
||||
"workbench_W": item['workbench_W'],
|
||||
"workbench_H": item['workbench_H'],
|
||||
# "guide_rail": item['guide_rail'],
|
||||
"machine_tool_L": item['machine_tool_L'],
|
||||
"machine_tool_W": item['machine_tool_W'],
|
||||
@@ -852,6 +854,7 @@ class MachineToolType(models.Model):
|
||||
# "lead_screw": item['lead_screw'],
|
||||
"workbench_L": item['workbench_L'],
|
||||
"workbench_W": item['workbench_W'],
|
||||
"workbench_H": item['workbench_H'],
|
||||
# "guide_rail": item['guide_rail'],
|
||||
"machine_tool_L": item['machine_tool_L'],
|
||||
"machine_tool_W": item['machine_tool_W'],
|
||||
@@ -934,6 +937,7 @@ class MachineToolType(models.Model):
|
||||
# "lead_screw": item['lead_screw'],
|
||||
"workbench_L": item['workbench_L'],
|
||||
"workbench_W": item['workbench_W'],
|
||||
"workbench_H": item['workbench_H'],
|
||||
# "guide_rail": item['guide_rail'],
|
||||
"machine_tool_L": item['machine_tool_L'],
|
||||
"machine_tool_W": item['machine_tool_W'],
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<header>
|
||||
<!-- <button name="do_production_schedule" type="object" string="批量排程"/> -->
|
||||
<button string="批量排程" name="%(sf_plan.action_plan_some)d" type="action"
|
||||
class="btn-primary"/>
|
||||
class="treeHeaderBtn"/>
|
||||
</header>
|
||||
<field name="state" widget="badge" decoration-warning="state == 'draft'"
|
||||
decoration-success="state == 'done'" decoration-info="state == 'processing'"
|
||||
|
||||
@@ -46,11 +46,16 @@
|
||||
groups="sf_base.group_quality_director"
|
||||
class="oe_highlight"/>
|
||||
</xpath>
|
||||
<xpath expr="//sheet//group//group//field[@name='title']" position="replace">
|
||||
<field name="title" class="custom_required"/>
|
||||
<!-- <xpath expr="//sheet//group//group//field[@name='title']" position="replace"> -->
|
||||
<!-- <field name="title" class="custom_required" required="1"/> -->
|
||||
<!-- </xpath> -->
|
||||
<xpath expr="//sheet//group//group//field[@name='title']" position="attributes">
|
||||
<attribute name="class">custom_required</attribute>
|
||||
<attribute name="required">1</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//sheet//group//group//field[@name='picking_type_ids']" position="attributes">
|
||||
<attribute name="class">custom_required</attribute>
|
||||
<attribute name="required">1</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
@@ -62,6 +67,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='measure_on']" position="attributes">
|
||||
<attribute name="class">custom_required</attribute>
|
||||
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='measure_frequency_type']" position="attributes">
|
||||
<attribute name="class">custom_required</attribute>
|
||||
|
||||
@@ -55,9 +55,12 @@
|
||||
<!-- <attribute name="groups">sf_base.group_purchase,sf_base.group_purchase_director</attribute> -->
|
||||
<button name="action_create_invoice" string="创建账单" type="object" class="oe_highlight" context="{'create_bill':True}" attrs="{'invisible': ['|', ('state', 'not in', ('purchase', 'done')), ('invoice_status', 'in', ('no', 'invoiced'))]}" data-hotkey="w" groups="sf_base.group_purchase,sf_base.group_purchase_director"/>
|
||||
</xpath>
|
||||
<xpath expr="//form/header/button[@name='button_confirm']" position="replace">
|
||||
<!-- <attribute name="groups">sf_base.group_purchase,sf_base.group_purchase_director</attribute> -->
|
||||
<button name="action_create_invoice" string="创建账单" type="object" class="oe_highlight" context="{'create_bill':True}" attrs="{'invisible': ['|', ('state', 'not in', ('purchase', 'done')), ('invoice_status', 'in', ('no', 'invoiced'))]}" data-hotkey="w" groups="sf_base.group_purchase,sf_base.group_purchase_director"/>
|
||||
<xpath expr="//form/header/button[@name='action_create_invoice'][2]" position="attributes">
|
||||
<attribute name="groups">sf_base.group_purchase,sf_base.group_purchase_director</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//form/header/button[@name='button_confirm']" position="attributes">
|
||||
<attribute name="groups">sf_base.group_purchase,sf_base.group_purchase_director</attribute>
|
||||
<!-- <button name="action_create_invoice" string="创建账单" type="object" class="oe_highlight" context="{'create_bill':True}" attrs="{'invisible': ['|', ('state', 'not in', ('purchase', 'done')), ('invoice_status', 'in', ('no', 'invoiced'))]}" data-hotkey="w" groups="sf_base.group_purchase,sf_base.group_purchase_director"/> -->
|
||||
</xpath>
|
||||
<!-- <xpath expr="//form/header/button[@name='action_create_invoice[2]']" position="attributes">-->
|
||||
<!-- <attribute name="groups">sf_base.group_purchase,sf_base.group_purchase_director</attribute>-->
|
||||
@@ -122,6 +125,17 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="purchase_order_kpis_tree_inherit_sf" model="ir.ui.view">
|
||||
<field name="name">purchase.stock.order.tree.inherit.sf</field>
|
||||
<field name="model">purchase.order</field>
|
||||
<field name="inherit_id" ref="purchase.purchase_order_kpis_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//tree//header//button[@name='action_create_invoice']" position="attributes">
|
||||
<attribute name="groups">sf_base.group_purchase,sf_base.group_purchase_director</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="purchase_stock_order_view_form_inherit_sf" model="ir.ui.view">
|
||||
<field name="name">purchase.stock.order.form.inherit.sf</field>
|
||||
|
||||
@@ -2,4 +2,5 @@ from . import base
|
||||
from . import tool_material_search
|
||||
from . import maintenance_equipment
|
||||
from . import mrp_workorder
|
||||
from . import functional_tool_enroll
|
||||
|
||||
|
||||
@@ -39,24 +39,29 @@ class FunctionalCuttingToolEntity(models.Model):
|
||||
functional_tool_status = fields.Selection([('正常', '正常'), ('报警', '报警'), ('已拆除', '已拆除')],
|
||||
string='状态', store=True, default='正常')
|
||||
current_location_id = fields.Many2one('stock.location', string='当前位置', readonly=True)
|
||||
current_location = fields.Char('位置', compute='_compute_current_location_id')
|
||||
current_location = fields.Selection(
|
||||
[('组装后', '组装后'), ('刀具房', '刀具房'), ('线边刀库', '线边刀库'), ('机内刀库', '机内刀库')],
|
||||
string='位置', compute='_compute_current_location_id', store=True)
|
||||
image = fields.Binary('图片', readonly=True)
|
||||
|
||||
active = fields.Boolean(string='已归档', default=True)
|
||||
|
||||
@api.depends('barcode_id')
|
||||
@api.depends('barcode_id.quant_ids')
|
||||
def _compute_current_location_id(self):
|
||||
for record in self:
|
||||
if record.barcode_id.quant_ids:
|
||||
for quant_id in record.barcode_id.quant_ids:
|
||||
if quant_id.inventory_quantity_auto_apply > 0:
|
||||
record.sudo().current_location_id = quant_id.location_id
|
||||
record.sudo().current_location = quant_id.location_id.name
|
||||
record.current_location_id = quant_id.location_id
|
||||
if quant_id.location_id.name == '制造前':
|
||||
record.current_location = '机内刀库'
|
||||
else:
|
||||
record.current_location = quant_id.location_id.name
|
||||
if record.current_location_id:
|
||||
record.sudo().get_location_num()
|
||||
else:
|
||||
record.sudo().current_location_id = False
|
||||
record.sudo().current_location = False
|
||||
record.current_location_id = False
|
||||
record.current_location = False
|
||||
|
||||
def get_location_num(self):
|
||||
"""
|
||||
@@ -64,15 +69,15 @@ class FunctionalCuttingToolEntity(models.Model):
|
||||
"""
|
||||
for obj in self:
|
||||
if obj.current_location_id:
|
||||
if obj.current_location_id.name in ['刀具房']:
|
||||
if obj.current_location in ['刀具房']:
|
||||
obj.tool_room_num = 1
|
||||
obj.line_edge_knife_library_num = 0
|
||||
obj.machine_knife_library_num = 0
|
||||
elif "线边刀库" in obj.current_location_id.name:
|
||||
elif "线边刀库" in obj.current_location:
|
||||
obj.tool_room_num = 0
|
||||
obj.line_edge_knife_library_num = 1
|
||||
obj.machine_knife_library_num = 0
|
||||
elif "机内刀库" in obj.current_location_id.name:
|
||||
elif "机内刀库" in obj.current_location:
|
||||
obj.tool_room_num = 0
|
||||
obj.line_edge_knife_library_num = 0
|
||||
obj.machine_knife_library_num = 1
|
||||
@@ -180,33 +185,45 @@ class FunctionalCuttingToolEntity(models.Model):
|
||||
('coarse_middle_thin', '=', self.coarse_middle_thin)]
|
||||
return result
|
||||
|
||||
# ==========刀具组接口==========
|
||||
# def _register_functional_tool_groups(self, obj):
|
||||
# create_url = '/AutoDeviceApi/ToolGroup'
|
||||
# sf_sync_config = self.env['res.config.settings'].get_values()
|
||||
# token = sf_sync_config['token']
|
||||
# sf_secret_key = sf_sync_config['sf_secret_key']
|
||||
# headers = Common.get_headers(obj, token, sf_secret_key)
|
||||
# strurl = sf_sync_config['sf_url'] + create_url
|
||||
# val = {
|
||||
# 'ToolName': obj.name,
|
||||
# 'GroupName': obj.tool_groups_id.name,
|
||||
# 'ToolId': obj.code
|
||||
# }
|
||||
# kw = json.dumps(val, ensure_ascii=False)
|
||||
# r = requests.post(strurl, json={}, data={'kw': kw, 'token': token}, headers=headers)
|
||||
# ret = r.json()
|
||||
# if r == 200:
|
||||
# return "刀具组发送成功"
|
||||
# else:
|
||||
# raise ValidationError("刀具组发送失败")
|
||||
def tool_inventory_displacement_out(self):
|
||||
"""
|
||||
机床当前刀库实时信息接口,功能刀具出库
|
||||
"""
|
||||
# 获取位置对象
|
||||
location_inventory_id = self.current_location_id
|
||||
stock_location_id = self.env['stock.location'].search([('name', '=', '制造前')])
|
||||
# 创建功能刀具该批次/序列号 库存移动和移动历史
|
||||
self.barcode_id.create_stock_quant(location_inventory_id, stock_location_id,
|
||||
self.functional_tool_name_id.id, '机床装刀')
|
||||
|
||||
# @api.model_create_multi
|
||||
# def create(self, vals):
|
||||
# obj = super(FunctionalCuttingToolEntity, self).create(vals)
|
||||
# # 调用刀具组接口
|
||||
# self._register_functional_tool_groups(obj)
|
||||
# return obj
|
||||
|
||||
# ==========刀具组接口==========
|
||||
# def _register_functional_tool_groups(self, obj):
|
||||
# create_url = '/AutoDeviceApi/ToolGroup'
|
||||
# sf_sync_config = self.env['res.config.settings'].get_values()
|
||||
# token = sf_sync_config['token']
|
||||
# sf_secret_key = sf_sync_config['sf_secret_key']
|
||||
# headers = Common.get_headers(obj, token, sf_secret_key)
|
||||
# strurl = sf_sync_config['sf_url'] + create_url
|
||||
# val = {
|
||||
# 'ToolName': obj.name,
|
||||
# 'GroupName': obj.tool_groups_id.name,
|
||||
# 'ToolId': obj.code
|
||||
# }
|
||||
# kw = json.dumps(val, ensure_ascii=False)
|
||||
# r = requests.post(strurl, json={}, data={'kw': kw, 'token': token}, headers=headers)
|
||||
# ret = r.json()
|
||||
# if r == 200:
|
||||
# return "刀具组发送成功"
|
||||
# else:
|
||||
# raise ValidationError("刀具组发送失败")
|
||||
|
||||
# @api.model_create_multi
|
||||
# def create(self, vals):
|
||||
# obj = super(FunctionalCuttingToolEntity, self).create(vals)
|
||||
# # 调用刀具组接口
|
||||
# self._register_functional_tool_groups(obj)
|
||||
# return obj
|
||||
|
||||
|
||||
class FunctionalToolWarning(models.Model):
|
||||
|
||||
351
sf_tool_management/models/functional_tool_enroll.py
Normal file
351
sf_tool_management/models/functional_tool_enroll.py
Normal file
@@ -0,0 +1,351 @@
|
||||
import json
|
||||
import base64
|
||||
import requests
|
||||
from odoo import models, api
|
||||
from odoo.addons.sf_base.commons.common import Common
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class StockLot(models.Model):
|
||||
_inherit = 'stock.lot'
|
||||
_description = '刀具物料序列号注册'
|
||||
|
||||
crea_url = "/api/tool_material_stock/create"
|
||||
|
||||
def enroll_tool_material_stock(self):
|
||||
sf_sync_config = self.env['res.config.settings'].get_values()
|
||||
token = sf_sync_config['token']
|
||||
sf_secret_key = sf_sync_config['sf_secret_key']
|
||||
headers = Common.get_headers(self, token, sf_secret_key)
|
||||
str_url = sf_sync_config['sf_url'] + self.crea_url
|
||||
objs_all = self.env['stock.lot'].search([('id', '=', self.id)])
|
||||
tool_material_stock_list = []
|
||||
if objs_all:
|
||||
for item in objs_all:
|
||||
val = {
|
||||
'name': item.name,
|
||||
'tool_material_status': item.tool_material_status,
|
||||
'location': item.quant_ids[-1].location_id.name
|
||||
}
|
||||
tool_material_stock_list.append(val)
|
||||
kw = json.dumps(tool_material_stock_list, ensure_ascii=False)
|
||||
r = requests.post(str_url, json={}, data={'kw': kw, 'token': token}, headers=headers)
|
||||
ret = r.json()
|
||||
if r == 200:
|
||||
return '刀具物料序列号注册成功'
|
||||
else:
|
||||
raise UserError("没有注册刀具物料序列号信息")
|
||||
|
||||
@api.onchange('quant_ids')
|
||||
def _onchange_quant_ids(self):
|
||||
for item in self:
|
||||
if item.product_id.categ_id == '刀具':
|
||||
item.enroll_tool_material_stock()
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
records = super(StockLot, self).create(vals_list)
|
||||
for record in records:
|
||||
if record.product_id.categ_id == '刀具':
|
||||
record.enroll_tool_material_stock()
|
||||
return records
|
||||
|
||||
|
||||
class ToolMaterial(models.Model):
|
||||
_inherit = 'sf.tool.material.search'
|
||||
_description = '刀具物料注册'
|
||||
|
||||
crea_url = '/api/tool_material/create'
|
||||
|
||||
def enroll_tool_material(self):
|
||||
sf_sync_config = self.env['res.config.settings'].get_values()
|
||||
token = sf_sync_config['token']
|
||||
sf_secret_key = sf_sync_config['sf_secret_key']
|
||||
headers = Common.get_headers(self, token, sf_secret_key)
|
||||
str_url = sf_sync_config['sf_url'] + self.crea_url
|
||||
objs_all = self.search([('id', '=', self.id)])
|
||||
tool_material_list = []
|
||||
if objs_all:
|
||||
for item in objs_all:
|
||||
barcode_names = []
|
||||
for barcode_id in item.barcode_ids:
|
||||
if barcode_id.name:
|
||||
barcode_names.append(barcode_id.name)
|
||||
val = {
|
||||
'name': item.name,
|
||||
'code': item.code,
|
||||
'cutting_tool_material_code': item.cutting_tool_material_id.code,
|
||||
'cutting_tool_standard_library_code': item.cutting_tool_standard_library_id.code,
|
||||
'specification_name': item.specification_id.name,
|
||||
'image': item.image,
|
||||
'number': item.number,
|
||||
'usable_num': item.usable_num,
|
||||
'have_been_used_num': item.have_been_used_num,
|
||||
'scrap_num': item.scrap_num,
|
||||
'barcode_names': str(barcode_names),
|
||||
'active': item.active
|
||||
}
|
||||
tool_material_list.append(val)
|
||||
kw = json.dumps(tool_material_list, ensure_ascii=False)
|
||||
r = requests.post(str_url, json={}, data={'kw': kw, 'token': token}, headers=headers)
|
||||
ret = r.json()
|
||||
if r == 200:
|
||||
return '刀具物料注册成功'
|
||||
else:
|
||||
raise UserError("没有注册刀具物料信息")
|
||||
|
||||
|
||||
class FunctionalCuttingToolEntity(models.Model):
|
||||
_inherit = 'sf.functional.cutting.tool.entity'
|
||||
_description = '功能刀具列表注册'
|
||||
|
||||
crea_url = "/api/functional_tool_entity/create"
|
||||
|
||||
# 注册同步功能刀具列表
|
||||
def enroll_functional_tool_entity(self):
|
||||
sf_sync_config = self.env['res.config.settings'].get_values()
|
||||
token = sf_sync_config['token']
|
||||
sf_secret_key = sf_sync_config['sf_secret_key']
|
||||
headers = Common.get_headers(self, token, sf_secret_key)
|
||||
str_url = sf_sync_config['sf_url'] + self.crea_url
|
||||
objs_all = self.env['sf.functional.cutting.tool.entity'].search([('id', '=', self.id)])
|
||||
functional_tool_list = []
|
||||
if objs_all:
|
||||
for item in objs_all:
|
||||
val = {
|
||||
'id': item.id,
|
||||
'code': item.code,
|
||||
'name': item.name,
|
||||
'tool_groups_name': item.tool_groups_id.name,
|
||||
'barcode': item.barcode_id.name,
|
||||
'cutting_tool_type_code': item.sf_cutting_tool_type_id.code,
|
||||
'functional_tool_diameter': item.functional_tool_diameter,
|
||||
'knife_tip_r_angle': item.knife_tip_r_angle,
|
||||
'coarse_middle_thin': item.coarse_middle_thin,
|
||||
'new_former': item.new_former,
|
||||
'tool_loading_length': item.tool_loading_length,
|
||||
'functional_tool_length': item.functional_tool_length,
|
||||
'effective_length': item.effective_length,
|
||||
'tool_room_num': item.tool_room_num,
|
||||
'line_edge_knife_library_num': item.line_edge_knife_library_num,
|
||||
'machine_knife_library_num': item.machine_knife_library_num,
|
||||
'max_lifetime_value': item.max_lifetime_value,
|
||||
'alarm_value': item.alarm_value,
|
||||
'used_value': item.used_value,
|
||||
'functional_tool_status': item.functional_tool_status,
|
||||
'current_location': item.current_location,
|
||||
'image': '' if not item.image else base64.b64encode(item.image).decode('utf-8'),
|
||||
'whether_standard_knife': item.whether_standard_knife,
|
||||
'L_D_number': item.L_D_number,
|
||||
'hiding_length': item.hiding_length,
|
||||
'cut_time': item.cut_time,
|
||||
'cut_length': item.cut_length,
|
||||
'cut_number': item.cut_number,
|
||||
'cutting_tool_integral_model_code': item.cutting_tool_integral_model_id.code,
|
||||
'cutting_tool_blade_model_code': item.cutting_tool_blade_model_id.code,
|
||||
'cutting_tool_cutterbar_model_code': item.cutting_tool_cutterbar_model_id.code,
|
||||
'cutting_tool_cutterpad_model_code': item.cutting_tool_cutterpad_model_id.code,
|
||||
'cutting_tool_cutterhandle_model_code': item.cutting_tool_cutterhandle_model_id.code,
|
||||
'cutting_tool_cutterhead_model_code': item.cutting_tool_cutterhead_model_id.code,
|
||||
'active': item.active,
|
||||
}
|
||||
functional_tool_list.append(val)
|
||||
kw = json.dumps(functional_tool_list, ensure_ascii=False)
|
||||
r = requests.post(str_url, json={}, data={'kw': kw, 'token': token}, headers=headers)
|
||||
ret = r.json()
|
||||
# self.code = ret['data']
|
||||
# self.state_zc = "已注册"
|
||||
if r == 200:
|
||||
return "功能刀具注册成功"
|
||||
else:
|
||||
raise UserError("没有注册功能刀具信息")
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
records = super(FunctionalCuttingToolEntity, self).create(vals_list)
|
||||
for record in records:
|
||||
if record:
|
||||
record.enroll_functional_tool_entity()
|
||||
return records
|
||||
|
||||
|
||||
class FunctionalToolWarning(models.Model):
|
||||
_inherit = 'sf.functional.tool.warning'
|
||||
_description = '功能刀具预警注册'
|
||||
|
||||
crea_url = "/api/functional_tool_warning/create"
|
||||
|
||||
# 注册同步功能刀具预警
|
||||
def enroll_functional_tool_warning(self):
|
||||
sf_sync_config = self.env['res.config.settings'].get_values()
|
||||
token = sf_sync_config['token']
|
||||
sf_secret_key = sf_sync_config['sf_secret_key']
|
||||
headers = Common.get_headers(self, token, sf_secret_key)
|
||||
str_url = sf_sync_config['sf_url'] + self.crea_url
|
||||
objs_all = self.env['sf.functional.tool.warning'].search([('id', '=', self.id)])
|
||||
tool_warning_list = []
|
||||
if objs_all:
|
||||
for item in objs_all:
|
||||
val = {
|
||||
'id': item.id,
|
||||
'name': item.name,
|
||||
'code': item.code,
|
||||
'tool_groups_name': item.tool_groups_id.name,
|
||||
'production_line': item.production_line_id.name,
|
||||
'machine_tool_id': item.maintenance_equipment_id.code,
|
||||
'machine_tool_code': item.machine_tool_code,
|
||||
'machine_table_type_code': item.machine_table_type_id.code,
|
||||
'cutter_spacing_code': item.cutter_spacing_code_id.code,
|
||||
'functional_tool_name': item.name,
|
||||
'barcode': item.barcode_id.name,
|
||||
'mrs_cutting_tool_type_code': item.mrs_cutting_tool_type_id.code,
|
||||
'diameter': item.diameter,
|
||||
'knife_tip_r_angle': item.knife_tip_r_angle,
|
||||
'install_tool_time': item.install_tool_time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'on_board_time': item.on_board_time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'max_lifetime_value': item.max_lifetime_value,
|
||||
'alarm_value': item.alarm_value,
|
||||
'used_value': item.used_value,
|
||||
'functional_tool_status': item.functional_tool_status,
|
||||
'alarm_time': item.alarm_time,
|
||||
'dispose_user': item.dispose_user,
|
||||
'dispose_time': item.dispose_time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'dispose_func': item.dispose_func,
|
||||
}
|
||||
tool_warning_list.append(val)
|
||||
kw = json.dumps(tool_warning_list, ensure_ascii=False)
|
||||
r = requests.post(str_url, json={}, data={'kw': kw, 'token': token}, headers=headers)
|
||||
ret = r.json()
|
||||
# self.code = ret['data']
|
||||
# self.state_zc = "已注册"
|
||||
if r == 200:
|
||||
return "功能刀具预警注册成功"
|
||||
else:
|
||||
raise UserError("没有注册功能刀具预警信息")
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
records = super(FunctionalToolWarning, self).create(vals_list)
|
||||
for record in records:
|
||||
if record:
|
||||
record.enroll_functional_tool_warning()
|
||||
return records
|
||||
|
||||
|
||||
class StockMoveLine(models.Model):
|
||||
_inherit = 'stock.move.line'
|
||||
_description = '功能刀具出入库记录注册'
|
||||
|
||||
crea_url = "/api/functional_tool_move/create"
|
||||
|
||||
# 注册同步功能刀具出入库记录
|
||||
def enroll_functional_tool_move(self):
|
||||
sf_sync_config = self.env['res.config.settings'].get_values()
|
||||
token = sf_sync_config['token']
|
||||
sf_secret_key = sf_sync_config['sf_secret_key']
|
||||
headers = Common.get_headers(self, token, sf_secret_key)
|
||||
str_url = sf_sync_config['sf_url'] + self.crea_url
|
||||
objs_all = self.env['stock.move.line'].search([('id', '=', self.id), ('functional_tool_name_id', '!=', False)])
|
||||
tool_stock_list = []
|
||||
if objs_all:
|
||||
for item in objs_all:
|
||||
val = {
|
||||
'id': item.id,
|
||||
'name': item.functional_tool_name_id.name,
|
||||
'code': item.code,
|
||||
'tool_groups_name': item.tool_groups_id.name,
|
||||
'reference': item.reference,
|
||||
'barcode': item.lot_id.name,
|
||||
'functional_tool_type_code': item.functional_tool_type_id.code,
|
||||
'diameter': item.diameter,
|
||||
'knife_tip_r_angle': item.knife_tip_r_angle,
|
||||
'install_tool_time': item.install_tool_time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'location_id': item.location_id.name,
|
||||
'location_dest_name': item.location_dest_id.name,
|
||||
'date': item.date.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'qty_done': item.qty_done,
|
||||
}
|
||||
tool_stock_list.append(val)
|
||||
kw = json.dumps(tool_stock_list, ensure_ascii=False)
|
||||
r = requests.post(str_url, json={}, data={'kw': kw, 'token': token}, headers=headers)
|
||||
ret = r.json()
|
||||
# self.code = ret['data']
|
||||
# self.state_zc = "已注册"
|
||||
if r == 200:
|
||||
return "功能刀具出入库记录注册成功"
|
||||
else:
|
||||
raise UserError("没有注册功能刀具出入库记录信息")
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
records = super(StockMoveLine, self).create(vals_list)
|
||||
for record in records:
|
||||
if record.functional_tool_name_id:
|
||||
record.enroll_functional_tool_move()
|
||||
return records
|
||||
|
||||
|
||||
class RealTimeDistributionFunctionalTools(models.Model):
|
||||
_inherit = 'sf.real.time.distribution.of.functional.tools'
|
||||
_description = '功能刀具安全库存注册'
|
||||
|
||||
crea_url = "/api/functional_tool_distribution/create"
|
||||
|
||||
# 注册同步功能刀具预警
|
||||
def enroll_functional_tool_real_time_distribution(self):
|
||||
sf_sync_config = self.env['res.config.settings'].get_values()
|
||||
token = sf_sync_config['token']
|
||||
sf_secret_key = sf_sync_config['sf_secret_key']
|
||||
headers = Common.get_headers(self, token, sf_secret_key)
|
||||
str_url = sf_sync_config['sf_url'] + self.crea_url
|
||||
objs_all = self.env['sf.real.time.distribution.of.functional.tools'].search([('id', '=', self.id)])
|
||||
tool_distribution_list = []
|
||||
if objs_all:
|
||||
for item in objs_all:
|
||||
functional_tool_codes = []
|
||||
for obj in item.sf_functional_cutting_tool_entity_ids:
|
||||
functional_tool_codes.append(obj.code)
|
||||
val = {
|
||||
'id': item.id,
|
||||
'name': item.name,
|
||||
'tool_groups_name': item.tool_groups_id.name,
|
||||
'sf_cutting_tool_type_code': item.sf_cutting_tool_type_id.code,
|
||||
'diameter': item.diameter,
|
||||
'knife_tip_r_angle': item.knife_tip_r_angle,
|
||||
'tool_stock_num': item.tool_stock_num,
|
||||
'side_shelf_num': item.side_shelf_num,
|
||||
'on_tool_stock_num': item.on_tool_stock_num,
|
||||
'tool_stock_total': item.tool_stock_total,
|
||||
'min_stock_num': item.min_stock_num,
|
||||
'max_stock_num': item.max_stock_num,
|
||||
'batch_replenishment_num': item.batch_replenishment_num,
|
||||
'unit': item.unit,
|
||||
'image': '' if not item.image else base64.b64encode(item.image).decode('utf-8'),
|
||||
'functional_tool_codes': str(functional_tool_codes),
|
||||
'whether_standard_knife': item.whether_standard_knife,
|
||||
'coarse_middle_thin': item.coarse_middle_thin,
|
||||
'active': item.active
|
||||
}
|
||||
tool_distribution_list.append(val)
|
||||
kw = json.dumps(tool_distribution_list, ensure_ascii=False)
|
||||
r = requests.post(str_url, json={}, data={'kw': kw, 'token': token}, headers=headers)
|
||||
ret = r.json()
|
||||
# self.code = ret['data']
|
||||
# self.state_zc = "已注册"
|
||||
if r == 200:
|
||||
return "功能刀具出入库记录注册成功"
|
||||
else:
|
||||
raise UserError("没有注册功能刀具出入库记录信息")
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
records = super(RealTimeDistributionFunctionalTools, self).create(vals_list)
|
||||
for record in records:
|
||||
if record.functional_tool_name_id:
|
||||
record.enroll_functional_tool_move()
|
||||
return records
|
||||
|
||||
def write(self, vals):
|
||||
res = super().write(vals)
|
||||
self.enroll_functional_tool_move()
|
||||
return res
|
||||
@@ -79,6 +79,9 @@ class SfMaintenanceEquipment(models.Model):
|
||||
'functional_tool_name_id': functional_tool_id.id,
|
||||
'tool_install_time': time
|
||||
})
|
||||
if functional_tool_id.current_location_id.name != '制造前':
|
||||
# 对功能刀具进行出库到生产线
|
||||
functional_tool_id.tool_inventory_displacement_out()
|
||||
functional_tool_id.write({
|
||||
'max_lifetime_value': data['MaxLife'],
|
||||
'used_value': data['UseLife'],
|
||||
@@ -101,10 +104,11 @@ class StockLot(models.Model):
|
||||
def _compute_tool_material_status(self):
|
||||
for record in self:
|
||||
if record:
|
||||
if record.quant_ids[-1].location_id.name == '刀具组装位置':
|
||||
record.tool_material_status = '在用'
|
||||
else:
|
||||
record.tool_material_status = '可用'
|
||||
if record.quant_ids:
|
||||
if record.quant_ids[-1].location_id.name == '刀具组装位置':
|
||||
record.tool_material_status = '在用'
|
||||
else:
|
||||
record.tool_material_status = '可用'
|
||||
|
||||
@api.model
|
||||
def name_search(self, name='', args=None, operator='ilike', limit=100):
|
||||
|
||||
@@ -311,6 +311,7 @@ class ToolMaterial(models.Model):
|
||||
product_id = fields.Many2one('product.product', string='刀具物料产品')
|
||||
|
||||
name = fields.Char('名称', related='product_id.name')
|
||||
code = fields.Char('编码', store=True)
|
||||
cutting_tool_material_id = fields.Many2one('sf.cutting.tool.material', '刀具物料',
|
||||
related='product_id.cutting_tool_material_id',
|
||||
store=True,
|
||||
@@ -330,6 +331,14 @@ class ToolMaterial(models.Model):
|
||||
|
||||
active = fields.Boolean(string='已归档', default=True)
|
||||
|
||||
@api.depends('product_id')
|
||||
def _compute_code(self):
|
||||
for record in self:
|
||||
if record:
|
||||
code = '%s_%s' % (record.cutting_tool_standard_library_id.code, record.specification_id.name)
|
||||
obj = self.search([('code', 'like', code)], limit=1, order="id desc")
|
||||
record.code = '%s_%03d' % (code, 1 if obj else int(obj.code[-3:]) + 1)
|
||||
|
||||
@api.depends('barcode_ids')
|
||||
def _compute_number(self):
|
||||
for record in self:
|
||||
|
||||
@@ -40,6 +40,8 @@
|
||||
<field name="arch" type="xml">
|
||||
<form create="0" edit="0" delete="0">
|
||||
<header>
|
||||
<button name="enroll_functional_tool_entity" string="功能刀具注册" type="object"
|
||||
class="btn-primary"/>
|
||||
<field name="functional_tool_status" widget="statusbar" statusbar_visible="正常,报警,已拆除"/>
|
||||
</header>
|
||||
<sheet>
|
||||
@@ -152,8 +154,8 @@
|
||||
<field name="max_lifetime_value"/>
|
||||
<field name="alarm_value"/>
|
||||
<field name="used_value"/>
|
||||
<field name="current_location_id"/>
|
||||
<field name="current_location" invisible="1"/>
|
||||
<field name="current_location_id" invisible="1"/>
|
||||
<field name="current_location"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="tool_loading_length"/>
|
||||
@@ -203,7 +205,7 @@
|
||||
<filter string="已归档" name="inactive" domain="[('active', '=', False)]"/>
|
||||
<searchpanel>
|
||||
<field name="sf_cutting_tool_type_id" icon="fa-building" enable_counters="1"/>
|
||||
<field name="current_location_id" icon="fa-building" enable_counters="1"/>
|
||||
<field name="current_location" icon="fa-building" enable_counters="1"/>
|
||||
<field name="functional_tool_status" icon="fa-building" enable_counters="1"/>
|
||||
</searchpanel>
|
||||
</search>
|
||||
@@ -243,6 +245,8 @@
|
||||
<field name="dispose_user"/>
|
||||
<field name="dispose_time"/>
|
||||
<field name="dispose_func"/>
|
||||
<button name="enroll_functional_tool_warning" string="刀具预警注册" type="object"
|
||||
class="btn-primary"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
@@ -318,6 +322,10 @@
|
||||
<field name="model">sf.real.time.distribution.of.functional.tools</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<header>
|
||||
<button name="enroll_functional_tool_real_time_distribution" string="安全库存注册" type="object"
|
||||
class="btn-primary"/>
|
||||
</header>
|
||||
<sheet>
|
||||
<div class="oe_title">
|
||||
<h1>
|
||||
@@ -454,6 +462,7 @@
|
||||
<field name="date"/>
|
||||
<field name="qty_done" string="数量"/>
|
||||
<field name="functional_tool_type_id" invisible="True"/>
|
||||
<button name="enroll_functional_tool_move" string="安全库存注册" type="object" class="btn-primary"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
<field name="model">sf.tool.material.search</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="刀具物料查询" create="0">
|
||||
<header>
|
||||
<button string="刀具物料注册" name="enroll_tool_material" type="object" class="btn-primary"/>
|
||||
</header>
|
||||
<sheet>
|
||||
<div class="oe_title">
|
||||
<h1>
|
||||
|
||||
@@ -300,29 +300,32 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
智能工厂组装单处扫码绑定刀具物料')
|
||||
"""
|
||||
for record in self:
|
||||
records = record.env['stock.lot'].search([('name', '=', barcode)])
|
||||
if not records:
|
||||
raise ValidationError('扫描的条形码数据不存在,请重新扫描!')
|
||||
for record_stock_lot in records:
|
||||
if record_stock_lot.quant_ids[-1].location_id.name == '刀具组装位置':
|
||||
raise ValidationError('该刀具物料已使用,请重新选择!!!')
|
||||
elif record_stock_lot.quant_ids[-1].location_id.name not in '刀具房':
|
||||
raise ValidationError('该刀具物料未入库,请重新选择!!!')
|
||||
tool_material_name = record_stock_lot.product_id.cutting_tool_material_id.name
|
||||
if tool_material_name == '整体式刀具':
|
||||
record.integral_code_id = record_stock_lot.id
|
||||
elif tool_material_name == '刀片':
|
||||
record.blade_code_id = record_stock_lot.id
|
||||
elif tool_material_name == '刀杆':
|
||||
record.bar_code_id = record_stock_lot.id
|
||||
elif tool_material_name == '刀盘':
|
||||
record.pad_code_id = record_stock_lot.id
|
||||
elif tool_material_name == '刀柄':
|
||||
record.handle_code_id = record_stock_lot.id
|
||||
elif tool_material_name == '夹头':
|
||||
record.chuck_code_id = record_stock_lot.id
|
||||
else:
|
||||
raise ValidationError('扫描的刀具物料不存在,请重新扫描!')
|
||||
if 'DJWL' in barcode:
|
||||
records = record.env['stock.lot'].search([('name', '=', barcode)])
|
||||
if not records:
|
||||
raise ValidationError('扫描的条形码数据不存在,请重新扫描!')
|
||||
for record_stock_lot in records:
|
||||
if record_stock_lot.quant_ids[-1].location_id.name == '刀具组装位置':
|
||||
raise ValidationError('该刀具物料已使用,请重新选择!!!')
|
||||
elif record_stock_lot.quant_ids[-1].location_id.name not in '刀具房':
|
||||
raise ValidationError('该刀具物料未入库,请重新选择!!!')
|
||||
tool_material_name = record_stock_lot.product_id.cutting_tool_material_id.name
|
||||
if tool_material_name == '整体式刀具':
|
||||
record.integral_code_id = record_stock_lot.id
|
||||
elif tool_material_name == '刀片':
|
||||
record.blade_code_id = record_stock_lot.id
|
||||
elif tool_material_name == '刀杆':
|
||||
record.bar_code_id = record_stock_lot.id
|
||||
elif tool_material_name == '刀盘':
|
||||
record.pad_code_id = record_stock_lot.id
|
||||
elif tool_material_name == '刀柄':
|
||||
record.handle_code_id = record_stock_lot.id
|
||||
elif tool_material_name == '夹头':
|
||||
record.chuck_code_id = record_stock_lot.id
|
||||
else:
|
||||
raise ValidationError('扫描的刀具物料不存在,请重新扫描!')
|
||||
else:
|
||||
record.rfid = barcode
|
||||
|
||||
# 组装功能刀具参数信息
|
||||
barcode_id = fields.Many2one('stock.lot', string='功能刀具序列号')
|
||||
@@ -676,7 +679,8 @@ class ProductProduct(models.Model):
|
||||
location_inventory_id = self.env['stock.location'].search([('name', '=', 'Production')])
|
||||
stock_location_id = self.env['stock.location'].search([('name', '=', '组装后')])
|
||||
# 创建功能刀具该批次/序列号 库存移动和移动历史
|
||||
stock_lot.create_stock_quant(location_inventory_id, stock_location_id, functional_tool_assembly.id)
|
||||
stock_lot.create_stock_quant(location_inventory_id, stock_location_id, functional_tool_assembly.id,
|
||||
'功能刀具组装')
|
||||
|
||||
return stock_lot
|
||||
|
||||
@@ -710,20 +714,20 @@ class ProductProduct(models.Model):
|
||||
location_inventory_id = tool_material.quant_ids.location_id[-1]
|
||||
stock_location_id = self.env['stock.location'].search([('name', '=', '刀具组装位置')])
|
||||
# 创建功能刀具该批次/序列号 库存移动和移动历史
|
||||
tool_material.create_stock_quant(location_inventory_id, stock_location_id, None)
|
||||
tool_material.create_stock_quant(location_inventory_id, stock_location_id, None, '功能刀具组装')
|
||||
|
||||
|
||||
class StockLot(models.Model):
|
||||
_inherit = 'stock.lot'
|
||||
|
||||
def create_stock_quant(self, location_inventory_id, stock_location_id, functional_tool_assembly_id):
|
||||
def create_stock_quant(self, location_inventory_id, stock_location_id, functional_tool_assembly_id, name):
|
||||
"""
|
||||
对功能刀具组装过程的功能刀具和刀具物料进行库存移动,以及创建移动历史
|
||||
"""
|
||||
|
||||
# 创建库存移动记录
|
||||
stock_move_id = self.env['stock.move'].create({
|
||||
'name': '功能刀具组装',
|
||||
stock_move_id = self.env['stock.move'].sudo().create({
|
||||
'name': name,
|
||||
'product_id': self.product_id.id,
|
||||
'location_id': location_inventory_id.id,
|
||||
'location_dest_id': stock_location_id.id,
|
||||
@@ -732,7 +736,7 @@ class StockLot(models.Model):
|
||||
})
|
||||
|
||||
# 创建移动历史记录
|
||||
stock_move_line_id = self.env['stock.move.line'].create({
|
||||
stock_move_line_id = self.env['stock.move.line'].sudo().create({
|
||||
'product_id': self.product_id.id,
|
||||
'functional_tool_name_id': functional_tool_assembly_id,
|
||||
'lot_id': self.id,
|
||||
|
||||
@@ -8,7 +8,7 @@ class Common(models.Model):
|
||||
_description = u'公用类'
|
||||
|
||||
def print_zpl(self, zpl_str):
|
||||
WinDll_path = "D://桌面//pythonZPL//tsc_python_sdk_example//TSC_Python_SDK_Example//tsc_sample//libs//TSCLIB.dll"
|
||||
WinDll_path = "D://桌面//pythonZPL//zebra_zpl//libs//TSCLIB.dll"
|
||||
try:
|
||||
tsclibrary = ctypes.WinDLL(WinDll_path)
|
||||
tsclibrary.openportW("USB")
|
||||
|
||||
Reference in New Issue
Block a user