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/MsCodeCtnTk/MsCodeCtnTkView.js

1823 lines
63 KiB
JavaScript

2 years ago
Ext.namespace('Shipping');
Shipping.MsCodeCtnTkView = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsCodeCtnTkView.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsCodeCtnTkView, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
editRecord: null,
editFactryRecord: null,
FactryStatus: 'add',
ctnid: '',
initUIComponents: function () {
this.serialNo = 0;
this.workSerialNo = 0;
this.bodyDel = [];
this.Loading = true;
//#region 编辑form
//枚举参照相关(编辑form)
this.ctnno = getUrlParam('ctnno');
this.storeCTNPROP = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeCTNPROP.load({ params: { enumTypeId: 97030} });
this.comboxCTNPROP = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCTNPROP,
fieldLabel: '箱属',
name: 'CTNPROP',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
this.storeNAMEPLATE = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeNAMEPLATE.load({ params: { condition: "1=1"} });
this.comboxNAMEPLATE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '铭牌信息',
store: this.storeNAMEPLATE,
flex: 2,
forceSelection: true,
name: 'NAMEPLATE',
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.storeOWNERCTN = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeOWNERCTN.load({ params: { condition: "1=1"} });
this.comboxOWNERCTN = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '罐东',
store: this.storeOWNERCTN,
flex: 2,
forceSelection: true,
name: 'OWNERCTN',
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.storeMADEFACTORY = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
_this = this;
this.storeMADEFACTORY.load({ params: { condition: "1=1"} });
this.comboxMADEFACTORY = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '生产厂家',
store: this.storeMADEFACTORY,
flex: 2,
forceSelection: true,
name: 'MADEFACTORY',
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.storeTRAILPEDAL = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeTRAILPEDAL.load({ params: { enumTypeId: 97031} });
this.comboxTRAILPEDAL = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeTRAILPEDAL,
fieldLabel: '步道踏板',
name: 'TRAILPEDAL',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
this.storeAIRVALVE = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeAIRVALVE.load({ params: { enumTypeId: 97032} });
this.comboxAIRVALVE = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeAIRVALVE,
fieldLabel: '空气阀',
name: 'AIRVALVE',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
this.storeSAFETYVALVE = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeSAFETYVALVE.load({ params: { enumTypeId: 97033} });
this.comboxSAFETYVALVE = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeSAFETYVALVE,
fieldLabel: '安全阀',
name: 'SAFETYVALVE',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
this.storeTOPVALVE = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeTOPVALVE.load({ params: { enumTypeId: 97034} });
this.comboxTOPVALVE = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeTOPVALVE,
fieldLabel: '顶阀',
name: 'TOPVALVE',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
this.storeBOTTOMVALVE = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeBOTTOMVALVE.load({ params: { enumTypeId: 97035} });
this.comboxBOTTOMVALVE = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeBOTTOMVALVE,
fieldLabel: '底阀',
name: 'BOTTOMVALVE',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
this.storeSTEAMPIPE = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeSTEAMPIPE.load({ params: { enumTypeId: 97036} });
this.comboxSTEAMPIPE = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeSTEAMPIPE,
fieldLabel: '蒸汽管',
name: 'STEAMPIPE',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
this.StoreCTNSTATUS = Ext.create('Ext.data.Store', {
fields: ['CTNSTATUS']
});
this.StoreCTNSTATUS.add({ "CTNSTATUS": "可用" });
this.StoreCTNSTATUS.add({ "CTNSTATUS": "不可用" });
this.comboxCTNSTATUS = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '箱状态',
store: this.StoreCTNSTATUS,
forceSelection: true,
name: 'CTNSTATUS',
valueField: 'CTNSTATUS',
displayField: 'CTNSTATUS'
});
this.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeDisportModel',
autoLoad: true,
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' }
});
this.comboxPORTDISCHARGE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '当前地区',
store: this.storeCodeDisport,
name: 'CURPORT',
valueField: 'PORT',
displayField: 'PORT'
});
//客户加载_场站
this.storeDESTPORT_STATOIN = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeDESTPORT_STATOIN.load({ params: { condition: "ISYARD='1'"} });
//场站
this.comboxDESTPORT_STATOIN = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '当前位置',
store: this.storeDESTPORT_STATOIN,
forceSelection: true,
name: 'CURSTATOIN',
valueField: 'CustName',
displayField: 'CodeAndName'
});
// this.storeListGood = Ext.create('Ext.data.Store', {
// model: 'MsCodeMSDS',
// remoteSort: true,
// proxy: {
// type: 'ajax',
// url: '/MvcContainer/MsCodeMSDS/GetDataList',
// reader: {
// id: 'GID',
// root: 'data',
// totalProperty: 'totalCount'
// }
// }
// });
// this.storeListGood.load({ params: { condition: ""} });
// this.comboxPREGOODNAME = Ext.create('DsExt.ux.RefTableCombox', {
// store: this.storeListGood,
// fieldLabel: '前装货',
// flex: 2, forceSelection: true,
// name: 'PREGOODNAME',
// valueField: 'GOODNAME',
// displayField: 'GOODNAME'
// });
//表参照相关(编辑form)
//编辑form
this.formEdit = Ext.widget('form', {
region: 'center',
frame: true,
bodyPadding: 5,
autoScroll: true,
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: 'GID',
name: 'GID', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'COMPANYID',
name: 'COMPANYID', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '箱号',
allowBlank: true,
flex: 1,
name: 'CTNNO'
}, this.comboxNAMEPLATE, this.comboxOWNERCTN]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCTNSTATUS, this.comboxPORTDISCHARGE, this.comboxDESTPORT_STATOIN, {
fieldLabel: '前装货',
readOnly: true,
flex: 1,
name: 'PREGOODNAME'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCTNPROP, this.comboxMADEFACTORY, {
fieldLabel: '生产日期',
format: 'Y-m-d',
flex: 1,
xtype: 'datefield',
name: 'MADEDATE'
}, { xtype: 'hiddenfield'}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '罐壁厚度',
name: 'TANKWALLTHICK',
regex: /^(-?\d+)(\.\d+)?$/,
regexText: '请输入正确的数值!',
flex: 0.6
}, {
xtype: 'label',
text: 'mm'
// html: "℃~"
}, {
fieldLabel: '封头厚度',
name: 'HEADTHICK',
regex: /^(-?\d+)(\.\d+)?$/,
regexText: '请输入正确的数值!',
flex: 0.6
}, {
xtype: 'label',
html: "mm"
}, {
fieldLabel: '容积',
regex: /^(-?\d+)(\.\d+)?$/,
regexText: '请输入正确的数值!',
name: 'TANKVOLUMN',
flex: 0.6
}, {
xtype: 'label',
html: "CBM"
}, {
fieldLabel: '皮重',
regex: /^(-?\d+)(\.\d+)?$/,
regexText: '请输入正确的数值!',
name: 'TAREWEIGHT',
flex: 0.6
}, {
xtype: 'label',
html: "KGS"
}, {
fieldLabel: '最大允许压力',
name: 'MAXWORKINGGPRESSURE',
regex: /^(-?\d+)(\.\d+)?$/,
regexText: '请输入正确的数值!',
flex: 0.6
}, {
xtype: 'label',
text: 'bar'
// html: "℃~"
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '试验压力',
name: 'TESTINGGPRESSURE',
regex: /^(-?\d+)(\.\d+)?$/,
regexText: '请输入正确的数值!',
flex: 0.6
}, {
xtype: 'label',
html: "bar"
}, {
fieldLabel: '设计温度',
name: 'DESIGNTEMPERATUREB',
regex: /^(-?\d+)(\.\d+)?$/,
regexText: '请输入正确的数值!',
flex: 0.6
}, {
xtype: 'label',
html: "℃~"
}, {
name: 'DESIGNTEMPERATUREE',
regex: /^(-?\d+)(\.\d+)?$/,
regexText: '请输入正确的数值!',
flex: 0.28
}, {
xtype: 'label',
html: "℃"
}, { xtype: 'hiddenfield',
flex: 1.7
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxTRAILPEDAL, this.comboxAIRVALVE, this.comboxSAFETYVALVE, this.comboxTOPVALVE, this.comboxBOTTOMVALVE]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '虹吸管',
inputValue: true,
xtype: 'checkboxfield',
name: 'EXSITSIPHONPIPE'
}, {
fieldLabel: '压力表',
inputValue: true,
xtype: 'checkboxfield',
name: 'EXSITPRESSUREGAUGE'
}, {
fieldLabel: '顶部溢流盒盖',
inputValue: true,
xtype: 'checkboxfield',
name: 'EXSITTOPOVERFLOWBOX'
}, {
fieldLabel: '人孔溢流盒盖',
inputValue: true,
xtype: 'checkboxfield',
name: 'EXSITINTOOVERFLOWBOX'
}, {
fieldLabel: '底部阀门防尘罩',
inputValue: true,
xtype: 'checkboxfield',
name: 'EXSITBOTTONVALVEDUSTCOVER'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxSTEAMPIPE, {
fieldLabel: '录入人',
readOnly: true,
disabled: true,
name: 'INPUTBYREF'
}, {
fieldLabel: '录入日期',
readOnly: true,
disabled: true,
name: 'INPUTTIME'
}, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield'}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
xtype: 'textareafield',
grow: true,
height: 40,
fieldLabel: '备注',
name: 'REMARKS',
anchor: '100%'
}]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}); //end this.formEdit
//#endregion
//#region 按钮Toolbar
//#endregion
//#region 不能去航线
this.storeBodyList = Ext.create('Ext.data.Store', {
model: 'MsCodeCtnTkNoLaneItems',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsCodeCtnTk/GetCodeCtnTkNoLaneItemsList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeLANE = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.Lane',
proxy: { url: '/CommMng/BasicDataRef/GetCodeLaneList' }
});
this.storeLANE.load();
this.comboxLANE = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeLANE,
// forceSelection: true,
name: 'LANE',
valueField: 'GID',
displayField: 'LANE'
});
//明细表表格
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.gridListNoLaneItems = new Ext.grid.GridPanel({
store: this.storeBodyList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridListCellEditing],
selType: 'cellmodel',
columns: [{
sortable: true,
dataIndex: 'GID',
header: '编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'LINKGID',
header: '业务编号',
hidden: true,
width: 0
}, {
dataIndex: 'LANEGID',
header: '航线',
width: 220,
editor: this.comboxLANE,
renderer: function (value, p, record) {
return record.data.LANE;
}
}]
});
this.gridListNoLaneItems.on('edit', function (editor, e, eOpts) {
this.gridListAfterEdit(editor, e, eOpts);
}, this);
this.panelNoLaneItems = new Ext.Panel({
title: '不能去航线信息',
layout: "border",
region: 'west',
width: 300,
animate: true,
frame: false,
items: [this.gridListNoLaneItems]
});
//#endregion
//#region 年检
//客户加载_场站
this.storeYARD = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeYARD.load({ params: { condition: "ISYARD='1'"} });
//场站
this.comboxYARD = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeYARD,
forceSelection: true,
name: 'DEPOT',
valueField: 'CustName',
displayField: 'CodeAndName'
});
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.storeInspectList = Ext.create('Ext.data.Store', {
model: 'MsCodeCtnTkInspect',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsCodeCtnTk/GetCodeCtnTkInspectItemsList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.gridListInspectCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.gridListInspectItems = new Ext.grid.GridPanel({
store: this.storeInspectList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridListInspectCellEditing],
selType: 'cellmodel',
columns: [{
sortable: true,
dataIndex: 'GID',
header: '编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'LINKGID',
header: '业务编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'DEPOT',
header: '场站',
editor: this.comboxYARD,
width: 100
}, {
sortable: true,
dataIndex: 'DEPOTDATE',
header: '入场时间',
editor: {
xtype: 'datefield',
format: 'Y-m-d'
},
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 100
}, {
sortable: true,
dataIndex: 'INSPECTDATE',
header: '年检时间',
editor: {
xtype: 'datefield',
format: 'Y-m-d'
},
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 100
}, {
sortable: true,
dataIndex: 'CYCLE',
header: '周期',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true
},
width: 100
}, {
sortable: true,
dataIndex: 'INSPECTCORP',
header: '年检企业',
editor: {
xtype: 'textfield'
},
width: 100
}, {
sortable: true,
dataIndex: 'DEPOTAMOUNT',
header: '场站费用',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true
},
width: 100
}, {
sortable: true,
dataIndex: 'DEPOTCURRENCY',
header: '场站币别',
editor: this.comboxCurr,
width: 100
}, {
sortable: true,
dataIndex: 'INSPECTAMOUNT',
header: '年检费用',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true
},
width: 100
}, {
sortable: true,
dataIndex: 'INSPECTCURRENCY',
header: '年检币别',
editor: this.comboxCurr,
width: 100
}]
});
//#endregion
//#region 保险
this.storeInsuranceList = Ext.create('Ext.data.Store', {
model: 'MsCodeCtnTkInsurance',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsCodeCtnTk/GetCodeCtnTkInsuranceItemsList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.gridListInsuranceItems = new Ext.grid.GridPanel({
store: this.storeInsuranceList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridListCellEditing],
selType: 'cellmodel',
columns: [{
sortable: true,
dataIndex: 'GID',
header: '编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'LINKGID',
header: '业务编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'BSNO',
header: '保险编号',
editor: {
xtype: 'textfield'
},
width: 200
}, {
sortable: true,
dataIndex: 'BEGINDATE',
header: '开始时间',
editor: {
xtype: 'datefield',
format: 'Y-m-d'
},
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 100
}, {
sortable: true,
dataIndex: 'ENDDATE',
header: '结束时间',
editor: {
xtype: 'datefield',
format: 'Y-m-d'
},
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 100
}, {
sortable: true,
dataIndex: 'CORPSNAME',
editor: {
xtype: 'textfield'
},
header: '保险企业',
width: 200
}]
});
//#endregion
//#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',
// width: 350,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.DocListCellEditing],
selModel: this.DocCM,
selType: 'cellmodel',
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",
title: '相关图片', //autoScroll: true,
frame: false,
split: true,
items: [this.gridDocList]
});
//#endregion
this.panelDetail = new Ext.Panel({
layout: "border",
region: "center",
title: "航线及图片",
frame: false,
split: true,
items: [this.panelNoLaneItems, this.panelDoc]
});
this.panelYearInspection = new Ext.Panel({
layout: "border",
region: "center",
title: "年检",
frame: false,
split: true,
items: [this.gridListInspectItems]
});
this.panelInsurance = new Ext.Panel({
layout: "border",
region: "center",
title: "保险",
frame: false,
split: true,
items: [this.gridListInsuranceItems]
});
//#region 布局
//控件布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 300,
items: [this.formEdit]
});
this.tabWTpanel = new Ext.TabPanel({
activeTab: 0,
autoWidth: true,
border: true,
frame: false,
region: 'center',
enableTabScroll: true,
items:
[
this.panelDetail, this.panelYearInspection, this.panelInsurance
]
});
Ext.apply(this, {
items: [this.panelTop, this.tabWTpanel]
});
//#endregion
//绑定查询窗体
this.storeBodyList.on('beforeload', function (store) {
var acondition = " LINKGID='" + this.ctnid + "'";
Ext.apply(store.proxy.extraParams, { condition: acondition });
}, this);
this.storeDocList.on('beforeload', function (store) {
var xcondition = " BSNO='" + this.ctnid + "'";
Ext.apply(store.proxy.extraParams, { condition: xcondition });
}, this);
this.ParentWin = window.parent.opener;
//初始化数据
this.InitData();
//绑定事件
}, //end initUIComponents
InitData: function () {
this.opStatus = 'edit';
this.FactryStatus = 'edit';
var condition = '';
if (this.opStatus == 'edit')
condition = " c.CTNNO='" + this.ctnno + "'";
this.LoadData(this.opStatus, condition);
}, //end InitData
LoadData: function (opstatus, condition) {
this.serialNo = 0;
this.workSerialNo = 0;
this.bodyDel = [];
this.opStatus = opstatus;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcContainer/MsCodeCtnTk/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 data = result.data;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(data);
if (this.opStatus == 'edit') {
var acondition = " BSNO='" + data.GID + "'";
_this.Loading = true;
_this.storeDocList.load({
params: { condition: acondition },
waitMsg: "正在查询数据...",
scope: this,
callback: function () {
_this.Loading = false;
}
});
acondition = " LINKGID='" + data.GID + "'";
this.ctnid = data.GID;
this.storeInspectList.load({ params: { condition: acondition} });
this.storeInsuranceList.load({ params: { condition: acondition} });
this.storeBodyList.load({ params: { condition: acondition} });
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}, // end LoadDate
Save: function (type) {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
basicForm.findField('GID').setDisabled(false);
var data = basicForm.getValues();
basicForm.findField('GID').setDisabled(true);
if (this.opStatus == 'add') {
data.GID = 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);
var bodydatasInspect = [];
for (var j = 0; j < this.storeInspectList.getCount(); j += 1) {
var memberyf = this.storeInspectList.getAt(j);
var DEPOTDATE = memberyf.data.DEPOTDATE;
var INSPECTDATE = memberyf.data.INSPECTDATE;
if (DEPOTDATE != '')
DEPOTDATE = Ext.util.Format.date(DEPOTDATE, 'Y-m-d');
if (INSPECTDATE != '')
INSPECTDATE = Ext.util.Format.date(INSPECTDATE, 'Y-m-d');
memberyf.data.DEPOTDATE = DEPOTDATE;
memberyf.data.INSPECTDATE = INSPECTDATE;
bodydatasInspect.push(memberyf);
};
var jsonBodyInspect = ConvertRecordsToJsonAll(bodydatasInspect);
var bodydatasInsurance = [];
for (var j = 0; j < this.storeInsuranceList.getCount(); j += 1) {
var memberyf = this.storeInsuranceList.getAt(j);
var BEGINDATE = memberyf.data.BEGINDATE;
var ENDDATE = memberyf.data.ENDDATE;
if (BEGINDATE != '')
BEGINDATE = Ext.util.Format.date(BEGINDATE, 'Y-m-d');
if (ENDDATE != '')
ENDDATE = Ext.util.Format.date(ENDDATE, 'Y-m-d');
memberyf.data.BEGINDATE = BEGINDATE;
memberyf.data.ENDDATE = ENDDATE;
bodydatasInsurance.push(memberyf);
};
var jsonBodyInsurance = ConvertRecordsToJsonAll(bodydatasInsurance);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcContainer/MsCodeCtnTk/Save',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
body: jsonBody,
Inspectbody: jsonBodyInspect,
Insurancebody: jsonBodyInsurance
},
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 (this.opStatus == 'add') {
var arrNewRecords = this.StoreList.add(returnData);
this.editRecord = arrNewRecords[0];
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('MsCodeCtnTk', 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';
basicForm.findField('GID').setDisabled(true);
for (var j = 0; j < this.storeBodyList.getCount(); j += 1) {
var memberbody = this.storeBodyList.getAt(j);
memberbody.set("LINKGID", this.editRecord.get('GID'));
memberbody.commit();
};
for (var j = 0; j < this.storeInspectList.getCount(); j += 1) {
var memberbody = this.storeInspectList.getAt(j);
memberbody.set("LINKGID", this.editRecord.get('GID'));
memberbody.commit();
};
for (var j = 0; j < this.storeInsuranceList.getCount(); j += 1) {
var memberbody = this.storeInsuranceList.getAt(j);
memberbody.set("LINKGID", this.editRecord.get('GID'));
memberbody.commit();
};
} else if (type == '1') {
for (var j = 0; j < this.storeBodyList.getCount(); j += 1) {
var memberbody = this.storeBodyList.getAt(j);
memberbody.set("LINKGID", this.editRecord.get('GID'));
memberbody.commit();
};
for (var j = 0; j < this.storeInspectList.getCount(); j += 1) {
var memberbody = this.storeInspectList.getAt(j);
memberbody.set("LINKGID", this.editRecord.get('GID'));
memberbody.commit();
};
for (var j = 0; j < this.storeInsuranceList.getCount(); j += 1) {
var memberbody = this.storeInsuranceList.getAt(j);
memberbody.set("LINKGID", this.editRecord.get('GID'));
memberbody.commit();
};
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
gridListAfterEdit: function (editor, e, eOpts) {
if (e.value == e.originalValue) return;
if (e.field == 'LANEGID') {
var selectrecords = DsStoreQueryBy(this.storeLANE, 'GID', e.value);
if (selectrecords.getCount() > 0) {
var selectdata = selectrecords.getAt(0).data;
e.record.set('LANE', selectdata.LANE);
} else {
e.record.set('LANE', '');
}
}
},
addDetail: function () {
var MSDSID = this.formEdit.getForm().findField('GID').getValue();
//var newSerialno = DsGetNewSerialNo(this.storeBodyList, this.serialNo);
var record = Ext.create('MsCodeCtnTkNoLaneItems', {
GID: NewGuid(),
LINKGID: '*',
LANEGID: '',
LANE: '',
REMARKS: ''
});
this.storeBodyList.add(record);
var n = this.storeBodyList.getCount();
this.gridListCellEditing.startEditByPosition({ row: n - 1, column: 1 });
},
addInspect: function () {
var MSDSID = this.formEdit.getForm().findField('GID').getValue();
var record = Ext.create('MsCodeCtnTkInspect', {
GID: NewGuid(),
LINKGID: '*',
DEPOT: '',
CYCLE: '0',
DEPOTAMOUNT: '0',
INSPECTAMOUNT: '0'
});
this.storeInspectList.add(record);
var n = this.storeInspectList.getCount();
this.gridListCellEditing.startEditByPosition({ row: n - 1, column: 1 });
},
onDelInspectClick: function () {
var selections = this.gridListInspectItems.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要删除的信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
var bodyAddDatas = [];
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
bodyAddDatas.push(rec);
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcContainer/MsCodeCtnTk/DeleteCodeCtnTkInspectItems',
params: {
data: jsonbodyAddDatas
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var acondition = " LINKGID='" + this.editRecord.get('GID') + "'";
this.storeInspectList.load({ params: { condition: acondition} });
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);
},
onImportInspectClick: function () {
var GID = this.formEdit.getForm().findField('GID').getValue();
var condition = " LINKGID='" + GID + "'";
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: '/MvcContainer/MsCodeCtnTk/ImportCtnTkInspect',
waitMsg: '正在上传',
method: 'POST',
params: {
bsno: GID
},
success: function (form, action) {
win.close(this);
Ext.Msg.show({ title: '提示', msg: '上传成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
me.storeInspectList.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();
return;
},
addInsurance: function () {
var MSDSID = this.formEdit.getForm().findField('GID').getValue();
var record = Ext.create('MsCodeCtnTkInsurance', {
GID: NewGuid(),
LINKGID: '*',
CORPSNAME: ''
});
this.storeInsuranceList.add(record);
var n = this.storeInsuranceList.getCount();
this.gridListCellEditing.startEditByPosition({ row: n - 1, column: 1 });
},
onDelInsuranceClick: function () {
var selections = this.gridListInsuranceItems.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要删除的信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
var bodyAddDatas = [];
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
bodyAddDatas.push(rec);
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcContainer/MsCodeCtnTk/DeleteCodeCtnTkInsuranceItems',
params: {
data: jsonbodyAddDatas
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var acondition = " LINKGID='" + this.editRecord.get('GID') + "'";
this.storeInsuranceList.load({ params: { condition: acondition} });
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);
},
onImportInsuranceClick: function () {
var GID = this.formEdit.getForm().findField('GID').getValue();
var condition = " LINKGID='" + GID + "'";
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: '/MvcContainer/MsCodeCtnTk/ImportCtnTkInsurance',
waitMsg: '正在上传',
method: 'POST',
params: {
bsno: GID
},
success: function (form, action) {
win.close(this);
Ext.Msg.show({ title: '提示', msg: '上传成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
me.storeInsuranceList.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();
return;
},
//#region 上传图片
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: '/MvcShipping/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("GID");
var custno = this.editRecord.get("CTNNO");
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: '/MvcShipping/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('警告', action.result.errors.msg);
}
});
}
}, {
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();
}
,
//#endregion
PrevRecord: function () {
var modifystr = this.getIsModify();
if (modifystr != "") {
Ext.Msg.show({ title: '警告', msg: modifystr + '未保存,如果离开此页,将丢失未保存的更改 ', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var j = this.StoreList.indexOf(this.editRecord);
if (j == 0) {
Ext.Msg.show({ title: '警告', msg: '已是最前一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
if (j == this.StoreList.count) {
Ext.Msg.show({ title: '警告', msg: '已是最后一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var condition = '';
j = j - 1;
this.editRecord = this.StoreList.getAt(j);
if (this.opStatus == 'edit') {
condition = "GID='" + this.editRecord.get('GID') + "'";
//this.storeBodyList.load({ params: { condition: condition} });
}
this.LoadData(this.opStatus, condition);
},
NextRecord: function () {
var modifystr = this.getIsModify();
if (modifystr != "") {
Ext.Msg.show({ title: '警告', msg: modifystr + '未保存,如果离开此页,将丢失未保存的更改 ', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var j = this.StoreList.indexOf(this.editRecord);
if (j == (this.StoreList.data.length - 1)) {
Ext.Msg.show({ title: '警告', msg: '已是最后一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var condition = '';
j = j + 1;
this.editRecord = this.StoreList.getAt(j);
if (this.opStatus == 'edit') {
condition = "GID='" + this.editRecord.get('GID') + "'";
//this.storeBodyList.load({ params: { condition: condition} });
}
this.LoadData(this.opStatus, condition);
},
getIsModify: function () {
if (panelEdit.formEdit.getForm().isDirty() == true) {
return '罐箱信息';
}
else return '';
} //
});