Commit 64a813dd authored by 1650842865's avatar 1650842865

数据字典允许文本重复;固定资产采购申请绑定资产编号时,根据数据字典matklMapping映射关系查询;查询物料时,如果传了ztype="X",SAP才查询 物料文本描述,否则只查询基本视图。

parent 9d881e63
......@@ -191,9 +191,9 @@ function checkDetailData(){
var flag=true,names={},values={};
$.each(detailData,function(i,o){
if(names[o.name]){
Public.tip('成员名称['+o.name+']重复,请检查!');
flag=false;
return false;
//Public.tip('成员名称['+o.name+']重复,请检查!');
//flag=false;
//return false;
}else{
names[o.name]=1;
}
......
......@@ -484,7 +484,7 @@ function saleMustInput(flag) { //销售必输项
UICtrl.setElRequiredFlag("#alandName",flag);
UICtrl.setElRequiredFlag("#aland",flag);
UICtrl.setElRequiredFlag("#taxkm",flag);
UICtrl.setElRequiredFlag("#ktgrm",flag);
//UICtrl.setElRequiredFlag("#ktgrm",flag);
UICtrl.setElRequiredFlag("#vkorgName",flag);
UICtrl.setElRequiredFlag("#vtwegName",flag);
var mtart = $("#mtart").val();
......
......@@ -129,7 +129,8 @@ function loadGrid() {
return {
filterValue:$("#werks").val(),
matkl:item.matkl,
mtart:"ZGMB"
mtart:"ZGMB",
ztype:"X"
}
},
back: {
......
......@@ -23,7 +23,10 @@ function initGrid() {
display: "资产编号", name: "ANLN1", width: "100", align: "left", type: "string",
},
{
display: "资产类型", name: "TXK20", width: "200", align: "left", type: "string",
display: "资产类型", name: "ANLKL", width: "60", align: "left", type: "string",
},
{
display: "资产类型描述", name: "TXK20", width: "200", align: "left", type: "string",
},
{
display: "资产描述", name: "TXT50", width: "300", align: "left", type: "string",
......
......@@ -244,7 +244,7 @@ function getGridColumns() {
required: true, type: "select",
data: {
type: 'system',
name: "dictionary",
name: "purchaseMatklDictionary",
getParam: function (item) {
return {
fieldName: "MATKL",
......
......@@ -134,9 +134,11 @@ public class ResourceSearchController {
String filterValue = sdo.getString("filterValue");
String mtart = sdo.getString("mtart");//如果传了刀模板具,就排除掉
String matkl = sdo.getString("matkl");//物料组
String ztype = sdo.getString("ztype");//标识是否查询物料文本描述
SapDialogQuery queryRequest = sdo.toObject(SapDialogQuery.class);
queryRequest.setWerks(filterValue);
queryRequest.setMatkl(matkl);
queryRequest.setZtype(ztype);
List<Map<String,String>> mapList = sapMaterialApplication.getSapMaterial(queryRequest);
// if (CollectionUtil.isNotEmpty(mapList)){
// mapList = mapList
......@@ -800,6 +802,67 @@ public class ResourceSearchController {
return model;
}
/**
* 物料组字典选择
* @param sdo
* @return
* @throws IOException
*/
@EasySearch(queryName = "purchaseMatklDictionary")
public Map<String, Object> queryPurchaseMatkDictionary(SDO sdo) throws IOException {
String param = sdo.getString("paramValue");
String filterValue = sdo.getString("filterValue");
List<Map<String, String>> mapList = new ArrayList<>();
List<Map<String, String>> resultMapList = new ArrayList<>();
mapList = sapDictionaryApplication.getSapDictionary("MATKL");
List<QuerySchemeField> fields = new ArrayList<>();
Long totalWidths=200L;
if (CollectionUtil.isNotEmpty(mapList)){
//只返回分类
//原材料 1/2/3开头,去掉二级分类(三位数)
if (StringUtil.isNotBlank(filterValue)){//固定条件过滤,前3位为大类编码
resultMapList = mapList
.stream()
.filter(
map -> map.containsKey("MATKL") && map.get("MATKL").startsWith(filterValue) && (map.get("MATKL").length() > 3 || "A30".equals(map.get("MATKL")))
)
.sorted(Comparator.comparing(map -> map.get("MATKL")))
.collect(Collectors.toList());
}
if (StringUtil.isNotBlank(param)){//输入查询条件过滤
resultMapList = resultMapList
.stream()
.filter(map -> map.values().stream().anyMatch(value->value.toLowerCase().contains(param.toLowerCase())))
.collect(Collectors.toList());
}
if (!CollectionUtils.isEmpty(resultMapList)){
Map<String, String> map = resultMapList.get(0);
String []widths=sapDictionaryApplication.getWidths(resultMapList);
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++;
}
}
}
System.out.println("数据条数:"+ mapList.size());
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(resultMapList, easySearchParse, pageRequest, null);
return model;
}
/**
* 查询异常分类明细
* @param sdo
......
package com.huigou.topsun.sap.purchase.controller;
import cn.hutool.core.collection.CollectionUtil;
import com.huigou.cache.DictUtil;
import com.huigou.context.Operator;
import com.huigou.context.OrgUnit;
import com.huigou.topsun.common.BillStatus;
......@@ -136,25 +137,22 @@ public class SapPurchaseController extends CommonController {
public String queryAnlanFromSap() throws IOException {
SDO sdo = this.getSDO();
String param = sdo.getString("paramValue");
//String werks = sdo.getString("werks");
String matkl = sdo.getString("matkl");
List<Map<String, String>> mapList = new ArrayList<>();
if (StringUtil.isBlank(param)){
//根据物料组找到固定资产类型映射关系
String detailText = DictUtil.getDictionaryDetailText("matklMapping", matkl);
if ((StringUtil.isBlank(detailText) || "all".equals(detailText)) && StringUtil.isBlank(param)){
return packGridDataAndResult(mapList);
}
mapList = sapDictionaryApplication.getSapDictionary("ANLN1");
if (CollectionUtil.isNotEmpty(mapList)) {
// mapList = mapList
// .stream()
// .filter(map -> map.values().stream().anyMatch(value -> value.contains(werks)))
// .collect(Collectors.toList());
//根据物料组筛选对应资产类型下的资产编号
// if ("A0001".equals(matkl)){//固定资产-房屋及建筑物
// mapList = mapList
// .stream()
// .filter(map -> map.values().stream().anyMatch(value -> value.contains("Z101")))
// .collect(Collectors.toList());
// }
if (StringUtil.isNotBlank(detailText)){
mapList = mapList
.stream()
.filter(map -> detailText.contains(map.get("ANLKL")))
.collect(Collectors.toList());
}
if (StringUtil.isNotBlank(param)){//输入查询条件过滤
mapList = mapList
.stream()
......
......@@ -14,5 +14,6 @@ public class SapDialogQuery {
private String matkl;
private String mtart;
private String ztype;
}
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