Commit 59a6abd9 authored by 鲁鑫's avatar 鲁鑫

采购信息记录维护接口调试

parent 49107545
...@@ -4,7 +4,10 @@ import cn.hutool.core.collection.CollectionUtil; ...@@ -4,7 +4,10 @@ import cn.hutool.core.collection.CollectionUtil;
import com.huigou.cache.DictUtil; import com.huigou.cache.DictUtil;
import com.huigou.topsun.sap.costCenter.application.CostCenterApplication; import com.huigou.topsun.sap.costCenter.application.CostCenterApplication;
import com.huigou.topsun.sap.sapApplication.application.SapDictionaryApplication; import com.huigou.topsun.sap.sapApplication.application.SapDictionaryApplication;
import com.huigou.topsun.sap.sapApplication.application.SapMaterialApplication;
import com.huigou.topsun.sap.sapApplication.application.SapPaymentApplication; import com.huigou.topsun.sap.sapApplication.application.SapPaymentApplication;
import com.huigou.topsun.sap.sapApplication.domain.query.SapDialogQuery;
import com.huigou.topsun.sap.sapApplication.domain.vo.SapMaterialVo;
import com.huigou.uasp.annotation.ControllerMapping; import com.huigou.uasp.annotation.ControllerMapping;
import com.huigou.uasp.bmp.common.easysearch.EasySearch; import com.huigou.uasp.bmp.common.easysearch.EasySearch;
import com.huigou.uasp.bmp.common.easysearch.domain.model.EasySearchParse; import com.huigou.uasp.bmp.common.easysearch.domain.model.EasySearchParse;
...@@ -13,6 +16,7 @@ import com.huigou.uasp.bmp.opm.application.MemEasySearcher; ...@@ -13,6 +16,7 @@ import com.huigou.uasp.bmp.opm.application.MemEasySearcher;
import com.huigou.uasp.bmp.opm.application.impl.MemEasySearcherImpl; import com.huigou.uasp.bmp.opm.application.impl.MemEasySearcherImpl;
import com.huigou.util.SDO; import com.huigou.util.SDO;
import com.huigou.util.StringUtil; import com.huigou.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
...@@ -33,8 +37,8 @@ public class ResourceSearchController { ...@@ -33,8 +37,8 @@ public class ResourceSearchController {
private SapDictionaryApplication sapDictionaryApplication; private SapDictionaryApplication sapDictionaryApplication;
@Resource @Resource
private SapPaymentApplication sapPaymentApplication; private SapPaymentApplication sapPaymentApplication;
@Resource @Autowired
private CostCenterApplication costCenterApplication; private SapMaterialApplication sapMaterialApplication;
@EasySearch(queryName = "knttp") @EasySearch(queryName = "knttp")
public Map<String, Object> knttpSelect(SDO sdo){ public Map<String, Object> knttpSelect(SDO sdo){
...@@ -92,9 +96,44 @@ public class ResourceSearchController { ...@@ -92,9 +96,44 @@ public class ResourceSearchController {
@EasySearch(queryName = "sapMaterialSelect") @EasySearch(queryName = "sapMaterialSelect")
public Map<String, Object> sapMaterialSelect(SDO sdo) throws IOException { public Map<String, Object> sapMaterialSelect(SDO sdo) throws IOException {
String fieldName = sdo.getString("paramValue"); String param = sdo.getString("paramValue");
List<Map<String, Object>> mapList = sapDictionaryApplication.getSapDictionary(fieldName); String filterValue = sdo.getString("filterValue");
return this.initEasySearchModel( mapList, "", sdo); SapDialogQuery queryRequest = sdo.toObject(SapDialogQuery.class);
queryRequest.setWerks(filterValue);
List<Map<String,Object>> mapList = sapMaterialApplication.getSapMaterial(queryRequest);
/*if (CollectionUtil.isNotEmpty(mapList)){
if (StringUtil.isNotBlank(filterValue)){//固定条件过滤,比如选了工厂后,只能读取改工厂下的物料组
mapList = mapList
.stream()
.filter(map -> map.containsValue(filterValue))
.collect(Collectors.toList());
}
}*/
Integer intPage = sdo.getInteger("intPage", 1);
Integer pageSize = sdo.getInteger("pageSize",10);
PageRequest pageRequest = new PageRequest(intPage - 1, pageSize);
EasySearchParse easySearchParse = new EasySearchParse();
List<QuerySchemeField> fields =
Arrays.asList(
new QuerySchemeField("工厂", "WERKS", "string", 100L),
new QuerySchemeField("工厂名称", "NAME1", "string", 200L),
new QuerySchemeField("物料编码", "MATNR", "string", 200L),
new QuerySchemeField("物料名称", "MAKTX", "string", 200L),
new QuerySchemeField("库存地点", "LGFSB", "string", 100L),
new QuerySchemeField("库存地点名称", "LGOBE", "string", 200L),
new QuerySchemeField("物料组", "MATKL", "string", 100L),
new QuerySchemeField("物料组名称", "WGBEZ", "string", 200L),
new QuerySchemeField("基本计量单位", "MEINS", "string", 100L),
new QuerySchemeField("基本计量单位名称", "MSEHL", "string", 100L),
new QuerySchemeField("采购组", "EKGRP", "string", 100L),
new QuerySchemeField("采购组名称", "EKNAM", "string", 200L),
new QuerySchemeField("价格基数", "PEINH", "string", 100L)
);
easySearchParse.setFields(fields);
easySearchParse.setWidth(450L);
MemEasySearcher<Map<String, Object>> memEasySearcher = new MemEasySearcherImpl<>();
Map<String, Object> model = memEasySearcher.search(mapList, easySearchParse, pageRequest, null);
return model;
} }
@EasySearch(queryName = "dictionary") @EasySearch(queryName = "dictionary")
......
...@@ -31,12 +31,24 @@ public class SapPurchaseInfoRecordItem extends AbstractEntity { ...@@ -31,12 +31,24 @@ public class SapPurchaseInfoRecordItem extends AbstractEntity {
*/ */
@Column(name = "EKORG") @Column(name = "EKORG")
private String ekorg; private String ekorg;
/**
* 采购组织
*/
@Column(name = "EKORG_NAME")
private String ekorgName;
/** /**
* 供应商 * 供应商
*/ */
@Column(name = "LIFNR") @Column(name = "LIFNR")
private String lifnr; private String lifnr;
/**
* 供应商
*/
@Column(name = "LIFNR_NAME")
private String lifnrName;
/** /**
* 供应商物料编码 * 供应商物料编码
*/ */
...@@ -62,6 +74,11 @@ public class SapPurchaseInfoRecordItem extends AbstractEntity { ...@@ -62,6 +74,11 @@ public class SapPurchaseInfoRecordItem extends AbstractEntity {
*/ */
@Column(name = "MATKL") @Column(name = "MATKL")
private String matkl; private String matkl;
/**
* 物料组
*/
@Column(name = "MATKL_NAME")
private String matklName;
/** /**
* 采购信息记录分类 * 采购信息记录分类
*/ */
...@@ -72,11 +89,22 @@ public class SapPurchaseInfoRecordItem extends AbstractEntity { ...@@ -72,11 +89,22 @@ public class SapPurchaseInfoRecordItem extends AbstractEntity {
*/ */
@Column(name = "EKGRP") @Column(name = "EKGRP")
private String ekgrp; private String ekgrp;
/**
* 采购组
*/
@Column(name = "EKGRP_NAME")
private String ekgrpName;
/** /**
* 工厂 * 工厂
*/ */
@Column(name = "WERKS") @Column(name = "WERKS")
private String werks; private String werks;
/**
* 工厂
*/
@Column(name = "WERKS_NAME")
private String werksName;
/** /**
* 生产版本 * 生产版本
*/ */
...@@ -92,6 +120,9 @@ public class SapPurchaseInfoRecordItem extends AbstractEntity { ...@@ -92,6 +120,9 @@ public class SapPurchaseInfoRecordItem extends AbstractEntity {
*/ */
@Column(name = "WAERS") @Column(name = "WAERS")
private String waers; private String waers;
@Column(name = "WAERS_NAME")
private String waersName;
/** /**
* 价格单位 * 价格单位
*/ */
...@@ -102,6 +133,11 @@ public class SapPurchaseInfoRecordItem extends AbstractEntity { ...@@ -102,6 +133,11 @@ public class SapPurchaseInfoRecordItem extends AbstractEntity {
*/ */
@Column(name = "BPRME") @Column(name = "BPRME")
private String bprme; private String bprme;
/**
* 订单价格单位(采购)
*/
@Column(name = "BPRME_NAME")
private String bprmeName;
/** /**
* 销售/购买税代码 * 销售/购买税代码
*/ */
...@@ -137,6 +173,12 @@ public class SapPurchaseInfoRecordItem extends AbstractEntity { ...@@ -137,6 +173,12 @@ public class SapPurchaseInfoRecordItem extends AbstractEntity {
*/ */
@Column(name = "MEINS") @Column(name = "MEINS")
private String meins; private String meins;
/**
* 基本计量单位
*/
@Column(name = "MEINS_NAME")
private String meinsName;
/** /**
* 订单单位到基本单位转换的分母 * 订单单位到基本单位转换的分母
*/ */
......
...@@ -5,6 +5,7 @@ import com.huigou.topsun.sap.sapApplication.domain.vo.SapMaterialVo; ...@@ -5,6 +5,7 @@ import com.huigou.topsun.sap.sapApplication.domain.vo.SapMaterialVo;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @Auther: xin.lu * @Auther: xin.lu
...@@ -12,5 +13,5 @@ import java.util.List; ...@@ -12,5 +13,5 @@ import java.util.List;
* @Description: * @Description:
*/ */
public interface SapMaterialApplication { public interface SapMaterialApplication {
List<SapMaterialVo> getSapMaterial(SapDialogQuery queryRequest) throws IOException; List<Map<String,Object>> getSapMaterial(SapDialogQuery queryRequest) throws IOException;
} }
package com.huigou.topsun.sap.sapApplication.application.impl; package com.huigou.topsun.sap.sapApplication.application.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.huigou.topsun.sap.common.HttpClient; import com.huigou.topsun.sap.common.HttpClient;
...@@ -26,8 +27,8 @@ public class SapMaterialApplicationImpl implements SapMaterialApplication { ...@@ -26,8 +27,8 @@ public class SapMaterialApplicationImpl implements SapMaterialApplication {
@Resource @Resource
private HttpClient httpClient; private HttpClient httpClient;
@Override @Override
public List<SapMaterialVo> getSapMaterial(SapDialogQuery queryRequest) throws IOException { public List<Map<String,Object>> getSapMaterial(SapDialogQuery queryRequest) throws IOException {
List<SapMaterialVo> sapMaterialVoList = new ArrayList<>(); List<Map<String,Object>> sapMaterialVoList = new ArrayList<>();
/*if (StringUtil.isBlank(queryRequest.getWerks()) || StringUtil.isBlank(queryRequest.getMatkl())){ /*if (StringUtil.isBlank(queryRequest.getWerks()) || StringUtil.isBlank(queryRequest.getMatkl())){
return sapMaterialVoList; return sapMaterialVoList;
}*/ }*/
...@@ -36,7 +37,8 @@ public class SapMaterialApplicationImpl implements SapMaterialApplication { ...@@ -36,7 +37,8 @@ public class SapMaterialApplicationImpl implements SapMaterialApplication {
Map<String, Object> map = JSONUtil.toMap(json); Map<String, Object> map = JSONUtil.toMap(json);
SapResult sapResult = JSONObject.parseObject(JSONUtil.toString(map.get("MSG")), SapResult.class); SapResult sapResult = JSONObject.parseObject(JSONUtil.toString(map.get("MSG")), SapResult.class);
if ("S".equals(sapResult.getTYPE())){ if ("S".equals(sapResult.getTYPE())){
sapMaterialVoList = JSONObject.parseArray(JSONUtil.toString(map.get("RDATA")), SapMaterialVo.class); sapMaterialVoList = (List<Map<String,Object>>) JSONArray.parse(JSONUtil.toString(map.get("RDATA")));
//sapMaterialVoList = JSONObject.parseArray(JSONUtil.toString(map.get("RDATA")), SapMaterialVo.class);
}else { }else {
throw new RuntimeException("查询物料失败:"+sapResult.getMESSAGE()); throw new RuntimeException("查询物料失败:"+sapResult.getMESSAGE());
} }
......
...@@ -11,6 +11,7 @@ import org.springframework.stereotype.Controller; ...@@ -11,6 +11,7 @@ import org.springframework.stereotype.Controller;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @Auther: xin.lu * @Auther: xin.lu
...@@ -34,7 +35,7 @@ public class SapDialogSelectController extends CommonController { ...@@ -34,7 +35,7 @@ public class SapDialogSelectController extends CommonController {
public String sapMaterialSelect() throws IOException { public String sapMaterialSelect() throws IOException {
SDO sdo = this.getSDO(); SDO sdo = this.getSDO();
SapDialogQuery queryRequest = sdo.toObject(SapDialogQuery.class); SapDialogQuery queryRequest = sdo.toObject(SapDialogQuery.class);
List<SapMaterialVo> sapMaterial = sapMaterialApplication.getSapMaterial(queryRequest); List<Map<String,Object>> sapMaterial = sapMaterialApplication.getSapMaterial(queryRequest);
return packGridDataAndResult(sapMaterial); return packGridDataAndResult(sapMaterial);
} }
} }
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