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/ImportDelivery/ImportDeliveryIndex.js

1027 lines
37 KiB
JavaScript

2 years ago
Ext.namespace('Shipping');
Shipping.ImportDeliveryIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.ImportDeliveryIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.ImportDeliveryIndex, Ext.Panel, {
PageSize: 100,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
initUIComponents: function () {
//定义数据集
this.formname = "formImportDeliveryIndex"; //页面名称
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' }
});
this.StoreOpRange.load({ params: { optype: "modImportSales"} });
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'ImportDeliverymb',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Import/ImportDelivery/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
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.initgirdcolums = [
{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
}, {
sortable: true,
dataIndex: 'BSSTATUS',
header: '业务锁定状态',
width: 80,
renderer: function (value, cellmeta) {
if (value == "1") {
return "<img src='../../../../TruckMng/Content/Images/Lock.png' />";
}
if (value == "2") {
return "<img src='../../../../TruckMng/Content/Images/submit.png' />";
}
}
}, {
sortable: true,
dataIndex: 'OUTRECEIPT',
header: '出库回执',
width: 80,
renderer: function (value, cellmeta) {
if (value == "1") {
return "<img src='../../../../TruckMng/Content/Images/submit.png' />";
}
}
},
{
sortable: true,
dataIndex: 'SALESNO',
header: '销售单号',
width: 130
},
{
sortable: true,
dataIndex: 'DELIVERYNO',
header: '出库单号',
width: 130
},
{
sortable: true,
dataIndex: 'DELIVERYDATE',
header: '出库日期',
width: 80
},
{
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '客户名称',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CORPID',
header: 'CORPID',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'DEPTGID',
header: 'DEPTGID',
width: 80
},
{
sortable: true,
dataIndex: 'OP',
header: '操作',
width: 80
},
{
sortable: true,
dataIndex: 'SALER',
header: '销售',
width: 80
},
{
sortable: true,
dataIndex: 'CONTACT',
header: '送货联系人',
width: 80
},
{
sortable: true,
dataIndex: 'TEL',
header: '送货联系电话',
width: 80
},
{
sortable: true,
dataIndex: 'TRUCKNO',
header: '车号',
width: 80
},
{
sortable: true,
dataIndex: 'WAREHOUSE',
header: '仓库',
width: 80
},
{
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'TIMEMARK',
header: 'TIMEMARK',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CORPRef',
header: '分公司',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'DEPTRef',
header: '部门',
width: 80
}, {
sortable: true,
dataIndex: 'SFKC',
header: '是否控车',
width: 80,
renderer: function (value, cellmeta) {
if (value == "1") {
return "<img src='../../../../TruckMng/Content/Images/submit.png' />";
}
}
}, {
sortable: true,
dataIndex: 'SFCM',
header: '是否抄码',
width: 80,
renderer: function (value, cellmeta) {
if (value == "1") {
return "<img src='../../../../TruckMng/Content/Images/submit.png' />";
}
}
},
{
sortable: true, hidden: true,
dataIndex: 'DeliveryType',
header: 'DeliveryType',
width: 80
},
{
sortable: true,
dataIndex: 'DeliveryType_REF',
header: '出库类型',
width: 80
}
];
this.girdcolums = this.initgirdcolums;
//定义Grid
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
selModel: this.GridCheckBoxModel,
trackMouseOver: true,
disableSelection: false,
columns: this.girdcolums,
// paging bar on the bottom
viewConfig: {
autoFill: true,
enableTextSelection: true
},
bbar: [Ext.create('Ext.PagingToolbar', {
id: "bbar",
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum]
});
/////////////以下部分为获取存储的gridpanel显示样式
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 0, true); //使用者id表名中间column数组跳过一开始的几列
this.girdcolums.unshift(new Ext.grid.RowNumberer());
this.gridList.reconfigure(this.storeList, this.girdcolums);
////////////////////////////////////////////////
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
DsOpenEditWin('/Import/ImportDelivery/Edit', "编辑出库单");
}, this);
//#region formSearch
//客户加载_委托单位
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustCode.load({ params: { condition: ""} });
//委托单位
_this = this;
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '委托单位',
store: this.storeCustCode, flex: 1,
forceSelection: true,
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeSALER = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeSALER.load();
//客服
this.comboxSALER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '销售',
store: this.storeSALER,
forceSelection: true,
name: 'SALER',
valueField: 'UserName',
displayField: 'CodeAndName'
});
this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '操作',
store: this.storeSALER,
forceSelection: true,
name: 'OP',
valueField: 'UserName',
displayField: 'CodeAndName'
});
this.storeSTORAGENAME = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeSTORAGENAME.load({ params: { condition: " ISWAREHOUSE=1 "} });
this.comboxSTORAGENAME = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '仓库名称',
store: this.storeSTORAGENAME,
//allowBlank: false,
forceSelection: true,
name: 'STORAGENAME',
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.storeOUTRECEIPT = Ext.create('Ext.data.Store', {
fields: ['VALUE', 'NAME']
});
this.storeOUTRECEIPT.add({ "VALUE": "1", "NAME": "是" });
this.storeOUTRECEIPT.add({ "VALUE": "0", "NAME": "否" });
this.storeOUTRECEIPT.add({ "VALUE": "", "NAME": "" });
this.comboxOUTRECEIPT = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '是否有出库回执',
store: this.storeOUTRECEIPT,
name: 'OUTRECEIPT',
valueField: 'VALUE',
displayField: 'NAME',
forceSelection: true
});
this.comboxSFKC = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '是否控车',
store: this.storeOUTRECEIPT,
name: 'SFKC',
valueField: 'VALUE',
displayField: 'NAME',
forceSelection: true
});
this.comboxSFCM = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '是否抄码',
store: this.storeOUTRECEIPT,
name: 'SFCM',
valueField: 'VALUE',
displayField: 'NAME',
forceSelection: true
});
this.storeBSSTATUS = Ext.create('Ext.data.Store', {
fields: ['VALUE', 'NAME']
});
this.storeBSSTATUS.add({ "VALUE": "1", "NAME": "财务锁定" });
this.storeBSSTATUS.add({ "VALUE": "2", "NAME": "提交" });
this.storeBSSTATUS.add({ "VALUE": "6", "NAME": "驳回" });
this.storeBSSTATUS.add({ "VALUE": "0", "NAME": "未锁定" });
this.storeBSSTATUS.add({ "VALUE": "", "NAME": "" });
this.comboxBSSTATUS = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '是否已锁定',
store: this.storeBSSTATUS,
name: 'BSSTATUS',
valueField: 'VALUE',
displayField: 'NAME',
forceSelection: true
});
this.storeDeliveryType = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeDeliveryType.load({ params: { enumTypeId: 42} });
this.comboxDeliveryType = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '出库类型', id: "DeliveryType",
forceSelection: true,
store: this.storeDeliveryType,
name: 'DeliveryType'
});
//#region formSearch枚举参照相关
//#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: [
{
fieldLabel: '销售单号/合同号/提单号/箱号',
name: 'SALESNO',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxCustCode,
/*{
fieldLabel: '销售日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'SALESDATE',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},*/{
fieldLabel: '出库日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'DELIVERYDATE',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '产品描述',
name: 'CARGONAME',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxSFKC
, this.comboxBSSTATUS
]
}
]//end items(fieldset 1)
}//end fieldset 1
, {//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
this.comboxSALER
, this.comboxOP
, this.comboxSTORAGENAME
, this.comboxOUTRECEIPT
, this.comboxSFCM
, this.comboxDeliveryType
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//#endregion formSearch
//查询工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: "新建",
iconCls: "btnadd",
handler: function (button, event) {
this.OprationStatus = 'add';
DsOpenEditWin('/Import/ImportDelivery/Edit');
},
scope: this
},
'-',
{
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
},
{
text: "重置条件",
iconCls: "btnreset",
handler: function (button, event) {
var form = this.formSearch.getForm();
form.reset();
},
scope: this
}, {
text: '提交审核',hidden:true,
tooltip: '提交审核',
handler: function (button, event) {
//this.onSubmitAuditClick();
},
scope: this
}, {
text: '撤销审核', hidden: true,
tooltip: '撤销审核',
handler: function (button, event) {
this.onSubmitAuditBackClick();
},
scope: this
}, '-',
{
text: "删除",
id: 'btndelete',
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(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: "打印",
iconCls: 'btnprint',
menu: [{
text: '货转出库',
handler: function (menu, event) {
_this.Print_HZCK();
}
}
],
scope: this
}, '-', {
text: "导出Excel",
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
_this.onExportClick(button, event);
},
scope: this
}
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 115,
items: [this.formSearch, this.panelBtn]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList]
});
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
this.PageSize = this.Pagenum.getValue();
this.storeList.pageSize = this.PageSize;
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.onRefreshClick();
}, //end initUIComponents
onRefreshClick: function (button, event) {
this.PageSize = this.Pagenum.getValue();
var sql = this.getCondition();
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
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];
var BSSTATUS = record.data.BSSTATUS;
if (BSSTATUS == '1') {
//锁定状态不可删除
Ext.Msg.show({ title: '提示', msg: '锁定状态的单据无法删除!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var _L = selections.length;
Ext.MessageBox.confirm('提示', '确定删除这' + _L + '条记录吗?', function (btn) {
if (btn == 'yes') {
//var record = selections[0];
for (var i = 0; i < _L; i++) {
var record = selections[i];
var DELIVERYNO = record.data.DELIVERYNO;
//var HTH = record.data.HTH;
var sql = " DELIVERYNO='" + DELIVERYNO + "'";
Ext.Ajax.request({
waitMsg: '正在查询数据...',
url: '/Import/XXH/GetChfee',
scope: this,
async: false,
params: { condition: sql },
waitMsg: "正在查询数据...",
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
var returnData = jsonresult.data;
//alert(returnData.Count);
this.ChfeeCount = parseInt(returnData.Count);
if (this.ChfeeCount != "") {
alert("出库单<" + DELIVERYNO + ">内包含未删除的费用,不能删除");
return;
} else {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/Import/ImportDelivery/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.DelWMSOUT(DELIVERYNO);//20170208 改为在后台进行
this.storeList.remove(record);
Ext.Msg.show({ title: '提示', msg: "数据删除结束", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
}
});
}
//this.storeList.remove(record);
//if (i >= _L ) {
// Ext.Msg.show({ title: '提示', msg: "数据删除结束", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
//}
};
this.onRefreshClick(button, event);
}, this);
}, //onDeleteClick
DelWMSOUT: function (DELIVERYNO) {
//var basicForm = this.formEdit.getForm();
//var data = basicForm.getValues();
//var DELIVERYNO = data.DELIVERYNO;
var _this = this;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/WMS/DeleteOUTByBSNO',
scope: this,
async: false,
params: {
BSNO: DELIVERYNO
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
_this.DelFee(DELIVERYNO);
if (response.responseText != "") {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
//var returnData = jsonresult.Data;
} 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');
}
});
},
onSubmitAuditClick: function () {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var BILLNOStr = '';
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
var BILLNO = rec.data.BILLNO;
if (rec.data.BILLSTATUS == '1' || rec.data.BILLSTATUS == '6') {
if (BILLNOStr == '')
BILLNOStr = BILLNO;
else {
BILLNOStr = BILLNOStr + ',' + BILLNO;
}
}
}
_this = this;
if (BILLNOStr == '') {
} else {
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Account/Chfee_ForeignPay/SubmitAuditList',
params: {
bills: BILLNOStr
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
_this.onRefreshClick();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
onSubmitAuditBackClick: function () {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var BILLNOStr = '';
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
var BILLNO = rec.data.BILLNO;
if (rec.data.BILLSTATUS == '2') {
if (BILLNOStr == '')
BILLNOStr = BILLNO;
else {
BILLNOStr = BILLNOStr + ',' + BILLNO;
}
}
}
_this = this;
if (BILLNOStr == '') {
} else {
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Account/Chfee_ForeignPay/SubmitAuditBackList',
params: {
bills: BILLNOStr
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
_this.onRefreshClick();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
};
},
getCondition: function () {
var form = this.formSearch.getForm();
/*if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}*/
var sql = "";
var SALESNO = form.findField('SALESNO').getValue();
sql = sql + getAndConSql(sql, SALESNO, " (SALESNO like '%" + SALESNO
+ "%' or SALESNO in(select SALESNO from import_saledetail where BSNO in( "
+ "select contractno from import_main m where m.hth like '%" + SALESNO + "%' or m.billno like '%" + SALESNO + "%' or m.containerno like '%" + SALESNO + "%')))");
var CUSTOMERNAME = form.findField('CUSTOMERNAME').getValue();
sql = sql + getAndConSql(sql, CUSTOMERNAME, "CUSTOMERNAME like '%" + CUSTOMERNAME + "%'");
var DELIVERYDATE = form.findField('DELIVERYDATE').getRawValue();
sql = sql + getAndConSql(sql, DELIVERYDATE, " DELIVERYDATE>= '" + DELIVERYDATE + "' and DELIVERYDATE <= '" + DELIVERYDATE + " 23:59:59' ");
var CARGONAME = form.findField('CARGONAME').getValue();
sql = sql + getAndConSql(sql, CARGONAME, "CARGONAME like '%" + CARGONAME + "%'");
var SALER = form.findField('SALER').getValue();
sql = sql + getAndConSql(sql, SALER, " DELIVERYNO in( select deliveryno from Vw_ImportDelivery where SALER like '%" + SALER + "%')");
var STORAGENAME = form.findField('STORAGENAME').getValue();
sql = sql + getAndConSql(sql, STORAGENAME, " DELIVERYNO in( select DELIVERYNO from Vw_ImportDelivery where WAREHOUSE like '%" + STORAGENAME + "%')");
var OP = form.findField('OP').getValue();
sql = sql + getAndConSql(sql, OP, " OP like '%" + OP + "%' ");
var OUTRECEIPT = form.findField('OUTRECEIPT').getValue();
sql = sql + getAndConSql(sql, OUTRECEIPT, " isnull(OUTRECEIPT,0) = " + OUTRECEIPT + " ");
var SFKC = form.findField('SFKC').getValue();
sql = sql + getAndConSql(sql, SFKC, " isnull(SFKC,0) = " + SFKC + " ");
var SFCM = form.findField('SFCM').getValue();
sql = sql + getAndConSql(sql, SFCM, " isnull(SFCM,0) = " + SFCM + " ");
var BSSTATUS = form.findField('BSSTATUS').getValue();
sql = sql + getAndConSql(sql, BSSTATUS, " isnull(BSSTATUS,0) = " + BSSTATUS + " ");
var DeliveryType = form.findField('DeliveryType').getValue();
sql = sql + getAndConSql(sql, DeliveryType, " DeliveryType = " + DeliveryType + " ");
return sql;
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
},
onExportClick: function (button, event) {
GridExportExcelPage(this.gridList);
//GridExportExcelPage(this.gridListSale);
}
, Print_HZCK: function () { //入库通知
var MainList = "";
var selectedRecords = [];
selectedRecords = this.gridList.selModel.getSelection();
var CUSTOMERNAME = "";
var WAREHOUSE = "";
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
//判断是否为同一仓库同一货主的货物
if (CUSTOMERNAME == "" && WAREHOUSE == "") {
CUSTOMERNAME = rec.get('CUSTOMERNAME');
WAREHOUSE = rec.get('WAREHOUSE');
} else
if (CUSTOMERNAME != rec.get('CUSTOMERNAME') || WAREHOUSE != rec.get('WAREHOUSE'))
{
alert("货主或仓库不同,不能加入表格");
continue;
}
if (MainList == "") { MainList = "'" + rec.get('DELIVERYNO') + "'"; }
else {
MainList = MainList + ",'" + rec.get('DELIVERYNO') + "'";
}
}
if (MainList == "") {
Ext.Msg.show({ title: '错误', msg: '选中至少一个合同', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
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 = 'ImportTrade_HZCK_DHM'; //货转出库打印格式
var sql1 = " select m.hth 合同号,m.containerno 箱号,c.name 货名 ";
sql1 = sql1 + " ,(select description from info_client where shortname='" + CUSTOMERNAME + "') 货主 ";
sql1 = sql1 + " ,(select description from info_client where shortname='" + WAREHOUSE + "') 冷库 ";
sql1 = sql1 + " ,(select dbo.trimdate( min(wmsdate)) from wms where cargo_gid=c.gid ) 入库日期 ";
sql1 = sql1 + " ,dd.WEIGHT_EX 预计出库重量, dd.BOXCOUNT_EX 预计出库件数 ";
sql1 = sql1 + " ,d.CONTACT 联系人,d.TEL 电话 ,dbo.[trimcndate](d.DELIVERYDATE) 出库日期 ";
sql1 = sql1 + " ,(select substring(country,0,(charindex('(',country)) ) from code_country where countryid=m.countryid) 国家 ";
sql1 = sql1 + " ,c.FactoryNo 厂号 ";
sql1 = sql1 + " from Import_delivery d ";
sql1 = sql1 + " left join Import_deliverydetail dd on dd.deliveryno=d.deliveryno ";
sql1 = sql1 + " left join Import_Saledetail sd on sd.gid=dd.SALEDETAIL_GID ";
sql1 = sql1 + " left join Import_cargo c on c.gid=sd.CARGO_GID ";
sql1 = sql1 + " left join import_main m on m.ContractNo=c.ContractNo ";
sql1 = sql1 + " where d.DELIVERYNO in(" + MainList + ") ";
var sql2 = "select '" + SHOWNAME + "' showname,'" + printdate + "' printdate";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
var sql6 = sql6 + "";
var sql6 = sql6 + "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
});