diff --git a/jikimo_frontend/static/src/js/custom_form_status_indicator.js b/jikimo_frontend/static/src/js/custom_form_status_indicator.js
index de50eddc..35f0f3e2 100644
--- a/jikimo_frontend/static/src/js/custom_form_status_indicator.js
+++ b/jikimo_frontend/static/src/js/custom_form_status_indicator.js
@@ -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('
')
+ }
+ }
+ }
+ } catch (e) {
+ console.log(e)
+ }
}
})
diff --git a/jikimo_frontend/static/src/scss/custom_style.scss b/jikimo_frontend/static/src/scss/custom_style.scss
index 3c106665..d3a44da4 100644
--- a/jikimo_frontend/static/src/scss/custom_style.scss
+++ b/jikimo_frontend/static/src/scss/custom_style.scss
@@ -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;
}
\ No newline at end of file
diff --git a/sf_base/security/ir.model.access.csv b/sf_base/security/ir.model.access.csv
index c0f53f98..3795e69b 100644
--- a/sf_base/security/ir.model.access.csv
+++ b/sf_base/security/ir.model.access.csv
@@ -9,16 +9,25 @@ access_sf_machine_brand_tags,sf_machine_brand_tags,model_sf_machine_brand_tags,b
access_sf_machine_brand_tags_admin,sf_machine_brand_tags_admin,model_sf_machine_brand_tags,base.group_system,1,1,1,0
access_sf_machine_control_system,sf_machine_control_system,model_sf_machine_control_system,base.group_user,1,1,1,0
access_sf_machine_control_system_admin,sf_machine_control_system_admin,model_sf_machine_control_system,base.group_system,1,1,1,0
+access_sf_production_process_group_sale_director,sf_production_process_group_sale_director,model_sf_production_process,sf_base.group_sale_director,1,0,0,0
+access_sf_production_process_group_sale_salemanager,sf_production_process_group_sale_salemanager,model_sf_production_process,sf_base.group_sale_salemanager,1,0,0,0
access_sf_production_process,sf_production_process,model_sf_production_process,base.group_user,1,1,1,0
access_sf_production_process_admin,sf_production_process_admin,model_sf_production_process,base.group_system,1,1,1,0
access_sf_production_materials,sf_production_materials,model_sf_production_materials,base.group_user,1,1,1,0
+access_sf_production_materials_group_sale_director,sf_production_materials_group_sale_director,model_sf_production_materials,sf_base.group_sale_director,1,0,0,0
+access_sf_production_materials_group_sale_salemanager,sf_production_materials_group_sale_salemanager,model_sf_production_materials,sf_base.group_sale_salemanager,1,0,0,0
+
access_sf_production_materials_admin,sf_production_materials_admin,model_sf_production_materials,base.group_system,1,1,1,0
access_sf_materials_model,sf_materials_model,model_sf_materials_model,base.group_user,1,1,1,0
access_sf_materials_model_admin,sf_materials_model_admin,model_sf_materials_model,base.group_system,1,1,1,0
access_sf_supplier_sort,sf_supplier_sort,model_sf_supplier_sort,base.group_user,1,1,1,0
access_sf_supplier_sort_admin,sf_supplier_sort_admin,model_sf_supplier_sort,base.group_system,1,1,1,0
access_sf_production_process_parameter,sf_production_process_parameter,model_sf_production_process_parameter,base.group_user,1,1,1,0
+access_sf_production_process_parameter_group_sale_director,sf_production_process_parameter_group_sale_director,model_sf_production_process_parameter,sf_base.group_sale_director,1,0,0,0
+access_sf_production_process_parameter_group_sale_salemanager,sf_production_process_parameter_group_sale_salemanager,model_sf_production_process_parameter,sf_base.group_sale_salemanager,1,0,0,0
+
+
access_sf_production_process_parameter_group_plan_director,sf_production_process_parameter_group_plan_director,model_sf_production_process_parameter,sf_base.group_plan_director,1,0,0,0
access_sf_production_process_parameter_group_purchase_director,sf_production_process_parameter_group_purchase_director,model_sf_production_process_parameter,sf_base.group_purchase_director,1,0,0,0
access_sf_production_process_parameter_group_sale_director,sf_production_process_parameter_group_sale_director,model_sf_production_process_parameter,sf_base.group_sale_director,1,0,0,0
@@ -101,6 +110,10 @@ access_sf_production_materials_group_plan_director,sf_production_materials_group
access_sf_production_materials_group_purchase_director,sf_production_materials_group_purchase_director,model_sf_production_materials,sf_base.group_purchase_director,1,1,0,0
access_sf_production_materials_group_sale_director,sf_production_materials_group_sale_director,model_sf_production_materials,sf_base.group_sale_director,1,1,0,0
access_sf_materials_model,sf_materials_model,model_sf_materials_model,sf_base.group_sf_mrp_user,1,0,0,0
+access_sf_materials_model_group_sale_salemanager,sf_materials_model_group_sale_salemanager,model_sf_materials_model,sf_base.group_sale_salemanager,1,0,0,0
+access_sf_materials_model_group_sale_director,sf_materials_model_group_sale_director,model_sf_materials_model,sf_base.group_sale_director,1,0,0,0
+
+
access_sf_materials_model_group_plan_director,sf_materials_model_group_plan_director,model_sf_materials_model,sf_base.group_plan_director,1,0,0,0
access_sf_materials_model_group_purchase_director,sf_materials_model_group_purchase_director,model_sf_materials_model,sf_base.group_purchase_director,1,0,0,0
access_sf_materials_model_group_sale_director,sf_materials_model_group_sale_director,model_sf_materials_model,sf_base.group_sale_director,1,0,0,0
diff --git a/sf_dlm_management/views/product_template_management_view.xml b/sf_dlm_management/views/product_template_management_view.xml
index 453de6a3..94fc6b45 100644
--- a/sf_dlm_management/views/product_template_management_view.xml
+++ b/sf_dlm_management/views/product_template_management_view.xml
@@ -10,6 +10,7 @@
+
diff --git a/sf_manufacturing/__manifest__.py b/sf_manufacturing/__manifest__.py
index 6a122097..1c49c88b 100644
--- a/sf_manufacturing/__manifest__.py
+++ b/sf_manufacturing/__manifest__.py
@@ -24,6 +24,7 @@
'views/mrp_workcenter_views.xml',
'views/mrp_workorder_view.xml',
'views/model_type_view.xml',
+ 'views/agv_setting_views.xml',
'views/sf_maintenance_equipment.xml',
],
diff --git a/sf_manufacturing/controllers/controllers.py b/sf_manufacturing/controllers/controllers.py
index 333c57f4..64b51b50 100644
--- a/sf_manufacturing/controllers/controllers.py
+++ b/sf_manufacturing/controllers/controllers.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
import logging
import json
+from datetime import datetime
from odoo import http
from odoo.http import request
@@ -114,7 +115,7 @@ class Manufacturing_Connect(http.Controller):
logging.info('RfidCode:%s' % ret['RfidCode'])
if 'RfidCode' in ret:
workorder = request.env['mrp.workorder'].sudo().search(
- [('routing_type', '=', '装夹预调'), ('rfid_code', '=', ret['RfidCode'])])
+ [('routing_type', '=', '装夹预调'), ('rfid_code', '=', ret['RfidCode'])], limit=1, order='id asc')
if workorder:
for item in workorder:
if item.material_center_point:
@@ -122,8 +123,8 @@ class Manufacturing_Connect(http.Controller):
res['Datas'].append({
'XOffset': 0 if not item.material_center_point else offset[0],
'YOffset': 0 if not item.material_center_point else offset[1],
- 'ZOffet': 0 if not item.material_center_point else offset[2],
- 'COffset': 0 if not item.X_deviation_angle else item.X_deviation_angle,
+ 'ZOffset': 0 if not item.material_center_point else offset[2],
+ 'COffset': 0,
'Coordinate': 'G54'
})
else:
@@ -432,14 +433,15 @@ class Manufacturing_Connect(http.Controller):
if 'DeviceId' in ret:
logging.info('DeviceId:%s' % ret['DeviceId'])
workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search(
- [('feeder_station_destination', '=', ret['DeviceId'])])
+ [('feeder_station_start_id.name', '=', ret['DeviceId']),
+ ('status', '=', '待配送')], limit=1, order='id asc')
if workpiece_delivery:
for wd in workpiece_delivery:
- logging.info('wd.workorder_id:%s' % wd.workorder_id.name)
+ logging.info('wd.production_id:%s' % wd.production_id.name)
if wd.workorder_id.state == 'done' and wd.production_id.production_line_state == '待上产线':
- logging.info('wd.production_id:%s' % wd.production_id.name)
logging.info('wd.production_line_state:%s' % wd.production_id.production_line_state)
wd.production_id.write({'production_line_state': '已上产线'})
+ wd.write({'production_line_state': '已上产线'})
else:
res = {'Succeed': False, 'ErrorCode': 203, 'Error': '该DeviceId没有对应的工件配送数据'}
else:
@@ -466,14 +468,28 @@ class Manufacturing_Connect(http.Controller):
if 'DeviceId' in ret:
logging.info('DeviceId:%s' % ret['DeviceId'])
workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search(
- [('feeder_station_destination', '=', ret['DeviceId'])])
+ [('feeder_station_destination_id.name', '=', ret['DeviceId']),
+ ('status', '=', '待配送')], limit=1, order='id asc')
if workpiece_delivery:
for wd in workpiece_delivery:
- logging.info('wd.workorder_id:%s' % wd.workorder_id.name)
+ logging.info('wd.production_id:%s' % wd.production_id.name)
if wd.workorder_id.state == 'done' and wd.production_id.production_line_state == '已上产线':
- logging.info('wd.production_id:%s' % wd.production_id.name)
logging.info('wd.production_line_state:%s' % wd.production_id.production_line_state)
+ workpiece_delivery_off = request.env['sf.workpiece.delivery'].sudo().create({
+ 'production_id': wd.production_id.id,
+ 'feeder_station_start_id': workpiece_delivery.feeder_station_start_id.id,
+ 'feeder_station_destination_id': '',
+ 'workorder_id': workpiece_delivery.workorder_id.id,
+ 'workpiece_code': workpiece_delivery.workpiece_code,
+ 'production_line_id': workpiece_delivery.production_line_id.id,
+ 'task_delivery_time': datetime.now(),
+ 'production_line_state': '已下产线'
+ })
wd.production_id.write({'production_line_state': '已下产线'})
+ logging.info('开始向agv下发下产线任务')
+ workpiece_delivery_off._delivery_avg()
+ logging.info('agv下发下产线任务已配送')
+
else:
res = {'Succeed': False, 'ErrorCode': 203, 'Error': '该DeviceId没有对应的工件配送数据'}
else:
@@ -482,3 +498,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)
diff --git a/sf_manufacturing/controllers/workpiece.py b/sf_manufacturing/controllers/workpiece.py
index e2f60421..fcdcf606 100644
--- a/sf_manufacturing/controllers/workpiece.py
+++ b/sf_manufacturing/controllers/workpiece.py
@@ -25,7 +25,7 @@ class Workpiece(http.Controller):
if 'method' in ret:
if ret['method'] == 'end':
workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search(
- [('production_id.name', '=', ret['reqCode'])])
+ [('production_id.name', '=', ret['reqCode']), ('agv_task_code'), '=', ret['taskCode']])
if workpiece_delivery:
workpiece_delivery.write({'status': '已配送', 'task_completion_time': ret['reqTime']})
else:
diff --git a/sf_manufacturing/models/__init__.py b/sf_manufacturing/models/__init__.py
index 3ca83b27..3de23ef3 100644
--- a/sf_manufacturing/models/__init__.py
+++ b/sf_manufacturing/models/__init__.py
@@ -8,3 +8,4 @@ from . import mrp_routing_workcenter
from . import stock
from . import res_user
from . import production_line_base
+from . import agv_setting
diff --git a/sf_manufacturing/models/agv_setting.py b/sf_manufacturing/models/agv_setting.py
new file mode 100644
index 00000000..22c486d1
--- /dev/null
+++ b/sf_manufacturing/models/agv_setting.py
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+from odoo import fields, models
+
+
+class AgvSetting(models.Model):
+ _name = 'sf.agv.site'
+ _description = 'agv站点'
+
+ number = fields.Integer('序号')
+ name = fields.Char('位置编号')
+ owning_region = fields.Char('所属区域')
+ state = fields.Selection([
+ ('占用', '占用'),
+ ('空闲', '空闲')], string='状态')
+ divide_the_work = fields.Char('主要分工')
+
+
+class AgvTaskRoute(models.Model):
+ _name = 'sf.agv.task.route'
+ _description = 'agv任务路线'
+
+ name = fields.Char('名称')
+ type = fields.Selection([
+ ('F01', '搬运'), ], string='类型', default="F01")
+ start_site_id = fields.Many2one('sf.agv.site', '起点接驳站位置编号')
+ end_site_id = fields.Many2one('sf.agv.site', '终点接驳站位置编号')
+ destination_production_line_id = fields.Many2one('sf.production.line', '目的生产线')
+ priority = fields.Selection([
+ ('0', '正常'),
+ ('1', '低'),
+ ('2', '中'),
+ ('3', '高'),
+ ('4', '紧急'),
+ ], string='优先级', default='0')
+ active = fields.Boolean('有效', default=True)
diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py
index 3c6cc6da..fccc4301 100644
--- a/sf_manufacturing/models/mrp_production.py
+++ b/sf_manufacturing/models/mrp_production.py
@@ -74,6 +74,8 @@ class MrpProduction(models.Model):
# 上传零件图纸
part_drawing = fields.Binary('零件图纸')
+ manual_quotation = fields.Boolean('人工编程', default=False, readonly=True)
+
@api.depends(
'move_raw_ids.state', 'move_raw_ids.quantity_done', 'move_finished_ids.state',
'workorder_ids.state', 'product_qty', 'qty_producing', 'schedule_state')
@@ -152,6 +154,15 @@ class MrpProduction(models.Model):
# cnc程序获取
def fetchCNC(self):
cnc = self.env['mrp.production'].search([('id', '=', self.id)])
+ quick_order = self.env['quick.easy.order'].search(
+ [('name', '=', cnc.product_id.default_code.rsplit('-', 1)[0])])
+ programme_way = False
+ if cnc.manual_quotation is True:
+ programme_way = 'manual operation'
+ else:
+ programme_way = 'auto'
+ if quick_order:
+ programme_way = 'manual operation'
try:
res = {'model_code': '' if not cnc.product_id.model_code else cnc.product_id.model_code,
'production_no': cnc.name,
@@ -166,8 +177,9 @@ class MrpProduction(models.Model):
'embryo_height': cnc.product_id.bom_ids.bom_line_ids.product_id.height,
'embryo_width': cnc.product_id.bom_ids.bom_line_ids.product_id.width,
'order_no': cnc.origin,
- 'model_order_no': cnc.product_id.default_code.rsplit(' -', 1)[0],
+ 'model_order_no': cnc.product_id.default_code,
'user': cnc.env.user.name,
+ 'programme_way': programme_way,
'model_file': '' if not cnc.product_id.model_file else base64.b64encode(
cnc.product_id.model_file).decode('utf-8')
}
diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py
index 110de50d..63c66577 100644
--- a/sf_manufacturing/models/mrp_workorder.py
+++ b/sf_manufacturing/models/mrp_workorder.py
@@ -46,6 +46,8 @@ class ResMrpWorkOrder(models.Model):
], string="工序类型")
results = fields.Char('结果')
+ manual_quotation = fields.Boolean('人工编程', default=False, readonly=True)
+
@api.onchange('users_ids')
def get_user_permissions(self):
uid = self.env.uid
@@ -414,21 +416,24 @@ class ResMrpWorkOrder(models.Model):
def button_workpiece_delivery(self):
if self.routing_type == '装夹预调':
for item in self.workpiece_delivery_ids:
- if not item.feeder_station_start:
- raise UserError('【工件配送】明细中请输入起点接驳站')
+ if not item.route_id:
+ raise UserError('【工件配送】明细中请选择【任务路线】')
# if not item.workpiece_code:
# raise UserError('请对【同运工件】进行扫描')
else:
- if item.status == '待下发':
- return {
- 'name': _('确认'),
- 'type': 'ir.actions.act_window',
- 'view_mode': 'form',
- 'res_model': 'sf.workpiece.delivery.wizard',
- 'target': 'new',
- 'context': {
- 'default_workorder_id': self.id,
- }}
+ if self.cnc_program_down_state == '已下发':
+ if item.status == '待下发':
+ return {
+ 'name': _('确认'),
+ 'type': 'ir.actions.act_window',
+ 'view_mode': 'form',
+ 'res_model': 'sf.workpiece.delivery.wizard',
+ 'target': 'new',
+ 'context': {
+ 'default_workorder_id': self.id,
+ }}
+ else:
+ raise UserError(_("该制造订单还未下发CNC程序单,无法进行工件配送"))
# 拼接工单对象属性值
def json_workorder_str(self, k, production, route):
@@ -666,47 +671,6 @@ class ResMrpWorkOrder(models.Model):
else:
self.results = '合格'
- # cnc程序获取
- def fetchCNC(self):
- try:
- cnc = self.env['mrp.workorder'].search(
- [('routing_type', '=', 'CNC加工'), ('production_id', '=', self.production_id.id)], limit=1)
- res = {'model_code': '' if not cnc.product_id.model_code else cnc.product_id.model_code,
- 'production_no': self.production_id.name,
- 'machine_tool_code': cnc.workcenter_id.equipment_id.code,
- 'material_code': cnc.env['sf.production.materials'].search(
- [('id', '=', cnc.product_id.materials_id.id)]).materials_no,
- 'material_type_code': cnc.env['sf.materials.model'].search(
- [('id', '=', cnc.product_id.materials_type_id.id)]).materials_no,
- 'machining_processing_panel': cnc.product_id.model_processing_panel,
- 'machining_precision': cnc.product_id.model_machining_precision,
- 'embryo_long': cnc.product_id.bom_ids.bom_line_ids.product_id.length,
- 'embryo_height': cnc.product_id.bom_ids.bom_line_ids.product_id.height,
- 'embryo_width': cnc.product_id.bom_ids.bom_line_ids.product_id.width,
- 'order_no': cnc.production_id.origin,
- 'model_order_no': cnc.product_id.default_code.rsplit(' -', 1)[0],
- 'user': self.env.user.name,
- 'model_file': '' if not cnc.product_id.model_file else base64.b64encode(
- cnc.product_id.model_file).decode('utf-8')
- }
- logging.info('res:%s' % res)
- configsettings = self.env['res.config.settings'].get_values()
- config_header = Common.get_headers(self, configsettings['token'], configsettings['sf_secret_key'])
- url = '/api/intelligent_programming/create'
- config_url = configsettings['sf_url'] + url
- # res_str = json.dumps(res)
- ret = requests.post(config_url, json={}, data=res, headers=config_header)
- ret = ret.json()
- logging.info('fetchCNC-ret:%s' % ret)
- if ret['status'] == 1:
- self.write(
- {'programming_no': ret['programming_no'], 'programming_state': '编程中', 'work_state': '编程中'})
- else:
- raise UserError(ret['message'])
- except Exception as e:
- logging.info('fetchCNC error:%s' % e)
- raise UserError("cnc程序获取编程单失败,请联系管理员")
-
def json_workorder_str1(self, k, production, route):
workorders_values_str = [0, '', {
'product_uom_id': production.product_uom_id.id,
@@ -839,7 +803,7 @@ class ResMrpWorkOrder(models.Model):
production_no_ftp = reportpath.split('/')
production_no = workorder.production_id.name.replace('/', '_')
# ftp地址
- remotepath = os.path.join('/', production_no_ftp[1], 'detection')
+ remotepath = os.path.join('/NC', production_no_ftp[1], 'detection')
logging.info('ftp地址:%s' % remotepath)
if reportpath.find(production_no) != -1:
# 服务器内临时地址
@@ -918,7 +882,7 @@ class CNCprocessing(models.Model):
'cutting_tool_handle_type': obj['cutting_tool_handle_type'],
'estimated_processing_time': obj['estimated_processing_time'],
'remark': obj['remark'],
- 'program_path': program_path.replace('/tmp', '')
+ 'program_path': program_path.replace('/tmp', '/home/ftp/ftp_root/NC')
})
cnc_processing.get_cnc_processing_file(program_path_tmp, cnc_processing, program_path)
# cnc_workorder.state = 'done'
@@ -957,7 +921,7 @@ class CNCprocessing(models.Model):
# 将FTP的nc文件下载到临时目录
def download_file_tmp(self, production_no, processing_panel):
- remotepath = os.path.join('/', production_no, 'return', processing_panel)
+ remotepath = os.path.join('/NC', production_no, 'return', processing_panel)
serverdir = os.path.join('/tmp', production_no, 'return', processing_panel)
ftp_resconfig = self.env['res.config.settings'].get_values()
ftp = FtpController(str(ftp_resconfig['ftp_host']), int(ftp_resconfig['ftp_port']), ftp_resconfig['ftp_user'],
@@ -1010,9 +974,9 @@ class SfWorkOrderBarcodes(models.Model):
workorder = self.env['mrp.workorder'].browse(self.ids)
# workorder = self.env['mrp.workorder'].search(
# [('routing_type', '=', '装夹预调'), ('production_id', '=', self.production_id.id)])
- # workorder_old = self.env['mrp.workorder'].search([('rfid_code', '=', barcode)])
- # if workorder_old:
- # raise UserError('该托盘已绑定工件,请先解除绑定!!!')
+ workorder_old = self.env['mrp.workorder'].search([('rfid_code', '=', barcode)])
+ if workorder_old:
+ raise UserError('该托盘已绑定工件,请先解除绑定!!!')
if workorder:
if workorder.routing_type == '装夹预调':
if workorder.state in ['done']:
@@ -1073,7 +1037,7 @@ class SfWorkOrderBarcodes(models.Model):
for item in workorder_rfid:
if item.state == "progress":
item.write({'rfid_code': barcode})
- # raise UserError('该托盘信息不存在!!!')
+ raise UserError('该托盘信息不存在!!!')
# stock_move_line = self.env['stock.move.line'].search([('lot_name', '=', barcode)])
# if stock_move_line.product_id.categ_type == '夹具':
# workorder.write({
@@ -1136,48 +1100,71 @@ class WorkPieceDelivery(models.Model):
store=True)
plan_start_processing_time = fields.Datetime('计划开始加工时间', readonly=True)
workpiece_code = fields.Char('同运工件编码')
- feeder_station_start = fields.Char('起点接驳站')
- feeder_station_destination = fields.Char('目的接驳站')
+ route_id = fields.Many2one('sf.agv.task.route', '任务路线')
+ feeder_station_start_id = fields.Many2one('sf.agv.site', '起点接驳站')
+ feeder_station_destination_id = fields.Many2one('sf.agv.site', '目的接驳站')
task_delivery_time = fields.Datetime('任务下发时间')
task_completion_time = fields.Datetime('任务完成时间')
delivery_duration = fields.Float('配送时长', compute='_compute_delivery_duration')
status = fields.Selection(
[('待下发', '待下发'), ('待配送', '待配送'), ('已配送', '已配送')], string='状态',
default='待下发')
+ production_line_state = fields.Selection(
+ [('待上产线', '待上产线'), ('已上产线', '已上产线'), ('已下产线', '已下产线')],
+ string='上/下产线', default='待上产线')
+ cnc_program_down_state = fields.Selection([('待下发', '待下发'), ('已下发', '已下发')],
+ string='CNC程序下发状态', default='待下发')
+ agv_task_code = fields.Char('agv任务单号')
+
+ @api.onchange('route_id')
+ def onchage_route(self):
+ if self.route_id:
+ self.feeder_station_start_id = self.route_id.start_site_id
+ self.feeder_station_destination_id = self.route_id.end_site_id
# 工件配送
def button_delivery(self):
- if self.status == '待下发':
- return {
- 'name': _('确认'),
- 'type': 'ir.actions.act_window',
- 'view_mode': 'form',
- 'res_model': 'sf.workpiece.delivery.wizard',
- 'target': 'new',
- 'context': {
- 'default_delivery_id': self.id,
- }}
+ if self.cnc_program_down_state == '待下发':
+ if self.route_id:
+ if self.status == '待下发':
+ return {
+ 'name': _('确认'),
+ 'type': 'ir.actions.act_window',
+ 'view_mode': 'form',
+ 'res_model': 'sf.workpiece.delivery.wizard',
+ 'target': 'new',
+ 'context': {
+ 'default_delivery_id': self.id,
+ }}
+ else:
+ raise UserError('状态为【待下发】的工件记录可进行配送')
+ else:
+ raise UserError('请选择任务路线再进行配送')
else:
- raise UserError('状态为【待下发】的工件记录可进行配送')
+ raise UserError(_("该制造订单还未下发CNC程序单,无法进行工件配送"))
# 配送至avg小车
def _delivery_avg(self):
config = self.env['res.config.settings'].get_values()
- agv_site = self.env['res.agv.site'].search([])
positionCode_Arr = []
- if agv_site:
- for item in agv_site:
- positionCode_Arr.append({
- 'positionCode': item.content,
- 'code': item.type
- })
+ if self.feeder_station_start_id:
+ positionCode_Arr.append({
+ 'positionCode': self.feeder_station_start_id.name,
+ 'code': '00'
+ })
+ if self.feeder_station_destination_id:
+ positionCode_Arr.append({
+ 'positionCode': self.feeder_station_destination_id.name,
+ 'code': '00'
+ })
res = {'reqCode': self.production_id.name, 'reqTime': '', 'clientCode': '', 'tokenCode': '',
- 'taskTyp': config['task_type_no'], 'ctnrTyp': '', 'ctnrCode': '', 'wbCode': config['wbcode'],
+ 'taskTyp': 'F01', 'ctnrTyp': '', 'ctnrCode': '', 'wbCode': config['wbcode'],
'positionCodePath': positionCode_Arr,
'podCode': '',
'podDir': '', 'materialLot': '', 'priority': '', 'taskCode': '', 'agvCode': '', 'materialLot': '',
'data': ''}
try:
+ config['agv_rcs_url'] = 'http://172.16.10.114:8182/rcms/services/rest/hikRpcService/genAgvSchedulingTask'
logging.info('AGV请求路径:%s' % config['agv_rcs_url'])
logging.info('AGV-json:%s' % res)
headers = {'Content-Type': 'application/json'}
@@ -1186,14 +1173,15 @@ class WorkPieceDelivery(models.Model):
logging.info('config-ret:%s' % ret)
if ret['code'] == 0:
if self.production_id.name == ret['reqCode']:
- self.write({'task_delivery_time': fields.Datetime.now(), 'status': '待配送'})
+ self.write(
+ {'task_delivery_time': fields.Datetime.now(), 'status': '待配送', 'agv_task_code': ret['data']})
else:
raise UserError(ret['message'])
except Exception as e:
logging.info('config-e:%s' % e)
raise UserError("工件配送请求agv失败")
- @api.depends('production_id.production_line_id')
+ @api.onchange('production_id.production_line_id')
def _compute_production_line_id(self):
if self.production_id.production_line_id:
self.production_line_id = self.production_id.production_line_id.id
diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py
index f3cba150..d766629c 100644
--- a/sf_manufacturing/models/product_template.py
+++ b/sf_manufacturing/models/product_template.py
@@ -1,14 +1,14 @@
# -*- coding: utf-8 -*-
import logging
+import requests
import base64
import hashlib
import os
from odoo import models, fields, api, _
from odoo.exceptions import ValidationError
from odoo.modules import get_resource_path
-from OCC.Extend.DataExchange import read_step_file
-from OCC.Extend.DataExchange import write_stl_file
-
+# from OCC.Extend.DataExchange import read_step_file
+# from OCC.Extend.DataExchange import write_stl_file
class ResProductMo(models.Model):
@@ -522,6 +522,9 @@ class ResProductMo(models.Model):
string='注册状态', default='未注册')
industry_code = fields.Char('行业编码', readonly=True)
+ # bfm下单
+ manual_quotation = fields.Boolean('人工编程', default=False, readonly=True)
+
@api.constrains('tool_length')
def _check_tool_length_size(self):
if self.tool_length > 1000000:
@@ -616,6 +619,7 @@ class ResProductMo(models.Model):
'process_parameters_code') else self.get_process_parameters_id(item['process_parameters_code']),
'model_remark': item['remark'],
'default_code': '%s-%s' % (order_number, i),
+ 'manual_quotation': item['manual_quotation'] or False,
'active': True,
}
copy_product_id.sudo().write(vals)
@@ -889,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'
diff --git a/sf_manufacturing/security/img.png b/sf_manufacturing/security/img.png
new file mode 100644
index 00000000..130affd5
Binary files /dev/null and b/sf_manufacturing/security/img.png differ
diff --git a/sf_manufacturing/security/ir.model.access.csv b/sf_manufacturing/security/ir.model.access.csv
index 8272af30..e8c2449c 100644
--- a/sf_manufacturing/security/ir.model.access.csv
+++ b/sf_manufacturing/security/ir.model.access.csv
@@ -129,4 +129,7 @@ access_sf_cmm_program_group_plan_dispatch,sf_cmm_program_group_plan_dispatch,mod
access_mrp_workcenter_productivity,mrp.workcenter.productivity,mrp.model_mrp_workcenter_productivity,sf_base.group_plan_dispatch,1,0,0,0
access_maintenance_equipment_tool_group_plan_dispatch,maintenance.equipment.tool,sf_manufacturing.model_maintenance_equipment_tool,sf_base.group_plan_dispatch,1,0,0,0
-access_sf_workpiece_delivery_group_plan_dispatch,sf.workpiece.delivery,sf_manufacturing.model_sf_workpiece_delivery,sf_base.group_plan_dispatch,1,0,0,0
\ No newline at end of file
+access_sf_workpiece_delivery_group_plan_dispatch,sf.workpiece.delivery,sf_manufacturing.model_sf_workpiece_delivery,sf_base.group_plan_dispatch,1,0,0,0
+
+access_sf_agv_site_group_sf_order_user,sf_agv_site_group_sf_order_user,model_sf_agv_site,sf_base.group_sf_order_user,1,1,1,0
+access_sf_agv_task_route_group_sf_order_user,sf_agv_task_route_group_sf_order_user,model_sf_agv_task_route,sf_base.group_sf_order_user,1,1,1,0
\ No newline at end of file
diff --git a/sf_manufacturing/views/agv_setting_views.xml b/sf_manufacturing/views/agv_setting_views.xml
new file mode 100644
index 00000000..dea85e6a
--- /dev/null
+++ b/sf_manufacturing/views/agv_setting_views.xml
@@ -0,0 +1,59 @@
+
+
+
+
+
+ agv站点
+ sf.agv.site
+
+
+
+
+
+
+
+
+
+
+
+
+ AGV站点
+ sf.agv.site
+ tree
+
+
+
+
+
+
+ AGV任务路线
+ sf.agv.task.route
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AGV任务路线
+ sf.agv.task.route
+ tree
+
+
+
+
+
\ No newline at end of file
diff --git a/sf_manufacturing/views/mrp_workorder_view.xml b/sf_manufacturing/views/mrp_workorder_view.xml
index 78db99af..6212f5f9 100644
--- a/sf_manufacturing/views/mrp_workorder_view.xml
+++ b/sf_manufacturing/views/mrp_workorder_view.xml
@@ -211,12 +211,12 @@
-
-
-
-
-
+
+
+
+
+
+
@@ -430,8 +430,10 @@
-
-
+
+
+
+
@@ -573,7 +575,7 @@
工件配送
sf.workpiece.delivery
-
+
@@ -583,11 +585,13 @@
decoration-danger="status == '待配送'"/>
-
-
-
-
-
+
+
+
+
+
+
+
@@ -600,16 +604,19 @@
-
+
-
+
+
+
+
diff --git a/sf_manufacturing/views/sf_maintenance_equipment.xml b/sf_manufacturing/views/sf_maintenance_equipment.xml
index b398f994..5ddf59b0 100644
--- a/sf_manufacturing/views/sf_maintenance_equipment.xml
+++ b/sf_manufacturing/views/sf_maintenance_equipment.xml
@@ -1,23 +1,38 @@
- 设备增加刀具库位table
+
sf_manufacturing_equipment.form
maintenance.equipment
-
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sf_manufacturing/wizard/workpiece_delivery_views.xml b/sf_manufacturing/wizard/workpiece_delivery_views.xml
index 49e80d52..34625878 100644
--- a/sf_manufacturing/wizard/workpiece_delivery_views.xml
+++ b/sf_manufacturing/wizard/workpiece_delivery_views.xml
@@ -5,14 +5,18 @@
sf.workpiece.delivery.wizard
diff --git a/sf_manufacturing/wizard/workpiece_delivery_wizard.py b/sf_manufacturing/wizard/workpiece_delivery_wizard.py
index 7101410d..1de3e84c 100644
--- a/sf_manufacturing/wizard/workpiece_delivery_wizard.py
+++ b/sf_manufacturing/wizard/workpiece_delivery_wizard.py
@@ -11,10 +11,11 @@ class WorkpieceDeliveryWizard(models.TransientModel):
delivery_id = fields.Many2one('sf.workpiece.delivery', string='配送')
workorder_id = fields.Many2one('mrp.workorder', string='工单')
+ route_id = fields.Many2one('sf.agv.task.route', '任务路线')
+ is_ok = fields.Boolean('确认上述信息正确无误.')
def confirm(self):
if self.workorder_id:
self.workorder_id.workpiece_delivery_ids._delivery_avg()
else:
self.delivery_id._delivery_avg()
-
diff --git a/sf_mrs_connect/models/ftp_operate.py b/sf_mrs_connect/models/ftp_operate.py
index 724f56b4..98e6d504 100644
--- a/sf_mrs_connect/models/ftp_operate.py
+++ b/sf_mrs_connect/models/ftp_operate.py
@@ -37,8 +37,16 @@ class FtpController():
os.makedirs(serverdir)
try:
logging.info("进入FTP目录 ")
- self.ftp.cwd(target_dir) # 切换工作路径
- logging.info('FTP目录:%s' % target_dir)
+ logging.info('目录:%s' % target_dir)
+ target_dir1 = target_dir.split('/')
+ logging.info('目录1:%s' % target_dir1[1])
+ self.ftp.cwd(target_dir1[1]) # 切换工作路径
+ logging.info('目录2:%s' % target_dir1[2])
+ self.ftp.cwd(target_dir1[2]) # 切换工作路径
+ logging.info('目录3:%s' % target_dir1[3])
+ self.ftp.cwd(target_dir1[3]) # 切换工作路径
+ logging.info('目录4:%s' % target_dir1[4])
+ self.ftp.cwd(target_dir1[4]) # 切换工作路径
remotenames = self.ftp.nlst()
logging.info('FTP目录文件:%s' % remotenames)
for file in remotenames:
@@ -48,6 +56,9 @@ class FtpController():
return 1
except Exception:
return 0
+ finally:
+ self.ftp.quit()
+ logging.info("ftp已关闭")
# 下载目录下的检测文件
def download_reportfile_tree(self, target_dir, serverdir, reportpath):
@@ -61,6 +72,8 @@ class FtpController():
self.ftp.cwd(target_dir1[1]) # 切换工作路径
logging.info('目录2:%s' % target_dir1[2])
self.ftp.cwd(target_dir1[2]) # 切换工作路径
+ logging.info('目录2:%s' % target_dir1[3])
+ self.ftp.cwd(target_dir1[3]) # 切换工作路径
remotenames = self.ftp.nlst()
logging.info('FTP目录检测报告文件:%s' % remotenames)
for filename in remotenames:
diff --git a/sf_mrs_connect/models/res_config_setting.py b/sf_mrs_connect/models/res_config_setting.py
index 7aa46639..ef2d93d8 100644
--- a/sf_mrs_connect/models/res_config_setting.py
+++ b/sf_mrs_connect/models/res_config_setting.py
@@ -15,6 +15,8 @@ class ResConfigSettings(models.TransientModel):
sf_url = fields.Char(string='访问地址', default='https://sf.cs.jikimo.com')
agv_rcs_url = fields.Char(string='avg_rcs访问地址',
default='http://172.16.10.114:8182/rcms/services/rest/hikRpcService/genAgvSchedulingTask')
+ center_control_url = fields.Char(string='中控访问地址',
+ default='http://172.16.21.50:8001')
wbcode = fields.Char('地码')
agv_code = fields.Char(string='agv编号')
task_type_no = fields.Char('任务单类型编号')
@@ -99,7 +101,7 @@ class ResConfigSettings(models.TransientModel):
agv_rcs_url = config.get_param('agv_rcs_url', default='')
wbcode = config.get_param('wbcode', default='')
agv_code = config.get_param('agv_code', default='')
- task_type_no = config.get_param('task_type_no', default='')
+ center_control_url = config.get_param('center_control_url', default='')
ftp_host = config.get_param('ftp_host', default='')
ftp_port = config.get_param('ftp_port', default='')
ftp_user = config.get_param('ftp_user', default='')
@@ -112,7 +114,7 @@ class ResConfigSettings(models.TransientModel):
agv_rcs_url=agv_rcs_url,
wbcode=wbcode,
agv_code=agv_code,
- task_type_no=task_type_no,
+ center_control_url=center_control_url,
ftp_host=ftp_host,
ftp_port=ftp_port,
ftp_user=ftp_user,
@@ -129,16 +131,8 @@ class ResConfigSettings(models.TransientModel):
ir_config.set_param("agv_rcs_url", self.agv_rcs_url or "")
ir_config.set_param("wbcode", self.wbcode or "")
ir_config.set_param("agv_code", self.agv_code or "")
- ir_config.set_param("task_type_no", self.task_type_no or "")
+ ir_config.set_param("center_control_url", self.center_control_url or "")
ir_config.set_param("ftp_host", self.ftp_host or "")
ir_config.set_param("ftp_port", self.ftp_port or "")
ir_config.set_param("ftp_user", self.ftp_user or "")
ir_config.set_param("ftp_password", self.ftp_password or "")
-
-
-class ResAgvSite(models.Model):
- _name = 'res.agv.site'
- _description = 'agv站点'
-
- type = fields.Selection([('00', '位置编号'), ('01', '库区编号'), ('02', '货架编号')], '类型')
- content = fields.Char('内容')
diff --git a/sf_mrs_connect/models/sync_common.py b/sf_mrs_connect/models/sync_common.py
index dd8eee8b..2795047a 100644
--- a/sf_mrs_connect/models/sync_common.py
+++ b/sf_mrs_connect/models/sync_common.py
@@ -2375,6 +2375,7 @@ class CuttingToolBasicParameters(models.Model):
r = requests.post(strUrl, json={}, data=None, headers=headers)
r = r.json()
result = json.loads(r['result'])
+ logging.info(result)
if result['status'] == 1:
if 'basic_parameters_integral_tool' in result['cutting_tool_basic_parameters_all_list']:
if result['cutting_tool_basic_parameters_all_list']['basic_parameters_integral_tool']:
diff --git a/sf_mrs_connect/security/ir.model.access.csv b/sf_mrs_connect/security/ir.model.access.csv
index f512ec84..0ed43a62 100644
--- a/sf_mrs_connect/security/ir.model.access.csv
+++ b/sf_mrs_connect/security/ir.model.access.csv
@@ -1,6 +1,5 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_sf_static_resource_datasync,sf_static_resource_datasync,model_sf_static_resource_datasync,base.group_user,1,1,1,1
-access_res_agv_site,access_res_agv_site,model_res_agv_site,base.group_system,1,1,1,1
diff --git a/sf_mrs_connect/views/res_config_settings_views.xml b/sf_mrs_connect/views/res_config_settings_views.xml
index e297f0eb..0d1ccc3e 100644
--- a/sf_mrs_connect/views/res_config_settings_views.xml
+++ b/sf_mrs_connect/views/res_config_settings_views.xml
@@ -1,26 +1,6 @@
-
- agv站点集合
- res.agv.site
-
-
-
-
-
-
-
-
-
- 站点集合
- res.agv.site
- tree
-
-
-
-
res.config.settings.view.form.inherit.sf_sync
res.config.settings
@@ -104,10 +84,6 @@
-
-
-
-
@@ -116,9 +92,19 @@
-
-
+
+
+
+
+
+ 中控参数配置
+
+
diff --git a/sf_sale/models/quick_easy_order_old.py b/sf_sale/models/quick_easy_order_old.py
index b740871f..24bf5738 100644
--- a/sf_sale/models/quick_easy_order_old.py
+++ b/sf_sale/models/quick_easy_order_old.py
@@ -1,12 +1,14 @@
import logging
import base64
import hashlib
+import requests
import os
from datetime import datetime
from stl import mesh
# from OCC.Core.GProp import GProp_GProps
-from OCC.Extend.DataExchange import read_step_file
-from OCC.Extend.DataExchange import write_stl_file
+# from OCC.Extend.DataExchange import read_step_file
+# from OCC.Extend.DataExchange import write_stl_file
+from odoo.addons.sf_base.commons.common import Common
from odoo import models, fields, api
from odoo.modules import get_resource_path
from odoo.exceptions import ValidationError, UserError
@@ -79,6 +81,8 @@ class QuickEasyOrder(models.Model):
report_path = attachment._full_path(attachment.store_fname)
vals['model_file'] = self.transition_glb_file(report_path, model_code)
obj = super(QuickEasyOrder, self).create(vals)
+ logging.info('---------向cloud生成模型库记录-------')
+ self.model_coloring(obj)
logging.info('---------开始派单到工厂-------')
self.distribute_to_factory(obj)
obj.state = '待接单'
@@ -124,18 +128,18 @@ class QuickEasyOrder(models.Model):
# # print(volume)
# item.model_volume = volume
# # 长宽高/体积
- # output_file = os.path.join('C:/Users/43484/Desktop/机企猫工作文档', str(library_of_models.code) + '.stl')
+ # output_file = os.path.join('C:/Users/43484/Desktop/机企猫工作文档', str(model_code) + '.stl')
output_file = os.path.join('/tmp', str(model_code) + '.stl')
- your_mesh = mesh.Mesh.from_file(output_file)
- volume, cog, inertia = your_mesh.get_mass_properties()
- xyz = (your_mesh.max_ - your_mesh.min_)
- item.model_length = xyz[0] # 长 单位mm
- item.model_width = xyz[1] # 宽
- item.model_height = xyz[2] # 高
- item.model_volume = volume
+ # your_mesh = mesh.Mesh.from_file(output_file)
+ # volume, cog, inertia = your_mesh.get_mass_properties()
+ # xyz = (your_mesh.max_ - your_mesh.min_)
+ # item.model_length = xyz[0] # 长 单位mm
+ # item.model_width = xyz[1] # 宽
+ # item.model_height = xyz[2] # 高
+ # item.model_volume = volume
write_stl_file(shapes, output_file, 'binary', 0.03, 0.5)
# 转化为glb
- # output_glb_file = os.path.join('C:/Users/43484/Desktop/机企猫工作文档', str(library_of_models.code) + '.glb')
+ # output_glb_file = os.path.join('C:/Users/43484/Desktop/机企猫工作文档', str(model_code) + '.glb')
output_glb_file = os.path.join('/tmp', str(model_code) + '.glb')
util_path = get_resource_path('sf_base', 'static/util')
cmd = 'python3 %s/stl2gltf.py %s %s -b' % (util_path, output_file, output_glb_file)
@@ -185,6 +189,7 @@ class QuickEasyOrder(models.Model):
'number': item.quantity,
'total_amount': item.price,
'remark': '',
+ 'manual_quotation': True,
'barcode': barcode
})
# res['bfm_process_order_list'] = json.dumps(res['bfm_process_order_list'])
@@ -262,3 +267,45 @@ class QuickEasyOrder(models.Model):
except Exception as e:
# self.cr.rollback()
return UserError('工厂创建销售订单和产品失败,请联系管理员')
+
+ # 模型上色
+
+ def model_coloring(self, order):
+ url = '/api/library_of_models/create'
+ config = self.env['res.config.settings'].get_values()
+ config_header = Common.get_headers(self, config['token'], config['sf_secret_key'])
+ logging.info('order: %s' % order.name)
+ if order:
+ attachment = order.upload_model_file[0]
+ base64_data = base64.b64encode(attachment.datas)
+ base64_datas = base64_data.decode('utf-8')
+ model_code = hashlib.sha1(base64_datas.encode('utf-8')).hexdigest()
+ logging.info('model_file-size: %s' % len(order.model_file))
+ logging.info('attachment.datas-size: %s' % len(attachment.datas))
+ vals = {
+ 'programme_way': 'manual operation',
+ 'model_code': model_code,
+ 'model_data': base64.b64decode(attachment.datas),
+ 'model_color_data': '',
+ 'model_name': attachment.name,
+ 'model_long': order.model_length,
+ 'model_width': order.model_width,
+ 'model_height': order.model_height,
+ 'model_volume': order.model_volume,
+ 'model_color_path': '/tmp/' + str(model_code) + ".step",
+ 'model_order_no': '%s-%s' % (order.name, 1),
+ 'remark': '订单号:%s 客户:%s' % (order.name, order.customer_id.name)
+ }
+ try:
+ ret = requests.post((config['sf_url'] + url), json={}, data=vals, headers=config_header,
+ timeout=60)
+ ret = ret.json()
+ # result = json.loads(ret['result'])
+ if ret['status'] == 1:
+ self.model_color_state = 'success'
+ else:
+ self.model_color_state = 'fail'
+ raise UserError(ret['message'])
+ except Exception as e:
+ self.model_color_state = 'fail'
+ raise UserError("模型上色失败")
diff --git a/sf_sale/models/sale_order.py b/sf_sale/models/sale_order.py
index 05523194..379ff199 100644
--- a/sf_sale/models/sale_order.py
+++ b/sf_sale/models/sale_order.py
@@ -142,6 +142,12 @@ class ResaleOrderLine(models.Model):
check_status = fields.Selection(related='order_id.check_status')
+class ProductTemplate(models.Model):
+ _inherit = 'product.template'
+
+ manual_quotation = fields.Boolean('人工编程', default=False)
+
+
class RePurchaseOrder(models.Model):
_inherit = 'purchase.order'
diff --git a/sf_sale/security/ir.model.access.csv b/sf_sale/security/ir.model.access.csv
index 290829df..451396e3 100644
--- a/sf_sale/security/ir.model.access.csv
+++ b/sf_sale/security/ir.model.access.csv
@@ -1,7 +1,7 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_quick_easy_order,quick_easy_order,model_quick_easy_order,base.group_system,1,1,1,0
-access_quick_easy_order_group_sale_salemanager,quick_easy_order_group_sale_salemanager,model_quick_easy_order,sf_base.group_sale_salemanager,1,0,1,0
-access_quick_easy_order_group_sale_director,quick_easy_order_group_sale_director,model_quick_easy_order,sf_base.group_sale_director,1,0,1,0
+access_quick_easy_order_group_sale_salemanager,quick_easy_order_group_sale_salemanager,model_quick_easy_order,sf_base.group_sale_salemanager,1,1,1,0
+access_quick_easy_order_group_sale_director,quick_easy_order_group_sale_director,model_quick_easy_order,sf_base.group_sale_director,1,1,1,0
access_sf_auto_quatotion_common,sf_auto_quatotion_common,model_sf_auto_quatotion_common,base.group_system,1,1,1,1
access_sale_order_manager,sale_order_manager,model_sale_order,sf_base.group_sale_salemanager,1,1,1,0
access_sale_order_director,sale_order_director,model_sale_order,sf_base.group_sale_director,1,1,1,0
diff --git a/sf_sale/views/quick_easy_order_view.xml b/sf_sale/views/quick_easy_order_view.xml
index abc574b0..3038b987 100644
--- a/sf_sale/views/quick_easy_order_view.xml
+++ b/sf_sale/views/quick_easy_order_view.xml
@@ -48,7 +48,7 @@
+ options="{'no_create': True}" required="1"/>
@@ -68,12 +68,12 @@
-
-
+
+
-
+ options="{'no_create': True}" required="1"/>
+
diff --git a/sf_tool_management/models/base.py b/sf_tool_management/models/base.py
index 56391077..83b4b550 100644
--- a/sf_tool_management/models/base.py
+++ b/sf_tool_management/models/base.py
@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
+import logging
+
from datetime import timedelta
from odoo import SUPERUSER_ID
from odoo import fields, models, api
@@ -191,7 +193,7 @@ class CAMWorkOrderProgramKnifePlan(models.Model):
machine_table_name_id = fields.Many2one('maintenance.equipment', string='机床名称',
domain="[('production_line_id', '=', production_line_id)]")
machine_table_name = fields.Char(string='机台号', readonly=True, related='machine_table_name_id.name')
- cutter_spacing_code_id = fields.Many2one('maintenance.equipment.tool', string='刀位号', required=True,
+ cutter_spacing_code_id = fields.Many2one('maintenance.equipment.tool', string='刀位号',
domain="[('equipment_id', '=', machine_table_name_id)]")
whether_standard_knife = fields.Boolean(string='是否标准刀', default=True)
need_knife_time = fields.Datetime(string='用刀时间', readonly=False)
@@ -201,19 +203,20 @@ class CAMWorkOrderProgramKnifePlan(models.Model):
barcode_id = fields.Many2one('stock.lot', string='功能刀具序列号',
domain=[('product_id.name', '=', '功能刀具')])
- functional_tool_name = fields.Char(string='功能刀具名称', compute='_compute_functional_tool_name')
- functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型', readonly=False)
- tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组')
- diameter = fields.Integer(string='刀具直径(mm)', readonly=False)
- tool_included_angle = fields.Float(string='刀尖R角(mm)', readonly=False)
- tool_loading_length = fields.Float(string='总长度(mm)', readonly=False)
+ functional_tool_name = fields.Char(string='功能刀具名称', readonly=True)
+ functional_tool_type_id = fields.Many2one('sf.functional.cutting.tool.model', string='功能刀具类型',
+ compute='_compute_tool_number', store=True)
+ tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组', compute='_compute_tool_number', store=True)
+ diameter = fields.Integer(string='刀具直径(mm)', compute='_compute_tool_number', store=True)
+ tool_included_angle = fields.Float(string='刀尖R角(mm)', compute='_compute_tool_number', store=True)
+ tool_loading_length = fields.Float(string='总长度(mm)', compute='_compute_tool_number', store=True)
extension_length = fields.Float(string='伸出长(mm)')
effective_length = fields.Float(string='有效长(mm)')
new_former = fields.Selection([('0', '新'), ('1', '旧')], string='新/旧', readonly=False, default='0')
coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')], default='3',
string='粗/中/精', readonly=False)
L_D = fields.Float(string='L/D值', readonly=False)
- clearance_length = fields.Float(string='避空长(mm)', readonly=False)
+ clearance_length = fields.Float(string='避空长(mm)', compute='_compute_tool_number', store=True)
required_cutting_time = fields.Integer(string='需切削时长', readonly=False)
process_type = fields.Char('加工类型')
margin_x_y = fields.Float('余量_X/Y')
@@ -229,15 +232,24 @@ class CAMWorkOrderProgramKnifePlan(models.Model):
active = fields.Boolean(string='已归档', default=True)
- @api.depends('diameter', 'tool_included_angle', 'tool_groups_id')
- def _compute_functional_tool_name(self):
- for obj in self:
- if obj.tool_groups_id:
- obj.functional_tool_name = '%s-D%sR%s' % (
- obj.tool_groups_id.name, obj.diameter,
- obj.tool_included_angle)
+ @api.depends('functional_tool_name')
+ def _compute_tool_number(self):
+ for item in self:
+ inventory = self.env['sf.tool.inventory'].sudo().search([('name', '=', item.functional_tool_name)])
+ if inventory:
+ item.functional_tool_type_id = inventory.functional_cutting_tool_model_id.id
+ item.tool_groups_id = inventory.tool_groups_id.id
+ item.diameter = int(inventory.diameter)
+ item.tool_included_angle = inventory.angle
+ item.tool_loading_length = inventory.tool_length
+ item.clearance_length = inventory.blade_length
else:
- obj.functional_tool_name = None
+ item.functional_tool_type_id = False
+ item.tool_groups_id = False
+ item.diameter = 0
+ item.tool_included_angle = 0
+ item.tool_loading_length = 0
+ item.clearance_length = 0
@api.model
def _read_group_names(self, categories, domain, order):
@@ -311,10 +323,9 @@ class CAMWorkOrderProgramKnifePlan(models.Model):
根据传入的工单信息,查询是否有需要的功能刀具,如果没有则生成CAM工单程序用刀计划
"""
status = False
- if cnc_processing.functional_tool_type_id and cnc_processing.cutting_tool_name:
+ if cnc_processing.cutting_tool_name:
functional_tools = self.env['sf.real.time.distribution.of.functional.tools'].sudo().search(
- [('sf_cutting_tool_type_id', '=', cnc_processing.functional_tool_type_id.id),
- ('name', '=', cnc_processing.cutting_tool_name)])
+ [('name', '=', cnc_processing.cutting_tool_name)])
if functional_tools:
for functional_tool in functional_tools:
if functional_tool.on_tool_stock_num == 0:
@@ -327,7 +338,6 @@ class CAMWorkOrderProgramKnifePlan(models.Model):
'name': cnc_processing.workorder_id.production_id.name,
'cam_procedure_code': cnc_processing.program_name,
'filename': cnc_processing.cnc_id.name,
- 'functional_tool_type_id': cnc_processing.functional_tool_type_id.id,
'functional_tool_name': cnc_processing.cutting_tool_name,
'cam_cutter_spacing_code': cnc_processing.cutting_tool_no,
'process_type': cnc_processing.processing_type,
@@ -338,8 +348,11 @@ class CAMWorkOrderProgramKnifePlan(models.Model):
'shank_model': cnc_processing.cutting_tool_handle_type,
'estimated_processing_time': cnc_processing.estimated_processing_time,
})
+ logging.info('CAM工单程序用刀计划创建成功!!!')
# 创建装刀请求
knife_plan.apply_for_tooling()
+ else:
+ logging.info('功能刀具【%s】满足CNC用刀需求!!!')
class FunctionalToolAssembly(models.Model):
@@ -409,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('刀片货位')
@@ -428,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('刀杆货位')
@@ -447,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('刀盘货位')
@@ -466,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)
@@ -506,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('')
diff --git a/sf_tool_management/models/mrp_workorder.py b/sf_tool_management/models/mrp_workorder.py
index df9a341e..8098c5a1 100644
--- a/sf_tool_management/models/mrp_workorder.py
+++ b/sf_tool_management/models/mrp_workorder.py
@@ -36,6 +36,7 @@ class CNCprocessing(models.Model):
obj = super(CNCprocessing, self).create(vals)
# 调用CAM工单程序用刀计划创建方法
self.env['sf.cam.work.order.program.knife.plan'].create_cam_work_plan(obj)
+ logging.info('成功调用CAM工单程序用刀计划创建方法!!!')
return obj
diff --git a/sf_warehouse/__init__.py b/sf_warehouse/__init__.py
index c081ee06..c9ba0265 100644
--- a/sf_warehouse/__init__.py
+++ b/sf_warehouse/__init__.py
@@ -1,2 +1,3 @@
# -*-coding:utf-8-*-
from . import models
+from . import wizard
diff --git a/sf_warehouse/__manifest__.py b/sf_warehouse/__manifest__.py
index 04051b06..b409c7ce 100644
--- a/sf_warehouse/__manifest__.py
+++ b/sf_warehouse/__manifest__.py
@@ -15,6 +15,7 @@
'data/ir_cron_data.xml',
'security/sf_stock_security.xml',
'security/ir.model.access.csv',
+ 'wizard/wizard_view.xml',
'views/view.xml',
'views/shelf_location.xml',
'views/change_stock_move_views.xml',
diff --git a/sf_warehouse/models/model.py b/sf_warehouse/models/model.py
index b4bec292..50469284 100644
--- a/sf_warehouse/models/model.py
+++ b/sf_warehouse/models/model.py
@@ -191,6 +191,7 @@ class SfLocation(models.Model):
# return res
# 生成货位
+
def create_location(self):
"""
当仓库类型为货架时,自动生成其下面的货位,数量为货架层数*层数容量
@@ -429,7 +430,6 @@ class ShelfLocation(models.Model):
}
return action
-
# # 仓库类别(selection:库区、库位、货位)
# location_type = fields.Selection([
# ('货架', '货架'),
@@ -516,6 +516,19 @@ class ShelfLocation(models.Model):
else:
raise UserError("该库位无产品")
+ @api.model_create_multi
+ def create(self, vals_list):
+ # 编码重复校验
+ barcode_list = []
+ for val in vals_list:
+ location = self.search([('barcode', '=', val['barcode'])])
+ if location:
+ barcode_list.append(val['name'])
+ if barcode_list:
+ raise UserError("货位编码【%s】存在重复" % barcode_list)
+ records = super(ShelfLocation, self).create(vals_list)
+ return records
+
class Sf_stock_move_line(models.Model):
_name = 'stock.move.line'
@@ -531,7 +544,7 @@ class Sf_stock_move_line(models.Model):
current_product_id = fields.Integer(compute='_compute_location_dest_id_value', store=True)
there_is_no_sn = fields.Boolean('是否有序列号', default=False)
- rfid = fields.Char('Rfid', readonly=True)
+ rfid = fields.Char('Rfid')
rfid_barcode = fields.Char('Rfid', compute='_compute_rfid')
@api.depends('lot_id')
@@ -812,35 +825,39 @@ class Sf_stock_move_line(models.Model):
destination_location_id = fields.Many2one(
'sf.shelf.location', string='目标货位')
- @api.onchange('destination_location_id')
- def _compute_destination_location_id(self):
+ def compute_destination_location_id(self):
for record in self:
+ obj = self.env['sf.shelf.location'].search([('name', '=',
+ self.destination_location_id.name)])
if record.lot_id:
shelf_location_obj = self.env['sf.shelf.location'].search(
[('product_sn_id', '=', record.lot_id.id)])
if shelf_location_obj:
shelf_location_obj.product_sn_id = False
- # obj = self.env['sf.shelf.location'].search([('location_id', '=',
- # self.destination_location_id.id)])
- obj = self.env['sf.shelf.location'].search([('name', '=',
- self.destination_location_id.name)])
if obj:
obj.product_sn_id = record.lot_id.id
- else:
- pass
else:
- obj = self.env['sf.shelf.location'].search([('name', '=',
- self.destination_location_id.name)])
if obj:
obj.product_sn_id = record.lot_id.id
else:
- obj = self.env['sf.shelf.location'].search([('name', '=',
- self.destination_location_id.name)])
if obj:
obj.product_id = record.product_id.id
# obj.location_status = '占用'
obj.product_num += record.reserved_uom_qty
+ @api.onchange('destination_location_id')
+ def _check_destination_location_id(self):
+ for item in self:
+ if item:
+ i = 0
+ barcode = item.destination_location_id.barcode
+ for line in item.picking_id.move_line_ids_without_package:
+ if barcode and barcode == line.destination_location_id.barcode:
+ i += 1
+ if i > 1:
+ raise ValidationError(
+ '【%s】货位已经被占用,请重新选择!!!' % item.destination_location_id.barcode)
+
class SfStockPicking(models.Model):
_inherit = 'stock.picking'
@@ -863,12 +880,15 @@ class SfStockPicking(models.Model):
res = super(SfStockPicking, self).button_validate()
for line in self.move_line_ids:
if line:
+ # 调用入库方法进行入库
+ line.compute_destination_location_id()
if line.current_location_id:
if line.current_location_id.product_sn_id:
line.current_location_id.product_sn_id = False
# line.current_location_id.location_status = '空闲'
line.current_location_id.product_num = 0
+ # 对入库作业的刀柄和托盘进行Rfid绑定校验
for move in self.move_ids:
if move and move.product_id.cutting_tool_material_id.name == '刀柄' or '托盘' in (
move.product_id.fixture_material_id.name or ''):
diff --git a/sf_warehouse/security/ir.model.access.csv b/sf_warehouse/security/ir.model.access.csv
index db246adc..a5b3b2fa 100644
--- a/sf_warehouse/security/ir.model.access.csv
+++ b/sf_warehouse/security/ir.model.access.csv
@@ -132,6 +132,9 @@ access_sf_cutting_tool_material_group_sf_stock_manager,sf_cutting_tool_material_
access_sf_cutting_tool_standard_library_group_sf_stock_manager,sf_cutting_tool_standard_library_group_sf_stock_manager,sf_base.model_sf_cutting_tool_standard_library,sf_warehouse.group_sf_stock_manager,1,0,1,0
access_sf_tool_materials_basic_parameters_group_sf_stock_manager,sf_tool_materials_basic_parameters_group_sf_stock_manager,sf_base.model_sf_tool_materials_basic_parameters,sf_warehouse.group_sf_stock_manager,1,0,1,0
+access_sf_shelf_location_wizard_group_plan_dispatch,sf_shelf_location_wizard_group_plan_dispatch,model_sf_shelf_location_wizard,sf_base.group_plan_dispatch,1,0,0,0
+access_sf_shelf_location_wizard_group_sf_stock_user_group_sf_stock_user,sf_shelf_location_wizard_group_sf_stock_user_group_sf_stock_user,model_sf_shelf_location_wizard,sf_warehouse.group_sf_stock_user,1,0,0,0
+access_sf_shelf_location_wizard_group_sf_stock_manager,sf_shelf_location_wizard_group_sf_stock_manager,model_sf_shelf_location_wizard,sf_warehouse.group_sf_stock_manager,1,1,1,0
diff --git a/sf_warehouse/views/change_stock_move_views.xml b/sf_warehouse/views/change_stock_move_views.xml
index 7af154b7..519eca85 100644
--- a/sf_warehouse/views/change_stock_move_views.xml
+++ b/sf_warehouse/views/change_stock_move_views.xml
@@ -19,7 +19,7 @@
+ '=', there_is_no_sn)]" options="{'no_create': True,'no_create_edit':True}"/>
diff --git a/sf_warehouse/views/shelf_location.xml b/sf_warehouse/views/shelf_location.xml
index d736f89c..90783fca 100644
--- a/sf_warehouse/views/shelf_location.xml
+++ b/sf_warehouse/views/shelf_location.xml
@@ -126,9 +126,19 @@
Shelf Location form
sf.shelf.location
-
-
-
-
-
-
+
+
+
+
+
@@ -175,7 +185,7 @@
shelf.location.kanban
sf.shelf.location
-
+
sf.shelf.location
+
diff --git a/sf_warehouse/wizard/__init__.py b/sf_warehouse/wizard/__init__.py
new file mode 100644
index 00000000..20a7f5c4
--- /dev/null
+++ b/sf_warehouse/wizard/__init__.py
@@ -0,0 +1 @@
+from . import wizard
\ No newline at end of file
diff --git a/sf_warehouse/wizard/wizard.py b/sf_warehouse/wizard/wizard.py
new file mode 100644
index 00000000..db64fe07
--- /dev/null
+++ b/sf_warehouse/wizard/wizard.py
@@ -0,0 +1,64 @@
+from odoo import fields, models, api
+from odoo.exceptions import UserError, ValidationError
+
+
+class ShelfLocationWizard(models.TransientModel):
+ _name = 'sf.shelf.location.wizard'
+ _description = '货位变更'
+
+ name = fields.Char('')
+
+ current_location_id = fields.Many2one('stock.location', string='所属库区', readonly=True)
+
+ current_shelf_id = fields.Many2one('sf.shelf', string='当前货架', readonly=True)
+ current_barcode = fields.Char('当前货位编码', readonly=True)
+ current_name = fields.Char('当前货位名称', readonly=True)
+ current_product_id = fields.Many2one('product.product', string='产品', readonly=True)
+
+ destination_shelf_id = fields.Many2one('sf.shelf', string='目标货架', compute='_compute_destination_name')
+ destination_barcode_id = fields.Many2one('sf.shelf.location', string='目标货位编码', required=True,
+ domain="")
+ destination_name = fields.Char('目标货位名称', compute='_compute_destination_name')
+
+ def return_domain(self):
+ val = [('location_status', '=', '空闲')]
+ if self.current_product_id:
+ val = ['|', ('location_status', '=', '空闲'), ('product_id', '=', self.current_product_id)]
+ if self.destination_shelf_id:
+ val.append(('shelf_id', '=', self.destination_shelf_id))
+ return "%s" % val
+
+ @api.depends('destination_barcode_id')
+ def _compute_destination_name(self):
+ if self.destination_barcode_id:
+ self.destination_name = self.destination_barcode_id.name
+ self.destination_shelf_id = self.destination_barcode_id.shelf_id.id
+ else:
+ self.destination_name = ''
+ self.destination_shelf_id = False
+
+ #
+ # @api.onchange('destination_barcode_id')
+ # def _onchange_destination_shelf_id(self):
+ # if self.destination_barcode_id:
+ # self.destination_shelf_id = self.destination_barcode_id.shelf_id.id
+
+ def confirm_the_change(self):
+ 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.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
+ else:
+ raise ValidationError('目标货位出错,请联系管理员!')
+
+ # 关闭弹出窗口
+ return {'type': 'ir.actions.act_window_close'}
diff --git a/sf_warehouse/wizard/wizard_view.xml b/sf_warehouse/wizard/wizard_view.xml
new file mode 100644
index 00000000..1bb95e15
--- /dev/null
+++ b/sf_warehouse/wizard/wizard_view.xml
@@ -0,0 +1,49 @@
+
+
+
+ 货位变更
+ sf.shelf.location.wizard
+
+
+
+
+
+
+ 货位变更
+ ir.actions.act_window
+ sf.shelf.location.wizard
+ form
+
+ new
+
+
\ No newline at end of file
|