Ext.define('saas.view.stock.make.FormPanel', { extend: 'saas.view.core.form.FormPanel', xtype: 'stock-make-formpanel', controller: 'stock-make-formpanel', viewModel: 'stock-make-formpanel', viewName: 'stock-make-formpanel', caller: 'Make', //字段属性 _title: '制造单', _idField: 'id', _codeField: 'ma_code', _statusField: 'ma_status', _statusCodeField: 'ma_statuscode', _auditmanField: 'ma_auditman', _auditdateField: 'ma_auditdate', _relationColumn: 'mm_maid', _readUrl: '/api/storage/make/read', _saveUrl: '/api/storage/make/save', _auditUrl: '/api/storage/make/audit', _unAuditUrl: '/api/storage/make/unAudit', _deleteUrl: '/api/storage/make/delete', _getBomUrl: '/api/document/bom/read', initId: 0, toolBtns: [], initComponent: function () { Ext.apply(this, { defaultItems: [{ xtype: 'hidden', name: 'id', fieldLabel: 'id', columnWidth: 0 }, { xtype: 'combobox', name: 'ma_type', allowBlank: false, columnWidth: 0.25, fieldLabel: '类型', queryMode: 'local', displayField: 'name', valueField: 'value', editable: false, allowBlank: false, store: Ext.create('Ext.data.ArrayStore', { fields: ['name', 'value'], data: [ ["拆件", "拆件"], ["组装", "组装"], ] }) }, { xtype: 'hidden', name: 'ma_prodid', fieldLabel: '产品id' }, { xtype: "bomDbfindTrigger", name: "ma_prodcode", fieldLabel: "产品编号", allowBlank: false, columnWidth: 0.25 }, { xtype: "textfield", name: "ma_proddetail", fieldLabel: "产品名称", readOnly: true, columnWidth: 0.25 }, { xtype: "textfield", name: "ma_prodorispec", fieldLabel: "产品型号", readOnly: true, columnWidth: 0.25, }, { xtype: "textfield", name: "ma_prodspec", fieldLabel: "产品规格", readOnly: true, columnWidth: 0.25, }, { xtype: "textfield", name: "ma_produnit", fieldLabel: "单位", readOnly: true, columnWidth: 0.25 }, { xtype: "textfield", name: "ma_version", fieldLabel: "版本号", readOnly: true, columnWidth: 0.25 }, { xtype: "numberfield", name: "ma_qty", fieldLabel: "数量", columnWidth: 0.25, allowBlank: false, decimalPrecision: 3, vtype: 'positiveNumber', }, { xtype: "hidden", name: "ma_whid", fieldLabel: "仓库id" }, { xtype: "hidden", name: "ma_whcode", fieldLabel: "仓库编号" }, { xtype: "warehouseDbfindTrigger", name: "ma_whname", fieldLabel: "仓库", allowBlank: false, columnWidth: 0.25 }, { xtype: "numberfield", name: "ma_price", fieldLabel: "单价(元)", readOnly: true, editable: false, decimalPrecision: 4, columnWidth: 0.25 }, { xtype: "numberfield", name: "ma_total", readOnly: true, editable: false, fieldLabel: "金额(元)", decimalPrecision: 2, thousandSeparator: ',', columnWidth: 0.25 }, { name: "detailGridField", xtype: "detailGridField", storeModel: 'saas.model.stock.Makematerial', detnoColumn: 'mm_detno', deleteDetailUrl: '/api/storage/make/deleteDetail', columns: [{ text: "id", dataIndex: "id", xtype: "numbercolumn", hidden: true }, { text: "mm_prodidid", dataIndex: "mm_prodid", xtype: "numbercolumn", hidden: true }, { text: "物料编号", width: 150.0, dataIndex: "mm_prodcode", allowBlank: false, xtype: "", items: null, editor: { displayField: "display", editable: true, format: "", hideTrigger: false, maxLength: 100.0, minValue: null, positiveNum: false, queryMode: "local", store: null, valueField: "value", xtype: "productMultiDbfindTrigger" } }, { text: 'model映射需要', dataIndex: 'productDTO', hidden: true, }, { text: "品牌", 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.0, dataIndex: "pr_detail", 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.0, dataIndex: "pr_orispeccode", 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_spec", ignore: true, renderer: function (v, m, r) { if (!v) { return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null; } return v; } }, { text: "需求数量", xtype: 'numbercolumn', dataIndex: "mm_qty", width: 110.0, editor: { xtype: "numberfield", decimalPrecision: 3, minValue: 0 }, renderer: function(v, m, r) { return saas.util.BaseUtil.numberFormat(v, 3, false); }, summaryType: 'sum', summaryRenderer: function(v, d, f, m) { return saas.util.BaseUtil.numberFormat(v, 3, false); } }, { text: "单位用量", xtype: 'numbercolumn', dataIndex: "mm_oneuseqty", hidden: true, renderer: function(v, m, r) { return saas.util.BaseUtil.numberFormat(v, 3, false); }, }, { text: "单位", dataIndex: "pr_unit", width: 65.0, ignore: true, renderer: function (v, m, r) { if (!v) { return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null; } return v; } }, { text: "仓库id", dataIndex: "mm_whid", xtype: "numbercolumn", hidden: true }, { text: "仓库编号", dataIndex: "mm_whcode", hidden: true }, { text: "仓库", dataIndex: "mm_whname", width: 120.0, items: null, allowBlank: false, editor: { displayField: "display", editable: true, format: "", hideTrigger: false, maxLength: 100.0, minValue: null, positiveNum: false, queryMode: "local", store: null, valueField: "value", xtype: "warehouseDbfindTrigger" } }, { text: "成本单价(元)", dataIndex: "mm_price", xtype: 'numbercolumn', width: 120.0, editor: { xtype: "numberfield", decimalPrecision: 4, minValue: 0 }, listeners: { edit: 'price_change' }, renderer: function(v, m, r) { return saas.util.BaseUtil.numberFormat(v, 4, true); } }, { text: "成本金额(元)", xtype: 'numbercolumn', dataIndex: "mm_amount", width: 120.0, editor: { xtype: "numberfield", decimalPrecision: 2, editable: false }, renderer: function(v, m, r) { return saas.util.BaseUtil.numberFormat(v, 2, true); }, summaryType: 'sum', summaryRenderer: function(v, d, f, m) { return saas.util.BaseUtil.numberFormat(v, 2, true); } }, { text: "备注", dataIndex: "mm_remark", width: 250, editor: { xtype: "textfield" }, }, { dataIndex: "mm_text1", text: "自定义字段1", width: 100, hidden: true, initHidden: false, editor: { xtype: "textfield" }, }, { dataIndex: "mm_text2", text: "自定义字段2", width: 100, hidden: true, initHidden: false, editor: { xtype: "textfield" }, }, { dataIndex: "mm_text3", text: "自定义字段3", width: 100, hidden: true, initHidden: false, editor: { xtype: "textfield" }, }, { dataIndex: "mm_text4", text: "自定义字段4", width: 100, hidden: true, initHidden: false, editor: { xtype: "textfield" }, }, { dataIndex: "mm_text5", text: "自定义字段5", width: 100, hidden: true, initHidden: false, editor: { xtype: "textfield" }, }] }, { 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: "ma_auditman", fieldLabel: "审核人", readOnly: true }, { xtype: "datefield", name: "ma_auditdate", fieldLabel: "审核日期", readOnly: true }, { xtype: "textfield", name: "ma_text1", fieldLabel: "自定义字段1", hidden: true, initHidden: false }, { xtype: "textfield", name: "ma_text2", fieldLabel: "自定义字段2", hidden: true, initHidden: false }, { xtype: "textfield", name: "ma_text3", fieldLabel: "自定义字段3", hidden: true, initHidden: false }, { xtype: "textfield", name: "ma_text4", fieldLabel: "自定义字段4", hidden: true, initHidden: false }, { xtype: "textfield", name: "ma_text5", fieldLabel: "自定义字段5", hidden: true, initHidden: false }] }); this.callParent(arguments); }, beforeAudit: function () { var me = this, controller = me.getController(), viewModel = me.getViewModel(), grid = me.down('detailGridField'), data = grid.getTrueData(), str = '', type = viewModel.get('ma_type'); if ('拆件' == type) { Ext.Array.each(data, function (item) { if (item.mm_price == 0) { str = str + item.mm_detno + '行' + item.mm_prodcode + '物料成本单价为0!' + '
' } }); } if (str != '') { saas.util.BaseUtil.showConfirm('提示', str) .then(function (y) { if (y == 'yes') { controller.audit(); } }); } else { controller.audit(); } return false; } });