Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/优化制造功能
This commit is contained in:
@@ -436,6 +436,7 @@ class Manufacturing_Connect(http.Controller):
|
|||||||
DeciveId)))
|
DeciveId)))
|
||||||
total_data = request.env['sf.shelf.location.datasync'].sudo().get_total_data()
|
total_data = request.env['sf.shelf.location.datasync'].sudo().get_total_data()
|
||||||
for item in shelfinfo:
|
for item in shelfinfo:
|
||||||
|
logging.info('货架已获取信息:%s' % item)
|
||||||
shelf_barcode = request.env['sf.shelf.location.datasync'].sudo().find_our_code(
|
shelf_barcode = request.env['sf.shelf.location.datasync'].sudo().find_our_code(
|
||||||
total_data, item['Postion'])
|
total_data, item['Postion'])
|
||||||
location_id = request.env['sf.shelf.location'].sudo().search(
|
location_id = request.env['sf.shelf.location'].sudo().search(
|
||||||
@@ -450,15 +451,15 @@ class Manufacturing_Connect(http.Controller):
|
|||||||
if tool:
|
if tool:
|
||||||
location_id.product_sn_id = tool.barcode_id.id
|
location_id.product_sn_id = tool.barcode_id.id
|
||||||
# 修改功能刀具状态
|
# 修改功能刀具状态
|
||||||
tool_state = {'Nomal': '正常', 'Warning': '报警'}
|
if item.get('State') == '报警':
|
||||||
if tool_state.get(item.get('State')):
|
if tool.functional_tool_status != item.get('State'):
|
||||||
if tool_state.get(item.get('State')) != tool.functional_tool_status:
|
|
||||||
tool.write({
|
tool.write({
|
||||||
'functional_tool_status': tool_state.get(item['State'])
|
'functional_tool_status': item['State']
|
||||||
})
|
})
|
||||||
else:
|
else:
|
||||||
location_id.product_sn_id = False
|
location_id.product_sn_id = False
|
||||||
logging.info('货架已获取信息:%s' % item)
|
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:
|
||||||
@@ -683,9 +684,14 @@ class Manufacturing_Connect(http.Controller):
|
|||||||
request.env['center_control.interface.log'].sudo().create(
|
request.env['center_control.interface.log'].sudo().create(
|
||||||
{'content': ret, 'name': 'AutoDeviceApi/AGVStationState'})
|
{'content': ret, 'name': 'AutoDeviceApi/AGVStationState'})
|
||||||
logging.info('ret:%s' % ret)
|
logging.info('ret:%s' % ret)
|
||||||
if 'DeviceId' in ret and 'AtHome' in ret:
|
ret = ret['param']
|
||||||
logging.info('DeviceId:%s, AtHome:%s' % (ret['DeviceId'], ret['AtHome']))
|
params = {}
|
||||||
request.env['sf.agv.site'].update_site_state({ret['DeviceId']: '占用' if ret['AtHome'] else '空闲'})
|
for i in range(len(ret)):
|
||||||
|
if 'DeviceId' in ret[i] and 'AtHome' in ret[i]:
|
||||||
|
logging.info('DeviceId:%s, AtHome:%s' % (ret[i]['DeviceId'], ret[i]['AtHome']))
|
||||||
|
params[ret[i]['DeviceId']] = '占用' if ret[i]['AtHome'] else '空闲'
|
||||||
|
if params:
|
||||||
|
request.env['sf.agv.site'].update_site_state(params)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': str(e)}
|
res = {'Succeed': False, 'ErrorCode': 202, 'Error': str(e)}
|
||||||
logging.info('AGVDownProduct error:%s' % e)
|
logging.info('AGVDownProduct error:%s' % e)
|
||||||
|
|||||||
@@ -226,12 +226,12 @@ class AgvScheduling(models.Model):
|
|||||||
if rec.state != '待下发':
|
if rec.state != '待下发':
|
||||||
return False
|
return False
|
||||||
_logger.info('AGV任务调度:下发调度任务,路线为%s' % agv_task_route)
|
_logger.info('AGV任务调度:下发调度任务,路线为%s' % agv_task_route)
|
||||||
rec._delivery_avg()
|
|
||||||
rec.state = '配送中'
|
rec.state = '配送中'
|
||||||
rec.task_delivery_time = fields.Datetime.now()
|
rec.task_delivery_time = fields.Datetime.now()
|
||||||
rec.site_state = '空闲'
|
rec.site_state = '空闲'
|
||||||
rec.end_site_id = agv_task_route.end_site_id.id
|
rec.end_site_id = agv_task_route.end_site_id.id
|
||||||
rec.agv_route_id = agv_task_route.id
|
rec.agv_route_id = agv_task_route.id
|
||||||
|
# rec._delivery_avg()
|
||||||
# 更新接驳站状态
|
# 更新接驳站状态
|
||||||
rec.env['sf.agv.site'].update_site_state({rec.end_site_id.name: '占用'}, False)
|
rec.env['sf.agv.site'].update_site_state({rec.end_site_id.name: '占用'}, False)
|
||||||
|
|
||||||
@@ -242,13 +242,13 @@ class AgvScheduling(models.Model):
|
|||||||
elif vals['state'] == '已配送':
|
elif vals['state'] == '已配送':
|
||||||
self.env['sf.workpiece.delivery'].search([('agv_scheduling_id', '=', self.id)]).write({
|
self.env['sf.workpiece.delivery'].search([('agv_scheduling_id', '=', self.id)]).write({
|
||||||
'status': '已配送',
|
'status': '已配送',
|
||||||
'feeder_station_destination_id': self.end_site_id,
|
'feeder_station_destination_id': self.end_site_id.id,
|
||||||
'route_id': self.agv_route_id.id,
|
'route_id': self.agv_route_id.id,
|
||||||
'task_completion_time': fields.Datetime.now()
|
'task_completion_time': fields.Datetime.now()
|
||||||
})
|
})
|
||||||
elif vals['state'] == '配送中':
|
elif vals['state'] == '配送中':
|
||||||
self.env['sf.workpiece.delivery'].search([('agv_scheduling_id', '=', self.id)]).write({
|
self.env['sf.workpiece.delivery'].search([('agv_scheduling_id', '=', self.id)]).write({
|
||||||
'feeder_station_destination_id': self.end_site_id,
|
'feeder_station_destination_id': self.end_site_id.id,
|
||||||
'route_id': self.agv_route_id.id,
|
'route_id': self.agv_route_id.id,
|
||||||
'task_delivery_time': fields.Datetime.now()
|
'task_delivery_time': fields.Datetime.now()
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -797,7 +797,7 @@ class MrpProduction(models.Model):
|
|||||||
})
|
})
|
||||||
return action
|
return action
|
||||||
|
|
||||||
# 返工
|
# 报废
|
||||||
def button_scrap_new(self):
|
def button_scrap_new(self):
|
||||||
cloud_programming = self._cron_get_programming_state()
|
cloud_programming = self._cron_get_programming_state()
|
||||||
return {
|
return {
|
||||||
@@ -969,12 +969,12 @@ class MrpProduction(models.Model):
|
|||||||
'location_dest_id', '=', self.env['stock.location'].search([('parent_path', '=', '2/5/')]).id),
|
'location_dest_id', '=', self.env['stock.location'].search([('parent_path', '=', '2/5/')]).id),
|
||||||
('location_src_id', '=', self.env['stock.location'].search(
|
('location_src_id', '=', self.env['stock.location'].search(
|
||||||
[('barcode', '=', 'CP')]).id)])
|
[('barcode', '=', 'CP')]).id)])
|
||||||
origin = move._prepare_procurement_origin()
|
# origin = move._prepare_procurement_origin()
|
||||||
procurement_requests.append(self.env['procurement.group'].Procurement(
|
procurement_requests.append(self.env['procurement.group'].Procurement(
|
||||||
move.product_id, 1.0, move.product_uom,
|
move.product_id, 1.0, move.product_uom,
|
||||||
self.env['stock.location'].search([('barcode', '=', 'CP')]),
|
self.env['stock.location'].search([('barcode', '=', 'CP')]),
|
||||||
rule and rule.name or "/",
|
rule and rule.name or "/",
|
||||||
origin, move.company_id, move_values))
|
sale_order.name, move.company_id, move_values))
|
||||||
self.env['procurement.group'].run(procurement_requests,
|
self.env['procurement.group'].run(procurement_requests,
|
||||||
raise_user_error=not self.env.context.get('from_orderpoint'))
|
raise_user_error=not self.env.context.get('from_orderpoint'))
|
||||||
# self.env['stock.move'].sudo().create(productions._get_moves_finished_values())
|
# self.env['stock.move'].sudo().create(productions._get_moves_finished_values())
|
||||||
@@ -986,7 +986,6 @@ class MrpProduction(models.Model):
|
|||||||
[('origin', '=', self.origin)], order='id desc', limit=1)
|
[('origin', '=', self.origin)], order='id desc', limit=1)
|
||||||
move = self.env['stock.move'].search([('origin', '=', productions.name)], order='id desc')
|
move = self.env['stock.move'].search([('origin', '=', productions.name)], order='id desc')
|
||||||
for mo in move:
|
for mo in move:
|
||||||
print(mo.id)
|
|
||||||
if mo.procure_method == 'make_to_order' and mo.name != productions.name:
|
if mo.procure_method == 'make_to_order' and mo.name != productions.name:
|
||||||
if mo.name == '/':
|
if mo.name == '/':
|
||||||
domain = [('barcode', '=', 'WH-PC'), ('sequence_code', '=', 'PC')]
|
domain = [('barcode', '=', 'WH-PC'), ('sequence_code', '=', 'PC')]
|
||||||
@@ -1001,6 +1000,14 @@ class MrpProduction(models.Model):
|
|||||||
if mo.production_id:
|
if mo.production_id:
|
||||||
if mo.production_id != productions:
|
if mo.production_id != productions:
|
||||||
mo.production_id = False
|
mo.production_id = False
|
||||||
|
mo_move = self.env['stock.move'].search(
|
||||||
|
[('origin', '=', sale_order.name), ('reference', 'ilike', 'WH/MO/')])
|
||||||
|
if mo_move:
|
||||||
|
sfp_move = self.env['stock.move'].search(
|
||||||
|
[('origin', '=', sale_order.name), ('reference', 'ilike', 'WH/SFP/')], limit=1)
|
||||||
|
mo_move.write({'reference': sfp_move.reference, 'partner_id': sfp_move.partner_id.id,
|
||||||
|
'picking_id': sfp_move.picking_id.id, 'picking_type_id': sfp_move.picking_type_id.id,
|
||||||
|
'production_id': False})
|
||||||
productions.write({'programming_no': self.programming_no, 'is_remanufacture': True})
|
productions.write({'programming_no': self.programming_no, 'is_remanufacture': True})
|
||||||
productions.procurement_group_id.mrp_production_ids.move_dest_ids.write(
|
productions.procurement_group_id.mrp_production_ids.move_dest_ids.write(
|
||||||
{'group_id': self.env['procurement.group'].search([('name', '=', sale_order.name)])})
|
{'group_id': self.env['procurement.group'].search([('name', '=', sale_order.name)])})
|
||||||
|
|||||||
@@ -1674,14 +1674,14 @@ class WorkPieceDelivery(models.Model):
|
|||||||
obj.feeder_station_start_id.name, obj.feeder_station_destination_id.name)
|
obj.feeder_station_start_id.name, obj.feeder_station_destination_id.name)
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
@api.constrains('route_id')
|
# @api.constrains('route_id')
|
||||||
def _check_route_id(self):
|
# def _check_route_id(self):
|
||||||
if self.type == '运送空料架':
|
# if self.type == '运送空料架':
|
||||||
if self.route_id and self.name is False:
|
# if self.route_id and self.name is False:
|
||||||
route = self.sudo().search(
|
# route = self.sudo().search(
|
||||||
[('route_id', '=', self.route_id.id), ('id', '!=', self.id), ('name', 'ilike', '运送空料架路线')])
|
# [('route_id', '=', self.route_id.id), ('id', '!=', self.id), ('name', 'ilike', '运送空料架路线')])
|
||||||
if route:
|
# if route:
|
||||||
raise UserError("该任务路线已存在,请重新选择")
|
# raise UserError("该任务路线已存在,请重新选择")
|
||||||
|
|
||||||
# @api.constrains('name')
|
# @api.constrains('name')
|
||||||
# def _check_name(self):
|
# def _check_name(self):
|
||||||
|
|||||||
@@ -130,7 +130,7 @@
|
|||||||
attrs="{'invisible': ['|',('state', '!=', 'rework') ,('programming_state', '!=', '已编程')]}"/>
|
attrs="{'invisible': ['|',('state', '!=', 'rework') ,('programming_state', '!=', '已编程')]}"/>
|
||||||
<button name="button_scrap_new" string="报废" type="object"
|
<button name="button_scrap_new" string="报废" type="object"
|
||||||
groups="sf_base.group_sf_mrp_user"
|
groups="sf_base.group_sf_mrp_user"
|
||||||
attrs="{'invisible': [('is_scrap', '=', False)]}"/>
|
attrs="{'invisible': ['|',('is_scrap', '=', False),('state','=','cancel')]}"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="(//header//button[@name='button_mark_done'])[3]" position="replace">
|
<xpath expr="(//header//button[@name='button_mark_done'])[3]" position="replace">
|
||||||
<button name="button_mark_done" attrs="{'invisible': [
|
<button name="button_mark_done" attrs="{'invisible': [
|
||||||
|
|||||||
@@ -20,6 +20,11 @@ class ProductionWizard(models.TransientModel):
|
|||||||
('已下发', '已下发')],
|
('已下发', '已下发')],
|
||||||
string='编程状态')
|
string='编程状态')
|
||||||
|
|
||||||
|
@api.onchange('is_remanufacture')
|
||||||
|
def _onchange_is_reprogramming(self):
|
||||||
|
if self.is_remanufacture is False:
|
||||||
|
self.is_reprogramming = False
|
||||||
|
|
||||||
def confirm(self):
|
def confirm(self):
|
||||||
self.production_id.action_cancel()
|
self.production_id.action_cancel()
|
||||||
self.production_id.detection_result_ids.write({'handle_result': '已处理'})
|
self.production_id.detection_result_ids.write({'handle_result': '已处理'})
|
||||||
|
|||||||
@@ -10,7 +10,8 @@
|
|||||||
<attribute name="groups">sf_base.group_sale_salemanager,sf_base.group_sale_director</attribute>
|
<attribute name="groups">sf_base.group_sale_salemanager,sf_base.group_sale_director</attribute>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//button[@name='action_view_mrp_production']" position="attributes">
|
<xpath expr="//button[@name='action_view_mrp_production']" position="attributes">
|
||||||
<attribute name="groups">mrp.group_mrp_user,sf_base.group_sale_salemanager,sf_base.group_sale_director
|
<attribute name="groups">
|
||||||
|
mrp.group_mrp_user,sf_base.group_sale_salemanager,sf_base.group_sale_director
|
||||||
</attribute>
|
</attribute>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//field[@name='user_id']" position="replace">
|
<xpath expr="//field[@name='user_id']" position="replace">
|
||||||
@@ -42,12 +43,12 @@
|
|||||||
<xpath expr="//form/header/button[@name='action_confirm'][2]" position="replace">
|
<xpath expr="//form/header/button[@name='action_confirm'][2]" position="replace">
|
||||||
<button name="action_confirm" data-hotkey="v"
|
<button name="action_confirm" data-hotkey="v"
|
||||||
string="确认接单" type="object" context="{'validate_analytic': True}"
|
string="确认接单" type="object" context="{'validate_analytic': True}"
|
||||||
attrs="{'invisible': ['|','&','|',('check_status', '!=', 'approved'),('state', 'in', ['draft','cancel']),'&','&',('check_status', '=', 'approved'),('state', 'in', ['sale','cancel']),('delivery_status', '!=', False),('state', 'in', ['cancel'])]}"/>
|
attrs="{'invisible': ['|', ('state', 'in', ['cancel']), '|','&',('check_status', '!=', 'approved'),('state', 'in', ['draft','cancel']),'&','&',('check_status', '=', 'approved'),('state', 'in', ['sale','cancel']),('delivery_status', '!=', False)]}"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//form/header/button[@name='action_cancel']" position="attributes">
|
<xpath expr="//form/header/button[@name='action_cancel']" position="attributes">
|
||||||
<attribute name="attrs">{'invisible': ['|','&','|', ('check_status', '!=', 'approved'),('state',
|
<attribute name="attrs">{'invisible': ['|', ('state', 'in', ['cancel']), '|','&',
|
||||||
'in', ['draft','cancel']),'&','&',('check_status', '=', 'approved'),('state', 'in',
|
('check_status', '!=', 'approved'),('state', 'in', ['draft','cancel']),'&','&',('check_status',
|
||||||
['sale','cancel']),('delivery_status', '!=', False), ('state', 'in', ['cancel'])]}
|
'=', 'approved'),('state', 'in', ['sale','cancel']),('delivery_status', '!=', False)]}
|
||||||
</attribute>
|
</attribute>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//form/header/button[@name='action_draft']" position="attributes">
|
<xpath expr="//form/header/button[@name='action_draft']" position="attributes">
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ class MrsShelfLocationDataSync(models.Model):
|
|||||||
total_data = self.get_total_data()
|
total_data = self.get_total_data()
|
||||||
print('shelfinfo:', shelfinfo)
|
print('shelfinfo:', shelfinfo)
|
||||||
for item in shelfinfo:
|
for item in shelfinfo:
|
||||||
|
logging.info('货架已获取信息:%s' % item)
|
||||||
shelf_barcode = self.find_our_code(total_data, item['Postion'])
|
shelf_barcode = self.find_our_code(total_data, item['Postion'])
|
||||||
location_id = self.env['sf.shelf.location'].search([('barcode', '=', shelf_barcode)], limit=1)
|
location_id = self.env['sf.shelf.location'].search([('barcode', '=', shelf_barcode)], limit=1)
|
||||||
if location_id:
|
if location_id:
|
||||||
@@ -121,14 +122,15 @@ class MrsShelfLocationDataSync(models.Model):
|
|||||||
if tool:
|
if tool:
|
||||||
location_id.product_sn_id = tool.barcode_id.id
|
location_id.product_sn_id = tool.barcode_id.id
|
||||||
# 修改功能刀具状态
|
# 修改功能刀具状态
|
||||||
tool_state = {'Nomal': '正常', 'Warning': '报警'}
|
if item.get('State') == '报警':
|
||||||
if tool_state.get(item.get('State')):
|
if tool.functional_tool_status != item.get('State'):
|
||||||
if tool_state.get(item.get('State')) != tool.functional_tool_status:
|
|
||||||
tool.write({
|
tool.write({
|
||||||
'functional_tool_status': tool_state.get(item['State'])
|
'functional_tool_status': item['State']
|
||||||
})
|
})
|
||||||
else:
|
else:
|
||||||
location_id.product_sn_id = False
|
location_id.product_sn_id = False
|
||||||
|
if item['RfidCode']:
|
||||||
|
logging.info('Rfid为【%s】的功能刀具在系统中不存在!' % item['RfidCode'])
|
||||||
else:
|
else:
|
||||||
stock_lot_obj = self.env['stock.lot'].search([('rfid', '=', item['RfidCode'])], limit=1)
|
stock_lot_obj = self.env['stock.lot'].search([('rfid', '=', item['RfidCode'])], limit=1)
|
||||||
if stock_lot_obj:
|
if stock_lot_obj:
|
||||||
@@ -136,7 +138,6 @@ class MrsShelfLocationDataSync(models.Model):
|
|||||||
else:
|
else:
|
||||||
location_id.product_sn_id = False
|
location_id.product_sn_id = False
|
||||||
|
|
||||||
logging.info('货架已获取信息:%s' % item)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.info("捕获错误信息:%s" % e)
|
logging.info("捕获错误信息:%s" % e)
|
||||||
raise ValidationError("数据错误导致同步失败,请联系管理员")
|
raise ValidationError("数据错误导致同步失败,请联系管理员")
|
||||||
|
|||||||
Reference in New Issue
Block a user