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/MvcContainer/Viewsjs/MsOpCtnApply/MsOpCtnApplySaleEdit.js

3219 lines
116 KiB
JavaScript

3 years ago
Ext.namespace('Shipping');
Shipping.MsOpCtnApplySaleEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpCtnApplySaleEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpCtnApplySaleEdit, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
editRecord: null,
editFactryRecord: null,
FactryStatus: 'add',
initUIComponents: function () {
this.serialNo = 0;
this.workSerialNo = 0;
this.bodyDel = [];
//#region 编辑form
//枚举参照相关(编辑form)
//权限范围
//this.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', {
// model: 'DsShipping.ux.CodeDisportModel',
// autoLoad: true,
// proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' }
//});
//this.storeCodeDisport.load();
this.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeDisportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportListRm' }
});
this.comboxPORTDISCHARGE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '目的港',
store: this.storeCodeDisport,
matchFieldWidth: false,
name: 'PORTDISCHARGE',
queryMode: 'remote',
minChars: 2,
queryParam: 'PORT',
allowBlank: true,
valueField: 'PORT',
displayField: 'PORT'
});
this.storeCodeDisport2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeDisportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportListRm' }
});
this.comboxPORTLOAD = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '起运港',
store: this.storePORTLOAD,
matchFieldWidth: false,
allowBlank: true,
queryMode: 'remote',
minChars: 2,
queryParam: 'PORT',
name: 'PORTLOAD',
valueField: 'PORT',
displayField: 'PORT'
});
_this = this;
//客户加载_委托单位
this.storeCUSTOMER = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCUSTOMER.load({ params: { condition: "ISCONTROLLER='1'"} });
//委托单位
this.comboxCUSTOMER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '委托单位',
store: this.storeCUSTOMER,
forceSelection: true,
allowBlank: true,
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.storeCustCodeFactry = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustCodeFactry.load({ params: { condition: "ISSHIPPER='1'"} });
this.comboxCustCodeFactry = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '工厂名称',
store: this.storeCustCodeFactry,
forceSelection: true,
allowBlank: true,
name: 'FACTORYNAME',
flex: 1,
valueField: 'CustName',
displayField: 'CodeAndName'
});
//人员信息加载
this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefList' }
});
this.storeOpCode.load();
//客服
this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '揽货人',
store: this.storeOpCode,
forceSelection: true,
allowBlank: true,
name: 'SALE',
valueField: 'UserName',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
_this.loadFactry();
// var GOODSNAME = this.formEdit.getForm().findField('GOODSNAME').getValue();
// var goodnamestr = "";
// if (GOODSNAME != '')
// goodnamestr = " and LINKGID IN (SELECT GID FROM code_msds WHERE GOODNAME='" + GOODSNAME + "') "
// var s = " ISCONTROLLER='1' AND SHORTNAME IN (SELECT FACTORYNAME FROM code_msds_factry WHERE SALE='" + combo.value + "'" + goodnamestr + " ) ";
// this.storeCustCodeFactry.load({ params: { condition: s} });
}
}
}
});
//客服
this.storeOpCode2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefList' }
});
this.storeOpCode2.load();
this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '操作员',
store: this.storeOpCode2,
forceSelection: true,
allowBlank: true,
name: 'OP',
valueField: 'UserName',
displayField: 'CodeAndName'
});
this.storeListGood = Ext.create('Ext.data.Store', {
model: 'MsCodeMSDS',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsCodeMSDS/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeListGood.load({ params: { start: 0, limit: 20000, condition: ""} });
this.comboxGoods = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeListGood,
fieldLabel: '品名',
allowBlank: true,
// forceSelection: true,
flex: 2,
name: 'GOODSNAME',
valueField: 'CHEMICALCGOODSNAME',
displayField: 'GOODNAMEANDCNAME',
listeners: {
'render': function (_field, eOpts) {//自定义函数,定义双击事件
var _this = this;
_field.getEl().on('dblclick', function (e, t, eOpts) {
var openSet = "height=700, width=1224, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2
var openType = "_blank";
var openUrl = "";
openUrl = "../MsCodeMSDS/MsdsView?handle=check&goodsname=" + t.value;
window.open(openUrl, openType, openSet);
});
},
'select': function (combo, records, eOpts) {
if (records.length > 0) {
this.loadFactry();
}
}
}
});
this.storeGOODTYPE = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeGOODTYPE.load({ params: { enumTypeId: 97028} });
this.comboxGOODTYPE = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeGOODTYPE,
fieldLabel: '货物类别',
allowBlank: true,
name: 'GOODTYPE',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
this.storeCtn = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeCtnModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeCtnList' }
});
this.storeCtn.load();
//箱型
this.comboxCTN = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCtn,
forceSelection: true,
fieldLabel: '箱型',
allowBlank: true,
name: 'CTNALL',
valueField: 'CTN',
displayField: 'CTN'
});
//运输条款
this.storeSERVICE = Ext.create('DsExt.ux.RefTableStore', {
model: 'CODE_SERVICE',
proxy: { url: '/CommMng/BasicDataRef/GetCodeServiceList' }
});
this.comboxSERVICE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '运输条款',
flex:1,
store: this.storeSERVICE,
forceSelection: true,
name: 'SERVICE',
valueField: 'SERVICE',
displayField: 'SERVICE'
});
this.storeSERVICE2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'CODE_SERVICE',
proxy: { url: '/CommMng/BasicDataRef/GetCodeServiceList' }
});
this.comboxSERVICE2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '运输条款',
flex: 1,
store: this.storeSERVICE2,
forceSelection: true,
name: 'SERVICE',
valueField: 'SERVICE',
displayField: 'SERVICE'
});
_this = this;
this.storeSERVICE.load({
params: { condition: "" }
, callback: function (r, options, success) {
if (success) {
_this.storeSERVICE2.loadData(_this.storeSERVICE.data.items);
}
}
});
//表参照相关(编辑form)
this.formGoodsAudit = Ext.widget('form', {
region: 'north',
title: '适货审核',
region: 'north',
frame: true,
bodyPadding: 5,
autoScroll: true,
collapsed: false,
collapsible: true,
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',
layout: 'anchor',
defaultType: 'textfield',
items: [{
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [{
fieldLabel: '提交时间',
readOnly: true,
name: 'SUBMITTIME'
}, {
fieldLabel: '审核状态',
readOnly: true,
name: 'AUDITSTATUS'
}, {
fieldLabel: '审核人',
readOnly: true,
name: 'AUDITBYREF'
}, {
fieldLabel: '审核时间',
readOnly: true,
name: 'AUDITTIME'
}, {
fieldLabel: '审核反馈',
flex: 2,
readOnly: true,
name: 'AUDITRESULT'
}]
}]//end items(fieldset 1)
}]
}); //end this.formEdit
this.StoreCurr3 = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeCurr',
proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' }
});
this.StoreCurr3.load({ params: { condition: "" } });
this.comboxCurr3 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '币别', flex: 0.5,
labelWidth: 40,
store: this.StoreCurr3,
forceSelection: true,
name: 'CURRENCY',
valueField: 'CURR',
displayField: 'CURR'
});
this.formCostAudit = Ext.widget('form', {
region: 'north',
title: '成本核算及审批',
region: 'north',
frame: true,
bodyPadding: 5,
// autoScroll: true,
trackResetOnLoad: true,
collapsed: false,
collapsible: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',
layout: 'anchor',
defaultType: 'textfield',
items: [{
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [{
fieldLabel: '审核状态',
readOnly: true,
name: 'COSTAUDITSTATUS'
}, {
fieldLabel: '审核人',
readOnly: true,
name: 'COSTAUDITBYREF'
}, {
fieldLabel: '审核时间',
readOnly: true,
name: 'COSTAUDITTIME'
}, {
fieldLabel: '审核反馈',
readOnly: true,
flex: 3,
name: 'COSTAUDITRESULT'
},{
fieldLabel: 'OWNERCTN',
name: 'OWNERCTN', flex: 0, hidden: true, margins: '0'
}]
}, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [ {
fieldLabel: '起运港免箱使天数',
readOnly: true,
labelWidth: 110, name: 'LOAD_FREE_USECTNE_DAY'
}, {
fieldLabel: '起运港超期箱使费',
readOnly: true,
labelWidth: 110, name: 'LOAD_OVER_USECTNE_RATE'
}, {
fieldLabel: '目的港免箱使天数',
readOnly: true,
labelWidth: 110, name: 'DEST_FREE_USECTNE_DAY'
}, {
fieldLabel: '目的港超期箱使费',
readOnly: true,
labelWidth: 110, name: 'DEST_OVER_USECTNE_RATE'
}, {
fieldLabel: '目的港还箱堆场',
readOnly: true,
labelWidth: 110, name: 'DESTPORT_STATOIN'
}]
}]//end items(fieldset 1)
}]
}); //end this.formEdit
//编辑form
this.formEdit = Ext.widget('form', {
region: 'north',
frame: true,
bodyPadding: 5,
height: 195,
// autoScroll: true,
trackResetOnLoad: true,
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: 'GID',
name: 'GID', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'COMPANYID',
name: 'COMPANYID', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'INPUTBY',
name: 'INPUTBY', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'PH',
hidden: true,
name: 'PH'
}, {
fieldLabel: 'DENSITY',
hidden: true,
name: 'DENSITY'
}, {
fieldLabel: 'UNNO',
hidden: true,
name: 'UNNO'
}, {
fieldLabel: 'DCLASS',
hidden: true,
name: 'DCLASS'
}, {
fieldLabel: 'SDCLASS',
hidden: true,
name: 'SDCLASS'
}, {
fieldLabel: 'PACKINGGROUP',
hidden: true,
name: 'PACKINGGROUP'
}, {
fieldLabel: 'ISPOLLUTEOCEAN',
hidden: true,
name: 'ISPOLLUTEOCEAN'
}, {
fieldLabel: 'MELTINGPOINT',
hidden: true,
name: 'MELTINGPOINT'
}, {
fieldLabel: 'BOILINGPOINT',
hidden: true,
name: 'BOILINGPOINT'
}, {
fieldLabel: 'FLASHPOINT',
hidden: true,
name: 'FLASHPOINT'
}, {
fieldLabel: 'IMDG',
hidden: true,
name: 'IMDG'
}, {
fieldLabel: 'CYCLEDAYS',
hidden: true,
name: 'CYCLEDAYS'
}, {
fieldLabel: 'CHANGERATE',
hidden: true,
name: 'CHANGERATE'
}, {
fieldLabel: 'FULL_CTN_FREE_STORAGE_DAY',
hidden: true,
name: 'FULL_CTN_FREE_STORAGE_DAY'
}, {
fieldLabel: 'FULL_CTN_OVER_STORAGE_RATE',
hidden: true,
name: 'FULL_CTN_OVER_STORAGE_RATE'
}, {
fieldLabel: 'CLEAR_CTN_FREE_STORAGE_DAY',
hidden: true,
name: 'CLEAR_CTN_FREE_STORAGE_DAY'
}, {
fieldLabel: 'CLEAR_CTN_OVER_STORAGE_RATE',
hidden: true,
name: 'CLEAR_CTN_OVER_STORAGE_RATE'
}, {
fieldLabel: 'NO_CLEAR_CTN_FREE_STORAGE_DAY',
hidden: true,
name: 'NO_CLEAR_CTN_FREE_STORAGE_DAY'
}, {
fieldLabel: 'NO_CLEAR_CTN_OVER_STORAGE_RATE',
hidden: true,
name: 'NO_CLEAR_CTN_OVER_STORAGE_RATE'
}
//, {
//fieldLabel: 'CTN_PRICE',
//hidden: true,
//name: 'CTN_PRICE'
//}, {
// fieldLabel: 'CURRENCY',
// hidden: true,
// name: 'CURRENCY'
//}
, {
fieldLabel: 'CTN_INCOME',
hidden: true,
name: 'CTN_INCOME'
}, {
fieldLabel: 'LOAD_FREE_USECTNE_DAY',
hidden: true,
name: 'LOAD_FREE_USECTNE_DAY'
}, {
fieldLabel: 'LOAD_OVER_USECTNE_RATE',
hidden: true,
name: 'LOAD_OVER_USECTNE_RATE'
}, {
fieldLabel: 'DEST_FREE_USECTNE_DAY',
hidden: true,
name: 'DEST_FREE_USECTNE_DAY'
}, {
fieldLabel: 'DEST_OVER_USECTNE_RATE',
hidden: true,
name: 'DEST_OVER_USECTNE_RATE'
}, {
fieldLabel: '申请编号',
labelWidth: 70,
readOnly: true,
allowBlank: true,
name: 'BSNO'
}, {
fieldLabel: '申请日期',
readOnly: true,
name: 'BSDATE'
}, this.comboxSALE, this.comboxOP, this.comboxCUSTOMER]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxGoods, this.comboxGOODTYPE, this.comboxPORTLOAD, this.comboxPORTDISCHARGE
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCTN, {
fieldLabel: '箱量',
allowBlank: true,
name: 'CTNNUM'
}, {
fieldLabel: '计划用箱日期',
format: 'Y-m-d',
allowBlank: true,
flex: 1,
xtype: 'datefield',
name: 'PLANCTNDATE'
}, this.comboxCustCodeFactry, {
fieldLabel: '是否我司订舱',
inputValue: true,
xtype: 'checkboxfield',
name: 'ISOWNERBOOKING'
}]
}, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [{
fieldLabel: '起运港免箱使天数',
labelWidth: 110, name: 'SLOAD_FREE_USECTNE_DAY'
}, {
fieldLabel: '起运港超期箱使费',
labelWidth: 110, name: 'SLOAD_OVER_USECTNE_RATE'
}, {
fieldLabel: '目的港免箱使天数',
labelWidth: 110, name: 'SDEST_FREE_USECTNE_DAY'
}, {
fieldLabel: '目的港超期箱使费',
labelWidth: 110, name: 'SDEST_OVER_USECTNE_RATE'
}, {
fieldLabel: '目的港代理',
readOnly: true,
name: 'AGENTNAME'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '工厂地址',
flex: 2, name: 'FACTORYADDR'
}, {
fieldLabel: '申请状态',
readOnly: true,
name: 'BSSTATUS'
}, {
fieldLabel: '录入人',
readOnly: true,
disabled: true,
name: 'INPUTBYREF'
}, {
fieldLabel: '录入日期',
readOnly: true,
disabled: true,
name: 'INPUTTIME'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
this.comboxSERVICE //运输条款
,{
fieldLabel: '是否加热',
flex: 1,
inputValue: true,
xtype: 'checkboxfield',
name: 'NEEDBEHEATED'
}, {
fieldLabel: '重量',
flex: 1,
xtype: 'numberfield',
allowDecimals: true, //允许输入小数
decimalPrecision: 3,
name: 'WEIGHT'
}, {
fieldLabel: '预计开船日期',
format: 'Y-m-d',
allowBlank: true,
flex: 1,
xtype: 'datefield',
name: 'PREI_ETD'
}, {
fieldLabel: '空箱调拨',
flex: 1,
inputValue: true,
xtype: 'checkboxfield',
name: 'EMPTYCTNALLOCATION'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '罐箱价格',
labelWidth: 55,
flex: 0.5,
// readOnly: true,
name: 'CTN_PRICE'
}, this.comboxCurr3,{
fieldLabel: '按进港日计算超期箱使',
inputValue: true,
labelWidth: 140,
xtype: 'checkboxfield',
name: 'ISPORTLOADDATE'
}, {
fieldLabel: '备注',
flex: 4,
name: 'REMARKS'
}]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}); //end this.formEdit
//#endregion
//#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
},
{
text: "保存",
iconCls: "btnsave",
id: 'btnsave',
handler: function (button, event) {
this.Save('0');
},
scope: this
},
{
text: "保存并关闭",
id: 'btnsaveandclose',
handler: function (button, event) {
this.Save('1');
},
scope: this
},
'-',
{
text: "保存并新建",
id: 'btnsaveandnew',
handler: function (button, event) {
this.Save('2');
},
scope: this
},
'-',
{
text: "复制并新建",
id: 'btncopyandsave',
handler: function (button, event) {
var basicForm = this.formEdit.getForm();
this.opStatus = 'add';
basicForm.findField('GID').setDisabled(false);
var field = basicForm.findField('GID');
var BSNO = NewGuid();
field.setValue(BSNO);
basicForm.findField('BSNO').setValue('')
basicForm.findField('GID').setDisabled(true);
for (var j = 0; j < this.storeBodyList.getCount(); j += 1) {
var memberbody = this.storeBodyList.getAt(j);
memberbody.set("LINKGID", '*');
memberbody.set("GID", NewGuid());
};
this.storeDocList.removeAll();
this.storeBodyCtnList.removeAll();
this.storeBodyCostList.removeAll();
this.formEdit.getForm().findField('BSSTATUS').setValue('');
this.formEdit.getForm().findField('INPUTBYREF').setValue(SHOWNAME);
this.formCostAudit.getForm().findField('COSTAUDITSTATUS').setValue('');
this.formCostAudit.getForm().findField('COSTAUDITBYREF').setValue('');
this.formCostAudit.getForm().findField('COSTAUDITTIME').setValue('');
this.formCostAudit.getForm().findField('COSTAUDITRESULT').setValue('');
this.formGoodsAudit.getForm().findField('SUBMITTIME').setValue('');
this.formGoodsAudit.getForm().findField('AUDITSTATUS').setValue('');
this.formGoodsAudit.getForm().findField('AUDITBYREF').setValue('');
this.formGoodsAudit.getForm().findField('AUDITTIME').setValue('');
this.formGoodsAudit.getForm().findField('AUDITRESULT').setValue('');
SetFormReadOnly(this.formEdit, false);
this.GetEditStatus();
},
scope: this
}, '-', {
id: 'btnSubmitAudit',
text: '提交审核',
tooltip: '提交审核',
handler: function (button, event) {
this.onSubmitAuditClick();
},
scope: this
}, '-', {
id: 'btnSubmitAuditBack',
text: '撤销提交',
tooltip: '撤销提交',
handler: function (button, event) {
this.onSubmitAuditBackClick();
},
scope: this
}, '-',
{
text: "申请修改",
id: 'ShenModify',
menu: [
{ text: "申请修改",
handler: function (menu, event) {
_this.onShenModifyClick();
}
}, { text: "撤销申请修改",
handler: function (menu, event) {
_this.onShenModifyDelCancelClick('0');
}
}, { text: "申请删除",
handler: function (menu, event) {
_this.onShenDeleteClick();
}
}, { text: "撤销申请删除",
handler: function (menu, event) {
_this.onShenModifyDelCancelClick('3');
}
}],
scope: this
}
]
}); //end 按钮Toolbar
//#endregion
//#region 明细
this.storeBodyList = Ext.create('Ext.data.Store', {
model: 'MsOpCtnApplySaleItems',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsOpCtnApply/GetCtnApplySaleItemsList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeFeeNameRef = Ext.create('DsExt.ux.RefTableStore', {
fields: [{ name: 'FEENAME', type: 'string' }
],
proxy: { url: '/MvcContainer/MsOpPrice/GetWXFEELIST' }
});
this.storeFeeNameRef.load({ params: { condition: ""} });
this.comboxFeeNameRef = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeFeeNameRef,
forceSelection: true,
name: 'ITEMNAME',
valueField: 'FEENAME',
displayField: 'FEENAME'
});
//明细表表格
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.gridListBody = new Ext.grid.GridPanel({
store: this.storeBodyList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridListCellEditing],
selType: 'cellmodel',
tbar: [{
text: '增加明细',
tooltip: '增加明细',
id: "btnadddetail",
iconCls: "btnadddetail",
handler: function (button, event) {
this.addDetail();
},
scope: this
}, '-', {
text: '删除明细',
tooltip: '删除明细',
id: "btndeldetail",
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDeletePriceItemsClick();
},
scope: this
}],
columns: [{
sortable: true,
dataIndex: 'GID',
header: '编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'LINKGID',
header: '业务编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'ITEMSNO',
header: '序号',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true
},
renderer: Ext.util.Format.numberRenderer('00'),
align: 'right',
width: 60
}, {
sortable: true,
dataIndex: 'ITEMNAME',
header: '项目名称',
editor: this.comboxFeeNameRef,
width: 140
}, {
sortable: true,
dataIndex: 'REMARKS',
header: '备注',
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true
},
width: 250
}]
});
this.gridListBody.on('edit', function (editor, e, eOpts) {
this.gridListAfterEdit(editor, e, eOpts);
}, this);
//#region 明细表-单据图片档案管理
_this = this;
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',
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: 140,
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.panelDoc = new Ext.Panel({
id: "panelDoc",
layout: "border",
region: "east",
width: 350,
title: '相关图片', //autoScroll: true,
frame: false,
split: true,
items: [this.gridDocList]
});
//#endregion
this.panelBodygz = new Ext.Panel({
title: '改装要求',
layout: "border",
region: 'center',
animate: true,
minHeight: 150,
// autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.gridListBody, this.panelDoc]
});
//#endregion
//#region 报价信息
this.storeBodyCostList = Ext.create('Ext.data.Store', {
model: 'MsOpCtnApplyCostItems',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsOpCtnApply/GetCtnApplyCostItemsList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.gridListCostBody = new Ext.grid.GridPanel({
store: this.storeBodyCostList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selType: 'cellmodel',
columns: [{
sortable: true,
dataIndex: 'GID',
header: '编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'LINKGID',
header: '业务编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'ITEMSNO',
header: '序号',
renderer: Ext.util.Format.numberRenderer('00'),
align: 'right',
width: 60
}, {
sortable: true,
dataIndex: 'FEENAME',
header: '费用名称',
width: 140
}, {
sortable: true,
dataIndex: 'UNIT',
header: '标准',
width: 100
}, {
sortable: true,
dataIndex: 'CURRENCY',
header: '币别',
width: 100
}, {
sortable: true,
dataIndex: 'UNITPRICE',
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: 'QUANTITY',
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: 'AMOUNT',
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: 'REMARK',
header: '备注',
width: 250
}, {
sortable: true,
dataIndex: 'INPUTBYREF',
header: '引入人',
width: 80
}, {
sortable: true,
dataIndex: 'INPUTTIME',
header: '引入时间',
width: 100
}]
});
this.storeBodyCostSum = Ext.create('Ext.data.Store', {
model: 'MsOpCtnApplyCostItems',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsOpCtnApply/GetCtnApplyCostSum',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.gridListCostSum = new Ext.grid.GridPanel({
store: this.storeBodyCostSum,
enableHdMenu: false,
region: 'east',
width: 240,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selType: 'cellmodel',
tbar: [{ xtype: 'label', text: '费用合计',
style: 'font-size:18px',
labelColor: '#000',
//style:'background-color: #4b9bf5',
x: '5%',
y: '5%'
}],
columns: [{
sortable: false,
dataIndex: 'CURRENCY',
header: '币别',
width: 100
}, {
sortable: false,
dataIndex: 'AMOUNT',
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
}]
});
this.panelCostBody = new Ext.Panel({
title: '成本核算明细',
layout: "border",
region: 'north',
frame: true,
bodyPadding: 5,
autoScroll: true,
collapsed: true,
collapsible: true,
trackResetOnLoad: true,
height: 200,
frame: false,
items: [this.gridListCostBody, this.gridListCostSum]
});
//#endregion
//#region 配箱信息
this.storeBodyCtnList = Ext.create('Ext.data.Store', {
model: 'MsOpCtnApplyCtnItems',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsOpCtnApply/GetCtnApplyCtnItemsList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.gridListCtnBody = new Ext.grid.GridPanel({
store: this.storeBodyCtnList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: [{
sortable: true,
dataIndex: 'GID',
header: '编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'LINKGID',
header: '业务编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'AUDITSTATUS',
header: '状态',
width: 80
}, {
sortable: true,
dataIndex: 'ITEMSNO',
header: '序号',
renderer: Ext.util.Format.numberRenderer('00'),
align: 'right',
width: 60
}, {
sortable: true,
dataIndex: 'CTNNO',
header: '箱号',
width: 140
}, {
sortable: true,
dataIndex: 'TANKVOLUMN',
header: '容积',
width: 100
}, {
sortable: true,
dataIndex: 'CTNPROP',
header: '箱属',
width: 200
}, {
sortable: true,
dataIndex: 'OWNERCTN',
header: '罐东',
width: 200
}, {
sortable: true,
dataIndex: 'INSPECTION_EXPIRE_DATE',
header: '年检到期日',
width: 100
}, {
sortable: true,
dataIndex: 'INSURANCE_EXPIRE_DATE',
header: '保险到期日',
width: 100
}, {
sortable: true,
dataIndex: 'CURPORT',
header: '当前地区',
width: 100
}, {
sortable: true,
dataIndex: 'CURSTATOIN',
header: '当前位置',
width: 100
}, {
sortable: true,
dataIndex: 'PREGOODNAME',
header: '前装货',
width: 100
}, {
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 250
}]
});
// this.gridListCtnBody.on('edit', function (editor, e, eOpts) {
// this.gridListAfterEdit(editor, e, eOpts);
// }, this);
this.gridListCtnBody.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
var openSet = "height=700, width=1224, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2
var openType = "_blank";
var openUrl = "";
openUrl = "../MsCodeCtnTk/CtnView?handle=check&ctnno=" + record.data.CTNNO;
window.open(openUrl, openType, openSet);
}, this);
this.panelCtnBody = new Ext.Panel({
title: '配箱明细',
layout: "border",
region: 'east',
width: 320,
animate: true,
minHeight: 250,
// autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.gridListCtnBody]
});
//#endregion
this.panelBody = new Ext.Panel({
layout: "border",
region: 'center',
animate: true,
minHeight: 160,
// autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.panelBodygz, this.panelCtnBody]
});
//#region 布局
//控件布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 28,
items: [this.panelBtn]
});
this.panelBodyAll = new Ext.Panel({
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
containerScroll: true,
frame: false,
items: [this.formEdit, this.formGoodsAudit, this.formCostAudit
///, this.panelCostBody
, this.panelBody]
});
Ext.apply(this, {
items: [this.panelTop, this.panelBodyAll]
});
//#endregion
//绑定查询窗体
this.storeBodyList.on('beforeload', function (store) {
var acondition = " LINKGID='" + this.editRecord.get('GID') + "'";
Ext.apply(store.proxy.extraParams, { condition: acondition });
}, this);
this.storeBodyCostList.on('beforeload', function (store) {
var acondition = " LINKGID='" + this.editRecord.get('GID') + "'";
Ext.apply(store.proxy.extraParams, { condition: acondition });
}, this);
this.storeBodyCtnList.on('beforeload', function (store) {
var acondition = " LINKGID='" + this.editRecord.get('GID') + "'";
Ext.apply(store.proxy.extraParams, { condition: acondition });
}, this);
this.ParentWin = window.parent.opener;
//初始化数据
this.InitData();
//#region 申请修改
this.storeCodeDisportM = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeDisportModel',
autoLoad: true,
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' }
});
this.storeCodeDisportM.load();
this.comboxPORTDISCHARGEM = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '目的港',
store: this.storeCodeDisportM,
name: 'PORTDISCHARGE',
allowBlank: true,
valueField: 'PORT',
displayField: 'PORT'
});
this.storePORTLOADM = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeDisportModel',
autoLoad: true,
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' }
});
this.storePORTLOADM.load();
this.comboxPORTLOADM = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '起运港',
store: this.storePORTLOADM,
allowBlank: true,
name: 'PORTLOAD',
valueField: 'PORT',
displayField: 'PORT'
});
_this = this;
//客户加载_委托单位
this.storeCUSTOMERM = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCUSTOMERM.load({ params: { condition: "ISCONTROLLER='1'"} });
//委托单位
this.comboxCUSTOMERM = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '委托单位',
store: this.storeCUSTOMERM,
forceSelection: true,
allowBlank: true,
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.storeCustCodeFactryM = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustCodeFactryM.load({ params: { condition: "ISSHIPPER='1'"} });
this.comboxCustCodeFactryM = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '工厂名称',
store: this.storeCustCodeFactryM,
forceSelection: true,
allowBlank: true,
name: 'FACTORYNAME',
flex: 1,
valueField: 'CustName',
displayField: 'CodeAndName'
});
//人员信息加载
this.storeOpCodeM = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefList' }
});
this.storeOpCodeM.load();
//客服
this.comboxSALEM = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '揽货人',
store: this.storeOpCodeM,
forceSelection: true,
allowBlank: true,
name: 'SALE',
valueField: 'UserName',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
// var GOODSNAME = this.formEdit.getForm().findField('GOODSNAME').getValue();
// var goodnamestr = "";
// if (GOODSNAME != '')
// goodnamestr = " and LINKGID IN (SELECT GID FROM code_msds WHERE GOODNAME='" + GOODSNAME + "') "
// var s = " ISCONTROLLER='1' AND SHORTNAME IN (SELECT FACTORYNAME FROM code_msds_factry WHERE SALE='" + combo.value + "'" + goodnamestr + " ) ";
// this.storeCustCodeFactry.load({ params: { condition: s} });
}
}
}
});
//客服
this.comboxOPM = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '操作员',
store: this.storeOpCodeM,
forceSelection: true,
allowBlank: true,
name: 'OP',
valueField: 'UserName',
displayField: 'CodeAndName'
});
this.storeListGoodM = Ext.create('Ext.data.Store', {
model: 'MsCodeMSDS',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsCodeMSDS/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeListGoodM.load({ params: { start: 0, limit: 20000, condition: ""} });
this.comboxGoodsM = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeListGoodM,
fieldLabel: '品名',
allowBlank: true,
forceSelection: true,
flex: 2,
name: 'GOODSNAME',
valueField: 'CHEMICALCGOODSNAME',
displayField: 'GOODNAMEANDCNAME',
listeners: {
'render': function (_field, eOpts) {//自定义函数,定义双击事件
var _this = this;
_field.getEl().on('dblclick', function (e, t, eOpts) {
var openSet = "height=700, width=1224, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2
var openType = "_blank";
var openUrl = "";
openUrl = "../MsCodeMSDS/MsdsView?handle=check&goodsname=" + t.value;
window.open(openUrl, openType, openSet);
});
},
'select': function (combo, records, eOpts) {
if (records.length > 0) {
this.loadFactry();
}
}
}
});
this.storeGOODTYPEM = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeGOODTYPEM.load({ params: { enumTypeId: 97028} });
this.comboxGOODTYPEM = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeGOODTYPEM,
fieldLabel: '货物类别',
allowBlank: true,
name: 'GOODTYPE',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
this.storeCtnM = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeCtnModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeCtnList' }
});
this.storeCtnM.load();
//箱型
this.comboxCTNM = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCtnM,
forceSelection: true,
fieldLabel: '箱型',
allowBlank: true,
name: 'CTNALL',
valueField: 'CTN',
displayField: 'CTN'
});
this.formMDEdit = Ext.widget('form', {
region: 'north',
frame: true,
bodyPadding: 5,
// autoScroll: true,
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: 'GID',
name: 'GID', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'APPLYID',
name: 'APPLYID', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'MODIFYTYPE',
name: 'MODIFYTYPE', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'COMPANYID',
name: 'COMPANYID', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'INPUTBY',
name: 'INPUTBY', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'PH',
hidden: true,
name: 'PH'
}, {
fieldLabel: 'DENSITY',
hidden: true,
name: 'DENSITY'
}, {
fieldLabel: 'UNNO',
hidden: true,
name: 'UNNO'
}, {
fieldLabel: 'DCLASS',
hidden: true,
name: 'DCLASS'
}, {
fieldLabel: 'SDCLASS',
hidden: true,
name: 'SDCLASS'
}, {
fieldLabel: 'PACKINGGROUP',
hidden: true,
name: 'PACKINGGROUP'
}, {
fieldLabel: 'ISPOLLUTEOCEAN',
hidden: true,
name: 'ISPOLLUTEOCEAN'
}, {
fieldLabel: 'MELTINGPOINT',
hidden: true,
name: 'MELTINGPOINT'
}, {
fieldLabel: 'BOILINGPOINT',
hidden: true,
name: 'BOILINGPOINT'
}, {
fieldLabel: 'FLASHPOINT',
hidden: true,
name: 'FLASHPOINT'
}, {
fieldLabel: 'IMDG',
hidden: true,
name: 'IMDG'
}, {
fieldLabel: '申请编号',
labelWidth: 70,
readOnly: true,
allowBlank: true,
name: 'BSNO'
}, {
fieldLabel: '申请日期',
readOnly: true,
name: 'BSDATE'
}, this.comboxSALEM, this.comboxOPM, this.comboxCUSTOMERM]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxGoodsM, this.comboxGOODTYPEM, this.comboxPORTLOADM, this.comboxPORTDISCHARGEM
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCTNM, {
fieldLabel: '箱量',
allowBlank: true,
name: 'CTNNUM'
}, {
fieldLabel: '计划用箱日期',
format: 'Y-m-d',
allowBlank: true,
flex: 1,
xtype: 'datefield',
name: 'PLANCTNDATE'
}, this.comboxCustCodeFactryM, {
fieldLabel: '是否我司订舱',
inputValue: true,
xtype: 'checkboxfield',
name: 'ISOWNERBOOKING'
}]
}, {
xtype: 'container',
layout: 'hbox',
flex: 1,
defaultType: 'textfield',
items: [{
fieldLabel: '起运港免箱使天数',
labelWidth: 110, name: 'SLOAD_FREE_USECTNE_DAY'
}, {
fieldLabel: '起运港超期箱使费',
labelWidth: 110, name: 'SLOAD_OVER_USECTNE_RATE'
}, {
fieldLabel: '目的港免箱使天数',
labelWidth: 110, name: 'SDEST_FREE_USECTNE_DAY'
}, {
fieldLabel: '目的港超期箱使费',
labelWidth: 110, name: 'SDEST_OVER_USECTNE_RATE'
}, {
fieldLabel: '目的港代理',
readOnly: true,
name: 'AGENTNAME'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '工厂地址',
flex: 2, name: 'FACTORYADDR'
}, {
fieldLabel: '申请状态',
readOnly: true,
name: 'BSSTATUS'
}, {
fieldLabel: '录入人',
readOnly: true,
disabled: true,
name: 'INPUTBYREF'
}, {
fieldLabel: '录入日期',
readOnly: true,
disabled: true,
name: 'INPUTTIME'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxSERVICE2
,{
fieldLabel: '是否加热',
flex: 1,
inputValue: true,
xtype: 'checkboxfield',
name: 'NEEDBEHEATED'
}, {
fieldLabel: '重量',
flex: 1,
xtype: 'numberfield',
allowDecimals: true, //允许输入小数
decimalPrecision: 3,
name: 'WEIGHT'
}, {
fieldLabel: '预计开船日期',
format: 'Y-m-d',
allowBlank: true,
flex: 1,
xtype: 'datefield',
name: 'PREI_ETD'
}, {
fieldLabel: '空箱调拨',
flex: 1,
inputValue: true,
xtype: 'checkboxfield',
name: 'EMPTYCTNALLOCATION'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '按进港日计算超期箱使',
inputValue: true,
labelWidth: 140,
xtype: 'checkboxfield',
name: 'ISPORTLOADDATE'
}, {
fieldLabel: '备注',
flex: 4,
name: 'REMARKS'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '修改原因',
flex: 4,
name: 'REASON'
}]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}); //end this.formEdit
this.winShenModifyShow = Ext.create('Ext.window.Window', {
title: "申请修改",
width: 980,
height: 305,
//plain : true,
layout: "border",
iconCls: "addicon",
resizable: false,
// 是否可以拖动
// draggable:false,
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
items: [this.formMDEdit],
buttons: [{
text: "确认修改",
minWidth: 70,
handler: function () {
_this.onShenModifyClickfn();
}
}, {
text: "关闭",
minWidth: 70,
handler: function () {
_this.winShenModifyShow.close();
}
}]
});
this.formMDDel = Ext.widget('form', {
region: 'north',
frame: true,
bodyPadding: 5,
// autoScroll: true,
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: 'GID',
name: 'GID', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'APPLYID',
name: 'APPLYID', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'MODIFYTYPE',
name: 'MODIFYTYPE', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'COMPANYID',
name: 'COMPANYID', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'INPUTBY',
name: 'INPUTBY', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'PH',
hidden: true,
name: 'PH'
}, {
fieldLabel: 'DENSITY',
hidden: true,
name: 'DENSITY'
}, {
fieldLabel: 'UNNO',
hidden: true,
name: 'UNNO'
}, {
fieldLabel: 'DCLASS',
hidden: true,
name: 'DCLASS'
}, {
fieldLabel: 'SDCLASS',
hidden: true,
name: 'SDCLASS'
}, {
fieldLabel: 'PACKINGGROUP',
hidden: true,
name: 'PACKINGGROUP'
}, {
fieldLabel: 'ISPOLLUTEOCEAN',
hidden: true,
name: 'ISPOLLUTEOCEAN'
}, {
fieldLabel: 'MELTINGPOINT',
hidden: true,
name: 'MELTINGPOINT'
}, {
fieldLabel: 'BOILINGPOINT',
hidden: true,
name: 'BOILINGPOINT'
}, {
fieldLabel: 'FLASHPOINT',
hidden: true,
name: 'FLASHPOINT'
}, {
fieldLabel: 'IMDG',
hidden: true,
name: 'IMDG'
}, {
fieldLabel: '申请编号',
labelWidth: 70,
readOnly: true,
hidden: true,
allowBlank: true,
name: 'BSNO'
}, {
fieldLabel: '申请日期',
readOnly: true,
hidden: true,
name: 'BSDATE'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '删除原因',
flex: 4,
name: 'REMARKS'
}]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}); //end this.formEdit
this.winShenDelShow = Ext.create('Ext.window.Window', {
title: "申请删除",
width: 600,
height: 160,
//plain : true,
layout: "border",
iconCls: "addicon",
resizable: false,
// 是否可以拖动
// draggable:false,
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
items: [this.formMDDel],
buttons: [{
text: "确认申请",
minWidth: 70,
handler: function () {
_this.onShenDelClickfn()
}
}, {
text: "关闭",
minWidth: 70,
handler: function () {
_this.winShenDelShow.close();
}
}]
});
//#endregion
//绑定事件
}, //end initUIComponents
InitData: function () {
this.opStatus = 'add';
var condition = '';
if (this.ParentWin) {
var ret = this.ParentWin.OprationSwap();
this.opStatus = ret[0];
this.StoreList = ret[1];
this.editRecord = ret[2];
}
if (this.opStatus == 'edit')
condition = " GID='" + this.editRecord.get('GID') + "'";
this.LoadData(this.opStatus, condition);
}, //end InitData
LoadData: function (opstatus, condition) {
this.serialNo = 0;
this.workSerialNo = 0;
this.bodyDel = [];
this.opStatus = opstatus;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcContainer/MsOpCtnApply/GetData',
params: {
handle: opstatus,
condition: condition
},
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;
}
var data = result.data;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(data);
this.formGoodsAudit.getForm().reset();
this.formGoodsAudit.getForm().setValues(data);
this.formCostAudit.getForm().reset();
this.formCostAudit.getForm().setValues(data);
var acondition = "";
if (this.opStatus == 'edit') {
var acondition = " BSNO='" + this.editRecord.get('GID') + "'";
_this.Loading = true;
_this.storeDocList.load({
params: { condition: acondition },
waitMsg: "正在查询数据...",
scope: this,
callback: function () {
_this.Loading = false;
}
});
acondition = " LINKGID='" + this.editRecord.get('GID') + "'";
}
else
acondition = " LINKGID='11111'";
this.storeBodyList.load({ params: { condition: acondition} });
this.storeBodyCostList.load({ params: { condition: acondition} });
this.storeBodyCostSum.load({ params: { condition: acondition} });
this.storeBodyCtnList.load({ params: { condition: acondition} });
this.GetEditStatus();
this.SetAuditForm();
document.title = MODULENAME + "-" + data.BSNO;
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}, // end LoadDate
SetAuditForm: function () {
var billstatus = this.formGoodsAudit.getForm().findField('AUDITSTATUS').getValue();
if (billstatus == '审核通过' || billstatus == '提交审核' || billstatus == '申请修改' || billstatus == '申请删除' || billstatus == '驳回申请修改' || billstatus == '驳回申请删除') {
SetFormReadOnly(this.formEdit, true);
} else {
SetFormReadOnly(this.formEdit, false);
}
},
Save: function (type) {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
basicForm.findField('GID').setDisabled(false);
var data = basicForm.getValues();
basicForm.findField('GID').setDisabled(true);
if (this.opStatus == 'add') {
data.GID = NewGuid();
}
var j = 0;
var bodydatas = [];
for (var i = 0; i < this.storeBodyList.getCount(); i += 1) {
var member = this.storeBodyList.getAt(i);
j = j + 1;
bodydatas.push(member);
}
// if (j == 0) {
// Ext.Msg.show({ title: '提示', msg: '改装要求不能为空,请先录入改装要求!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
// return;
// }
//
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcContainer/MsOpCtnApply/Save',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
body: jsonBody
},
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.formEdit.getForm().setValues(returnData);
this.formGoodsAudit.getForm().reset();
this.formGoodsAudit.getForm().setValues(returnData);
this.formCostAudit.getForm().reset();
this.formCostAudit.getForm().setValues(returnData);
if (this.opStatus == 'add') {
var arrNewRecords = this.StoreList.add(returnData);
this.editRecord = arrNewRecords[0];
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('MsOpCtnApply', returnData);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'id')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
}
if (type == '0') {
this.opStatus = 'edit';
basicForm.findField('GID').setDisabled(true);
for (var j = 0; j < this.storeBodyList.getCount(); j += 1) {
var memberbody = this.storeBodyList.getAt(j);
memberbody.set("LINKGID", this.editRecord.get('GID'));
memberbody.commit();
};
} else if (type == '1') {
this.opStatus = 'edit';
basicForm.findField('GID').setDisabled(true);
for (var j = 0; j < this.storeBodyList.getCount(); j += 1) {
var memberbody = this.storeBodyList.getAt(j);
memberbody.set("LINKGID", this.editRecord.get('GID'));
memberbody.commit();
};
window.close();
} else {
this.LoadData('add', '');
basicForm.findField('GID').setDisabled(false);
}
} 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
loadFactry: function () {
var GOODSNAME = this.formEdit.getForm().findField('GOODSNAME').getValue();
var goodnamestr = "";
if (GOODSNAME != '')
goodnamestr = " and MSDSID IN (SELECT GID FROM code_msds WHERE GOODNAME='" + GOODSNAME + "') "
var SALE = this.formEdit.getForm().findField('SALE').getValue();
var SALEstr = "";
if (SALE != '')
SALEstr = " and SALE='" + SALE + "' "
var s = " ISCONTROLLER='1' AND SHORTNAME IN (SELECT FACTORYNAME FROM code_msds_factry WHERE 1=1 " + SALEstr + goodnamestr + " ) ";
this.storeCustCodeFactry.load({ params: { condition: s} });
},
addDetail: function () {
// if (this.opStatus == "add") {
// Ext.Msg.show({ title: '提示', msg: '商品信息未保存,无法添加工厂信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
// return;
// }
var MSDSID = this.formEdit.getForm().findField('GID').getValue();
var SerialNo = this.GetHandleSerialNo(this.storeBodyList);
//var newSerialno = DsGetNewSerialNo(this.storeBodyList, this.serialNo);
var record = Ext.create('MsOpCtnApplySaleItems', {
GID: NewGuid(),
LINKGID: '*',
ITEMSNO: SerialNo,
ITEMNAME: '',
REMARKS: ''
});
this.storeBodyList.add(record);
var n = this.storeBodyList.getCount();
this.gridListCellEditing.startEditByPosition({ row: n - 1, column: 1 });
},
GetHandleSerialNo: function (store) {
var result = 0;
if (result == 0) {
for (var i = 0; i < store.getCount(); i += 1) {
var member = store.getAt(i);
if (parseInt(member.data.ITEMSNO) > parseInt(result)) {
result = member.data.ITEMSNO;
}
}
}
result = parseInt(result) + 1;
return result;
},
gridListAfterEdit: function (editor, e, eOpts) {
if (e.value == e.originalValue) return;
if (e.field == 'REJECTID') {
}
},
onDeletePriceItemsClick: function () {
var selections = this.gridListBody.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要删除的工厂信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
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/DeleteOpCtnApplySaleItems',
params: {
data: jsonbodyAddDatas
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var acondition = " LINKGID='" + this.editRecord.get('GID') + "'";
this.storeBodyList.load({ params: { condition: acondition} });
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);
},
onSubmitAuditClick: function () {
var Duino = this.formEdit.getForm().findField('BSNO').getValue();
var GID = this.formEdit.getForm().findField('GID').getValue();
var billstatus = this.formGoodsAudit.getForm().findField('AUDITSTATUS').getValue();
if (Duino == '*') {
Ext.Msg.show({ title: '提示', msg: '请先保存此申请,然后才能提交审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
if ((billstatus != '未提交') && (billstatus != '驳回提交') && (billstatus != '驳回申请修改') && (billstatus != '驳回申请删除') && (billstatus != '')) {
Ext.Msg.show({ title: '提示', msg: '当前状态无法提交审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
_this = this;
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/MvcContainer/MsOpCtnApply/SubmitGoodsAudit',
params: {
bill: GID
},
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 {
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcContainer/MsOpCtnApply/GetData',
params: {
handle: 'edit',
condition: " GID='" + GID + "'"
},
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;
}
var data = result.data;
_this.formEdit.getForm().reset();
_this.formEdit.getForm().setValues(data);
this.formGoodsAudit.getForm().reset();
this.formGoodsAudit.getForm().setValues(data);
this.formCostAudit.getForm().reset();
this.formCostAudit.getForm().setValues(data);
var editp = Ext.create('MsOpCtnApply', data);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'id')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
this.GetEditStatus();
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onSubmitAuditBackClick: function () {
var Duino = this.formEdit.getForm().findField('BSNO').getValue();
var GID = this.formEdit.getForm().findField('GID').getValue();
var billstatus = this.formGoodsAudit.getForm().findField('AUDITSTATUS').getValue();
if (Duino == '*') {
Ext.Msg.show({ title: '提示', msg: '请先保存申请,然后才能提交审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
if (billstatus != '提交审核') {
Ext.Msg.show({ title: '提示', msg: '当前状态无法撤销提交!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
_this = this;
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/MvcContainer/MsOpCtnApply/SubmitGoodsAuditBack',
params: {
bill: GID
},
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 {
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcContainer/MsOpCtnApply/GetData',
params: {
handle: 'edit',
condition: " GID='" + GID + "'"
},
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;
}
var data = result.data;
_this.formEdit.getForm().reset();
_this.formEdit.getForm().setValues(data);
this.formGoodsAudit.getForm().reset();
this.formGoodsAudit.getForm().setValues(data);
this.formCostAudit.getForm().reset();
this.formCostAudit.getForm().setValues(data);
var editp = Ext.create('MsOpCtnApply', data);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'id')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
this.GetEditStatus();
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onShenModifyClick: function () {
var Duino = this.formEdit.getForm().findField('BSNO').getValue();
var GID = this.formEdit.getForm().findField('GID').getValue();
var billstatus = this.formGoodsAudit.getForm().findField('AUDITSTATUS').getValue();
if (Duino == '*') {
Ext.Msg.show({ title: '提示', msg: '请先保存此申请!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
if ((billstatus != '审核通过')) {
Ext.Msg.show({ title: '提示', msg: '当前状态无法申请修改!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
this.formMDEdit.getForm().loadRecord(this.editRecord);
this.winShenModifyShow.show();
},
onShenModifyClickfn: function () {
var basicForm = this.formMDEdit.getForm();
if (!basicForm.isValid()) {
return;
}
basicForm.findField('GID').setDisabled(false);
var data = basicForm.getValues();
basicForm.findField('GID').setDisabled(true);
_this = this;
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/MvcContainer/MsOpCtnApply/ShenModifyDel',
params: {
type: '1',
data: Ext.JSON.encode(data)
},
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 {
var data = result.Data;
_this.formEdit.getForm().reset();
_this.formEdit.getForm().setValues(data);
this.formGoodsAudit.getForm().reset();
this.formGoodsAudit.getForm().setValues(data);
this.formCostAudit.getForm().reset();
this.formCostAudit.getForm().setValues(data);
var editp = Ext.create('MsOpCtnApply', data);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'id')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
this.GetEditStatus();
_this.winShenModifyShow.close();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onShenDeleteClick: function () {
var Duino = this.formEdit.getForm().findField('BSNO').getValue();
var GID = this.formEdit.getForm().findField('GID').getValue();
var billstatus = this.formGoodsAudit.getForm().findField('AUDITSTATUS').getValue();
if (Duino == '*') {
Ext.Msg.show({ title: '提示', msg: '请先保存此申请!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
if ((billstatus != '审核通过')) {
Ext.Msg.show({ title: '提示', msg: '当前状态无法申请删除!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
this.formMDDel.getForm().loadRecord(this.editRecord);
this.formMDDel.getForm().findField('REMARKS').setValue('');
this.winShenDelShow.show();
},
onShenDelClickfn: function () {
var basicForm = this.formMDDel.getForm();
if (!basicForm.isValid()) {
return;
}
basicForm.findField('GID').setDisabled(false);
var data = basicForm.getValues();
basicForm.findField('GID').setDisabled(true);
_this = this;
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/MvcContainer/MsOpCtnApply/ShenModifyDel',
params: {
type: '4',
data: Ext.JSON.encode(data)
},
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 {
var data = result.Data;
_this.formEdit.getForm().reset();
_this.formEdit.getForm().setValues(data);
this.formGoodsAudit.getForm().reset();
this.formGoodsAudit.getForm().setValues(data);
this.formCostAudit.getForm().reset();
this.formCostAudit.getForm().setValues(data);
var editp = Ext.create('MsOpCtnApply', data);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'id')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
this.GetEditStatus();
_this.winShenDelShow.close();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onShenModifyDelCancelClick: function (type) {
var Duino = this.formEdit.getForm().findField('BSNO').getValue();
var GID = this.formEdit.getForm().findField('GID').getValue();
var billstatus = this.formGoodsAudit.getForm().findField('AUDITSTATUS').getValue();
if (Duino == '*') {
Ext.Msg.show({ title: '提示', msg: '请先保存此申请,然后才能提交审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
if (type == '0') {
if ((billstatus != '申请修改')) {
Ext.Msg.show({ title: '提示', msg: '当前状态无法撤销申请修改!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
} else if (type == '3') {
if ((billstatus != '申请删除')) {
Ext.Msg.show({ title: '提示', msg: '当前状态无法撤销申请删除!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
}
_this = this;
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/MvcContainer/MsOpCtnApply/ShenModifyDelCancel',
params: {
GID: GID,
type: type
},
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 {
var data = result.Data;
_this.formEdit.getForm().reset();
_this.formEdit.getForm().setValues(data);
this.formGoodsAudit.getForm().reset();
this.formGoodsAudit.getForm().setValues(data);
this.formCostAudit.getForm().reset();
this.formCostAudit.getForm().setValues(data);
var editp = Ext.create('MsOpCtnApply', data);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'id')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
this.GetEditStatus();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
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("GID");
var custno = 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: custno,
BSNO: billno
},
success: function (form, action) {
win.close(this);
Ext.Msg.show({ title: '提示', msg: '上传成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
var condition = billno;
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('警告', '上传过程中出现错误!');
}
});
}
}, {
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
PrevRecord: function () {
var modifystr = this.getIsModify();
if (modifystr != "") {
Ext.Msg.show({ title: '警告', msg: modifystr + '未保存,如果离开此页,将丢失未保存的更改 ', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
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;
}
var condition = '';
j = j - 1;
this.editRecord = this.StoreList.getAt(j);
if (this.opStatus == 'edit') {
condition = "GID='" + this.editRecord.get('GID') + "'";
//this.storeBodyList.load({ params: { condition: condition} });
}
this.LoadData(this.opStatus, condition);
},
// #region 编辑时按钮等的状态
GetEditStatus: function () {
var canedit = false;
var op = this.formEdit.getForm().findField('INPUTBY').getValue();
var modustr = "modOpCtnApply";
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpIDRang' }
});
_this = this;
this.StoreOpRange.load({ params: { optype: modustr },
callback: function (r, options, success) {
if (success) {
if (r.length != 0) {
var records = DsStoreQueryBy(_this.StoreOpRange, 'OPID', op);
if (records.getCount() > 0) {
canedit = true;
} else {
canedit = false;
}
} else { canedit = false; }
_this.setSaveBtnStatus(canedit);
}
}
});
},
setSaveBtnStatus: function (enable) {
var btnESave = Ext.getCmp('btnsave');
var btnESaveAndClose = Ext.getCmp('btnsaveandclose');
var btnESaveAndNew = Ext.getCmp('btnsaveandnew');
var btnECopyAndNew = Ext.getCmp('btncopyandsave');
var btnSubmitAudit = Ext.getCmp('btnSubmitAudit');
var btnSubmitAuditBack = Ext.getCmp('btnSubmitAuditBack');
var btnShenModify = Ext.getCmp('ShenModify');
if (enable) {
btnESave.enable();
btnESaveAndClose.enable();
btnESaveAndNew.enable();
// btnECopyAndNew.enable();
// var billstatus = this.formGoodsAudit.getForm().findField('AUDITSTATUS').getValue();
// if ((billstatus != '未提交') && (billstatus != '驳回提交') && (billstatus != '')) {
// } else {
// }
btnSubmitAudit.enable();
btnSubmitAuditBack.enable();
btnShenModify.enable();
} else {
btnESave.disable();
btnESaveAndClose.disable();
btnESaveAndNew.disable();
// btnECopyAndNew.disable();
btnSubmitAudit.disable();
btnSubmitAuditBack.disable();
btnShenModify.disable();
}
},
//#endregion
NextRecord: function () {
var modifystr = this.getIsModify();
if (modifystr != "") {
Ext.Msg.show({ title: '警告', msg: modifystr + '未保存,如果离开此页,将丢失未保存的更改 ', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
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;
}
var condition = '';
j = j + 1;
this.editRecord = this.StoreList.getAt(j);
if (this.opStatus == 'edit') {
condition = "GID='" + this.editRecord.get('GID') + "'";
//this.storeBodyList.load({ params: { condition: condition} });
}
this.LoadData(this.opStatus, condition);
},
getIsModify: function () {
var drmodify = this.storeBodyList.getModifiedRecords();
if (drmodify.length != 0)
return '改装要求';
if (panelEdit.formEdit.getForm().isDirty() == true)
return '申请信息';
else return '';
} //
});