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.

2654 lines
100 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

//集运管理-路单查询
Ext.namespace('DsTruck');
DsTruck.ImportSyncIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.DsTruck.ImportSyncIndex.superclass.constructor.call(this);
};
Ext.extend(DsTruck.ImportSyncIndex, Ext.Panel, {
PageSize: 200,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
initUIComponents: function () {
this.editrecord = "";
this.isLoading = false;
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
model: 'ImportSyncmb',
remoteSort: true,
pageSize: this.PageSize,
proxy: {
type: 'ajax',
url: '/Import/ImportSync/GetDataList',
reader: {
idProperty: 'ContractNo',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.formname = "ImportSync";
this.initgirdcolums = [
{
sortable: true, hidden: true,
dataIndex: 'Local_ContractNo',
header: '代理商序列号',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'ContractNo',
header: 'ContractNo',
width: 80
},
{
sortable: true,
dataIndex: 'HTHRef',
header: '本地合同号',
width: 80
},
{
sortable: true,
dataIndex: 'HTH',
header: '代理商合同号',
width: 80
},
{
sortable: true,
dataIndex: 'ContainerNo',
header: '箱号',
width: 80
},
{
sortable: true,
dataIndex: 'BillNo',
header: '提单号',
width: 80
},
{
sortable: true,
dataIndex: 'SealNo',
header: '铅封号',
width: 80
},
{
sortable: true,
dataIndex: 'Sailingdate',
header: '开船日',
width: 80
},
{
sortable: true,
dataIndex: 'ArrivalDate',
header: '到港日',
width: 80
},
{
sortable: true,
dataIndex: 'RecDate',
header: '回空日期',
width: 80
},
{
sortable: true,
dataIndex: 'tax_date',
header: '出税日期',
width: 80
},
{
sortable: true,
dataIndex: 'tax_paydate',
header: '付税日期',
width: 80
},
{
sortable: true,
dataIndex: 'ShipCompany_id',
header: '船公司',
width: 80
},
{
sortable: true,
dataIndex: 'Vessel',
header: '船名',
width: 80
},
{
sortable: true,
dataIndex: 'Voyage',
header: '航次',
width: 80
},
{
sortable: true,
dataIndex: 'Ex_sailingdate',
header: '预计开船日',
width: 80
},
{
sortable: true,
dataIndex: 'Sampling_need',
header: '海关是否抽检',
width: 80
},
{
sortable: true,
dataIndex: 'SamplingDate_Act',
header: '海关抽检日期',
width: 80
},
{
sortable: true,
dataIndex: 'CustomsReleaseDate',
header: '海关放行日期',
width: 80
},
{
sortable: true,
dataIndex: 'PortDays',
header: '港口天数',
width: 80
},
{
sortable: true,
dataIndex: 'inspection_date',
header: '商检验货日期',
width: 80
},
{
sortable: true,
dataIndex: 'ReceiveDate',
header: '接收日期',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'Received',
header: 'Received',
width: 80
},
{
sortable: true,
dataIndex: 'ReceivedRed',
header: '已接收',
width: 80
}
];
this.girdcolums = this.initgirdcolums;
this.MainCB = Ext.create('Ext.selection.CheckboxModel');
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 35
});
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
layout: "border",
region: 'center',
selModel: this.MainCB,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
viewConfig: {
enableTextSelection: true,
getRowClass: function (record, rowIndex, rowParams, store) {
var feeStatus = record.get('Received');
return DsTruck.ReceivedRowClass(feeStatus);
}
},
columns: this.girdcolums,
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
/////////////以下部分为获取存储的gridpanel显示样式
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums);
//使用者id表名 中间column数组
this.girdcolums.unshift(new Ext.grid.RowNumberer());
this.gridList.reconfigure(this.storeList, this.girdcolums);
////////////////////////////
this.storeSync = Ext.create('Ext.data.Store', {
model: 'Syncmb',
remoteSort: true,
pageSize: this.PageSize,
proxy: {
type: 'ajax',
url: '/Import/ImportSync/GetSync',
reader: {
idProperty: 'ContractNo',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeHTH = Ext.create('DsExt.ux.RefTableStore', {
model: 'HTHmb',
proxy: { url: '/Import/ImportSync/GetHTH' }
});
var _this = this;
this.storeHTH.load({
callback: function (options, success, response) {
var p = {
HTH: '',
ContractNo: ''
};
_this.storeHTH.insert(0, p);
/*
if (success) {
this.storeHTH.data.unshift({"",""});
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
*/
}
});
this.comboxHTH = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '本地合同号', id: "Local_ContractNo",
forceSelection: true,
store: this.storeHTH,
name: 'LocalContractNo',
valueField: 'ContractNo',
displayField: 'HTH'
});
this.MainCB = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true });
this.formSyncInfo = Ext.widget('form', {
frame: true,
region: "north",
bodyPadding: 3,
height: 70,
width: 300,
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: [
{
xtype: 'textfield', id: "ContractNo", hidden: true,
fieldLabel: '代理商合同序列号',
name: 'ContractNo' //flex: 2
},
{
xtype: 'textfield', id: "HTH",
fieldLabel: '代理商合同号',
name: 'HTH' //flex: 2
}
//,{xtype:'hiddenfield'}
, {
xtype: 'button',
text: "进行对照",
tooltip: "用指定的本地业务与选定业务进行对照",
handler: function (button, event) {
Local_ContractNo = Ext.getCmp("Local_ContractNo").getValue();
ContractNo = Ext.getCmp("ContractNo").getValue();
//alert(ContractNo+"_"+Local_ContractNo)
this.onSyncClick(ContractNo, Local_ContractNo);
},
scope: this
}
]
}]
}
, {//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
this.comboxHTH
//,{xtype:'hiddenfield'}
, {
xtype: 'button',
text: "同步选定",
tooltip: "将选中值同步至本地",
handler: function (button, event) {
this.onSaveSync(Ext.getCmp("ContractNo").getValue(), Ext.getCmp("Local_ContractNo").getValue());
},
scope: this
}
]
}]
}
]//end root items
});
this.gridSyncList = new Ext.grid.GridPanel({
store: this.storeSync,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.MainCB,
viewConfig: {
enableTextSelection: true,
autoFill: true,
getRowClass: function (record, rowIndex, rowParams, store) {
var feeStatus = record.get('isSame');
return DsTruck.isSameRowClass(feeStatus);
}
},
columns: [
{
sortable: true,
dataIndex: 'FieldName',
header: '字段名',
width: 80
}, {
sortable: true, hidden: true,
dataIndex: 'Field',
header: 'Field',
width: 80
},
{
sortable: true,
dataIndex: 'NewValueRef',
header: '代理商信息',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'NewValue',
header: 'NewValue',
width: 80
},
{
sortable: true,
dataIndex: 'OldValue',
header: '本地信息',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'isSame',
header: 'isSame',
width: 80
}
]
});
//#region
this.storeport = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeport.load({ params: { enumTypeId: 10} });
this.comboxport = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '目的港',
forceSelection: true,
store: this.storeport,
name: 'port',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.OnClickXML();
}
}
}
});
this.storeCountry = Ext.create('DsExt.ux.RefTableStore', {
model: 'ConutryRef',
proxy: { url: '/CommMng/BasicDataRef/GetCountryRefList' }
});
this.storeCountry.load({ params: { condition: ""} });
this.comboxCountry = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '进口国',
store: this.storeCountry,
name: 'countryid',
valueField: 'countryid',
displayField: 'country_idandname',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.OnClickXML();
}
}
}
});
//#endregion
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
this.comboxport
, this.comboxCountry
, {
fieldLabel: '合同号/提单号',
name: 'HTH',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.OnClickXML();
}
}
}
}
, {
fieldLabel: '箱号/封号',
name: 'ContainerNo',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.OnClickXML();
}
}
}
}
, {
fieldLabel: '报关号/报检号',
name: 'BGBJ',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.OnClickXML();
}
}
}
}, {
xtype:'hiddenfield'
}
]
}, {//fieldset 2
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '从..到港日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ArrivalDate_min',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.OnClickXML();
}
}
}
}, {
fieldLabel: '到..到港日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ArrivalDate_max',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.OnClickXML();
}
}
}
}, {
fieldLabel: '从..接单日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'creattime_min',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.OnClickXML();
}
}
}
}, {
fieldLabel: '到..接单日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'creattime_max',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.OnClickXML();
}
}
}
}, , {
fieldLabel: '从..分公司接单日',
format: 'Y-m-d', labelWidth: 110,
xtype: 'datefield',
name: 'createtime_2_min',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.OnClickXML();
}
}
}
}, {
fieldLabel: '到..分公司接单日',
format: 'Y-m-d', labelWidth: 110,
xtype: 'datefield',
name: 'createtime_2_max',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.OnClickXML();
}
}
}
}]
}]
}, {//fieldset 3
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
]
}]
} //end items(fieldset 3)
, {//fieldset 4
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
]
}]
}
]
}
]//end root items
});
//查询工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
},
{
text: "获取业务信息",
id: "helloworld",
handler: function (button, event) {
this.OnClickXML();
},
scope: this
}, {
text: "导出Excel",
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(button, event);
},
scope: this
}, '-', {
text: "保存列表样式",
id: "btntest",
menu: [
{ text: "保存",
handler: function (button, event) {
this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.girdcolums, 1, true);
}
}, { text: "初始化",
handler: function (menu, event) {
//_this.InitGrid(_this.initgirdcolums);
_this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.initgirdcolums, 1, true);
}
}],
scope: this
}, '-', {
text: "将所有未同步业务生成至本地(同时生成商品费用)",
id: "btnMakeAllImport",
iconCls: 'btnadd',
handler: function (button, event) {
this.onMakeAllImportClick();
},
scope: this
}, {
text: "将所有选定业务生成至本地",hidden:true,
id: "btnMakeImport",
iconCls: 'btnadd',
handler: function (button, event) {
this.onMakeImportClick("0");
},
scope: this
}, {
text: "将所有选定业务生成至本地(同时生成商品费用)",
id: "btnMakeImportFee",
iconCls: 'btnadd',
handler: function (button, event) {
this.onMakeImportClick("1");
},
scope: this
}
]
});
//选择load
this.gridList.getSelectionModel().on('select', function (model, record, index) {
if (this.isLoading == true) {
return;
}
var ContractNo = record.data.ContractNo;
var HTH = record.data.HTH;
this.editrecord = record;
var Local_ContractNo = record.data.Local_ContractNo;
//alert(ContractNo + "_" + Local_ContractNo);
Ext.getCmp("ContractNo").setValue(ContractNo);
Ext.getCmp("HTH").setValue(HTH);
Ext.getCmp("Local_ContractNo").setValue(Local_ContractNo);
if (ContractNo != "" && Local_ContractNo != "") {
this.onSyncClick(ContractNo, Local_ContractNo);
}
this.storeChFee_Pub.load({
params: { BSNO: ContractNo },
waitMsg: "正在查询数据...",
scope: this
});
if (Local_ContractNo == "") {
this.storeChFee_Local.removeAll();
this.storeSync.removeAll();
} else
this.storeChFee_Local.load({
params: { BSNO: Local_ContractNo },
waitMsg: "正在查询数据...",
scope: this
});
var condition = " BSNO='" + ContractNo + "'";
this.storeDocPubList.load({
params: { condition: condition },
waitMsg: "正在查询数据...",
scope: this,
callback: function () {
}
});
//var condition = ContractNo ;
this.storeCargoPubList.load({
params: { ContractNo: ContractNo },
waitMsg: "正在查询数据...",
scope: this,
callback: function () {
}
});
this.storeCargo_Local.load({
params: { ContractNo: Local_ContractNo },
waitMsg: "正在查询数据...",
scope: this,
callback: function () {
}
});
}, this);
//#region 费用比对
this.storeChFee_Pub = Ext.create('Ext.data.Store', {
model: 'FeeSyncmb',
remoteSort: false,
pageSize: this.PageSize,
proxy: {
type: 'ajax',
url: '/Import/ImportSync/GetChFee_Pub',
reader: {
idProperty: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.ChFee_PubCB = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true });
this.gridChFee_Pub = new Ext.grid.GridPanel({
store: this.storeChFee_Pub,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.ChFee_PubCB,
viewConfig: {
enableTextSelection: true,
autoFill: true
},
columns: [
{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'BSNO',
header: 'BSNO',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'HTH',
header: '代理合同号',
width: 80
},
{
sortable: true, //hidden: true,
dataIndex: 'CUSTOMERNAME',
header: '结算对象',
width: 80
},
{
sortable: true,
dataIndex: 'FEETYPERef',
header: '收付类型',
width: 40
},
{
sortable: true,
dataIndex: 'FEENAME',
header: '费用名称',
width: 80
},
{
sortable: true,
dataIndex: 'UNITPRICE',
header: '单价',
width: 80
},
{
sortable: true,
dataIndex: 'QUANTITY',
header: '数量',
width: 80
},
{
sortable: true,
dataIndex: 'AMOUNT',
header: '金额',
width: 80
},
{
sortable: true,
dataIndex: 'CURRENCY',
header: '币别',
width: 35
},
{
sortable: true,
dataIndex: 'EXCHANGERATE',
header: '汇率',
width: 55
},
{
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 160
},
{
sortable: true,
dataIndex: 'SETTLEMENT',
header: '结算金额',
width: 80
},
{
sortable: true,
dataIndex: 'SETTLEDATE',
header: '结算时间',
width: 100
}
]
});
this.storeChFee_Local = Ext.create('Ext.data.Store', {
model: 'FeeSyncmb',
remoteSort: false,
pageSize: this.PageSize,
proxy: {
type: 'ajax',
url: '/Import/ImportSync/GetChFee_Local',
reader: {
idProperty: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.ChFee_LocalCB = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true });
this.gridChFee_Local = new Ext.grid.GridPanel({
store: this.storeChFee_Local,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.ChFee_LocalCB,
viewConfig: {
enableTextSelection: true,
autoFill: true
},
columns: [
{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'BSNO',
header: 'BSNO',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'HTH',
header: '本地合同号',
width: 80
},
{
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '结算对象',
width: 80
},
{
sortable: true,
dataIndex: 'FEETYPERef',
header: '收付类型',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'FEESTATUS',
header: 'FEESTATUS',
width: 80
},
{
sortable: true,
dataIndex: 'FEESTATUS_REF',
header: '费用状态',
width: 80
},
{
sortable: true,
dataIndex: 'FEENAME',
header: '费用名称',
width: 80
},
{
sortable: true,
dataIndex: 'UNITPRICE',
header: '单价',
width: 80
},
{
sortable: true,
dataIndex: 'QUANTITY',
header: '数量',
width: 80
},
{
sortable: true,
dataIndex: 'AMOUNT',
header: '金额',
width: 80
},
{
sortable: true,
dataIndex: 'CURRENCY',
header: '币别',
width: 80
},
{
sortable: true,
dataIndex: 'EXCHANGERATE',
header: '汇率',
width: 80
},
{
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 160
},
{
sortable: true,
dataIndex: 'SETTLEMENT',
header: '已结算',
width: 80
}
]
});
//#endregion
//#region 商品信息比对
this.storeCargoPubList = Ext.create('Ext.data.Store', {
model: 'CargoSyncmb',
remoteSort: false,
pageSize: this.PageSize,
proxy: {
type: 'ajax',
url: '/Import/ImportSync/GetCargoPubList',
reader: {
idProperty: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.CargoPubCB = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true });
this.gridCargoPubList = new Ext.grid.GridPanel({
store: this.storeCargoPubList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.CargoPubCB,
viewConfig: {
enableTextSelection: true,
autoFill: true
},
columns: [
{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'ContractNo',
header: 'ContractNo',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'cargoinfo_id',
header: 'cargoinfo_id',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'cargociq_id',
header: 'cargociq_id',
width: 80
},
{
sortable: true,
dataIndex: 'Name',
header: '标签品名',
width: 80
},
{
sortable: true,
dataIndex: 'Ename',
header: '英文品名',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'UNIT',
header: 'UNIT',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'U_PRICE',
header: 'U_PRICE',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'U_weight',
header: 'U_weight',
width: 80
},
{
sortable: true,
dataIndex: 'weight',
header: '净重(kg)',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'm_weight',
header: 'm_weight',
width: 80
},
{
sortable: true,
dataIndex: 'price',
header: '单价',
width: 80
},
{
sortable: true,
dataIndex: 'price_limit',
header: '限价',
width: 80
},
{
sortable: true,
dataIndex: 'Amount',
header: '合同金额',
width: 80
},
{
sortable: true,
dataIndex: 'tax_Amount',
header: '完税价格',
width: 80
},
{
sortable: true,
dataIndex: 'BoxCount',
header: '箱件数',
width: 80
},
{
sortable: true,
dataIndex: 'BoxWeight',
header: '箱件重量',
width: 80
},
{
sortable: true,
dataIndex: 'Exporter',
header: '出口商',
width: 80
},
{
sortable: true,
dataIndex: 'FactoryNo',
header: '厂号',
width: 80
},
{
sortable: true,
dataIndex: 'Productiondate',
header: '生产日期',
width: 80
},
{
sortable: true,
dataIndex: 'currid',
header: '币别',
width: 80
},
{
sortable: true,
dataIndex: 'prepayments',
header: '预付款',
width: 80
},
{
sortable: true,
dataIndex: 'balance',
header: '尾款',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'paypart',
header: 'paypart',
width: 80
},
{
sortable: true,
dataIndex: 'baolv',
header: '保率',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'tariff',
header: 'tariff',
width: 80
},
{
sortable: true,
dataIndex: 'tax',
header: '关税税率',
width: 80
},
{
sortable: true,
dataIndex: 'tax_zz',
header: '增值税税率',
width: 80
},
{
sortable: true,
dataIndex: 'tax_1',
header: '关税',
width: 80
},
{
sortable: true,
dataIndex: 'tax_zz_1',
header: '增值税',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'Declarenumber',
header: 'Declarenumber',
width: 80
},
{
sortable: true,
dataIndex: 'Exchangerate',
header: '汇率',
width: 80
},
{
sortable: true,
dataIndex: 'Exchangerate_Customs',
header: '海关汇率',
width: 80
},
{
sortable: true,
dataIndex: 'PreProportion',
header: '预付比例',
width: 80
},
{
sortable: true,
dataIndex: 'Amount_Writeoffs',
header: '备案金额',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'sequence',
header: 'sequence',
width: 80
},
{
sortable: true,
dataIndex: 'SBYS',
header: '申报要素',
width: 80
},
{
sortable: true,
dataIndex: 'BZTCHNO',
header: '批次号',
width: 80
},
{
sortable: true,
dataIndex: 'CargoType',
header: '货物类型',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'KINDPKGS',
header: 'KINDPKGS',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'Weight_Act',
header: 'Weight_Act',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'BoxCount_Act',
header: 'BoxCount_Act',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'ExpirationDate',
header: 'ExpirationDate',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'AGENCRATE',
header: 'AGENCRATE',
width: 80
},
{
sortable: true,
dataIndex: 'MOREORLESS',
header: '溢短装重量',
width: 80
},
{
sortable: true,
dataIndex: 'Remark',
header: '备注',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'SPECIFICATIONS',
header: 'SPECIFICATIONS',
width: 80
},
{
sortable: true,
dataIndex: 'cicodeandname',
header: 'HS代码',
width: 80
},
{
sortable: true,
dataIndex: 'ciqcodeandname',
header: 'CIQ代码',
width: 80
}
]
});
this.storeCargo_Local = Ext.create('Ext.data.Store', {
model: 'CargoSyncmb',
remoteSort: false,
pageSize: this.PageSize,
proxy: {
type: 'ajax',
url: '/Import/ImportSync/GetCargoLocalList',
reader: {
idProperty: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.Cargo_LocalCB = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true });
this.gridCargo_Local = new Ext.grid.GridPanel({
store: this.storeCargo_Local,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.Cargo_LocalCB,
viewConfig: {
enableTextSelection: true,
autoFill: true
},
columns: [
{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'ContractNo',
header: 'ContractNo',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'cargoinfo_id',
header: 'cargoinfo_id',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'cargociq_id',
header: 'cargociq_id',
width: 80
},
{
sortable: true,
dataIndex: 'Name',
header: '标签品名',
width: 80
},
{
sortable: true,
dataIndex: 'Ename',
header: '英文品名',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'UNIT',
header: 'UNIT',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'U_PRICE',
header: 'U_PRICE',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'U_weight',
header: 'U_weight',
width: 80
},
{
sortable: true,
dataIndex: 'weight',
header: '净重(kg)',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'm_weight',
header: 'm_weight',
width: 80
},
{
sortable: true,
dataIndex: 'price',
header: '单价',
width: 80
},
{
sortable: true,
dataIndex: 'price_limit',
header: '限价',
width: 80
},
{
sortable: true,
dataIndex: 'Amount',
header: '合同金额',
width: 80
},
{
sortable: true,
dataIndex: 'tax_Amount',
header: '完税价格',
width: 80
},
{
sortable: true,
dataIndex: 'BoxCount',
header: '箱件数',
width: 80
},
{
sortable: true,
dataIndex: 'BoxWeight',
header: '箱件重量',
width: 80
},
{
sortable: true,
dataIndex: 'Exporter',
header: '出口商',
width: 80
},
{
sortable: true,
dataIndex: 'FactoryNo',
header: '厂号',
width: 80
},
{
sortable: true,
dataIndex: 'Productiondate',
header: '生产日期',
width: 80
},
{
sortable: true,
dataIndex: 'currid',
header: '币别',
width: 80
},
{
sortable: true,
dataIndex: 'prepayments',
header: '预付款',
width: 80
},
{
sortable: true,
dataIndex: 'balance',
header: '尾款',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'paypart',
header: 'paypart',
width: 80
},
{
sortable: true,
dataIndex: 'baolv',
header: '保率',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'tariff',
header: 'tariff',
width: 80
},
{
sortable: true,
dataIndex: 'tax',
header: '关税税率',
width: 80
},
{
sortable: true,
dataIndex: 'tax_zz',
header: '增值税税率',
width: 80
},
{
sortable: true,
dataIndex: 'tax_1',
header: '关税',
width: 80
},
{
sortable: true,
dataIndex: 'tax_zz_1',
header: '增值税',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'Declarenumber',
header: 'Declarenumber',
width: 80
},
{
sortable: true,
dataIndex: 'Exchangerate',
header: '汇率',
width: 80
},
{
sortable: true,
dataIndex: 'Exchangerate_Customs',
header: '海关汇率',
width: 80
},
{
sortable: true,
dataIndex: 'PreProportion',
header: '预付比例',
width: 80
},
{
sortable: true,
dataIndex: 'Amount_Writeoffs',
header: '备案金额',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'sequence',
header: 'sequence',
width: 80
},
{
sortable: true,
dataIndex: 'SBYS',
header: '申报要素',
width: 80
},
{
sortable: true,
dataIndex: 'BZTCHNO',
header: '批次号',
width: 80
},
{
sortable: true,
dataIndex: 'CargoType',
header: '货物类型',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'KINDPKGS',
header: 'KINDPKGS',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'Weight_Act',
header: 'Weight_Act',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'BoxCount_Act',
header: 'BoxCount_Act',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'ExpirationDate',
header: 'ExpirationDate',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'AGENCRATE',
header: 'AGENCRATE',
width: 80
},
{
sortable: true,
dataIndex: 'MOREORLESS',
header: '溢短装重量',
width: 80
},
{
sortable: true,
dataIndex: 'Remark',
header: '备注',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'SPECIFICATIONS',
header: 'SPECIFICATIONS',
width: 80
},
{
sortable: true,
dataIndex: 'cicodeandname',
header: 'HS代码',
width: 80
},
{
sortable: true,
dataIndex: 'ciqcodeandname',
header: 'CIQ代码',
width: 80
}
]
});
//#endregion
//#region 左下的公开单据列表
this.storeDocPubList = Ext.create('Ext.data.Store', {
model: 'DocPubmb',
remoteSort: true,
pageSize: this.PageSize,
proxy: {
type: 'ajax',
url: '/Import/ReceiptDoc/GetDocPubList',
reader: {
idProperty: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.gridDocPubList = new Ext.grid.GridPanel({
store: this.storeDocPubList,
enableHdMenu: false,
region: 'center',
height: 300,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
autoScroll: true,
viewConfig: {
enableTextSelection: true
},
columns: [
{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
},
{
sortable: true,
dataIndex: 'RECEIPTTYPE',
header: '单据文档类型',
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,
editor: {
xtype: 'textfield'
}
},
{
sortable: true, hidden: true,
dataIndex: 'Driect_URL',
header: 'Driect_URL',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'MODIFIEDUSER',
header: 'MODIFIEDUSER',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'MODIFIEDUSERRef',
header: '修改人',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'MODIFIEDTIME',
header: '修改时间',
width: 85
}
]
});
//#endregion
//布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 100,
items: [this.formSearch, this.panelBtn]
});
this.panelgridList = new Ext.Panel({
// 左边的左边 合同信息
layout: "border",
region: 'west',
margin: '0 0',
width: 450,
split: true,
items: [this.gridList]
});
this.panelSync = new Ext.Panel({
//左边的中上 字段选择和合同选择
layout: "border",
region: 'center',
margin: '0 0',
//height: 450,
width: 230,
split: true,
items: [this.formSyncInfo, this.gridSyncList]
});
this.panelDocPubList = new Ext.Panel({
//左边的中下,单据列表
layout: "border",
region: 'south',
margin: '0 0',
height: 260, //width: 450,
split: true,
items: [this.gridDocPubList]
});
this.panelLeftCenter = new Ext.Panel({
//左边的中间
layout: "border",
region: 'center',
margin: '0 0',
height: 550, //width: 450,
split: true,
items: [this.panelSync, this.panelDocPubList]
});
this.panelLeft = new Ext.Panel({
// 左边
layout: "border",
region: 'west',
margin: '0 0',
width: 750,
split: true,
items: [this.panelgridList, this.panelLeftCenter]
});
this.panelChFee_Pub = new Ext.Panel({
title: '代理商公布的费用信息',
layout: "border",
region: 'center',
margin: '0 0',
height: 450,
//width: 450,
split: true,
tooltip: "注意,只有录入/驳回提交状态的费用才可以被覆盖",
tbar: [
{
// id: "saveandclose",
text: "将选中费用同步至本地",
id: "btnSave_Fee",
iconCls: "btnsave",
handler: function (button, event) {
this.SaveFee();
},
scope: this
}
],
items: [this.gridChFee_Pub]
});
this.panelChFee = new Ext.Panel({
title: '本地业务费用信息',
layout: "border",
region: 'south',
margin: '0 0',
height: 400, //width: 450,
split: true,
items: [this.gridChFee_Local]
});
this.page_1 = new Ext.Panel({
id: "page_1",
title: "费用信息",
autoScroll: true,
//closable:true,
items: [this.panelChFee_Pub, this.panelChFee]
});
this.panelCargo_Pub = new Ext.Panel({
title: '代理商公布的商品信息',
layout: "border",
region: 'center',
margin: '0 0',
//height: 450,
width: 450,
split: true,
tbar: [
{
// id: "saveandclose",
text: "将选中商品同步至本地",
id: "btnSave_Cargo",
iconCls: "btnsave",
handler: function (button, event) {
this.SaveCargo();
},
scope: this
}
],
items: [this.gridCargoPubList]
});
this.panelCargo_Local = new Ext.Panel({
title: '本地商品信息',
layout: "border",
region: 'south',
margin: '0 0',
height: 400, //width: 450,
split: true,
items: [this.gridCargo_Local]
});
this.page_2 = new Ext.Panel({
id: "page_2",
title: "商品信息",
region: 'center',
layout: "border",
items: [this.panelCargo_Pub, this.panelCargo_Local]
});
/*
this.panelRight = new Ext.Panel({
//右半
layout: "border",
region: 'center',
margin: '0 0',
height: 560, //width: 450,
split: true,
items: []
});*/
this.TabRight = new Ext.tab.Panel({
//右半
layout: "border",
region: 'center',
margin: '0 0',
height: 560, //width: 450,
split: true,
items: [this.page_2, this.page_1
]
});
this.panelCenter = new Ext.Panel({
//
layout: "border",
region: 'center',
margin: '0 0',
//height: 260, //width: 450,
split: true,
items: [this.panelLeft, this.TabRight]
});
//页面布局
Ext.apply(this, {
items: [this.panelTop, this.panelCenter]
});
this.storeList.on('beforeload', function (store) {
if (!this.checkSearchCondition())
return;
var sql = this.getCondition2();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
}, //end initUIComponents
onRefreshClick: function (button, event) {
if (!this.checkSearchCondition())
return;
var sql = this.getCondition2();
this.isLoading = true;
var _this = this;
this.storeList.load({
params: { start: 0, limit: this.PageSize, condition: sql },
waitMsg: "正在查询数据...",
scope: this,
callback: function () {
this.isLoading = false;
}
});
},
getStrValue: function (list) {
var _list = [];
for (var _i = 0; _i < list.length; _i++) {
_list.push("'" + list[_i] + "'");
}
return _list;
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = "";
var port = form.findField('port').getValue();
sql = sql + getAndConSql(sql, port, "m.port = " + port + "");
var countryid = form.findField('countryid').getValue();
sql = sql + getAndConSql(sql, countryid, "m.countryid like '%" + countryid + "%'");
//HTH, ContainerNo, BGBJ
var HTH = form.findField('HTH').getValue();
sql = sql + getAndConSql(sql, HTH, "(m.HTH like '%" + HTH + "%' or m.billno like '%" + HTH + "%')");
var ContainerNo = form.findField('ContainerNo').getValue();
sql = sql + getAndConSql(sql, ContainerNo, "(m.ContainerNo like '%" + ContainerNo + "%' or m.SEALNO like '%" + ContainerNo + "%')");
var BGBJ = form.findField('BGBJ').getValue();
sql = sql + getAndConSql(sql, BGBJ, "(M.DeclareNumber like '%" + BGBJ + "%' or M.inspection_no like '%" + BGBJ + "%')");
/*
var SailingDate_min = form.findField('SailingDate_min').getRawValue();
sql = sql + getAndConSql(sql, SailingDate_min, "m.Sailingdate >= '" + SailingDate_min + "'");
var SailingDate_max = form.findField('SailingDate_max').getRawValue();
sql = sql + getAndConSql(sql, SailingDate_max, "m.Sailingdate <= '" + SailingDate_max + " 23:59:59'");
*/
var ArrivalDate_min = form.findField('ArrivalDate_min').getRawValue();
sql = sql + getAndConSql(sql, ArrivalDate_min, "m.ArrivalDate >= '" + ArrivalDate_min + "'");
var ArrivalDate_max = form.findField('ArrivalDate_max').getRawValue();
sql = sql + getAndConSql(sql, ArrivalDate_max, "m.ArrivalDate <= '" + ArrivalDate_max + " 23:59:59'");
var creattime_min = form.findField('creattime_min').getRawValue();
sql = sql + getAndConSql(sql, creattime_min, "m.creattime >= '" + creattime_min + "'");
var creattime_max = form.findField('creattime_max').getRawValue();
sql = sql + getAndConSql(sql, creattime_max, "m.creattime <= '" + creattime_max + " 23:59:59'");
var createtime_2_min = form.findField('createtime_2_min').getRawValue();
sql = sql + getAndConSql(sql, createtime_2_min, "m.createtime_2 >= '" + createtime_2_min + "'");
var createtime_2_max = form.findField('createtime_2_max').getRawValue();
sql = sql + getAndConSql(sql, createtime_2_max, "m.createtime_2 <= '" + createtime_2_max + " 23:59:59'");
return sql;
},
getCondition2: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = "";
var port = form.findField('port').getValue();
sql = sql + getAndConSql(sql, port, "p.port = " + port + "");
var countryid = form.findField('countryid').getValue();
sql = sql + getAndConSql(sql, countryid, "p.countryid like '%" + countryid + "%'");
//HTH, ContainerNo, BGBJ
var HTH = form.findField('HTH').getValue();
sql = sql + getAndConSql(sql, HTH, "(p.HTH like '%" + HTH + "%' or p.billno like '%" + HTH + "%')");
var ContainerNo = form.findField('ContainerNo').getValue();
sql = sql + getAndConSql(sql, ContainerNo, "(p.ContainerNo like '%" + ContainerNo + "%' or p.SEALNO like '%" + ContainerNo + "%')");
var BGBJ = form.findField('BGBJ').getValue();
sql = sql + getAndConSql(sql, BGBJ, "(p.DeclareNumber like '%" + BGBJ + "%' or p.inspection_no like '%" + BGBJ + "%')");
/*
var SailingDate_min = form.findField('SailingDate_min').getRawValue();
sql = sql + getAndConSql(sql, SailingDate_min, "p.Sailingdate >= '" + SailingDate_min + "'");
var SailingDate_max = form.findField('SailingDate_max').getRawValue();
sql = sql + getAndConSql(sql, SailingDate_max, "p.Sailingdate <= '" + SailingDate_max + " 23:59:59'");
*/
var ArrivalDate_min = form.findField('ArrivalDate_min').getRawValue();
sql = sql + getAndConSql(sql, ArrivalDate_min, "p.ArrivalDate >= '" + ArrivalDate_min + "'");
var ArrivalDate_max = form.findField('ArrivalDate_max').getRawValue();
sql = sql + getAndConSql(sql, ArrivalDate_max, "p.ArrivalDate <= '" + ArrivalDate_max + " 23:59:59'");
var creattime_min = form.findField('creattime_min').getRawValue();
sql = sql + getAndConSql(sql, creattime_min, "p.creattime >= '" + creattime_min + "'");
var creattime_max = form.findField('creattime_max').getRawValue();
sql = sql + getAndConSql(sql, creattime_max, "p.creattime <= '" + creattime_max + " 23:59:59'");
var createtime_2_min = form.findField('createtime_2_min').getRawValue();
sql = sql + getAndConSql(sql, createtime_2_min, "p.createtime_2 >= '" + createtime_2_min + "'");
var createtime_2_max = form.findField('createtime_2_max').getRawValue();
sql = sql + getAndConSql(sql, createtime_2_max, "p.createtime_2 <= '" + createtime_2_max + " 23:59:59'");
return sql;
},
checkSearchCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return false;
}
return true;
},
onExportClick: function (button, event) {
GridExportExcelPage(this.gridList);
},
onSyncClick: function (ContractNo, Local_ContractNo) {
if (Local_ContractNo == "") {
this.storeSync.removeAll();
} else
this.storeSync.load({
params: { ContractNo: ContractNo, Local_ContractNo: Local_ContractNo },
waitMsg: "正在查询数据...",
scope: this
});
},
onSaveSync: function (ContractNo, Local_ContractNo) {
var mes = "";
var selectedRecords = this.gridSyncList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (mes == "") { mes = " " + rec.get('Field') + "='" + rec.get('NewValue') + "'"; }
else {
mes = mes + "," + rec.get('Field') + "='" + rec.get('NewValue') + "'";
}
}
var SQL = " update import_main_public set received=1,local_contractno='" + Local_ContractNo + "' where contractno='" + ContractNo + "' ";
if (mes != "") {
SQL = SQL + " Update import_main set " + mes + " where contractno='" + Local_ContractNo + "'";
}
//SQL = SQL + " Update CH_FEE_Public set LocalBSNO='" + Local_ContractNo + "' where BSNO='" + ContractNo + "'";
//SQL = SQL + " delete from Receipt_Doc_Public where BSNO='" + Local_ContractNo + "'";
SQL = SQL + " delete from Receipt_Doc where BSNO='" + Local_ContractNo + "'";
SQL = SQL + " delete from Receipt_Doc where GID in(select GID from Receipt_Doc_Public where BSNO='" + ContractNo + "') ";
SQL = SQL + " insert into Receipt_Doc (GID,RECEIPTTYPE,BSNO,URL,Driect_URL) select GID,RECEIPTTYPE,'" + Local_ContractNo + "',URL,Driect_URL from Receipt_Doc_Public where BSNO='" + ContractNo + "'";
var _this = this;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Import/ImportSync/SaveSync',
scope: this,
params: {
SQL: SQL
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var Local_ContractNo = Ext.getCmp("Local_ContractNo").getValue();
var ContractNo = Ext.getCmp("ContractNo").getValue();
this.onSyncClick(ContractNo, Local_ContractNo);
_this.editrecord.set('Local_ContractNo', Local_ContractNo);
_this.editrecord.set('HTHRef', Ext.getCmp("Local_ContractNo").getRawValue());
_this.editrecord.set('Received', 1);
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
//alert('03');
}
});
}
, OnClickXML: function () {
//商检销售记录
var condition = this.getCondition();
if (condition == "") {
Ext.MessageBox.confirm('提示', '不指定条件时,将会从代理商处获取所有未取得的或最近修改过的业务信息,这可能会花费较多时间。确定吗?',
function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.timeout = 9000000; //90秒
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Import/XXH/SendXML',
scope: this,
params: {
condition: condition
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult._r) {
this.onRefreshClick();
} 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
});
}
//alert('03');
}
});
}
},
this); //确认窗口over
} else {
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.timeout = 9000000; //90秒
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Import/XXH/SendXML',
scope: this,
params: {
condition: condition
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult._r) {
this.onRefreshClick();
} 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
});
}
//alert('03');
}
});
}
}
, SaveCargo: function () {
//首先遍历本地商品信息如有相同GID则调用UPDATE方法
selectedRecords = this.gridCargoPubList.selModel.getSelection();
var needUpd = false;
var _this = this;
//var _canUPD = false;
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
var GID = rec.get('GID');
this.storeCargo_Local.each(function (record) {
var LocalGID = record.get('GID');
if (LocalGID == GID) {
needUpd = true;
Ext.MessageBox.confirm('提示', '会覆盖现有的商品信息,确认吗?', function (btn) {
if (btn == 'yes') {
//_this.UploadCargo(rec);
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
var GID = rec.get('GID');
this.storeCargo_Local.each(function (record) {
var LocalGID = record.get('GID');
if (LocalGID == GID) {
_this.UploadCargo(rec);
}
});
}
}
});
}
});
if (needUpd == false) {
this.InsertCargo(GID);
}
needUpd = false;
}
//如无则调用插入方法
}
, InsertCargo: function (GID) {
var Local_ContractNo = Ext.getCmp("Local_ContractNo").getValue();
var _this = this;
var SQL = " INSERT INTO Import_cargo ";
SQL = SQL + " (ContractNo,cargoinfo_id,cargociq_id,name,Ename,UNIT,U_PRICE,U_weight,weight,m_weight ";
SQL = SQL + " ,price,price_limit,Amount,tax_Amount,BoxCount,BoxWeight,Exporter,FactoryNo,Productiondate ";
SQL = SQL + " ,currid,prepayments,balance,paypart,baolv,tariff,tax,tax_zz,tax_1,tax_zz_1,Declarenumber,Exchangerate,FinanceStatus ";
SQL = SQL + " ,Exchangerate_Customs,PreProportion,Amount_Writeoffs,sequence ";
SQL = SQL + " ,SBYS,BZTCHNO,GID,CargoType,KINDPKGS,Weight_Act,BoxCount_Act,isLocked,productiondate_max ";
SQL = SQL + " ,productiondate_min,ExpirationDate,AGENCRATE,MOREORLESS,Remark ";
SQL = SQL + " ,SPECIFICATIONS,price_agio,pay_amount) ";
SQL = SQL + " SELECT '" + Local_ContractNo + "',cargoinfo_id,cargociq_id,name,Ename,UNIT,U_PRICE,U_weight,weight,m_weight ";
SQL = SQL + " ,price,price_limit,Amount,tax_Amount,BoxCount,BoxWeight,Exporter,FactoryNo,Productiondate ";
SQL = SQL + " ,(select codename from code_currency cc where cc.gid=currid ) currid,prepayments,balance,paypart,baolv,tariff,tax,tax_zz,tax_1,tax_zz_1,Declarenumber,Exchangerate,FinanceStatus ";
SQL = SQL + " ,Exchangerate_Customs,PreProportion,Amount_Writeoffs,sequence ";
SQL = SQL + " ,SBYS,BZTCHNO,GID,CargoType,KINDPKGS,Weight_Act,BoxCount_Act,isLocked,productiondate_max ";
SQL = SQL + " ,productiondate_min,ExpirationDate,AGENCRATE,MOREORLESS,Remark ";
SQL = SQL + " ,SPECIFICATIONS,0,0 ";
SQL = SQL + " FROM Import_cargo_Public where GID= '" + GID + "'";
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Import/ImportSync/SaveSync',
scope: this,
params: {
SQL: SQL
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
_this.storeCargo_Local.load({
params: { ContractNo: Local_ContractNo },
waitMsg: "正在查询数据...",
scope: this,
callback: function () {
}
});
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
//alert('03');
}
});
}
, UploadCargo: function (rec) {
var Local_ContractNo = Ext.getCmp("Local_ContractNo").getValue();
var _this = this;
var SQL = " update Import_cargo ";
SQL = SQL + " set cargoinfo_id=" + rec.get('cargoinfo_id') + ",cargociq_id=" + rec.get('cargociq_id');
SQL = SQL + " ,name='" + rec.get('Name') + "',Ename='" + rec.get('Ename') + "',UNIT='" + rec.get('UNIT') + "'";
SQL = SQL + " ,U_PRICE=" + rec.get('U_PRICE') + ",U_weight=" + rec.get('U_weight') + ",weight=" + rec.get('weight') + ",m_weight=" + rec.get('m_weight') + " ";
SQL = SQL + " ,price=" + rec.get('price') + ",price_limit=" + rec.get('price_limit') + ",Amount=" + rec.get('Amount') + ",tax_Amount=" + rec.get('tax_Amount') + " ";
SQL = SQL + " ,BoxCount=" + rec.get('BoxCount') + ",BoxWeight=" + rec.get('BoxWeight') + ",Exporter='" + rec.get('Exporter') + "',FactoryNo='" + rec.get('FactoryNo') + "',Productiondate='" + rec.get('Productiondate') + "' ";
SQL = SQL + " ,currid='" + rec.get('currid') + "',prepayments=" + rec.get('prepayments') + ",balance=" + rec.get('balance') + ",paypart=" + rec.get('paypart') + ",baolv=" + rec.get('baolv') + ",tariff='" + rec.get('tariff') + "' ";
SQL = SQL + " ,tax=" + rec.get('tax') + ",tax_zz=" + rec.get('tax_zz') + ",Declarenumber='" + rec.get('Declarenumber') + "',Exchangerate=" + rec.get('Exchangerate') + " ";
SQL = SQL + " ,Exchangerate_Customs=" + rec.get('Exchangerate_Customs') + ",PreProportion=" + rec.get('PreProportion') + " ";
SQL = SQL + " ,Amount_Writeoffs=" + rec.get('Amount_Writeoffs') + ",sequence=" + rec.get('sequence') + " ";
SQL = SQL + " ,SBYS='" + rec.get('SBYS') + "',BZTCHNO='" + rec.get('BZTCHNO') + "',GID='" + rec.get('GID') + "',CargoType='" + rec.get('CargoType') + "',KINDPKGS='" + rec.get('KINDPKGS') + "' ";
SQL = SQL + " ,Weight_Act=" + rec.get('Weight_Act') + ",BoxCount_Act=" + rec.get('BoxCount_Act') + " ";
//SQL = SQL + ",productiondate_max='" + rec.get('productiondate_max') + "' ,productiondate_min='" + rec.get('productiondate_min') + "',ExpirationDate='" + rec.get('ExpirationDate') + "' ";
SQL = SQL + " ,MOREORLESS='" + rec.get('MOREORLESS') + "',Remark='" + rec.get('Remark') + "' ";
SQL = SQL + " ,tax_1='" + rec.get('tax_1') + "',tax_zz_1='" + rec.get('tax_zz_1') + "' ";
SQL = SQL + " where GID= '" + rec.get('GID') + "'";
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Import/ImportSync/SaveSync',
scope: this,
params: {
SQL: SQL
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
_this.storeCargo_Local.load({
params: { ContractNo: Local_ContractNo },
waitMsg: "正在查询数据...",
scope: this,
callback: function () {
}
});
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
//alert('03');
}
});
}
, SaveFee: function () {
//首先遍历本地费用信息如有相同GID则调用UPDATE方法
selectedRecords = this.gridChFee_Pub.selModel.getSelection();
var needUpd = false;
var _this = this;
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
var GID = rec.get('GID');
this.storeChFee_Local.each(function (record) {
var LocalGID = record.get('GID');
if (LocalGID == GID) {
needUpd = true;
if (record.get('FEESTATUS') == "1" || record.get('FEESTATUS') == "6") {
Ext.MessageBox.confirm('提示', '会覆盖现有信息,确认吗?', function (btn) {
if (btn == 'yes') {
_this.UploadFee(rec);
}
});
} else {
alert("注意,不处于 录入 驳回提交 状态的费用将无法覆盖。")
}
}
});
if (needUpd == false) {
this.InsertFee(GID);
}
needUpd = false;
}
//如无则调用插入方法
}
, InsertFee: function (GID) {
var Local_ContractNo = Ext.getCmp("Local_ContractNo").getValue();
var _this = this;
var field = " (GId,BsNo,FeeStatus,FeeType,FeeName,FeeDescription,CustomerType,CustomerName,Unit,UnitPrice,Quantity ";
field = field + " ,Amount,Currency,ExChangerate,Reason,Commissionrate,Settlement,Invoice,OrderAmount,OrderInvoice ";
field = field + " ,Auditoperator,EnterOperator,EnterDate,DebitNo,IsDebit,IsOpen,IsAdvancedpay,IsInvoice,FeeFrt,IsCrmOrderFee,AuditStatus,REMARK) ";
var _value = " select GID,'" + Local_ContractNo + "',1,3-convert(int,FeeType),FeeName,'','',CustomerName,'',Unitprice,Quantity";
_value = _value + ",Amount,Currency,Exchangerate,'',0,0,0,0,0 ";
_value = _value + ",'','" + USERID + "',getdate(),'',0,1,0,0,'PP',0,0,REMARK from ch_fee_public where GID='" + GID + "' ";
var SQL = " Insert into ch_fee " + field + _value;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Import/ImportSync/SaveSync',
scope: this,
params: {
SQL: SQL
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
_this.storeChFee_Local.load({
params: { BSNO: Local_ContractNo },
waitMsg: "正在查询数据...",
scope: this,
callback: function () {
}
});
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
//alert('03');
}
});
}
, UploadFee: function (rec) {
var Local_ContractNo = Ext.getCmp("Local_ContractNo").getValue();
var _this = this;
var SQL = " update ch_fee set ";
SQL = SQL + " FeeType=3-" + rec.get('FEETYPE') + " ,FeeName='" + rec.get('FEENAME') + "',CustomerName='" + rec.get('CUSTOMERNAME') + "',Unit=''";
SQL = SQL + " ,UnitPrice=" + rec.get('UNITPRICE') + ",Quantity =" + rec.get('QUANTITY') + " ";
SQL = SQL + " ,Amount=" + rec.get('AMOUNT') + ",Currency='" + rec.get('CURRENCY') + "',ExChangerate=" + rec.get('EXCHANGERATE') + " ";
SQL = SQL + " ,Commissionrate=0,Settlement=0,Invoice=0,OrderAmount=0,OrderInvoice=0 ";
SQL = SQL + " ,Auditoperator='',EnterOperator='" + USERID + "',REMARK='" + rec.get('REMARK') + "' ";
SQL = SQL + " where GID= '" + rec.get('GID') + "'";
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Import/ImportSync/SaveSync',
scope: this,
params: {
SQL: SQL
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
_this.storeChFee_Local.load({
params: { BSNO: Local_ContractNo },
waitMsg: "正在查询数据...",
scope: this,
callback: function () {
}
});
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
//alert('03');
}
});
}
, onMakeImportClick: function (type) {
var mes = "";
var selectedRecords = this.gridList.selModel.getSelection();
if (selectedRecords.length <= 0) {
alert("请选择至少一个业务");
return;
}
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i].data;
if (rec.Local_ContractNo != "") {
//alert("已经同步的业务不能再次生成");
if (mes == "") { mes = "'" + rec.ContractNo + "'"; }
else {
mes = mes + ",'" + rec.ContractNo + "'";
}
} else {
if (mes == "") { mes = "'" + rec.ContractNo + "'"; }
else {
mes = mes + ",'" + rec.ContractNo + "'";
}
}
}
if (mes != "") {
var SQL = " ";
SQL = SQL + " INSERT INTO [Import_main]";
SQL = SQL + " ([ContractNo],[HTH],[company],[seller],[buyer],[STT],[countryid],[creator],[creattime],[Auditor],[Audittime],[MainState],[printed]";
SQL = SQL + " ,[AutoAPP],[ShipCompany_id],[Billno],[BillType],[BillTime],[Vessel],[Voyage],[Ex_sailingdate],[Sailingdate],[ArrivalDate],[ContainerNo]";
SQL = SQL + " ,[SealNo],[Freetime],[TransactionMethod],[PaymentMethods],[SecurityDeposit],[CustomsReleaseDate],[SamplingDate_Plan],[SamplingDate_Act]";
SQL = SQL + " ,[inspection_Signup_date],[inspection_no],[inspection_date],[CIQ_licence],[CIQ_canbesearch],[tax_date],[tax_paydate],[remark],[port]";
SQL = SQL + " ,[Writeoffs],[Paydate],[E_Billtime],[HDtime],[FinanceStatus],[remark_2],[remark_3],[remark_4],[Sampling_need],[DeclareNumber],[Inspection_Storage]";
SQL = SQL + " ,[DeliveryDate],[DeliveryAddress],[Contacter],[Tel],[Overfilled],[OwnApp],[ReceiptStatus],[Receiptremark],[Prepaydate],[TRADINGAGENCY],[ACCDATE]";
SQL = SQL + " ,[ContractStatus],[KCClear],[ISDELETE],[DELETEUSER],[DELETETIME],[RCVMode],[ISVOU],[VOUCHERNO],[OP],[MZBZ],[RecDate],[PortDays],[OPBillTime]";
SQL = SQL + " ,[Dock],[Customs_broker],[inspection_broker],[CreateTime_2],[ResendTime],[BuzType],[Inspection_Buyer],[Inspection_Contacter],[Inspection_Tel]";
SQL = SQL + " ,[Inspection_DeliveryAddress],[HaveContract],[HaveCargoMark],[CORPID],[DEPTID],[Supplier_Billno],[Other_Billno],[Agent],[Buy_Type],[Buy_OP]";
SQL = SQL + " ,[Bill_ExpressNo],[Agents_paydate],[HAVESAMPLE],[ISBONDED],[CHECKSAMPLY],[CHECKSAMPLE],[CTN],[BILLTRANCNO],[LOCK_EXCHANGERATE],[EXCHANGERATE]";
SQL = SQL + " ,[Unsealdate],[ISREFORM])";
SQL = SQL + " select [ContractNo],[HTH],[company],[seller],[buyer],[STT],[countryid],[creator],[creattime],[Auditor],[Audittime],[MainState],[printed]";
SQL = SQL + " ,[AutoAPP],[ShipCompany_id],[Billno],[BillType],[BillTime],[Vessel],[Voyage],[Ex_sailingdate],[Sailingdate],[ArrivalDate],[ContainerNo]";
SQL = SQL + " ,[SealNo],[Freetime],[TransactionMethod],[PaymentMethods],[SecurityDeposit],[CustomsReleaseDate],[SamplingDate_Plan],[SamplingDate_Act]";
SQL = SQL + " ,[inspection_Signup_date],[inspection_no],[inspection_date],[CIQ_licence],[CIQ_canbesearch],[tax_date],[tax_paydate],[remark],[port]";
SQL = SQL + " ,[Writeoffs],[Paydate],[E_Billtime],[HDtime],[FinanceStatus],[remark_2],[remark_3],[remark_4],[Sampling_need],[DeclareNumber],[Inspection_Storage]";
SQL = SQL + " ,[DeliveryDate],[DeliveryAddress],[Contacter],[Tel],[Overfilled],[OwnApp],[ReceiptStatus],[Receiptremark],[Prepaydate],[TRADINGAGENCY],[ACCDATE]";
SQL = SQL + " ,[ContractStatus],[KCClear],[ISDELETE],[DELETEUSER],[DELETETIME],[RCVMode],[ISVOU],[VOUCHERNO],[OP],[MZBZ],[RecDate],[PortDays],[OPBillTime]";
SQL = SQL + " ,[Dock],[Customs_broker],[inspection_broker],[CreateTime_2],[ResendTime],[BuzType],[Inspection_Buyer],[Inspection_Contacter],[Inspection_Tel]";
SQL = SQL + " ,[Inspection_DeliveryAddress],[HaveContract],[HaveCargoMark],[CORPID],[DEPTID],[Supplier_Billno],[Other_Billno],[Agent],[Buy_Type],[Buy_OP]";
SQL = SQL + " ,[Bill_ExpressNo],'' [Agents_paydate],[HAVESAMPLE],[ISBONDED],'' [CHECKSAMPLY],[CHECKSAMPLE],[CTN],[BILLTRANCNO],[LOCK_EXCHANGERATE],[EXCHANGERATE]";
SQL = SQL + " ,[Unsealdate],[ISREFORM] from import_main_public where ContractNo in ( " + mes + " ) and not exists(select 1 from import_main where contractno in ( " + mes + " ))";
SQL = SQL + " Update import_main_public set Local_ContractNo = ContractNo,received=1 where ContractNo in ( " + mes + " ) and gid not in (select gid from [Import_cargo])";
SQL = SQL + " INSERT INTO [Import_cargo] ";
SQL = SQL + " ([ContractNo],[cargoinfo_id],[cargociq_id],[name],[Ename],[UNIT],[U_PRICE],[U_weight],[weight],[m_weight],[price],[price_agio],[price_limit] ";
SQL = SQL + " ,[Amount],[tax_Amount],[pay_Amount],[BoxCount],[BoxWeight],[Exporter],[FactoryNo],[Productiondate],[currid],[prepayments],[balance] ";
SQL = SQL + " ,[paypart],[baolv],[tariff],[tax],[tax_zz],[Declarenumber],[Exchangerate],[FinanceStatus],[Exchangerate_Customs],[tax_1],[tax_zz_1] ";
SQL = SQL + " ,[tax_2],[tax_zz_2],[PreProportion],[Amount_Writeoffs],[sequence],[SBYS],[BZTCHNO],[GID],[CargoType],[KINDPKGS],[Weight_Act],[BoxCount_Act] ";
SQL = SQL + " ,[isLocked],[productiondate_max],[productiondate_min],[ExpirationDate],[AGENCRATE],[MOREORLESS],[Remark],[pay_prepayments] ";
SQL = SQL + " ,[pay_balance],[SPECIFICATIONS]) ";
SQL = SQL + " select [ContractNo],[cargoinfo_id],[cargociq_id],[name],[Ename],[UNIT],[U_PRICE],[U_weight],[weight],[m_weight],[price],0 [price_agio],[price_limit] ";
SQL = SQL + " ,[Amount],[tax_Amount],[Amount],[BoxCount],[BoxWeight],[Exporter],[FactoryNo],[Productiondate],[currid],[prepayments],[balance] ";
SQL = SQL + " ,[paypart],[baolv],[tariff],[tax],[tax_zz],[Declarenumber],[Exchangerate],[FinanceStatus],[Exchangerate_Customs],[tax_1],[tax_zz_1] ";
SQL = SQL + " ,[tax_2],[tax_zz_2],[PreProportion],[Amount_Writeoffs],[sequence],[SBYS],[BZTCHNO],[GID],[CargoType],[KINDPKGS],[Weight_Act],[BoxCount_Act] ";
SQL = SQL + " ,[isLocked],[productiondate_max],[productiondate_min],[ExpirationDate],[AGENCRATE],[MOREORLESS],[Remark],[pay_prepayments] ";
SQL = SQL + " ,[pay_balance],[SPECIFICATIONS] from Import_cargo_Public where ContractNo in ( " + mes + " ) and not exists(select 1 from import_cargo where gid =Import_cargo_Public.GID)";
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
async: false,
waitMsg: '正在保存数据...',
url: '/Import/ImportSync/SaveSync',
scope: this,
params: {
SQL: SQL
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
//刷新列表
if (type == "1") {
//this.MakeFee();
} else {
this.onRefreshClick();
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
//alert('03');
}
});
} else if (type == "1") {
//this.MakeFee();
}
}
, onMakeAllImportClick: function () {
var SQL = " ";
SQL = SQL + " INSERT INTO [Import_cargo] ";
SQL = SQL + " ([ContractNo],[cargoinfo_id],[cargociq_id],[name],[Ename],[UNIT],[U_PRICE],[U_weight],[weight],[m_weight],[price],[price_agio],[price_limit] ";
SQL = SQL + " ,[Amount],[tax_Amount],[pay_Amount],[BoxCount],[BoxWeight],[Exporter],[FactoryNo],[Productiondate],[currid],[prepayments],[balance] ";
SQL = SQL + " ,[paypart],[baolv],[tariff],[tax],[tax_zz],[Declarenumber],[Exchangerate],[FinanceStatus],[Exchangerate_Customs],[tax_1],[tax_zz_1] ";
SQL = SQL + " ,[tax_2],[tax_zz_2],[PreProportion],[Amount_Writeoffs],[sequence],[SBYS],[BZTCHNO],[GID],[CargoType],[KINDPKGS],[Weight_Act],[BoxCount_Act] ";
SQL = SQL + " ,[isLocked],[productiondate_max],[productiondate_min],[ExpirationDate],[AGENCRATE],[MOREORLESS],[Remark],[pay_prepayments] ";
SQL = SQL + " ,[pay_balance],[SPECIFICATIONS]) ";
SQL = SQL + " select [ContractNo],[cargoinfo_id],[cargociq_id],[name],[Ename],[UNIT],[U_PRICE],[U_weight],[weight],[m_weight],[price],0 [price_agio],[price_limit] ";
SQL = SQL + " ,[Amount],[tax_Amount],[Amount],[BoxCount],[BoxWeight],[Exporter],[FactoryNo],[Productiondate],[currid],[prepayments],[balance] ";
SQL = SQL + " ,[paypart],[baolv],[tariff],[tax],[tax_zz],[Declarenumber],[Exchangerate],[FinanceStatus],[Exchangerate_Customs],[tax_1],[tax_zz_1] ";
SQL = SQL + " ,[tax_2],[tax_zz_2],[PreProportion],[Amount_Writeoffs],[sequence],[SBYS],[BZTCHNO],[GID],[CargoType],[KINDPKGS],[Weight_Act],[BoxCount_Act] ";
SQL = SQL + " ,[isLocked],[productiondate_max],[productiondate_min],[ExpirationDate],[AGENCRATE],[MOREORLESS],[Remark],[pay_prepayments] ";
SQL = SQL + " ,[pay_balance],[SPECIFICATIONS] from Import_cargo_Public where ContractNo not in ( select contractno from import_main ) and gid not in (select gid from [Import_cargo]) ";
SQL = SQL + " INSERT INTO [Import_main]";
SQL = SQL + " ([ContractNo],[HTH],[company],[seller],[buyer],[STT],[countryid],[creator],[creattime],[Auditor],[Audittime],[MainState],[printed]";
SQL = SQL + " ,[AutoAPP],[ShipCompany_id],[Billno],[BillType],[BillTime],[Vessel],[Voyage],[Ex_sailingdate],[Sailingdate],[ArrivalDate],[ContainerNo]";
SQL = SQL + " ,[SealNo],[Freetime],[TransactionMethod],[PaymentMethods],[SecurityDeposit],[CustomsReleaseDate],[SamplingDate_Plan],[SamplingDate_Act]";
SQL = SQL + " ,[inspection_Signup_date],[inspection_no],[inspection_date],[CIQ_licence],[CIQ_canbesearch],[tax_date],[tax_paydate],[remark],[port]";
SQL = SQL + " ,[Writeoffs],[Paydate],[E_Billtime],[HDtime],[FinanceStatus],[remark_2],[remark_3],[remark_4],[Sampling_need],[DeclareNumber],[Inspection_Storage]";
SQL = SQL + " ,[DeliveryDate],[DeliveryAddress],[Contacter],[Tel],[Overfilled],[OwnApp],[ReceiptStatus],[Receiptremark],[Prepaydate],[TRADINGAGENCY],[ACCDATE]";
SQL = SQL + " ,[ContractStatus],[KCClear],[ISDELETE],[DELETEUSER],[DELETETIME],[RCVMode],[ISVOU],[VOUCHERNO],[OP],[MZBZ],[RecDate],[PortDays],[OPBillTime]";
SQL = SQL + " ,[Dock],[Customs_broker],[inspection_broker],[CreateTime_2],[ResendTime],[BuzType],[Inspection_Buyer],[Inspection_Contacter],[Inspection_Tel]";
SQL = SQL + " ,[Inspection_DeliveryAddress],[HaveContract],[HaveCargoMark],[CORPID],[DEPTID],[Supplier_Billno],[Other_Billno],[Agent],[Buy_Type],[Buy_OP]";
SQL = SQL + " ,[Bill_ExpressNo],[Agents_paydate],[HAVESAMPLE],[ISBONDED],[CHECKSAMPLY],[CHECKSAMPLE],[CTN],[BILLTRANCNO],[LOCK_EXCHANGERATE],[EXCHANGERATE]";
SQL = SQL + " ,[Unsealdate],[ISREFORM])";
SQL = SQL + " select [ContractNo],[HTH],[company],[seller],[buyer],[STT],[countryid],[creator],[creattime],[Auditor],[Audittime],[MainState],[printed]";
SQL = SQL + " ,[AutoAPP],[ShipCompany_id],[Billno],[BillType],[BillTime],[Vessel],[Voyage],[Ex_sailingdate],[Sailingdate],[ArrivalDate],[ContainerNo]";
SQL = SQL + " ,[SealNo],[Freetime],[TransactionMethod],[PaymentMethods],[SecurityDeposit],[CustomsReleaseDate],[SamplingDate_Plan],[SamplingDate_Act]";
SQL = SQL + " ,[inspection_Signup_date],[inspection_no],[inspection_date],[CIQ_licence],[CIQ_canbesearch],[tax_date],[tax_paydate],[remark],[port]";
SQL = SQL + " ,[Writeoffs],[Paydate],[E_Billtime],[HDtime],[FinanceStatus],[remark_2],[remark_3],[remark_4],[Sampling_need],[DeclareNumber],[Inspection_Storage]";
SQL = SQL + " ,[DeliveryDate],[DeliveryAddress],[Contacter],[Tel],[Overfilled],[OwnApp],[ReceiptStatus],[Receiptremark],[Prepaydate],[TRADINGAGENCY],[ACCDATE]";
SQL = SQL + " ,[ContractStatus],[KCClear],[ISDELETE],[DELETEUSER],[DELETETIME],[RCVMode],[ISVOU],[VOUCHERNO],[OP],[MZBZ],[RecDate],[PortDays],[OPBillTime]";
SQL = SQL + " ,[Dock],[Customs_broker],[inspection_broker],[CreateTime_2],[ResendTime],[BuzType],[Inspection_Buyer],[Inspection_Contacter],[Inspection_Tel]";
SQL = SQL + " ,[Inspection_DeliveryAddress],[HaveContract],[HaveCargoMark],[CORPID],[DEPTID],[Supplier_Billno],[Other_Billno],[Agent],[Buy_Type],[Buy_OP]";
SQL = SQL + " ,[Bill_ExpressNo],'' [Agents_paydate],[HAVESAMPLE],[ISBONDED],'' [CHECKSAMPLY],[CHECKSAMPLE],[CTN],[BILLTRANCNO],[LOCK_EXCHANGERATE],[EXCHANGERATE]";
SQL = SQL + " ,[Unsealdate],[ISREFORM] from import_main_public where ContractNo not in ( select contractno from import_main )";
SQL = SQL + " Update import_main_public set Local_ContractNo = ContractNo,received=1 where ContractNo in ( select contractno from import_main )";
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
async: false,
waitMsg: '正在保存数据...',
url: '/Import/ImportSync/SaveSync',
scope: this,
params: {
SQL: SQL
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
//刷新列表
this.onRefreshClick();
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
//alert('03');
}
});
}
,
MakeFee: function (button, event) { //初始化应收应付,
var mes = "";
var selectedRecords = this.gridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i].data;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
async: false,
waitMsg: '正在保存数据...',
url: '/Import/ImportSync/MakeFee',
scope: this,
params: {
ContractNo: rec.ContractNo
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
//刷新列表
this.onRefreshClick();
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
//alert('03');
}
});
}
}
});