Accept Merge Request #1108: (feature/sf物流方面缺陷与优化 -> develop)
Merge Request: Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/sf物流方面缺陷与优化 Created By: @马广威 Accepted By: @马广威 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1108?initial=true
This commit is contained in:
@@ -20,12 +20,12 @@
|
||||
<field name="button_compensation_state" attrs='{"invisible": ["|",
|
||||
("state","!=","progress"),("user_permissions","=",False)]}'/>
|
||||
<!-- <span> </span>-->
|
||||
<!-- <button name="button_send_program_again" type="object" string="重新下发NC程序"-->
|
||||
<!-- class="btn-primary"-->
|
||||
<!-- confirm="是否确认重新下发NC程序?"-->
|
||||
<!-- groups="sf_base.group_sf_order_user,sf_base.group_sf_equipment_user"-->
|
||||
<!-- attrs="{'invisible': ['|', '|', '|',('routing_type','!=','装夹预调'),('state','in',['done', 'cancel',-->
|
||||
<!-- 'progress']),('processing_drawing','=',False),('is_send_program_again','=',True)]}"/>-->
|
||||
<button name="button_send_program_again" type="object" string="重新下发NC程序"
|
||||
class="btn-primary"
|
||||
confirm="是否确认重新下发NC程序?"
|
||||
groups="sf_base.group_sf_order_user,sf_base.group_sf_equipment_user"
|
||||
attrs="{'invisible': ['|', '|', '|',('routing_type','!=','装夹预调'),('state','in',['done', 'cancel',
|
||||
'progress']),('processing_drawing','=',False),('is_send_program_again','=',True)]}"/>
|
||||
<!-- <button string="一键补偿" name="compensation" type="object" confirm="是否确认下发补偿"-->
|
||||
<!-- class="btn-primary" attrs='{"invisible": ["|",-->
|
||||
<!-- ("state","!=","progress"),("user_permissions","=",False)]}'/>-->
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<!-- attrs='{"invisible": ["|",("state","!=","progress"), -->
|
||||
<!-- ("user_permissions","!=",True)]}'/> -->
|
||||
<!-- <button string="下发" name="up" type="object" class="btn-primary" confirm="是否确认下发此程序" context="{'default_cnc_ids': cnc_ids}"/> -->
|
||||
<!-- <button string="下发" name="up" type="object" class="btn-primary" confirm="是否确认下发此程序"-->
|
||||
<button string="下发" name="up" type="object" class="btn-primary" confirm="是否确认下发此程序"
|
||||
context="{'default_sf_cnc_processing_id': id}" attrs='{"invisible": ["|",("state","!=","progress"),
|
||||
("user_permissions","!=",True)]}'/>
|
||||
<!-- <button string="下发" name="up" type="object" class="btn-primary" confirm="是否确认下发此程序"-->
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<!-- <field name="program_ids" domain="[('workorder_id', '=', workorder_id)]"/>-->
|
||||
</group>
|
||||
<footer>
|
||||
<!-- <button string="合并下发" name="confirm_up" type="object" class="btn-primary" confirm="是否确认合并下发"/>-->
|
||||
<button string="合并下发" name="confirm_up" type="object" class="btn-primary" confirm="是否确认合并下发"/>
|
||||
<button string="取消" class="btn-secondary" special="cancel"/>
|
||||
</footer>
|
||||
</form>
|
||||
|
||||
@@ -311,6 +311,14 @@ class MrpProduction(models.Model):
|
||||
# 其他规则限制: 默认只分配给工作中心状态为非故障的工作中心;
|
||||
|
||||
def _create_workorder3(self, item):
|
||||
# 根据product_id对self进行分组
|
||||
grouped_product_ids = {k: list(g) for k, g in groupby(self, key=lambda x: x.product_id.id)}
|
||||
# 初始化一个字典来存储每个product_id对应的生产订单名称列表
|
||||
product_id_to_production_names = {}
|
||||
# 对于每个product_id,获取其所有生产订单的名称
|
||||
for product_id, productions in grouped_product_ids.items():
|
||||
# 为同一个product_id创建一个生产订单名称列表
|
||||
product_id_to_production_names[product_id] = [production.name for production in productions]
|
||||
for production in self:
|
||||
if not production.bom_id or not production.product_id:
|
||||
continue
|
||||
|
||||
@@ -207,7 +207,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
[("programming", "编程"), ("clamping", "返工"), ("cutter", "刀具"), ("operate computer", "操机"),
|
||||
("technology", "工艺"), ("customer redrawing", "客户改图"), ("other", "其他"), ], string="原因", tracking=True)
|
||||
detailed_reason = fields.Text('详细原因')
|
||||
# is_send_program_again = fields.Boolean(string='是否重新下发NC程序', default=False)
|
||||
is_send_program_again = fields.Boolean(string='是否重新下发NC程序', default=False)
|
||||
|
||||
@api.onchange('rfid_code')
|
||||
def _onchange(self):
|
||||
@@ -1036,7 +1036,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
if raw_move:
|
||||
raw_move.write({'state': 'done'})
|
||||
record.production_id.button_mark_done1()
|
||||
record.production_id.state = 'done'
|
||||
# self.production_id.state = 'done'
|
||||
|
||||
# 将FTP的检测报告文件下载到临时目录
|
||||
def download_reportfile_tmp(self, workorder, reportpath):
|
||||
@@ -1079,30 +1079,31 @@ class ResMrpWorkOrder(models.Model):
|
||||
return True
|
||||
|
||||
# 重新下发nc程序
|
||||
# def button_send_program_again(self):
|
||||
# try:
|
||||
# res = {'programming_no': self.production_id.programming_no}
|
||||
# configsettings = self.env['res.config.settings'].get_values()
|
||||
# config_header = Common.get_headers(self, configsettings['token'], configsettings['sf_secret_key'])
|
||||
# url = '/api/intelligent_programming/reset_state_again'
|
||||
# config_url = configsettings['sf_url'] + url
|
||||
# r = requests.post(config_url, json=res, data=None, headers=config_header)
|
||||
# r = r.json()
|
||||
# result = json.loads(r['result'])
|
||||
# if result['status'] == 1:
|
||||
# productions = self.env['mrp.production'].search(
|
||||
# [('programming_no', '=', self.production_id.programming_no), ('programming_state', '=', '已编程')])
|
||||
# if productions:
|
||||
# workorder = productions.workorder_ids.filtered(
|
||||
# lambda ap: ap.routing_type in ['装夹预调', 'CNC加工'] and ap.state not in ['done', 'cancel',
|
||||
# 'progress'])
|
||||
# if workorder:
|
||||
# productions.write({'work_state': '编程中', 'programming_state': '编程中'})
|
||||
# else:
|
||||
# raise UserError(result['message'])
|
||||
# except Exception as e:
|
||||
# logging.info('button_send_program_again error:%s' % e)
|
||||
# raise UserError("重新下发nc程序失败,请联系管理员")
|
||||
def button_send_program_again(self):
|
||||
try:
|
||||
res = {'programming_no': self.production_id.programming_no}
|
||||
configsettings = self.env['res.config.settings'].get_values()
|
||||
config_header = Common.get_headers(self, configsettings['token'], configsettings['sf_secret_key'])
|
||||
url = '/api/intelligent_programming/reset_state_again'
|
||||
config_url = configsettings['sf_url'] + url
|
||||
r = requests.post(config_url, json=res, data=None, headers=config_header)
|
||||
r = r.json()
|
||||
result = json.loads(r['result'])
|
||||
if result['status'] == 1:
|
||||
productions = self.env['mrp.production'].search(
|
||||
[('programming_no', '=', self.production_id.programming_no), ('programming_state', '=', '已编程')])
|
||||
if productions:
|
||||
workorder = productions.workorder_ids.filtered(
|
||||
lambda ap: ap.routing_type in ['装夹预调', 'CNC加工'] and ap.state not in ['done', 'cancel',
|
||||
'progress'])
|
||||
if workorder:
|
||||
workorder.write({'is_send_program_again': True})
|
||||
productions.write({'work_state': '编程中', 'programming_state': '编程中'})
|
||||
else:
|
||||
raise UserError(result['message'])
|
||||
except Exception as e:
|
||||
logging.info('button_send_program_again error:%s' % e)
|
||||
raise UserError("重新下发nc程序失败,请联系管理员")
|
||||
|
||||
|
||||
class CNCprocessing(models.Model):
|
||||
|
||||
@@ -211,7 +211,7 @@ class StockRule(models.Model):
|
||||
'''
|
||||
# productions._create_workorder()
|
||||
#
|
||||
# self.env['stock.move'].sudo().create(productions._get_moves_finished_values())
|
||||
self.env['stock.move'].sudo().create(productions._get_moves_finished_values())
|
||||
productions.filtered(lambda p: (not p.orderpoint_id and p.move_raw_ids) or \
|
||||
(
|
||||
p.move_dest_ids.procure_method != 'make_to_order' and not
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
<field name='user_permissions' invisible="1"/>
|
||||
<field name='name' invisible="1"/>
|
||||
<field name='is_delivery' invisible="1"/>
|
||||
<!-- <field name='is_send_program_again' invisible="1"/>-->
|
||||
<field name='is_send_program_again' invisible="1"/>
|
||||
<!-- 工单form页面的开始停工按钮等 -->
|
||||
<!-- <button name="button_start" type="object" string="开始" class="btn-success" -->
|
||||
<!-- attrs="{'invisible': ['|', '|', ('production_state', 'not in', ('pending_processing', 'pending_cam', 'pending_era_cam')), ('state','!=','ready'), ('routing_type', 'not in', ('装夹预调', 'CNC加工', '解除装夹'))]}" -->
|
||||
@@ -160,11 +160,11 @@
|
||||
<!-- attrs="{'invisible': ['|', '|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '!=', 'blocked'),('state','=','done')]}"/> -->
|
||||
<button name="button_workpiece_delivery" type="object" string="工件配送" class="btn-primary"
|
||||
attrs="{'invisible': ['|','|',('routing_type','!=','装夹预调'),('is_delivery','=',True),('state','!=','done')]}"/>
|
||||
<!-- <button name="button_send_program_again" type="object" string="重新下发NC程序" class="btn-primary"-->
|
||||
<!-- confirm="是否确认重新下发NC程序?"-->
|
||||
<!-- groups="sf_base.group_sf_order_user,sf_base.group_sf_equipment_user"-->
|
||||
<!-- attrs="{'invisible': ['|', '|', '|',('routing_type','!=','装夹预调'),('state','in',['done', 'cancel',-->
|
||||
<!-- 'progress']),('cnc_worksheet','=',False),('is_send_program_again','=',True)]}"/>-->
|
||||
<button name="button_send_program_again" type="object" string="重新下发NC程序" class="btn-primary"
|
||||
confirm="是否确认重新下发NC程序?"
|
||||
groups="sf_base.group_sf_order_user,sf_base.group_sf_equipment_user"
|
||||
attrs="{'invisible': ['|', '|', '|',('routing_type','!=','装夹预调'),('state','in',['done', 'cancel',
|
||||
'progress']),('cnc_worksheet','=',False),('is_send_program_again','=',True)]}"/>
|
||||
</xpath>
|
||||
<xpath expr="//page[1]" position="before">
|
||||
<page string="开料要求" attrs='{"invisible": [("routing_type","!=","切割")]}'>
|
||||
|
||||
@@ -73,7 +73,8 @@ class Sf_Mrs_Connect(http.Controller):
|
||||
panel_file_path = os.path.join(program_path_tmp_panel, file)
|
||||
logging.info('panel_file_path:%s' % panel_file_path)
|
||||
cnc_workorder.write(
|
||||
{'cnc_ids': cnc_workorder.cnc_ids.sudo()._json_cnc_processing(panel, ret),
|
||||
{'is_send_program_again': False,
|
||||
'cnc_ids': cnc_workorder.cnc_ids.sudo()._json_cnc_processing(panel, ret),
|
||||
'cmm_ids': cnc_workorder.cmm_ids.sudo()._json_cmm_program(panel, ret),
|
||||
'cnc_worksheet': base64.b64encode(open(panel_file_path, 'rb').read())})
|
||||
pre_workorder = production.workorder_ids.filtered(
|
||||
@@ -81,7 +82,8 @@ class Sf_Mrs_Connect(http.Controller):
|
||||
'cancel'] and ap.processing_panel == panel)
|
||||
if pre_workorder:
|
||||
pre_workorder.write(
|
||||
{'processing_drawing': base64.b64encode(open(panel_file_path, 'rb').read())})
|
||||
{'is_send_program_again': False,
|
||||
'processing_drawing': base64.b64encode(open(panel_file_path, 'rb').read())})
|
||||
productions.write({'programming_state': '已编程', 'work_state': '已编程'})
|
||||
cnc_program_ids = [item.id for item in productions]
|
||||
workpiece_delivery = request.env['sf.workpiece.delivery'].sudo().search(
|
||||
|
||||
Reference in New Issue
Block a user