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.

826 lines
28 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.MsOpCtnTkFitingsAuditBsIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpCtnTkFitingsAuditBsIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpCtnTkFitingsAuditBsIndex, Ext.Panel, {
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '',
PageSize: 100,
sortfield: '',
sortdire: '',
initUIComponents: function () {
this.formname = "MsOpCtnTkFitingsAuditBsIndex" ; //页面名称
this.linkgid = "111";
this.initgirdcolums = [{
sortable: true,
dataIndex: 'GID',
header: 'GID',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'OPTYPE',
header: 'OPTYPE',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'BSSTATUS',
header: '状态',
width: 60
}, {
sortable: true,
dataIndex: 'OPDATE',
header: '报损日期',
width: 100
}, {
sortable: true,
dataIndex: 'BSSTATUS',
header: '状态',
width: 60
}, {
sortable: true,
dataIndex: 'YARD',
header: '报损场站',
width: 120
}, {
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 300
}, {
sortable: true,
dataIndex: 'CREATEUSERREF',
header: '创建人',
width: 100
}, {
sortable: true,
dataIndex: 'CREATEUSERREF',
header: '创建时间',
width: 100
}, {
sortable: true,
dataIndex: 'MODIFIEDUSERREF',
header: '修改人',
width: 100
}, {
sortable: true,
dataIndex: 'MODIFIEDTIME',
header: '修改时间',
width: 100
}
];
this.girdcolums = this.initgirdcolums;
_this = this;
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsOpCtnTkFitings',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsOpCtnTkFitings/GetAuditDataList',
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: {
autoFill: true,
enableTextSelection: true,
getRowClass: function (record, rowIndex, rowParams, store) {
}
},
// 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.InitGrid(this.girdcolums, '');
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
// DsOpenEditWin('/MvcContainer/MsOpPrice/SeaeEdit', record.data.GID);
var openSet = "height=700, width=1200, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 700) / 2 + ",Left= " + (screen.width - 1000) / 2
var openType = record.data.GID;
var openUrl = "/MvcContainer/MsOpCtnTkFitings/DbEdit";
window.open(openUrl, openType, openSet);
}, this);
this.gridList.addListener('sortchange', function (ct, column, direction, eOpts) {
this.sortfield = column.dataIndex;
this.sortdire = direction;
}, this);
this.gridList.columns[1] = new Ext.grid.RowNumberer();
//#region formSearch 查询面板
//客户加载_场站
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', {
fieldLabel: '出库场站',
store: this.storeYARD,
forceSelection: true,
name: 'YARD',
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.storeAddDCType = Ext.create('Ext.data.Store', {
fields: ['DC', 'NAME']
});
this.storeAddDCType.add({ "DC": "", "NAME": "全部" });
this.storeAddDCType.add({ "DC": "1", "NAME": "未审核" });
this.storeAddDCType.add({ "DC": "2", "NAME": "已审核" });
this.storeAddDCType.add({ "DC": "3", "NAME": "仅需自己审核" });
this.comboxaddDCType = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '审核状态',
store: this.storeAddDCType,
valueField: 'DC',
displayField: 'NAME',
forceSelection: true,
name: 'DC',
value: '3',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
_this = this;
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',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxaddDCType,this.comboxYARD, {
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: "btnAuditPass",
handler: function (button, event) {
this.onAuditBillPassClick();
},
scope: this
},
'-',
{
text: "驳回提交",
iconCls: "btndelete",
id: "btnAuditBack",
handler: function (button, event) {
this.onAuditBillBackClick();
},
scope: this
},
'-',
{
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
},
'-',
{
text: "刷新",
iconCls: "btnrefresh",
handler: function (button, event) {
this.storeList.reload();
},
scope: this
},
{
text: "重置条件",
iconCls: "btnreset",
handler: function (button, event) {
var form = this.formSearch.getForm();
form.reset();
},
scope: this
}, '-',
{
text: "打印",
iconCls: 'btnprint',
menu: [
{ text: "全部",
handler: function (menu, event) {
_this.Print();
}
}, { text: "选择打印",
handler: function (menu, event) {
_this.PrintSelect();
}
}],
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
}
]
});
//#region 费用信息
this.storeBodyList = Ext.create('Ext.data.Store', {
model: 'MsOpCtnTkFitingsDetail',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsOpCtnTkFitings/GetFitingsBodyList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.initgirdbillcolums = [{
sortable: true,
dataIndex: 'GID',
header: '编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'LINKGID',
header: '业务编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'FITINGNAME',
header: '配件名称',
width: 110
}, {
sortable: true,
dataIndex: 'MODEL',
header: '规格型号',
width: 140
}, {
sortable: true,
dataIndex: 'PKGS',
header: '数量',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 110
}, {
sortable: true,
dataIndex: 'REMARKS',
header: '备注',
width: 350
}];
this.girdbillcolums = this.initgirdbillcolums;
this.GridCheckBoxbillModel = Ext.create('Ext.selection.CheckboxModel');
this.gridListBody = new Ext.grid.GridPanel({
store: this.storeBodyList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.GridCheckBoxbillModel,
selType: 'cellmodel',
viewConfig: {
autoFill: true,
getRowClass: function (record, rowIndex, rowParams, store) {
//var feeStatus = record.get('FEESTATUS');
//return Shipping.FeeGetRowClass(feeStatus);
}
},
columns: this.girdbillcolums
});
this.gridListBody.on('edit', function (editor, e, eOpts) {
this.gridListAfterEdit(editor, e, eOpts);
}, this);
this.panelBody = new Ext.Panel({
title: '配件详细信息',
layout: "border",
region: 'south',
height: 320,
split: true,
animate: true,
// autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.gridListBody]
});
this.gridList.getSelectionModel().on('select', function (model, record, index) {
this.linkgid = record.data.GID;
var acondition = " LINKGID='" + this.linkgid + "'";
this.storeBodyList.load({ params: { condition: acondition } });
}, this);
//#endregion
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.panelBody]
});
this.storeList.on('beforeload', function (store) {
Ext.apply(store.proxy.extraParams, { condition: _this.sqlcontext});
}, this);
this.storeBodyList.on('beforeload', function (store) {
var acondition = " LINKGID='" + this.linkgid + "'";
Ext.apply(store.proxy.extraParams, { condition: acondition });
}, this);
this.sqlcontext = '';
this.gridList.reconfigure(this.storeList, this.girdcolums);
this.onRefreshClick();
// this.InitGrid(this.girdcolums,this.sqlcontext);
}, //end initUIComponents
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.sqlcontext = sql;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: _this.sqlcontext},
waitMsg: "正在查询数据...",
scope: this
});
},
onDsQuery: function () {
var sql = this.sqlcontext;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onAuditBillPassClick: 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];
var BILLSTATUS = rec.data.BSSTATUS;
if (BILLSTATUS == '提交报损') {
bodyAddDatas.push(rec);
} else {
Ext.Msg.show({ title: '提示', msg: '当前状态不允许审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
_this = this;
Ext.MessageBox.confirm('提示', '确定审核通过选中的业务吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在审核数据...');
Ext.Ajax.request({
waitMsg: '正在审核数据...',
url: '/MvcContainer/MsOpCtnTkFitings/AuditBillList',
params: {
bill: jsonbodyAddDatas
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
_this.storeBodyList.removeAll();
_this.storeList.reload();
Ext.Msg.show({ title: '提示', msg: '审核成功!', 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);
},
onAuditBillBackClick: 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];
var BILLSTATUS = rec.data.BSSTATUS;
if ((BILLSTATUS == '提交报损' || BILLSTATUS == '确认报损')) {
bodyAddDatas.push(rec);
} else {
Ext.Msg.show({ title: '提示', msg: '当前状态不允许驳回!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
_this = this;
Ext.MessageBox.show({
title: "确认驳回!",
msg: "请输入驳回原因!",
width: 300,
buttons: Ext.MessageBox.OKCANCEL,
multiline: true,
fn: function (btn, text) {
if (btn == "ok") {
Ext.Ajax.request({
waitMsg: '正在操作数据...',
url: '/MvcContainer/MsOpCtnTkFitings/AuditBillBack',
params: {
bill: jsonbodyAddDatas,
reasean: text
},
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;
} else {
_this.storeList.reload();
}
} else {
Ext.MessageBox.alert('错误', response.responseText);
}
},
scope: this
});
}
}
});
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = " OPTYPE='" + OPTYPE + "'";
var DC = form.findField('DC').getValue();
if (DC == '3') {
sql = sql + getAndConSql(sql, DC, " dbo.[GetUsingStep](wu.WORKFLOWID,wu.currentid,'" + USERID + "',wu.stepno)>0 ");
} if (DC == '2') {
sql = sql + getAndConSql(sql, DC, " (b.BSSTATUS='确认报损') ");
} if (DC == '1') {
sql = sql + getAndConSql(sql, DC, " (b.BSSTATUS='提交报损' or b.BSSTATUS='未提交') ");
}
var YARD = form.findField('YARD').getValue();
sql = sql + getAndConSql(sql, YARD, " YARD='" + YARD + "'");
var expDateBgn = form.findField('ETDbgn').getRawValue();
sql = sql + getAndConSql(sql, expDateBgn, "OPDATE >='" + expDateBgn + "'");
var expDateEnd = form.findField('ETDend').getRawValue();
sql = sql + getAndConSql(sql, expDateEnd, "OPDATE <='" + 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/MsOpCtnTkFitings/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 = 'MSOPCTNTKFITINGSCG';
var sql1 = returnstr;
var sql2 = "select * from op_ctntkFiting 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 = '';
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 = 'MSOPPRICESELECT';
var sql1 = "select * from op_ctntkFiting WHERE GID IN (" + feeGidSql + ") order by " + sortstr;
var sql2 = "select * from op_ctntkFiting where GID='" + bsno + "'";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
});