Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/刀具物料与夹具物料的反注册

This commit is contained in:
jinling.yang
2023-08-15 17:31:49 +08:00
110 changed files with 27374 additions and 1649 deletions

View File

@@ -46,11 +46,11 @@ class ResProductMo(models.Model):
)
brand_id = fields.Many2one('sf.machine.brand', '品牌')
manufacturer_model_number = fields.Char('厂家型号')
tool_length = fields.Integer('长度L(mm)', size=6)
tool_width = fields.Integer('宽度D(mm)', size=6)
tool_height = fields.Integer('高度T(mm)', size=6)
tool_weight = fields.Float('重量(kg)', size=4)
coating_material = fields.Char('涂层材料')
# 整体式刀具参数
cutting_tool_total_length = fields.Float('总长度(mm)')
cutting_tool_shank_length = fields.Float('柄部长度(mm)')
@@ -93,7 +93,7 @@ class ResProductMo(models.Model):
string='适用刀盘型号' # 使用空列表作为默认值
)
cutting_tool_radius = fields.Float('刀尖半径(mm)')
# 刀杆/刀盘参数
# 刀杆/参数
cutting_tool_c_diameter = fields.Float('C柄径(mm)')
cutting_tool_l_total_length = fields.Float('L总长(mm)')
cutting_tool_d_diameter = fields.Float('D刃径(mm)')
@@ -156,11 +156,6 @@ class ResProductMo(models.Model):
register_state = fields.Selection([('未注册', '未注册'), ('已注册', '已注册'),('注册失败','注册失败')], string='注册状态', default='未注册')
industry_code = fields.Char('行业编码', readonly=True)
@api.onchange('brand_id')
def _onchange_brand_id(self):
if self.brand_id:
self.manufacturer_model_number = self.brand_id.manufacturer_model_number
def _json_apply_machine_tool_type_item_code(self, item):
code_arr = []
for i in item.product_id.fixture_apply_machine_tool_type_ids:

View File

@@ -283,9 +283,9 @@ class StockPicking(models.Model):
_('该入库单对应的单号为%s的出库单还未完成,不能进行验证操作!' % picking_out.name))
res = super().button_validate()
# 采购单验证(夹具和刀具)
# 采购单验证(夹具)
for item in self.move_ids_without_package:
if item.product_id.categ_type in ['刀具', '夹具']:
if item.product_id.categ_type == '夹具':
if item.quantity_done > 0:
item._register_fixture()
return res
@@ -349,7 +349,7 @@ class ReStockMove(models.Model):
# 将采购到的夹具注册到Cloud
def _register_fixture(self):
create_url = '/api/fixture/create'
create_url = '/api/factory_fixture_material/create'
config = self.env['res.config.settings'].get_values()
headers = Common.get_headers(self, config['token'], config['sf_secret_key'])
strurl = config['sf_url'] + create_url
@@ -358,7 +358,6 @@ class ReStockMove(models.Model):
'token': config['token'],
'name': item.product_id.name,
'brand_code': self.env['sf.machine.brand'].search([('id', '=', item.product_id.brand_id.id)]).code,
'manufacturer_model_number': item.product_id.manufacturer_model_number,
'fixture_material_code': self.env['sf.fixture.material'].search(
[('id', '=', item.product_id.fixture_material_id.id)]).code,
'fixture_multi_mounting_type_code': self.env['sf.multi_mounting.type'].search(
@@ -401,3 +400,5 @@ class ReStockMove(models.Model):
item.product_id.write({'register_state': '注册失败'})
except Exception as e:
raise UserError("注册夹具到云端失败,请联系管理员!")

View File

@@ -1,20 +1,38 @@
/** @odoo-module */
import { KanbanController } from "@web/views/kanban/kanban_controller";
import { kanbanView } from "@web/views/kanban/kanban_view";
import { registry } from "@web/core/registry";
import {KanbanController} from "@web/views/kanban/kanban_controller";
import {kanbanView} from "@web/views/kanban/kanban_view";
import {registry} from "@web/core/registry";
// the controller usually contains the Layout and the renderer.
class CustomKanbanController extends KanbanController {
// Your logic here, override or insert new methods...
// if you override setup(), don't forget to call super.setup()
// if you override willStart(), don't forget to call super.willStart()
// if you override destroy(), don't forget to call super.destroy()
async setup() {
super.setup();
console.log('99999999111');
this.workOrders = await this.getAllWorkOrders();
console.log('lines', this.workOrders);
}
this.workOrdersNew = this.workOrders;
console.log('lines222222222', this.workOrders);
console.log(typeof this.workOrders);
console.log(Array.isArray(this.workOrders));
console.log(this.workOrders.every(order => typeof order === 'object' && order.id !== undefined));
// var aDiv = document.getElementsByClassName('o_kanban_record')
// for (var i = 0; i < aDiv.length; i++) {
// console.log(aDiv[i])
// }
// console.log(aDiv)
}
buttonClick(ev) {
const button = ev.currentTarget;
const id = button.getAttribute('data-id');
@@ -37,23 +55,23 @@ class CustomKanbanController extends KanbanController {
kwargs: {}
}).then((response) => {
console.log('response', response);
setTimeout(function () {
location.reload();
},2000)
location.reload();
window.onload = function () {
button.classList.add('choose')
}
});
});
}
async getAllWorkOrders() {
const response = await this.env.services.rpc('/web/dataset/call_kw',{
async getAllWorkOrders() {
const response = await this.env.services.rpc('/web/dataset/call_kw', {
model: 'sf.production.line',
method: 'search_read',
args: [],
kwargs: {},
});
// const response1 = await this.env.services.rpc('/web/dataset/call_kw',{
// model: 'mrp.workcenter',
// model: 'mrp.workcenter',
// method: 'search_read',
// args: [],
// kwargs: {},

View File

@@ -16,7 +16,12 @@
font-weight: bold;
}
.o_content > .d-flex {
display: block !important;
}
//.o_content > .d-flex {
// display: block !important;
//}

View File

@@ -4,10 +4,13 @@
<xpath expr="//t[@t-component='props.Renderer']" position="before">
<div class="choosekanban">
<!-- <t t-foreach="env['mrp.workcenter'].get_dynamic_data()" t-as="i" t-key="i"> -->
<t t-foreach="workOrders" t-as="i" t-key="i.id">
<button t-on-click="buttonClick" t-att-data-id="i.name">
<t t-esc="i.name"></t>
</button>
<!-- <t t-foreach="workOrders" t-as="i" t-key="i.id"> -->
<t t-if="workOrders">
<t t-foreach="workOrders" t-as="i" t-key="i.id">
<button t-on-click="buttonClick" t-att-data-id="i.name">
<t t-esc="i.name"></t>
</button>
</t>
</t>
</div>
</xpath>