This commit is contained in:
xd 2024-05-17 13:25:22 +08:00
parent c30010c017
commit 840c62fd3d
8 changed files with 267 additions and 22 deletions

View File

@ -1,5 +1,5 @@
#for tests only !
#Wed May 15 15:21:44 CST 2024
#Fri May 17 13:23:58 CST 2024
jco.destination.pool_capacity=10
jco.client.lang=ZH
jco.client.ashost=172.19.0.120

View File

@ -60,6 +60,20 @@ public class SapRfcController
@Autowired
private RedisCache redisCache;
/**
* 获取SAP 客户数据
* @param rfcResult
* @return
*/
@GetMapping("/listCustomer")
public AjaxResult listCustomer(RfcResult rfcResult)
{
List<RfcResult> res = SapRfcUtils.listCustomer(rfcResult);
return AjaxResult.success(res);
}
/**
* 获取SAP 国家数据
* @param customer

View File

@ -11,6 +11,39 @@ import java.util.List;
public class SapRfcUtils {
/**
* 获取SAP 国家数据
* @param param
* @return
*/
public static List<RfcResult> listCustomer(RfcResult param) {
JCoFunction function = null;
RfcResult rfcResult = null;
List<RfcResult> rfcResults = new ArrayList<>();
JCoDestination destination = ConnectToSAP.connect();
try {
function = destination.getRepository().getFunctionTemplate("ZOA03_SEND_COM").getFunction();
if (function == null)
throw new RuntimeException("RFC_SYSTEM_INFO not found in SAP.");
JCoParameterList input = function.getImportParameterList();
input.getStructure("KH").setValue("KUNNR",param.getValue());
input.getStructure("KH").setValue("NAME1",param.getLabel());
function.execute(destination);
JCoTable table = function.getTableParameterList().getTable("OUTKH");
for(int i = 0; i<table.getNumRows(); i++){
table.setRow(i);
rfcResult = new RfcResult();
rfcResult.setValue(table.getString("KUNNR"));
rfcResult.setLabel(table.getString("NAME1"));
rfcResults.add(rfcResult);
}
}catch (Exception e) {
e.printStackTrace();
}
return rfcResults;
}
/**
* 获取SAP国家数据
* @param param 不传查询全部
@ -439,4 +472,32 @@ public class SapRfcUtils {
}
return res;
}
public static void main(String[] args) {
JCoFunction function = null;
RfcResult rfcResult = null;
List<RfcResult> countrys = new ArrayList<>();
JCoDestination destination = ConnectToSAP.connect();
try {
function = destination.getRepository().getFunctionTemplate("ZOA03_SEND_COM").getFunction();
if (function == null)
throw new RuntimeException("RFC_SYSTEM_INFO not found in SAP.");
JCoParameterList input = function.getImportParameterList();
input.getStructure("KH").setValue("NAME1","无锡");
function.execute(destination);
JCoTable table = function.getTableParameterList().getTable("OUTKH");
for(int i = 0; i<table.getNumRows(); i++){
table.setRow(i);
rfcResult = new RfcResult();
rfcResult.setValue(table.getString("KUNNR"));
rfcResult.setLabel(table.getString("NAME1"));
countrys.add(rfcResult);
}
}catch (Exception e) {
e.printStackTrace();
}
System.out.println(countrys.size());
}
}

View File

@ -1,5 +1,14 @@
import request from '@/utils/request'
// 查询SAP 客户数据
export function listCustomer(query) {
return request({
url: '/rfc/rfc/listCustomer',
method: 'get',
params: {'value':query.Code,'label':query.Name}
})
}
// 查询SAP 国家数据
export function getCountrys(query) {
return request({

View File

@ -0,0 +1,150 @@
<template>
<el-dialog
title="客户选择"
:visible.sync="open"
:width="width || '900px'"
:height="height || '650px'"
:show-close="false" append-to-body>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="100px">
<el-form-item label="公司编码" prop="Code">
<el-input
v-model="queryParams.Code"
placeholder="请输入公司编码"
clearable
/>
</el-form-item>
<el-form-item label="公司名称" prop="Name">
<el-input
v-model="queryParams.Name"
placeholder="请输入公司名称"
clearable
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" ref="table" :data="pagedData" @selection-change="handleSelectionChange" height="300">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="公司编码" align="center" prop="value" />
<el-table-column label="公司名称" align="center" prop="label" />
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="currentPage"
:limit.sync="pageSize"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="confirm" :disabled="single"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { listCustomer } from "@/api/common/sapRfc";// sap-rfc
export default {
name: "CustomerSelect",
props: {
width: {
type: String,
default: "900px",
},
height: {
type: String,
default: '650px'
},
open: {
type: Boolean,
default:false,
}
},
data() {
return {
//
loading: false,
//
single: true,
//
multiple: true,
//
queryParams: {
Code: null,
Name: null
},
//
total: 0,
pageSize: 10,
currentPage: 1,
customerList: [],
//
checkedCustomer: null,
}
},
methods: {
/** 切换每页显示条数 */
handleSizeChange(val) {
this.pageSize = val;
this.currentPage = 1;
},
/** 页码选择 */
handleCurrentChange(val) {
this.currentPage = val;
},
/** 查询客户管理列表 */
getList() {
this.loading = true;
listCustomer(this.queryParams).then(response => {
this.customerList = response.data;
this.total = response.data.length;
this.currentPage = 1;
this.loading = false;
});
},
/** 搜索按钮操作 */
handleQuery() {
if(this.queryParams.Code || this.queryParams.Name){
this.queryParams.pageNum = 1;
this.getList();
}else{
this.$message.warning("请输入查询条件!");
return;
}
},
//
handleSelectionChange(selection) {
this.checkedCustomer = selection[0];
this.single = selection.length!==1
this.multiple = !selection.length
},
//
cancel() {
this.$emit('cancel');
},
//
confirm() {
this.customerList = [];
this.total = 0;
this.resetForm("queryForm");
this.$emit("submit", this.checkedCustomer); //usernamenickname
},
},
computed: {
//
pagedData() {
const startIndex = (this.currentPage - 1) * this.pageSize;
const endIndex = startIndex + this.pageSize;
return this.customerList.slice(startIndex, endIndex);
},
},
}
</script>
<style scoped>
</style>

