Commit 233326a5 authored by 刘学辉's avatar 刘学辉

Merge remote-tracking branch 'origin/dev' into dev

parents 81b8cec2 aa0e1e49
...@@ -163,8 +163,9 @@ function updateHandler(row) { ...@@ -163,8 +163,9 @@ function updateHandler(row) {
//删除按钮 //删除按钮
function deleteHandler() { function deleteHandler() {
let row = DataUtil.getSelectedRow(gridManager); let row = DataUtil.getSelectedRow(gridManager);
if (row.isCostCenterHis != 1){ //只能删除历史数据和新增已中止数据
Public.tip("只能删除历史数据") if (row.isCostCenterHis != 1 && row.status != 5){
Public.tip("只能删除已中止数据");
return false; return false;
} }
DataUtil.del({ DataUtil.del({
......
...@@ -189,7 +189,11 @@ function getExtendedData(processAction) { ...@@ -189,7 +189,11 @@ function getExtendedData(processAction) {
return false; return false;
}else if (datas.some(item => item.kostl === "" && item.aufnr === "")){ }else if (datas.some(item => item.kostl === "" && item.aufnr === "")){
const nullItems = datas.filter(item => item.kostl === "" && item.aufnr === "").map(item => item.zlenr); const nullItems = datas.filter(item => item.kostl === "" && item.aufnr === "").map(item => item.zlenr);
Public.tip("行号[" + nullItems.join(",") + "]成本中心or订单选择一栏填写"); Public.tip("行号[" + nullItems.join(",") + "]成本中心or订单只能选择一栏填写");
return false;
}else if (datas.some(item => item.kostl != "" && item.aufnr != "")){
const nullItems = datas.filter(item => item.kostl != "" && item.aufnr != "").map(item => item.zlenr);
Public.tip("行号[" + nullItems.join(",") + "]成本中心or订单只能选择一栏填写");
return false; return false;
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
</head> </head>
<body> <body>
<x:hidden name="isDetailPage" value="false"/> <!--是否是详情页--> <x:hidden name="isDetailPage" value="false"/> <!--是否是详情页-->
<x:billTitle title="统计指标指数过账" needStatus="false" needPerson="true"/> <x:billTitle title="统计指标过账" needStatus="false" needPerson="true"/>
<form class="hg-form" method="post" action="" id="submitForm"> <form class="hg-form" method="post" action="" id="submitForm">
<x:hidden name="id"/> <x:hidden name="id"/>
<x:hidden name="billCode"/> <x:hidden name="billCode"/>
......
...@@ -107,7 +107,7 @@ function deleteHandler() { ...@@ -107,7 +107,7 @@ function deleteHandler() {
function addHandler() { function addHandler() {
UICtrl.addTabItem({ UICtrl.addTabItem({
tabid: 'statsIndicators', tabid: 'statsIndicators',
text: "统计指标数据", text: "新增统计指标过账",
url: web_app.name + '/sapStatsIndicators/forwardStatsIndicators.job' url: web_app.name + '/sapStatsIndicators/forwardStatsIndicators.job'
}); });
} }
...@@ -115,7 +115,7 @@ function addHandler() { ...@@ -115,7 +115,7 @@ function addHandler() {
function doView(id) { function doView(id) {
UICtrl.addTabItem({ UICtrl.addTabItem({
tabid: 'showStatsIndicators'+id, tabid: 'showStatsIndicators'+id,
text: "统计指标详情", text: "统计指标过账详情",
url: web_app.name + '/sapStatsIndicators/showStatsIndicators.job?bizId='+id+"&isDetailPage=true" url: web_app.name + '/sapStatsIndicators/showStatsIndicators.job?bizId='+id+"&isDetailPage=true"
}); });
} }
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<x:select name="yesorno" dictionary="yesorno"/> <x:select name="yesorno" dictionary="yesorno"/>
</div> </div>
<div id="layout"> <div id="layout">
<div position="center" title="统计指标"> <div position="center" title="统计指标过账列表">
<x:title title="common.button.search" hideTable="queryMainForm" isHide="true"/> <x:title title="common.button.search" hideTable="queryMainForm" isHide="true"/>
<form class="hg-form ui-hide" method="post" action="" id="queryMainForm"> <form class="hg-form ui-hide" method="post" action="" id="queryMainForm">
<x:inputC name="proofingApplyNo" required="false" label="申请单号" labelCol="1"/> <x:inputC name="proofingApplyNo" required="false" label="申请单号" labelCol="1"/>
......
...@@ -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 id="cashierGrid">
<div class="blank_div clearfix"></div>
<div id="sapSuppliersPayGrid" style="margin: 2px;"></div>
<div class="blank_div clearfix"></div> <div class="blank_div clearfix"></div>
<div id="sapSuppliersBankGrid" style="margin: 2px;"></div> <div id="sapSuppliersBankGrid" style="margin: 2px;"></div>
</div>
</form> </form>
</body> </body>
</html> </html>
...@@ -283,7 +283,7 @@ public class ResourceSearchController { ...@@ -283,7 +283,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]);
} }
...@@ -310,36 +310,6 @@ public class ResourceSearchController { ...@@ -310,36 +310,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");
...@@ -347,7 +317,7 @@ public class ResourceSearchController { ...@@ -347,7 +317,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")
...@@ -357,7 +327,7 @@ public class ResourceSearchController { ...@@ -357,7 +327,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")
...@@ -366,7 +336,7 @@ public class ResourceSearchController { ...@@ -366,7 +336,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")
...@@ -375,7 +345,7 @@ public class ResourceSearchController { ...@@ -375,7 +345,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")
...@@ -386,7 +356,7 @@ public class ResourceSearchController { ...@@ -386,7 +356,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")
...@@ -398,7 +368,7 @@ public class ResourceSearchController { ...@@ -398,7 +368,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")
...@@ -407,7 +377,7 @@ public class ResourceSearchController { ...@@ -407,7 +377,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")
...@@ -416,46 +386,7 @@ public class ResourceSearchController { ...@@ -416,46 +386,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())) {
if ("0".equals(suppliersInfo.getApplyType())){
suppliersInfo.setPartner(sapResult.getMESSAGE_V1().substring(4)); 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