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', _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: [], 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_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, minValue:1 },{ 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:8, columnWidth: 0.25 },{ xtype : "numberfield", name : "ma_total", readOnly:true, editable:false, fieldLabel : "金额", decimalPrecision:2, 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 : "名称", dataIndex : "pr_detail", width : 200.0, 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_spec", width : 150.0, 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_unit", width : 80.0, 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) { var arr = (v + '.').split('.'); var xr = (new Array(arr[1].length > 3 ? 3 : arr[1].length)).fill('0'); var format = '0.' + xr.join(); return Ext.util.Format.number(v, format); }, summaryType: 'sum', summaryRenderer: function(v) { var arr = (v + '.').split('.'); var xr = (new Array(arr[1].length > 3 ? 3 : arr[1].length)).fill('0'); var format = '0.' + xr.join(); return Ext.util.Format.number(v, format); } }, { text : "单位用量", xtype: 'numbercolumn', dataIndex : "mm_oneuseqty", width : 110.0, hidden:true, editor : { xtype : "numberfield", decimalPrecision: 8, editable:false, minValue:0 }, renderer : function(v) { var arr = (v + '.').split('.'); var xr = (new Array(arr[1].length)).fill('0'); var format = '0.' + xr.join(); return Ext.util.Format.number(v, format); }, summaryType: 'sum', summaryRenderer: function(v) { var arr = (v + '.').split('.'); var xr = (new Array(arr[1].length)).fill('0'); var format = '0.' + xr.join(); return Ext.util.Format.number(v, format); } }, { text : "仓库id", dataIndex : "mm_whid", xtype : "numbercolumn", hidden:true }, { text : "仓库编号", dataIndex : "mm_whcode", hidden:true }, { text : "仓库", dataIndex : "mm_whname", width : 150.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 : 110.0, editor : { xtype : "numberfield", decimalPrecision: 8, minValue:0 }, listeners:{ edit:'price_change' }, renderer : function(v) { var arr = (v + '.').split('.'); var xr = (new Array(arr[1].length)).fill('0'); var format = '0,000.' + xr.join(); return Ext.util.Format.number(v, format); } }, { text : "成本金额", xtype: 'numbercolumn', dataIndex : "mm_amount", width : 110.0, editor : { xtype : "numberfield", decimalPrecision: 2, editable : false }, renderer : function(v) { var arr = (v + '.').split('.'); var xr = (new Array(arr[1].length)).fill('0'); var format = '0,000.' + xr.join(); return Ext.util.Format.number(v, format); }, summaryType: 'sum', summaryRenderer: function(v) { var arr = (v + '.').split('.'); var xr = (new Array(arr[1].length)).fill('0'); var format = '0,000.' + xr.join(); return Ext.util.Format.number(v, format); } },{ text : "替代料", dataIndex : "mm_repprodcode", width : 0, editor : { xtype : "textfield" }, }, { text : "备注", dataIndex : "mm_remark", width : 250, 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 }] });