View File

@ -6,7 +6,8 @@
:width="width || '900px'"
:height="height || '650px'"
:before-close="handleClose"
append-to-body>
append-to-body
class="customer-dialog">
<div class="selectBox">
<div class="bottomBox" v-show="showSearch">
@ -141,8 +142,6 @@
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
@ -151,14 +150,15 @@
</div>
</template>
<style>
/** 弹出框设置 */
.customer-dialog .el-dialog__body {
padding: 0px 20px;
}
</style>
<script>
import { listUser, getUser, deptTreeSelect } from "@/api/system/user";
import { getToken } from "@/utils/auth";
import Treeselect from "@riophae/vue-treeselect";
export default {
@ -188,9 +188,7 @@
},
data() {
return {
loading: false,
// open: false,
activeName: 'first',
defaultProps: {
@ -219,10 +217,8 @@
//
checkedUsers: [],
// userNodeAll: false,
// cancelUserNodeAll: false,
};
},
created() {
@ -247,11 +243,9 @@
console.log(tab, event);
},
//
getNickNameList(uns) {
let result = [];
uns.forEach(item => {
if(this.allUserMap.has(item)) {
var json = {};
@ -377,17 +371,14 @@
this.updateCheckedUsers();
},
clearAll() {
this.checkedUsers = [];
this.updateCheckedUsers();
}
}
}
</script>
<style lang="scss" scoped>
.selectBox {
width:100%;
min-width: 900px;

View File

@ -166,7 +166,7 @@
<el-form-item label="客户" prop="quotCustomerName">
<el-input v-model="form.quotCustomerBm" v-if="false"/>
<el-input v-model="form.quotCustomerName" placeholder="请输入客户" :disabled="true">
<div v-hasPermi="['quot:quot:add']"><el-button icon="el-icon-search" v-if="this.form.quotApprovalStatus == '0' || this.form.quotApprovalStatus == null"></el-button></div>
<el-button slot="append" icon="el-icon-search" @click="openCustomer" v-if="this.form.quotApprovalStatus == '0' || this.form.quotApprovalStatus == null"></el-button>
</el-input>
</el-form-item>
</el-col>
@ -681,6 +681,8 @@
</div>
</el-dialog>
<CustomerSelect ref="customerSelect" :open="customerOpen" @submit="submitCustomer" @cancel="customerOpen=false"></CustomerSelect>
<!-- 技术确认单详情对话框 -->
<jsqrDialog ref="jsqrDialog"></jsqrDialog>
@ -723,15 +725,18 @@ import { getToken } from "@/utils/auth";
import { checkPermi } from '@/utils/permission';//
import { getDicts } from "@/api/system/dict/data";
//
/** 导入客户选择组件 */
import CustomerSelect from "@/views/components/Tools/CustomerSelect/index.vue";
/** 导入技术确认单详情组件*/
import jsqrDialog from '@/views/technicalConfirm/technicalConfirm/jsxzInfo.vue';
//
/** 导入核价单详情组件*/
import hjDialog from '@/views/priceVerification/priceVerification/hjInfo.vue';
export default {
name: "Quot",
components: {
//
'CustomerSelect': CustomerSelect,
'jsqrDialog': jsqrDialog,
'hjDialog': hjDialog
},
@ -775,6 +780,10 @@ export default {
title: "",
//
open: false,
//
customerOpen:false,
//
addFileOpen: false,
//
@ -834,6 +843,17 @@ export default {
this.getList();
},
methods: {
//
openCustomer(){
this.customerOpen=true;
},
//
submitCustomer(customer){
this.form.quotCustomerBm = customer.value;
this.form.quotCustomerName = customer.label;
this.customerOpen=false;
},
/** 清空表单 */
reset(){
this.form = {