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/MvcShipping/Viewsjs/MsOpSeae/PiLiangDoc.js

1534 lines
55 KiB
JavaScript

3 years ago
Ext.namespace('Shipping');
Shipping.PiliangSeaeDoc = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.PiliangSeaeDoc.superclass.constructor.call(this);
};
Ext.extend(Shipping.PiliangSeaeDoc, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
EditRecord: null,
region: 'north',
BsNo: '',
feeType:null,
StoreFee: null,
StoreFeeUnit: null,
StoreFeeCust:null,
initUIComponents: function () {
this.strBSNO = '';
this.stroplb = 'op_Seae';
this.formname = "formPiliangSeaeDoc"; //页面名称
this.formHead = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [
{ xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '件数',
name: 'PKGS', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '重量',
name: 'KGS', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '尺码',
name: 'CBM', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '委托编号',
readOnly: true,
name: 'CUSTNO'
}, {
fieldLabel: '主提单号',
readOnly: true,
name: 'MBLNO'
},
{
fieldLabel: '箱型箱量',
readOnly: true,
name: 'CNTRTOTAL'
}, {
fieldLabel: '付费方式',
readOnly: true,
name: 'BLFRT'
}, {
fieldLabel: 'MBL付费方式',
readOnly: true,
name: 'MBLFRT'
}
]
},
{ xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '揽货人',
readOnly: true,
name: 'SALE'
}, {
fieldLabel: '委托单位',
readOnly: true,
name: 'CUSTOMERNAME'
},
{
fieldLabel: '卸货港',
readOnly: true,
name: 'PORTDISCHARGE'
},
{
fieldLabel: '船名',
readOnly: true,
name: 'VESSEL'
}, {
fieldLabel: '航次',
readOnly: true,
name: 'VOYNO'
}
]
},
{ xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
xtype: 'label',
text: '服务项目'
},
{
xtype: 'checkboxfield',
fieldLabel: '熏蒸',
flex: 1,
labelAlign: 'right',
readOnly: true,
frame: true,
name: 'ISFUMIGATION'
},
{
xtype: 'checkboxfield',
fieldLabel: '仓储',
flex: 1,
labelAlign: 'right',
readOnly: true,
name: 'ISSTORAGE'
},
{
xtype: 'checkboxfield',
fieldLabel: '陆运',
flex: 1,
labelAlign: 'right',
readOnly: true,
name: 'ISLAND'
},
{
xtype: 'checkboxfield',
fieldLabel: '报关',
flex: 1,
labelAlign: 'right',
readOnly: true,
name: 'ISCUSTOMES'
},
{
xtype: 'checkboxfield',
fieldLabel: '报检',
flex: 1,
labelAlign: 'right',
readOnly: true,
name: 'ISINSPECTION'
},
{
xtype: 'checkboxfield',
fieldLabel: '订舱',
flex: 1,
labelAlign: 'right',
readOnly: true,
name: 'ISBOOKING'
},
{
xtype: 'checkboxfield',
fieldLabel: '使用代理',
flex: 1,
labelAlign: 'right',
readOnly: true,
name: 'ISAGENT'
},
{
xtype: 'checkboxfield',
fieldLabel: '分单签单',
flex: 1,
labelAlign: 'right',
readOnly: true,
name: 'ISHBLNO'
}
]
}
]
}]
}); //end this.formEdit
//#region 按钮Toolbar
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
id: 'btnEPrev',
text: "上一票",
// iconCls: "btnsave",
handler: function (button, event) {
this.PrevRecord();
},
scope: this
}, {
id: 'btnENext',
text: "下一票",
// iconCls: "btnsave",
handler: function (button, event) {
this.NextRecord();
},
scope: this
}]
}); //end 按钮Toolbar
//#endregion
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 130,
id: "BillHeadSeae",
items: [this.panelBtn, this.formHead]
});
//#region 单据管理
this.ReceiptDrSerialNo = 0;
this.ReceiptDrBodyDel = [];
this.Loading = true;
this.StoreDrOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsReceiptOP',
proxy: { url: '/MvcShipping/MsOpReceipt/GetReceiptOpRang' }
});
this.StoreDrOpRange.load({ params: { optype: "modOpReceiptManagement"} });
//明细表-数据集
this.storeDrOpReceipt = Ext.create('Ext.data.Store', {
model: 'MsOpReceiptEntity',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpReceipt/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.cellEditingDrOpReceipt = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.ReceiptDrGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
_this = this;
//键值维护表_贸易方式
this.storeCrmKeyCodeCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CrmKeyCodeModel',
proxy: { url: '/CommMng/BasicDataRef/GetCrmKeyCodeList' }
});
this.storeCrmKeyCodeCode.load({ params: { condition: " and KEYTYPE='单据类型'"} });
this.comboxRECEIPTTYPE = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '单据类型',
store: this.storeCrmKeyCodeCode,
forceSelection: true,
name: 'RECEIPTTYPE',
valueField: 'KEYVALUE',
displayField: 'KEYVALUE'
});
//
this.columns = [{
sortable: true,
dataIndex: 'GID',
header: '惟一编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'BSNO',
header: '业务编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'RECEIPTNO',
header: '单据编号',
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(17)
}
}
}
},
width: 100
}, {
sortable: true,
dataIndex: 'RECEIPTTYPE',
header: '单据类型',
editor: this.comboxRECEIPTTYPE,
width: 80
}, {
sortable: true,
dataIndex: 'RECEIVE_MAN',
header: '接单人',
//editor: SHOWNAME,
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(17)
}
}
}
},
width: 80
}, {
sortable: true,
dataIndex: 'RECEIVE_DATE',
header: '接单日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'), //format是'm/d/Y'结果是”09/24/2008”
editor: {
//dateFormat: Ext.util.Format.dateRenderer('Y-m-d'),
format: 'Y-m-d',
xtype: 'datefield',
selectOnFocus: true
},
width: 80
}, {
sortable: true,
dataIndex: 'SEND_MAN',
header: '送单人',
//editor: SHOWNAME,
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(17)
}
}
}
},
width: 80
}, {
sortable: true,
dataIndex: 'SEND_DATE',
header: '送单日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'), //format是'm/d/Y'结果是”09/24/2008”
editor: {
//dateFormat: Ext.util.Format.dateRenderer('Y-m-d'),
format: 'Y-m-d',
xtype: 'datefield',
selectOnFocus: true
},
width: 80
}, {
sortable: true,
dataIndex: 'TRANCER',
header: '送单快递公司',
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(17)
}
}
}
},
width: 80
}, {
sortable: true,
dataIndex: 'TRANCNO',
header: '送单快递单号',
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(17)
}
}
}
},
width: 80
}, {
sortable: true,
dataIndex: 'ISREPEAT',
header: '是否回单',
//xtype: "checkboxfield",
//xtype:"booleancolumn",
//trueText: "是",
//falseText: " ",
editor: {
xtype: 'checkboxfield'
},
width: 60
}, {
sortable: true,
dataIndex: 'REPEAT_MAN',
header: '回单人',
//editor: SHOWNAME,
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(17)
}
}
}
},
width: 80
}, {
sortable: true,
dataIndex: 'REPEAT_DATE',
header: '回单日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'), //format是'm/d/Y'结果是”09/24/2008”
editor: {
//dateFormat: Ext.util.Format.dateRenderer('Y-m-d'),
format: 'Y-m-d',
xtype: 'datefield',
selectOnFocus: true
},
width: 80
}, {
sortable: true,
dataIndex: 'ISRECEIVE',
header: '是否还单',
editor: {
xtype: 'checkboxfield'
},
width: 60
}, {
sortable: true,
dataIndex: 'RETURN_MAN',
header: '还单人',
//editor: SHOWNAME,
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(17)
}
}
}
},
width: 80
}, {
sortable: true,
dataIndex: 'RETURN_DATE',
header: '还单日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'), //format是'm/d/Y'结果是”09/24/2008”
editor: {
//dateFormat: Ext.util.Format.dateRenderer('Y-m-d'),
format: 'Y-m-d',
xtype: 'datefield',
selectOnFocus: true
},
width: 80
}, {
sortable: true,
dataIndex: 'RETURN_TRANCER',
header: '还单的快递公司',
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(17)
}
}
}
},
width: 100
}, {
sortable: true,
dataIndex: 'RETURN_TRANCNO',
header: '还单的快递单号',
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(17)
}
}
}
},
width: 100
}, {
sortable: true,
dataIndex: 'REMARK',
header: '备注',
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(17)
}
}
}
},
width: 200
}, {
sortable: true,
dataIndex: 'CORPID',
header: '分公司代码',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'CREATEUSER',
header: '创建人',
width: 0
}, {
sortable: true,
dataIndex: 'CREATETIME',
header: '创建时间',
width: 0
}, {
sortable: true,
dataIndex: 'MODIFIEDUSER',
header: '最后更改人',
width: 0
}, {
sortable: true,
dataIndex: 'MODIFIEDTIME',
header: '最后更改时间',
width: 0
}];
this.gridDrOpReceipt = new Ext.grid.GridPanel({
store: this.storeDrOpReceipt,
enableHdMenu: false,
region: 'center',
id: 'gridDrOpReceipt',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.cellEditingDrOpReceipt],
selModel: this.ReceiptDrGridCheckBoxModel,
selType: 'cellmodel',
viewConfig: {
autoFill: true
},
tbar: [{
text: '',
tooltip: '添加',
iconCls: "btnadd",
handler: function (button, event) {
this.onAddDetailClick(button, event);
},
scope: this
}, '-', {
text: '',
tooltip: '保存',
iconCls: "btnsave",
handler: function (button, event) {
this.onPostDetailClick(button, event);
},
scope: this
},
'-', {
text: '',
tooltip: '删除',
iconCls: "btndelete",
handler: function (button, event) {
this.onDelDetailClick(button, event);
},
scope: this
}, '-', {
text: '',
tooltip: '取消修改',
iconCls: "btncancel",
handler: function (button, event) {
this.onCancelDetailClick(button, event);
},
scope: this
}, '-', {
text: '',
tooltip: '刷新',
iconCls: "btnrefresh",
handler: function (button, event) {
this.storeDrOpReceipt.load({ params: { billno: this.strBSNO, optype: this.stroplb} });
},
scope: this
}, '-', {
text: '',
tooltip: '打印',
iconCls: "btnprint",
menu:
[{ text: "打印账单",
menu: [{
text: "所选打印",
handler: function (menu, event) {
_this.onPrintSelectDetailClick(menu, event);
}
}, {
text: "所有打印",
handler: function (menu, event) {
_this.onPrintAllDetailClick(menu, event);
}
}]
}, '-', ],
scope: this
}, '-', {
text: "确认送单",
//iconCls: "btnreset",
handler: function (button, event) {
this.onSetRECEIPT("SEND");
},
scope: this
}, {
text: "确认回单",
//iconCls: "btnreset",
handler: function (button, event) {
this.onSetRECEIPT("REPEAT");
},
scope: this
}, {
text: "确认还单",
//iconCls: "btnreset",
handler: function (button, event) {
this.onSetRECEIPT("RETURN");
},
scope: this
}, '-', {
text: "保存列表样式",
id: "btntest",
handler: function (button, event) {
var formname = this.formname;
var tempcolumns = this.gridDrOpReceipt.columns;
DsTruck.SaveGridPanel(USERID, formname, tempcolumns, this.columns, 0, true);
},
scope: this
}],
columns: this.columns
});
_this = this;
/////////////以下部分为获取存储的gridpanel显示样式
this.columns = DsTruck.GetGridPanel(USERID, this.formname, this.columns);
//使用者id表名 中间column数组跳过一开始的几列
//this.girdcolums.unshift(new Ext.grid.RowNumberer());
this.gridDrOpReceipt.reconfigure(this.storeDrOpReceipt, this.columns);
////////////////////////////
this.cellEditingDrOpReceipt.on('beforeedit', function (editor, e) {
return this.cellEditingOpReceiptBeforeEdit(editor, e);
}, this);
this.gridDrOpReceipt.on('beforeload', function (store) {
Ext.apply(store.proxy.extraParams, { billno: _this.strBSNO, optype: _this.stroplb });
}, this);
this.panelReceipt = new Ext.Panel({
//layout: "anchor",
layout: "border",
anchor: '100% 50%',
height: 350,
region: 'north',
items: [
this.gridDrOpReceipt
]
});
//#endregion
//#region 明细表-单据图片档案管理
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',
tbar: [{
text: '删除',
tooltip: '删除',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelFileClick(button, event);
},
scope: this
}, '-', {
text: '上传附件',
tooltip: '上传附件',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onUpLoadFileClick(button, event);
},
scope: this
}],
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: 200,
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.storeDocList.on('beforeload', function (store) {
var strBSNO = this.EditRecord.get("BSNO");
var condition2 = " BSNO='" + strBSNO + "' ";
Ext.apply(store.proxy.extraParams, { condition: condition2 });
}, this);
this.panelDoc = new Ext.Panel({
id: "panelDoc",
layout: "border",
region: "center",
//autoScroll: true,
frame: false,
split: true,
items: [this.gridDocList]
});
//#endregion
Ext.apply(this, {
items: [this.panelTop,this.panelReceipt, this.panelDoc]
});
parentWin = window.parent.opener;
this.InitData();
},
//#region 加载事件
InitData: function () {
this.opStatus = 'add';
var condition = '';
_this = this;
if (parentWin) {
var ret = parentWin.OprationSwap();
this.opStatus = ret[0];
this.StoreList = ret[1];
this.EditRecord = ret[2];
}
this.BsNo = this.EditRecord.get('BSNO');
this.LoadData();
}, //end InitData
LoadData: function () {
this.formHead.getForm().loadRecord(this.EditRecord);
var strBSNO = this.EditRecord.get("BSNO");
this.strBSNO = this.EditRecord.get("BSNO");
this.storeDrOpReceipt.load({ params: { billno: this.strBSNO, optype: "op_Seae"} });
var condition2 = " BSNO='" + strBSNO + "' ";
this.Loading = true;
this.storeDocList.load({
params: { condition: condition2 },
waitMsg: "正在查询数据...",
scope: this,
callback: function () {
this.Loading = false;
}
});
}, // end LoadDate
//#region 明细操作
onNextKeyClick: function (col) {
var rows = this.gridDrOpReceipt.getSelectionModel().getSelection();
var row = rows[rows.length - 1];
var s = this.gridDrOpReceipt.getStore();
var number = s.indexOf(row) + 1;
if (number == this.gridDrOpReceipt.getStore().getCount()) {
this.onAddDetailClick(s, event);
} else {
this.cellEditingDrOpReceipt.startEditByPosition({ row: number, column: col });
}
},
onAddDetailClick: function (button, event) {
var store = this.storeDrOpReceipt;
var newSerialno = this.GetHandleSerialNo(store);
var newsort = store.getCount() + 1;
var myDate = new Date();
//myDate = this.GetDateStr(0);
var record = null;
record = Ext.create('MsOpReceiptEntity', {
GID: NewGuid(), // 惟一编号
BSNO: '*', // 关联编号/业务编号BSNO
RECEIPTNO: '', // 单据编号
RECEIPTTYPE: '', // 单据类型
RECEIVE_MAN: SHOWNAME, // 接单人
RECEIVE_DATE: myDate, // 接单日期
SEND_MAN: '', // 送单人
SEND_DATE: null, // 送单日期
TRANCER: '', // 送单的快递公司
TRANCNO: '', // 送单的快递单号
ISREPEAT: 'false', // 是否回单
REPEAT_MAN: '', // 回单人
REPEAT_DATE: null, // 回单日期
ISRECEIVE: 'false', // 是否还单
RETURN_MAN: '', // 还单人
RETURN_DATE: null, // 还单日期
RETURN_TRANCER: '', // 还单的快递公司
RETURN_TRANCNO: '', // 还单的快递单号
REMARK: '', // 备注
CORPID: '', // 分公司代码
CREATEUSER: USERID, // 创建人GID
CREATETIME: null, // 创建时间
MODIFIEDUSER: USERID, // 更改操作人GID
MODIFIEDTIME: null // 更改操作时间
//Sort: newSerialno,
});
store.add(record);
var editColumnIndex = 1;
var cellediting = this.cellEditingDrOpReceipt;
var n = store.getCount();
cellediting.startEditByPosition({ row: n - 1, column: editColumnIndex });
},
onCancelDetailClick: function (menu, event) {
var store = this.storeDrOpReceipt;
for (var i = 0; i < store.getCount(); i += 1) {
var member = store.getAt(i);
member.reject();
}
},
GetHandleSerialNo: function (store) {
var result = 0;
if (result == 0) {
for (var i = 0; i < store.getCount(); i += 1) {
var member = store.getAt(i);
if (member.data.Sort > result) {
result = member.data.Sort;
}
}
}
result = parseInt(result) + 1;
return result;
},
//获取日期
GetDateStr: function (AddDayCount) {
var dd = new Date();
dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期
var y = dd.getFullYear();
var m = dd.getMonth() + 1; //获取当前月份的日期
var d = dd.getDate();
return y + "-" + m + "-" + d;
},
//#endregion
//#region 单据确认
onSetRECEIPT: function (onSetType) {
var ReceiptGIDSql = '';
var selectedRecords = this.ReceiptDrGridCheckBoxModel.selected.items;
var candelete = this.CheckOpReceiptDelete(selectedRecords);
if (candelete == false) {
return;
}
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.BSNO == "*") {//如果是新增但没有保存的数据,没有必要提交到后台
this.storeDrOpReceipt.remove(selectedRecords[i]);
} else {
var ReceiptGID = "'" + rec.data.GID + "'";
if (ReceiptGIDSql == '') {
ReceiptGIDSql = ReceiptGID;
} else {
ReceiptGIDSql = ReceiptGIDSql + "," + ReceiptGID;
}
}
}
}
_this = this;
Ext.Msg.wait('正在操作数据...');
if (ReceiptGIDSql != '') {
Ext.Ajax.request({
waitMsg: '正在操作数据...',
url: '/MvcShipping/MsOpReceipt/onSetRECEIPT',
params: {
BSNO: _this.strBSNO,
gids: ReceiptGIDSql,
onSetType: onSetType
},
callback: function (options, success, response) {
if (success) {
//Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
for (var i = 0; i < selectedRecords.length; i++) {
}
this.storeDrOpReceipt.reload();
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 });
},
scope: this
}); //end Ext.Ajax.request
} else {
Ext.Msg.show({ title: '提示', msg: "操作成功!", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
}
}, this);
},
//#endregion
//#region 删除
onDelDetailClick: function (button, event) {
var ReceiptGIDSql = '';
var selectedRecords = this.ReceiptDrGridCheckBoxModel.selected.items;
var candelete = this.CheckOpReceiptDelete(selectedRecords);
if (candelete == false) {
return;
}
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.BSNO == "*") {//如果是新增但没有保存的数据,没有必要提交到后台
this.storeDrOpReceipt.remove(selectedRecords[i]);
} else {
var ReceiptGID = "'" + rec.data.GID + "'";
if (ReceiptGIDSql == '') {
ReceiptGIDSql = ReceiptGID;
} else {
ReceiptGIDSql = ReceiptGIDSql + "," + ReceiptGID;
}
}
}
}
_this = this;
Ext.Msg.wait('正在删除数据...');
if (ReceiptGIDSql != '') {
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsOpReceipt/Delete',
params: {
BSNO: _this.strBSNO,
data: ReceiptGIDSql
},
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.storeDrOpReceipt.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);
},
//#endregion
//#region 操作权限判断
CheckOpReceiptDelete: function (records) {
for (var i = 0; i < records.length; i++) {
var rec = records[i];
var MODIFIEDUSER = rec.data.MODIFIEDUSER;
var recop = DsStoreQueryBy(this.StoreDrOpRange, 'OPID', MODIFIEDUSER);
if (recop.getCount() > 0) {
} else {
Ext.Msg.show({ title: '提示', msg: '你没有权限操作此信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
canDelete = false;
}
}
return true;
},
//#endregion
//#region 保存
onPostDetailClick: function (button, event) {
var bodyDrOpReceiptDatas = [];
for (var i = 0; i < this.storeDrOpReceipt.getCount(); i += 1) {
var memberyf = this.storeDrOpReceipt.getAt(i);
bodyDrOpReceiptDatas.push(memberyf);
};
var jsonOpReceiptBody = ConvertFeeRecordsToJson(bodyDrOpReceiptDatas);
//
_this = this;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOpReceipt/Save',
scope: this,
params: {
BSNO: _this.strBSNO,
OpReceiptbody: jsonOpReceiptBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
for (var i = 0; i < this.storeDrOpReceipt.getCount(); i += 1) {
var member = this.storeDrOpReceipt.getAt(i);
member.set("BSNO", _this.strBSNO);
member.commit();
}
} 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
//#endregion
//#region 表格的AfterEdit
setHeadFieldValue: function (fieldName, value) {
var field = this.formtotal.getForm().findField(fieldName);
field.setValue(value);
},
//#endregion
//#region 修改权限判断
cellEditingOpReceiptBeforeEdit: function (editor, e) {
var MODIFIEDUSER = e.record.get('MODIFIEDUSER');
var records = DsStoreQueryBy(this.StoreDrOpRange, 'OPID', MODIFIEDUSER);
if (records.getCount() > 0) {
} else {
Ext.Msg.show({ title: '提示', msg: '你没有权限修改此信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
canedit = false;
}
return true;
},
//#endregion
//#region 保存
setSaveBtnStatus: function (enable) {
var bsbtnSave = Ext.getCmp('pcbtnSave');
var bsbtnSaveAndClose = Ext.getCmp('pcbtnSaveAndClose');
var bsbtnSaveAndNew = Ext.getCmp('pcbtnSaveAndNew');
var pcbtnNew = Ext.getCmp('pcbtnNew');
if (enable) {
bsbtnSave.enable();
bsbtnSaveAndClose.enable();
bsbtnSaveAndNew.enable();
pcbtnNew.enable();
} else {
bsbtnSaveAndNew.disable();
pcbtnNew.disable();
}
},
//#endregion
//#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("CUSTNO");
var strBSNO = this.EditRecord.get("BSNO");
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: billno,
BSNO: strBSNO
},
success: function (form, action) {
win.close(this);
Ext.Msg.show({ title: '提示', msg: '上传成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
var condition = strBSNO;
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
//#region 打印
onPrintSelectDetailClick: function (button, event) {
var selectedRecords = this.ReceiptDrGridCheckBoxModel.selected.items;
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要打印的数据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (this.stroplb == 'op_Seae') {
var printType = 'SEAEDRReceipt';
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_seae WHERE BSNO = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_Apply') {
var printType = 'APPLYDRReceipt';
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_apply WHERE BSNO = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_Seai') {
var printType = 'SEAIDRReceipt';
var sql1 = /*"SET LANGUAGE 'us_english' "
+ */" select * from op_seai WHERE BSNO = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_Bulk') {
var printType = 'BULKDRReceipt';
var sql1 = /*"SET LANGUAGE 'us_english' "
+ */" select * from op_bulk WHERE BSNO = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_other') {
var printType = 'OpOtherReceipt';
var sql1 = /*"SET LANGUAGE 'us_english' "
+ */" select * from op_other WHERE BSNO = '" + this.strBSNO + "'";
};
var ReceiptGIDSql = '';
for (var i = 0; i < selectedRecords.length; i++) {
var record = selectedRecords[i];
var ReceiptGID = "''" + record.get('GID') + "''";
if (ReceiptGIDSql == '') {
ReceiptGIDSql = ReceiptGID;
} else {
ReceiptGIDSql = ReceiptGIDSql + "," + ReceiptGID;
}
};
var sql2 = "";
if (ReceiptGIDSql != '') {
sql2 = sql2 + "select GID as 惟一编号,BSNO as 业务编号,RECEIPTNO as 单据编号,RECEIPTTYPE as 单据类型,RECEIVE_MAN as 接单人,convert(char(10),RECEIVE_DATE,20) as 接单日期,SEND_MAN as 送单人,convert(char(10),SEND_DATE,20) as 送单日期,TRANCER as 送单快递公司,TRANCNO as 送单快递单号,ISREPEAT as 是否回单,REPEAT_MAN as 回单人,convert(char(10),REPEAT_DATE,20) as 回单日期,ISRECEIVE as 是否还单,RETURN_MAN as 还单人,convert(char(10),RETURN_DATE,20) as 还单日期,RETURN_TRANCER as 还单快递公司,RETURN_TRANCNO as 还单快递单号,REMARK as 备注,(select top 1 [NAME] from [company] where gid=op_receipt.CORPID) as 分公司,(select top 1 SHOWNAME from [user] where gid=op_receipt.CREATEUSER) as 创建人,CREATETIME as 创建时间,(select top 1 SHOWNAME from [user] where gid=op_receipt.MODIFIEDUSER) as 最后更改人,MODIFIEDTIME as 最后更改时间 from op_receipt where GID in (" + ReceiptGIDSql + ") order by bsno,MODIFIEDTIME";
}
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
onPrintAllDetailClick: function (button, event) {
if (this.stroplb == 'op_Seae') {
var printType = 'SEAEDRReceiptALL';
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_seae WHERE BSNO = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_Apply') {
var printType = 'APPLYDRReceiptALL';
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_apply WHERE BSNO = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_Seai') {
var printType = 'SEAIDRReceiptALL';
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_seai WHERE BSNO = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_Bulk') {
var printType = 'BULKDRReceiptALL';
var sql1 = "SET LANGUAGE 'us_english' "
+ " select * from op_bulk WHERE BSNO = '" + this.strBSNO + "'";
} else if (this.stroplb == 'op_other') {
var printType = 'OpOtherReceipt';
var sql1 = "SET LANGUAGE 'us_english' "
+ "select * from op_other WHERE BSNO = '" + this.strBSNO + "'";
};
var sql2 = "SET LANGUAGE 'us_english' select GID as 惟一编号,BSNO as 业务编号,RECEIPTNO as 单据编号,RECEIPTTYPE as 单据类型,RECEIVE_MAN as 接单人,convert(char(10),RECEIVE_DATE,20) as 接单日期,SEND_MAN as 送单人,convert(char(10),SEND_DATE,20) as 送单日期,TRANCER as 送单快递公司,TRANCNO as 送单快递单号,ISREPEAT as 是否回单,REPEAT_MAN as 回单人,convert(char(10),REPEAT_DATE,20) as 回单日期,ISRECEIVE as 是否还单,RETURN_MAN as 还单人,convert(char(10),RETURN_DATE,20) as 还单日期,RETURN_TRANCER as 还单快递公司,RETURN_TRANCNO as 还单快递单号,REMARK as 备注,(select top 1 [NAME] from [company] where gid=op_receipt.CORPID) as 分公司,(select top 1 SHOWNAME from [user] where gid=op_receipt.CREATEUSER) as 创建人,CREATETIME as 创建时间,(select top 1 SHOWNAME from [user] where gid=op_receipt.MODIFIEDUSER) as 最后更改人,MODIFIEDTIME as 最后更改时间 from op_receipt where BSNO='" + this.strBSNO + "' order by bsno,MODIFIEDTIME";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
//#endregion
PrevRecord: function () {
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;
}
j = j - 1;
this.EditRecord = this.StoreList.getAt(j);
this.BsNo = this.EditRecord.get('BSNO');
this.LoadData();
},
NextRecord: function () {
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;
}
j = j + 1;
this.EditRecord = this.StoreList.getAt(j);
this.BsNo = this.EditRecord.get('BSNO');
this.LoadData();
},
getModifyStatus: function () {
return this.panelFee.getModifyStatus();
},
feeType: function () {
return this.panelFee.feeType;
},
StoreFee: function () {
return this.panelFee.StoreFee;
},
StoreFeeUnit: function () {
return this.panelFee.StoreFeeUnit;
},
StoreFeeCust: function () {
return this.panelFee.StoreFeeCust;
}
});