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/Import/Viewsjs/audit/auditIndex.js

1225 lines
45 KiB
JavaScript

2 years ago
Ext.namespace('DsTruck');
DsTruck.AuditIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.DsTruck.AuditIndex.superclass.constructor.call(this);
};
Ext.extend(DsTruck.AuditIndex, Ext.Panel, {
PageSize: 500,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
initUIComponents: function () {
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
model: 'XXHmb',
remoteSort: true,
pageSize: this.PageSize,
proxy: {
type: 'ajax',
url: '/Import/XXH/GetDataList',
reader: {
idProperty: 'id' + 'cgid',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.formname = "HT_audit";
//#region 枚举参照
this.storeport = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeport.load({ params: { enumTypeId: 10} });
this.comboxport = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '目的港',
store: this.storeport,
name: 'port'
});
this.storeMainstate = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeMainstate.load({ params: { enumTypeId: 3} });
this.comboxMainstate = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '合同状态',
store: this.storeMainstate,
name: 'Mainstate'
//,
//value: '2'
});
//表参照
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'
});
this.storeCargoinfo = Ext.create('DsExt.ux.RefTableStore', {
model: 'CargoRef',
proxy: { url: '/CommMng/BasicDataRef/GetCargoRefList' }
});
this.storeCargoinfo.load({ params: { condition: ""} });
this.comboxCargoinfo = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: 'HS代码',
store: this.storeCargoinfo,
name: 'Cargoinfo_id',
valueField: 'id',
displayField: 'codeandname'
//HS代码
});
this.storeCargociq = Ext.create('DsExt.ux.RefTableStore', {
model: 'CargociqRef',
proxy: { url: '/CommMng/BasicDataRef/GetCargociqRefList' }
});
this.storeCargociq.load({ params: { condition: ""} });
this.comboxCargociq = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: 'ciq代码',
store: this.storeCargociq,
name: 'Cargociq_id',
valueField: 'id',
displayField: 'codeandname'
//ciq代码
});
this.storeCompany = Ext.create('DsExt.ux.RefTableStore', {
model: 'companymb',
proxy: { url: '/CommMng/BasicDataRef/GetcompanyList' }
});
this.storeCompany.load({ params: { condition: ""} });
this.comboxCompany = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '用证公司',
store: this.storeCompany,
name: 'company',
valueField: 'gid',
displayField: 'name'
});
this.storeRemind = Ext.create('DsExt.ux.RefTableStore', {
model: 'remind',
proxy: { url: '/CommMng/BasicDataRef/Getimportremind' }
});
this.storeRemind.load({ params: { condition: ""} });
this.comboxRemind = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '业务提醒',
store: this.storeRemind,
name: 'Remind',
valueField: 'RemindSql',
displayField: 'RemindName',
triggerAction: 'all',
selectOnFocus: true, flex: 1,
listeners: {
change: function (field, newValue, oldValue) {
this.onGetremind(field, newValue, oldValue);
},
scope: this
}
});
this.storeUser = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeUser.load({ params: { condition: ""} });
this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '操作人',
forceSelection: true,
store: this.storeUser,
name: 'OP',
valueField: 'UserName',
displayField: 'CodeAndName'
});
this.storeAuditStatus = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeAuditStatus.load({ params: { enumTypeId: 33} });
this.comboxAuditStatus = Ext.create('Ext.ux.form.field.BoxSelect', {
fieldLabel: '未完成审单项目',
//renderTo: 'basicBoxselect',
//autoHeight:true,
autosize: true,
bodyPadding: 1,
flex: 4,
//height:60,
width: 80,
labelWidth: 90,
store: this.storeAuditStatus,
queryMode: 'local',
//stacked: true,
//pinList: false,
triggerOnClick: false,
valueField: 'EnumValueName',
displayField: 'EnumValueName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
//,value: ['TX', 'CA']
});
//#endregion
//#region 定义Grid
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 50
});
this.column = [
{
sortable: true,
dataIndex: 'ContractNo',
header: '合同序列号',
width: 120
}, {
sortable: true,
dataIndex: 'HTH',
header: '合同号',
width: 80
}, {
sortable: true,
dataIndex: 'HTDATE',
header: '合同日期',
width: 80
}, {
sortable: true,
dataIndex: 'seller',
header: '贸易商',
width: 80
}, {
sortable: true,
dataIndex: 'buyer',
header: '购货方',
width: 80
}, {
sortable: true, dataIndex: 'id', header: 'id', hidden: true
},
{
dataIndex: 'TimeMark', header: 'TimeMark', hidden: true
},
{
sortable: true,
dataIndex: 'cgid',
header: 'cgid',
hidden: true,
width: 80
},
{
sortable: true,
dataIndex: 'name',
header: '货物名称',
width: 80
}, {
sortable: true,
dataIndex: 'weight',
header: '净重(吨)',
width: 80
},
{
sortable: true,
dataIndex: 'cicode',
header: 'HS代码',
hidden: true,
width: 80
},
{
sortable: true,
dataIndex: 'ciname',
header: 'HS名称',
width: 80
}, {
sortable: true,
dataIndex: 'countryid',
header: 'countryid',
hidden: true,
width: 80
}, {
sortable: true,
dataIndex: 'country',
header: '进口国',
width: 80
}, {
sortable: true,
dataIndex: 'portRef',
header: '目的港',
width: 80
}, {
sortable: true,
dataIndex: 'companyname',
header: '用证公司',
width: 80
}, {
sortable: true,
dataIndex: 'BillNo',
header: '提单号',
width: 80
}, {
sortable: true,
dataIndex: 'ContainerNo',
header: '箱号',
width: 80
}, {
sortable: true,
dataIndex: 'SealNo',
header: '铅封号',
width: 80
}, {
sortable: true,
dataIndex: 'ValidDate',
header: '许可证有效期',
width: 80
}, {
sortable: true,
dataIndex: 'TRADINGAGENCY',
header: '订货方(中间商)',
width: 80
}, {
sortable: true,
dataIndex: 'FactoryNo',
header: '厂号',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'OP',
header: '操作人',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'AuditorREF',
header: '审单人',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'MZBZREF',
header: '是否木质包装',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'Productiondate',
header: '生产日期',
width: 100
}, {
sortable: true, id: '',
dataIndex: 'BZTCHNO',
header: '批次号',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'Exporter',
header: '出口商',
width: 120
}, {
sortable: true, id: '',
dataIndex: 'Inspection_Buyer',
header: '商检收货单位',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'ArrivalDate',
header: '到港日',
width: 100
}, {
sortable: true, id: '',
dataIndex: 'appusedweight',
header: '配证重量',
width: 100
}, {
sortable: true, //id: '',
dataIndex: 'HAVESAMPLE',
header: '已做样本清单',
width: 80
}, {
sortable: true, //id: '',
dataIndex: 'CHECKSAMPLE',
header: '样本清单已检查',
width: 80
}, {
sortable: true, //id: '',
dataIndex: 'SBYS',
header: '申报要素',
width: 160
}, {
sortable: true, //id: '',
dataIndex: 'inspection_no',
header: '报检号',
width: 120
}, {
sortable: true, hidden: true,
dataIndex: 'TRADECOUNTRY',
header: 'TRADECOUNTRY',
width: 80
},
{
sortable: true,
dataIndex: 'TRADECOUNTRY_REF',
header: '贸易国',
width: 80
},
{
sortable: true,
dataIndex: 'CIQ_licence',
header: '卫生证序列号',
width: 100
},
{
sortable: true,
dataIndex: 'CIQDATE',
header: '卫生证日期',
width: 80
},
{
sortable: true,
dataIndex: 'VSIGN',
header: '兽医官签名',
width: 80
}];
this.Pagenum = Ext.create('Ext.form.field.Number', {
name: 'bottles',
fieldLabel: '每页记录数',
labelAlign: 'right',
value: this.PageSize,
maxValue: 100000,
width: 180,
minValue: 0,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.MainCB = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true });
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
stripeRows: true,
selModel: this.MainCB,
viewConfig: {
enableTextSelection: true
},
columns: [new Ext.grid.RowNumberer()],
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum]
});
/////////////以下部分为获取存储的gridpanel显示样式
this.column = DsTruck.GetGridPanel(GID, this.formname, this.column);
this.column.unshift(new Ext.grid.RowNumberer());
this.gridList.reconfigure(this.storeList, this.column);
////////////////////////////
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
// alert('0....' + dataview.toString() + ',' + record.toString() + ',' + item.toString() + ',' + index.toString() + ',' + e.toString() + ',' + b.toString());
this.SelectedRecord = record;
this.OprationStatus = 'edit';
DsOpenEditWin('/Import/audit/Edit', record.data.ContractNo, "760", "1100");
}, this);
/* this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
alert(record.get("ContractNo"))
}, this);*/
//#endregion
//#region formSearch
//#region formSearch枚举参照相关
//#endregion
var _this = this;
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
//collapsed: false,
//collapsible: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 80,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '合同号',
name: 'HTH',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '合同序列号',
name: 'ContractNo',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},
this.comboxCompany,
this.comboxCountry, {
fieldLabel: '从..到港日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ArrivalDate_min',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}]
}]
}, //end items(fieldset 1)
{//fieldset 2
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxport, this.comboxOP,
this.comboxCargoinfo,
this.comboxCargociq, {
fieldLabel: '到..到港日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ArrivalDate_max',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
]
}]
}, //end fieldset 2
{//fieldset 3
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '货物名称包含',
name: 'Cname_1',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},
this.comboxMainstate,
{
fieldLabel: '贸易商',
name: 'seller',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '客户',
name: 'buyer',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '从..审单时间',
format: 'Y-m-d',
xtype: 'datefield',
name: 'Audittime_min',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}]
}]
}, //end items(fieldset 3)
{//fieldset 4
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '提单号',
name: 'BillNo',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '报检号',
name: 'inspection_no',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '箱号',
name: 'ContainerNo',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '铅封号',
name: 'SealNo',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到..审单时间',
format: 'Y-m-d',
xtype: 'datefield',
name: 'Audittime_max',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}]
}]
} //end items(fieldset 4)
, {//fieldset 5
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '厂号',
name: 'FactoryNo',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxRemind, {
fieldLabel: '备注中包含',
name: 'remark', flex: 1,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '从..报检时间',
format: 'Y-m-d',
xtype: 'datefield',
name: 'BJTIME_FROM',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到..报检时间',
format: 'Y-m-d',
xtype: 'datefield',
name: 'BJTIME_END',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}]
}]
} //end items(fieldset 5)
, {//fieldset 5
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '卫生证序列号',
name: 'CIQ_licence', flex: 1,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},
this.comboxAuditStatus, {
fieldLabel: '未做样本清单',
xtype: 'checkbox',
name: 'HAVESAMPLE',
flex: 1,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '样本清单未检查',
xtype: 'checkbox',
name: 'CHECKSAMPLE',
flex: 1, labelWidth: 90,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}]
}]
} //end items(fieldset 5)
]//end root items
});
//#endregion formSearch
//查询工具条
var _this = this;
var menu1 = new Ext.menu.Menu({
id: 'basicMenu',
items: [{
text: '样本清单',
handler: clickHandler
}, {
text: '审单报告',
handler: clickHandler2
}
]
});
function clickHandler() {
panelTest.Print();
};
function clickHandler2() {
panelTest.Print_AuditStatus();
};
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
xtype: 'button',
width: 35,
//text: "",
iconCls: "btnmore",
handler: function (button, event) {
var sql = this.getCondition();
var winAccess = new Shipping.DsQuery({
});
winAccess.StoreList = this.storeList;
winAccess.formname = this.formname;
winAccess.condition = sql;
winAccess.LoadQueryData_self(this.formname);
winAccess.show();
return;
},
scope: this
},
{
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
},
{
text: "重置条件",
iconCls: "btnreset",
handler: function (button, event) {
this.onResetClick(button, event);
},
scope: this
},
{
text: "保存列表样式",
id: "btntest",
handler: function (button, event) {
//this.column = DsTruck.SaveGridPanel(GID, this.formname, this.gridList.columns, this.column, 1,false);
var tempcolumns = this.gridList.columns;
DsTruck.SaveGridPanel(GID, this.formname, tempcolumns, this.column, 1, false);
},
scope: this
}, '-'
, { text: "打印报表", menu: menu1, scope: this }
]
});
//布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
collapsed: false,
collapsible: true,
height: 200,
items: [this.formSearch]
});
Ext.apply(this, {
items: [this.panelBtn, this.panelTop, this.gridList]
});
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.gridList.addListener('itemcontextmenu', this.itemcontextmenu);
}, //end initUIComponents
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.PageSize = this.Pagenum.getValue();
this.storeList.pageSize = this.PageSize;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onDsQuery: function () {
//var girdcolums = this.gridList.getColumnMode();
var sql = this.sqlcontext;
this.PageSize = this.Pagenum.getValue();
this.storeList.pageSize = this.PageSize;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
,
callback: function (records, options, success) {
//mergeCells(_this.gridList, [1]);
//alert(records);
}
});
},
onDeleteClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/Import/XXH/Delete',
params: {
data: Ext.JSON.encode(record.data)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.remove(record);
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);
}, //onDeleteClick
onResetClick: function (button, event) {
this.formSearch.getForm().reset();
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = ' M.ISDELETE=0 ';//去掉条件限制进口业务也可以配证by zxb 2018.0917
var OP = form.findField('OP').getValue();
sql = sql + getAndConSql(sql, OP, "M.OP = '" + OP + "'");
var HTH = form.findField('HTH').getValue();
sql = sql + getAndConSql(sql, HTH, "M.HTH like '%" + HTH + "%'");
var ContractNo = form.findField('ContractNo').getValue();
sql = sql + getAndConSql(sql, ContractNo, "M.ContractNo like '%" + ContractNo + "%'");
var company = form.findField('company').getValue();
sql = sql + getAndConSql(sql, company, "M.company = '" + company + "'");
var countryid = form.findField('countryid').getValue();
sql = sql + getAndConSql(sql, countryid, "m.countryid like '%" + countryid + "%'");
var port = form.findField('port').getValue();
sql = sql + getAndConSql(sql, port, "m.port = " + port + "");
var Cargoinfo_id = form.findField('Cargoinfo_id').getValue();
//alert(Cargoinfo_id);
sql = sql + getAndConSql(sql, Cargoinfo_id, "cg.Cargoinfo_id = " + Cargoinfo_id + "");
var Cargociq_id = form.findField('Cargociq_id').getValue();
//alert(Cargociq_id);
sql = sql + getAndConSql(sql, Cargociq_id, "cg.Cargociq_id = " + Cargociq_id + "");
var Cname = form.findField('Cname_1').getValue();
if (Cname != "") {
sql = sql + getAndConSql(sql, Cname, "cg.name like '%" + Cname + "%'");
}
var Mainstate = form.findField('Mainstate').getValue();
sql = sql + getAndConSql(sql, Mainstate, "m.Mainstate = " + Mainstate + "");
var seller = form.findField('seller').getRawValue();
sql = sql + getAndConSql(sql, seller, "M.seller like '%" + seller + "%'");
var buyer = form.findField('buyer').getRawValue();
sql = sql + getAndConSql(sql, buyer, "M.buyer like '%" + buyer + "%'");
var BillNo = form.findField('BillNo').getRawValue();
sql = sql + getAndConSql(sql, BillNo, "m.BillNo like '%" + BillNo + "%'");
var inspection_no = form.findField('inspection_no').getRawValue();
sql = sql + getAndConSql(sql, inspection_no, "m.inspection_no like '%" + inspection_no + "%'");
var ContainerNo = form.findField('ContainerNo').getRawValue();
sql = sql + getAndConSql(sql, ContainerNo, "m.ContainerNo like '%" + ContainerNo + "%'");
var SealNo = form.findField('SealNo').getValue();
sql = sql + getAndConSql(sql, SealNo, "m.SealNo like '%" + SealNo + "%'");
var remark = form.findField('remark').getValue();
sql = sql + getAndConSql(sql, remark, "m.remark like '%" + remark + "%'");
var Remind = form.findField('Remind').getValue();
sql = sql + getAndConSql(sql, Remind, Remind);
var FactoryNo = form.findField('FactoryNo').getValue();
sql = sql + getAndConSql(sql, FactoryNo, "cg.FactoryNo like '%" + FactoryNo + "%'");
var HAVESAMPLE = form.findField("HAVESAMPLE").getValue();
if (HAVESAMPLE)
{ sql = sql + getAndConSql(sql, HAVESAMPLE, " isnull(m.HAVESAMPLE,0)=0 "); }
var CHECKSAMPLE = form.findField("CHECKSAMPLE").getValue();
if (CHECKSAMPLE)
{ sql = sql + getAndConSql(sql, CHECKSAMPLE, " isnull(m.CHECKSAMPLE,0)=0 "); }
var Audittime_min = form.findField('Audittime_min').getRawValue();
sql = sql + getAndConSql(sql, Audittime_min, "m.Audittime >= '" + Audittime_min + "'");
var Audittime_max = form.findField('Audittime_max').getRawValue();
sql = sql + getAndConSql(sql, Audittime_max, "m.Audittime <= '" + Audittime_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 BJTIME_FROM = form.findField('BJTIME_FROM').getRawValue();
sql = sql + getAndConSql(sql, BJTIME_FROM, "m.inspection_Signup_date >= '" + BJTIME_FROM + "'");
var BJTIME_END = form.findField('BJTIME_END').getRawValue();
sql = sql + getAndConSql(sql, BJTIME_END, "m.inspection_Signup_date <= '" + BJTIME_END + " 23:59:59'");
var CIQ_licence = form.findField('CIQ_licence').getValue();
sql = sql + getAndConSql(sql, CIQ_licence, " m.CIQ_licence like '%" + CIQ_licence + "%'");
var AuditStatusList = this.comboxAuditStatus.getValue();
//alert(CnameList);
var AuditStatus = "";
for (var i in AuditStatusList) {
if (AuditStatus == "") { AuditStatus = "'" + AuditStatusList[i] + "'"; }
else { AuditStatus = AuditStatus + ",'" + AuditStatusList[i] + "'"; }
}
if (AuditStatus != "") {
sql = sql + getAndConSql(sql, AuditStatus, "M.contractno in(select BSNO from Import_AuditStatus where RECEIPTNAME in (" + AuditStatus + ") and AuditStatus='NO')");
}
return sql;
},
onGetremind: function (field, newValue, oldValue) {
if (newValue != null) {
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: newValue },
waitMsg: "正在查询数据...",
scope: this
});
}
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
}
// alert(this.OprationStatus.ToString());
// alert(this.storeList.toString());
// alert(this.SelectedRecord.toString());
,
Print: function () {//样本清单
var MainList = "";
var selectedRecords = [];
selectedRecords = this.gridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (MainList == "") { MainList = "" + rec.get('id') + ""; }
else {
MainList = MainList + "," + rec.get('id') + "";
}
}
if (MainList == "") return;
function GetDateStr(AddDayCount) {
var dd = new Date();
dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期
var y = dd.getFullYear();
var m = dd.getMonth() + 1; //获取当前月份的日期
var d = dd.getDate();
return y + "-" + m + "-" + d;
}
//alert(GetDateStr(+5));
var printdate = GetDateStr(0);
var printType = 'XXH_Audit_Sample'; //样本清单
//var T = this.getCondition();
//if (T != "") { T = " where " + T; };
var sql1 = " select m.contractno 合同序列号,HTH 合同号,seller 贸易商, buyer 购货方 ,cg.name 货物名称 ";
sql1 = sql1 + " ,cg.[weight]/1000 净重,cg.Productiondate 生产日期,cg.Exporter 出口商,m.Inspection_Buyer 商检收货单位 ";
sql1 = sql1 + " ,containerno 箱号,dbo.f_str(m.ContractNo) 品名,dbo.F_factoryno(m.ContractNo) 厂号 ";
sql1 = sql1 + " ,dbo.f_BZTCHNO(m.ContractNo) 批号 ,dbo.f_boxweight(m.ContractNo) 规格 ";
sql1 = sql1 + " ,m.inspection_no 报检号,CIQ_licence 卫生证号 ";
sql1 = sql1 + " ,substring(cc.country,0,(charindex('(',cc.country)) ) 原产地 ";
sql1 = sql1 + " ,comp.fullname 用证公司 ";
sql1 = sql1 + " ,m.inspection_no 报检号,ic.tel 商检_电话,CHIEF 商检_联系人 ";
sql1 = sql1 + " ,IC.Email 商检_Email ,EDICODE 商检_组织机构代码,IC.ADDR 商检_送货地址 ";
sql1 = sql1 + " from Import_main m ";
sql1 = sql1 + " left join code_country cc on cc.countryid=m.countryid ";
sql1 = sql1 + " left join company comp on comp.gid=m.company ";
sql1 = sql1 + " left join import_cargo cg on cg.contractno=m.contractno ";
sql1 = sql1 + " left join info_client IC on IC.shortname=m.Inspection_Buyer ";
sql1 = sql1 + " where m.id in(" + MainList + ") ";
sql1 = sql1 + " order by ArrivalDate,ex_sailingdate ";
var sql2 = "select '" + SHOWNAME + "' SHOWNAME,'" + printdate + "' printdate";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
,
Print_AuditStatus: function () {//样本清单
var MainList = "";
var selectedRecords = [];
selectedRecords = this.gridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (MainList == "") { MainList = "" + rec.get('id') + ""; }
else {
MainList = MainList + "," + rec.get('id') + "";
}
}
if (MainList == "") return;
function GetDateStr(AddDayCount) {
var dd = new Date();
dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期
var y = dd.getFullYear();
var m = dd.getMonth() + 1; //获取当前月份的日期
var d = dd.getDate();
return y + "-" + m + "-" + d;
}
//alert(GetDateStr(+5));
var printdate = GetDateStr(0);
var printType = 'Import_AuditStatus'; //样本清单
//var T = this.getCondition();
//if (T != "") { T = " where " + T; };
/*
var sql1 = " select HTH 合同号,ReceiptName 单据名称,AuditStatus 审单情况,Modifiedtime 审单时间,CZSTATUS 审单问题 ";
sql1 = sql1 + " from Import_AuditStatus A ";
sql1 = sql1 + " left join Import_main m on A.BSNO=m.contractno ";
sql1 = sql1 + " where m.id in(" + MainList + ") ";
sql1 = sql1 + " order by ArrivalDate,ex_sailingdate ";
*/
var sql1 = " select HTH 合同号,m.contractno,dbo.F_AuditStatusReceiptName(m.contractno,'OK') CN_OK ";
sql1 = sql1 + " ,dbo.F_AuditStatusReceiptName_EN(m.contractno,'OK') En_OK ";
sql1 = sql1 + " ,dbo.F_AuditStatusReceiptName(m.contractno,'NO') CN_NO ";
sql1 = sql1 + " ,dbo.F_AuditStatusReceiptName_EN(m.contractno,'NO') En_NO ";
sql1 = sql1 + " from Import_Main m ";
sql1 = sql1 + " where m.id in(" + MainList + ") ";
//sql1 = sql1 + " order by ArrivalDate,ex_sailingdate ";
var sql2 = "select '" + SHOWNAME + "' SHOWNAME,'" + printdate + "' printdate";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
, // 调用的函数
itemcontextmenu: function (his, record, item, index, e) {
// itemcontextmenu( Ext.view.View this, Ext.data.Model record,
// HTMLElement item, Number index, Ext.EventObject e, Object eOpts )
// 分类代码表的右键菜单
e.preventDefault();
e.stopEvent(); // 取消浏览器默认事件
var array = [{
text: '样本清单已做',
handler: function () {
}
}, {
text: '样本清单已检查',
handler: function () {
}
}, {
text: '样本清单未做',
handler: function () {
}
}, {
text: '样本清单未检查',
handler: function () {
}
}];
var nodemenu = new Ext.menu.Menu({
items: array
});
nodemenu.showAt(e.getXY()); // 菜单打开的位置
}
});