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.

899 lines
32 KiB
JavaScript

10 months ago
Ext.namespace('Shipping');
Shipping.MsOpCtnDetailEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpCtnDetailEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpCtnDetailEdit, Ext.Panel, {
parentWin: null,
editRecord: null,
initUIComponents: function () {
this.serialNo = 0;
this.itemindex = 1;
//#region 加载父类值
parentWin = window.parent.opener;
if (parentWin) {
var ret = parentWin.OprationSwapOpCtnDetail();
this.editRecord = ret[0];
}
//#endregion
//#region 下拉框信息加载
//箱型_集装箱列表中的下拉框加载
this.storeCodeCtn = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeCtnModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeCtnList' }
});
this.storeCodeCtn.load();
this.comboxCTNALL = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '箱型',
store: this.storeCodeCtn,
forceSelection: true,
name: 'CTNALL',
valueField: 'CTN',
displayField: 'CTN'
});
//件数包装_集装箱列表中的下拉框加载
this.storeCodePackage = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodePackageModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodePackageList' }
});
this.storeCodePackage.load();
this.comboxKINDPKGS_CTN = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '件数包装',
store: this.storeCodePackage,
forceSelection: true,
name: 'KINDPKGS',
valueField: 'PKGS',
displayField: 'PKGS'
});
//#endregion
//#region 集装箱-主列表
this.storeList = Ext.create('Ext.data.Store', {
model: 'MsOpSeaeDetail',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpSeae/GetBodyList',
reader: {
id: 'BsNo,CTNCODE,CTN_ID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.girdcolums = [{
sortable: true,
dataIndex: 'CTN_ID',
header: '编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'BSNO',
header: '业务编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'CTNCODE',
header: Zi.LAN.CTNCODE,
width: 35
}, {
dataIndex: 'CTNALL',
header: Zi.LAN.CTNALL,
width: 70
}, {
dataIndex: 'CTNNUM',
header: Zi.LAN.CTNNUM ,
width: 50
}, {
dataIndex: 'CNTRNO',
header: Zi.LAN.CNTRNO,
width: 100
}, {
dataIndex: 'SEALNO',
header: Zi.LAN.SEALNO,
width: 80
}, {
sortable: true,
dataIndex: 'PKGS',
header: Zi.LAN.PKGS,
width: 80,
align: 'right',
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer()
}, {
dataIndex: 'KINDPKGS',
header: Zi.LAN.KINDPKGS,
width: 120
}, {
dataIndex: 'KGS',
header: Zi.LAN.KGS2,
width: 100,
align: 'right',
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.0000'),
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 4, '', true);
return value;
}
}, {
dataIndex: 'CBM',
header: Zi.LAN.CBM2,
width: 100,
align: 'right',
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.0000'),
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 4, '', true);
return value;
}
}, {
dataIndex: 'TAREWEIGHT',
header: Zi.LAN.TAREWEIGHT,
width: 100,
align: 'right',
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.0000'),
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 4, '', true);
return value;
}
}, {
dataIndex: 'CNTRSOURCE',
header: Zi.LAN.CNTRSOURCE,
width: 70
}, {
dataIndex: 'REMARK',
header: Zi.LAN.REMARK,
width: 150
}];
this.AddGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
//定义Grid
this.gridListMain = new Ext.grid.GridPanel({
title: Zi.LAN.MBLNO + '' + this.editRecord.data.MBLNO.toString() + Zi.LAN.panelBodyCtn,
store: this.storeList,
enableHdMenu: false,
//region: 'west',
region: 'north',
height: 400,
frame: true,
loadMask: { msg: Zi.LAN.ShuJuJiaZaiZhongQingShaoDeng},
trackMouseOver: true,
viewConfig: {
enableTextSelection: true
},
disableSelection: false,
selModel: this.AddGridCheckBoxModel,
columns: this.girdcolums,
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
tbar: [{
text: Zi.LAN.btnprintctn,
tooltip: Zi.LAN.btnprintctn,
id: "btnprint",
iconCls: "btnprint",
handler: function (button, event) {
this.Print(button, event);
},
scope: this
}]
});
_this = this;
this.gridListMain.addListener('itemclick', function (dataview, record, item, index, e, b) {
this.storeBodyList.load({ params: { condition: "CTN_ID='" + record.data.CTN_ID + "'" }, scope: this });
}, this);
//#endregion
//#region 集装箱-明细表
this.storeBodyList = Ext.create('Ext.data.Store', {
model: 'MsOpCtnDetail',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpSeae/GetOpCtnDetailList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.StoreDPKGTYPE2 = Ext.create('Ext.data.Store', {
fields: ['ID', 'NAME']
});
this.StoreDPKGTYPE2.add({ "ID": "", "NAME": "没有要求" });
this.StoreDPKGTYPE2.add({ "ID": "1", "NAME": "高度危险" });
this.StoreDPKGTYPE2.add({ "ID": "2", "NAME": "中度危险" });
this.StoreDPKGTYPE2.add({ "ID": "3", "NAME": "低度危险" });
//this.storeDPKGTYPE2 = Ext.create('DsExt.ux.RefEnumStore', {});
//this.storeDPKGTYPE2.load({ params: { enumTypeId: 97305 } });
this.comboxDPKGTYPE2 = Ext.create('DsExt.ux.RefEnumCombox', {
store: this.storeDPKGTYPE2,
name: 'PKGTYPE',
valueField: 'ID',
displayField: 'NAME'
});
this.StoreISMP2 = Ext.create('Ext.data.Store', {
fields: ['ID', 'NAME']
});
this.StoreISMP2.add({ "ID": "1", "NAME": "是" });
this.StoreISMP2.add({ "ID": "", "NAME": "否" });
this.comboxISMP2 = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreISMP2,
forceSelection: true,
flex: 1,
name: 'ISMP',
valueField: 'ID',
displayField: 'NAME'
});
this.girdcolums2 = [{
sortable: true,
dataIndex: 'GID',
header: '编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'CTN_ID',
header: 'CTN编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'PKGS',
header: Zi.LAN.PKGS,
width: 80,
align: 'right',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true, //得到焦点时自动选择文本
allowDecimals: false, //允许输入小数
nanText: '请输入有效整数',
value: 0
},
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer()
}, {
dataIndex: 'KINDPKGS',
header: Zi.LAN.KINDPKGS,
width: 120,
editor: this.comboxKINDPKGS_CTN
}, {
dataIndex: 'KGS',
header: Zi.LAN.KGS2,
width: 100,
align: 'right',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true, //得到焦点时自动选择文本
allowDecimals: true, //允许输入小数
decimalPrecision: 4, //允许保留的小数位数,并四舍五入
nanText: '请输入有效小数',
value: 0.00000
},
summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 4, '', true);
return value;
}
}, {
dataIndex: 'CBM',
header: Zi.LAN.CBM2,
width: 100,
align: 'right',
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true, //得到焦点时自动选择文本
allowDecimals: true, //允许输入小数
decimalPrecision: 4, //允许保留的小数位数,并四舍五入
nanText: '请输入有效小数',
value: 0.00000
},
summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 4, '', true);
return value;
}
}, {
dataIndex: 'HSCODE',
header: Zi.LAN.HSCODE,
width: 100,
editor: {
xtype: 'textareafield',
selectOnFocus: true,
allowBlank: false
}
}, {
dataIndex: 'NCM',
header: 'NCM',
width: 100,
editor: {
xtype: 'textareafield',
selectOnFocus: true,
allowBlank: false
}
}, {
dataIndex: 'DCLASS',
header: Zi.LAN.DCLASS,
width: 60,
editor: {
xtype: 'textareafield',
selectOnFocus: true,
allowBlank: false
}
}, {
dataIndex: 'DUNNO',
header: Zi.LAN.DUNNO,
width: 60,
editor: {
xtype: 'textareafield',
selectOnFocus: true,
allowBlank: false
}
}, {
dataIndex: 'DFLASH',
header: Zi.LAN.DFLASH,
width: 60,
editor: {
xtype: 'textareafield',
selectOnFocus: true,
allowBlank: false
}
}, {
dataIndex: 'DPAGE',
header: Zi.LAN.DPAGE,
width: 60,
editor: {
xtype: 'textareafield',
selectOnFocus: true,
allowBlank: false
}
}, {
dataIndex: 'PKGTYPE',
header: Zi.LAN.PKGTYPE,
width: 120,
editor: this.comboxDPKGTYPE2
}, {
dataIndex: 'ISMP',
header: Zi.LAN.ISMP,
width: 120,
editor: this.comboxISMP2
}, {
dataIndex: 'LINKMAN',
header: Zi.LAN.LINKMAN,
width: 60,
editor: {
xtype: 'textareafield',
selectOnFocus: true,
allowBlank: false
}
}, {
dataIndex: 'DTEL',
header: Zi.LAN.ATTN,
width: 60,
editor: {
xtype: 'textareafield',
selectOnFocus: true,
allowBlank: false
}
}, {
dataIndex: 'DESCRIPTION',
header: Zi.LAN.DESCRIPTION,
width: 200,
editor: {
xtype: 'textareafield',
selectOnFocus: true,
allowBlank: false,
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'blur': function blur(combo, eOpts, obj) {
this.formEdit.getForm().findField('DESCRIPTION').setValue(combo.value);
}
}
}
}, {
dataIndex: 'MARKS',
header: Zi.LAN.MARK,
width: 200,
editor: {
xtype: 'textareafield',
selectOnFocus: true,
allowBlank: false,
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'blur': function blur(combo, eOpts, obj) {
this.formEdit.getForm().findField('MARKS').setValue(combo.value);
}
}
}
}];
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridList = new Ext.grid.GridPanel({
title: Zi.LAN.DUOPINMINGXINXI,
store: this.storeBodyList,
enableHdMenu: false,
//region: 'north',
region: 'west',
width: 900,
frame: true,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridListCellEditing],
selModel: this.GridCheckBoxModel,
selType: 'cellmodel',
columns: this.girdcolums2,
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
tbar: [{
text: Zi.LAN.btnadddetail,
tooltip: Zi.LAN.btnadddetail,
id: "btnadddetail",
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddDetailClick(button, event);
},
scope: this
}, {
id: 'btnESave',
text: Zi.LAN.btnsavemanifestDelivery,
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0');
},
scope: this
}, '-', {
text: Zi.LAN.btndeldetail,
tooltip: Zi.LAN.btndeldetail,
id: "btndeldetail",
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelDetailClick(button, event);
},
scope: this
}, '-', {
text: Zi.LAN.YinRuEXCELShuJu,
handler: function (button, event) {
this.onImportCtnDetailClick(button, event);
},
scope: this
}]
});
this.gridList.addListener('itemclick', function (dataview, record, item, index, e, b) {
this.formEdit.getForm().findField('DESCRIPTION').setValue(record.data.DESCRIPTION);
this.formEdit.getForm().findField('MARKS').setValue(record.data.MARKS);
}, this);
//#endregion
//#region 编辑formEdit 基本信息
this.formEdit = Ext.widget('form', {
title: Zi.LAN.DESCRIPTION + '&' + Zi.LAN.MARK,
region: 'center',
frame: true,
border: false,
trackResetOnLoad: true,
items: [{
fieldLabel: 'GID',
name: 'GID', hidden: true
}, {
xtype: 'label',
flex: 1, id: 'DESCRIPTIONSTR',
html: "<font color='green'></font>"
}, {
xtype: 'textareafield',
grow: true, //字段是否自动伸展和收缩,默认为false
labelSeparator: '', //标签分隔字符
name: 'DESCRIPTION',
height: 170,
anchor: '100%',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'blur': function blur(combo, eOpts, obj) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length > 0) {
this.SetShipperLable('DESCRIPTION', 35);
selections[0].set('DESCRIPTION', combo.value);
}
this.formEdit.getForm().findField('DESCRIPTION')
.setValue(combo.value.toUpperCase());
}
//
}
}, {
xtype: 'label',
flex: 1, id: 'MARKSSTR',
html: "<font color='green'></font>"
}, {
xtype: 'textareafield',
grow: true, //字段是否自动伸展和收缩,默认为false
labelSeparator: '', //标签分隔字符
name: 'MARKS',
height: 170,
anchor: '100%',
enableKeyEvents: true, //激活键盘事件
listeners: {
scope: this,
'blur': function blur(combo, eOpts, obj) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length > 0) {
this.SetShipperLable('MARKS', 24);
selections[0].set('MARKS', combo.value);
}
this.formEdit.getForm().findField('MARKS')
.setValue(combo.value.toUpperCase());
}
//
}
}]
});
//#endregion
//#region 框架结构
Ext.apply(this, {
border: false,
items: [this.gridListMain, this.gridList, this.formEdit]
});
//#endregion
//#region 加载列表
this.storeList.load({ params: { condition: "BSNO='" + this.editRecord.data.BSNO.toString() + "'" }, scope: this });
this.storeList.on('load', function (store, records) {
if (store.getCount() > 0) {
this.gridListMain.getSelectionModel().select(0);
}
}, this);
this.gridListMain.getSelectionModel().on('select', function (model, record, index) {
this.storeBodyList.load({ params: { condition: "CTN_ID='" + record.data.CTN_ID + "'" }, scope: this });
}, this);
//#endregion
},
//#region 保存明细
Save: function (type) {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
//
var selections = this.gridListMain.getSelectionModel().getSelection();
var sCTN_ID = selections[0].data.CTN_ID;
var iPKGS = selections[0].data.PKGS;
var dKGS = selections[0].data.KGS;
var dCBM = selections[0].data.CBM;
//
var data = this.formEdit.getForm().getValues(false, false, false);
var bodydatas = [];
var iPKGS2 = 0;
var dKGS2 = 0;
var dCBM2 = 0;
for (var i = 0; i < this.storeBodyList.getCount(); i += 1) {
iPKGS2 += this.storeBodyList.getAt(i).get("PKGS");
dKGS2 = Add(dKGS2, this.storeBodyList.getAt(i).get("KGS"));
var ctncbm=this.storeBodyList.getAt(i).get("CBM");
dCBM2 = Add(dCBM2, parseFloat(ctncbm).toFixed(4));
var member = this.storeBodyList.getAt(i);
bodydatas.push(member);
}
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
//
//if (iPKGS2 > iPKGS) {
// Ext.Msg.show({ title: '错误', msg: "多品名中 件数总和 超出 集装箱件数!", icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
// return;
//}
//if (dKGS2 > dKGS) {
// Ext.Msg.show({ title: '错误', msg: "多品名中 重量总和 超出 集装箱重量!", icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
// return;
//}
//if (dCBM2 > dCBM) {
// Ext.Msg.show({ title: '错误', msg: "多品名中 立方数总 超出 集装箱立方数!", icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
// return;
//}
//
Ext.Msg.wait(Zi.LAN.ZhengZaiCaoZuoShuJu);
Ext.Ajax.request({
waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu,
url: '/MvcShipping/MsOpSeae/SaveOpCtnDetail',
scope: this,
params: {
body: jsonBody,
pkgs: iPKGS,
kgs: dKGS,
cbm: dCBM
},
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.storeBodyList.load({ params: { condition: "CTN_ID='" + sCTN_ID + "'" }, scope: this });
} else {
Ext.Msg.show({ title: Zi.LAN.ChuoWu, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: Zi.LAN.ChuoWu, msg: Zi.LAN.FuWuQiXiangYingChuCuo, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
});
}, //end save
//#endregion
//#region 添加明细
onAddDetailClick: function (button, event) {
var descrip = this.editRecord.get('DESCRIPTION');
var sMARKS = this.editRecord.get('MARKS');
if (sMARKS.toString().trim() == "N/M") {
sMARKS = "";
}
var iPKGS2 = 0;
var dKGS2 = 0;
var dCBM2 = 0;
for (var i = 0; i < this.storeBodyList.getCount(); i += 1) {
iPKGS2 += this.storeBodyList.getAt(i).get("PKGS");
dKGS2 = Add(dKGS2, this.storeBodyList.getAt(i).get("KGS"), 4);
dCBM2 = Add(dCBM2, this.storeBodyList.getAt(i).get("CBM"), 4);
}
var selections = this.gridListMain.getSelectionModel().getSelection();
if (selections.length > 0) {
var sCTN_ID = selections[0].data.CTN_ID;
var iPKGS = selections[0].data.PKGS;
var sKINDPKGS = selections[0].data.KINDPKGS;
var dKGS = selections[0].data.KGS;
var dCBM = selections[0].data.CBM;
iPKGS = iPKGS - iPKGS2;
dKGS = Add(dKGS, -dKGS2, 4);
dCBM = Add(dCBM, -dCBM2, 4);
var record = Ext.create('MsOpCtnDetail', {
GID: '*',
CTN_ID: sCTN_ID,
PKGS: iPKGS,
KINDPKGS: sKINDPKGS,
KGS: dKGS,
CBM: dCBM,
HSCODE: '',
DESCRIPTION: descrip,
MARKS: sMARKS
});
this.storeBodyList.add(record);
var n = this.storeBodyList.getCount();
this.gridListCellEditing.startEditByPosition({ row: n - 1, column: 2 });
}
else {
Ext.Msg.show({ title: Zi.LAN.JingGao, msg: Zi.LAN.QINGXUANZEJIZHUANGXIANG, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
},
onImportCtnDetailClick: function (button, event) {
var selections = this.gridListMain.getSelectionModel().getSelection();
if (selections.length > 0) {
var sCTN_ID = selections[0].data.CTN_ID;
}
else {
Ext.Msg.show({ title: Zi.LAN.JingGao, msg: Zi.LAN.QINGXUANZEJIZHUANGXIANG, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
var condition = " CTN_ID='" + sCTN_ID + "'";
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: Zi.LAN.LoadExcel,
fieldLabel: 'EXCEL',
buttonText: Zi.LAN.LoadExcel2,
allowBlank: false,
width: 200,
buttonCfg:
{
iconCls: 'uploaddialog'
},
anchor: '98%'
}],
buttons: [{
text: Zi.LAN.submit,
type: 'submit',
handler: function () {
var UserFilePath = Ext.getCmp('LoadExcel').getValue();
if (!CheckFileExt(UserFilePath, /.xls|.xlsx/i)) {
Ext.Msg.show({ title: Zi.LAN.ChuoWu, msg: Zi.LAN.QingQueRenNiShangChuanDeWenJianWeiEXCELWenJian, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (!imgform.form.isValid()) { return; }
imgform.form.submit({
url: '/MvcShipping/MsOpSeae/ImportCtnDetail',
waitMsg: '正在上传',
method: 'POST',
params: {
CTN_ID: sCTN_ID
},
success: function (form, action) {
win.close(this);
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.ShangChuanChengGong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
me.storeBodyList.load({ params: { condition: condition} });
},
failure: function (form, action) {
form.reset();
if (action.failureType == Ext.form.Action.SERVER_INVALID)
Ext.MessageBox.alert(Zi.LAN.JingGao, action.result.errors.msg);
}
});
}
}, {
text: Zi.LAN.GuanBi,
type: 'submit',
handler: function () {
win.close(this);
}
}]
});
var win = new Ext.Window({
title: Zi.LAN.ShangChuanEXCEL ,
width: 380,
height: 120,
modal: true,
resizable: false,
border: false,
items: imgform
});
win.show();
return;
},
//#endregion
//#region 删除明细
onDelDetailClick: function (button, event) {
var selections = this.gridListMain.getSelectionModel().getSelection();
var sCTN_ID = selections[0].data.CTN_ID;
var selectedRecords = this.gridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.GID == "" || rec.data.GID == "*")//如果是新增但没有保存的数据,没有必要提交到后台
{
this.storeBodyList.remove(selectedRecords[i]);
}
else {
Ext.MessageBox.confirm(Zi.LAN.TiShi, Zi.LAN.QueDingShanChuGaiJiLuMa, function (btn) {
if (btn == 'yes') {
Ext.Msg.wait(Zi.LAN.ZhengZaiCaoZuoShuJu);
Ext.Ajax.request({
waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu,
url: '/MvcShipping/MsOpSeae/DeleteOpCtnDetail',
params: {
data: Ext.JSON.encode(rec.data)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
//this.storeBodyList.remove(rec);
this.storeBodyList.load({ params: { condition: "CTN_ID='" + sCTN_ID + "'" }, scope: this });
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: Zi.LAN.ChuoWu, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: Zi.LAN.JingGao, msg: Zi.LAN.FuWuQiXiangYingChuCuo, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
scope: this
});
}
}, this);
}
}
},
//#endregion
//#region 打印
Print: function () {
var billNo = this.editRecord.data.BSNO.toString();
var selectedRecords = this.gridListMain.getSelectionModel().getSelection();
var feeGidSql = '';
for (var i = 0; i < selectedRecords.length; i++) {
var record = selectedRecords[i];
var feeGId = "'" + record.get('CTN_ID') + "'";
if (feeGidSql == '') {
feeGidSql = feeGId;
} else {
feeGidSql = feeGidSql + "," + feeGId;
}
};
if (feeGidSql == '') feeGidSql = 'aaaaa'
var printType = 'MSOPSEAECTNDETAIL';
var sql1 = "SET LANGUAGE 'us_english' SELECT d.CTN_ID,d.PKGS,d.KINDPKGS,d.KGS,d.CBM,d.HSCODE,d.DESCRIPTION,d.MARKS,c.CNTRNO,c.SEALNO,b.MBLNO,c.BSNO FROM op_ctn_detail d left join op_ctn c on (c.CTN_ID=d.CTN_ID) left join op_seae b on (b.BSNO=c.BSNO) WHERE c.BSNO = '" + billNo + "' order by d.CTN_ID,d.ID ";
var sql2 = "SET LANGUAGE 'us_english' SELECT d.CTN_ID,d.PKGS,d.KINDPKGS,d.KGS,d.CBM,d.HSCODE,d.DESCRIPTION,d.MARKS,c.CNTRNO,c.SEALNO,b.MBLNO,c.BSNO FROM op_ctn_detail d left join op_ctn c on (c.CTN_ID=d.CTN_ID) left join op_seae b on (b.BSNO=c.BSNO) WHERE c.BSNO = '" + billNo + "' AND c.CTN_ID IN (" + feeGidSql + ") order by d.CTN_ID,d.ID ";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6, '');
},
//#endregion
//#region 判断一行字符数是否超标
SetShipperLable: function (fieldname, len) {
var basicForm = this.formEdit.getForm();
var field = basicForm.findField(fieldname);
var SHIPPERSTR = Ext.getCmp(fieldname + 'STR');
var str = Billstrnum(field.getValue(), len);
SHIPPERSTR.setText(str, false);
}
//#endregion
});