Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/优化货架货位-新增打印条码
This commit is contained in:
@@ -364,6 +364,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
y7 = self.Y7_axis
|
||||
y8 = self.Y8_axis
|
||||
z1 = self.Z9_axis
|
||||
z2 = self.Z10_axis
|
||||
x0 = ((x3 - x4) * (x2 * y1 - x1 * y2) - (x1 - x2) * (x4 * y3 - x3 * y4)) / (
|
||||
(x3 - x4) * (y1 - y2) - (x1 - x2) * (y3 - y4))
|
||||
y0 = ((y3 - y4) * (y2 * x1 - y1 * x2) - (y1 - y2) * (y4 * x3 - y3 * x4)) / (
|
||||
@@ -374,7 +375,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
(y7 - y8) * (x5 - x6) - (y5 - y6) * (x7 - x8))
|
||||
x = (x0 + x1) / 2
|
||||
y = (y0 + y1) / 2
|
||||
z = z1 / 2
|
||||
z = (z1 + z2) / 2
|
||||
|
||||
jd = math.atan2((x5 - x6), (y5 - y6))
|
||||
jdz = jd * 180 / math.pi
|
||||
@@ -992,6 +993,7 @@ class SfWorkOrderBarcodes(models.Model):
|
||||
work_state = {'done': '已完工'}
|
||||
raise UserError('装夹%s,请勿重复扫码' % work_state.get(workorder.state))
|
||||
lots = self.env['stock.lot'].sudo().search([('rfid', '=', barcode)])
|
||||
logging.info("托盘信息:%s" % lots)
|
||||
if lots:
|
||||
for lot in lots:
|
||||
if lot.product_id.categ_type == '夹具':
|
||||
@@ -1010,6 +1012,7 @@ class SfWorkOrderBarcodes(models.Model):
|
||||
if workorder_rfid:
|
||||
for item in workorder_rfid:
|
||||
item.write({'rfid_code': barcode})
|
||||
logging.info("Rfid绑定成功!!!")
|
||||
else:
|
||||
embryo_stock_lot = self.env['stock.lot'].search([('name', '=', barcode)])
|
||||
if embryo_stock_lot:
|
||||
@@ -1043,7 +1046,7 @@ class SfWorkOrderBarcodes(models.Model):
|
||||
for item in workorder_rfid:
|
||||
if item.state == "progress":
|
||||
item.write({'rfid_code': barcode})
|
||||
raise UserError('该托盘信息不存在!!!')
|
||||
# raise UserError('该托盘信息不存在!!!')
|
||||
# stock_move_line = self.env['stock.move.line'].search([('lot_name', '=', barcode)])
|
||||
# if stock_move_line.product_id.categ_type == '夹具':
|
||||
# workorder.write({
|
||||
|
||||
@@ -591,6 +591,7 @@ class MachineBrand(models.Model):
|
||||
if not brand:
|
||||
self.create({
|
||||
"name": item['name'],
|
||||
"active": item['active'],
|
||||
"code": item['code'],
|
||||
"remark": item['remark'],
|
||||
"image_brand": '' if not item['image_brand'] else base64.b64decode(item['image_brand']),
|
||||
@@ -599,6 +600,7 @@ class MachineBrand(models.Model):
|
||||
})
|
||||
else:
|
||||
brand.name = item['name']
|
||||
brand.active = item['active']
|
||||
brand.remark = item['remark']
|
||||
brand.image_brand = '' if not item['image_brand'] else base64.b64decode(item['image_brand'])
|
||||
brand.tag_ids = self.env['sf.machine.brand.tags'].search(
|
||||
|
||||
@@ -227,6 +227,7 @@ class SfShelf(models.Model):
|
||||
_order = 'create_date desc'
|
||||
|
||||
name = fields.Char('货架名称', required=True, size=20)
|
||||
active = fields.Boolean("有效", default=True)
|
||||
barcode = fields.Char('编码', copy=False, size=15, required=True)
|
||||
|
||||
# 货位
|
||||
@@ -335,6 +336,7 @@ class ShelfLocation(models.Model):
|
||||
_name = 'sf.shelf.location'
|
||||
_inherit = ['printing.utils']
|
||||
_description = '货位'
|
||||
_rec_name = 'barcode'
|
||||
_order = 'id asc, create_date asc'
|
||||
|
||||
# current_location_id = fields.Many2one('sf.shelf.location', string='当前位置')
|
||||
@@ -344,6 +346,7 @@ class ShelfLocation(models.Model):
|
||||
destination_move_ids = fields.One2many('stock.move.line', 'destination_location_id', '目标位置调拨单')
|
||||
storage_time = fields.Datetime('入库时间', compute='_compute_location_status')
|
||||
production_id = fields.Many2one('mrp.production', string='制造订单')
|
||||
active = fields.Boolean("有效", default=True)
|
||||
|
||||
@api.depends('location_status')
|
||||
def _compute_location_status(self):
|
||||
@@ -529,6 +532,12 @@ class Sf_stock_move_line(models.Model):
|
||||
there_is_no_sn = fields.Boolean('是否有序列号', default=False)
|
||||
|
||||
rfid = fields.Char('Rfid', readonly=True)
|
||||
rfid_barcode = fields.Char('Rfid', compute='_compute_rfid')
|
||||
|
||||
@api.depends('lot_id')
|
||||
def _compute_rfid(self):
|
||||
for item in self:
|
||||
item.rfid_barcode = item.lot_id.rfid
|
||||
|
||||
def action_revert_inventory(self):
|
||||
# 检查用户是否有执行操作的权限
|
||||
@@ -949,15 +958,27 @@ class SfProcurementGroup(models.Model):
|
||||
return res
|
||||
|
||||
|
||||
# class SfPickingType(models.Model):
|
||||
# _inherit = 'stock.picking.type'
|
||||
#
|
||||
# def _default_show_operations(self):
|
||||
# return self.user_has_groups('stock.group_production_lot,'
|
||||
# 'stock.group_stock_multi_locations,'
|
||||
# 'stock.group_tracking_lot',
|
||||
# 'sf_warehouse.group_sf_stock_user',
|
||||
# 'sf_warehouse.group_sf_stock_manager')
|
||||
|
||||
class SfPickingType(models.Model):
|
||||
_inherit = 'stock.picking.type'
|
||||
|
||||
def _default_show_operations(self):
|
||||
return self.user_has_groups('stock.group_production_lot,'
|
||||
'stock.group_stock_multi_locations,'
|
||||
'stock.group_tracking_lot',
|
||||
'sf_warehouse.group_sf_stock_user',
|
||||
'sf_warehouse.group_sf_stock_manager')
|
||||
return self.user_has_groups(
|
||||
'stock.group_production_lot,'
|
||||
'stock.group_stock_multi_locations,'
|
||||
'stock.group_tracking_lot,'
|
||||
'sf_warehouse.group_sf_stock_user,'
|
||||
'sf_warehouse.group_sf_stock_manager'
|
||||
)
|
||||
|
||||
|
||||
class CustomStockMove(models.Model):
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<field name="destination_location_id" domain="[('location_id', '=', location_dest_id_value), '|',
|
||||
('location_status', '=', '空闲'), ('product_id', '=', current_product_id), ('product_sn_id',
|
||||
'=', there_is_no_sn)]"/>
|
||||
|
||||
<field name="rfid_barcode" string="Rfid"/>
|
||||
|
||||
<!-- <field name="location_dest_id_product_type"/> -->
|
||||
<!-- <field name="location_dest_id"/> -->
|
||||
|
||||
Reference in New Issue
Block a user