Ext.define('make.view.sale.saleFosenrecast.FormPanel', {
extend: 'saas.view.core.form.FormPanel',
xtype: ['sale-saleforecast-formpanel', 'saleforecast-formpanel'],
controller: 'sale-saleforecast-formpanel',
viewModel: 'sale-saleforecast-formpanel',
viewName: 'sale-saleforecast-formpanel',
caller: 'SaleForecast',
//字段属性
_title: '备货单',
_idField: 'id',
_codeField: 'sf_code',
_statusField: 'sf_status',
_statusCodeField: 'sf_statuscode',
_auditmanField: 'sf_auditman',
_auditdateField: 'sf_auditdate',
_readUrl: '/api/sale/saleforecast/read',
_saveUrl: '/api/sale/saleforecast/save',
_auditUrl: '/api/sale/saleforecast/audit',
_unAuditUrl: '/api/sale/saleforecast/unAudit',
_deleteUrl: '/api/sale/saleforecast/delete',
_turnSaleUrl: '/api/sale/saleforecast/turnSale',
_runATP: '/api/sale/saleforecast/runAtp',
initId: 0,
initComponent: function () {
Ext.apply(this, {
defaultItems: [{
xtype: 'hidden',
name: 'id',
fieldLabel: 'id'
},{
xtype: 'currencyCombo',
name:'sf_currency',
fieldLabel: '币种',
allowBlank: false,
columnWidth: 0.25,
defaultValue:this.getViewModel().get('defaultCurrency'),
},{
xtype: 'numberfield',
name: 'sf_taxrate',
fieldLabel: '税率(%)',
columnWidth: 0.25,
minValue: 0,
maxValue: 100,
defaultValue: saas.util.BaseUtil.getDefualtTaxRate(),
},{
xtype:'radiogroup',
columnWidth: 0.4,
name:'sf_clashway',
margin:'0 0 0 55',
simpleValue:true,
tooltip: {
text:'任意订单自动核销:任意客户的销售订单审核时自动根据物料编号核销掉对应的备货数量。
按备货客户核销:销售订单客户与备货客户一样时,订单审核时自动根据物料编号核销掉对应的备货数量。',
title:'提示',
dismissDelay:7200000
},
items: [
{ boxLabel: '任意订单自动核销', inputValue: 'ALL', checked: true},
{ boxLabel: '按备货客户核销', inputValue: 'client' }
]
},{
name: "detailGridField",
xtype: "detailGridField",
detnoColumn: 'sd_detno',
storeModel: 'saas.model.sale.SaleForecastDetail',
deleteDetailUrl: '/api/sale/saleforecast/deleteDetail',
columns: [{
text: "id",
dataIndex: "id",
xtype: "numbercolumn",
hidden: true
}, {
text: "物料id",
dataIndex: "sd_prodid",
hidden: true
}, {
text: "物料名称",
width: 150.0,
dataIndex: "pr_detail",
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"
},
renderer: function (v, m, r) {
if (!v) {
return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
}
return v;
}
}, {
text: 'model映射需要',
dataIndex: 'productDTO',
hidden: true,
}, {
text: "型号",
width: 200.0,
dataIndex: "pr_orispeccode",
ignore: true,
renderer: function (v, m, r) {
var str = '';
if(r.data["productDTO"] ){
if(r.data["productDTO"]['pr_brand']){
str += '厂家/品牌:'+ r.data["productDTO"]['pr_brand'] + '
';
}
if(r.data["productDTO"]['pr_spec']){
str += '规格:' + r.data["productDTO"]['pr_spec'];
}
if(str) m.tdAttr = 'data-qtip="'+ str +'"';
if (!v) {
return r.data["productDTO"] ? r.data["productDTO"][m.column.dataIndex] : null;
}
}
return v;
}
}, {
text: "数量",
dataIndex: "sd_qty",
width: 110.0,
xtype: 'numbercolumn',
allowBlank: false,
editor: {
xtype: "numberfield",
decimalPrecision: 6,
minValue: 0
},
renderer: function(v, m, r) {
return saas.util.BaseUtil.numberFormat(v, 6, true);
},
summaryType: 'sum',
summaryRenderer: function(v, d, f, m) {
return saas.util.BaseUtil.numberFormat(v, 6, true);
}
}, {
text: "已核销数量",
dataIndex: "sd_yqty",
width: 110.0,
xtype: 'numbercolumn',
allowBlank: true,
editable: false,
ignore:true,
nocopy:true,
renderer: function(v, m, r) {
return saas.util.BaseUtil.numberFormat(v, 6, true);
},
summaryType: 'sum',
summaryRenderer: function(v, d, f, m) {
return saas.util.BaseUtil.numberFormat(v, 6, true);
}
}, {
text: "已开工单数",
dataIndex: "sd_ymaqty",
width: 110.0,
xtype: 'numbercolumn',
allowBlank: true,
editable: false,
ignore:true,
nocopy:true,
renderer: function(v, m, r) {
return saas.util.BaseUtil.numberFormat(v, 6, true);
},
summaryType: 'sum',
summaryRenderer: function(v, d, f, m) {
return saas.util.BaseUtil.numberFormat(v, 6, true);
}
}, {
text: "订单冲减工单数",
dataIndex: "sd_maqty",
width: 120.0,
xtype: 'numbercolumn',
allowBlank: true,
editable: false,
ignore:true,
nocopy:true,
renderer: function(v, m, r) {
return saas.util.BaseUtil.numberFormat(v, 6, true);
},
summaryType: 'sum',
summaryRenderer: function(v, d, f, m) {
return saas.util.BaseUtil.numberFormat(v, 6, true);
}
}, {
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: "客户id",
dataIndex: "sd_custid",
hidden: true
},{
text: "客户编号",
dataIndex: "sd_custcode",
hidden: true
},{
text: "客户名称",
dataIndex: "sd_custname",
width: 110.0,
editor: {
displayField: "display",
editable: true,
format: "",
hideTrigger: false,
maxLength: 100.0,
minValue: null,
positiveNum: false,
queryMode: "local",
store: null,
valueField: "value",
xtype: "customerDbfindTrigger"
}
}, {
text: "交货日期",
dataIndex: "sd_delivery",
width: 110.0,
xtype: 'datecolumn',
editor: {
xtype: "datefield",
editable: true,
hideTrigger: false
}
}, {
text: "可承诺交期",
dataIndex: "sd_atpdelivery",
width: 150.0,
xtype: 'datecolumn',
format: 'Y-m-d',
ignore: true,
},{
text: "交期运算结果描述",
dataIndex: "sd_atpdesc",
width: 200.0,
ignore: true,
},{
text: "物料编号",
width: 150.0,
dataIndex: "sd_prodcode",
xtype: "",
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: "productMultiDbfindTrigger"
}
}, {
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,
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: "sd_remark",
width: 250,
items: null,
editor: {
xtype: "textfield"
},
}, {
dataIndex: "sd_text1",
text: "自定义字段1",
width: 100,
hidden: true,
initHidden: false,
editor: {
xtype: "textfield"
},
}, {
dataIndex: "sd_text2",
text: "自定义字段2",
width: 100,
hidden: true,
initHidden: false,
editor: {
xtype: "textfield"
},
}, {
dataIndex: "sd_text3",
text: "自定义字段3",
width: 100,
hidden: true,
initHidden: false,
editor: {
xtype: "textfield"
},
}, {
dataIndex: "sd_text4",
text: "自定义字段4",
width: 100,
hidden: true,
initHidden: false,
editor: {
xtype: "textfield"
},
}, {
dataIndex: "sd_text5",
text: "自定义字段5",
width: 100,
hidden: true,
initHidden: false,
editor: {
xtype: "textfield"
},
}]
}, {
xtype: "textfield",
name: "sf_remark",
fieldLabel: "备注",
columnWidth: 1
}, {
xtype: "datefield",
name: "sf_date",
fieldLabel: "单据日期",
defaultValue: new Date()
}, {
xtype: "employeeDbfindTrigger",
name: "sf_seller",
fieldLabel: "业务员"
}, {
xtype: "hidden",
name: "sf_sellerid",
fieldLabel: "业务员ID"
}, {
xtype: "hidden",
name: "sf_sellercode",
fieldLabel: "业务员编号",
}, {
xtype: "hidden",
name: "creatorId",
fieldLabel: "录入人ID",
readOnly: true
}, {
xtype: "textfield",
name: "creatorName",
fieldLabel: "录入人",
readOnly: true
}, {
xtype: "datefield",
name: "createTime",
fieldLabel: "录入日期",
readOnly: true,
hidden: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: "sf_auditman",
fieldLabel: "审核人",
readOnly: true
}, {
xtype: "datefield",
name: "sf_auditdate",
fieldLabel: "审核日期",
hidden:true,
readOnly: true
}, {
xtype: "textfield",
name: "sf_text1",
fieldLabel: "自定义字段1",
hidden: true,
initHidden: false
}, {
xtype: "textfield",
name: "sf_text2",
fieldLabel: "自定义字段2",
hidden: true,
initHidden: false
}, {
xtype: "textfield",
name: "sf_text3",
fieldLabel: "自定义字段3",
hidden: true,
initHidden: false
}, {
xtype: "textfield",
name: "sf_text4",
fieldLabel: "自定义字段4",
hidden: true,
initHidden: false
}, {
xtype: "textfield",
name: "sf_text5",
fieldLabel: "自定义字段5",
hidden: true,
initHidden: false
}],
bbar:[{
xtype:'component',
html: saas.util.BaseUtil.getCompanyApp() == 'make-app' ? '*说明:
1、用于没有客户明确的订单,对未来特定时间内,全部产品或特定产品的销售数量与销售金额的估计,备货销售时采用;
2、用于生产类型为自制、委外的成品、半成品备料,外购件备料请直接下采购单。':'*说明: 用于没有客户明确的订单,对未来特定时间内,全部产品或特定产品的销售数量与销售金额的估计,备货销售时采用。'
}],
toolBtns: [{
xtype: 'button',
text: '转工单',
hidden: true,
handler: 'turnMake',
bind: {
hidden: '{sf_statuscode!="AUDITED"}'
}
},{
xtype: 'button',
text: '交期运算',
handler: 'runATP'
}]
});
this.callParent();
},
});