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.

1240 lines
42 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.

Ext.namespace('Shipping');
Shipping.MsOpCtnApplySaleIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpCtnApplySaleIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpCtnApplySaleIndex, Ext.Panel, {
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '',
PageSize: 100,
sortfield: '',
sortdire: '',
initUIComponents: function () {
this.formname = "MsOpCtnApplySaleIndex"; //页面名称
Ext.define('MsCodeOpStatusDetail', {
extend: 'Ext.data.Model',
idProperty: 'GID',
fields: [
{ name: 'GID', type: 'string' },
{ name: 'SerialNo', type: 'number' },
{ name: 'OPSTATUS', type: 'string' },
{ name: 'REMARKS', type: 'string' },
{ name: 'COLOR', type: 'string' },
{ name: 'OPTYPE', type: 'string' },
{ name: 'OPTYPESTR', type: 'string' },
{ name: 'STTYPE', type: 'string' },
{ name: 'STTYPESTR', type: 'string' }
]
});
this.initgirdcolums = [{
sortable: true,
id: '',
dataIndex: '',
header: '',
width: 0
}, {
sortable: true,
dataIndex: 'GID',
header: 'GID',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'COMPANYID',
header: 'COMPANYID',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'PRICETYPE',
header: 'PRICETYPE',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'BSNO',
header: '申请单号',
width: 100,
renderer: function (value, meta, record) {
if (record.data.BSSTATUS == '成本审核驳回') {
meta.tdCls = 'check_red';
}
return value;
}
}, {
sortable: true,
dataIndex: 'BSDATE',
header: '申请日期',
width: 100
}, {
sortable: true,
dataIndex: 'OPSTATUS',
header: '自定义状态标识',
renderer: function (value, metadata, record, rowIndex) {
metadata.style = "background-color:" + record.data.OPSTATUSCOLOR;
return value;
},
width: 100
}, {
sortable: true,
dataIndex: 'BSSTATUS',
header: '申请状态',
width: 100
}, {
sortable: true,
dataIndex: 'PLANCTNDATE',
header: '计划用箱日期',
width: 100,
renderer: function (value, meta, record) {
if (value != '' && record.data.ADDCTNNUM==0) {
var ENDATE = new Date(value);
var myDate = new Date();
var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d');
mydatestr = getNewDay(mydatestr, 5);
mydatestr = new Date(mydatestr);
if (mydatestr.getTime() >= ENDATE.getTime()) {
meta.tdCls = 'feestatus_nopass';
}
}
return value;
}
}, {
sortable: true,
dataIndex: 'SALE',
header: '揽货人',
width: 100
}, {
sortable: true,
dataIndex: 'OP',
header: '操作员',
width: 100
}, {
sortable: true,
dataIndex: 'GOODSNAME',
header: '品名',
width: 100
}, {
sortable: true,
dataIndex: 'GOODSNAMEREF',
header: '货物名称(含英文简称)',
width: 100
}, {
sortable: true,
dataIndex: 'GOODSTYPE',
header: '产品系列',
width: 100
}, {
sortable: true,
dataIndex: 'GOODTYPE',
header: '产品类别',
width: 100
}, {
sortable: true,
dataIndex: 'PORTLOAD',
header: '起运港',
width: 100
}, {
sortable: true,
dataIndex: 'PORTDISCHARGE',
header: '目的港',
width: 100
}, {
sortable: true,
dataIndex: 'CTNALL',
header: '箱型',
width: 100
}, {
sortable: true,
dataIndex: 'CTNNUM',
header: '箱量',
width: 100
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '客户名称',
width: 100
}, {
sortable: true,
dataIndex: 'FACTORYNAME',
header: '工厂名称',
width: 100
}, {
sortable: true,
dataIndex: 'PREGOODSNAME',
header: '前装品名',
width: 100
}, {
sortable: true,
dataIndex: 'CURGOODSNAME',
header: '后装品名',
width: 100
}, {
sortable: true,
dataIndex: 'AUDITSTATUS',
header: '适货审核状态',
width: 100
}, {
sortable: true,
dataIndex: 'AUDITBYREF',
header: '适货审核人',
width: 100
}, {
sortable: true,
dataIndex: 'AUDITTIME',
header: '适货审核时间',
width: 100
}, {
sortable: true,
dataIndex: 'AUDITRESULT',
header: '适货审核结果',
width: 100
}, {
sortable: true,
dataIndex: 'AGENTINPUTBY',
header: '代理维护人',
width: 100
}, {
sortable: true,
dataIndex: 'CYCLEDAYS',
header: '周期',
width: 100
}, {
sortable: true,
dataIndex: 'COSTAUDITSTATUS',
header: '成本审核状态',
width: 100
}, {
sortable: true,
dataIndex: 'COSTAUDITBYREF',
header: '成本审核人',
width: 100
}, {
sortable: true,
dataIndex: 'COSTAUDITTIME',
header: '成本审核时间',
width: 100
}, {
sortable: true,
dataIndex: 'COSTAUDITRESULT',
header: '成本审核结果',
width: 100
}, {
sortable: true,
dataIndex: 'MNGAUDITSTATUS',
header: '总经理审核状态',
width: 100
}, {
sortable: true,
dataIndex: 'MNGAUDITRESULT',
header: '总经理审核反馈',
width: 100
}, {
sortable: true,
dataIndex: 'CHANGERATE',
header: '超期箱使费佣金比例',
width: 100
}, {
sortable: true,
dataIndex: 'FULL_CTN_FREE_STORAGE_DAY',
header: '重箱免堆天数',
width: 100
}, {
sortable: true,
dataIndex: 'CTN_PRICE',
header: '罐箱价格',
width: 100
}, {
sortable: true,
dataIndex: 'CURRENCY',
header: '币别',
width: 50
}, {
sortable: true,
dataIndex: 'REMARKS',
header: '备注',
width: 200
}, {
sortable: true,
dataIndex: 'INPUTBYREF',
header: '录入人',
width: 100
}, {
sortable: true,
dataIndex: 'INPUTTIME',
header: '录入时间',
width: 100
}, {
sortable: true,
dataIndex: 'DESTPORT_STATOIN',
header: '目的港还箱堆场',
width: 100
}, {
sortable: true,
dataIndex: 'SERVICE',
header: '运输条款',
width: 100
}, {
sortable: true,
dataIndex: 'NEEDBEHEATED',
header: '是否加热',
renderer: function (value, meta) {
if (isFalse(value)) {
return "";
} else {
meta.tdCls = 'feestatus_pass';
return "是";
}
},
width: 100
}, {
sortable: true,
dataIndex: 'EMPTYCTNALLOCATION',
header: '空箱调拨',
renderer: function (value, meta) {
if (isFalse(value)) {
return "";
} else {
meta.tdCls = 'feestatus_pass';
return "是";
}
},
width: 100
}, {
sortable: true,
align: 'right',
dataIndex: 'WEIGHT',
header: '重量(KGS)',
width: 100,
renderer: function (value) {
return Ext.util.Format.number(value, '0.000');
}
}, {
sortable: true,
dataIndex: 'PREI_ETD',
header: '预计开船日期',
width: 100
}
];
this.girdcolums = this.initgirdcolums;
_this = this;
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsOpCtnApply',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsOpCtnApply/GetDataList',
reader: {
root: 'data',
totalProperty: 'totalCount'
}
}
});
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 30
});
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
_this = this;
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.GridCheckBoxModel,
columns: this.girdcolums,
viewConfig: {
enableTextSelection: true
},
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id表名中间column数组跳过一开始的几列
this.girdcolums.unshift(new Ext.grid.RowNumberer());
// this.InitGrid(this.girdcolums, '');
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OpenEditWin(record);
}, this);
this.gridList.addListener('sortchange', function (ct, column, direction, eOpts) {
this.sortfield = column.dataIndex;
this.sortdire = direction;
}, this);
//#region formSearch 查询面板
this.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeDisportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' }
});
this.storeCodeDisport.load();
this.comboxPORTDISCHARGE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '目的港',
store: this.storeCodeDisport,
name: 'PORTDISCHARGE',
valueField: 'PORT',
queryMode: 'local',
displayField: 'PORT',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.comboxPORTLOAD = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '起运港',
store: this.storeCodeDisport,
name: 'PORTLOAD',
valueField: 'PORT',
queryMode: 'local',
displayField: 'PORT',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//客户加载_委托单位
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListController' }
});
//this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} });
//委托单位
_this = this;
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '委托单位',
store: this.storeCustCode,
forceSelection: true,
queryMode: 'remote',
minChars: 1,
queryParam: 'CODENAME',
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeOpStatus2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCodeOpStatusDetail',
proxy: { url: '/MvcShipping/MsCodeOpStatus/GetBodyList' }
});
this.storeOpStatus2.load({ params: { condition: "OPTYPE='用箱申请'" } });
this.comboxOPSTATUS2 = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeOpStatus2,
forceSelection: true,
fieldLabel: '自定义标识',
name: 'OPSTATUS',
valueField: 'OPSTATUS',
displayField: 'OPSTATUS'
});
_this = this;
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '编号',
name: 'MblNo',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxCustCode, this.comboxOPSTATUS2,{
fieldLabel: '录入日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETDbgn',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETDend',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
xtype: 'button',
width: 90,
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}, {
xtype: 'button',
width: 90,
text: "高级查询",
iconCls: "btnmore",
handler: function (button, event) {
var sql = this.getCondition();
var winAccess = new Shipping.DsQuery({
});
winAccess.StoreList = this.storeList;
winAccess.formname = this.formname;
winAccess.condition = sql;
winAccess.show();
return;
},
scope: this
}]
}
]//end items(fieldset 1)
}]//end root items
});
//#endregion formSearch
//查询工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: "新建",
iconCls: "btnadd",
id:'Opctnapplyadd',
handler: function (button, event) {
this.OprationStatus = 'add';
var openSet = "height=650, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 500) / 2 + ",Left= " + (screen.width - 600) / 2
var openType = "";
var openUrl = "/MvcContainer/MsOpCtnApply/SalesEdit";
if (PRICETYPE == "2")
openUrl = "/MvcContainer/MsOpCtnApply/SalesEdit";
window.open(openUrl, openType, openSet);
// DsOpenEditWin('/MvcContainer/MsOpPrice/SeaeEdit');
},
scope: this
}, '-',
{
text: "删除",
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
},
'-',
{
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
},
{
text: "重置条件",
iconCls: "btnreset",
handler: function (button, event) {
this.onClearSql(button, event);
},
scope: this
}, '-',
{
text: "打印",
iconCls: 'btnprint',
menu: [
{ text: "全部",
handler: function (menu, event) {
_this.Print();
}
}, { text: "选择打印",
handler: function (menu, event) {
_this.PrintSelect();
}
}],
scope: this
}, {
text: "导出Excel",
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(button, event);
},
scope: this
}, '-',
{
text: "打开",
iconCls: "btnright", id: "OPEN",
handler: function (button, event) {
this.onOpenClick(button, event);
},
scope: this
}, '-',
{
text: "自定义状态标识",
iconCls: "btnright",
handler: function (button, event) {
this.winOPSTATUSShow.show();
},
scope: this
}, '-',
{
text: "取消自定义状态标识",
iconCls: "btnright",
handler: function (button, event) {
this.onUpdateCancelOpStatuslick();
},
scope: this
}
, '-', {
text: "保存列表样式",
menu: [
{ text: "保存",
handler: function (button, event) {
this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.girdcolums, 1, true);
}
}, { text: "初始化",
handler: function (menu, event) {
_this.InitGrid(_this.initgirdcolums);
_this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.initgirdcolums, 1, true);
}
}],
scope: this
}
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 75,
items: [this.formSearch, this.panelBtn]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList]
});
this.storeList.on('beforeload', function (store) {
Ext.apply(store.proxy.extraParams, { condition: _this.sqlcontext, pricetype: PRICETYPE });
}, this);
this.sqlcontext = '';
this.gridList.reconfigure(this.storeList, this.girdcolums);
this.onRefreshClick();
this.onRefreshClick();
this.storeOpStatus = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCodeOpStatusDetail',
proxy: { url: '/MvcShipping/MsCodeOpStatus/GetBodyList' }
});
this.storeOpStatus.load({ params: { condition: "OPTYPE='用箱申请'" } });
this.comboxOPSTATUS = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeOpStatus,
forceSelection: true,
fieldLabel: '自定义状态',
name: 'OPSTATUS',
valueField: 'OPSTATUS',
displayField: 'OPSTATUS'
});
this.formOPSTATUSShow = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 85,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [this.comboxOPSTATUS
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
this.winOPSTATUSShow = Ext.create('Ext.window.Window', {
title: "自定义状态",
width: 280,
//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.formOPSTATUSShow],
buttons: [{
text: "确认更新",
minWidth: 70,
handler: function () {
var OPSTATUS = _this.formOPSTATUSShow.getForm().findField('OPSTATUS').getValue();
_this.onUpdateOpStatuslick(OPSTATUS)
}
}, {
text: "关闭",
minWidth: 70,
handler: function () {
_this.winOPSTATUSShow.close();
}
}]
});
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable',
params: {
modulename: "modOpCtnApplyNoAdd"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
} else {
var btnFeeLock = Ext.getCmp('Opctnapplyadd');
btnFeeLock.setVisible(false);
}
} else {
}
},
scope: this
});
// this.InitGrid(this.girdcolums,this.sqlcontext);
}, //end initUIComponents
onUpdateOpStatuslick: function (OPSTATUS) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要更新的信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var bodyAddDatas = [];
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
bodyAddDatas.push(rec);
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Ajax.request({
waitMsg: '正在操作数据...',
url: '/MvcContainer/MsOpCtnApply/UpdateOpStatus',
params: {
data: jsonbodyAddDatas,
opstatus: OPSTATUS
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
} else {
Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
_this.storeList.reload();
_this.winOPSTATUSShow.close();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onUpdateCancelOpStatuslick: function () {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要更新的信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var bodyAddDatas = [];
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
bodyAddDatas.push(rec);
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Ajax.request({
waitMsg: '正在操作数据...',
url: '/MvcContainer/MsOpCtnApply/UpdateOpStatus',
params: {
data: jsonbodyAddDatas,
opstatus: ''
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
} else {
Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
_this.storeList.reload();
_this.winOPSTATUSShow.close();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.sqlcontext = sql;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: _this.sqlcontext, pricetype: PRICETYPE },
waitMsg: "正在查询数据...",
scope: this
});
},
onDsQuery: function () {
var sql = this.sqlcontext;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql, pricetype: PRICETYPE },
waitMsg: "正在查询数据...",
scope: this
});
},
onDeleteClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
if (record.data.BSSTATUS != '' && record.data.BSSTATUS != '未提交' && record.data.BSSTATUS != '适货审核驳回') {
Ext.Msg.show({ title:'', msg: '当前状态不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); //'警告', '业务已锁定,不允许删除!'
return;
}
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/MsOpCtnApply/Delete',
params: {
data: jsonbodyAddDatas
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.onDsQuery();
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);
}, //onDeleteClick
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
}, //onDeleteClick
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = "";
// var PORTLOAD = form.findField('PORTLOAD').getValue();
// sql = sql + getAndConSql(sql, PORTLOAD, " b.PORTLOAD like '%" + PORTLOAD + "%' ");
// var PORTDISCHARGE = form.findField('PORTDISCHARGE').getValue();
// sql = sql + getAndConSql(sql, PORTDISCHARGE, " b.PORTDISCHARGE like '%" + PORTDISCHARGE + "%' ");
// var LANE = form.findField('LANE').getValue();
// sql = sql + getAndConSql(sql, LANE, " b.LINE='" + LANE + "'");
var MblNo = form.findField('MblNo').getValue();
sql = sql + getAndConSql(sql, MblNo, "b.BsNo like '%" + MblNo + "%' ");
var CUSTOMERNAME = form.findField('CUSTOMERNAME').getValue();
sql = sql + getAndConSql(sql, CUSTOMERNAME, "b.CUSTOMERNAME='" + CUSTOMERNAME + "'");
var OPSTATUS = form.findField('OPSTATUS').getValue();
sql = sql + getAndConSql(sql, OPSTATUS, "b.OPSTATUS='" + OPSTATUS + "'");
var expDateBgn = form.findField('ETDbgn').getRawValue();
sql = sql + getAndConSql(sql, expDateBgn, "b.INPUTTIME >='" + expDateBgn + "'");
var expDateEnd = form.findField('ETDend').getRawValue();
sql = sql + getAndConSql(sql, expDateEnd, "b.INPUTTIME <='" + expDateEnd + " 23:59:59'");
return sql;
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
},
Print: function () {
_this = this;
if (this.storeList.getCount() == 0) {
return;
}
var bsno = '11111';
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length != 0) {
var record = selections[0];
bsno = record.data.GID;
}
var sortstr = '';
if (this.sortfield != '' && this.sortdire != '') {
sortstr = this.sortfield + ' ' + this.sortdire;
}
Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据...',
url: '/MvcContainer/MsOpCtnApply/GetDataListStr',
scope: this,
params: {
condition: _this.sqlcontext,
printstr: 'true',
pricetype: PRICETYPE,
sort: sortstr
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnstr = jsonresult.data;
var printType = 'MSOPCTNAPPLY';
var sql1 = returnstr;
var sql2 = "select * from op_ctnapply where GID='" + bsno + "'";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
} 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
});
}
}
});
},
PrintSelect: function () {
_this = this;
if (this.storeList.getCount() == 0) {
return;
}
var selectedRecords = [];
var storeadd = null;
selectedRecords = this.GridCheckBoxModel.selected.items;
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要打印的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var sortstr = 'INPUTTIME DESC ';
if (this.sortfield != '' && this.sortdire != '') {
sortstr = this.sortfield + ' ' + this.sortdire;
}
var feeGidSql = '';
for (var i = 0; i < selectedRecords.length; i++) {
var record = selectedRecords[i];
var feeGId = "'" + record.get('GID') + "'";
if (feeGidSql == '') {
feeGidSql = feeGId;
} else {
feeGidSql = feeGidSql + "," + feeGId;
}
};
var bsno = '11111';
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length != 0) {
var record = selections[0];
bsno = record.data.GID;
}
var printType = 'MSCODECTNTKSELECT';
var sql1 = "select * from op_ctnapply WHERE GID IN (" + feeGidSql + ") order by " + sortstr;
var sql2 = "select * from op_ctnapply where GID='" + bsno + "'";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
,
onExportClick: function () {
_this = this;
if (this.storeList.getCount() == 0) {
return;
}
var bsno = '11111';
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length != 0) {
var record = selections[0];
bsno = record.data.GID;
}
var sortstr = '';
if (this.sortfield != '' && this.sortdire != '') {
sortstr = this.sortfield + ' ' + this.sortdire;
}
Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据...',
url: '/MvcContainer/MsOpCtnApply/GetDataListStr',
scope: this,
params: {
condition: _this.sqlcontext,
printstr: 'true',
pricetype: PRICETYPE,
sort: sortstr
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnstr = jsonresult.data;
var printType = 'MSOPCTNAPPLY';
var sql1 = returnstr;
sql1 = sql1.replace(/\+/g, "@@@")
if (sql1 != '') {
GridExportBySql(sql1, this.formname, '申请放箱列表.xls');
}
} 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
});
}
}
});
},
onOpenClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
record = selections[0];
this.OpenEditWin(record);
}
, OpenEditWin: function (record) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
var openSet = "height=650, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 500) / 2 + ",Left= " + (screen.width - 600) / 2;
var openType = record.data.GID;
var openUrl = "/MvcContainer/MsOpCtnApply/SalesEdit";
if (PRICETYPE == "2")
openUrl = "/MvcContainer/MsOpCtnApply/SalesEdit";
window.open(openUrl, openType, openSet);
}
});