Ext.define('make.view.make.bomComposite.SearchForm', {
extend: 'Ext.form.Panel',
xtype: 'make-query-searchform',
controller: 'make-query-searchform',
name: 'bomcomposite1',
width: '100%',
minHeight: 100,
bodyPadding: '10 10 0 10',
margin: '0 0 12 0',
layout: 'column',
viewModel: {
formulas: {
//总在途
onOrder: function (get) {
var a = get('noComplete'),
b = get('purchase'),
i = Number(get('application'));
return Number(a) + Number(b) + Number(i);
},
//总库存
onHand: function (get) {
var a = get('greattotal'),
b = get('badtotal');
return Number(a) + Number(b);
},
//总需求
onNeed: function (get) {
var a = get('noShipment'),
b = get('noPicking'),
c = get('safeInventory'),
d = get('safeForecastUnClash');
return Number(a) + Number(b) + Number(c) + Number(d);
},
//净需求
realNeed: function (get) {
var a = Number(get('noShipment')),
b = Number(get('noPicking')),
c = Number(get('safeInventory')),
d = Number(get('greattotal')),
e = Number(get('noComplete')),
f = Number(get('purchase')),
g = Number(get('safeForecastUnClash')),
i = Number(get('application'));
return a + b + c + g + i - d - e - f;
}
}
},
initComponent: function () {
var me = this;
Ext.apply(this, {
items: [{
xtype: "productDbfindTrigger",
name: 'pr_code',
allowBlank: false,
emptyText: '请选择物料',
width: 200,
columnWidth: 0.25
}, {
xtype: 'displayfield',
name: 'pr_detail',
fieldLabel: '名称',
labelWidth: 50,
width: 200,
columnWidth: 0.25,
margin: '0 0 0 10'
}, {
xtype: 'displayfield',
name: 'pr_orispeccode',
fieldLabel: '型号',
labelWidth: 50,
width: 200,
columnWidth: 0.25,
margin: '0 0 0 10'
}, {
xtype: 'displayfield',
name: 'pr_unit',
fieldLabel: '单位',
labelWidth: 50,
width: 200,
columnWidth: 0.25,
margin: '0 0 0 10'
}, {
xtype: 'button',
text: '查询',
handler: 'onQuery'
}, {
xtype: 'form',
columnWidth: 1,
layout: 'column',
margin: '0 0 10 0',
bodyStyle: 'background:#f6f6f6; padding:10px;',
defaults: {
columnWidth: 0.25,
layout: 'vbox',
xtype: 'form',
cls: 'bomcomposite-form',
bodyStyle: 'background:#f7f7f7;',
defaults: {
xtype: 'displayfield',
labelStyle: 'color:#505363;font-size: 13px;',
thousandSeparator: ',',
renderer: function (v) {
if (!v) {
v = 0;
}
return saas.util.BaseUtil.numberFormat(v, 6, true)
}
}
},
items: [{
items: [{
fieldLabel: '总需求量(+)',
labelStyle: 'color:#505363;font-size: 13px; font-weight: bold;',
bind: '{onNeed}',
renderer: function (v) {
if (!v) {
v = 0;
}
return '' + saas.util.BaseUtil.numberFormat(v, 6, true) + ''
}
}, {
name: 'noShipment',
fieldLabel: '订单未发货',
bind: '{noShipment}'
}, {
name: 'noPicking',
fieldLabel: '工单未领料',
bind: '{noPicking}'
}, {
name: 'safeInventory',
fieldLabel: '安全库存',
bind: '{safeInventory}'
}, {
name: 'safeForecastUnClash',
fieldLabel: '备货未核销',
bind: '{safeForecastUnClash}'
}]
}, {
items: [{
fieldLabel: '现有库存量(-)',
labelStyle: 'color:#505363;font-size: 13px; font-weight: bold;',
bind: '{greattotal}',
renderer: function (v) {
if (!v) {
v = 0;
}
return '' + saas.util.BaseUtil.numberFormat(v, 6, true) + ''
}
}, {
name: 'greattotal',
fieldLabel: '良品库存',
bind: '{greattotal}'
}, {
name: 'badtotal',
fieldLabel: '不良品库存',
bind: '{badtotal}'
}, {
name: 'total',
fieldLabel: '总库存',
bind: '{onHand}'
}]
}, {
items: [{
fieldLabel: '在途库存量(-)',
labelStyle: 'color:#505363;font-size: 13px; font-weight: bold;',
bind: '{onOrder}',
renderer: function (v) {
if (!v) {
v = 0;
}
return '' + saas.util.BaseUtil.numberFormat(v, 6, true) + ''
}
}, {
name: 'purchase',
fieldLabel: '采购未交',
bind: '{purchase}'
}, {
name: 'noComplete',
fieldLabel: '工单未完工',
bind: '{noComplete}'
}, {
name: 'application',
fieldLabel: '请购未转',
bind: '{application}'
}]
}, {
items: [{
fieldLabel: '净需求',
labelWidth: 60,
labelStyle: 'color:#505363;font-size: 13px; font-weight: bold;',
thousandSeparator: ',',
bind: '{realNeed}',
renderer: function (v) {
if (!v) {
v = 0;
}
return '' + saas.util.BaseUtil.numberFormat(v, 6, true) + ''
},
}]
}]
}]
});
this.callParent(arguments);
},
});