Commit aa0e1e49 authored by 鲁鑫's avatar 鲁鑫

供应商新增、修改流程控制

parent a67ff136
...@@ -10,6 +10,7 @@ $(document).ready(function () { ...@@ -10,6 +10,7 @@ $(document).ready(function () {
loadSuppliersBuyerListGrid(); loadSuppliersBuyerListGrid();
loadSuppliersBankListGrid(); loadSuppliersBankListGrid();
bindEvent(); bindEvent();
controlCashierGrid();
}); });
function initialize(){ function initialize(){
UICtrl.layout("#layout", {leftWidth: 3}); UICtrl.layout("#layout", {leftWidth: 3});
...@@ -24,6 +25,10 @@ function initialize(){ ...@@ -24,6 +25,10 @@ function initialize(){
UICtrl.setDisable($("#submitForm")); UICtrl.setDisable($("#submitForm"));
canEdit=false; canEdit=false;
} }
$('#supplierList').fileList({
bizId : $("#id").val()
});
} }
/** /**
...@@ -42,6 +47,10 @@ function setId(bizId) { ...@@ -42,6 +47,10 @@ function setId(bizId) {
sapSuppliersPayGridManager.loadData(); sapSuppliersPayGridManager.loadData();
sapSuppliersBuyerGridManager.loadData(); sapSuppliersBuyerGridManager.loadData();
sapSuppliersBankGridManager.loadData(); sapSuppliersBankGridManager.loadData();
$('#supplierList').fileList({
bizId : bizId
});
} }
/** /**
...@@ -62,34 +71,188 @@ function getsId() { ...@@ -62,34 +71,188 @@ function getsId() {
} }
// 加载付款信息表格 // 加载采购组织信息表格
function loadSuppliersPayListGrid() { function loadSuppliersBuyerListGrid() {
var toolbarOptions = UICtrl.getDefaultToolbarOptions({ var toolbarOptions = null;
// 添加一行表格 if (applyType == 0){
addHandler: function () { toolbarOptions = UICtrl.getDefaultToolbarOptions({
UICtrl.addGridRow(sapSuppliersPayGridManager, // 添加一行表格
{ addHandler: function () {
// 行号加一 UICtrl.addGridRow(sapSuppliersBuyerGridManager,
sequence: (sapSuppliersPayGridManager.getData().length + 1)*10,reprf:"X" {
// 行号加一
sequence: (sapSuppliersBuyerGridManager.getData().length + 1)*10,
webre:"X",
kalsk:"Z1"
}
);
},
// 删除
deleteHandler: function () {
var _grid = UICtrl.getGridManager('#sapSuppliersBuyerGrid');
DataUtil.delSelectedRows({
action: 'sapSuppliersData/deleteSuppliersBuyers.ajax',
param: {},
gridManager: _grid,
idFieldName: 'id',
onSuccess: function () {
sapSuppliersBuyerGridManager.loadData();
}
});
}
});
}
// 表格
sapSuppliersBuyerGridManager = UICtrl.grid("#sapSuppliersBuyerGrid", {
gridManager: null,
columns: getBuyColumns(),
dataAction: "server",
url: web_app.name + '/sapSuppliersData/slicedSuppliersBuyerData.ajax',
parms: {sId: getsId},
pageSize: 20,
usePager: true,
toolbar: toolbarOptions,
enabledEdit: canEdit,
width: "98%",
height: "300px",
heightDiff: -8,
checkbox: true,
fixedCellHeight: true,
selectRowButtonOnly: true,
});
UICtrl.setSearchAreaToggle(sapSuppliersBuyerGridManager);
}
function getBuyColumns(){
var columns = [];
columns.push({
display: "行号", name: "sequence", width: 80, minWidth: 60, type: "String", align: "left",
//editor: {type: 'spinner', min: 1, max: 100, mask: 'nnn'}
},)
//修改不能编辑采购组织
if (applyType == 1){
columns.push({
display: "采购组织", name: "ekorgTextView", width: 200, minWidth: 60, type: "String", align: "left",
})
}else {
columns.push({
display: "采购组织", name: "ekorgTextView", width: 200, minWidth: 60, type: "String", align: "left",
editor: {
type: 'dictionary',
data: {name: 'ekorg'},
textField: 'ekorgTextView',
valueField: 'ekorg',
required: true,
render: function (item) {
return item.ekorgTextView;
} }
); },
},)
}
columns.push({
display: "货币码", name: "waersTextView", width: 140, minWidth: 60, type: "String", align: "left",
editor: {
type: 'dictionary',
data: {name: 'waers'},
textField: 'waersTextView',
valueField: 'waers',
required: true,
render: function (item) {
return item.waersTextView;
}
}, },
// 删除选中的尺码信息 },)
deleteHandler: function () { columns.push({
var _grid = UICtrl.getGridManager('#sapSuppliersPayGrid'); display: "付款条件", name: "payConditionTextView", width: 150, minWidth: 60, type: "String", align: "left",
DataUtil.delSelectedRows({ editor: {
action: 'sapSuppliersData/deleteSuppliersPays.ajax', type: 'dictionary',
param: {}, data: {name: 'payCondition'},
gridManager: _grid, textField: 'payConditionTextView',
idFieldName: 'id', valueField: 'payCondition',
onSuccess: function () { required: true,
sapSuppliersPayGridManager.loadData(); render: function (item) {
} return item.payConditionTextView;
}); }
} },
}); },)
if (applyType=="-1"){ columns.push({
toolbarOptions=null; display: "国际贸易条款", name: "inco1TextView", width: 200, minWidth: 60, type: "String", align: "left",
editor: {
type: 'dictionary',
data: {name: 'inco1'},
textField: 'inco1TextView',
valueField: 'inco1',
required: false,
render: function (item) {
return item.inco1TextView;
}
},
},)
columns.push({
display: "国际贸易条款位置1", name: "inco2L", width: 140, minWidth: 60, type: "String", align: "left",
editor: {type: 'text', required: false}
},)
columns.push( {
display: "国际贸易条款位置2", name: "inco3L", width: 160, minWidth: 60, type: "String", align: "left",
editor: {type: 'text', required: false}
},)
columns.push({
display: "收货的发票验证", name: "webre", width: 100, minWidth: 60, type: "String", align: "left",
//editor: {type: 'text', required: true}
},)
columns.push({
display: "供应商方案组", name: "kalsk", width: 140, minWidth: 60, type: "String", align: "left",
//editor: {type: 'text', required: true}
},)
columns.push({
display: "供应商销售人员", name: "verkf", width: 140, minWidth: 60, type: "String", align: "left",
editor: {type: 'text', required: false}
},)
columns.push({
display: "供应商电话号码", name: "telf1", width: 140, minWidth: 60, type: "String", align: "left",
editor: {type: 'text', required: false}
},)
columns.push({
display: "服务的发票校验标识", name: "lebre", width: 140, minWidth: 60, type: "String", align: "left",
editor: {type: 'text', required: false}
},)
columns.push( {
display: "采购冻结", name: "sperm", width: 140, minWidth: 60, type: "String", align: "left",
editor: {type: 'text', required: false}
},)
return columns;
}
// 加载付款信息表格
function loadSuppliersPayListGrid() {
var toolbarOptions = null;
if (applyType == 0){
toolbarOptions = UICtrl.getDefaultToolbarOptions({
// 添加一行表格
addHandler: function () {
UICtrl.addGridRow(sapSuppliersPayGridManager,
{
// 行号加一
sequence: (sapSuppliersPayGridManager.getData().length + 1)*10,reprf:"X"
}
);
},
// 删除选中的尺码信息
deleteHandler: function () {
var _grid = UICtrl.getGridManager('#sapSuppliersPayGrid');
DataUtil.delSelectedRows({
action: 'sapSuppliersData/deleteSuppliersPays.ajax',
param: {},
gridManager: _grid,
idFieldName: 'id',
onSuccess: function () {
sapSuppliersPayGridManager.loadData();
}
});
}
});
} }
// 表格 // 表格
sapSuppliersPayGridManager = UICtrl.grid("#sapSuppliersPayGrid", { sapSuppliersPayGridManager = UICtrl.grid("#sapSuppliersPayGrid", {
...@@ -154,7 +317,7 @@ function loadSuppliersPayListGrid() { ...@@ -154,7 +317,7 @@ function loadSuppliersPayListGrid() {
data: {name: 'zwels'}, data: {name: 'zwels'},
textField: 'zwelsTextView', textField: 'zwelsTextView',
valueField: 'zwels', valueField: 'zwels',
// checkbox:true, // checkbox:true,
required: true, required: true,
render: function (item) { render: function (item) {
return item.zwelsTextView; return item.zwelsTextView;
...@@ -210,181 +373,34 @@ function loadSuppliersPayListGrid() { ...@@ -210,181 +373,34 @@ function loadSuppliersPayListGrid() {
UICtrl.setSearchAreaToggle(sapSuppliersPayGridManager); UICtrl.setSearchAreaToggle(sapSuppliersPayGridManager);
} }
// 加载银行信息表格
// 加载采购组织信息表格 function loadSuppliersBankListGrid() {
function loadSuppliersBuyerListGrid() { var toolbarOptions = null;
var toolbarOptions = UICtrl.getDefaultToolbarOptions({ if (applyType == 0){
// 添加一行表格 toolbarOptions = UICtrl.getDefaultToolbarOptions({
addHandler: function () { // 添加一行表格
UICtrl.addGridRow(sapSuppliersBuyerGridManager, addHandler: function () {
{ UICtrl.addGridRow(sapSuppliersBankGridManager,
// 行号加一 {
sequence: (sapSuppliersBuyerGridManager.getData().length + 1)*10, // 行号加一
webre:"X", sequence: (sapSuppliersBankGridManager.getData().length + 1)*10
kalsk:"Z1"
}
);
},
// 删除
deleteHandler: function () {
var _grid = UICtrl.getGridManager('#sapSuppliersBuyerGrid');
DataUtil.delSelectedRows({
action: 'sapSuppliersData/deleteSuppliersBuyers.ajax',
param: {},
gridManager: _grid,
idFieldName: 'id',
onSuccess: function () {
sapSuppliersBuyerGridManager.loadData();
}
});
}
});
if (applyType=="-1"){
toolbarOptions=null;
}
// 表格
sapSuppliersBuyerGridManager = UICtrl.grid("#sapSuppliersBuyerGrid", {
gridManager: null,
columns: [
{
display: "行号", name: "sequence", width: 80, minWidth: 60, type: "String", align: "left",
//editor: {type: 'spinner', min: 1, max: 100, mask: 'nnn'}
},
{
display: "采购组织", name: "ekorgTextView", width: 200, minWidth: 60, type: "String", align: "left",
editor: {
type: 'dictionary',
data: {name: 'ekorg'},
textField: 'ekorgTextView',
valueField: 'ekorg',
required: true,
render: function (item) {
return item.ekorgTextView;
}
},
},
{
display: "货币码", name: "waersTextView", width: 140, minWidth: 60, type: "String", align: "left",
editor: {
type: 'dictionary',
data: {name: 'waers'},
textField: 'waersTextView',
valueField: 'waers',
required: true,
render: function (item) {
return item.waersTextView;
}
},
},
{
display: "付款条件", name: "ztermTextView", width: 150, minWidth: 60, type: "String", align: "left",
editor: {
type: 'dictionary',
data: {name: 'zterm'},
textField: 'ztermTextView',
valueField: 'zterm',
required: true,
render: function (item) {
return item.ztermTextView;
} }
}, );
}, },
{ // 删除选中的尺码信息
display: "国际贸易条款", name: "inco1TextView", width: 200, minWidth: 60, type: "String", align: "left", deleteHandler: function () {
editor: { var _grid = UICtrl.getGridManager('#sapSuppliersBankGrid');
type: 'dictionary', DataUtil.delSelectedRows({
data: {name: 'inco1'}, action: 'sapSuppliersData/deleteSuppliersBanks.ajax',
textField: 'inco1TextView', param: {},
valueField: 'inco1', gridManager: _grid,
required: false, idFieldName: 'id',
render: function (item) { onSuccess: function () {
return item.inco1TextView; sapSuppliersBankGridManager.loadData();
} }
}, });
}, }
{ });
display: "国际贸易条款位置1", name: "inco2L", width: 140, minWidth: 60, type: "String", align: "left",
editor: {type: 'text', required: false}
},
{
display: "国际贸易条款位置2", name: "inco3L", width: 160, minWidth: 60, type: "String", align: "left",
editor: {type: 'text', required: false}
},
{
display: "收货的发票验证", name: "webre", width: 100, minWidth: 60, type: "String", align: "left",
//editor: {type: 'text', required: true}
},
{
display: "供应商方案组", name: "kalsk", width: 140, minWidth: 60, type: "String", align: "left",
//editor: {type: 'text', required: true}
},
{
display: "供应商销售人员", name: "verkf", width: 140, minWidth: 60, type: "String", align: "left",
editor: {type: 'text', required: false}
},
{
display: "供应商电话号码", name: "telf1", width: 140, minWidth: 60, type: "String", align: "left",
editor: {type: 'text', required: false}
},
{
display: "服务的发票校验标识", name: "lebre", width: 140, minWidth: 60, type: "String", align: "left",
editor: {type: 'text', required: false}
},
/*{
display: "边境运输方式", name: "expvz", width: 140, minWidth: 60, type: "String", align: "left",
editor: {type: 'text', required: false}
}, */
{
display: "采购冻结", name: "sperm", width: 140, minWidth: 60, type: "String", align: "left",
editor: {type: 'text', required: false}
},
],
dataAction: "server",
url: web_app.name + '/sapSuppliersData/slicedSuppliersBuyerData.ajax',
parms: {sId: getsId},
pageSize: 20,
usePager: true,
toolbar: toolbarOptions,
enabledEdit: canEdit,
width: "98%",
height: "300px",
heightDiff: -8,
checkbox: true,
fixedCellHeight: true,
selectRowButtonOnly: true,
});
UICtrl.setSearchAreaToggle(sapSuppliersBuyerGridManager);
}
// 加载银行信息表格
function loadSuppliersBankListGrid() {
var toolbarOptions = UICtrl.getDefaultToolbarOptions({
// 添加一行表格
addHandler: function () {
UICtrl.addGridRow(sapSuppliersBankGridManager,
{
// 行号加一
sequence: (sapSuppliersBankGridManager.getData().length + 1)*10
}
);
},
// 删除选中的尺码信息
deleteHandler: function () {
var _grid = UICtrl.getGridManager('#sapSuppliersBankGrid');
DataUtil.delSelectedRows({
action: 'sapSuppliersData/deleteSuppliersBanks.ajax',
param: {},
gridManager: _grid,
idFieldName: 'id',
onSuccess: function () {
sapSuppliersBankGridManager.loadData();
}
});
}
});
if (applyType=="-1"){
toolbarOptions=null;
} }
// 表格 // 表格
sapSuppliersBankGridManager = UICtrl.grid("#sapSuppliersBankGrid", { sapSuppliersBankGridManager = UICtrl.grid("#sapSuppliersBankGrid", {
...@@ -635,4 +651,18 @@ function reloadGrid() { ...@@ -635,4 +651,18 @@ function reloadGrid() {
sapSuppliersPayGridManager.loadData(); sapSuppliersPayGridManager.loadData();
sapSuppliersBuyerGridManager.loadData(); sapSuppliersBuyerGridManager.loadData();
sapSuppliersBankGridManager.loadData(); sapSuppliersBankGridManager.loadData();
}
function controlCashierGrid(){
var status = $("#statusId").val();
if (status == 0 || status == 1){
$("#cashierGrid").hide();
}
let subProcUnitId = getSubProcUnitId();
if ("cashier" == subProcUnitId){
$("#cashierGrid").show();
}
if ("finance" == subProcUnitId){
$("#cashierGrid").show();
}
} }
\ No newline at end of file
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<script type="text/javascript"> <script type="text/javascript">
var applyType ="${applyType}"; var applyType ="${applyType}";
</script> </script>
<x:base include="layout,dialog,grid,tree,combox,commonTree,date"/> <x:base include="layout,dialog,grid,tree,combox,commonTree,date,attachment"/>
<x:script src='/biz/topsun/sap/suppliers/suppliersDataDetail.js'/> <x:script src='/biz/topsun/sap/suppliers/suppliersDataDetail.js'/>
</head> </head>
<body> <body>
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
<x:hidden name="positionId"/> <x:hidden name="positionId"/>
<x:hidden name="positionName"/> <x:hidden name="positionName"/>
<x:hidden name="personMemberId"/> <x:hidden name="personMemberId"/>
<x:hidden name="statusId"/>
<%-- <x:hidden name="personMemberName"/>--%> <%-- <x:hidden name="personMemberName"/>--%>
<x:title title="申请人填写区域" name="group"/> <x:title title="申请人填写区域" name="group"/>
<div class="hg-form-cols"> <div class="hg-form-cols">
...@@ -84,22 +85,24 @@ ...@@ -84,22 +85,24 @@
<%--<x:inputC name="faxExtens" label="第一个传真号分机号" labelCol="1" fieldCol="2"/>--%> <%--<x:inputC name="faxExtens" label="第一个传真号分机号" labelCol="1" fieldCol="2"/>--%>
<!--x:selectC name="ktokk" label="供应商帐户组" labelCol="1" fieldCol="2" required="true" dictionary="buGroup"/--> <!--x:selectC name="ktokk" label="供应商帐户组" labelCol="1" fieldCol="2" required="true" dictionary="buGroup"/-->
<x:inputC name="kunnr" label="客户编号" labelCol="1" fieldCol="2"/> <x:inputC name="kunnr" label="客户编号" labelCol="1" fieldCol="2"/>
<x:inputC name="vbund" label="贸易伙伴" labelCol="1" fieldCol="2"/> <%--<x:inputC name="vbund" label="贸易伙伴" labelCol="1" fieldCol="2"/>--%>
<x:inputC name="stenr" label="责任税务部门的税收编号" labelCol="2" fieldCol="2" required="true"/> <x:inputC name="stenr" label="责任税务部门的税收编号" labelCol="2" fieldCol="2" required="true"/>
<x:selectC name="sperr" label="中心记帐冻结" labelCol="1" fieldCol="1" dictionary="sperr"/> <x:selectC name="sperr" label="中心记帐冻结" labelCol="1" fieldCol="1" dictionary="sperr"/>
<x:selectC name="sperm" label="集中设置的采购冻结" labelCol="2" fieldCol="1" dictionary="sperrB"/> <x:selectC name="sperm" label="集中设置的采购冻结" labelCol="2" fieldCol="1" dictionary="sperrB"/>
</div> </div>
</div> </div>
<div class="blank_div clearfix"></div> <div style="padding-top: 15px;">
<div id="sapSuppliersPayGrid" style="margin: 2px;"></div> <x:fileList bizCode="supplier" bizId="attbizId" id="supplierList" title="供应商资料" />
</div>
<div class="blank_div clearfix"></div> <div class="blank_div clearfix"></div>
<div id="sapSuppliersBuyerGrid" style="margin: 2px;"></div> <div id="sapSuppliersBuyerGrid" style="margin: 2px;"></div>
<div class="blank_div clearfix"></div> <div id="cashierGrid">
<div id="sapSuppliersBankGrid" style="margin: 2px;"></div> <div class="blank_div clearfix"></div>
<div id="sapSuppliersPayGrid" style="margin: 2px;"></div>
<div class="blank_div clearfix"></div>
<div id="sapSuppliersBankGrid" style="margin: 2px;"></div>
</div>
</form> </form>
</body> </body>
</html> </html>
...@@ -248,7 +248,7 @@ public class ResourceSearchController { ...@@ -248,7 +248,7 @@ public class ResourceSearchController {
if (!CollectionUtils.isEmpty(mapList)){ if (!CollectionUtils.isEmpty(mapList)){
Map<String, String> map = mapList.get(0); Map<String, String> map = mapList.get(0);
String []widths=getWidths(mapList); String []widths=sapDictionaryApplication.getWidths(mapList);
for (int y=0;y<widths.length;y++){ for (int y=0;y<widths.length;y++){
totalWidths+=Long.valueOf(widths[y]); totalWidths+=Long.valueOf(widths[y]);
} }
...@@ -275,36 +275,6 @@ public class ResourceSearchController { ...@@ -275,36 +275,6 @@ public class ResourceSearchController {
return model; return model;
} }
public String[] getWidths(List<Map<String, String>> mapList){
Map<String, String> map = mapList.get(0);
String []widths=new String[map.size()];
for (int i=0;i<mapList.size();i++){
Map<String, String> mapp = mapList.get(i);
int u=0;
for (String key : mapp.keySet()) {
if (widths[u]==null){
widths[u] = "40";
}
String tmpWidth=widths[u];
String value=(String) mapp.get(key);
if (value.trim().length()>10){
if (Integer.parseInt(tmpWidth)<130){
widths[u]="130";
}
} else {
if (value.trim().length()>6){
if (Integer.parseInt(tmpWidth)<80){
widths[u]=String.valueOf(value.trim().length()*10);
}
}
}
u++;
}
}
return widths;
}
@EasySearch(queryName = "getCusAndSuppliers") @EasySearch(queryName = "getCusAndSuppliers")
public Map<String, Object> getCusAndSuppliers(SDO sdo) throws IOException { public Map<String, Object> getCusAndSuppliers(SDO sdo) throws IOException {
String param = sdo.getString("paramValue"); String param = sdo.getString("paramValue");
...@@ -312,7 +282,7 @@ public class ResourceSearchController { ...@@ -312,7 +282,7 @@ public class ResourceSearchController {
String ZEP_BPTYPE = sdo.getString("ZEP_BPTYPE"); String ZEP_BPTYPE = sdo.getString("ZEP_BPTYPE");
List<Map<String, String>> mapList = new ArrayList<>(); List<Map<String, String>> mapList = new ArrayList<>();
mapList = sapPaymentApplication.getCusAndSuppliers(BUKRS,ZEP_BPTYPE); mapList = sapPaymentApplication.getCusAndSuppliers(BUKRS,ZEP_BPTYPE);
return this.initEasySearchModel( mapList, param, sdo); return sapDictionaryApplication.initEasySearchModel( mapList, param, sdo);
} }
@EasySearch(queryName = "getCusAndBanks") @EasySearch(queryName = "getCusAndBanks")
...@@ -322,7 +292,7 @@ public class ResourceSearchController { ...@@ -322,7 +292,7 @@ public class ResourceSearchController {
String ZEP_BPTYPE = sdo.getString("ZEP_BPTYPE"); String ZEP_BPTYPE = sdo.getString("ZEP_BPTYPE");
List<Map<String, String>> mapList = new ArrayList<>(); List<Map<String, String>> mapList = new ArrayList<>();
mapList = sapPaymentApplication.getCusAndBanks(PARTNER,ZEP_BPTYPE); mapList = sapPaymentApplication.getCusAndBanks(PARTNER,ZEP_BPTYPE);
return this.initEasySearchModel( mapList, param, sdo); return sapDictionaryApplication.initEasySearchModel( mapList, param, sdo);
} }
@EasySearch(queryName = "getCompanyAndBankInfos") @EasySearch(queryName = "getCompanyAndBankInfos")
...@@ -331,7 +301,7 @@ public class ResourceSearchController { ...@@ -331,7 +301,7 @@ public class ResourceSearchController {
String BUKRS = sdo.getString("BUKRS"); String BUKRS = sdo.getString("BUKRS");
List<Map<String, String>> mapList = new ArrayList<>(); List<Map<String, String>> mapList = new ArrayList<>();
mapList = sapPaymentApplication.getCompanyAndBankInfos(BUKRS); mapList = sapPaymentApplication.getCompanyAndBankInfos(BUKRS);
return this.initEasySearchModel( mapList, param, sdo); return sapDictionaryApplication.initEasySearchModel( mapList, param, sdo);
} }
@EasySearch(queryName = "getCompanyOrders") @EasySearch(queryName = "getCompanyOrders")
...@@ -340,7 +310,7 @@ public class ResourceSearchController { ...@@ -340,7 +310,7 @@ public class ResourceSearchController {
String BUKRS = sdo.getString("BUKRS"); String BUKRS = sdo.getString("BUKRS");
List<Map<String, String>> mapList = new ArrayList<>(); List<Map<String, String>> mapList = new ArrayList<>();
mapList = sapPaymentApplication.getCompanyOrders(BUKRS); mapList = sapPaymentApplication.getCompanyOrders(BUKRS);
return this.initEasySearchModel( mapList, param, sdo); return sapDictionaryApplication.initEasySearchModel( mapList, param, sdo);
} }
@EasySearch(queryName = "getPurchaseOrders") @EasySearch(queryName = "getPurchaseOrders")
...@@ -351,7 +321,7 @@ public class ResourceSearchController { ...@@ -351,7 +321,7 @@ public class ResourceSearchController {
String ZEP_FTYPE = sdo.getString("ZEP_FTYPE"); String ZEP_FTYPE = sdo.getString("ZEP_FTYPE");
List<Map<String, String>> mapList = new ArrayList<>(); List<Map<String, String>> mapList = new ArrayList<>();
mapList = sapPaymentApplication.getPurchaseOrders(BUKRS,PARTNER,ZEP_FTYPE); mapList = sapPaymentApplication.getPurchaseOrders(BUKRS,PARTNER,ZEP_FTYPE);
return this.initEasySearchModel( mapList, param, sdo); return sapDictionaryApplication.initEasySearchModel( mapList, param, sdo);
} }
@EasySearch(queryName = "getPartnerInvs") @EasySearch(queryName = "getPartnerInvs")
...@@ -363,7 +333,7 @@ public class ResourceSearchController { ...@@ -363,7 +333,7 @@ public class ResourceSearchController {
String ZEP_FTYPE = sdo.getString("ZEP_FTYPE"); String ZEP_FTYPE = sdo.getString("ZEP_FTYPE");
List<Map<String, String>> mapList = new ArrayList<>(); List<Map<String, String>> mapList = new ArrayList<>();
mapList = sapPaymentApplication.getPartnerInvs(BUKRS,PARTNER,ZEP_FTYPE,ZYL03); mapList = sapPaymentApplication.getPartnerInvs(BUKRS,PARTNER,ZEP_FTYPE,ZYL03);
return this.initEasySearchModel( mapList, param, sdo); return sapDictionaryApplication.initEasySearchModel( mapList, param, sdo);
} }
@EasySearch(queryName = "getArea") @EasySearch(queryName = "getArea")
...@@ -372,7 +342,7 @@ public class ResourceSearchController { ...@@ -372,7 +342,7 @@ public class ResourceSearchController {
String LAND1 = sdo.getString("LAND1"); String LAND1 = sdo.getString("LAND1");
List<Map<String, String>> mapList = new ArrayList<>(); List<Map<String, String>> mapList = new ArrayList<>();
mapList = sapAreaApplication.getAreas(LAND1); mapList = sapAreaApplication.getAreas(LAND1);
return this.initEasySearchModel( mapList, param, sdo); return sapDictionaryApplication.initEasySearchModel( mapList, param, sdo);
} }
@EasySearch(queryName = "getBankInfo") @EasySearch(queryName = "getBankInfo")
...@@ -381,46 +351,7 @@ public class ResourceSearchController { ...@@ -381,46 +351,7 @@ public class ResourceSearchController {
String BANKS = sdo.getString("BANKS"); String BANKS = sdo.getString("BANKS");
List<Map<String, String>> mapList = new ArrayList<>(); List<Map<String, String>> mapList = new ArrayList<>();
mapList = sapBankInfoApplication.getBankInfo(BANKS); mapList = sapBankInfoApplication.getBankInfo(BANKS);
return this.initEasySearchModel( mapList, param, sdo); return sapDictionaryApplication.initEasySearchModel( mapList, param, sdo);
} }
public Map<String,Object> initEasySearchModel(List<Map<String, String>> mapList,String param,SDO sdo){
List<QuerySchemeField> fields = new ArrayList<>();
Long totalWidths=200L;
if (CollectionUtil.isNotEmpty(mapList)){
if (StringUtil.isNotBlank(param)){//输入查询条件过滤
mapList = mapList
.stream()
.filter(map -> map.values().stream().anyMatch(value->value.contains(param)))
.collect(Collectors.toList());
}
if (!CollectionUtils.isEmpty(mapList)){
Map<String, String> map = mapList.get(0);
String []widths=getWidths(mapList);
for (int y=0;y<widths.length;y++){
totalWidths+=Long.valueOf(widths[y]);
}
int x=0;
for (String key : map.keySet()) {
QuerySchemeField querySchemeField = new QuerySchemeField(key,key,"string",Long.valueOf(widths[x]));
fields.add(querySchemeField);
x++;
}
/* map.keySet().forEach(key->{
QuerySchemeField querySchemeField = new QuerySchemeField(key,key,"string",200L);
fields.add(querySchemeField);
});*/
}
}
Integer intPage = sdo.getInteger("intPage", 1);
Integer pageSize = sdo.getInteger("pageSize",10);
PageRequest pageRequest = new PageRequest(intPage - 1, pageSize);
EasySearchParse easySearchParse = new EasySearchParse();
easySearchParse.setFields(fields);
easySearchParse.setWidth(totalWidths);
MemEasySearcher<Map<String, String>> memEasySearcher = new MemEasySearcherImpl<>();
Map<String, Object> model = memEasySearcher.search(mapList, easySearchParse, pageRequest, null);
return model;
}
} }
package com.huigou.topsun.ep.controller;
import com.huigou.topsun.ep.epApplication.EpApplication;
import com.huigou.topsun.sap.sapApplication.application.SapDictionaryApplication;
import com.huigou.uasp.annotation.ControllerMapping;
import com.huigou.uasp.bmp.common.easysearch.EasySearch;
import com.huigou.util.SDO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @Auther: xin.lu
* @Date: 2024/06/22/15:35
* @Description: easySearch方式查询EP系统数据
*/
@Controller
@ControllerMapping("/epResourceSearch")
public class EpResourceSearchController {
@Autowired
private EpApplication epApplication;
@Autowired
private SapDictionaryApplication sapDictionaryApplication;
@EasySearch(queryName = "queryBrand")
public Map<String, Object> queryBrand(SDO sdo) throws IOException {
String param = sdo.getString("paramValue");
List<Map<String, String>> mapList = new ArrayList<>();
mapList = epApplication.queryEpBrand(param);
return sapDictionaryApplication.initEasySearchModel( mapList, param, sdo);
}
@EasySearch(queryName = "queryPd")
public Map<String, Object> queryPd(SDO sdo) throws IOException {
String param = sdo.getString("paramValue");
String filterValue = sdo.getString("filterValue");
List<Map<String, String>> mapList = new ArrayList<>();
mapList = epApplication.queryEpPd(filterValue);
return sapDictionaryApplication.initEasySearchModel( mapList, param, sdo);
}
}
package com.huigou.topsun.ep.epApplication;
import java.util.List;
import java.util.Map;
/**
* @Auther: xin.lu
* @Date: 2024/06/22/15:23
* @Description:
*/
public interface EpApplication {
List<Map<String, String>> queryEpBrand(String brandName);
List<Map<String, String>> queryEpPd(String brandCode);
}
package com.huigou.topsun.ep.epApplication.impl;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.huigou.topsun.ep.epApplication.EpApplication;
import com.huigou.topsun.sap.common.HttpClient;
import com.huigou.topsun.sap.common.domain.SapResult;
import com.huigou.topsun.util.SAPUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Auther: xin.lu
* @Date: 2024/06/22/15:23
* @Description:
*/
@Service("epApplication")
public class EpApplicationImpl implements EpApplication {
@Autowired
private HttpClient httpClient;
@Override
public List<Map<String, String>> queryEpBrand(String brandName) {
Map<String,Object> map = new HashMap<>();
map.put("brandName",brandName);
List<Map<String, String>> mapList = new ArrayList<>();
String message = "";
try {
String executeForEp = httpClient.executeForEp(map, "md/brand/queryAllEnableBrand");
Map<String, String> resultMap = JSONObject.parseObject(executeForEp, Map.class);
if ("200".equals(resultMap.get("code"))) {
ObjectMapper objectMapper = SAPUtils.objectMapper();
mapList = objectMapper.readValue(com.huigou.util.JSONUtil.toString(resultMap.get("data")), new TypeReference<List<Map<String, String>>>() {});
}else {
message = resultMap.get("msg");
}
} catch (IOException e) {
throw new RuntimeException("查询品牌出错:" + message);
}
return mapList;
}
@Override
public List<Map<String, String>> queryEpPd(String brandCode) {
Map<String,Object> map = new HashMap<>();
map.put("brandCode",brandCode);
List<Map<String, String>> mapList = new ArrayList<>();
String message = "";
try {
String executeForEp = httpClient.executeForEp(map, "md/mditem/queryProductByBrandCode");
Map<String, String> resultMap = JSONObject.parseObject(executeForEp, Map.class);
if ("200".equals(resultMap.get("code"))) {
ObjectMapper objectMapper = SAPUtils.objectMapper();
mapList = objectMapper.readValue(com.huigou.util.JSONUtil.toString(resultMap.get("data")), new TypeReference<List<Map<String, String>>>() {});
}else {
message = resultMap.get("msg");
}
} catch (IOException e) {
throw new RuntimeException("查询产品出错:" + message);
}
return mapList;
}
}
package com.huigou.topsun.sap.nonProdApply.application.impl; package com.huigou.topsun.sap.nonProdApply.application.impl;
import com.huigou.topsun.sap.nonProdApply.domain.NonProdApplyBaseInfo;
import com.huigou.topsun.sap.nonProdApply.domain.SapNonProdApplyDept;
import com.huigou.topsun.sap.nonProdApply.domain.TmpNonProdMaterialDataImport; import com.huigou.topsun.sap.nonProdApply.domain.TmpNonProdMaterialDataImport;
import com.huigou.topsun.sap.nonProdApply.repository.NonProdApplyBaseInfoRepository;
import com.huigou.topsun.sap.nonProdApply.repository.NonProdApplyDeptRepository;
import com.huigou.topsun.sap.nonProdApply.repository.TmpNonProdMaterialDataImportRepository; import com.huigou.topsun.sap.nonProdApply.repository.TmpNonProdMaterialDataImportRepository;
import com.huigou.uasp.bmp.common.BizBillStatus;
import com.huigou.uasp.tool.dataimport.application.ExcelImportInterface; import com.huigou.uasp.tool.dataimport.application.ExcelImportInterface;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -14,10 +20,39 @@ public class NonProdMaterialDataExcelImport implements ExcelImportInterface { ...@@ -14,10 +20,39 @@ public class NonProdMaterialDataExcelImport implements ExcelImportInterface {
@Autowired @Autowired
private TmpNonProdMaterialDataImportRepository tmpNonProdMaterialDataImportRepository; private TmpNonProdMaterialDataImportRepository tmpNonProdMaterialDataImportRepository;
@Autowired
private NonProdApplyBaseInfoRepository nonProdApplyBaseInfoRepository;
@Autowired
private NonProdApplyDeptRepository nonProdApplyDeptRepository;
@Override @Override
public void executeImport(String batchNumber) { public void executeImport(String batchNumber) {
List<TmpNonProdMaterialDataImport> dataImportList = tmpNonProdMaterialDataImportRepository.findByBatchNumber(batchNumber); List<TmpNonProdMaterialDataImport> dataImportList = tmpNonProdMaterialDataImportRepository.findByBatchNumber(batchNumber);
for (TmpNonProdMaterialDataImport tmpNonProdMaterialDataImport : dataImportList) {
NonProdApplyBaseInfo nonProdApplyBaseInfo = new NonProdApplyBaseInfo();
//维护类型 :new 新建 modify 变更 extend 扩展
nonProdApplyBaseInfo.setMaintenanceType("new");
//通用品名
nonProdApplyBaseInfo.setGenericName(tmpNonProdMaterialDataImport.getMaktx());
//基本计量单位
nonProdApplyBaseInfo.setBaseUnit(tmpNonProdMaterialDataImport.getMeins());
nonProdApplyBaseInfo.setBaseUnitName(tmpNonProdMaterialDataImport.getMeinsName());
//物品属性
nonProdApplyBaseInfo.setItemAttributes(tmpNonProdMaterialDataImport.getMtart());
//文本说明
nonProdApplyBaseInfo.setTextDescription(tmpNonProdMaterialDataImport.getMaktxDescCn());
//处理状态: 0 待分发 1 基本信息填写 2 已分发 3 已办结
nonProdApplyBaseInfo.setDistribute(3);
nonProdApplyBaseInfo.setDefaultValues();
//审批状态已完成
nonProdApplyBaseInfo.setStatusId(BizBillStatus.COMPLETED.getId());
nonProdApplyBaseInfo = nonProdApplyBaseInfoRepository.save(nonProdApplyBaseInfo);
//赋值基本信息维护
SapNonProdApplyDept sapNonProdApplyDept = new SapNonProdApplyDept();
BeanUtils.copyProperties(tmpNonProdMaterialDataImport,sapNonProdApplyDept);
sapNonProdApplyDept.setBaseInfoId(nonProdApplyBaseInfo.getId());
nonProdApplyDeptRepository.save(sapNonProdApplyDept);
}
} }
} }
package com.huigou.topsun.sap.sapApplication.application; package com.huigou.topsun.sap.sapApplication.application;
import com.huigou.util.SDO;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -11,4 +13,8 @@ import java.util.Map; ...@@ -11,4 +13,8 @@ import java.util.Map;
*/ */
public interface SapDictionaryApplication { public interface SapDictionaryApplication {
List<Map<String,String>> getSapDictionary(String fieldName) throws IOException; List<Map<String,String>> getSapDictionary(String fieldName) throws IOException;
public Map<String,Object> initEasySearchModel(List<Map<String, String>> mapList, String param, SDO sdo);
public String[] getWidths(List<Map<String, String>> mapList);
} }
package com.huigou.topsun.sap.sapApplication.application.impl; package com.huigou.topsun.sap.sapApplication.application.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
...@@ -8,14 +9,24 @@ import com.huigou.cache.SystemCache; ...@@ -8,14 +9,24 @@ import com.huigou.cache.SystemCache;
import com.huigou.topsun.sap.common.HttpClient; import com.huigou.topsun.sap.common.HttpClient;
import com.huigou.topsun.sap.sapApplication.application.SapDictionaryApplication; import com.huigou.topsun.sap.sapApplication.application.SapDictionaryApplication;
import com.huigou.topsun.util.SAPUtils; import com.huigou.topsun.util.SAPUtils;
import com.huigou.uasp.bmp.common.easysearch.domain.model.EasySearchParse;
import com.huigou.uasp.bmp.common.easysearch.domain.model.QuerySchemeField;
import com.huigou.uasp.bmp.opm.application.MemEasySearcher;
import com.huigou.uasp.bmp.opm.application.impl.MemEasySearcherImpl;
import com.huigou.util.JSONUtil; import com.huigou.util.JSONUtil;
import com.huigou.util.SDO;
import com.huigou.util.StringUtil;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* @Auther: xin.lu * @Auther: xin.lu
...@@ -42,4 +53,76 @@ public class SapDictionaryApplicationImpl implements SapDictionaryApplication { ...@@ -42,4 +53,76 @@ public class SapDictionaryApplicationImpl implements SapDictionaryApplication {
List<Map<String,String>> mapList = objectMapper.readValue(execute, new TypeReference<List<Map<String, String>>>() {}); List<Map<String,String>> mapList = objectMapper.readValue(execute, new TypeReference<List<Map<String, String>>>() {});
return mapList; return mapList;
} }
@Override
public Map<String,Object> initEasySearchModel(List<Map<String, String>> mapList,String param,SDO sdo){
List<QuerySchemeField> fields = new ArrayList<>();
Long totalWidths=200L;
if (CollectionUtil.isNotEmpty(mapList)){
if (StringUtil.isNotBlank(param)){//输入查询条件过滤
mapList = mapList
.stream()
.filter(map -> map.values().stream().anyMatch(value->value.contains(param)))
.collect(Collectors.toList());
}
if (!CollectionUtils.isEmpty(mapList)){
Map<String, String> map = mapList.get(0);
String []widths=getWidths(mapList);
for (int y=0;y<widths.length;y++){
totalWidths+=Long.valueOf(widths[y]);
}
int x=0;
for (String key : map.keySet()) {
QuerySchemeField querySchemeField = new QuerySchemeField(key,key,"string",Long.valueOf(widths[x]));
fields.add(querySchemeField);
x++;
}
/* map.keySet().forEach(key->{
QuerySchemeField querySchemeField = new QuerySchemeField(key,key,"string",200L);
fields.add(querySchemeField);
});*/
}
}
Integer intPage = sdo.getInteger("intPage", 1);
Integer pageSize = sdo.getInteger("pageSize",10);
PageRequest pageRequest = new PageRequest(intPage - 1, pageSize);
EasySearchParse easySearchParse = new EasySearchParse();
easySearchParse.setFields(fields);
easySearchParse.setWidth(totalWidths);
MemEasySearcher<Map<String, String>> memEasySearcher = new MemEasySearcherImpl<>();
Map<String, Object> model = memEasySearcher.search(mapList, easySearchParse, pageRequest, null);
return model;
}
@Override
public String[] getWidths(List<Map<String, String>> mapList){
Map<String, String> map = mapList.get(0);
String []widths=new String[map.size()];
for (int i=0;i<mapList.size();i++){
Map<String, String> mapp = mapList.get(i);
int u=0;
for (String key : mapp.keySet()) {
if (widths[u]==null){
widths[u] = "40";
}
String tmpWidth=widths[u];
String value=(String) mapp.get(key);
if (value.trim().length()>10){
if (Integer.parseInt(tmpWidth)<130){
widths[u]="130";
}
} else {
if (value.trim().length()>6){
if (Integer.parseInt(tmpWidth)<80){
widths[u]=String.valueOf(value.trim().length()*10);
}
}
}
u++;
}
}
return widths;
}
} }
...@@ -382,8 +382,10 @@ public class SuppliersDataApplicationImpl extends FlowBroker implements Supplier ...@@ -382,8 +382,10 @@ public class SuppliersDataApplicationImpl extends FlowBroker implements Supplier
} }
SapResult sapResult = sapResultList.get(0); SapResult sapResult = sapResultList.get(0);
resultMap.put("sequence", resultMap.get("row")); resultMap.put("sequence", resultMap.get("row"));
if ("S".equals(sapResult.getTYPE())&&"0".equals(suppliersInfo.getApplyType())) { if ("S".equals(sapResult.getTYPE())) {
suppliersInfo.setPartner(sapResult.getMESSAGE_V1().substring(4)); if ("0".equals(suppliersInfo.getApplyType())){
suppliersInfo.setPartner(sapResult.getMESSAGE_V1().substring(4));
}
resultMap.put("TYPE", sapResult.getTYPE()); resultMap.put("TYPE", sapResult.getTYPE());
resultMap.put("MESSAGE", sapResult.getMESSAGE()); resultMap.put("MESSAGE", sapResult.getMESSAGE());
suppliersInfoRepository.save(suppliersInfo); suppliersInfoRepository.save(suppliersInfo);
......
...@@ -208,9 +208,9 @@ public class ImpDataFromXLS { ...@@ -208,9 +208,9 @@ public class ImpDataFromXLS {
buyer.setWaers(value); buyer.setWaers(value);
break; break;
case "AE": case "AE":
buyer.setZterm(value); //采购付款条件 提供编码 buyer.setPayCondition(value); //采购付款条件 提供编码
String ztermbm=DictUtil.getDictionaryDetailValue("zterm",value); String ztermbm=DictUtil.getDictionaryDetailValue("zterm",value);
buyer.setZterm(ztermbm); buyer.setPayCondition(ztermbm);
break; break;
case "AF": case "AF":
buyer.setVerkf(value); buyer.setVerkf(value);
......
...@@ -51,9 +51,9 @@ public class SuppliersBuyer implements Serializable { ...@@ -51,9 +51,9 @@ public class SuppliersBuyer implements Serializable {
/** /**
* 付款条件代码 * 付款条件代码
*/ */
@Column(name = "zterm") @Column(name = "pay_condition")
@JSONField(name = "ZTERM") @JSONField(name = "ZTERM")
private String zterm; private String payCondition;
/** /**
* 国际贸易条款 * 国际贸易条款
......
...@@ -25,7 +25,7 @@ public class SuppliersBuyerVo { ...@@ -25,7 +25,7 @@ public class SuppliersBuyerVo {
* 付款条件代码 * 付款条件代码
*/ */
@JsonProperty("ZTERM") @JsonProperty("ZTERM")
private String zterm; private String payCondition;
/** /**
* 国际贸易条款 * 国际贸易条款
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment