You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Areas/MvcShipping/Viewsjs/MsOpBulk/MsOpBulkEdit.js

3179 lines
109 KiB
JavaScript

Ext.namespace('Shipping');
Shipping.MsOpBulkEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpBulkEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpBulkEdit, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
EditRecord: null,
Editdata: null,
stroplb: '大宗散货',
initUIComponents: function () {
this.serialNo = 0;
this.bodyDel = [];
this.itemindex = 1;
this.accdatesameetd = 0;
this.MsPeriod = null;
//枚举参照相关
//表参照相关
this.storeDefValue = Ext.create('Ext.data.Store', {
model: 'DsShipping.ux.OpDefValue',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCodeOpDef/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeMustBe = Ext.create('Ext.data.Store', {
model: 'DsShipping.ux.OpDefValue',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCodeOpMustField/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeSalesCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeSalesCode.load();
this.comboxSalesCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '揽货人',
store: this.storeSalesCode,
forceSelection: true,
name: 'SALE',
valueField: 'UserName',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var recs = DsStoreQueryBy(this.storeUserBase, 'USERID', records[0].data.GID);
var SALEDEPT = this.formHead.getForm().findField('SALEDEPT');
if (recs.getCount() > 0) {
var data = recs.getAt(0).data;
SALEDEPT.setValue(data.DEPTNAME);
} else {
SALEDEPT.setValue('');
}
}
}
}
});
this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeOpCode.load();
this.comboxOp = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '操 作',
store: this.storeOpCode,
forceSelection: true,
name: 'OP',
valueField: 'UserName',
displayField: 'CodeAndName',
value: SHOWNAME
});
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} });
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '委托单位',
store: this.storeCustCode,
forceSelection: true,
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' }
});
this.storeSource = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.SourceModel',
proxy: { url: '/CommMng/BasicDataRef/GetSource' }
});
this.storeSource.load();
this.storeSourceDetail = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.SourceDetailModel',
proxy: { url: '/CommMng/BasicDataRef/GetSourceDetail' }
});
this.comboxSource = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '业务来源',
store: this.storeSource,
forceSelection: true,
name: 'BSSOURCE',
valueField: 'SourceName',
displayField: 'SourceName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var recs = DsStoreQueryBy(this.storeSource, 'SourceID', records[0].data.SourceID);
if (recs.getCount() > 0) {
var data = recs.getAt(0).data;
var s = data.SourceID;
this.storeSourceDetail.load({
params: {
SourceId: s
}
});
} else {
var BSSOURCEDETAIL = this.formEdit.getForm().findField('BSSOURCEDETAIL');
BSSOURCEDETAIL.setValue('');
}
}
}
}
});
this.comboxSourceDetail = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '贸易条款',
store: this.storeSourceDetail,
forceSelection: true,
name: 'BSSOURCEDETAIL',
valueField: 'SourceDetail',
displayField: 'SourceDetail'
});
this.storeUserBase = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserBaseModel',
proxy: { url: '/MvcShipping/MsBaseInfo/GetUserBaseList' }
});
this.storeUserBase.load();
this.storeDept = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.DeptModel',
proxy: { url: '/CommMng/BasicDataRef/GetDeptList' }
});
this.storeDept.load();
this.comboxDept = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '所属部门',
store: this.storeDept,
forceSelection: true,
name: 'SALEDEPT',
valueField: 'DeptName',
displayField: 'DeptName',
hidden: true
});
this.storeTransType = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeTransType.load({ params: { enumTypeId: 97002} });
_this = this;
this.comboxTransType = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '运输方式',
store: this.storeTransType,
forceSelection: true,
name: 'TRANSTYPE',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var trantype = records[0].data.EnumValueName;
this.trantypechange(trantype);
}
}
}
});
this.storeBsStatus = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeBsStatus.load({ params: { enumTypeId: 97001} });
this.comboxBsStatus = Ext.create('DsExt.ux.RefEnumComboxList', {
fieldLabel: '托单状态',
forceSelection: true,
store: this.storeBsStatus,
name: 'OPSTATUS'
});
this.storeOurPort = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.PortRefModel',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOurPortRefList' }
});
this.storeOurPort.load();
this.comboxOurPortFr = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '发运地',
store: this.storeOurPort,
forceSelection: true,
name: 'PORTLOAD',
valueField: 'CNAME',
displayField: 'PORTANDNAME',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var port = records[0].data.CNAME;
this.portchange(port);
}
}
}
});
this.storeOurPort2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.PortRefModel',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOurPortRefList' }
});
this.storeOurPort2.load();
this.comboxOurPortTo = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '目的地',
store: this.storeOurPort2,
forceSelection: true,
name: 'PORTDISCHARGE',
valueField: 'CNAME',
displayField: 'PORTANDNAME'
});
this.storeGoods = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.GoodsRefModel',
proxy: { url: '/MvcShipping/MsBaseInfo/GetGoodsRefList' }
});
this.storeGoods.load();
this.comboxGoods = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '商品名称',
store: this.storeGoods,
// forceSelection: true,
name: 'GOODCODE',
valueField: 'GOODCODE',
displayField: 'CODEANDNAME',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
this.setGoodsName(records[0].data.GOODCODE);
}
}
}
});
this.StoreStlName = Ext.create('Ext.data.Store', {
fields: ['STLNAME']
});
this.StoreStlName.add({ "STLNAME": "票结" });
this.StoreStlName.add({ "STLNAME": "半月结" });
this.StoreStlName.add({ "STLNAME": "月结" });
this.StoreStlName.add({ "STLNAME": "周结" });
this.comboxStlName = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreStlName,
fieldLabel: '结算方式',
forceSelection: true,
name: 'STLNAME',
valueField: 'STLNAME',
displayField: 'STLNAME'
});
this.formHead = Ext.widget('form', {
region: 'north',
frame: true,
bodyPadding: 5,
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '业务编号',
name: 'BSNO', hidden: true
}, {
fieldLabel: '业务锁定状态',
name: 'BSSTATUS', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '费用锁定状态',
name: 'FEESTATUS', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '费用锁定状态',
name: 'INPUTBY', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '商品名称',
name: 'GOODSNAME', flex: 0, hidden: true, margins: '0'
}
,
{
fieldLabel: '委托编号',
readOnly: false,
flex: 1,
name: 'CUSTNO'
},
{
fieldLabel: '订舱编号',
flex: 1,
name: 'ORDERNO'
}, {
fieldLabel: '会计期间',
flex: 1,
xtype: 'monthfield',
name: 'ACCDATE'
}, {
fieldLabel: '业务锁定',
flex: 0.5,
readOnly: true,
name: 'BSSTATUSREF'
}, {
fieldLabel: '费用锁定',
flex: 0.5,
readOnly: true,
name: 'FEESTATUSREF'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCustCode, this.comboxSource, this.comboxSourceDetail, {
fieldLabel: '业务日期',
format: 'Y-m-d',
xtype: 'datefield',
allowBlank: false,
name: 'OPDATE'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxOp, this.comboxSalesCode, this.comboxDept, this.comboxTransType, this.comboxBsStatus
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxStlName, {
fieldLabel: '结算日期',
format: 'Y-m-d',
flex: 1,
xtype: 'datefield',
name: 'STLDATE'
}, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield'}]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}); //end this.formEdit
this.formEdit = Ext.widget('form', {
region: 'north',
frame: true,
bodyPadding: 5,
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxOurPortFr, this.comboxOurPortTo, this.comboxGoods, {
fieldLabel: '发运日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETD'
}, {
fieldLabel: '最晚结束时间',
format: 'Y-m-d',
xtype: 'datefield',
name: 'LASTETD'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '件数',
name: 'PKGS'
}, {
fieldLabel: '吨数',
name: 'KGS'
}, {
fieldLabel: '已发运吨数',
readOnly: true,
name: 'OVERKGS'
}, {
fieldLabel: '已发运件数',
readOnly: true,
name: 'OVERPKGS'
}, { xtype: 'hiddenfield' }
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '备注',
name: 'REMARK'
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}); //end this.formEdit
this.formKC = Ext.widget('form', {
region: 'north',
frame: true,
bodyPadding: 5,
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '站台库存件数',
readOnly: true,
name: 'PKGS'
}, {
fieldLabel: '站台库存吨数',
readOnly: true,
name: 'KGS'
}, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield' }
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}]
}); //end this.formEdit
//明细表-数据集
this.storeBodyList = Ext.create('Ext.data.Store', {
model: 'MsOpBulkDetail',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpBulk/GetBodyList',
reader: {
id: 'BSNO,SERIALNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.gridListCellEditing.on('beforeedit', function (editor, e) {
return this.cellEditingBeforeEdit(editor, e);
}, this);
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridList = new Ext.grid.GridPanel({
store: this.storeBodyList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridListCellEditing],
selModel: this.GridCheckBoxModel,
selType: 'cellmodel',
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
tbar: [{
text: '增加明细',
tooltip: '增加明细',
id: "btnadddetail",
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddDetailClick(button, event);
},
scope: this
}, '-', {
text: '删除明细',
tooltip: '删除明细',
id: "btndeldetail",
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelDetailClick(button, event);
},
scope: this
}, '-', {
text: '保存明细',
tooltip: '保存明细',
iconCls: "btnsave",
handler: function (button, event) {
this.onPostDetailClick(button, event);
},
scope: this
}, '-', {
text: '记 账',
tooltip: '记账',
handler: function (button, event) {
this.onAuditDetailClick(button, event);
},
scope: this
}, '-', {
text: 'EXCEL引入',
tooltip: 'EXCEL引入',
iconCls: "btnexportexcel",
handler: function (button, event) {
this.onImportDetailClick(button, event, 1);
},
scope: this
},
'-',
{
text: "打印",
iconCls: "btnprint",
handler: function (button, event) {
this.PrintTrainTruck();
},
scope: this
}],
columns: [{
sortable: true,
dataIndex: 'BSNO',
header: '业务编号',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'ACCSTATUS',
header: '是否记账',
width: 60
}, {
sortable: true,
dataIndex: 'SerialNo',
header: '序号',
width: 30
}, {
sortable: true,
dataIndex: 'EXPDATE',
header: '日期',
editor: {
xtype: 'datefield',
format: 'Y-m-d',
selectOnFocus: true
},
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 120
}, {
sortable: true,
dataIndex: 'KGS',
header: '毛重',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
width: 100
}, {
sortable: true,
dataIndex: 'TAREKGS',
header: '皮重',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
width: 100
}, {
sortable: true,
dataIndex: 'PKGKGS',
header: '包装物重',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
width: 100
}, {
sortable: true,
dataIndex: 'NETKGS',
header: '净重',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
width: 100
}, {
sortable: true,
dataIndex: 'PKGS',
header: '袋数',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
width: 120
}, {
sortable: true,
dataIndex: 'TRUCKNO',
header: '车号',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 120
}, {
sortable: true,
dataIndex: 'POUNDNO',
header: '磅单编号',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 110
}, {
sortable: true,
dataIndex: 'DRVNAME',
header: '驾驶员',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 120
}, {
sortable: true,
dataIndex: 'TRANSTOTAL',
header: '应付运费',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
width: 120
}, {
sortable: true,
dataIndex: 'TRANSOT',
header: '额外费用',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
width: 120
}, {
sortable: true,
dataIndex: 'REMARK',
header: '其他',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 110
}
]
});
this.storeBodyTruckList = Ext.create('Ext.data.Store', {
model: 'MsOpBulkDetail',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpBulk/GetBodyList',
reader: {
id: 'BSNO,SERIALNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.gridTruckListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.gridTruckListCellEditing.on('beforeedit', function (editor, e) {
return this.cellEditingBeforeEdit(editor, e);
}, this);
this.GridTruckCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridTruckList = new Ext.grid.GridPanel({
store: this.storeBodyTruckList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridTruckListCellEditing],
selModel: this.GridTruckCheckBoxModel,
selType: 'cellmodel',
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
tbar: [{
text: '增加明细',
tooltip: '增加明细',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddTruckDetailClick(button, event);
},
scope: this
}, '-', {
text: '删除明细',
tooltip: '删除明细',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelTruckDetailClick(button, event);
},
scope: this
}, '-', {
text: '保存明细',
tooltip: '保存明细',
iconCls: "btnsave",
handler: function (button, event) {
this.onPostTruckDetailClick(button, event);
},
scope: this
}, '-', {
text: '记 账',
tooltip: '记账',
handler: function (button, event) {
this.onAuditTruckDetailClick(button, event);
},
scope: this
}, '-', {
text: 'EXCEL引入',
tooltip: 'EXCEL引入',
iconCls: "btnexportexcel",
handler: function (button, event) {
this.onImportDetailClick(button, event, 2);
},
scope: this
}, '-',
{
text: "打印",
iconCls: "btnprint",
handler: function (button, event) {
this.PrintDetail();
},
scope: this
}],
columns: [{
sortable: true,
dataIndex: 'BSNO',
header: '业务编号',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'ACCSTATUS',
header: '是否记账',
width: 60
}, {
sortable: true,
dataIndex: 'SerialNo',
header: '序号',
width: 30
}, {
sortable: true,
dataIndex: 'EXPDATE',
header: '日期',
editor: {
xtype: 'datefield',
format: 'Y-m-d',
selectOnFocus: true
},
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 120
}, {
sortable: true,
dataIndex: 'KGS',
header: '毛重',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
width: 100
}, {
sortable: true,
dataIndex: 'TAREKGS',
header: '皮重',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
width: 100
}, {
sortable: true,
dataIndex: 'PKGKGS',
header: '包装物重',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
width: 100
}, {
sortable: true,
dataIndex: 'NETKGS',
header: '净重',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
width: 100
}, {
sortable: true,
dataIndex: 'PKGS',
header: '袋数',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
width: 120
}, {
sortable: true,
dataIndex: 'TRUCKNO',
header: '车号',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 120
}, {
sortable: true,
dataIndex: 'POUNDNO',
header: '磅单编号',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 110
}, {
sortable: true,
dataIndex: 'DRVNAME',
header: '驾驶员',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 120
}, {
sortable: true,
dataIndex: 'TRANSTOTAL',
header: '应付运费',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
width: 120
}, {
sortable: true,
dataIndex: 'TRANSOT',
header: '额外费用',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
width: 120
}, {
sortable: true,
dataIndex: 'REMARK',
header: '其他',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 110
}
]
});
this.storeBodyTrainList = Ext.create('Ext.data.Store', {
model: 'MsOpBulkTrainDetail',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpBulk/GetBodyListTrain',
reader: {
id: 'BSNO,SERIALNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.gridListTrainCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.storeTrainType = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeTrainType.load({ params: { enumTypeId: 97003} });
this.comboxTrainType = Ext.create('DsExt.ux.RefEnumComboxList', {
store: this.storeTrainType,
name: 'TRAINTYPE'
});
this.GridTrainCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridListTrainCellEditing.on('beforeedit', function (editor, e) {
return this.cellEditingBeforeEdit(editor, e);
}, this);
this.gridListTrain = new Ext.grid.GridPanel({
store: this.storeBodyTrainList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridListTrainCellEditing],
selModel: this.GridTrainCheckBoxModel,
selType: 'cellmodel',
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
tbar: [{
text: '增加明细',
tooltip: '增加明细',
id: "btnadddetailTrain",
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddDetailTrainClick(button, event);
},
scope: this
}, '-', {
text: '删除明细',
tooltip: '删除明细',
id: "btndeldetailTrain",
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelDetailTrainClick(button, event);
},
scope: this
}, '-', {
text: '保存明细',
tooltip: '保存明细',
iconCls: "btnsave",
handler: function (button, event) {
this.onPostDetailTrainClick(button, event);
},
scope: this
}, '-', {
text: '记 账',
tooltip: '记账',
handler: function (button, event) {
this.onAuditTrainClick(button, event);
},
scope: this
}, '-', {
text: 'EXCEL引入',
tooltip: 'EXCEL引入',
iconCls: "btnexportexcel",
handler: function (button, event) {
this.onImportDetailClick(button, event, 3);
},
scope: this
}, '-',
{
text: "打印",
iconCls: "btnprint",
handler: function (button, event) {
this.PrintTrainDetail();
},
scope: this
}],
columns: [{
sortable: true,
dataIndex: 'BSNO',
header: '业务编号',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'ACCSTATUS',
header: '是否记账',
width: 60
}, {
sortable: true,
dataIndex: 'ARRIVALSTATION',
header: '到站',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 120
}, {
sortable: true,
dataIndex: 'SerialNo',
header: '序号',
width: 30
}, {
sortable: true,
dataIndex: 'EXPDATE',
header: '日期',
editor: {
xtype: 'datefield',
format: 'Y-m-d',
selectOnFocus: true
},
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 120
}, {
sortable: true,
dataIndex: 'TRAINNO',
header: '车号',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 120
}, {
sortable: true,
dataIndex: 'INVNO',
header: '票号',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 120
}, {
sortable: true,
dataIndex: 'TRANSTOTAL',
header: '金额',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
width: 120,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'PKGS',
header: '包数',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
width: 120
}, {
sortable: true,
dataIndex: 'TRAINTYPE',
header: '车型',
editor: this.comboxTrainType,
width: 120
}, {
sortable: true,
dataIndex: 'KGS',
header: '吨数',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
width: 100
}, {
sortable: true,
dataIndex: 'TRANSOT',
header: '额外费用',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
},
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00'),
width: 120,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'REMARK',
header: '其他',
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 110
}
]
});
//按钮Toolbar
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
id: 'btnESave',
text: "保存",
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0');
},
scope: this
},
{
id: 'btnESaveAndClose',
text: "保存并关闭",
handler: function (button, event) {
this.Save('1');
},
scope: this
},
{
id: 'btnESaveAndNew',
text: "保存并新建",
handler: function (button, event) {
this.Save('2');
},
scope: this
},
{
id: 'btnECopyNew',
text: "复制新建",
handler: function (button, event) {
var basicForm = this.formHead.getForm();
this.opStatus = 'add';
basicForm.findField('BSNO').setDisabled(false);
var field = basicForm.findField('BSNO');
field.setValue(NewGuid());
basicForm.findField('BSNO').setDisabled(true);
field = basicForm.findField('CUSTNO');
field.setValue('');
field = basicForm.findField('INPUTBY');
field.setValue(SHOWNAME);
field = basicForm.findField('OP');
field.setValue(SHOWNAME);
var field = basicForm.findField('BSSTATUS');
field.setValue(false);
var field = basicForm.findField('BSSTATUSREF');
field.setValue('未锁定');
var field = basicForm.findField('FEESTATUS');
field.setValue(false);
var field = basicForm.findField('FEESTATUSREF');
field.setValue('未锁定');
this.storeBodyList.removeAll();
this.storeBodyTruckList.removeAll();
this.storeBodyTrainList.removeAll();
this.GetEditStatus();
},
scope: this
},
'-',
{
text: "关闭",
handler: function (button, event) {
window.close();
},
scope: this
},
{
text: "新建",
handler: function (button, event) {
this.LoadData('add', '');
var basicForm = this.formEdit.getForm();
basicForm.findField('BsNo').setDisabled(false);
},
scope: this
},
'-',
{
text: "打印",
iconCls: "btnprint",
handler: function (button, event) {
this.Print();
},
scope: this
}
]
}); //end 按钮Toolbar
this.panelTruck = new Ext.Panel({
title: '提货管理',
layout: "border",
anchor: '100% 50%',
frame: true,
split: true,
items: [this.gridList, this.gridListSum]
});
this.panelTrain = new Ext.Panel({
title: '发货管理',
layout: "border",
anchor: '100% 50%',
// region: 'center',
frame: true,
items: [this.gridListTrain]
});
this.panelTruckgl = new Ext.Panel({
title: '公路拖车明细',
layout: "border",
anchor: '100% 100%',
frame: true,
items: [this.gridTruckList]
});
this.panelBody = new Ext.Panel({
title: '运输明细',
layout: "anchor",
frame: true,
height:450,
region: 'north',
items: [
this.panelTruck, this.panelTrain
]
});
this.panelpage1 = new Ext.Panel({
title: '基本信息',
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
containerScroll: true,
frame: false,
items: [this.formEdit, this.panelBody]
});
this.treestore = new Ext.data.TreeStore({
model: 'DsShipping.ux.ModuleModel',
nodeParam: 'PARENTID',
proxy: {
type: 'ajax',
url: '/MvcShipping/MsBaseInfo/GetModuTreeRefList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
},
autoLoad: true,
root: {
name: '根节点',
expanded: true,
id: '3268AAB2-D4EE-4904-B82F-F30F90236FEE'
}
});
this.tabpanel = new Ext.TabPanel
({
activeTab: 0,
autoWidth: true,
border: false,
frame: false,
region: 'center',
id: "TabPanelID",
enableTabScroll: true,
items:
[
this.panelpage1
]
});
this.tabtree = new Ext.tree.Panel({
region: 'west',
title: '大宗散货操作',
split: true,
width: 180,
collapsible: true,
margins: '0 0 0 0',
store: this.treestore,
rootVisible: false,
hideHeaders: true,
animate: false,
lines: false,
columns: [{
xtype: 'treecolumn',
text: '模块名称',
width: 178,
dataIndex: 'DESCRIPTION'
}],
listeners: {
scope: this,
'itemclick': function (_this, record, item, index, e, eOpts) {
if (record.data.MODULEURL == '@') {
this.tabapplypanel.activeTab = 0;
} else { record.data.MODULEURL != '#' }
{
if (Ext.getCmp('pnl' + record.data.NAME)) {
var children = this.tabapplypanel.items;
if (children) {
for (var i = 0, len = children.length; i < len; i++) {
if (children.items[i].id) {
if (children.items[i].id == 'pnl' + record.data.NAME) {
this.tabapplypanel.setActiveTab(i);
}
}
}
}
} else {
if (this.formHead.getForm().findField('CUSTNO').getValue() == "") {
Ext.Msg.show({ title: '注意', msg: '请先保存业务信息后再打开其他模块!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
} else {
if (record.data.NAME == 'modBulkAllFee') {
var paneltabitems = new Shipping.BulkFee({
id: 'pnl' + record.data.NAME,
layout: "border",
region: "center",
autoScroll: true,
frame: false,
title: record.data.DESCRIPTION
});
} else if (record.data.NAME == 'modBulkAmendFee') {
var paneltabitems = new Shipping.ApplyAmendFee({
id: 'pnl' + record.data.NAME,
layout: "border",
region: "center",
autoScroll: true,
frame: false,
title: record.data.DESCRIPTION
});
} else {
var paneltabitems = new Ext.Panel({
id: 'pnl' + record.data.NAME,
layout: "fit",
region: "center",
autoScroll: true,
frame: false,
title: record.data.DESCRIPTION,
html: ' <iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="' + record.data.MODULEURL + '"> </iframe>'
});
}
this.tabapplypanel.add(paneltabitems);
this.tabapplypanel.setActiveTab(paneltabitems);
this.tabapplypanel.doLayout();
}
}
}
}
}
/* ,
root: {
expanded: true,
children: [{
text: '基本信息',
leaf: true
}, {
text: '费用信息',
leaf: true
}
]
}
*/
});
/*
this.panel_west = new Ext.Panel
({
id: 'panWestMenu',
region: 'west',
title: '报关业务操作',
split: true,
width: 180,
collapsible: true,
margins: '0 0 0 0',
layout: 'accordion',
items: [this.tabtree],
layoutConfig: { animate: true }
});
*/
this.panelapply = new Ext.Panel({
title: '大宗散货委托信息',
id: 'pnlmodOpBulkOpwt',
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
frame: false,
items: [this.panelBtn, this.formHead, this.tabpanel]
});
this.tabapplypanel = new Ext.TabPanel
({
activeTab: 0,
autoWidth: true,
border: true,
frame: false,
region: 'center',
id: "TabapplyPanel",
enableTabScroll: true,
items:
[
this.panelapply
],
listeners: {
scope: this,
'beforetabchange': function (tabPanel, newCard, oldCard, eOpts) {
if (oldCard.id == "pnlmodBulkAllFee") {
var feemodify = oldCard.panelFee.getModifyStatus();
if (feemodify) {
Ext.Msg.show({ title: '警告', msg: '费用未保存,请先保存费用!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return false;
}
}
if (oldCard.id == "pnlmodBulkAmendFee") {
var feemodify = oldCard.panelFee.getModifyStatus();
if (feemodify) {
Ext.Msg.show({ title: '警告', msg: '更改单未保存,请先保存更改单!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return false;
}
}
}
}
});
Ext.apply(this, {
items: [this.tabtree, this.tabapplypanel]
});
parentWin = window.parent.opener;
this.InitData();
this.LoadMustBe();
//绑定事件
this.gridTruckList.on('edit', function (editor, e, eOpts) {
this.gridAfterEdit(editor, e, eOpts);
}, this);
this.gridListTrain.on('edit', function (editor, e, eOpts) {
this.gridAfterEdit(editor, e, eOpts);
}, this);
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsSysParamSet/GetData',
params: {
condition: "PARAMNAME='ACCDATESAMEETD'"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
} else {
var data = result.data;
if (data.PARAMVALUE == '1') {
this.accdatesameetd = 1;
} else {
}
}
} else {
}
},
scope: this
});
}, //end initUIComponents
InitData: function () {
this.opStatus = 'add';
var condition = '';
_this = this;
if (parentWin) {
var ret = parentWin.OprationSwap();
this.opStatus = ret[0];
this.StoreList = ret[1];
this.editRecord = ret[2];
}
if (this.opStatus == 'edit') {
condition = " BsNo='" + this.editRecord.get('BSNO') + "'";
var s = " SOURCEID=(select SOURCEID from code_source where SOURCENAME='" + this.editRecord.get('BSSOURCE') + "')";
this.storeSourceDetail.load({ params: { condition: s} });
}
this.LoadData(this.opStatus, condition);
}, //end InitData
LoadData: function (opstatus, condition) {
this.serialNo = 0;
this.bodyDel = [];
this.opStatus = opstatus;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsOpBulk/GetData',
params: {
handle: opstatus,
condition: condition
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
data = result.data;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(data);
this.formHead.getForm().reset();
this.formHead.getForm().setValues(data);
this.GetEditStatus();
if (this.opStatus == 'add') {
this.LoadDefValue();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
var billno = '*';
var gid = '*';
if (this.opStatus == 'edit') {
billno = this.editRecord.get('BSNO');
}
var condition = " BSNO='" + billno + "'";
this.storeBodyList.load({ params: { condition: condition + " and ISTRAIN='1' "} });
this.storeBodyTrainList.load({ params: { condition: condition} });
this.storeBodyTruckList.load({ params: { condition: condition + " AND ISTRAIN='0' "} });
},
LoadPeriod: function () {
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/Account/ChMonthClose/GetNowPeriod',
params: {
condition: ''
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
return;
}
data = result.data;
this.MsPeriod = data;
var ETD = this.formEdit.getForm().findField('ETD').getValue();
if (ETD == '') {
this.formEdit.getForm().findField('ETD').setMinValue(this.MsPeriod.FDAY);
} else {
var oDate1 = new Date(ETD);
var oDate2 = new Date(this.MsPeriod.FDAY);
if (oDate1.getTime() >= oDate2.getTime()) {
this.formEdit.getForm().findField('ETD').setMinValue(this.MsPeriod.FDAY);
} else {
this.formEdit.getForm().findField('ETD').setReadOnly(true);
}
}
var ACCDATE = this.formHead.getForm().findField('ACCDATE').getValue();
var oDate1 = new Date(ACCDATE + '-01');
var oDate2 = new Date(this.MsPeriod.PERIOD + '-01');
if (oDate1.getTime() >= oDate2.getTime()) {
this.formHead.getForm().findField('ACCDATE').setMinValue(this.MsPeriod.PERIOD);
} else {
this.formHead.getForm().findField('ACCDATE').setReadOnly(true);
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
// end LoadDate
Save: function (type) {
var basicForm = this.formEdit.getForm();
var basicForm2 = this.formHead.getForm();
var PORTLOAD = this.formEdit.getForm().findField('PORTLOAD').value;
if (!basicForm.isValid()) {
return;
}
if (!basicForm2.isValid()) {
return;
}
var bodydatas = [];
for (var i = 0; i < this.storeBodyList.getCount(); i += 1) {
var member = this.storeBodyList.getAt(i);
bodydatas.push(member);
}
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
var jsonDelBody = ConvertRecordsToJsonAll(this.bodyDel);
this.formHead.getForm().findField('BSNO').setDisabled(false);
var data = this.formHead.getForm().getValues(false, false, false);
var data2 = this.formEdit.getForm().getValues(false, false, false);
this.formHead.getForm().findField('BSNO').setDisabled(true);
/*
for (var i = 0; i < this.myCheckboxGroup.items.length; i++) {
if (this.myCheckboxGroup.items.items[i].checked) {
data["'"+this.myCheckboxGroup.items.items[i].name+"'"]=1;
}
}
*/
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOpBulk/Save',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
data2: Ext.JSON.encode(data2),
body: jsonBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(returnData);
this.formHead.getForm().reset();
this.formHead.getForm().setValues(returnData);
if (this.opStatus == 'add') {
var arrNewRecords = this.StoreList.add(returnData);
this.editRecord = arrNewRecords[0];
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('MsOpBulk', returnData);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'id')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
}
if (type == '0') {
this.opStatus = 'edit';
basicForm2.findField('BSNO').setDisabled(true);
} else if (type == '1') {
window.close();
} else if (type == '2') {
this.LoadData('add', '');
}
this.portchange(PORTLOAD);
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
} //end save
,
onAddDetailClick: function (button, event) {
this.addDetail();
}, //end onAddDetailClick
onDelDetailClick: function (button, event) {
this.deleteDetail();
}, //onDelDetailClick
onAddTruckDetailClick: function (button, event) {
this.addTruckDetail();
}, //end onAddDetailClick
onDelTruckDetailClick: function (button, event) {
this.deleteTruckDetail();
}, //onDelDetailClick
onAddDetailTrainClick: function (button, event) {
this.addDetailTrain();
}, //end onAddDetailClick
onDelDetailTrainClick: function (button, event) {
this.deleteDetailTrain();
}, //onDelDetailClick
gridAfterEdit: function (editor, e, eOpts) {
if (e.field == 'PKGS' || e.field == 'KGS') {
this.calcDetailTotal();
}
},
cellEditingBeforeEdit: function (editor, e) {
var allow = this.getAllowOperationDetail();
if (allow == false) {
return;
}
var AccStatus = e.record.get('ACCSTATUS');
var canedit = !AccStatus;
var op = this.formHead.getForm().findField('OP').getValue();
if (canedit) {
var records = DsStoreQueryBy(this.StoreOpRange, 'OPID', op);
if (records.getCount() > 0) {
} else {
Ext.Msg.show({ title: '提示', msg: '你没有权限修改!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
canedit = false;
}
}
return canedit;
},
calcDetailTotal: function () {
var ttlpkgs = 0;
var ttlkgs = 0;
for (var i = 0; i < this.storeBodyTruckList.getCount(); i += 1) {
var member = this.storeBodyTruckList.getAt(i);
var accstatus = member.get('ACCSTATUS');
if (accstatus = true) {
var pkgs = member.get('PKGS');
var kgs = member.get('KGS');
ttlpkgs = parseFloat(ttlpkgs).add( parseFloat(pkgs));
ttlkgs = parseFloat(ttlkgs).add(parseFloat(kgs));
}
}
for (var i = 0; i < this.storeBodyTrainList.getCount(); i += 1) {
var member = this.storeBodyTrainList.getAt(i);
var accstatus = member.get('ACCSTATUS');
if (accstatus = true) {
var pkgs = member.get('PKGS');
var kgs = member.get('KGS');
ttlpkgs = parseFloat(ttlpkgs).add( parseFloat(pkgs));
ttlkgs = parseFloat(ttlkgs).add( parseFloat(kgs));
}
}
this.setHeadFieldValue('OVERKGS', Ext.util.Format.number(parseFloat(ttlkgs), '00.00'));
this.setHeadFieldValue('OVERPKGS', Ext.util.Format.number(parseFloat(ttlpkgs), '00.00'));
},
setHeadFieldValue: function (fieldName, value) {
var field = this.formEdit.getForm().findField(fieldName);
field.setValue(value);
},
getAllowOperationDetail: function () {
var BsStatus = this.formHead.getForm().findField('BSSTATUSREF').getValue();
if (BsStatus == "未锁定")
return true;
else {
Ext.Msg.show({ title: '错误', msg: "此票委托已业务已锁定!", icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return false;
}
},
GetHandleSerialNo: function (store) {
var result = 0;
if (result == 0) {
for (var i = 0; i < store.getCount(); i += 1) {
var member = store.getAt(i);
if (member.data.SerialNo > result) {
result = member.data.SerialNo;
}
}
}
result = result + 1;
return result;
},
addDetail: function () {
var BSNO = this.editRecord.get('BSNO');
var PORTLOAD = this.editRecord.get('PORTLOAD');
if (BSNO == '*') {
Ext.Msg.show({ title: '注意', msg: '请先保存业务信息再添加运输明细!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
if (PORTLOAD == '') {
Ext.Msg.show({ title: '注意', msg: '起运站点不能为空,请录入并保存后再录入运输明细!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var newSerialno = DsGetNewSerialNo(this.storeBodyList, 0);
var record = Ext.create('MsOpBulkDetail', {
BSNO: '*',
SerialNo: newSerialno,
ISTRAIN: '1',
TRUCKNO: '',
DRVNAME: '',
STATIONNO: PORTLOAD,
EXPDATE: '',
PKGS: 0,
KGS: 0,
NETKGS: 0,
TAREKGS: 0,
PKGKGS: 0,
POUNDNO: '',
TRANSTOTAL: 0,
TRANSOT: 0,
REMARK: ''
});
this.storeBodyList.add(record);
var n = this.storeBodyList.getCount();
this.gridListCellEditing.startEditByPosition({ row: n - 1, column: 2 });
},
deleteDetail: function () {
var selectedRecords = this.GridCheckBoxModel.selected.items;
var BSNO = this.formHead.getForm().findField('BSNO').getValue();
Ext.MessageBox.confirm('提示', '确定要删除选中的明细吗?', function (btn) {
if (btn == 'yes') {
var bodyDatas = [];
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.BSNO == "" || rec.BSNO == "*") //如果是新增但没有保存的数据,没有必要提交到后台
{
this.storeBodyList.remove(selectedRecords[i]);
} else {
bodyDatas.push(rec);
}
}
var jsonBody = ConvertRecordsToJsonAll(bodyDatas);
_this = this;
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsOpBulk/DeleteDetail',
params: {
bsno: BSNO,
body: jsonBody
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
for (var i = 0; i < selectedRecords.length; i++) {
this.storeBodyList.remove(selectedRecords[i]);
}
this.gridList.getView().refresh();
var PORTLOAD = this.formEdit.getForm().findField('PORTLOAD').value;
this.portchange(PORTLOAD);
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
},
onPostDetailClick: function (button, event) {
var bodyDatas = [];
var i;
var BSNO = this.formHead.getForm().findField('BSNO').getValue();
var PORTLOAD = this.formEdit.getForm().findField('PORTLOAD').value;
for (i = 0; i < this.storeBodyList.getCount(); i += 1) {
var memberyf = this.storeBodyList.getAt(i);
bodyDatas.push(memberyf);
};
var jsonBody = ConvertBSNORecordsToJson(bodyDatas);
_this = this;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOpBulk/SaveDetail',
scope: this,
params: {
bsno: BSNO,
body: jsonBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
for (var i = 0; i < this.storeBodyList.getCount(); i += 1) {
var member = this.storeBodyList.getAt(i);
member.set("BSNO", BSNO);
member.commit();
}
this.portchange(PORTLOAD);
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
}, //end save
onAuditDetailClick: function (button, event) {
var bodyDatas = [];
var i;
var BSNO = this.formHead.getForm().findField('BSNO').getValue();
var selectedRecords = this.GridCheckBoxModel.selected.items;
var PORTLOAD = this.formEdit.getForm().findField('PORTLOAD').value;
var GidStr = '';
Ext.MessageBox.confirm('提示', '确定要将明细记账吗?', function (btn) {
if (btn == 'yes') {
_this = this;
Ext.Msg.wait('正在记账...');
Ext.Ajax.request({
waitMsg: '正在记账...',
url: '/MvcShipping/MsOpBulk/AuditDetail',
params: {
bsno: BSNO,
audit: true
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
for (var i = 0; i < this.storeBodyList.getCount(); i += 1) {
var member = this.storeBodyList.getAt(i);
member.set("BSNO", BSNO);
member.set("ACCSTATUS", true);
member.commit();
}
this.portchange(PORTLOAD);
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
}, //end save
addTruckDetail: function () {
var BSNO = this.editRecord.get('BSNO');
var PORTLOAD = this.editRecord.get('PORTLOAD');
if (BSNO == '*') {
Ext.Msg.show({ title: '注意', msg: '请先保存业务信息再添加运输明细!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
if (PORTLOAD == '') {
Ext.Msg.show({ title: '注意', msg: '起运站点不能为空,请录入并保存后再录入运输明细!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var newSerialno = DsGetNewSerialNo(this.storeBodyTruckList, 0);
var record = Ext.create('MsOpBulkDetail', {
BSNO: '*',
SerialNo: newSerialno,
ISTRAIN: '0',
TRUCKNO: '',
DRVNAME: '',
STATIONNO: PORTLOAD,
EXPDATE: '',
PKGS: 0,
KGS: 0,
NETKGS: 0,
TAREKGS: 0,
PKGKGS: 0,
POUNDNO: '',
TRANSTOTAL: 0,
TRANSOT: 0,
REMARK: ''
});
this.storeBodyTruckList.add(record);
var n = this.storeBodyTruckList.getCount();
this.gridTruckListCellEditing.startEditByPosition({ row: n - 1, column: 2 });
},
deleteTruckDetail: function () {
var selectedRecords = this.GridTruckCheckBoxModel.selected.items;
var BSNO = this.formHead.getForm().findField('BSNO').getValue();
Ext.MessageBox.confirm('提示', '确定要删除选中的明细吗?', function (btn) {
if (btn == 'yes') {
var bodyDatas = [];
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.BSNO == "" || rec.BSNO == "*") //如果是新增但没有保存的数据,没有必要提交到后台
{
this.storeBodyTruckList.remove(selectedRecords[i]);
} else {
bodyDatas.push(rec);
}
}
var jsonBody = ConvertRecordsToJsonAll(bodyDatas);
_this = this;
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsOpBulk/DeleteDetail',
params: {
bsno: BSNO,
body: jsonBody
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
for (var i = 0; i < selectedRecords.length; i++) {
this.storeBodyTruckList.remove(selectedRecords[i]);
}
this.gridTruckList.getView().refresh();
this.calcDetailTotal();
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
},
onPostTruckDetailClick: function (button, event) {
var bodyDatas = [];
var i;
var BSNO = this.formHead.getForm().findField('BSNO').getValue();
var PORTLOAD = this.formEdit.getForm().findField('PORTLOAD').value;
for (i = 0; i < this.storeBodyTruckList.getCount(); i += 1) {
var memberyf = this.storeBodyTruckList.getAt(i);
bodyDatas.push(memberyf);
};
var jsonBody = ConvertBSNORecordsToJson(bodyDatas);
_this = this;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOpBulk/SaveDetail',
scope: this,
params: {
bsno: BSNO,
body: jsonBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
for (var i = 0; i < this.storeBodyTruckList.getCount(); i += 1) {
var member = this.storeBodyTruckList.getAt(i);
member.set("BSNO", BSNO);
member.commit();
}
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
}, //end save
onAuditTruckDetailClick: function (button, event) {
var bodyDatas = [];
var i;
var BSNO = this.formHead.getForm().findField('BSNO').getValue();
var selectedRecords = this.GridTruckCheckBoxModel.selected.items;
var PORTLOAD = this.formEdit.getForm().findField('PORTLOAD').value;
var GidStr = '';
Ext.MessageBox.confirm('提示', '确定要将明细记账吗?', function (btn) {
if (btn == 'yes') {
_this = this;
Ext.Msg.wait('正在记账...');
Ext.Ajax.request({
waitMsg: '正在记账...',
url: '/MvcShipping/MsOpBulk/AuditDetail',
params: {
bsno: BSNO,
audit: true
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
for (var i = 0; i < this.storeBodyTruckList.getCount(); i += 1) {
var member = this.storeBodyTruckList.getAt(i);
member.set("BSNO", BSNO);
member.set("ACCSTATUS", true);
member.commit();
}
this.calcDetailTotal();
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
},
addDetailTrain: function () {
var newSerialno = DsGetNewSerialNo(this.storeBodyTrainList, 0);
var record = Ext.create('MsOpBulkTrainDetail', {
BSNO: '*',
SerialNo: newSerialno,
TRAINNO: '',
TRAINTYPE: '',
INVNO: '',
STATIONNO: '',
ARRIVALSTATION: '',
EXPDATE: '',
PKGS: 0,
KGS: 0,
TRANSTOTAL: 0,
TRANSOT: 0,
REMARK: ''
});
this.storeBodyTrainList.add(record);
var n = this.storeBodyTrainList.getCount();
this.gridListTrainCellEditing.startEditByPosition({ row: n - 1, column: 2 });
},
deleteDetailTrain: function () {
var selectedRecords = this.GridTrainCheckBoxModel.selected.items;
var BSNO = this.formHead.getForm().findField('BSNO').getValue();
Ext.MessageBox.confirm('提示', '确定要删除选中的明细吗?', function (btn) {
if (btn == 'yes') {
var bodyDatas = [];
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.BSNO == "" || rec.BSNO == "*") //如果是新增但没有保存的数据,没有必要提交到后台
{
this.storeBodyTrainList.remove(selectedRecords[i]);
} else {
bodyDatas.push(rec);
}
}
var jsonBody = ConvertRecordsToJsonAll(bodyDatas);
_this = this;
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsOpBulk/DeleteTrainDetail',
params: {
bsno: BSNO,
body: jsonBody
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
for (var i = 0; i < selectedRecords.length; i++) {
this.storeBodyTrainList.remove(selectedRecords[i]);
}
this.gridListTrain.getView().refresh();
this.calcDetailTotal();
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
},
onPostDetailTrainClick: function (button, event) {
var bodyDatas = [];
var i;
var BSNO = this.formHead.getForm().findField('BSNO').getValue();
var PORTLOAD = this.formEdit.getForm().findField('PORTLOAD').value;
for (i = 0; i < this.storeBodyTrainList.getCount(); i += 1) {
var memberyf = this.storeBodyTrainList.getAt(i);
bodyDatas.push(memberyf);
};
var jsonBody = ConvertBSNORecordsToJson(bodyDatas);
_this = this;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOpBulk/SaveTrainDetail',
scope: this,
params: {
bsno: BSNO,
body: jsonBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
for (var i = 0; i < this.storeBodyTrainList.getCount(); i += 1) {
var member = this.storeBodyTrainList.getAt(i);
member.set("BSNO", BSNO);
member.commit();
}
this.portchange(PORTLOAD);
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
}, //end save
onAuditTrainClick: function (button, event) {
var bodyDatas = [];
var i;
var BSNO = this.formHead.getForm().findField('BSNO').getValue();
var selectedRecords = this.GridTrainCheckBoxModel.selected.items;
var PORTLOAD = this.formEdit.getForm().findField('PORTLOAD').value;
var GidStr = '';
Ext.MessageBox.confirm('提示', '确定要将选中的明细记账吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在记账...');
Ext.Ajax.request({
waitMsg: '正在记账...',
url: '/MvcShipping/MsOpBulk/AuditTrainDetail',
params: {
bsno: BSNO,
audit:true
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
for (var i = 0; i < this.storeBodyTrainList.getCount(); i += 1) {
var member = this.storeBodyTrainList.getAt(i);
member.set("BSNO", BSNO);
member.set("ACCSTATUS", true);
member.commit();
}
this.portchange(PORTLOAD);
this.calcDetailTotal();
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
}, //end save
GetEditStatus: function () {
var canedit = false;
var bsStatus = this.formHead.getForm().findField('BSSTATUS').getValue();
var inputby = this.formHead.getForm().findField('INPUTBY').getValue();
var op = this.formHead.getForm().findField('OP').getValue();
var trantype = this.formHead.getForm().findField('TRANSTYPE').getValue();
this.trantypechange(trantype);
_this = this;
if (bsStatus == "true") {
canedit = false;
this.setSaveBtnStatus(canedit);
} else {
this.StoreOpRange.load({ params: { optype: "modOpBulkOpwt" },
callback: function (r, options, success) {
if (success) {
if (r.length != 0) {
var records = DsStoreQueryBy(_this.StoreOpRange, 'OPID', op);
if (records.getCount() > 0) {
canedit = true;
} else {
var recordins = DsStoreQueryBy(_this.StoreOpRange, 'OPID', inputby);
if (recordins.getCount() > 0) {
canedit = true;
} else {
canedit = false;
}
}
} else { canedit = false; }
_this.setSaveBtnStatus(canedit);
}
}
});
}
_this = this;
Ext.Ajax.request({
waitMsg: '正在查询委托编号状态...',
url: '/MvcShipping/MsBaseInfo/GetRuleEdit',
params: {
rulename: '委托编号',
ruletype: '7'
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
var custno = _this.formHead.getForm().findField('CUSTNO');
custno.setReadOnly(true);
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
trantypechange: function (trantype) {
var PORTLOAD = this.formEdit.getForm().findField('PORTLOAD').value;
_this = this;
if (trantype == '公路') {
this.panelBody.removeAll(false);
this.panelBody.add(_this.panelTruckgl);
this.panelBody.doLayout();
this.panelpage1.removeAll(false);
this.panelpage1.add(this.formEdit);
this.panelpage1.add(this.panelBody);
this.panelpage1.doLayout();
} else {
this.panelBody.removeAll(false);
this.panelBody.add(_this.panelTruck);
this.panelBody.add(_this.panelTrain);
this.panelBody.doLayout();
this.panelpage1.removeAll(false);
this.panelpage1.add(this.formEdit);
this.panelpage1.add(this.formKC);
this.panelpage1.add(this.panelBody);
this.panelpage1.doLayout();
if (PORTLOAD != '') {
var condition = "STATIONNO='" + PORTLOAD + "'"
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsOpBulk/GetStationKc',
params: {
condition: condition
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
data = result.data;
_this.formKC.getForm().reset();
_this.formKC.getForm().setValues(data);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
}
},
portchange: function (PORTLOAD) {
var trantype = this.formHead.getForm().findField('TRANSTYPE').value;
_this = this;
if (trantype == '公路') {
} else {
if (PORTLOAD != '') {
var condition = "STATIONNO='" + PORTLOAD + "'"
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsOpBulk/GetStationKc',
params: {
condition: condition
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
data = result.data;
_this.formKC.getForm().reset();
_this.formKC.getForm().setValues(data);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
}
},
setSaveBtnStatus: function (enable) {
var btnESave = Ext.getCmp('btnESave');
var btnESaveAndClose = Ext.getCmp('btnESaveAndClose');
var btnESaveAndNew = Ext.getCmp('btnESaveAndNew');
var btnEAddDetail = Ext.getCmp('btnadddetail');
var btnEDeleteDetail = Ext.getCmp('btndeldetail');
if (enable) {
btnESave.enable();
btnESaveAndClose.enable();
btnESaveAndNew.enable();
btnEAddDetail.enable();
btnEDeleteDetail.enable();
} else {
btnESave.disable();
btnESaveAndClose.disable();
btnESaveAndNew.disable();
btnEAddDetail.disable();
btnEDeleteDetail.disable();
}
},
onImportDetailClick: function (button, event, type) {
var BSNO = this.formHead.getForm().findField('BSNO').getValue();
var condition = " BSNO='" + BSNO + "'";
me = this;
var imgform = new Ext.FormPanel({
region: 'center',
labelWidth: 20,
frame: true,
autoScroll: false,
border: false,
fileUpload: true,
items: [{
xtype: 'fileuploadfield',
id: 'LoadExcel',
name: 'LoadExcel',
emptyText: '请选择EXCEL文件',
fieldLabel: 'EXCEL',
buttonText: '选择文件',
allowBlank: false,
width: 200,
buttonCfg:
{
iconCls: 'uploaddialog'
},
anchor: '98%'
}],
buttons: [{
text: '上传',
type: 'submit',
handler: function () {
var UserFilePath = Ext.getCmp('LoadExcel').getValue();
if (!CheckFileExt(UserFilePath, /.xls|.xlsx/i)) {
Ext.Msg.show({ title: '错误', msg: '请确认你上传的文件为EXCEL文件!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (!imgform.form.isValid()) { return; }
imgform.form.submit({
url: '/MvcShipping/MsOpBulk/ImportDetail',
waitMsg: '正在上传',
method: 'POST',
params: {
bsno: BSNO,
updatetype: type
},
success: function (form, action) {
win.close(this);
Ext.Msg.show({ title: '提示', msg: '上传成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
if (type == 1) {
me.storeBodyList.load({ params: { condition: condition + " and ISTRAIN='1' "} });
} else if (type == 2) {
me.storeBodyTruckList.load({ params: { condition: condition + " and ISTRAIN='0' "} });
} else if (type == 3) {
me.storeBodyTrainList.load({ params: { condition: condition} });
}
},
failure: function (form, action) {
form.reset();
if (action.failureType == Ext.form.Action.SERVER_INVALID)
Ext.MessageBox.alert('警告', action.result.errors.msg);
}
});
}
}, {
text: '关闭',
type: 'submit',
handler: function () {
win.close(this);
}
}]
});
var win = new Ext.Window({
title: "上传EXCEL",
width: 380,
height: 120,
modal: true,
resizable: false,
border: false,
items: imgform
});
win.show();
// var winAccess = new Shipping.FileImport({
// });
// winAccess.StoreList = this.storeList;
// winAccess.ImportUrl = "/MvcShipping/MsOpBulk/ImportDetail";
// winAccess.BSNO = BSNO;
// winAccess.show();
return;
},
LoadDefValue: function () {
this.storeDefValue.load({ params: { condition: "BSTYPE='大宗散货'" },
callback: function (r, options, success) {
if (success) {
if (this.storeDefValue.getCount() > 0) {
for (var j = 0; j < this.storeDefValue.getCount(); j += 1) {
var member = this.storeDefValue.getAt(j);
var headfield = this.formHead.getForm().findField(member.data.FIELDNAME);
if (headfield != NaN && headfield != null)
headfield.setValue(member.data.DEFVALUE);
var headfield = this.formEdit.getForm().findField(member.data.FIELDNAME);
if (headfield != NaN && headfield != null)
headfield.setValue(member.data.DEFVALUE);
};
} else {
}
}
},
scope: this
});
},
LoadMustBe: function () {
this.storeMustBe.load({ params: { condition: "BSTYPE='综合业务'" },
callback: function (r, options, success) {
if (success) {
if (this.storeMustBe.getCount() > 0) {
for (var j = 0; j < this.storeMustBe.getCount(); j += 1) {
var member = this.storeMustBe.getAt(j);
var headfield = this.formHead.getForm().findField(member.data.FIELDNAME);
if (headfield != NaN && headfield != null)
headfield.allowBlank = false;
var headfield = this.formEdit.getForm().findField(member.data.FIELDNAME);
if (headfield != NaN && headfield != null)
headfield.allowBlank = false;
};
} else {
}
}
},
scope: this
});
},
setGoodsName: function (GoodCode) {
var recs = DsStoreQueryBy(this.storeGoods, 'GOODCODE', GoodCode);
var basicForm = this.formEdit.getForm();
var goodsname = basicForm.findField('GOODSNAME');
if (recs.getCount() > 0) {
var data = recs.getAt(0).data;
goodsname.setValue(data.GOODSNAME);
} else {
goodsname.setValue('');
}
},
Print: function () {
var basicForm = this.formHead.getForm();
var billNo = basicForm.findField('CUSTNO').value;
var bsNo = basicForm.findField('BSNO').value;
if (billNo == '*' || billNo == '') {
Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var printType = 'MSWLBULK';
var sql1 = "SET LANGUAGE 'us_english' SELECT * FROM op_bulk WHERE BSNo = '" + bsNo + "'";
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
PrintDetail: function () {
var basicForm = this.formHead.getForm();
var billNo = basicForm.findField('CUSTNO').value;
var bsNo = basicForm.findField('BSNO').value;
if (billNo == '*' || billNo == '') {
Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var printType = 'MSWLBULKTRUCKDETAIL';
var sql1 = "SET LANGUAGE 'us_english' SELECT * FROM op_Bulk_detail WHERE BSNo = '" + bsNo + "'";
var sql2 = "SET LANGUAGE 'us_english' SELECT * FROM op_bulk WHERE BSNo = '" + bsNo + "'";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
PrintTrainDetail: function () {
var basicForm = this.formHead.getForm();
var billNo = basicForm.findField('CUSTNO').value;
var bsNo = basicForm.findField('BSNO').value;
if (billNo == '*' || billNo == '') {
Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var printType = 'MSWLBULKTRAINDETAIL';
var sql1 = "SET LANGUAGE 'us_english' SELECT * FROM op_Bulk_railway_detail WHERE BSNo = '" + bsNo + "'";
var sql2 = "SET LANGUAGE 'us_english' SELECT * FROM op_bulk WHERE BSNo = '" + bsNo + "'";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
PrintTrainTruck: function () {
var basicForm = this.formHead.getForm();
var billNo = basicForm.findField('CUSTNO').value;
var bsNo = basicForm.findField('BSNO').value;
if (billNo == '*' || billNo == '') {
Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var printType = 'MSWLBULKTRAINTRUCKDETAIL';
var sql1 = "SET LANGUAGE 'us_english' SELECT * FROM op_Bulk_detail WHERE BSNo = '" + bsNo + "'";
var sql2 = "SET LANGUAGE 'us_english' SELECT * FROM op_bulk WHERE BSNo = '" + bsNo + "'";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
getIsModify: function () {
var feepanel = Ext.getCmp('pnlmodBulkAllFee');
if (feepanel != NaN && feepanel != null) {
var feemodify = feepanel.panelFee.getModifyStatus();
if (feemodify) {
return '费用信息';
}
}
var feeamendpanel = Ext.getCmp('pnlmodBulkAmendFee');
if (feeamendpanel != NaN && feeamendpanel != null) {
var feemodify = feeamendpanel.panelFee.getModifyStatus();
if (feemodify) {
return '更改单信息';
}
}
if (this.formHead.getForm().isDirty() == true || this.formEdit.getForm().isDirty() == true) {
return '业务信息';
}
else return '';
}
});