diff --git a/jikimo_account_process/__manifest__.py b/jikimo_account_process/__manifest__.py index f701deb7..0c1b521c 100644 --- a/jikimo_account_process/__manifest__.py +++ b/jikimo_account_process/__manifest__.py @@ -3,8 +3,8 @@ 'name': "jikimo_account_process", 'summary': """ - Short (1 phrase/line) summary of the module's purpose, used as - subtitle on modules listing or apps.openerp.com""", + 处理会计凭证生成重复名称报错问题 + """, 'description': """ Long description of module's purpose diff --git a/jikimo_frontend/views/bye_odoo.xml b/jikimo_frontend/views/bye_odoo.xml index 14fd211b..d75ddd06 100644 --- a/jikimo_frontend/views/bye_odoo.xml +++ b/jikimo_frontend/views/bye_odoo.xml @@ -16,7 +16,7 @@ diff --git a/sf_dlm/__manifest__.py b/sf_dlm/__manifest__.py index 7878467b..bcd052f0 100644 --- a/sf_dlm/__manifest__.py +++ b/sf_dlm/__manifest__.py @@ -10,7 +10,7 @@ """, 'category': 'sf', 'website': 'https://www.sf.jikimo.com', - 'depends': ['sf_base', 'web_widget_model_viewer', 'mrp_subcontracting', 'purchase_stock', 'uom', ], + 'depends': ['sf_base', 'mrp_subcontracting', 'purchase_stock', 'uom'], 'data': [ 'data/product_data.xml', 'data/uom_data.xml', diff --git a/sf_machine_connect/__manifest__.py b/sf_machine_connect/__manifest__.py index db7ae467..48857914 100644 --- a/sf_machine_connect/__manifest__.py +++ b/sf_machine_connect/__manifest__.py @@ -12,7 +12,7 @@ 'category': 'sf', 'author': 'jikimo', 'website': 'https://sf.cs.jikimo.com', - 'depends': ['web', 'mail', 'sf_base', 'sf_manufacturing', 'barcodes', ], + 'depends': ['web', 'sf_manufacturing', 'barcodes'], 'data': [ # 定义权限组放在最上面 # 权限组 diff --git a/sf_machine_connect/controllers/controllers.py b/sf_machine_connect/controllers/controllers.py index b8c31cb6..a65e97ef 100644 --- a/sf_machine_connect/controllers/controllers.py +++ b/sf_machine_connect/controllers/controllers.py @@ -15,7 +15,7 @@ db_config = { "user": "postgres", "password": "postgres", "port": "5432", - "host": "172.16.10.113" + "host": "172.16.10.131" } @@ -24,6 +24,8 @@ def convert_to_seconds(time_str): if time_str is None: return 0 + if time_str == 0: + return 0 pattern = r"(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?" @@ -1306,9 +1308,9 @@ class Sf_Dashboard_Connect(http.Controller): res['data'][item] = { 'wait_time': last_all_time['run_time'] if last_all_time['run_time'] is not None else 0, 'cut_time': last_all_time['process_time'] if last_all_time['process_time'] is not None else 0, - 'cut_24_time': last_24_time['process_time'] if last_24_time['process_time'] is not None else 0, + 'cut_24_time': last_24_time['process_time'] if last_24_time else 0, 'power_on_time': last_all_time['power_on_time'] if last_all_time['power_on_time'] is not None else 0, - 'power_on_24_time': last_24_time['power_on_time'] if last_24_time['power_on_time'] is not None else 0, + 'power_on_24_time': last_24_time['power_on_time'] if last_24_time else 0, 'alarm_last_24_time': alarm_last_24_time, 'alarm_last_24_nums': len(list(set(alarm_last_24_nums))), 'idle_count': idle_count, diff --git a/sf_maintenance/models/sf_maintenance_oee.py b/sf_maintenance/models/sf_maintenance_oee.py index 0c75ba53..a88bc27e 100644 --- a/sf_maintenance/models/sf_maintenance_oee.py +++ b/sf_maintenance/models/sf_maintenance_oee.py @@ -12,6 +12,8 @@ def convert_to_seconds(time_str): if time_str is None: return 0 + if time_str == 0: + return 0 pattern = r"(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?" @@ -122,24 +124,37 @@ class SfMaintenanceEquipmentOEE(models.Model): real_dict = result_time['data'][self.equipment_code] print('=', result_time) if result_time['status'] == 1: - self.online_time = round((convert_to_seconds(real_dict['power_on_time']) - convert_to_seconds( - real_dict['power_on_24_time'])) / 3600, 2) - self.work_time = round( - (convert_to_seconds(real_dict['cut_time']) - convert_to_seconds(real_dict['cut_24_time'])) / 3600, - 2) + if real_dict['power_on_24_time'] == 0: + self.online_time = 0 + self.idle_time = 0 + self.idle_rate = 0 + self.work_rate = 0 + self.fault_time = 0 + self.fault_rate = 0 + self.fault_nums = 0 + self.idle_nums = 0 + self.work_time = 0 + else: + self.online_time = round((convert_to_seconds(real_dict['power_on_time']) - convert_to_seconds( + real_dict['power_on_24_time'])) / 3600, 2) + self.idle_time = float(self.online_time) - float( + self.work_time) if self.online_time and self.work_time else 0 + self.idle_rate = round( + float(self.idle_time) / (float(self.online_time) if self.online_time else 1) * 100, 2) + self.work_rate = round( + float(self.work_time) / (float(self.online_time) if self.online_time else 1) * 100, 2) + self.fault_time = (float(real_dict['alarm_last_24_time']) if real_dict[ + 'alarm_last_24_time'] else 0) / 3600 + self.fault_rate = round( + float(self.fault_time) / (float(self.online_time) if self.online_time else 1) * 100, 2) + self.fault_nums = real_dict['alarm_last_24_nums'] + self.idle_nums = real_dict['idle_count'] + self.work_time = round( + (convert_to_seconds(real_dict['cut_time']) - convert_to_seconds(real_dict['cut_24_time'])) / 3600, + 2) self.offline_time = 24 - (float(self.online_time) if self.online_time else 0) - self.idle_time = float(self.online_time) - float( - self.work_time) if self.online_time and self.work_time else 0 - self.idle_rate = round( - float(self.idle_time) / (float(self.online_time) if self.online_time else 1) * 100, 2) - self.work_rate = round( - float(self.work_time) / (float(self.online_time) if self.online_time else 1) * 100, 2) - self.fault_time = (float(real_dict['alarm_last_24_time']) if real_dict[ - 'alarm_last_24_time'] else 0) / 3600 - self.fault_rate = round( - float(self.fault_time) / (float(self.online_time) if self.online_time else 1) * 100, 2) - self.fault_nums = real_dict['alarm_last_24_nums'] - self.idle_nums = real_dict['idle_count'] + + if response.status_code == 200: result = response.json() diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 7c3ec50f..eb613c75 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -1197,8 +1197,8 @@ class ResMrpWorkOrder(models.Model): if record.is_rework is False: if not record.material_center_point: raise UserError("坯料中心点为空,请检查") - if record.X_deviation_angle <= 0: - raise UserError("X偏差角度小于等于0,请检查!本次计算的X偏差角度为:%s" % record.X_deviation_angle) + # if record.X_deviation_angle <= 0: + # raise UserError("X偏差角度小于等于0,请检查!本次计算的X偏差角度为:%s" % record.X_deviation_angle) record.process_state = '待加工' # record.write({'process_state': '待加工'}) record.production_id.process_state = '待加工' @@ -1826,6 +1826,11 @@ class WorkPieceDelivery(models.Model): return is_free else: raise UserError("接驳站暂未反馈站点实时状态,请稍后再试") + + def delivery_avg(self): + is_agv_task_dispatch = self.env['ir.config_parameter'].sudo().get_param('is_agv_task_dispatch') + if is_agv_task_dispatch: + self._delivery_avg() # 配送至avg小车 def _delivery_avg(self): @@ -1886,7 +1891,7 @@ class WorkPieceDelivery(models.Model): logging.info('delivery_item-name:%s' % delivery_item.name) delivery_item.write({ 'task_delivery_time': fields.Datetime.now(), - 'status': '待配送' + 'status': '已下发' }) if delivery_item.type == "上产线": delivery_item.workorder_id.write({'is_delivery': True}) diff --git a/sf_manufacturing/views/mrp_workorder_view.xml b/sf_manufacturing/views/mrp_workorder_view.xml index c3e05739..d0577fbc 100644 --- a/sf_manufacturing/views/mrp_workorder_view.xml +++ b/sf_manufacturing/views/mrp_workorder_view.xml @@ -797,7 +797,7 @@ -