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.

1749 lines
61 KiB
JavaScript

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

Ext.namespace('Shipping');
Shipping.MsCodeGoodsEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsCodeGoodsEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsCodeGoodsEdit, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
storeList: null,
EditRecord: null,
status:null,
feeType: 0,
StoreFee: null,
initUIComponents: function () {
this.serialNo = 0;
this.workSerialNo = 0;
this.bodyDel = [];
this.CodeGoodsEdit = getUrlParam('CodeGoodsEdit');
//#region 编辑form
//枚举参照相关(编辑form)
//箱主
this.storeCARRIER = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListCARRIER' }
});
this.storeiii = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListCARRIER' }
});
this.storeOther = Ext.create('DsExt.ux.RefTableStore', {
model: 'aaaModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListCARRIER' }
});
this.storeOther.load({ params: { condition: "ISCARRIER='1'"} });
this.storeCARRIER.load({ params: { condition: "ISCARRIER='1'"} });
//船公司
this.comboxCARRIER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '箱主',
store: this.storeCARRIER,
name: 'CNTROWNER',
valueField: 'CustName',
displayField: 'CodeAndName',
allowBlank: false
});
//场站
this.storeYARD = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListYARD' }
});
this.storeYARD.load();
//
this.comboxYARD = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeYARD,
forceSelection: true,
name: 'YARD',
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.ecz = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeYARD,
forceSelection: true,
name: 'eYARD',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//箱型
this.storeCodeCtn = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeCtnModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeCtnList' }
});
this.storeCodeCtn.load();
this.comboxCTNTYPE = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCodeCtn,
forceSelection: true,
name: 'cntype',
valueField: 'CTN',
displayField: 'CTN'
});
//港口
this.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.PortRefModel',
proxy: { url: '/MvcShipping/MsBaseInfo/GetPortRefList' }
});
this.storeCodeDisport.load();
this.comboxPORTLOAD = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCodeDisport,
forceSelection: true,
name: 'SPORT',
valueField: 'PORT',
displayField: 'PORT'
});
//状态
this.StoreStatus = Ext.create('Ext.data.Store', {
fields: ['NAME']
});
this.StoreStatus.add({ "NAME": "可用" });
this.StoreStatus.add({ "NAME": "已用" });
this.StoreStatus.add({ "NAME": "维修" });
this.StoreStatus.add({ "NAME": "停用" });
this.StoreStatus.add({ "NAME": "退租" });
this.StoreStatus.add({ "NAME": "灭失" });
this.StoreStatus.add({ "NAME": "卖出" });
this.comboxStatus = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreStatus,
forceSelection: true,
name: 'status',
valueField: 'NAME',
displayField: 'NAME'
});
//oneway
this.Storeoneway = Ext.create('Ext.data.Store', {
fields: ['onewayn']
});
this.Storeoneway.add({ "onewayn": "√" });
this.Storeoneway.add({ "onewayn": "×" });
this.onewayStatus = Ext.create('DsExt.ux.RefTableCombox', {
store: this.Storeoneway,
forceSelection: true,
name: 'oneway',
valueField: 'onewayn',
displayField: 'onewayn'
});
//freeuse
this.freeuseStatus = Ext.create('DsExt.ux.RefTableCombox', {
store: this.Storeoneway,
forceSelection: true,
name: 'freeuse',
valueField: 'onewayn',
displayField: 'onewayn'
});
//结束位置港口
this.EPORT = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCodeDisport,
forceSelection: true,
name: 'EPORT',
valueField: 'PORT',
displayField: 'PORT'
});
//租入箱主
this.comboxZuRu = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '箱主',
store: this.storeCARRIER,
name: 'CNTROWNER',
valueField: 'CustName',
displayField: 'CodeAndName',
allowBlank: false
});
//币别
this.StoreCurr = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeCurr',
proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' }
});
this.StoreCurr.load({ params: { condition: ""} });
this.comboxCurr = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreCurr,
forceSelection: true,
name: 'CURRENCY',
valueField: 'CURR',
displayField: 'CURR'
});
//租出箱主
this.comboxZuchu = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '箱主',
store: this.storeCARRIER,
name: 'CNTROWNER',
valueField: 'CustName',
displayField: 'CodeAndName',
allowBlank: false
});
//卖出箱主
this.comboxSell = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '箱主',
store: this.storeCARRIER,
name: 'CNTROWNER',
valueField: 'CustName',
displayField: 'CodeAndName',
allowBlank: false
});
//购买方
this.Buycombox = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '购买方',
store: this.storeOther,
name: 'SELLBY',
valueField: 'CustName',
displayField: 'CodeAndName',
allowBlank: false
});
//出租方
this.comboxcZuRu = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '出租方',
store: this.storeCARRIER,
name: 'SELLBY',
valueField: 'CustName',
displayField: 'CodeAndName',
allowBlank: false
});
//承租方(chu)
this.comboxcZuChu= Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '承租方',
store: this.storeOther,
name: 'SELLBY',
valueField: 'CustName',
displayField: 'CodeAndName',
allowBlank: false
});
//出租方
this.comboxcZuRu = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '出租方',
store: this.storeOther,
name: 'SELLBY',
valueField: 'CustName',
displayField: 'CodeAndName',
allowBlank: false
});
this.comboxmaixiang = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '卖箱单位',
store: this.storeOther,
name: 'SELLBY',
valueField: 'CustName',
displayField: 'CodeAndName',
allowBlank: false
});
this.storeCnsource = Ext.create('Ext.data.Store', {
fields: [ 'SOURCE']
});
this.storeCnsource.add({ "SOURCE": "自备箱", "SOURCE": "自备箱" });
this.storeCnsource.add({ "SOURCE": "长租箱", "SOURCE": "长租箱" });
this.storeCnsource.add({ "SOURCE": "短租箱", "SOURCE": "短租箱" });
this.storeCnsource.add({ "SOURCE": "租买箱", "SOURCE": "租买箱" });
this.storeCnsource.add({ "SOURCE": "FreeUse箱", "SOURCE": "FreeUse箱" });
this.cnsource = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '箱源',
store: this.storeCnsource,
valueField: 'SOURCE',
displayField: 'SOURCE',
name: 'CNSOURCE'
});
//租入箱源
this.cnsourceZuRu = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '箱源',
store: this.storeCnsource,
valueField: 'SOURCE',
displayField: 'SOURCE',
name: 'CNSOURCE'
});
//租出箱源
this.cnsourceZuChu = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '箱源',
store: this.storeCnsource,
valueField: 'SOURCE',
displayField: 'SOURCE',
name: 'CNSOURCE'
});
//明细箱源
this.cnsourceMX = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCnsource,
forceSelection: true,
valueField: 'SOURCE',
displayField: 'SOURCE',
name: 'CNSOURCE'
});
//卖出箱源
this.cnsourceMaichu = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '箱源',
store: this.storeCnsource,
valueField: 'SOURCE',
displayField: 'SOURCE',
name: 'CNSOURCE'
});
//表参照相关(编辑form)
//编辑form
_a=this;
this.formEdit = Ext.widget('form', {
title:'买箱单',
region: 'center',
frame: true,
bodyPadding: 5,
autoScroll: 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: 'GID',
name: 'GID',
hidden:true
}, {
fieldLabel: '类别',
name:'CTNTYPEREF',
hidden:true
}
,
{
fieldLabel: '委托编号',
name: 'BSNO',
allowBlank: false
}, _a.comboxCARRIER,
{
fieldLabel: '22222',
name: 'CTNTYPE',
value:'1',
hidden:true
},
{
fieldLabel: '审核状态',
name:'STATUSREF',
value:'新建',
readOnly:true
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [_a.cnsource, {
fieldLabel: '购买日期',
format: 'Y-m-d',
xtype: 'datefield',
flex: 1,
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
name: 'BUYTIME',
allowBlank: false,
},_a.comboxmaixiang]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '操作人',
name: 'INPUTBY',
readOnly:true
},
{
fieldLabel: '操作时间',
name: 'BSDATE',
readOnly:true
},
{
fieldLabel: '备注',
name: 'Remarks'
}]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}); //end this.formEdit
//租入界面
_this=this;
this.formZuRu = Ext.widget('form', {
title:'租入界面',
region: 'center',
frame: true,
bodyPadding: 5,
autoScroll: 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: 'GID',
name: 'GID',
hidden:true
},
{
fieldLabel: '类别',
name:'CTNTYPEREF',
hidden:true
}
, {
fieldLabel: '委托编号',
name: 'BSNO',
allowBlank: false
}, this.comboxZuRu,
{
fieldLabel: '审核状态',
name:'STATUSREF',
value:'新建'
},
{
fieldLabel: 'CTNTYPE',
name: 'CTNTYPE',
value:'2',
hidden:true
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.cnsourceZuRu,this.comboxcZuRu,
,{
fieldLabel: '操作人',
name: 'INPUTBY',
readOnly:true
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '租用开始日期',
id:"zsdate",
format: 'Y-m-d',
xtype: 'datefield',
flex: 1,
name: 'RENT_BEGINTIME',
allowBlank: false,
listeners:{
         blur: function(){
var zsdate = Ext.getCmp('zsdate').rawValue;
var zedate = Ext.getCmp('zedate').rawValue;
var zts=Ext.getCmp('zday');
             if (zedate!="") {
if (zsdate>zedate) {
alert("租用开始日期不能大于结束日期");
return false;
}
var zsd= _this.DateDiff(zedate,zsdate)+1;
ts.setValue(zsd);
}
         }
}
},
{
fieldLabel: '租用结束日期',
id:"zedate",
format: 'Y-m-d',
xtype: 'datefield',
flex: 1,
name: 'RENT_ENDTIME',
allowBlank: false,
listeners:{
         blur: function(){
var zsdate = Ext.getCmp('zsdate').rawValue;
var zedate = Ext.getCmp('zedate').rawValue;
var ts=Ext.getCmp('zday');
             if (zsdate!="") {
if (zsdate>zedate) {
alert("租用开始日期不能大于结束日期");
return false;
}
var zsd= _this.DateDiff(zedate,zsdate)+1;
ts.setValue(zsd);
}
        }
}
},
{
fieldLabel: '承租天数',
id:"zday",
name: 'RENTDAY',
readOnly:true,
allowBlank: false
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '操作时间',
name: 'BSDATE',
readOnly:true,
flex:1
},
{
fieldLabel: '备注',
name: 'Remarks',
flex:2
}]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}); //end this.formEdit
//租出界面
this.formZuChu = Ext.widget('form', {
title:'租出界面',
region: 'center',
frame: true,
bodyPadding: 5,
autoScroll: 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: 'GID',
name: 'GID',
hidden:true
}, {
fieldLabel: '类别',
name:'CTNTYPEREF',
hidden:true
}, {
fieldLabel: '委托编号',
name: 'BSNO',
allowBlank: false
}, this.comboxZuchu, {
fieldLabel: '审核状态',
name:'STATUSREF',
value:'新建'
},
{
fieldLabel: 'CTNTYPE',
name: 'CTNTYPE',
value:'3',
hidden:true
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.cnsourceZuChu,this.comboxcZuChu,{
fieldLabel: '操作人',
name: 'INPUTBY',
readOnly:true
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '租用开始日期',
id:"sdate",
format: 'Y-m-d',
xtype: 'datefield',
flex: 1,
name: 'RENT_BEGINTIME',
allowBlank: false,
listeners:{
         blur: function(){
var sdate = Ext.getCmp('sdate').rawValue;
var edate = Ext.getCmp('edate').rawValue;
var ts=Ext.getCmp('day');
             if (edate!="") {
if (sdate>edate) {
alert("租用开始日期不能大于结束日期");
return false;
}
var sd= _this.DateDiff(edate,sdate)+1;
ts.setValue(sd);
}
         }
}
},
{
fieldLabel: '租用结束日期',
format: 'Y-m-d',
id:"edate",
xtype: 'datefield',
flex: 1,
name: 'RENT_ENDTIME',
allowBlank: false,
listeners:{
         blur: function(){
var sdate = Ext.getCmp('sdate').rawValue;
var edate = Ext.getCmp('edate').rawValue;
var ts=Ext.getCmp('day');
             if (edate!="") {
if (sdate>edate) {
alert("租用开始日期不能大于结束日期");
return false;
}
var sd= _this.DateDiff(edate,sdate)+1;
ts.setValue(sd);
}
         }
}
},
{
fieldLabel: '承租天数',
name: 'RENTDAY',
allowBlank: false,
readOnly:true,
id:"day"
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '操作时间',
name: 'BSDATE',
flex:1,
readOnly:true
}
,{
fieldLabel: '备注',
name: 'Remarks',
flex:2
}]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}); //end this.formEdit
//新建卖箱单
this.formSell = Ext.widget('form', {
title:'卖箱单',
region: 'center',
frame: true,
bodyPadding: 5,
autoScroll: 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: 'GID',
name: 'GID',
hidden:true
}, {
fieldLabel: '类别',
name:'CTNTYPEREF',
hidden:true
},
{
fieldLabel: '委托编号',
name: 'BSNO',
allowBlank: false
}, this.comboxSell,,
{
fieldLabel: '审核状态',
name:'STATUSREF',
value:'新建',
readOnly:true
},
{
fieldLabel: 'CTNTYPE',
name: 'CTNTYPE',
value:'4',
hidden:true
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.cnsourceMaichu, {
fieldLabel: '卖出日期',
format: 'Y-m-d',
xtype: 'datefield',
flex: 1, name: 'SELLTIME',
allowBlank: false
},this.Buycombox]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [ {
fieldLabel: '操作人',
name: 'INPUTBY',
readOnly:true
},
{
fieldLabel: '操作时间',
name: 'BSDATE',
readOnly:true
},{
fieldLabel: '备注',
name: 'Remarks',
}]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}); //end this.formEdit
_ss=this;
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: "保存",
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0');
},
scope: this
},
{
text: "保存并关闭",
handler: function (button, event) {
this.Save('1');
},
scope: this
},
'-',
{
text: "保存并新建",
handler: function (button, event) {
this.Save('2');
},
scope: this
},
'-',
{
text: "复制新建",
handler: function (button, event) {
_aa=this;
var basicForm = this.formEdit.getForm();
this.opStatus = 'add';
basicForm.findField('PORTID').setDisabled(false);
var field = basicForm.findField('PORTID');
field.setValue(NewGuid());
basicForm.findField('PORTID').setDisabled(true);
field = basicForm.findField('CREATEUSERREF');
field.setValue('');
field = basicForm.findField('GOODNAME');
field.setValue('');
for (var j = 0; j < this.storeBodyList.getCount(); j += 1) {
var memberbody = this.storeBodyList.getAt(j);
memberbody.set("LINKGID", '*');
memberbody.commit();
};
},
scope: this
}
,
{
text: "提交审核",
id: "tjsh",
iconCls: "btnadd",
menu: [
{ text: "提交审核",
handler: function (button, event) {
var s = 2;
_ss.TjSh(button,event,s);
}
}, { text: "取消提交",
handler: function (button, event, s) {
var s = 1;
_ss.TjSh(button,event,s);
}
}],
scope: this
},
{
text: "审核通过",
id: "shtg",
iconCls: "btnsubmit",
menu: [
{ text: "审核通过",
handler: function (button, event) {
var s = 3;
_ss.TjSh(button,event,s);
}
}, { text: "取消审核",
handler: function (button, event, s) {
var s = 4;
_ss.TjSh(button,event,s);
}
}],
scope: this
}
]
}); //end 按钮Toolbar
//#endregion
//#region 明细表
//明细表-数据集
this.storeBodyList = Ext.create('Ext.data.Store', {
model: 'CtnoutinmxDetail',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpCtnRentBuy/GetBodyList',
reader: {
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.gridList = new Ext.grid.GridPanel({
store: this.storeBodyList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridListCellEditing],
selType: 'cellmodel',
tbar: [{
text: '增加规格明细',
tooltip: '增加规格明细',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddDetailClick(button, event, 1);
},
scope: this
}, '-', {
text: '删除规格明细',
tooltip: '删除规格明细',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelDetailClick(button, event, 1);
},
scope: this
}, '-', {
text: '导入Excel',
iconCls: "btnexportexcel",
tooltip: '导入Excel',
handler: function (button, event) {
this.onImportCtnClick(button, event);
},
scope: this
}],
columns: [{
sortable: true,
dataIndex: 'GID',
header: 'GID',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'LINKGID',
header: 'LINKGID',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'STATUS',
header: '状态',
editor:this.comboxStatus,
width: 95
}
, {
sortable: true,
dataIndex: 'CNTRNO',
header: '箱号',
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true
},
width: 95
}
, {
sortable: true,
dataIndex: 'cntype',
header: '箱型',
editor: this.comboxCTNTYPE,
width: 95
}, {
sortable: true,
dataIndex: 'UnitPrice',
header: '单价',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true
},
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;
},
align: 'right',
width: 95
}, {
sortable: true,
dataIndex: 'Currency',
header: '币别',
editor:this.comboxCurr,
width: 95
}
, {
sortable: true,
dataIndex: 'cnsource',
header: '箱源',
editor: this.cnsourceMX,
width: 95
}
, {
sortable: true,
dataIndex: 'SPORT',
header: '启用港口',
editor: this.comboxPORTLOAD,
width: 95
} , {
sortable: true,
dataIndex: 'sCustName',
header: '启用场站',
editor: this.comboxYARD,
width: 100
}
, {
sortable: true,
dataIndex: 'cntage',
header: '箱龄',
editor: {
format: 'Y-m-d',
xtype: 'datefield',
selectOnFocus: true,
enableKeyEvents: true
},
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 95
}
, {
sortable: true,
dataIndex: 'EPORT',
header: '结束位置港口',
editor: this.EPORT,
width: 95
}
, {
sortable: true,
dataIndex: 'eCustName',
header: '结束位置场站',
editor: this.ecz,
width: 100
}
, {
sortable: true,
dataIndex: 'ONEWAY',
header: 'oneway',
editor: this.onewayStatus,
width: 85
}
, {
sortable: true,
dataIndex: 'FREEUSE',
header: 'freeuse',
editor: this.freeuseStatus,
width: 85
}
, {
sortable: true,
dataIndex: 'REMARKS',
header: '备注',
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true
},
width: 100
}
]
});
this.panelService = new Ext.Panel({
title: '集装箱规格明细',
layout: "border",
region: 'center',
margin: '5 10',
items: [this.gridList]
});
this.paneldetail = new Ext.Panel({
layout: "border",
region: "center",
items: [
this.panelService
]
});
//#region 费用信息
this.panelFee = new Shipping.FeeEditGrid({
region: 'center',
layout: 'border'
});
this.panelFee.panelDrChFee.anchor = '100% 40%';
this.panelFee.panelCrChFee.anchor = '100% 60%';
this.panelFee.stroplb = 'OpCtnBsCard';
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "WTDW-委托单位", "CUSTTYPE": "委托单位", "CUSTNAME": "CUSTOMERNAME" });
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "CD-车队", "CUSTTYPE": "车队", "CUSTNAME": "TRUCKNAME" });
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "MDGDL-目的港代理", "CUSTTYPE": "目的港代理", "CUSTNAME": "AGENTNAME" });
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "DCGS-订舱公司", "CUSTTYPE": "订舱公司", "CUSTNAME": "AGENTNAME" });
this.panelFee.StoreDrOpRange.load({ params: { optype: "modOtherRecvFeeManagement"} });
this.panelFee.StoreCrOpRange.load({ params: { optype: "modOtherPayFeeManagement"} });
this.panelFee.storeFeeNameRef.load({ params: { condition: ""} });
this.panelDrCrFee = new Ext.Panel({
layout: "border",
region: 'center',
animate: true,
// autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.panelFee]
});
//#endregion
this.page_1 = new Ext.Panel({
id: "page_1",
title: "集装箱明细",
autoScroll: true,
layout: "border",
region: 'center',
closable:true,
items: [this.panelService]
});
this.page_2 = new Ext.Panel({
id: "page_2",
title: "费用信息",
autoScroll: true,
layout: "border",
region: 'center',
closable:true,
items: [this.panelDrCrFee]
});
this.MainTab = new Ext.tab.Panel({
layout: "border",
height: 460,
region: "north", split: true,
items: [
this.page_1
, this.page_2
]
});
//#region 布局
//控件布局
//#endregion
//绑定查询窗体
//初始化数据
this.ParentWin = window.parent.opener;
this.InitData();
this.storeBodyList.on('beforeload', function (store) {
var cargoid = 0;
if (this.opStatus == 'edit') {
cargoid = this.editRecord.get('GID');
}
var sql = " LINKGID='" + cargoid + "'";
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
}, //end initUIComponents
LoadFeeData: function (EditRecord) {
this.panelFee.EditRecord = EditRecord;
if (this.bsno == undefined) {
var bsno = this.editRecord.get('GID');
} else {
var bsno = this.bsno;
}
this.panelFee.strBSNO = bsno;
this.panelFee.StoreDateCurr.load({ params: { optype: "OpCtnBsCard", bsno: bsno} });
this.panelFee.StoreUnit.load({ params: { bsno: bsno, bstype: "OpCtnBsCard"} });
this.panelFee.storeDrChFee.load({ params: { billno: bsno, type: 1, optype: "OpCtnBsCard"} });
this.panelFee.storeCrChFee.load({ params: { billno: bsno, type: 2, optype: "OpCtnBsCard"} });
this.panelFee.storeBodySum.load({ params: { bsno: bsno },
callback: function (r, options, success) {
if (success) {
_thisfee.setTotalHead();
}
}
});
this.panelFee.storeChFeeGain.load({ params: { bsno: bsno} });
}, // end LoadDate
InitData: function () {
// this.opStatus = 'add';
var condition = '';
if (this.ParentWin) {
var ret = this.ParentWin.OprationSwap();
this.opStatus = ret[0];
this.storeList = ret[1];
this.editRecord = ret[2];
this.status=ret[3];
}
if (this.status==1) {
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 200,
items: [this.panelBtn, this.formEdit]
});
}else if (this.status==2) {
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 200,
items: [this.panelBtn, this.formZuRu]
});
}else if (this.status==3) {
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 200,
items: [this.panelBtn, this.formZuChu]
});
}else {
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 200,
items: [this.panelBtn, this.formSell]
});
}
_fff=this;
Ext.apply(this, {
items: [this.panelTop, this.MainTab]
});
if (this.opStatus == 'edit'){
condition =this.editRecord.get('GID');
this.LoadData(this.opStatus, condition);
}else {
var aaa=_fff.status;
Ext.Ajax.request({
url: '/MvcShipping/MsOpCtnRentBuy/GetUser',
method: 'POST',
params:{},
success: function (data) {
var bindex = Ext.JSON.decode(data.responseText);
if (aaa==1||aaa=="1") {
_fff.formEdit.getForm().findField('INPUTBY').setValue(bindex.data.INPUTBY);
_fff.formEdit.getForm().findField('BSDATE').setValue(bindex.data.BSDATE);
}else if (aaa==2||aaa=="2") {
_fff.formZuRu.getForm().findField('INPUTBY').setValue(bindex.data.INPUTBY);
_fff.formZuRu.getForm().findField('BSDATE').setValue(bindex.data.BSDATE);
}else if (aaa==3||aaa=="3") {
_fff.formZuChu.getForm().findField('INPUTBY').setValue(bindex.data.INPUTBY);
_fff.formZuChu.getForm().findField('BSDATE').setValue(bindex.data.BSDATE);
}else if (aaa==4||aaa=="4") {
_fff.formSell.getForm().findField('INPUTBY').setValue(bindex.data.INPUTBY);
_fff.formSell.getForm().findField('BSDATE').setValue(bindex.data.BSDATE);
}else {
alert(aaa);
}
}, failure: function (data) {
Ext.Msg.alert('提示', '系统管理员没能正确加载');
}
});
}
}, //end InitData
TjSh:function(button,event,s){
if (s == "2" || s == 2) {
tijiao = "确定要提交审核吗?";
sdie = "提交审核";
} else if (s == "1" || s == 1) {
tijiao = "确认要取消审核吗?";
sdie = "新建";
} else if (s == "3" || s == 3) {
tijiao = "确认要审核通过吗?"
sdie = "审核";
} else if (s == "4" || s == 4) {
tijiao = "确认要取消审核吗";
sdie = "新建";
}
var data="";
var aaa=this.status;
if (aaa==1||aaa=="1") {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
};
data = basicForm.getValues();
}else if (aaa==2||aaa=="2") {
var basicZuRu = this.formZuRu.getForm();
if (!basicZuRu.isValid()) {
return;
};
data = basicZuRu.getValues();
}else if (aaa==3||aaa=="3") {
var basicZuChu = this.formZuChu.getForm();
if (!basicZuChu.isValid()) {
return;
};
data = basicZuChu.getValues();
}else if (aaa==4||aaa=="4") {
var basicSell = this.formSell.getForm();
if (!basicSell.isValid()) {
return;
};
data = basicSell.getValues();
}else {
alert(aaa);
}
_this=this;
Ext.MessageBox.confirm('提示', tijiao, function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在提交...');
Ext.Ajax.request({
waitMsg: '正在提交...',
url: '/MvcShipping/MsOpCtnRentBuy/tjsh',
params: {
data: Ext.JSON.encode(data),
st:s
},
callback: function (options, success, response) {
if (success) {
if(s=="3"||s==3){
_this.LoadFeeData(_this.editRecord);
}
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
_this.storeList.reload();
if (aaa==1||aaa=="1") {
var basicForm = _this.formEdit.getForm();
basicForm.findField('STATUSREF').setValue(sdie);
}else if (aaa==2||aaa=="2") {
var basicZuRu = _this.formZuRu.getForm();
basicZuRu.findField('STATUSREF').setValue(sdie);
}else if (aaa==3||aaa=="3") {
var basicZuChu = _this.formZuChu.getForm();
basicZuChu.findField('STATUSREF').setValue(sdie);
}else if (aaa==4||aaa=="4") {
var basicSell = _this.formSell.getForm();
basicSell.findField('STATUSREF').setValue(sdie);
}else {
alert(aaa);
}
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 });
},
});
}
})
},
LoadData: function (opstatus, condition) {
this.serialNo = 0;
this.workSerialNo = 0;
this.bodyDel = [];
this.opStatus = opstatus;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsOpCtnRentBuy/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;
}
this.setSaveBtnStatus();
this.LoadFeeData(this.editRecord);
var data = result.data;
switch (this.status) {
case 1:
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(data);
break;
case 2:
this.formZuRu.getForm().reset();
this.formZuRu.getForm().setValues(data);
break;
case 3:
this.formZuChu.getForm().reset();
this.formZuChu.getForm().setValues(data);
break;
case 4:
this.formSell.getForm().reset();
this.formSell.getForm().setValues(data);
break;
default:
alert("程序出错");
break;
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
var billno = '*';
var cargoid = 0;
if (this.opStatus == 'edit') {
cargoid = this.editRecord.get('GID');
}
this.storeBodyList.load({ params: { condition: " ox.LINKGID='" + cargoid + "'"} });
}, // end LoadDate
Save: function (type) {
var data="";
var aaa=this.status;
if (aaa==1||aaa=="1") {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
};
data = basicForm.getValues();
}else if (aaa==2||aaa=="2") {
var basicZuRu = this.formZuRu.getForm();
if (!basicZuRu.isValid()) {
return;
};
data = basicZuRu.getValues();
}else if (aaa==3||aaa=="3") {
var basicZuChu = this.formZuChu.getForm();
if (!basicZuChu.isValid()) {
return;
};
data = basicZuChu.getValues();
}else if (aaa==4||aaa=="4") {
var basicSell = this.formSell.getForm();
if (!basicSell.isValid()) {
return;
};
data = basicSell.getValues();
}else {
alert("程序出错");
}
if (data.STATUSREF=="提交审核"||data.STATUSREF=="审核") {
alert("无法修改数据,您已经提交审核");
return;
}
data.DM_ID = NewGuid();
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);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOpCtnRentBuy/Save',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
body: jsonBody,
status:this.status
},
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().setValues(returnData);
if (aaa==1||aaa=="1") {
this.formEdit.getForm().findField('GID').setValue(data.DM_ID);
}else if (aaa==2||aaa=="2") {
this.formZuRu.getForm().findField('GID').setValue(data.DM_ID);
}else if (aaa==3||aaa=="3") {
this.formZuChu.getForm().findField('GID').setValue(data.DM_ID);
}else if (aaa==4||aaa=="4") {
this.formSell.getForm().findField('GID').setValue(data.DM_ID);
}else {
alert("程序出错");
}
if (this.opStatus == 'add') {
Ext.Msg.alert('提示','添加成功');
var arrNewRecords = this.storeList.add(returnData);
this.editRecord = arrNewRecords[0];
}
else if (this.opStatus == 'edit') {
this.opStatus='edit';
Ext.Msg.alert('提示','修改成功');
this.storeList.reload();
this.editRecord.commit();
}
if (type == '0') {
this.opStatus = 'edit';
// basicForm.findField('GID').setDisabled(true);
for (var j = 0; j < this.storeBodyList.getCount(); j += 1) {
var memberbody = this.storeBodyList.getAt(j);
memberbody.set("GID", this.editRecord.get('GID'));
memberbody.commit();
};
} else if (type == '1') {
window.close();
} else {
this.LoadData('add', '');
basicForm.findField('GID').setDisabled(false);
}
} 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
setSaveBtnStatus: function () {
var tjsh = Ext.getCmp('tjsh');
var shtg = Ext.getCmp('shtg');
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable',
params: {
modulename: "modFeenotPraa"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
tjsh.disable();
} else {
tjsh.enable();
}
} else {
}
},
scope: this
});
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable',
params: {
modulename: "jizhuangxsh"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
shtg.disable();
} else {
shtg.enable();
}
} else {
}
},
scope: this
});
},
onAddDetailClick: function (button, event, type) {
this.addDetail(type);
}, //end onAddDetailClick
onDelDetailClick: function (button, event, type) {
this.deleteDetail(type);
}, //onDelDetailClick
gridAfterEdit: function (editor, e, eOpts) {
},
addDetail: function (type) {
var newSerialno = 0;
store = this.storeBodyList;
var record = Ext.create('MsCodeGoodsDetail', {
GID: '',
LINKGID: '',
GOODSDETAILNAME: "",
GOODSDETAILPKGS: 0
});
store.add(record);
this.gridListCellEditing.startEditByPosition({ row: 2, column: 1 });
},
DateDiff: function  (sDate1,  sDate2){    //sDate1和sDate2是2006-12-18格式  
       var  aDate,  oDate1,  oDate2,  iDays  
       aDate  =  sDate1.split("-")  
       oDate1  =  new  Date(aDate[1]  +  '-'  +  aDate[2]  +  '-'  +  aDate[0])    //转换为12-18-2006格式  
       aDate  =  sDate2.split("-")  
       oDate2  =  new  Date(aDate[1]  +  '-'  +  aDate[2]  +  '-'  +  aDate[0])  
       iDays  =  parseInt(Math.abs(oDate1  -  oDate2)  /  1000  /  60  /  60  /24)    //把相差的毫秒数转换为天数  
       return  iDays  
   },    
