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

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

parent 49107545
......@@ -43,6 +43,17 @@ function initItemGrid() {
selectRowButtonOnly: true,
//autoApplyNextEditor:false,
toolbar: toolbarOptions,
onBeforeEdit: function (editParma) {
if (Public.isNotBlank(editParma.record.matnr) && editParma.column.name=='matklName'){
return false;
}
if (Public.isNotBlank(editParma.record.matklName) && editParma.column.name=='matnr'){
return false;
}
return true;
},
}
);
UICtrl.setSearchAreaToggle(itemGridManager);
......@@ -51,38 +62,145 @@ function initItemGrid() {
function getGridColumns() {
var columns = [];
columns = [
{display: "语言", name: "zyy", width: "80", align: "left", type: "string",
editor: {required: false, type: "text"}
},
// {display: "语言", name: "zyy", width: "80", align: "left", type: "string",
// editor: {required: false, type: "text"}
// },
{display: "采购信息记录号", name: "infnr", width: "100", align: "left", type: "string",
editor: {required: false, type: "text"}
//editor: {required: false, type: "text"}
},
{display: "工厂", name: "werksName", width: "200", align: "left", type: "string",
editor: {
required: true, type: "select",
data: {
type: 'system',
name: "dictionary",
getParam: function (item) {
return {fieldName: "WERKS"}
},
back: {
WERKS: "werks",
NAME1: "werksName",
}
},
{display: "采购组织", name: "ekorg", width: "100", align: "left", type: "string",
editor: {required: false, type: "text"}
}
},
{display: "采购组织", name: "ekorgName", width: "200", align: "left", type: "string",
editor: {
required: true, type: "select",
data: {
type: 'system',
name: "dictionary",
getParam: function (item) {
return {
fieldName: "EKORG",
filterValue:item.werks
}
},
back: {
EKORG: "ekorg",
EKOTX: "ekorgName",
}
},
{display: "供应商", name: "lifnr", width: "100", align: "left", type: "string",
}
},
{display: "供应商", name: "lifnr", width: "200", align: "left", type: "string",
editor: {required: true, type: "text"}
// editor: {
// required: true, type: "select",
// data: {
// type: 'system',
// name: "dictionary",
// getParam: function (item) {
// return {fieldName: "LIFNR"}
// },
// back: {
// LIFNR: "lifnr",
// NAME1: "lifnrName",
// }
// },
// }
},
{display: "供应商物料编码", name: "idnlf", width: "100", align: "left", type: "string",
editor: {required: false, type: "text"}
},
{display: "名称1", name: "name1", width: "100", align: "left", type: "string",
editor: {required: false, type: "text"}
},
{display: "物料编码", name: "matnr", width: "100", align: "left", type: "string",
editor: {required: false, type: "text"}
{display: "物料编码", name: "matnr", width: "200", align: "left", type: "string",
editor: {
required: true, type: "select",
data: {
type: 'system',
name: "sapMaterialSelect",
getParam: function (item) {
return {
filterValue:item.werks
}
},
{display: "物料描述", name: "maktx", width: "100", align: "left", type: "string",
editor: {required: false, type: "text"}
back: {
MATNR: "matnr",
MAKTX: "maktx",
MATKL: "matkl",
WGBEZ: "matklName",
EKGRP: "ekgrp",
EKNAM: "ekgrpName",
PEINH: "peinh",
MEINS: "meins",
MSEHL:"meinsName",
MEINS:"bprme",
MSEHL:"bprmeName",
}
},
{display: "物料组", name: "matkl", width: "100", align: "left", type: "string",
editor: {required: false, type: "text"}
}
},
{display: "采购信息记录分类", name: "esokz", width: "200", align: "left", type: "string",
editor: {required: false, type: "text"}
{display: "物料描述", name: "maktx", width: "200", align: "left", type: "string",
editor: {required: true, type: "text"}
},
{display: "物料组", name: "matklName", width: "200", align: "left", type: "string",
editor: {
required: true, type: "select",
data: {
type: 'system',
name: "dictionary",
getParam: function (item) {
return {
fieldName: "MATKL"
}
},
{display: "采购组", name: "ekgrp", width: "100", align: "left", type: "string",
editor: {required: false, type: "text"}
back: {
MATKL: "matkl",
WGBEZ: "matklName",
}
},
{display: "工厂", name: "werks", width: "100", align: "left", type: "string",
editor: {required: false, type: "text"}
}
},
{display: "采购信息记录分类", name: "esokzTextView", width: "200", align: "left", type: "string",
editor: {
type: 'dictionary',
data: {name: 'esokz'},
textField: 'esokzTextView',
valueField: 'esokz',
required: true,
render: function (item) {
return item.esokzTextView;
}
},
},
{display: "采购组", name: "ekgrpName", width: "200", align: "left", type: "string",
editor: {
required: true, type: "select",
data: {
type: 'system',
name: "dictionary",
getParam: function (item) {
return {fieldName: "EKGRP"}
},
back: {
EKGRP: "ekgrp",
EKNAM: "ekgrpName"
}
},
}
},
{display: "生产版本", name: "verid", width: "200", align: "left", type: "string",
editor: {required: false, type: "text"}
......@@ -91,13 +209,62 @@ function getGridColumns() {
editor: {type: 'text', mask: '9999999.99'}
},
{display: "货币码", name: "waers", width: "100", align: "left", type: "string",
// editor: {
// required: true, type: "select",
// data: {
// type: 'system',
// name: "dictionary",
// getParam: function (item) {
// return {fieldName: "WAERS"}
// },
// back: {
// WAERS: "waers",
// EKGRP: "waersName"
// }
// },
// }
editor: {required: false, type: "text"}
},
{display: "价格单位", name: "peinh", width: "200", align: "left", type: "string",
{display: "价格单位", name: "peinh", width: "100", align: "left", type: "string",
editor: {required: false, type: "text"}
},
{display: "订单价格单位(采购)", name: "bprme", width: "90", align: "left", type: "string",
editor: {type: 'text', required: false},
{display: "订单价格单位(采购)", name: "bprmeName", width: "90", align: "left", type: "string",
editor: {
required: false, type: "select",
data: {
type: 'system',
name: "dictionary",
getParam: function (item) {
return {fieldName: "MEINS"}
},
back: {
MSEHI: "bprme",
MSEHL: "bprmeName",
}
},
}
},
{display: "基本计量单位", name: "meinsName", width: "100", align: "left", type: "string",
editor: {
required: true, type: "select",
data: {
type: 'system',
name: "dictionary",
getParam: function (item) {
return {fieldName: "MEINS"}
},
back: {
MSEHI: "meins",
MSEHL: "meinsName",
}
},
}
},
{display: "单位转换分母", name: "umren", width: "100", align: "left", type: "string",
editor: {type: 'text', mask: '9999999.99'}
},
{display: "单位转换分子", name: "umrez", width: "100", align: "left", type: "string",
editor: {type: 'text', mask: '9999999.99'}
},
{display: "销售/购买税代码", name: "mwskz", width: "100", align: "left", type: "string",
editor: {type: "text", required: false,}
......@@ -117,38 +284,48 @@ function getGridColumns() {
{display: "电话", name: "telf1", width: "100", align: "left", type: "string",
editor: {required: false, type: "text"}
},
{display: "基本计量单位", name: "meins", width: "200", align: "left", type: "string",
editor: {required: false, type: "text"}
},
{display: "订单单位到基本单位转换的分母", name: "umren", width: "200", align: "left", type: "string",
editor: {type: 'text', mask: '9999999.99'}
},
{display: "基本计量单位转换分子", name: "umrez", width: "100", align: "left", type: "string",
editor: {type: 'text', mask: '9999999.99'}
},
{display: "原产地国", name: "urzla", width: 150, minWidth: 60, type: "string", align: "center",
editor: {required: false, type: "text"}
},
{display: "地区", name: "regio", width: 150, minWidth: 60, type: "string", align: "center",
editor: {required: false, type: "text"}
},
{display: "删除标志", name: "loekz", width: 150, minWidth: 60, type: "string", align: "center",
editor: {required: false, type: "text"}
{display: "删除标志", name: "loekzTextView", width: 150, minWidth: 60, type: "string", align: "center",
editor: {
type: 'dictionary',
data: {name: 'loekz'},
textField: 'loekzTextView',
valueField: 'loekz',
required: false,
render: function (item) {
return item.loekzTextView;
}
},
},
{display: "排序字段", name: "sortl", width: 150, minWidth: 60, type: "string", align: "center",
editor: {required: false, type: "text"}
},
{display: "标准采购订单数量", name: "norbm", width: "80", align: "left", type: "string",
{display: "标准采购订单数量", name: "norbm", width: "120", align: "left", type: "string",
editor: {type: 'text', mask: '9999999.99'}
},
{display: "最小采购订单数量", name: "minbm", width: "100", align: "left", type: "string",
{display: "最小采购订单数量", name: "minbm", width: "120", align: "left", type: "string",
editor: {type: 'text', mask: '9999999.99'}
},
{display: "等级类型", name:"stfkz", width: "80", align: "left", type: "string",
editor: {type: 'text'},
{display: "等级类型", name:"stfkzTextView", width: "200", align: "left", type: "string",
editor: {
type: 'dictionary',
data: {name: 'stfkz'},
textField: 'stfkzTextView',
valueField: 'stfkz',
required: true,
render: function (item) {
return item.stfkzTextView;
}
},
},
{display: "计划交货时间", name: "aplfz", width: "80", align: "left", type: "string",
editor: {required: false, type: "text", mask: '9999999.99'}
{display: "计划交货时间(天)", name: "aplfz", width: "150", align: "left", type: "string",
editor: {type: 'text', mask: '9999999.99'}
},
......@@ -205,6 +382,15 @@ function getExtendedData(processAction) {
if (!datas) {
return false;
}
datas.forEach(data=>{
if (Public.isNotBlank(data.bprme)
&& Public.isNotBlank(data.meins)
&& (Public.isBlank(data.umren) || Public.isBlank(data.umrez))){
Public.tip("订单价格单位不为空,单位转换分子、分母必填")
return false;
}
})
extendedData.sapPurchaseInfoRecordItems = Public.encodeJSONURI(datas);
}
return extendedData;
......
......@@ -4,7 +4,10 @@ import cn.hutool.core.collection.CollectionUtil;
import com.huigou.cache.DictUtil;
import com.huigou.topsun.sap.costCenter.application.CostCenterApplication;
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.domain.query.SapDialogQuery;
import com.huigou.topsun.sap.sapApplication.domain.vo.SapMaterialVo;
import com.huigou.uasp.annotation.ControllerMapping;
import com.huigou.uasp.bmp.common.easysearch.EasySearch;
import com.huigou.uasp.bmp.common.easysearch.domain.model.EasySearchParse;
......@@ -13,6 +16,7 @@ import com.huigou.uasp.bmp.opm.application.MemEasySearcher;
import com.huigou.uasp.bmp.opm.application.impl.MemEasySearcherImpl;
import com.huigou.util.SDO;
import com.huigou.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Controller;
......@@ -33,8 +37,8 @@ public class ResourceSearchController {
private SapDictionaryApplication sapDictionaryApplication;
@Resource
private SapPaymentApplication sapPaymentApplication;
@Resource
private CostCenterApplication costCenterApplication;
@Autowired
private SapMaterialApplication sapMaterialApplication;
@EasySearch(queryName = "knttp")
public Map<String, Object> knttpSelect(SDO sdo){
......@@ -92,9 +96,44 @@ public class ResourceSearchController {
@EasySearch(queryName = "sapMaterialSelect")
public Map<String, Object> sapMaterialSelect(SDO sdo) throws IOException {
String fieldName = sdo.getString("paramValue");
List<Map<String, Object>> mapList = sapDictionaryApplication.getSapDictionary(fieldName);
return this.initEasySearchModel( mapList, "", sdo);
String param = sdo.getString("paramValue");
String filterValue = sdo.getString("filterValue");
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")
......
......@@ -31,12 +31,24 @@ public class SapPurchaseInfoRecordItem extends AbstractEntity {
*/
@Column(name = "EKORG")
private String ekorg;
/**
* 采购组织
*/
@Column(name = "EKORG_NAME")
private String ekorgName;
/**
* 供应商
*/
@Column(name = "LIFNR")
private String lifnr;
/**
* 供应商
*/
@Column(name = "LIFNR_NAME")
private String lifnrName;
/**
* 供应商物料编码
*/
......@@ -62,6 +74,11 @@ public class SapPurchaseInfoRecordItem extends AbstractEntity {
*/
@Column(name = "MATKL")
private String matkl;
/**
* 物料组
*/
@Column(name = "MATKL_NAME")
private String matklName;
/**
* 采购信息记录分类
*/
......@@ -72,11 +89,22 @@ public class SapPurchaseInfoRecordItem extends AbstractEntity {
*/
@Column(name = "EKGRP")
private String ekgrp;
/**
* 采购组
*/
@Column(name = "EKGRP_NAME")
private String ekgrpName;
/**
* 工厂
*/
@Column(name = "WERKS")
private String werks;
/**
* 工厂
*/
@Column(name = "WERKS_NAME")
private String werksName;
/**
* 生产版本
*/
......@@ -92,6 +120,9 @@ public class SapPurchaseInfoRecordItem extends AbstractEntity {
*/
@Column(name = "WAERS")
private String waers;
@Column(name = "WAERS_NAME")
private String waersName;
/**
* 价格单位
*/
......@@ -102,6 +133,11 @@ public class SapPurchaseInfoRecordItem extends AbstractEntity {
*/
@Column(name = "BPRME")
private String bprme;
/**
* 订单价格单位(采购)
*/
@Column(name = "BPRME_NAME")
private String bprmeName;
/**
* 销售/购买税代码
*/
......@@ -137,6 +173,12 @@ public class SapPurchaseInfoRecordItem extends AbstractEntity {
*/
@Column(name = "MEINS")
private String meins;
/**
* 基本计量单位
*/
@Column(name = "MEINS_NAME")
private String meinsName;
/**
* 订单单位到基本单位转换的分母
*/
......
......@@ -5,6 +5,7 @@ import com.huigou.topsun.sap.sapApplication.domain.vo.SapMaterialVo;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
* @Auther: xin.lu
......@@ -12,5 +13,5 @@ import java.util.List;
* @Description:
*/
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;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.huigou.topsun.sap.common.HttpClient;
......@@ -26,8 +27,8 @@ public class SapMaterialApplicationImpl implements SapMaterialApplication {
@Resource
private HttpClient httpClient;
@Override
public List<SapMaterialVo> getSapMaterial(SapDialogQuery queryRequest) throws IOException {
List<SapMaterialVo> sapMaterialVoList = new ArrayList<>();
public List<Map<String,Object>> getSapMaterial(SapDialogQuery queryRequest) throws IOException {
List<Map<String,Object>> sapMaterialVoList = new ArrayList<>();
/*if (StringUtil.isBlank(queryRequest.getWerks()) || StringUtil.isBlank(queryRequest.getMatkl())){
return sapMaterialVoList;
}*/
......@@ -36,7 +37,8 @@ public class SapMaterialApplicationImpl implements SapMaterialApplication {
Map<String, Object> map = JSONUtil.toMap(json);
SapResult sapResult = JSONObject.parseObject(JSONUtil.toString(map.get("MSG")), SapResult.class);
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 {
throw new RuntimeException("查询物料失败:"+sapResult.getMESSAGE());
}
......
......@@ -11,6 +11,7 @@ import org.springframework.stereotype.Controller;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
* @Auther: xin.lu
......@@ -34,7 +35,7 @@ public class SapDialogSelectController extends CommonController {
public String sapMaterialSelect() throws IOException {
SDO sdo = this.getSDO();
SapDialogQuery queryRequest = sdo.toObject(SapDialogQuery.class);
List<SapMaterialVo> sapMaterial = sapMaterialApplication.getSapMaterial(queryRequest);
List<Map<String,Object>> sapMaterial = sapMaterialApplication.getSapMaterial(queryRequest);
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