Compare commits
15 Commits
feature/71
...
release/re
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b8894609a9 | ||
|
|
3f8fd6da62 | ||
|
|
62ead52f00 | ||
|
|
8841d800ea | ||
|
|
920e96ffc6 | ||
|
|
d52f5fa841 | ||
|
|
e0559e9887 | ||
|
|
39a25bb6c8 | ||
|
|
e129c08426 | ||
|
|
c6b47bd68d | ||
|
|
126d60f8d7 | ||
|
|
4225a8fe1b | ||
|
|
a13a79f41f | ||
|
|
a828c823dd | ||
|
|
9cf2bac9c6 |
@@ -41,6 +41,7 @@ class PurchaseRequest(models.Model):
|
|||||||
if lines:
|
if lines:
|
||||||
for line in lines:
|
for line in lines:
|
||||||
for line_item in line.order_line:
|
for line_item in line.order_line:
|
||||||
|
if line_item.state == 'purchase':
|
||||||
product_id = line_item.product_id.id
|
product_id = line_item.product_id.id
|
||||||
qty = line_item.product_qty
|
qty = line_item.product_qty
|
||||||
product_rounding[product_id] = line_item.product_id.uom_id.rounding
|
product_rounding[product_id] = line_item.product_id.uom_id.rounding
|
||||||
@@ -60,10 +61,10 @@ class PurchaseRequest(models.Model):
|
|||||||
|
|
||||||
if discrepancies:
|
if discrepancies:
|
||||||
# 弹出提示框
|
# 弹出提示框
|
||||||
message = "产品数量不一致:\n"
|
message = "产品与采购数量不一致:\n"
|
||||||
for product_id, required_qty, order_qty in discrepancies:
|
for product_id, required_qty, order_qty in discrepancies:
|
||||||
product_name = self.env['product.product'].browse(product_id).display_name # 获取产品名称
|
product_name = self.env['product.product'].browse(product_id).display_name # 获取产品名称
|
||||||
message += f"产品 {product_name},需求数量 {required_qty},关联采购订单数量 {order_qty}(含询价状态)\n"
|
message += f"产品 {product_name},需求数量 {required_qty},关联采购订单确认的数量 {order_qty}。\n"
|
||||||
# 添加确认框
|
# 添加确认框
|
||||||
message += "确认关闭?"
|
message += "确认关闭?"
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -445,32 +445,7 @@ class Manufacturing_Connect(http.Controller):
|
|||||||
shelfinfo = list(filter(lambda x: x.get('DeviceId') == DeciveId,
|
shelfinfo = list(filter(lambda x: x.get('DeviceId') == DeciveId,
|
||||||
request.env['sf.shelf.location'].sudo().get_sf_shelf_location_info(
|
request.env['sf.shelf.location'].sudo().get_sf_shelf_location_info(
|
||||||
DeciveId)))
|
DeciveId)))
|
||||||
total_data = request.env['sf.shelf.location.datasync'].sudo().get_total_data()
|
request.env['sf.shelf.location.datasync'].sudo().set_shelf_location(shelfinfo)
|
||||||
for item in shelfinfo:
|
|
||||||
logging.info('货架已获取信息:%s' % item)
|
|
||||||
shelf_barcode = request.env['sf.shelf.location.datasync'].sudo().find_our_code(
|
|
||||||
total_data, item['Postion'])
|
|
||||||
location_id = request.env['sf.shelf.location'].sudo().search(
|
|
||||||
[('barcode', '=', shelf_barcode)],
|
|
||||||
limit=1)
|
|
||||||
if location_id:
|
|
||||||
# 如果是线边刀库信息,则对功能刀具移动生成记录
|
|
||||||
if 'Tool' in item['Postion']:
|
|
||||||
tool = request.env['sf.functional.cutting.tool.entity'].sudo().search(
|
|
||||||
[('rfid', '=', item['RfidCode']), ('functional_tool_status', '!=', '已拆除')])
|
|
||||||
tool.sudo().tool_in_out_stock_location(location_id)
|
|
||||||
if tool:
|
|
||||||
location_id.product_sn_id = tool.barcode_id.id
|
|
||||||
# 修改功能刀具状态
|
|
||||||
if item.get('State') == '报警':
|
|
||||||
if tool.functional_tool_status != item.get('State'):
|
|
||||||
tool.write({
|
|
||||||
'functional_tool_status': item['State']
|
|
||||||
})
|
|
||||||
else:
|
|
||||||
location_id.product_sn_id = False
|
|
||||||
if item['RfidCode']:
|
|
||||||
logging.info('Rfid为【%s】的功能刀具在系统中不存在!' % item['RfidCode'])
|
|
||||||
else:
|
else:
|
||||||
equipment_id = request.env['maintenance.equipment'].sudo().search([('name', '=', DeciveId)])
|
equipment_id = request.env['maintenance.equipment'].sudo().search([('name', '=', DeciveId)])
|
||||||
if equipment_id:
|
if equipment_id:
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class JikimoSaleRoutePicking(Sf_Bf_Connect):
|
|||||||
bfm_process_order_list = json.loads(kw['bfm_process_order_list'])
|
bfm_process_order_list = json.loads(kw['bfm_process_order_list'])
|
||||||
order_id = request.env['sale.order'].with_user(request.env.ref("base.user_admin")).sale_order_create(
|
order_id = request.env['sale.order'].with_user(request.env.ref("base.user_admin")).sale_order_create(
|
||||||
company_id, kw['delivery_name'], kw['delivery_telephone'], kw['delivery_address'],
|
company_id, kw['delivery_name'], kw['delivery_telephone'], kw['delivery_address'],
|
||||||
kw['delivery_end_date'], kw['payments_way'], kw['pay_way'], kw['order_number'], state='draft',
|
kw['delivery_end_date'], kw['payments_way'], kw['pay_way'], kw['order_number'], kw['remark'], state='draft',
|
||||||
model_display_version=kw.get('model_display_version'))
|
model_display_version=kw.get('model_display_version'))
|
||||||
i = 1
|
i = 1
|
||||||
# 给sale_order的default_code字段赋值
|
# 给sale_order的default_code字段赋值
|
||||||
@@ -47,7 +47,7 @@ class JikimoSaleRoutePicking(Sf_Bf_Connect):
|
|||||||
i += 1
|
i += 1
|
||||||
if kw.get('contract_file_name') and kw.get('contract_file') and kw.get('contract_code'):
|
if kw.get('contract_file_name') and kw.get('contract_file') and kw.get('contract_code'):
|
||||||
order_id.create_sale_documents(kw.get('contract_file_name'), kw.get('contract_file'))
|
order_id.create_sale_documents(kw.get('contract_file_name'), kw.get('contract_file'))
|
||||||
order_id.write({'contract_code': kw.get('contract_code')})
|
order_id.write({'contract_code': kw.get('contract_code'), 'contract_date': kw.get('contract_date')})
|
||||||
res['factory_order_no'] = order_id.name
|
res['factory_order_no'] = order_id.name
|
||||||
order_id.confirm_to_supply_method()
|
order_id.confirm_to_supply_method()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@@ -227,6 +227,14 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
# finish_move.move_dest_ids.move_line_ids.reserved_uom_qty = 0
|
# finish_move.move_dest_ids.move_line_ids.reserved_uom_qty = 0
|
||||||
else:
|
else:
|
||||||
next_workorder = sorted_workorders[position + 1]
|
next_workorder = sorted_workorders[position + 1]
|
||||||
|
# 持续获取下一个工单,直到找到一个不是返工的工单
|
||||||
|
while next_workorder and next_workorder.state == 'rework':
|
||||||
|
position += 1
|
||||||
|
if position + 1 < len(sorted_workorders):
|
||||||
|
next_workorder = sorted_workorders[position + 1]
|
||||||
|
else:
|
||||||
|
next_workorder = None
|
||||||
|
if next_workorder:
|
||||||
next_state = next_workorder.state
|
next_state = next_workorder.state
|
||||||
if next_state not in ['pending', 'waiting', 'ready']:
|
if next_state not in ['pending', 'waiting', 'ready']:
|
||||||
raise UserError('下工序已经开始,无法回退')
|
raise UserError('下工序已经开始,无法回退')
|
||||||
|
|||||||
@@ -210,8 +210,8 @@
|
|||||||
<field name="msgtype">markdown</field>
|
<field name="msgtype">markdown</field>
|
||||||
<field name="urgency">normal</field>
|
<field name="urgency">normal</field>
|
||||||
<field name="content">### 功能刀具寿命到期提醒:
|
<field name="content">### 功能刀具寿命到期提醒:
|
||||||
单号:拆解单[{{code}}]({{tool_expired_remind_special_url}})
|
单号:拆解单[{{code}}]({{request_url}})
|
||||||
事项:{{functional_tool_id.tool_name_id.name}}寿命已到期,需拆解</field>
|
事项:{{name}}寿命已到期,需拆解</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="template_tool_assembly_remind" model="jikimo.message.template">
|
<record id="template_tool_assembly_remind" model="jikimo.message.template">
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
from odoo import models, api
|
from odoo import models, api
|
||||||
|
from urllib.parse import urlencode
|
||||||
|
|
||||||
|
|
||||||
class SFMessagefunctionalToolDismantle(models.Model):
|
class SFMessagefunctionalToolDismantle(models.Model):
|
||||||
@@ -18,12 +19,39 @@ class SFMessagefunctionalToolDismantle(models.Model):
|
|||||||
obj.add_queue('功能刀具寿命到期')
|
obj.add_queue('功能刀具寿命到期')
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def get_special_url(self,id,tmplate_name,special_name,model_id):
|
def _get_message(self, message_queue_ids):
|
||||||
|
contents = []
|
||||||
|
for message_queue_id in message_queue_ids:
|
||||||
|
if message_queue_id.message_template_id.name == '功能刀具寿命到期':
|
||||||
|
content = message_queue_id.message_template_id.content
|
||||||
|
td_line = self.search([('id', '=', int(message_queue_id.res_id))])
|
||||||
|
url = self.request_url(int(message_queue_id.res_id))
|
||||||
|
content = content.replace('{{code}}', td_line.code).replace(
|
||||||
|
'{{request_url}}', url).replace('{{name}}', td_line.name)
|
||||||
|
contents.append(content)
|
||||||
|
return contents, message_queue_ids
|
||||||
|
|
||||||
|
def request_url(self, id):
|
||||||
|
url = self.env['ir.config_parameter'].get_param('web.base.url')
|
||||||
|
action_id = self.env.ref('sf_tool_management.sf_functional_tool_dismantle_view_act').id
|
||||||
|
menu_id = self.env.ref('sf_tool_management.menu_sf_functional_tool_dismantle').id
|
||||||
|
# 查询参数
|
||||||
|
params = {'id': id, 'menu_id': menu_id, 'action': action_id,
|
||||||
|
'model': 'sf.functional.tool.dismantle',
|
||||||
|
'view_type': 'form'}
|
||||||
|
# 拼接查询参数
|
||||||
|
tool_string = urlencode(params)
|
||||||
|
# 拼接URL
|
||||||
|
full_url = url + "/web#" + tool_string
|
||||||
|
return full_url
|
||||||
|
|
||||||
|
def get_special_url(self, id, tmplate_name, special_name, model_id):
|
||||||
menu_id = 0
|
menu_id = 0
|
||||||
action_id = 0
|
action_id = 0
|
||||||
if tmplate_name=='调拨入库' and special_name== 'tool_expired_remind_special_url':
|
if tmplate_name == '调拨入库' and special_name == 'tool_expired_remind_special_url':
|
||||||
menu_id = self.env.ref('mrp.menu_mrp_root').id
|
menu_id = self.env.ref('mrp.menu_mrp_root').id
|
||||||
action_id = self.env.ref('sf_tool_management.sf_functional_tool_dismantle_view_act').id
|
action_id = self.env.ref('sf_tool_management.sf_functional_tool_dismantle_view_act').id
|
||||||
return super(SFMessagefunctionalToolDismantle, self).get_url(id, menu_id, action_id,model_id)
|
return super(SFMessagefunctionalToolDismantle, self).get_url(id, menu_id, action_id, model_id)
|
||||||
else:
|
else:
|
||||||
return super(SFMessagefunctionalToolDismantle, self).get_special_url(id, tmplate_name, special_name, model_id)
|
return super(SFMessagefunctionalToolDismantle, self).get_special_url(id, tmplate_name, special_name,
|
||||||
|
model_id)
|
||||||
|
|||||||
@@ -43,14 +43,17 @@ class SFMessageQualityCheck(models.Model):
|
|||||||
# ('message_template_id', '=', message_template.id)])
|
# ('message_template_id', '=', message_template.id)])
|
||||||
# return jikimo_message_queue
|
# return jikimo_message_queue
|
||||||
def write(self, vals):
|
def write(self, vals):
|
||||||
original_state = self.quality_state
|
original_state = {}
|
||||||
|
for item in self:
|
||||||
|
original_state.update({f'{item.id}': item.quality_state})
|
||||||
res = super(SFMessageQualityCheck, self).write(vals)
|
res = super(SFMessageQualityCheck, self).write(vals)
|
||||||
if res and vals.get('quality_state') == 'none' and original_state != 'none':
|
for item in self:
|
||||||
|
if vals.get('quality_state') == 'none' and original_state.get(f'{item.id}') != 'none':
|
||||||
message_template_id = self.env['jikimo.message.template'].sudo().search([('name', '=', '待质检提醒')])
|
message_template_id = self.env['jikimo.message.template'].sudo().search([('name', '=', '待质检提醒')])
|
||||||
queue_id = self.env['jikimo.message.queue'].sudo().search(
|
queue_id = self.env['jikimo.message.queue'].sudo().search(
|
||||||
[('message_template_id', '=', message_template_id[-1].id), ('res_id', '=', self.id)])
|
[('message_template_id', '=', message_template_id[-1].id), ('res_id', '=', item.id)])
|
||||||
if not queue_id and '制造' not in [pt.name for pt in self.point_id.picking_type_ids]:
|
if not queue_id and '制造' not in [pt.name for pt in item.point_id.picking_type_ids]:
|
||||||
self.add_queue('待质检')
|
item.add_queue('待质检')
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def _get_message(self, message_queue_ids):
|
def _get_message(self, message_queue_ids):
|
||||||
|
|||||||
@@ -64,13 +64,14 @@ class ReSaleOrder(models.Model):
|
|||||||
model_display_version = fields.Char('模型展示版本', default="v1")
|
model_display_version = fields.Char('模型展示版本', default="v1")
|
||||||
|
|
||||||
contract_code = fields.Char('合同编号')
|
contract_code = fields.Char('合同编号')
|
||||||
|
contract_date = fields.Date('合同日期')
|
||||||
contract_document_id = fields.Many2one('documents.document', string='合同文件')
|
contract_document_id = fields.Many2one('documents.document', string='合同文件')
|
||||||
contract_file = fields.Binary(related='contract_document_id.datas', string='合同文件内容')
|
contract_file = fields.Binary(related='contract_document_id.datas', string='合同文件内容')
|
||||||
contract_file_name = fields.Char(related='contract_document_id.attachment_id.name', string='文件名')
|
contract_file_name = fields.Char(related='contract_document_id.attachment_id.name', string='文件名')
|
||||||
|
|
||||||
# 业务平台分配工厂后在智能工厂先创建销售订单
|
# 业务平台分配工厂后在智能工厂先创建销售订单
|
||||||
def sale_order_create(self, company_id, delivery_name, delivery_telephone, delivery_address,
|
def sale_order_create(self, company_id, delivery_name, delivery_telephone, delivery_address,
|
||||||
deadline_of_delivery, payments_way, pay_way, order_number, state='sale',
|
deadline_of_delivery, payments_way, pay_way, order_number, remark, state='sale',
|
||||||
model_display_version='v1'):
|
model_display_version='v1'):
|
||||||
now_time = datetime.datetime.now()
|
now_time = datetime.datetime.now()
|
||||||
partner = self.get_customer()
|
partner = self.get_customer()
|
||||||
@@ -89,6 +90,7 @@ class ReSaleOrder(models.Model):
|
|||||||
'pay_way': pay_way,
|
'pay_way': pay_way,
|
||||||
'order_code': order_number,
|
'order_code': order_number,
|
||||||
'model_display_version': model_display_version,
|
'model_display_version': model_display_version,
|
||||||
|
'remark': remark,
|
||||||
}
|
}
|
||||||
if deadline_of_delivery:
|
if deadline_of_delivery:
|
||||||
# deadline_of_delivery字段存在为false字符串情况
|
# deadline_of_delivery字段存在为false字符串情况
|
||||||
|
|||||||
@@ -58,20 +58,6 @@ class FunctionalCuttingToolEntity(models.Model):
|
|||||||
safe_inventory_id = fields.Many2one('sf.real.time.distribution.of.functional.tools',
|
safe_inventory_id = fields.Many2one('sf.real.time.distribution.of.functional.tools',
|
||||||
string='功能刀具安全库存', readonly=True)
|
string='功能刀具安全库存', readonly=True)
|
||||||
|
|
||||||
@api.onchange('functional_tool_status')
|
|
||||||
def _onchange_functional_tool_status(self):
|
|
||||||
for item in self:
|
|
||||||
if item:
|
|
||||||
if item.functional_tool_status == '报警':
|
|
||||||
self.create_tool_dismantle()
|
|
||||||
|
|
||||||
def set_functional_tool_status(self):
|
|
||||||
# self.write({
|
|
||||||
# 'functional_tool_status': '报警'
|
|
||||||
# })
|
|
||||||
self.functional_tool_status = '报警'
|
|
||||||
self.create_tool_dismantle()
|
|
||||||
|
|
||||||
def create_tool_dismantle(self):
|
def create_tool_dismantle(self):
|
||||||
for item in self:
|
for item in self:
|
||||||
# 创建报警刀具拆解单
|
# 创建报警刀具拆解单
|
||||||
|
|||||||
@@ -42,7 +42,6 @@
|
|||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form create="0" edit="0" delete="0">
|
<form create="0" edit="0" delete="0">
|
||||||
<header>
|
<header>
|
||||||
<button name="set_functional_tool_status" string="报警" type="object" invisible="1"/>
|
|
||||||
<!-- <button name="enroll_functional_tool_entity" string="功能刀具注册" type="object"-->
|
<!-- <button name="enroll_functional_tool_entity" string="功能刀具注册" type="object"-->
|
||||||
<!-- class="btn-primary"/>-->
|
<!-- class="btn-primary"/>-->
|
||||||
<field name="functional_tool_status" widget="statusbar" statusbar_visible="正常,报警,已拆除"/>
|
<field name="functional_tool_status" widget="statusbar" statusbar_visible="正常,报警,已拆除"/>
|
||||||
|
|||||||
@@ -107,20 +107,33 @@ class MrsShelfLocationDataSync(models.Model):
|
|||||||
equipment_id.register_equipment_tool()
|
equipment_id.register_equipment_tool()
|
||||||
|
|
||||||
shelfinfo = self.env['sf.shelf.location'].get_sf_shelf_location_info()
|
shelfinfo = self.env['sf.shelf.location'].get_sf_shelf_location_info()
|
||||||
total_data = self.get_total_data()
|
self.set_shelf_location(shelfinfo)
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
logging.info("库区信息同步失败:%s" % e)
|
||||||
|
raise ValidationError("数据错误导致同步失败,请联系管理员")
|
||||||
|
|
||||||
|
def set_shelf_location(self, shelfinfo):
|
||||||
print('shelfinfo:', shelfinfo)
|
print('shelfinfo:', shelfinfo)
|
||||||
|
total_data = self.get_total_data()
|
||||||
for item in shelfinfo:
|
for item in shelfinfo:
|
||||||
logging.info('货架已获取信息:%s' % item)
|
logging.info('货架已获取信息:%s' % item)
|
||||||
shelf_barcode = self.find_our_code(total_data, item['Postion'])
|
shelf_barcode = self.env['sf.shelf.location.datasync'].sudo().find_our_code(
|
||||||
location_id = self.env['sf.shelf.location'].search([('barcode', '=', shelf_barcode)], limit=1)
|
total_data, item['Postion'])
|
||||||
|
location_id = self.env['sf.shelf.location'].sudo().search(
|
||||||
|
[('barcode', '=', shelf_barcode)],
|
||||||
|
limit=1)
|
||||||
if location_id:
|
if location_id:
|
||||||
# 如果是线边刀库信息,则对功能刀具移动生成记录
|
# 如果是线边刀库信息,则对功能刀具移动生成记录
|
||||||
if 'Tool' in item['Postion']:
|
if 'Tool' in item['Postion']:
|
||||||
tool = self.env['sf.functional.cutting.tool.entity'].sudo().search(
|
tool = self.env['sf.functional.cutting.tool.entity'].sudo().search(
|
||||||
[('rfid', '=', item['RfidCode']), ('functional_tool_status', '!=', '已拆除')])
|
[('rfid', '=', item['RfidCode']), ('functional_tool_status', '!=', '已拆除')])
|
||||||
tool.tool_in_out_stock_location(location_id)
|
tool.sudo().tool_in_out_stock_location(location_id)
|
||||||
if tool:
|
if tool:
|
||||||
location_id.product_sn_id = tool.barcode_id.id
|
location_id.product_sn_id = tool.barcode_id.id
|
||||||
|
if item.get('State') == '报警' and tool.functional_tool_status != '报警':
|
||||||
|
# 创建报警刀具拆解单和刀具报警记录
|
||||||
|
tool.create_tool_dismantle()
|
||||||
# 修改功能刀具标准状态值和已使用寿命值、功能刀具状态
|
# 修改功能刀具标准状态值和已使用寿命值、功能刀具状态
|
||||||
if 'LifeStd' in item and 'LifeUse' in item:
|
if 'LifeStd' in item and 'LifeUse' in item:
|
||||||
tool.sudo().write({
|
tool.sudo().write({
|
||||||
@@ -138,7 +151,3 @@ class MrsShelfLocationDataSync(models.Model):
|
|||||||
location_id.product_sn_id = stock_lot_obj.id
|
location_id.product_sn_id = stock_lot_obj.id
|
||||||
else:
|
else:
|
||||||
location_id.product_sn_id = False
|
location_id.product_sn_id = False
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
logging.info("库区信息同步失败:%s" % e)
|
|
||||||
raise ValidationError("数据错误导致同步失败,请联系管理员")
|
|
||||||
|
|||||||
Reference in New Issue
Block a user