deleteDetail: function (type) {
var selectedRecords = this.gridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
this.storeBodyList.remove(rec);
}
},
onImportCtnClick: function (button, event) {
var data="";
var qx="";
var aaa=this.status;
if (aaa==1||aaa=="1") {
data = this.formEdit.getForm().findField('GID').getValue();
qx=this.formEdit.getForm().findField('STATUSREF').getValue();
}else if (aaa==2||aaa=="2") {
data = this.formZuRu.getForm().findField('GID').getValue();
qx=this.formZuRu.getForm().findField('STATUSREF').getValue();
}else if (aaa==3||aaa=="3") {
data = this.formZuChu.getForm().findField('GID').getValue();
qx=this.formZuChu.getForm().findField('STATUSREF').getValue();
}else if (aaa==4||aaa=="4") {
data = this.formSell.getForm().findField('GID').getValue();
qx=this.formSell.getForm().findField('STATUSREF').getValue();
}else {
alert("程序出错");
}
if (data==""||data==null) {
alert('请先保存数据');
return false;
}
if (qx=="提交审核"||qx=="审核") {
alert("无法导入Excel,数据正在审核或审核通过");
return;
}
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/MsOpCtnRentBuy/ImportDetail',
waitMsg: '正在上传',
method: 'POST',
params: {
data:data
},
success: function (form, action) {
win.close();
Ext.Msg.show({ title: '提示', msg: action.result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
var sql = " ox.LINKGID='" + data + "'";
me.storeBodyList.load({ params: { condition:sql } });
},
failure: function (form, action) {
form.reset();
if (action.failureType == Ext.form.Action.SERVER_INVALID){
Ext.MessageBox.alert('失败',action.result.Message);
}else {
Ext.MessageBox.alert('失败',action.result.Message);
}
}
});
}
}, {
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();
}
});