Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/new

This commit is contained in:
jinling.yang
2024-07-30 14:37:19 +08:00
8 changed files with 8288 additions and 77189 deletions

View File

@@ -149,7 +149,7 @@ class JdEclp(models.Model):
}, },
} }
_logger.info('准备调接口1') _logger.info('准备调接口1')
url1 = config['bfm_url'] + '/api/create/jd/order' url1 = config['bfm_url_new'] + '/api/create/jd/order'
requests.post(url1, json=json1, data=None) requests.post(url1, json=json1, data=None)
_logger.info('调用成功1') _logger.info('调用成功1')
_logger.info('准备调接口2') _logger.info('准备调接口2')
@@ -158,7 +158,7 @@ class JdEclp(models.Model):
'orderNo': self.origin, 'orderNo': self.origin,
}, },
} }
url2 = config['bfm_url'] + '/api/get/jd/no' url2 = config['bfm_url_new'] + '/api/get/jd/no'
response = requests.post(url2, json=json2, data=None) response = requests.post(url2, json=json2, data=None)
# _logger.info('调用成功2', response.json()['result']['wbNo']) # _logger.info('调用成功2', response.json()['result']['wbNo'])
tem_ret = response.json().get('result') tem_ret = response.json().get('result')
@@ -196,7 +196,7 @@ class JdEclp(models.Model):
'no': self.origin, 'no': self.origin,
}, },
} }
url1 = config['bfm_url'] + '/api/create/jd/bill' url1 = config['bfm_url_new'] + '/api/create/jd/bill'
response = requests.post(url1, json=json1, data=None) response = requests.post(url1, json=json1, data=None)
# _logger.info('调用成功2', response.json()) # _logger.info('调用成功2', response.json())

View File

@@ -30,7 +30,7 @@ class StatusChange(models.Model):
'process_start_time': process_start_time, 'process_start_time': process_start_time,
}, },
} }
url1 = config['bfm_url'] + '/api/get/state/get_order' url1 = config['bfm_url_new'] + '/api/get/state/get_order'
requests.post(url1, json=json1, data=None) requests.post(url1, json=json1, data=None)
logging.info('接口已经执行=============') logging.info('接口已经执行=============')
@@ -54,7 +54,7 @@ class StatusChange(models.Model):
'state': '待派单', 'state': '待派单',
}, },
} }
url1 = config['bfm_url'] + '/api/get/state/cancel_order' url1 = config['bfm_url_new'] + '/api/get/state/cancel_order'
requests.post(url1, json=json1, data=None) requests.post(url1, json=json1, data=None)
return res return res

View File

@@ -8,11 +8,14 @@ _logger = logging.getLogger(__name__)
class ResBFMConfigSettings(models.TransientModel): class ResBFMConfigSettings(models.TransientModel):
_inherit = 'res.config.settings' _inherit = 'res.config.settings'
bfm_url = fields.Selection( # bfm_url = fields.Selection(
[("https://bfm.cs.jikimo.com", "开发环境(https://bfm.cs.jikimo.com)"), # [("https://bfm.cs.jikimo.com", "开发环境(https://bfm.cs.jikimo.com)"),
("https://bfm.t.jikimo.com", "测试环境(https://bfm.t.jikimo.com)"), # ("https://bfm.t.jikimo.com", "测试环境(https://bfm.t.jikimo.com)"),
# ("正式环境", "https://bfm.jikimo.com")], string='bfm环境', store=True) # ("https://bfm.r.jikimo.com", "预发布环境(https://bfm.r.jikimo.com)"),
("https://bfm.jikimo.com", "正式环境(https://bfm.jikimo.com)")], string='bfm环境', store=True) # # ("正式环境", "https://bfm.jikimo.com")], string='bfm环境', store=True)
# ("https://bfm.jikimo.com", "正式环境(https://bfm.jikimo.com)")], string='bfm环境', store=True)
bfm_url_new = fields.Char('业务平台环境路径', placeholder='请输入当前对应的业务平台环境路径')
@api.model @api.model
def get_values(self): def get_values(self):
@@ -22,14 +25,14 @@ class ResBFMConfigSettings(models.TransientModel):
""" """
values = super(ResBFMConfigSettings, self).get_values() values = super(ResBFMConfigSettings, self).get_values()
config = self.env['ir.config_parameter'].sudo() config = self.env['ir.config_parameter'].sudo()
bfm_url = config.get_param('bfm_url', default='') bfm_url_new = config.get_param('bfm_url_new', default='')
values.update( values.update(
bfm_url=bfm_url, bfm_url_new=bfm_url_new,
) )
return values return values
def set_values(self): def set_values(self):
super(ResBFMConfigSettings, self).set_values() super(ResBFMConfigSettings, self).set_values()
ir_config = self.env['ir.config_parameter'].sudo() ir_config = self.env['ir.config_parameter'].sudo()
ir_config.set_param("bfm_url", self.bfm_url or "") ir_config.set_param("bfm_url_new", self.bfm_url_new or "")

View File

@@ -14,8 +14,8 @@
<div class="o_setting_left_pane"/> <div class="o_setting_left_pane"/>
<div class="o_setting_right_pane"> <div class="o_setting_right_pane">
<div class="text-muted"> <div class="text-muted">
<label for="bfm_url" /> <label for="bfm_url_new" />
<field name="bfm_url" string="访问地址"/> <field name="bfm_url_new" string="业务平台访问地址"/>
</div> </div>
</div> </div>
<!-- </div> --> <!-- </div> -->

