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/MvcContainer/Viewsjs/MsOpCtnr/MsOpCtnrSellEdit.js

2574 lines
90 KiB
JavaScript

This file contains ambiguous Unicode 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.

///<reference path="../../../../Views/../TruckMng/Scripts/vswd-ext_2.0.2.js" />
Ext.namespace('Shipping');
//#region 获取 YYYY-mm-dd 格式的日期
//var xhr = new XMLHttpRequest();
var currdate = new Date();
//xhr.open("HEAD", location.href, true);
//xhr.onreadystatechange = function () {
// if (xhr.readyState == 4 && xhr.status == 200) {
// var datestr = xhr.getResponseHeader("Date");
// currdate = new Date(datestr);
// }
//}
//xhr.send(null);
//#endregion
Shipping.MsOpCtnrSellEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpCtnrSellEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpCtnrSellEdit, Ext.Panel, {
parentWin: null,
OpStatus: 'add',
StoreList: null,
EditRecord: null,
parentRecord: null,
PageSize: 500,
initUIComponents: function () {
this.formname = 'MsCtnrSellEdit';
this.CtnrSellBodyDel = [];
_this = this;
//#region 数据集定义
//空重
this.storeCTNEF = Ext.create('Ext.data.Store', {
fields: ['FType', 'NAME']
});
this.storeCTNEF.add({ "FType": 'E', "NAME": "空" });
this.storeCTNEF.add({ "FType": 'F', "NAME": "重" });
this.comboxCTNEF = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCTNEF,
valueField: 'FType',
displayField: 'NAME',
forceSelection: true,
name: 'CTNEF'
});
//箱型_集装箱列表中的下拉框加载
Ext.regModel('CTNALLMODEL',
{
fields: [{ name: 'CTN' }]
});
this.storeCodeCtn = Ext.create('DsExt.ux.RefTableStore', {
model: 'CTNALLMODEL',
proxy: { url: '/MvcContainer/MsOpCtnr/GetCodeCtnList' }
});
this.storeCodeCtn.load();
this.comboxCTNALL = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCodeCtn,
name: 'CTNALL',
valueField: 'CTN',
displayField: 'CTN'
});
//租买箱公司
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListController' }
});
this.storeCustCode.load();
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '客户名称',
store: this.storeCustCode,
forceSelection: true,
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
id: 'CUSTOMERNAME',
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
allowBlank: false
});
this.comboxCustCodeSearch = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '租买公司',
store: this.storeCustCode,
forceSelection: true,
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
id: 'CUSTOMERNAMEBUY',
name: 'CUSTOMERNAMEBUY',
valueField: 'CustName',
displayField: 'CodeAndName',
allowBlank: true
});
//租买类型
Ext.define('BLTypemb', {
extend: 'Ext.data.Model',
fields: [
{ name: 'BLType', type: 'string' }
]
});
var BLTypeData = [
{ "BLType": "卖箱" }, { "BLType": "退租" }, { "BLType": "租出" }, { "BLType": "返箱" }];
this.storeBLType = Ext.create('Ext.data.Store', {
model: 'BLTypemb',
data: BLTypeData
});
this.comboxBuyType = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '类型',
forceSelection: true,
store: this.storeBLType,
name: 'BLTYPE',
allowBlank: false,
valueField: 'BLType',
displayField: 'BLType',
value:'卖箱'
});
this.storeCNTRSOURCE = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeCNTRSOURCE.load({ params: { enumTypeId: 97015 } });
this.comboxCNTRSOURCE = Ext.create('DsExt.ux.RefEnumCombox', {
store: this.storeCNTRSOURCE,
fieldLabel: '箱源',
name: 'CNTRSOURCE',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
this.comboxCNTRSOURCEDetail = Ext.create('DsExt.ux.RefEnumCombox', {
forceSelection: true,
store: this.storeCNTRSOURCE,
name: 'CNTRSOURCE',
// allowBlank: false,
valueField: 'CNTRSOURCE',
displayField: 'CNTRSOURCE'
});
//人员信息加载
this.storeSaleCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeSaleCode.load();
//揽货人
this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '揽货人',
store: this.storeSaleCode,
forceSelection: true,
name: 'SALE',
valueField: 'UserName',
displayField: 'CodeAndName',
value: SHOWNAME,
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
if (this.SALEORDERDEPTBYOP == 0)
this.formHead.getForm().findField('SALEDEPT').setValue(records[0].data.DEPTNAME);
}
}
}
});
//所属部门
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,
// flex: 0.5,
// labelWidth: 60,
forceSelection: true,
name: 'SALEDEPT',
value: DEPTNAME,
valueField: 'DeptName',
displayField: 'DeptName'
//,hidden: true
});
this.storeCodeLoadport = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeLoadportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeLoadportList' }
});
this.storeCodeLoadport.load();
this.comboxPORT = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '启运地',
store: this.storeCodeLoadport,
name: 'PORTLOAD',
valueField: 'PORT',
displayField: 'CodeAndName',
matchFieldWidth: false //下拉款自适应宽度
//
});
this.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeDisportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportListRm' }
});
this.comboxPORTDISCHARGE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel:'目的地', //'卸货港',
store: this.storeCodeDisport,
name: 'PORTDISCHARGE',
valueField: 'PORT',
queryMode: 'remote',
minChars: 1,
queryParam: 'PORT',
displayField: 'CodeAndName',
listeners: {
scope: this,
blur: function (field, The, eOpts) {
field.setRawValue(field.value);
}
}
});
this.comboxPORTDetail = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCodeLoadport,
//forceSelection: true,
id: 'PORTDetail',
name: 'PORTDetail',
valueField: 'PORT',
displayField: 'CodeAndName',
matchFieldWidth: 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', {
fieldLabel: '放箱场站',
store: this.storeYARD,
forceSelection: true,
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
name: 'YARD',
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.storeRETURNYARD = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListYARD' }
});
this.storeRETURNYARD.load();
//
this.comboxRETURNYARD = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '目的地场站',
store: this.storeRETURNYARD,
forceSelection: true,
queryMode: 'remote',
labelWidth: 80,
minChars: 0,
queryParam: 'CODENAME',
name: 'RETURNYARD',
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.comboxYARDDetail = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeYARD,
forceSelection: true,
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
name: 'YARDDetail',
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.storeDetailYARD = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListYARD' }
});
this.storeDetailYARD.load();
this.comboxRETURNYARDDetail = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeDetailYARD,
forceSelection: true,
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
name: 'RETURNYARD',
valueField: 'CustName',
displayField: 'CodeAndName'
});
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/GetSourceDetail2' }
});
this.comboxBSSOURCE = 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 = "SOURCEID='" + data.SourceID + "'";
this.storeSourceDetail.load({ params: { condition: s } });
} else {
var BSSOURCEDETAIL = this.formEdit.getForm().findField('BSSOURCEDETAIL');
BSSOURCEDETAIL.setValue('');
}
}
}
}
});
this.storeSourceDetail.load();
this.comboxBSSOURCEDETAIL = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '来源明细', //'来源明细',
store: this.storeSourceDetail,
// forceSelection: true,
name: 'BSSOURCEDETAIL',
valueField: 'SourceDetail',
displayField: 'SourceDetail'
});
//人员信息加载
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',
enableKeyEvents: true
});
//箱动态类型
this.storeCTNSTATUS = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeCTNSTATUS.load({ params: { enumTypeId: 99060 } });
this.comboxCTNSTATUS = Ext.create('DsExt.ux.RefEnumCombox', {
store: this.storeCTNSTATUS,
name: 'CTNSTATUS',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
//应收费用名称
this.storeFeeNameRef = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.FeeTypeRefModel',
proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefListNew' }
});
this.storeFeeNameRef.load();
this.comboxFeeNameRef = Ext.create('DsExt.ux.DCombox', {
store: this.storeFeeNameRef,
minChars: 1,
matchFieldWidth: false,
//queryParam: 'Name',
lazyRender: false,
name: 'DRFEENAME',
valueField: 'Name',
displayField: 'CodeAndName'
});
this.storeFeeNameRefCr = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.FeeTypeRefModel',
proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefListNew' }
});
this.storeFeeNameRefCr.load();
this.comboxFeeNameRefCr = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeFeeNameRefCr,
forceSelection: true,
queryMode: 'local',
minChars: 1,
//queryParam: 'Name',
lazyRender: false,
name: 'CRFEENAME', matchFieldWidth: false,
valueField: 'Name',
displayField: 'CodeAndName',
listeners: {
beforequery: function (e) {
return FilterCombox(e);
},
specialkey: function (field, e) {
//将回车13转义成tab9
if (e.getKey() == e.ENTER) {
e.keyCode = 9;
}
if (e.keyCode == 9) {
//将combo
//alert(field.value);
if (field.value == null) {
_name = this.store.data.keys[0];
this.setValue(_name);
} else {
if (field.value.replace(/\s*/g, "") == "") {
_name = this.store.data.keys[0];
this.setValue(_name);
}
}
}
}
}
});
this.storeRETURNTYPE = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeRETURNTYPE.load({ params: { enumTypeId: 99061 } });
this.comboxRETURNTYPE = Ext.create('DsExt.ux.RefEnumCombox', {
store: this.storeRETURNTYPE,
fieldLabel: '处理方式', //'来源明细',
name: 'RETURNTYPE',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
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: 'CURR',
valueField: 'CURR',
displayField: 'CURR'
});
//#endregion
//#region form定义
//编辑form:formEdit
this.formEdit = Ext.widget('form', {
// layout: "border",
region: 'north',
height: 270,
frame: true,
bodyPadding: 1,
trackResetOnLoad: true,
fieldDefaults: {
margins: '1 1 1 1',
labelAlign: 'right',
flex: 1,
labelWidth: 64,
msgTarget: 'qtip'
//,split:true
},
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{//container_1
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: 'BSNO',
hidden: true,
name: 'BSNO'
},{
fieldLabel: '业务单号', flex: 1,
name: 'BILLNO',
id: 'BILLNO',
readOnly:true,
disabled:true
}, {
fieldLabel: '业务状态',
readOnly: true,
name: 'BSSTATUSREF',
value: '未锁定'
}, {
fieldLabel: '费用状态',
readOnly: true,
name: 'FEESTATUSREF',
value: '未锁定'
},this.comboxCustCode,
{
name: 'BSDATE', id: "BSDATE",
fieldLabel: '业务时间',
format: 'Y-m-d',
value: Ext.util.Format.date(currdate, 'Y-m-d'),
xtype: 'datefield'
},{
fieldLabel: '会计期间',
flex: 1,
name: 'ACCDATE',
xtype: 'monthfield',
format: 'Y-m',
value: Ext.util.Format.date(currdate, 'Y-m'),
editable: false,
allowBlank: false
}
]
}//container_1 end
,
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
this.comboxCNTRSOURCE,this.comboxBuyType,
this.comboxPORT,
this.comboxYARD,
this.comboxPORTDISCHARGE,
this.comboxRETURNYARD
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '提单号',
name: 'MBLNO'
}, {
fieldLabel: '运输工具',
name: 'VESSEL'
}, {
fieldLabel: '班次号',
name: 'VOYNO'
}, {
fieldLabel: '开航日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETD'
}, this.comboxSALE, this.comboxOP
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
this.comboxBSSOURCE, this.comboxBSSOURCEDETAIL, this.comboxDept, {
fieldLabel: '生成费用',
readOnly:true,
name: 'ISCREATEFEEREF'
},
{
fieldLabel: '生成业务费用',
readOnly: true,
labelWidth: 120,
name: 'CREATEBSFEEREF'
}, {
fieldLabel: '箱型箱量',
readOnly: true,
name: 'CNTRTOTAL'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '最后一次更改人',
name: 'MODIFIEDUSER',
hidden: true
}, {
fieldLabel: '备注',
name: 'REMARK',
height: 40,
xtype: "textarea"
}]
}
]
}
]
});
//#endregion
//#region 编辑
//数据集
this.storeCtnrSell = Ext.create('Ext.data.Store', {
model: 'MsOpCtnrDetail',
pageSize: this.PageSize,
remoteSort: false,
pruneModifiedRecords: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsOpCtnr/GetCtnrSellDetail',
reader: {
id: 'CTNGID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
var _this = this;
this.columns = [
{
sortable: true, //1
dataIndex: 'CTNGID',
header: '惟一编号',
width: 80, hidden: true
}, {
sortable: true, //1
dataIndex: 'CNTRNO',
header: '箱号',
width: 100, hidden: false, editor: {
xtype: 'textfield'
}
},
{
sortable: true,
dataIndex: 'CTNEF',
header: '空重',
width: 40,
editor: this.comboxCTNEF,
renderer: function (value, p, record) {
return record.data.CTNEFREF;
}
},{
sortable: true,
dataIndex: 'CTNALL',
header: '箱型',
width: 40,
editor: this.comboxCTNALL
},{
sortable: true,
dataIndex: 'CNTRSOURCE',
header: '箱源',
width: 60,
editor: this.comboxCNTRSOURCEDetail
},{
sortable: true,
dataIndex: 'CTNSTATUS',
header: '当前箱动态',
width:100,
editor: this.comboxCTNSTATUS
},
{
sortable: true,
dataIndex: 'CTNSTATUSTIME',
header: '箱动态时间',
width: 100,
editor: {
xtype: 'datefield',
format: 'Y-m-d',
selectOnFocus: true
},
renderer: Ext.util.Format.dateRenderer('Y-m-d')
},
{
sortable: true,
dataIndex: 'PORT',
header: '当前地点',
width: 100,
editor: this.comboxPORTDetail
},
{
sortable: true,
dataIndex: 'YARD',
header: '当前场站',
width: 80,
editor: this.comboxYARDDetail
},
{
sortable: true,
dataIndex: 'CURR',
header: '币别',
width: 80,
editor: this.comboxCurr
},
{
sortable: true,
dataIndex: 'DRFEENAME',
header: '应收费用名称',
width: 80,
editor: this.comboxFeeNameRef
},
{
sortable: true,
dataIndex: 'DR',
header: '应收费用',
width: 80,
editor: {
xtype: 'textfield'
},
summaryType: 'sum', align: 'right'
},
{
sortable: true,
dataIndex: 'CRFEENAME',
header: '应付费用名称',
width: 80,
editor: this.comboxFeeNameRefCr
},
{
sortable: true,
dataIndex: 'CR',
header: '应付费用',
width: 80,
editor: {
xtype: 'textfield'
}
},
{
sortable: true,
dataIndex: 'MXCR',
header: '买箱成本',
summaryType: 'sum', align: 'right'
},
{
sortable: true,
dataIndex: 'RETURNYARD',
header: '目的地场站',
width: 80,
editor: this.comboxRETURNYARDDetail
},
{
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 80,
editor: {
xtype: 'textfield'
}
}
];
this.girdcolums = this.columns;
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id表名中间column数组跳过一开始的几列
if (true) {
}
this.cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.CheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.formCtnrInBody = new Ext.grid.GridPanel({
store: this.storeCtnrSell,
enableHdMenu: false,
region: 'center',
columnLines: true,
//layout: "border",
//title: '费用明细',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.cellEditing],
selModel: this.CheckBoxModel,
selType: 'cellmodel',
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
tbar: [{ xtype: 'label', text: '集装箱信息',
style: 'font-size:18px',
labelColor: '#099',
//style:'background-color: #4b9bf5',
x: '5%',
y: '5%'
}, {
text: '删除', id: "del1",
tooltip: '删除',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelCtnrInClick(button, event);
},
scope: this
}, '-', {
// id: "saveandclose",
text: "保存",
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0');
},
scope: this
}, '-', {
text: "保存列表样式",
menu: [{ text: "保存",
handler: function (button, event) {
_this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.formCtnrInBody.columns, _this.girdcolums, 0, true); //使用者id表名中间column数组跳过一开始的几列
}
}, { text: "初始化",
handler: function (menu, event) {
_this.formCtnrInBody.reconfigure(_this.storeCtnrSell, _this.columns);
_this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.formCtnrInBody.columns, _this.columns, 0, true); //使用者id表名中间column数组跳过一开始的几列
}
}],
scope: this
}],
columns: this.girdcolums
});
this.formCtnrInBody.columns[0] = new Ext.grid.RowNumberer();
this.formCtnrInBody.on('edit', function (editor, e, eOpts) {
this.gridAfterEdit(editor, e, eOpts);
}, this);
//////////////////////////////////////////////明细<<<< CtnrIn列表 >>>>结束
//#endregion
//#region 搜寻所卖箱
this.storeAddDCType = Ext.create('Ext.data.Store', {
fields: ['DC', 'NAME']
});
this.storeAddDCType.add({ "DC": "", "NAME": "" });
this.storeAddDCType.add({ "DC": "1", "NAME": "是" });
this.comboxaddDCType = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel:'需返箱',
labelWidth: 60,
store: this.storeAddDCType,
valueField: 'DC',
displayField: 'NAME',
forceSelection: true,
name: 'ISBERETURN',
value: '',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.formSearch = Ext.widget('form', {
frame: true,
region: 'north',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 60,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxOpLb, {
fieldLabel: '租买单号',
name: 'BuyBillNo',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxCustCodeSearch, {
fieldLabel: '箱号',
labelWidth:30,
name: 'CNTRNO',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},
{
fieldLabel: '买箱时间从',
format: 'Y-m-d',
labelWidth: 70,
xtype: 'datefield',
name: 'BUY_BSDATE',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '买箱时间到',
format: 'Y-m-d',
xtype: 'datefield',
labelWidth: 70,
name: 'BUY_BSDATETO',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxaddDCType, {
xtype: 'button',
text: "批量箱号查询",
iconCls: "btnsearch",
handler: function (button, event) {
this.formCntrList.getForm().findField('CNTRNOLIST').setValue('');
this.winCntrListShow.show();
},
scope: this
}, {
xtype: 'button',
text: "查询",
iconCls: "btnsearch",
handler: function (button, event) {
this.onRefreshClick();
},
scope: this
}, {
xtype: 'button',
text: "清空条件",
iconCls: "btnreset",
handler: function (button, event) {
this.onClearSql(button, event);
},
scope: this
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//#endregion
//region 数据表
//定义数据集
this.storeListSearch = Ext.create('Ext.data.Store', {
model: 'MsOpCtnrDetail',
pageSize: this.PageSize,
remoteSort: false,
pruneModifiedRecords: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsOpCtnr/GetCtnrSearchList',
reader: {
id: 'CTNGID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//定义Grid
_this = this;
this.initgirdcolumsSearch= [
{
sortable: true, //1
dataIndex: 'CTNGID',
header: '惟一编号',
width: 80, hidden: true
}, {
sortable: true, //1
dataIndex: 'CNTRNO',
header: '箱号',
width: 100
},
{
sortable: true,
dataIndex: 'CTNEF',
header: '空重',
width: 60
}, {
sortable: true,
dataIndex: 'CTNALL',
header: '箱型',
width: 60
}, {
sortable: true,
dataIndex: 'CNTRSOURCE',
header: '箱源',
width: 80
}, {
sortable: true,
dataIndex: 'CTNSTATUS',
header: '当前箱动态',
width: 100
},
{
sortable: true,
dataIndex: 'CTNSTATUSTIME',
header: '箱动态时间',
width:100,
renderer: Ext.util.Format.dateRenderer('Y-m-d')
},
{
sortable: true,
dataIndex: 'ISBERETURNREF',
header: '需返箱',
width: 100
},
{
sortable: true,
dataIndex: 'PORT',
header: '当前地点',
width: 100
},
{
sortable: true,
dataIndex: 'YARD',
header: '当前场站',
width: 80
},
{
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 120
}];
this.girdcolumsSearch = this.initgirdcolumsSearch;
this.girdcolumsSearch = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolumsSearch, 0);
this.GridCheckBoxModelSearch = Ext.create('Ext.selection.CheckboxModel');
this.gridListSearch=new Ext.grid.GridPanel({
store: this.storeListSearch,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.GridCheckBoxModelSearch,
tbar: [{
text: '添加选中集装箱',
tooltip: '添加选中集装箱',
id: 'btnadd',
iconCls: "btnadd",
handler: function (button, event) {
this.onAddSelected();
},
scope: this
}, '-', {
text: "保存列表样式",
menu: [{
text: "保存",
handler: function (button, event) {
_this.girdcolumsSearch = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridListSearch.columns, _this.girdcolumsSearch, 0, true); //使用者id表名中间column数组跳过一开始的几列
}
}, {
text: "初始化",
handler: function (menu, event) {
_this.gridListSearch.reconfigure(_this.storeListFee, _this.initgirdcolumsFee);
_this.girdcolumsSearch = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridListSearch.columns, _this.initgirdcolumsSearch, 0, true); //使用者id表名中间column数组跳过一开始的几列
}
}],
scope: this
}],
columns: this.girdcolumsSearch,
viewConfig: {
enableTextSelection: true
}
});
this.gridListSearch.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
//this.SelectedRecordSearch = record;
}, this);
//#endregion
//公共按钮Toolbar:panelBtn
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
// id: "saveandclose",
text: "保存",
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0');
},
scope: this
}, {
// id: "saveandclose",
text: "保存并关闭",
handler: function (button, event) {
this.Save('1');
},
scope: this
}, '-',
{
// id: "saveandclose",
text: "生成费用",
handler: function (button, event) {
this.CreateCost("0");
},
scope: this
}, '-',
{
// id: "saveandclose",
text: "取消费用",
handler: function (button, event) {
this.CreateCost("1");
},
scope: this
},'-',
{
// id: "saveandclose",
text: "关闭",
handler: function (button, event) {
window.close();
},
scope: this
}
]
}); //end 按钮Toolbar
this.panelTop;
//#region//布局
parentWin = window.parent.opener;
if (parentWin) {
var ret = parentWin.OprationSwap();
this.OpStatus = ret[0]; //edit
this.StoreList = ret[1];
this.EditRecord = ret[2]; //SelectedRecord
this.parentRecord = ret[3];
}
this.panelTop = new Ext.Panel({
region: "north",
height: 200,
items: [this.panelBtn, this.formEdit]
});
//#region 其他
this.panelFee = new Shipping.FeeEditGrid({
region: 'center',
layout: 'border'
});
this.panelFee.stroplb = 'op_other';
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "WTDW-委托单位", "CUSTTYPE": "委托单位", "CUSTNAME": "CUSTOMERNAME" });
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "CGS-船公司", "CUSTTYPE": "船公司", "CUSTNAME": "CARRIER" });
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "DCDL-订舱代理", "CUSTTYPE": "订舱代理", "CUSTNAME": "FORWARDER" });
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "BGH-报关行", "CUSTTYPE": "报关行", "CUSTNAME": "CUSTOMSER" });
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "CD-车队", "CUSTTYPE": "车队", "CUSTNAME": "TRUCKER" });
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "FHR-发货人", "CUSTTYPE": "发货人", "CUSTNAME": "SHIPPERID" });
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "SHR-收货人", "CUSTTYPE": "收货人", "CUSTNAME": "CONSIGNEEID" });
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "TZR-通知人", "CUSTTYPE": "通知人", "CUSTNAME": "NOTIFYPARTYID" });
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "DL-代理", "CUSTTYPE": "代理", "CUSTNAME": "AGENTID" });
this.panelFee.StoreCustType.add({ "SCUSTTYPE": "CZ-场站", "CUSTTYPE": "场站", "CUSTNAME": "YARD" });
this.panelFee.StoreDrOpRange.load({ params: { optype: "modOtherRecvFeeManagement" } });
this.panelFee.StoreCrOpRange.load({ params: { optype: "modOtherPayFeeManagement" } });
this.panelFee.storeFeeNameRef.load({ params: { condition: "" } });
this.panelChFee = new Ext.Panel({
region: 'center',
layout: 'border',
margin: '0 0',
height: 300, //width: 450,
items: [/*this.panelChFee_YS, this.panelChFee_YF*/
this.panelFee
]
});
//#endregion
this.panelDetail = new Ext.Panel({
layout: "border",
region: 'center',
items: [this.formCtnrInBody]
});
this.panelSearch = new Ext.Panel({
layout: "border",
region: 'south',
frame: true,
height: 200,
resizable: true,
items: [this.formSearch, this.gridListSearch]
});
this.page_1 = new Ext.Panel({
id: "page_1",
title: "卖箱信息",
layout: "border",
region: 'center',
items: [this.panelDetail, this.panelSearch]
});
this.page_2 = new Ext.Panel({
id: "page_2",
autoScroll: true,
title: "卖箱相关应收应付费用",
layout: "border",
region: 'center',
items: [this.panelChFee
]
});
//#region 明细表-单据图片档案管理
_this = this;
this.storeDocList = Ext.create('Ext.data.Store', {
model: 'ReceiptDocmb',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Import/ReceiptDoc/GetDocList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.DocListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.DocCM = Ext.create('Ext.selection.CheckboxModel');
this.gridDocList = new Ext.grid.GridPanel({
store: this.storeDocList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.DocListCellEditing],
selModel: this.DocCM,
selType: 'cellmodel',
tbar: [{
text: '删除',
tooltip: '删除',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelFileClick(button, event);
},
scope: this
}, '-', {
text: '上传附件',
tooltip: '上传附件',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onUpLoadFileClick(button, event);
},
scope: this
}],
columns: [{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'R_GID',
header: 'R_GID',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'BSNO',
header: 'BSNO',
width: 80
},
{
sortable: true,
dataIndex: 'URL',
header: '文件名',
width: 140,
renderer: function (value, p, record) {
return '<a href="' + record.data.Driect_URL + '" style=' + '"text-decoration:none"' + '>' + value + '</a>';
}
},
{
sortable: true, hidden: true,
dataIndex: 'Driect_URL',
header: 'Driect_URL',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'MODIFIEDUSER',
header: 'MODIFIEDUSER',
width: 80
},
{
sortable: true,
dataIndex: 'MODIFIEDUSERRef',
header: '上传人',
width: 80
},
{
sortable: true,
dataIndex: 'MODIFIEDTIME',
header: '上传时间',
width: 135
}
]
});
this.panelDoc = new Ext.Panel({
id: "panelDoc",
layout: "border",
region: "center",
//width: 350,
title: '上传附件', //autoScroll: true,
frame: false,
split: true,
items: [this.gridDocList]
});
//#endregion
this.MainTab = new Ext.tab.Panel({
layout: "border",
region: "center", split: true,
items: [this.page_1, this.page_2, this.panelDoc]
});
Ext.apply(this, {
items: [this.panelTop, this.MainTab]
});
this.InitData();
//#endregion
//集中绑定事件
this.formCtnrInBody.on('edit', function (editor, e, eOpts) {
this.CtnrInAfterEdit(editor, e, eOpts);
}, this);
this.cellEditing.on('beforeedit', function (editor, e) {
return this.CtnrInBeforeEdit(editor, e);
}, this);
this.formCntrList = Ext.widget('form', {
// layout: "border",
region: 'north',
height: 170,
frame: true,
bodyPadding: 1,
trackResetOnLoad: true,
fieldDefaults: {
margins: '1 1 1 1',
labelAlign: 'right',
flex: 1,
labelWidth: 64,
msgTarget: 'qtip'
//,split:true
},
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{//container_1
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '箱号',
name: 'CNTRNO',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
var cnlist = _this.formCntrList.getForm().findField('CNTRNOLIST').getValue();
if (cnlist == '') {
cnlist = field.value;
} else {
cnlist = cnlist + '\n' + field.value;
}
_this.formCntrList.getForm().findField('CNTRNOLIST').setValue(cnlist);
_this.formCntrList.getForm().findField('CNTRNO').setValue('');
}
}
}
}
]
}//container_1 end
,
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
xtype: 'textareafield',
grow: true,
flex: 2,
fieldLabel: '箱号列表', //'AGENT',
height: 120,
name: 'CNTRNOLIST',
anchor: '100%'
}
]
}
]
}
]
});
this.winCntrListShow = Ext.create('Ext.window.Window', {
title: "批量箱号查询", //"批量修改",
width: 820,
//height : 120,
//plain : true,
iconCls: "addicon",
resizable: false,
// 是否可以拖动
// draggable:false,
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
items: [this.formCntrList],
buttons: [{
text: '查询', //"确认修改",
minWidth: 70,
handler: function () {
_this.onCntrListClick()
_this.winCntrListShow.close();
}
}, {
text: "取消", //"关闭",
minWidth: 70,
handler: function () {
_this.winCntrListShow.close();
}
}]
});
}, //end initUIComponents
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.sqlcontext = sql;
this.storeListSearch.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onCntrListClick: function (button, event) {
var cntrliststr = this.formCntrList.getForm().findField('CNTRNOLIST').getValue();
var sql = '';
if (cntrliststr == '') {
Ext.Msg.show({ title: '提示', msg: '没有要查询的箱号', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var cntrlist = cntrliststr.match(/.+[\n]*/g);//按行匹配
for (var j = 0; j < cntrlist.length; j++) {
if (cntrlist[j].replace(/\n/g, "") != '') {
if (sql == '') {
sql = sql + "'" + cntrlist[j].replace(/\n/g, "") + "'";
} else {
sql = sql + ",'" + cntrlist[j].replace(/\n/g, "") + "'";
}
}
}
if (sql == '') {
Ext.Msg.show({ title: '提示', msg: '没有要查询的箱号', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
sql = " detail.CNTRNO in (" + sql + ") "
this.sqlcontext = sql;
this.storeListSearch.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = " ISNULL(detail.ISSTOP,0)=0 AND (ISNULL(detail.ISLOCK,'')='' or ISNULL(detail.ISLOCK,'')='0' ) AND (ISNULL(detail.CTNSTATUS,'')='可用') ";
var BuyBILLNO = form.findField('BuyBillNo').getValue();
if (BuyBILLNO != '' && BuyBILLNO != null) {
sql = " ctn.BILLNO like '%" + BuyBILLNO + "%'";
}
var ISBERETURN = form.findField('ISBERETURN').getValue();
if (ISBERETURN == '1') {
sql = " detail.ISBERETURN=1 ";
}
var CUSTOMERNAMEBUY = form.findField('CUSTOMERNAMEBUY').getRawValue();
sql = sql + getAndConSql(sql, CUSTOMERNAMEBUY, " ctn.CUSTOMERNAME like '%" + CUSTOMERNAMEBUY + "%'");
var CNTRNO = form.findField('CNTRNO').getValue();
sql = sql + getAndConSql(sql, CNTRNO, " detail.CNTRNO like '%" + CNTRNO + "%'");
var BuyBSDATE = form.findField('BUY_BSDATE').getRawValue();
sql = sql + getAndConSql(sql, BuyBSDATE, " ctn.BSDATE >= '" + BuyBSDATE + "'");
var BSDATETO = form.findField('BUY_BSDATETO').getRawValue();
if (BSDATETO != '' && BSDATETO != null) {
sql = sql + getAndConSql(sql, BSDATETO, " ctn.BSDATE <= '" + BSDATETO + "'");
}
return sql;
},
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
//this.InitData();
},
//添加选中的箱子到卖箱明细
onAddSelected: function () {
var BILLNO = this.formEdit.getForm().findField('BILLNO').getValue();
if (BILLNO == '') {
Ext.Msg.show({ title: '提示', msg: '请先保存业务信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var selectedRecords = this.GridCheckBoxModelSearch.selected.items;
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要添加的集装箱!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var data = this.formEdit.getForm().getValues();
store = this.storeCtnrSell;
var record = null;
var BSNO = '';
var PORT = '';
var YARD = '';
PORT = data.PORTDISCHARGE;
YARD = data.YARD;
var BLTYPE = data.BLTYPE;
var RETURNYARD = data.RETURNYARD;
//var btnadd = Ext.getCmp('btnadd');
//btnadd.disable();
var store = this.storeCtnrSell;
var myDate = new Date();
var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d');
var bodydatas = [];
for (var i = 0; i < selectedRecords.length; i++) {
recordSearch = selectedRecords[i];
bodydatas.push(recordSearch);
var recs = DsStoreQueryBy(store, 'CNTRNO', recordSearch.data.CNTRNO);
if (recs.getCount() > 0) {
} else {
var record = null;
record = Ext.create('MsOpCtnrDetail', {
BSNO:"*",
CTNGID: recordSearch.data.CTNGID,
CTNALL: recordSearch.data.CTNALL,
CNTRNO: recordSearch.data.CNTRNO,
CNTRSOURCE: recordSearch.data.CNTRSOURCE,
CTNSTATUS: BLTYPE,
CTNSTATUSTIME: mydatestr ,
PORT: PORT,
YARD: YARD,
RETURNYARD: RETURNYARD,
CTNEF: recordSearch.data.CTNEF,
CTNEFREF: recordSearch.data.CTNEFREF,
CUSTNO: recordSearch.data.CUSTNO,
MBLNO: recordSearch.data.MBLNO,
REMARK: recordSearch.data.REMARK
});
store.add(record);
}
this.storeListSearch.remove(recordSearch);
}
//var currBody = ConvertRecordsToJsonAll(bodydatas);
//var data = this.formEdit.getForm().getValues();
//Ext.Ajax.request({
// waitMsg: '正在添加数据...',
// url: '/MvcContainer/MsOpCtnr/AddSellDetail',
// params: {
// OpStatus: this.OpStatus,
// data: data,
// ctndetail: currBody
// },
// callback: function (options, success, response) {
// if (success) {
// var result = Ext.JSON.decode(response.responseText);
// if (!result.Success) {
// btnadd.enable();
// Ext.Msg.show({
// title: '提示',
// msg: result.Message,
// icon: Ext.MessageBox.ERROR,
// buttons: Ext.Msg.OK
// });
// return;
// } else {
// }
// } else {
// btnadd.enable();
// Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
// }
// },
// scope: this
//});
},
parentfunction: function (button, event) {
var ret1 = window.parent.opener.OprationSwap();
ret1[3]();
},
onAddCtnrInClick: function (button, event, type) {
var store = null;
var data = this.formEdit.getForm().getValues();
store = this.storeCtnrSell;
var myDate = new Date();
var record = null;
var BSNO = '';
var PORT = '';
var YARD = '';
if (this.OpStatus == "add") {
PORT = data.PORT;
YARD = data.YARD;
CNTRSOURCE = data.CNTRSOURCE;
} else {
BSNO = this.EditRecord.get('BSNO');
PORT = this.EditRecord.get('PORT');
YARD = this.EditRecord.get('YARD');
CNTRSOURCE = this.EditRecord.get('CNTRSOURCE');
}
var newid = NewGuid();
record = Ext.create('MsOpCtnrDetail', {
CTNGID: newid,
CTNALL: '',
CNTRNO: '',
CNTRSOURCE: CNTRSOURCE,
CTNSTATUS:'',
CTNSTATUSTIME: Ext.util.Format.date(myDate, 'Y-m-d'),
PORT: PORT,
YARD: YARD,
CTNEF: '',
CUSTNO: '',
MBLNO: '',
REMARK:''
});
store.add(record);
cellediting = this.cellEditing;
var n = store.getCount();
cellediting.startEditByPosition({ row: n - 1, column: 2 });
},
onDelCtnrInClick: function (button, event, type) {
var bsno = this.formEdit.getForm().findField('BSNO').getValue();
var selectedRecords = [];
selectedRecords = this.CheckBoxModel.selected.items;
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要删除的集装箱信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var data = this.formEdit.getForm().getValues();
Ext.MessageBox.confirm('提示', '确定要删除选中的集装箱信息吗?', function (btn) {
if (btn == 'yes') {
if (selectedRecords.length > 0) {
var CtnrIndatas = [];
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.BSNO == "" || rec.data.BSNO == "*")//如果是新增但没有保存的数据,没有必要提交到后台
{
this.storeCtnrSell.remove(selectedRecords[i]);
} else {
CtnrIndatas.push(rec);
}
}
if (CtnrIndatas.length > 0) {
var CtnrInBody = ConvertRecordsToJsonAll(CtnrIndatas);
Ext.Msg.wait('正在删除...');
Ext.Ajax.request({
waitMsg: '正在删除...', //'正在删除数据...',
url: '/MvcContainer/MsOpCtnr/DeleteSellDetail',
params: {
headdata: Ext.JSON.encode(data),
data: CtnrInBody,
bsno: bsno
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeCtnrSell.reload();
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 });
},
scope: this
}); //end Ext.Ajax.request
}
}
}
}, this);
},
onUpdateCtnrYardClick: function (button, event, type) {
var bsno = this.formEdit.getForm().findField('BSNO').getValue();
var PORTDISCHARGE = this.formEdit.getForm().findField('PORTDISCHARGE').getValue();
var selectedRecords = [];
_this = this;
selectedRecords = this.CheckBoxModel.selected.items;
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要更新的集装箱信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var data = this.formEdit.getForm().getValues();
Ext.MessageBox.confirm('提示', '确定要更新选中的集装箱信息,确认到场吗?', function (btn) {
if (btn == 'yes') {
if (selectedRecords.length > 0) {
var CtnrIndatas = [];
for (var i = 0; i < selectedRecords.length; i++) {
var memberyf = selectedRecords[i];
memberyf.data.PORT = PORTDISCHARGE;
memberyf.data.YARD = memberyf.data.RETURNYARD;
memberyf.data.CTNSTATUS ='在场';
memberyf.data.CTNSTATUSTIME = Ext.util.Format.date(currdate, 'Y-m-d'),
memberyf.commit();
CtnrIndatas.push(memberyf);
}
if (CtnrIndatas.length > 0) {
var CtnrInBody = ConvertRecordsToJsonAll(CtnrIndatas);
Ext.Msg.wait('正在更新...');
Ext.Ajax.request({
waitMsg: '正在更新...', //'正在删除数据...',
url: '/MvcContainer/MsOpCtnr/SaveSellDetail',
params: {
headdata: Ext.JSON.encode(data),
data: CtnrInBody,
bsno: bsno
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeCtnrSell.reload();
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 });
},
scope: this
}); //end Ext.Ajax.request
}
}
}
}, this);
},
getLinenum: function (button, event) {
var _L = 0;
for (var i = 0; i < this.storeCtnrSell.getCount(); i++) {
var _t = parseInt(this.storeCtnrSell.getAt(i).get("LINENUM"));
if (_t > _L) { _L = _t; }
}
_L++;
return _L;
},
CtnrInAfterEdit: function (editor, e, eOpts) {
if (COMPANYID == "" || DEPTGID == "") {
alert("登录信息不全,请退出重新登录");
returen;
}
},
CtnrInBeforeEdit: function (editor, e, eOpts) {
//需要自己实现里面的事件
if (COMPANYID == "" || DEPTGID == "") {
alert("登录信息不全,请退出重新登录");
returen;
}
},
InitData: function () {
this.OpStatus = 'add';
var condition = '';
if (parentWin) {
var ret = parentWin.OprationSwap();
this.OpStatus = ret[0]; //edit
this.StoreList = ret[1];
this.EditRecord = ret[2]; //SelectedRecord
this.parentRecord = ret[3];
}
if (this.OpStatus == 'edit') {
condition = " BSNO='" + this.EditRecord.get('BSNO') + "'";
this.LoadData(this.OpStatus, condition);
}
else {
this.LoadData(this.OpStatus, condition);
}
//this.LoadMustBe();
}, //end InitData
//载入数据
LoadData: function (OpStatus, condition) {
if (COMPANYID == "" || DEPTGID == "") {
alert("登录信息不全,请退出重新登录");
return;
}
this.OpStatus = OpStatus;
var _this = this;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcContainer/MsOpCtnr/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;
}
var timeStamp = result.timeStamp;
timeStamp = timeStamp.replace(/\//g, '-');
//格式化时分秒
var y = '';
var m = '';
var d = '';
var timetemp = timeStamp.split('-');
y = timetemp[0];
if (timetemp[1].length < 2) {
m = '0' + timetemp[1];
} else {
m = timetemp[1];
}
if (timetemp[2].length < 2) {
d = '0' + timetemp[2];
} else {
d = timetemp[2];
}
var timeStampFin = y + '-' + m + '-' + d;
TIMESTAMP = timeStampFin;
timeStamp = timeStampFin;
var data = result.data;
if (this.OpStatus == 'add') {
}
this.Editdata = data;
var basicForm = this.formEdit.getForm();
basicForm.setValues(data);
this.panelFee.EditRecord = this.EditRecord;
this.panelFee.strBSNO = data.BSNO;
this.panelFee.storeDrChFee.load({ params: { billno: this.panelFee.strBSNO, type: 1, optype: "op_other", condition: "((BSNO = '" + data.BSNO + "' OR WMSOUTBSNO='" + data.BSNO + "') and feetype=1) " } });
this.panelFee.storeCrChFee.load({ params: { billno: this.panelFee.strBSNO, type: 2, optype: "op_other", condition: "((BSNO = '" + data.BSNO + "' OR WMSOUTBSNO='" + data.BSNO + "') and feetype=1) " } });
this.panelFee.storeBodySum.load({
params: { bsno: this.panelFee.strBSNO, optype: "op_other" },
callback: function (r, options, success) {
if (success) {
_this.panelFee.setTotalHead();
}
}
});
this.panelFee.storeChFeeGain.load({ params: { bsno: this.panelFee.strBSNO, optype: "op_other" } });
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
}); //request over
if (this.OpStatus == 'edit') {
var BSNO = this.EditRecord.get('BSNO');
this.storeCtnrSell.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: " mng.BSNO='" + BSNO + "'" },
waitMsg: "正在查询数据...",
scope: this
});
var acondition = " BSNO='" + this.EditRecord.get('BSNO') + "'";
_this.Loading = true;
_this.storeDocList.load({
params: { condition: acondition },
waitMsg: "正在查询数据...",
scope: this,
callback: function () {
_this.Loading = false;
}
});
}
}, // end LoadDate
Save: function (type) {
var basicForm = this.formEdit.getForm();
var bsno = basicForm.findField('BSNO').value;
if (!basicForm.isValid()) {
return;
}
Ext.getCmp('BILLNO').setDisabled(false);
var data = this.formEdit.getForm().getValues();
if (COMPANYID == "" || DEPTGID == "") {
Ext.MessageBox.alert("提示", "登录信息不全,请退出重新登录");
return;
}
var CtnrIndatas = [];
for (var i = 0; i < this.storeCtnrSell.getCount(); i += 1) {
var member = this.storeCtnrSell.getAt(i);
var CTNSTATUSTIME = member.data.CTNSTATUSTIME;
if (CTNSTATUSTIME != '')
CTNSTATUSTIME = Ext.util.Format.date(CTNSTATUSTIME, 'Y-m-d');
member.data.CTNSTATUSTIME = CTNSTATUSTIME;
CtnrIndatas.push(member);
}
var CtnrInBody = ConvertRecordsToJsonAll(CtnrIndatas);
var CtnrInBodyDel = ConvertRecordsToJsonAll(this.CtnrSellBodyDel);
var _this = this;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcContainer/MsOpCtnr/SaveSell',
scope: this,
async: false,
params: {
OpStatus: this.OpStatus,
data: Ext.JSON.encode(data),
CtnrInBody: CtnrInBody,
CtnrInBodyDel: CtnrInBodyDel
},
callback: function (options, success, response) {
Ext.getCmp('BILLNO').setDisabled(true);
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 (this.OpStatus == 'add') {
var arrNewRecords = this.StoreList.add(returnData);
this.EditRecord = arrNewRecords[0];
}
else if (this.OpStatus == 'edit') {
var editp = Ext.create('MsOpCtnrList', returnData);
this.EditRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'BSNO')
this.EditRecord.set(name, editp.get(name));
}
}, this);
this.EditRecord.commit();
}
this.panelFee.EditRecord = this.EditRecord;
this.panelFee.strBSNO = returnData.BSNO;
this.storeCtnrSell.commitChanges();
if (type == '0') {
this.OpStatus = 'edit';
var BSNO = _this.EditRecord.get('BSNO');
this.storeCtnrSell.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: " mng.BSNO='" + BSNO + "'" },
waitMsg: "正在查询数据...",
scope: this
});
} else if (type == '1') {//保存并关闭
window.close();
}
} 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
});
}
//alert('03');
}
});
},
//end save
LoadPeriod: function (opstatus) {
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;
this.LoadPeriodStatus(opstatus);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
LoadPeriodStatus: function (opstatus) {
var ACCDATE = this.formEdit.getForm().findField('ACCDATE').getValue();
var oDate1 = new Date(ACCDATE + '-01');
var oDate2 = new Date(this.MsPeriod.PERIOD + '-01');
if (oDate1.getTime() >= oDate2.getTime()) {
this.formEdit.getForm().findField('ACCDATE').setMinValue(this.MsPeriod.PERIOD);
this.formEdit.getForm().findField('ACCDATE').setReadOnly(false);
} else {
if (opstatus == 'add' || opstatus == 'copyadd') {
this.formEdit.getForm().findField('ACCDATE').setMinValue(this.MsPeriod.PERIOD);
this.formEdit.getForm().findField('ACCDATE').setValue(this.MsPeriod.PERIOD);
this.formEdit.getForm().findField('ACCDATE').setReadOnly(false);
}
else {
this.formEdit.getForm().findField('ACCDATE').setMinValue('');
this.formEdit.getForm().findField('ACCDATE').setReadOnly(true);
}
}
},
gridAfterEdit: function (editor, e, eOpts) {
//需要自己实现里面的事件
if (e.field == 'CTNEF') {
var isctn = e.value;
if (isctn == 'F')
e.record.set('CTNEFEF', "重");
else
e.record.set('CTNEFREF', "空");
} else if (e.field == 'DRFEENAME') {
var DRFEENAME = e.record.data['DRFEENAME'];
for (var j = 0; j < this.storeCtnrIn.getCount(); j += 1) {
var memberbody = this.storeCtnrIn.getAt(j);
if (memberbody.data.DRFEENAME == "" || memberbody.data.DRFEENAME == NaN || memberbody.data.DRFEENAME == null) {
memberbody.set("DRFEENAME", DRFEENAME);
// memberbody.commit();
}
};
} else if (e.field == 'CRFEENAME') {
var CRFEENAME = e.record.data['CRFEENAME'];
for (var j = 0; j < this.storeCtnrIn.getCount(); j += 1) {
var memberbody = this.storeCtnrIn.getAt(j);
if (memberbody.data.CRFEENAME == "" || memberbody.data.CRFEENAME == NaN || memberbody.data.CRFEENAME == null) {
memberbody.set("CRFEENAME", CRFEENAME);
// memberbody.commit();
}
};
}
},
CreateCost: function (flag) {
var basicForm = this.formEdit.getForm();
var bsno = basicForm.findField('BSNO').value;
if (!basicForm.isValid()) {
return;
}
var data = this.formEdit.getForm().getValues();
if (COMPANYID == "" || DEPTGID == "") {
Ext.MessageBox.alert("提示", "登录信息不全,请退出重新登录");
return;
}
var CtnrIndatas = [];
for (var i = 0; i < this.storeCtnrSell.getCount(); i += 1) {
var member = this.storeCtnrSell.getAt(i);
CtnrIndatas.push(member);
}
var CtnrInBody = ConvertRecordsToJsonAll(CtnrIndatas);
var _this = this;
Ext.Msg.wait('正在生成费用, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在生成费用...',
url: '/MvcContainer/MsOpCtnr/CreateCost',
scope: this,
async: false,
params: {
data: Ext.JSON.encode(data),
CtnrInBody: CtnrInBody,
flag:flag
},
callback: function (options, success, response) {
{
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success == true) {
Ext.MessageBox.alert('提示', result.Message);
this.panelFee.storeDrChFee.load({ params: { billno: this.panelFee.strBSNO, type: 1, optype: "op_other", condition: "((BSNO = '" + this.panelFee.strBSNO + "' OR WMSOUTBSNO='" + this.panelFee.strBSNO + "') and feetype=1) " } });
this.panelFee.storeCrChFee.load({ params: { billno: this.panelFee.strBSNO, type: 2, optype: "op_other", condition: "((BSNO = '" + this.panelFee.strBSNO + "' OR WMSOUTBSNO='" + this.panelFee.strBSNO + "') and feetype=1) " } });
this.LoadData(this.OpStatus, "BSNO='" + bsno+"'");
} else {
Ext.MessageBox.alert('提示', result.Message);
return;
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
}
}
});
},
onDelFileClick: function (button, event) {
var feeGidSql = '';
var selectedRecords = [];
selectedRecords = this.DocCM.selected.items;
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要删除的附件!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
Ext.MessageBox.confirm('提示', '确定要删除选中的附件吗?', function (btn) {
if (btn == 'yes') {
if (selectedRecords.length > 0) {
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.GID == "*") //如果是新增但没有保存的数据,没有必要提交到后台
{
this.storeDocList.remove(selectedRecords[i]);
} else {
var feeGId = "'" + rec.data.GID + "'";
if (feeGidSql == '') {
feeGidSql = feeGId;
} else {
feeGidSql = feeGidSql + "," + feeGId;
}
}
}
}
_this = this;
Ext.Msg.wait('正在删除数据...');
if (feeGidSql != '') {
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcContainer/MsOpReceipt/DeleteUploadFile',
params: {
data: feeGidSql
},
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.storeDocList.remove(selectedRecords[i]);
}
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
} else {
Ext.Msg.show({ title: '提示', msg: "删除成功!", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
}
}, this);
}
, onUpLoadFileClick: function (button, event) {
var billno = this.EditRecord.get("BSNO");
var custno = this.EditRecord.get("BILLNO");
me = this;
var imgform = new Ext.FormPanel({
region: 'center',
labelWidth: 40,
frame: true,
bodyStyle: 'padding:5px 5px 0',
autoScroll: true,
border: false,
fileUpload: true,
items: [{
xtype: 'fileuploadfield',
id: 'LoadFile',
name: 'LoadFile',
emptyText: '请选择文件',
fieldLabel: '文件',
buttonText: '选择文件',
allowBlank: false,
buttonCfg:
{
iconCls: 'uploaddialog'
},
anchor: '98%'
}],
buttons: [{
text: '上传',
type: 'submit',
handler: function () {
var UserFilePath = Ext.getCmp('LoadFile').getValue();
// if (!CheckFileExt(UserFilePath, /.jpg|.gif|.png|.bmp|.pdf/i)) {
// Ext.Msg.show({ title: '错误', msg: '请确认你上传的文件为图片文件!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
// return;
// }
if (!imgform.form.isValid()) { return; }
imgform.form.submit({
url: '/MvcContainer/MsOpReceipt/UploadFile',
waitMsg: '正在上传',
method: 'POST',
submitEmptyText: false,
async: false,
params: {
CUSTNO: custno,
BSNO: billno
},
success: function (form, action) {
win.close(this);
Ext.Msg.show({ title: '提示', msg: '上传成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
var condition = billno;
var condition2 = " BSNO='" + condition + "' ";
me.Loading = true;
me.storeDocList.load({
params: { condition: condition2 },
waitMsg: "正在查询数据...",
scope: this,
callback: function () {
me.Loading = false;
}
});
},
failure: function (form, action) {
form.reset();
if (action.failureType == Ext.form.Action.SERVER_INVALID)
Ext.MessageBox.alert('警告', '上传过程中出现错误!');
}
});
}
}, {
text: '关闭',
type: 'submit',
handler: function () {
win.close(this);
}
}]
});
var win = new Ext.Window({
title: "上传文件",
width: 360,
height: 120,
modal: true,
resizable: false,
border: false,
items: imgform
});
win.show();
},
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 fieldname = member.data.FIELDNAME;
var headfield = this.formEdit.getForm().findField(member.data.FIELDNAME);
if (headfield != NaN && headfield != null) {
if (member.data.ISMUST == "1")
headfield.allowBlank = false;
if (member.data.ISCOLOR == "1")
headfield.setFieldStyle({ background: '#ffc' });
if (member.data.ISREADONLY == "1")
headfield.setReadOnly(true);
}
};
} else {
}
}
},
scope: this
});
}
//#endregion
//#endregion
});