123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369 |
- Ext.define('make.view.make.bom.FormPanel', {
- extend: 'saas.view.core.form.FormPanel',
- xtype: ['make-bom-formpanel', 'bom-formpanel'],
- controller: 'make-bom-formpanel',
- viewModel: 'make-bom-formpanel',
- viewName: 'make-bom-formpanel',
- caller: 'Bom',
- //字段属性
- _title: 'BOM',
- _idField: 'id',
- _codeField: 'bo_code',
- _statusField: 'bo_status',
- _statusCodeField: 'bo_statuscode',
- _auditmanField: 'bo_auditman',
- _auditdateField: 'bo_auditdate',
- _relationColumn: 'bd_boid',
- _readUrl: '/api/make/bom/read',
- _saveUrl: '/api/make/bom/save',
- _auditUrl: '/api/make/bom/audit',
- _unAuditUrl: '/api/make/bom/unAudit',
- _deleteUrl: '/api/make/bom/delete',
- initId: 0,
- initComponent: function () {
- var me = this;
- Ext.apply(this, {
- toolBtns: [{
- xtype: 'button',
- text: '展开',
- hidden: true,
- bind: {
- hidden: '{bo_statuscode == "UNAUDITED"}'
- },
- handler: 'bomStruct'
- }, {
- xtype: 'button',
- text: 'BOM变更',
- handler:'modifyBomDetail',
- bind: {
- hidden: '{bo_statuscode != "AUDITED"}'
- }
- },{
- xtype: 'button',
- text: '变更记录',
- bind: {
- hidden: '{bo_statuscode != "AUDITED"}'
- },
- handler: function(){
- var bomStructDialog = me.add(
- Ext.widget('make-bom-bomecndetailwin', {
- height: '65%',
- width: '70%',
- title: 'BOM变更',
- closable: true,
- modal: true,
- resizable:false,
- initId: this.ownerCt.ownerCt.initId
- })
- )
- bomStructDialog.show();
- }
- }],
- defaultItems: [{
- xtype: 'hidden',
- name: 'id',
- fieldLabel: 'id',
- allowBlank: true,
- columnWidth: 0
- }, {
- xtype: "productMDbfindTrigger",
- name: "bo_mothercode",
- fieldLabel: "产品编号",
- allowBlank: false,
- },{
- xtype: "hidden",
- name: "bo_motherid",
- fieldLabel: "产品ID",
- },{
- xtype: "textfield",
- name: "bo_mothername",
- fieldLabel: "产品名称",
- readOnly:true
- },{
- xtype: 'tipTextfield',
- name: "pr_orispeccode",
- fieldLabel: "产品型号",
- editable: false,
- ignore: true,
- bind:{
- otherInfoTip:'厂家/品牌:{pr_brand}<br>产品规格:{pr_spec}'
- }
- },{
- xtype: "textfield",
- name: "pr_unit",
- fieldLabel: "单位",
- readOnly:true,
- ignore: true
- },{
- xtype: "textfield",
- name: "pr_spec",
- fieldLabel: "规格",
- readOnly:true,
- hidden:true,
- ignore: true,
- maxLength: 200,
- },{
- xtype: "textfield",
- name: "pr_brand",
- fieldLabel: "厂家/品牌",
- readOnly:true,
- hidden:true,
- ignore: true
- },{
- xtype: "textfield",
- name: "bo_version",
- fieldLabel: "版本号"
- },{
- xtype: 'remotecombo',
- storeUrl: '/api/document/workcenter/getCombo',
- name: "bo_wcname",
- fieldLabel: "工作中心",
- allowBlank: false,
- addHandler: function (b) {
- var form = this.ownerCmp.ownerCt;
- this.dialog = form.add({
- xtype: 'document-workcenter-window',
- bind: {
- title: '新增工作中心'
- },
- dataKind: 'workcenter',
- _parent: form,
- _combo: this.ownerCmp,
- record: null,
- session: true
- });
- this.dialog.show();
- },
- editHandler:function(btn,type){
- saas.util.BaseUtil.openTab('document-workcenter-datalist', '工作中心','maintab--document-workcenter-datalist');
- var combo = btn.ownerCt.up('remotecombo');
- if(combo){
- combo.collapse();
- }
- }
- },{
- name: "detailGridField",
- xtype: "detailGridField",
- storeModel: 'make.model.make.BomDetail',
- deleteDetailUrl: '/api/make/bom/deleteDetail',
- /*relativeBinds:{
- refFields:['bd_sonid'],
- fields:['bd_soncode','pr_detail','pr_unit','pr_spec','pr_brand','pr_orispeccode']
- },*/
- detnoColumn: 'bd_detno',
- columns: [{
- text: "id",
- dataIndex: "id",
- xtype: "numbercolumn",
- hidden: true
- }, {
- text: "物料id",
- dataIndex: "bd_sonid",
- xtype: "numbercolumn",
- hidden: true
- },{
- text: "物料编号",
- xtype: 'buttoncolumn',
- tdCls: 'report-item',
- width: 150,
- dataIndex: "bd_soncode",
- items: null,
- allowBlank: false,
- editor: {
- displayField: "display",
- editable: true,
- format: "",
- hideTrigger: false,
- maxLength: 100,
- minValue: null,
- positiveNum: false,
- queryMode: "local",
- store: null,
- valueField: "value",
- xtype: "productMultiDbfindTrigger"
- },
- renderer: function (value, meta, record) {
- var view = this.up('[viewName="make-bom-formpanel"]'),
- vm = view.getViewModel();
- if(vm && vm.get('bo_statuscode') == 'AUDITED'){
- return `<div class="report-item-action"><span>${value}</span><span class="x-fa fa-edit fa-fw"></span></div>`;
- }
- return value;
- },
- handler: 'modifyBomDetail2',
- }, {
- text: "物料名称",
- width: 150.0,
- dataIndex: "pr_detail",
- ignore: true,
- editor: {
- displayField: "display",
- editable: true,
- format: "",
- hideTrigger: false,
- maxLength: 100.0,
- minValue: null,
- positiveNum: false,
- queryMode: "local",
- store: null,
- valueField: "value",
- xtype: "productMultiDbfindTrigger"
- },
- renderer: function (v, m, r) {
- if (!v) {
- return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
- }
- return v;
- }
- }, {
- text: "厂家/品牌",
- hidden:true,
- width: 100.0,
- dataIndex: "pr_brand",
- ignore: true,
- renderer: function (v, m, r) {
- if (!v) {
- return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
- }
- return v;
- }
- }, {
- text: "型号",
- width: 200,
- dataIndex: "pr_orispeccode",
- ignore: true,
- renderer: saas.util.RenderUtil['renderer_prod']
- }, {
- text: "单位",
- width: 65.0,
- dataIndex: "pr_unit",
- ignore: true,
- renderer: function (v, m, r) {
- if (!v) {
- return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
- }
- return v;
- }
- },{
- text: "标准用量",
- dataIndex: "bd_baseqty",
- xtype: 'numbercolumn',
- width: 110.0,
- allowBlank: false,
- editor: {
- xtype: "numberfield",
- decimalPrecision: 6,
- minValue: 0
- },
- renderer: function(v, m, r) {
- return saas.util.BaseUtil.numberFormat(v, 6, true);
- }
- }, {
- text: "位号",
- dataIndex: "bd_location",
- editor: {
- xtype: "textfield"
- },
- width: 250,
- },{
- text: "备注",
- dataIndex: "bd_remark",
- editor: {
- xtype: "textfield"
- },
- width: 250,
- },{
- text: "规格",
- hidden:true,
- width: 200,
- dataIndex: "pr_spec",
- ignore: true,
- renderer: function (v, m, r) {
- if (!v) {
- return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
- }
- return v;
- }
- },{
- text: '标准损耗(%)',
- dataIndex: 'pr_lossrate',
- width: 100,
- ignore: true,
- xtype: 'numbercolumn',
- renderer : function(v, m, r) {
- return saas.util.BaseUtil.numberFormat(v, 2, true);
- },
- },{
- text: 'model映射需要',
- dataIndex: 'productDTO',
- hidden: true,
- }]
- }, {
- xtype: "textfield",
- name: "bo_remark",
- fieldLabel: "备注",
- columnWidth: 1
- },{
- xtype: "hidden",
- name: "creatorId",
- fieldLabel: "录入人ID",
- readOnly: true
- }, {
- xtype: "textfield",
- name: "creatorName",
- fieldLabel: "录入人",
- readOnly: true,
- }, {
- xtype: "datefield",
- name: "createTime",
- fieldLabel: "单据日期",
- readOnly: true,
- defaultValue: new Date()
- }, {
- xtype: "hidden",
- name: "updaterId",
- fieldLabel: "更新人ID",
- readOnly: true
- }, {
- xtype: "hidden",
- name: "updaterName",
- fieldLabel: "更新人",
- readOnly: true
- }, {
- xtype: "hidden",
- name: "updateTime",
- fieldLabel: "更新日期",
- readOnly: true,
- defaultValue: new Date()
- }, {
- xtype: "textfield",
- name: "bo_auditman",
- fieldLabel: "审核人",
- readOnly: true
- }, {
- xtype: "hidden",
- name: "bo_auditdate",
- fieldLabel: "审核日期",
- readOnly: true
- }],
- });
- this.callParent(arguments);
- },
- beforeAudit: function () {
- var me = this,
- viewModel = me.getViewModel(),
- grid = me.down('detailGridField'),
- data = grid.getTrueData();
- Ext.Array.each(data, function (item) {
- if (item.pd_orderprice == 0) {
- // saas.util.BaseUtil.showErrorToast(item.pd_pdno + '行' + item.pd_prodcode + '物料单价为0');
- }
- });
- return true;
- }
- });
|