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/SoftMng/Viewsjs/SingleAudit/SingleIndex.js

734 lines
25 KiB
JavaScript

2 years ago
Ext.namespace('Shipping');
Shipping.SingleIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.SingleIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.SingleIndex, Ext.Panel, {
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
EditRecord: null, //用于从主界面获取
BsNo: '',
OPLBNAME: "",
initUIComponents: function () {
var mainform = window.parent._this; // Ext.getCmp('OpSeaiEdit');
this.formname = 'SingleList';
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
model: 'SingleListModel',
pageSize: this.PageSize,
// autoLoad: { start: 0, limit: 30 },
remoteSort: true,
proxy: {
type: 'ajax',
url: '/SoftMng/Export/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//定义Grid
this.SingleCB = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true });
this.columns = [{
sortable: true,
dataIndex: 'GID',
header: 'GID',
hidden: true,
width: 120
},{
sortable: false,
dataIndex: 'CustomMaster',
header: '申报地海关',
hidden:true,
width: 80
}, {
sortable: true,
dataIndex: 'SeqNo',
header: '统一编号',
width: 120
}, {
sortable: true,
dataIndex: 'ManualNo',
header: '备案号',
width: 120
}, {
sortable: true,
dataIndex: 'ContrNo',
header: '合同协议号',
width: 120
},{
sortable: true,
dataIndex: 'CUSTNO',
header: '委托编号',
width: 120
},{
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '委托单位',
width: 120
},{
sortable: true,
dataIndex: 'CUSTOMNO',
header: '报关单号',
width: 120
}, {
sortable: true,
dataIndex: 'BillNo',
header: '提单号',
width: 120
},{
sortable: true,
dataIndex: 'VESSEL',
header: '船名',
width: 120
},{
sortable: true,
dataIndex: 'VOYNO',
header: '航次',
width: 120
},{
sortable: true,
dataIndex: 'ETD',
header: '开船日期',
width: 120
}, {
sortable: true,
dataIndex: 'ETA',
header: '到港日期',
width: 120
},{
sortable: true,
dataIndex: 'IEPort',
header: '出境关别',
width: 120
},{
sortable: true,
dataIndex: 'DDate',
header: '申报日期',
width: 120
},{
sortable: true,
dataIndex: 'IEDATE',
header: '出口日期',
width: 120
},{
sortable: true,
dataIndex: 'TradeName',
header: '企业名称',
width: 120
},{
sortable: true,
dataIndex: 'OwnerCodeScc',
header: '生产销售单位',
width: 120
},{
sortable: true,
dataIndex: 'AgentName',
header: '申报单位',
width: 120
},{
sortable: true,
dataIndex: 'TradeCoScc',
header: '境内发货人',
width: 120
},{
sortable: true,
dataIndex: 'OverseasConsigneeCode',
header: '境外发货人',
width: 120
}, {
sortable: true,
dataIndex: 'COMPOP',
header: '提交人',
width: 120
}, {
sortable: true,
dataIndex: 'COMPTIME',
header: '提交时间',
width: 120
}];
this.girdcolums = this.columns;
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1, true);
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
selModel: this.SingleCB,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
columns: this.girdcolums,
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
DsOpenEditWin('/SoftMng/Export/Single?gid=' + record.data.GID+'&tabIndex=0&audit=1');
//DsOpenEditWin('/SoftMng/Export/Index?bsno=' + record.data.BSNO);
}, this);
//#region formSearch
this.storeBsType = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeBsType.load({ params: { enumTypeId: 96004 } });
this.comboxTransType = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '运输类型',
store: this.storeBsType,
forceSelection: true,
name: 'TRANSTYPE',
valueField: 'EnumValueId',
displayField: 'EnumValueName',
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/GetCustomRefList' }
});
this.storeCustCode.load();
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '委托单位',
store: this.storeCustCode,
forceSelection: true,
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeBillState = Ext.create('Ext.data.Store', {
fields: ['FSTATUS', 'NAME']
});
this.storeBillState.add({ "FSTATUS": "N", "NAME": "新建" });
this.storeBillState.add({ "FSTATUS": "S", "NAME": "审核" });
this.storeBillState.add({ "FSTATUS": "P", "NAME": "复核" });
this.storeBillState.add({ "FSTATUS": "L", "NAME": "已上传" });
this.storeBillState.add({ "FSTATUS": "R", "NAME": "驳回提交" });
this.comboxBillState = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '报关单状态',
store: this.storeBillState,
valueField: 'FSTATUS',
displayField: 'NAME',
forceSelection: true,
name: 'BillState',
value: 'S',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
flex: 1,
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxBillState,this.comboxCustCode,
this.comboxTransType,
{
fieldLabel: '录入日期(从)',
name: 'DateFrom',
format: 'Y-m-d',
labelWidth: 90,
xtype: 'datefield',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},
{
fieldLabel: '录入日期(到)',
labelWidth: 90,
name: 'DateTo',
format: 'Y-m-d',
xtype: 'datefield',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}]
}]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//#endregion formSearch
//查询工具条
_this = this;
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
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: "btnAudit",
// handler: function (button, event) {
// this.onAudit(button, event);
// },
// scope: this
//}, '-', {
// text: "驳回",
// iconCls: "btnReject",
// handler: function (button, event) {
// this.onReject(button, event);
// },
// scope: this
//},
'-', {
text: "保存列表样式",
menu: [{
text: "保存",
handler: function (button, event) {
alert(GID);
_this.girdcolums = DsTruck.SaveGridPanel(GID, _this.formname, _this.gridList.columns, _this.girdcolums, 0, true); //使用者id表名中间column数组跳过一开始的几列
}
}, {
text: "初始化",
handler: function (menu, event) {
_this.formWMSINBody.reconfigure(_this.storeList, _this.columns);
_this.girdcolums = DsTruck.SaveGridPanel(GID, _this.formname, _this.gridList.columns, _this.columns, 0, true); //使用者id表名中间column数组跳过一开始的几列
}
}],
scope: this
}, {
text: "打印", //"打印",
iconCls: 'btnprint',
menu: [
{
text: "全部", //"全部",
handler: function (menu, event) {
_this.onPrintClick();
}
}, {
text: "选择打印", //"选择打印",
handler: function (menu, event) {
_this.PrintSelect();
}
}],
scope: this
}
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 100,
items: [this.formSearch, this.panelBtn]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList]
});
this.onRefreshClick();
}, //end initUIComponents
//#region 加载事件
InitData: function () {
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: this.sqlcontext },
waitMsg: "正在查询数据...",
scope: this
});
this.storeList.on('beforeload', function (store) {
Ext.apply(store.proxy.extraParams, { condition: this.sqlcontext });
}, this);
//#endregion
}, //end InitData
//#endregion
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.sqlcontext = sql;
this.storeList.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 = '';
var BillState = form.findField('BillState').getValue();
sql = sql + getAndConSql(sql, BillState, " d.BillState='" + BillState + "'");
var TRANSTYPE = form.findField('TRANSTYPE').getValue();
if (TRANSTYPE != '' && TRANSTYPE != null) {
sql = sql + getAndConSql(sql, TRANSTYPE, " o.BSTYPE = '" + TRANSTYPE + "'");
}
var CUSTOMERNAME = form.findField('CUSTOMERNAME').getValue();
if (CUSTOMERNAME != '' && CUSTOMERNAME != null) {
sql = sql + getAndConSql(sql, CUSTOMERNAME, " o.CUSTOMERNAME like '%" + CUSTOMERNAME + "%'");
}
var DATEFROM = form.findField('DateFrom').getRawValue();
sql = sql + getAndConSql(sql, DATEFROM, " d.PDate >= '" + DATEFROM + "'");
var DATETO = form.findField('DateTo').getRawValue();
sql = sql + getAndConSql(sql, DATETO, " d.PDate >= '" + DATETO + "'");
return sql;
},
onAudit: 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 selectedRecords = [];
selectedRecords = this.gridList.selModel.getSelection();
Ext.MessageBox.confirm('提示', '确定审核记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在审核数据...');
for (var i = 0; i < selectedRecords.length; i++) {
Ext.Ajax.request({
waitMsg: '正在审核数据...',
url: '/SoftMng/Export/Audit',
params: {
billGID: selectedRecords[i].data.GID,
billState: 'P'
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.onRefreshClick();
Ext.Msg.show({ title: '提示', msg: selectedRecords[i].CUSTNO+'审核成功', 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);
},
onReject: 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 selectedRecords = [];
selectedRecords = this.gridList.selModel.getSelection();
Ext.MessageBox.confirm('提示', '确定驳回记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在驳回数据...');
for (var i = 0; i < selectedRecords.length; i++) {
Ext.Ajax.request({
waitMsg: '正在驳回数据...',
url: '/SoftMng/Export/Audit',
params: {
billGID: selectedRecords[i].data.GID,
billState: 'R'
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.onRefreshClick();
Ext.Msg.show({ title: '提示', msg: selectedRecords[i].CUSTNO + '审核成功', 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);
},
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
//this.InitData();
},
onAudit: 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;
}
if (selections.length == 1) {
if (selections[0].data.BSSTATUS != '已备货') {
Ext.Msg.show({ title: '提示', msg: '系统只接收已备货的备货单!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
}
var selectedRecords = [];
selectedRecords = this.gridList.selModel.getSelection();
var selectStores = [];
for (var i = 0; i < selectedRecords.length; i++) {
selectStores.push(selectedRecords[i].data);
}
Ext.MessageBox.confirm('提示', '确定审核该单据吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在审核数据...');
Ext.Ajax.request({
waitMsg: '正在审核数据...',
url: '/SoftMng/Export/Audit',
params: {
data: Ext.JSON.encode(selectStores),
USERID: USERID
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
//this.storeList.remove(selections);
this.onRefreshClick();
Ext.Msg.show({ title: '提示', msg: '数据审核成功', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
//DsOpenEditWin('/MvcShipping/WMSOUT_GuiGe/Edit', "明细出库");
}
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);
},
OprationSwap: function () {
var ret = new Array();
ret[0] = 'edit';
ret[1] = this.SelectedRecord;
ret[2] = Ext.getCmp('btnRefresh');
ret[3] = 'StockOutDetail';;//整体出库 StockOut,明细出库 StockOutDetail
ret[4] = '0';//是否货权转移 10
ret[5] = true;
return ret;
},
onPrintClick: function (button, event) {
// var printType = 'WmsInfoReport_opseai'; //海运进口 入库明细
var printType = 'WmsInfoReportNewList';
var uid = USERID;
var sql1 = "select * from wms ";
var wherestr = this.getCondition();
if (wherestr != '') {
sql1 += "where 1=1 and " + wherestr;
}
PrintComm(printType, sql1);
},
PrintSelect: function () {
_this = this;
if (this.storeList.getCount() == 0) {
return;
}
var selectedRecords = [];
var storeadd = null;
selectedRecords = this.SingleCB.selected.items;
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要打印的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
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 mblno = '';
var printType = 'WmsInfoReportNewListSelect';
var sql1 = "select * from wms WHERE GID IN (" + feeGidSql + ") order by WMSDATE DESC";
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6, "");
}
});