Accept Merge Request #143: (feature/sf胚料序号码验证 -> develop)
Merge Request: 坯料认证判断 Created By: @龚启豪 Accepted By: @龚启豪 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/143?initial=true
This commit is contained in:
@@ -13,8 +13,8 @@
|
|||||||
'depends': ['sf_base', 'sf_sale', 'sf_dlm'],
|
'depends': ['sf_base', 'sf_sale', 'sf_dlm'],
|
||||||
'data': [
|
'data': [
|
||||||
'views/res_partner_view.xml',
|
'views/res_partner_view.xml',
|
||||||
'views/view.xml',
|
# 'views/view.xml',
|
||||||
'report/bill_report.xml',
|
# 'report/bill_report.xml',
|
||||||
],
|
],
|
||||||
'demo': [
|
'demo': [
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
from . import http
|
from . import http
|
||||||
from . import models
|
from . import models
|
||||||
from . import process_status
|
from . import process_status
|
||||||
from . import jd_eclp
|
# from . import jd_eclp
|
||||||
|
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ class FinishStatusChange(models.Model):
|
|||||||
|
|
||||||
# default_code = fields.Char(string='内部编码')
|
# default_code = fields.Char(string='内部编码')
|
||||||
|
|
||||||
def button_validate(self):
|
def button_validate1(self):
|
||||||
# Clean-up the context key at validation to avoid forcing the creation of immediate
|
# Clean-up the context key at validation to avoid forcing the creation of immediate
|
||||||
# transfers.
|
# transfers.
|
||||||
ctx = dict(self.env.context)
|
ctx = dict(self.env.context)
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
import re
|
||||||
|
|
||||||
from odoo import api, fields, models, _
|
from odoo import api, fields, models, _
|
||||||
|
|
||||||
|
|
||||||
@@ -57,11 +59,12 @@ class MrpProduction(models.Model):
|
|||||||
|
|
||||||
def action_generate_serial(self):
|
def action_generate_serial(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
|
iot_code = self.env['stock.lot']._get_next_serial(self.company_id, self.product_id) or self.env['ir.sequence'].next_by_code('stock.lot.serial')
|
||||||
|
iot_code_name = re.sub('[\u4e00-\u9fa5]', "", iot_code)
|
||||||
self.lot_producing_id = self.env['stock.lot'].create({
|
self.lot_producing_id = self.env['stock.lot'].create({
|
||||||
'product_id': self.product_id.id,
|
'product_id': self.product_id.id,
|
||||||
'company_id': self.company_id.id,
|
'company_id': self.company_id.id,
|
||||||
'name': self.env['stock.lot']._get_next_serial(self.company_id, self.product_id) or self.env[
|
'name': iot_code_name,
|
||||||
'ir.sequence'].next_by_code('stock.lot.serial'),
|
|
||||||
})
|
})
|
||||||
if self.move_finished_ids.filtered(lambda m: m.product_id == self.product_id).move_line_ids:
|
if self.move_finished_ids.filtered(lambda m: m.product_id == self.product_id).move_line_ids:
|
||||||
self.move_finished_ids.filtered(
|
self.move_finished_ids.filtered(
|
||||||
@@ -235,6 +238,7 @@ class MrpProduction(models.Model):
|
|||||||
current_sequence += 1
|
current_sequence += 1
|
||||||
if work.name == '获取CNC加工程序':
|
if work.name == '获取CNC加工程序':
|
||||||
work.button_start()
|
work.button_start()
|
||||||
|
#work.button_finish()
|
||||||
work.fetchCNC()
|
work.fetchCNC()
|
||||||
|
|
||||||
#创建工单并进行排序
|
#创建工单并进行排序
|
||||||
|
|||||||
@@ -202,10 +202,24 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
else:
|
else:
|
||||||
raise UserError('托盘码不能为空')
|
raise UserError('托盘码不能为空')
|
||||||
|
|
||||||
|
#验证坯料序列号是否正确
|
||||||
|
def pro_code_is_ok(self,barcode):
|
||||||
|
if barcode!=False:
|
||||||
|
if barcode != self.pro_code:
|
||||||
|
raise UserError('坯料序列号错误')
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return True
|
||||||
|
|
||||||
|
pro_code = fields.Char(string='坯料序列号')
|
||||||
|
|
||||||
|
pro_code_ok = fields.Boolean(default=False)
|
||||||
|
|
||||||
#托盘扫码绑定
|
#托盘扫码绑定
|
||||||
def gettray_auto(self, barcode):
|
def gettray_auto(self, barcode):
|
||||||
if barcode != False:
|
if barcode != False:
|
||||||
values = self.env['sf.tray'].search([("code", "=", barcode)])
|
values = self.env['sf.tray'].search([("code", "=", barcode)])
|
||||||
|
|
||||||
if values:
|
if values:
|
||||||
if values.state == "占用":
|
if values.state == "占用":
|
||||||
raise UserError('该托盘已占用')
|
raise UserError('该托盘已占用')
|
||||||
@@ -378,8 +392,11 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
}]
|
}]
|
||||||
return workorders_values_str
|
return workorders_values_str
|
||||||
|
|
||||||
|
|
||||||
# 重写工单开始按钮方法
|
# 重写工单开始按钮方法
|
||||||
def button_start(self):
|
def button_start(self):
|
||||||
|
if self.routing_type == '装夹':
|
||||||
|
self.pro_code = self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name
|
||||||
if self.state == 'waiting' or self.state == 'ready' or self.state == 'progress':
|
if self.state == 'waiting' or self.state == 'ready' or self.state == 'progress':
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
if any(not time.date_end for time in self.time_ids.filtered(lambda t: t.user_id.id == self.env.user.id)):
|
if any(not time.date_end for time in self.time_ids.filtered(lambda t: t.user_id.id == self.env.user.id)):
|
||||||
@@ -538,10 +555,15 @@ class SfWorkOrderBarcodes(models.Model):
|
|||||||
_inherit = ["mrp.workorder", "barcodes.barcode_events_mixin"]
|
_inherit = ["mrp.workorder", "barcodes.barcode_events_mixin"]
|
||||||
|
|
||||||
def on_barcode_scanned(self, barcode):
|
def on_barcode_scanned(self, barcode):
|
||||||
tray_code = self.env['sf.tray'].search([('code', '=', barcode)])
|
|
||||||
self.tray_code = tray_code.code
|
|
||||||
workorder = self.env['mrp.workorder'].browse(self.ids)
|
workorder = self.env['mrp.workorder'].browse(self.ids)
|
||||||
self.tray_id = workorder.gettray_auto(barcode)
|
if "*" not in barcode:
|
||||||
|
tray_code = self.env['sf.tray'].search([('code', '=', barcode)])
|
||||||
|
self.tray_code = tray_code.code
|
||||||
|
self.tray_id = workorder.gettray_auto(barcode)
|
||||||
|
else:
|
||||||
|
self.pro_code_ok = workorder.pro_code_is_ok(barcode)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# return {
|
# return {
|
||||||
# 'type': 'ir.actions.act_window',
|
# 'type': 'ir.actions.act_window',
|
||||||
|
|||||||
@@ -166,9 +166,15 @@
|
|||||||
<field name="routing_type" invisible="1"/>
|
<field name="routing_type" invisible="1"/>
|
||||||
<field name="tray_code"/>
|
<field name="tray_code"/>
|
||||||
<field name="tray_id" readonly="1"/>
|
<field name="tray_id" readonly="1"/>
|
||||||
|
|
||||||
|
|
||||||
</group>
|
</group>
|
||||||
|
<group>
|
||||||
|
<field name="pro_code" readonly="1" attrs='{"invisible": [("pro_code_ok","=",False)]}' style="color:green"/>
|
||||||
|
<field name="pro_code" readonly="1" attrs='{"invisible": [("pro_code_ok","!=",False)]}'/>
|
||||||
|
<div>
|
||||||
|
<field name="pro_code_ok" invisible="1"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</group>
|
||||||
<div class="col-12 col-lg-6 o_setting_box">
|
<div class="col-12 col-lg-6 o_setting_box">
|
||||||
<button type="object" class="oe_highlight" name="gettray" string="绑定托盘"
|
<button type="object" class="oe_highlight" name="gettray" string="绑定托盘"
|
||||||
attrs='{"invisible": ["|","|",("tray_id","!=",False),("state","!=","progress"),("production_id","=",False)]}'/>
|
attrs='{"invisible": ["|","|",("tray_id","!=",False),("state","!=","progress"),("production_id","=",False)]}'/>
|
||||||
|
|||||||
@@ -15,8 +15,7 @@
|
|||||||
attrs='{"invisible": [("production_id","=",False)]}'/>
|
attrs='{"invisible": [("production_id","=",False)]}'/>
|
||||||
<field name="workorder_id"/>
|
<field name="workorder_id"/>
|
||||||
</group>
|
</group>
|
||||||
<div class="col
|
<div class="col-12 col-lg-6 o_setting_box">
|
||||||
-12 col-lg-6 o_setting_box">
|
|
||||||
<button type="object" class="oe_highlight" name="unclamp" string="解除装夹"
|
<button type="object" class="oe_highlight" name="unclamp" string="解除装夹"
|
||||||
attrs='{"invisible": [("state","=","空闲")]}'/>
|
attrs='{"invisible": [("state","=","空闲")]}'/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user