View File

@@ -910,39 +910,40 @@ class ResMrpWorkOrder(models.Model):
# if workorder.state not in ['cancel', 'rework']: # if workorder.state not in ['cancel', 'rework']:
# workorder.state = 'rework' # workorder.state = 'rework'
if workorder.routing_type == '装夹预调' and workorder.state in ['waiting', 'ready', 'pending']: if workorder.routing_type == '装夹预调' and workorder.state in ['waiting', 'ready', 'pending']:
# 当工单对应制造订单的功能刀具状态为 【无效刀】时,先对的第一个装夹预调工单状态设置为 【等待组件】 if workorder.production_id.programming_state == '已编程':
if workorder.production_id.tool_state in ['1', '2']: # 当工单对应制造订单的功能刀具状态为 【无效刀】时,先对的第一个装夹预调工单状态设置为 【等待组件】
if workorder.state in ['ready']: if workorder.production_id.tool_state in ['1', '2']:
workorder.state = 'waiting' if workorder.state in ['ready']:
continue workorder.state = 'waiting'
elif workorder.state in ['waiting']: continue
continue elif workorder.state in ['waiting']:
elif workorder.state == 'pending' and workorder == self.search( continue
[('production_id', '=', workorder.production_id.id), elif workorder.state == 'pending' and workorder == self.search(
('routing_type', '=', '装夹预调'),
('state', 'not in', ['rework', 'done', 'cancel'])],
limit=1,
order="sequence"):
workorder.state = 'waiting'
continue
elif workorder.production_id.tool_state in ['0']:
if workorder.production_id.workorder_ids.filtered(lambda a: a.state == 'rework'):
if not workorder.production_id.workorder_ids.filtered(
lambda a: (a.routing_type not in ['装夹预调'] and
a.state not in ['pending', 'done', 'rework', 'cancel'])):
# 查询工序最小的非完工、非返工的装夹预调工单
work_id = self.search(
[('production_id', '=', workorder.production_id.id), [('production_id', '=', workorder.production_id.id),
('routing_type', '=', '装夹预调'), ('routing_type', '=', '装夹预调'),
('state', 'not in', ['rework', 'done', 'cancel'])], ('state', 'not in', ['rework', 'done', 'cancel'])],
limit=1, limit=1,
order="sequence") order="sequence"):
if workorder == work_id: workorder.state = 'waiting'
if workorder.production_id.reservation_state == 'assigned': continue
workorder.state = 'ready' elif workorder.production_id.tool_state in ['0']:
elif workorder.production_id.reservation_state != 'assigned': if workorder.production_id.workorder_ids.filtered(lambda a: a.state == 'rework'):
workorder.state = 'waiting' if not workorder.production_id.workorder_ids.filtered(
continue lambda a: (a.routing_type not in ['装夹预调'] and
a.state not in ['pending', 'done', 'rework', 'cancel'])):
# 查询工序最小的非完工、非返工的装夹预调工单
work_id = self.search(
[('production_id', '=', workorder.production_id.id),
('routing_type', '=', '装夹预调'),
('state', 'not in', ['rework', 'done', 'cancel'])],
limit=1,
order="sequence")
if workorder == work_id:
if workorder.production_id.reservation_state == 'assigned':
workorder.state = 'ready'
elif workorder.production_id.reservation_state != 'assigned':
workorder.state = 'waiting'
continue
logging.info('工序:%s' % workorder.sequence) logging.info('工序:%s' % workorder.sequence)
logging.info('工单最终状态:%s' % workorder.state) logging.info('工单最终状态:%s' % workorder.state)

File diff suppressed because it is too large Load Diff

View File

@@ -158,7 +158,7 @@ class QuickEasyOrder(models.Model):
payload = { payload = {
'file_path': new_file_path, 'file_path': new_file_path,
'dest_path': new_folder_path, 'dest_path': new_folder_path,
'back_url': config['bfm_url'] 'back_url': config['bfm_url_new']
} }
response = requests.post(url, json=payload, headers=headers) response = requests.post(url, json=payload, headers=headers)
if response.status_code == 200: if response.status_code == 200:

View File

@@ -1,6 +1,6 @@
import logging import logging
from datetime import timedelta, datetime from datetime import timedelta, datetime, date
from odoo import fields, models, api from odoo import fields, models, api
from odoo.exceptions import ValidationError from odoo.exceptions import ValidationError
@@ -867,7 +867,7 @@ class StockPicking(models.Model):
picking_id.button_validate() picking_id.button_validate()
def _get_name_stock1(self, picking_type_id): def _get_name_stock1(self, picking_type_id):
name = picking_type_id.sequence_id.prefix name = f'{picking_type_id.sequence_id.prefix}DJ/{date.today().strftime("%y")}'
stock_id = self.env['stock.picking'].sudo().search( stock_id = self.env['stock.picking'].sudo().search(
[('name', 'like', name), ('picking_type_id', '=', picking_type_id.id)], [('name', 'like', name), ('picking_type_id', '=', picking_type_id.id)],
limit=1, limit=1,