Commit b2f482c0 authored by 1650842865's avatar 1650842865

付款申请时,把已使用过的采购发票号排除掉;新增打样工序报价流程

parent 63b63665
...@@ -40,6 +40,11 @@ function loadItemGrid() { ...@@ -40,6 +40,11 @@ function loadItemGrid() {
toolbarOptions = UICtrl.getDefaultToolbarOptions({ toolbarOptions = UICtrl.getDefaultToolbarOptions({
// 添加一行表格 // 添加一行表格
addHandler: function () { addHandler: function () {
var processQuotedType = $("#processQuotedType").val();
if (Public.isBlank(processQuotedType)){
Public.tip("请先选择工序报价类别");
return false;
}
UICtrl.addGridRow(itemGridManager, UICtrl.addGridRow(itemGridManager,
{ {
// 行号加一 // 行号加一
...@@ -180,17 +185,21 @@ function getOrderColumns(){ ...@@ -180,17 +185,21 @@ function getOrderColumns(){
name: "sapProductSelect", name: "sapProductSelect",
getParam: function (item) { getParam: function (item) {
return { return {
//filterValue:item.werks processQuotedType:$("#processQuotedType").val()
} }
}, },
back: { back: {
MATNR: "productCode", MATNR: "productCode",
MAKTX: "productName", MAKTX: "productName",
MSEHL: "unitName" MSEHL: "unitName",
PROOFING_NO: "proofingNo"
} }
}, },
} }
},); },);
columns.push({
display: "打样单号", name: "proofingNo", width: 300, minWidth: 60, type: "string", align: "left",
},);
columns.push({ columns.push({
display: "产品名称", name: "productName", width: 300, minWidth: 60, type: "string", align: "left", display: "产品名称", name: "productName", width: 300, minWidth: 60, type: "string", align: "left",
},); },);
...@@ -210,7 +219,8 @@ function getOrderColumns(){ ...@@ -210,7 +219,8 @@ function getOrderColumns(){
return false; return false;
} }
return { return {
itemCode:item.productCode itemCode:item.productCode,
proofingNo:item.proofingNo
} }
}, },
back: { back: {
...@@ -367,6 +377,7 @@ function getExtendedData(processAction) { ...@@ -367,6 +377,7 @@ function getExtendedData(processAction) {
if (!datas) { if (!datas) {
return false; return false;
} }
checkProcessQuotedType(datas);
extendedData.items = Public.encodeJSONURI(datas); extendedData.items = Public.encodeJSONURI(datas);
} }
return extendedData; return extendedData;
...@@ -388,6 +399,7 @@ function checkConstraints(){ ...@@ -388,6 +399,7 @@ function checkConstraints(){
Public.tip("报价单明细必填"); Public.tip("报价单明细必填");
return false; return false;
} }
checkProcessQuotedType(datas)
var hasItemNumber = true; var hasItemNumber = true;
var no = 0; var no = 0;
//如果没保存,从datas中取数据判断有没有报价规则 //如果没保存,从datas中取数据判断有没有报价规则
...@@ -429,6 +441,29 @@ function checkConstraints(){ ...@@ -429,6 +441,29 @@ function checkConstraints(){
} }
function checkProcessQuotedType(datas){
var processQuotedType = $("#processQuotedType").val();
if ("normal" == processQuotedType){
for (let i = 0; i < datas.length; i++) {
var row = datas[i];
//如果常规报价有打样单号,说明工序报价类型跟明细不对应
if (Public.isNotBlank(row.proofingNo)){
Public.tip("工序报价类别与报价单明细不一致,请修改!");
return false;
}
}
}else {
for (let i = 0; i < datas.length; i++) {
var row = datas[i];
//如果常规报价有打样单号,说明工序报价类型跟明细不对应
if (Public.isBlank(row.proofingNo)){
Public.tip("工序报价类别与报价单明细不一致,请修改!");
return false;
}
}
}
}
function bindEvent(){ function bindEvent(){
$('#supplierName').searchbox({ $('#supplierName').searchbox({
type: "system", name: "selectSuppliersDatas", type: "system", name: "selectSuppliersDatas",
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
<x:hidden name="personMemberName"/> <x:hidden name="personMemberName"/>
<div class="hg-form-cols"> <div class="hg-form-cols">
<div class="hg-form-row"> <div class="hg-form-row">
<x:selectC name="processQuotedType" label="工序报价类别" labelCol="1" fieldCol="2" required="true" dictionary="processQuotedType"/>
<x:hidden name="supplier"/> <x:hidden name="supplier"/>
<x:inputC name="supplierName" label="供应商" labelCol="1" fieldCol="2" required="true" wrapper="select"/> <x:inputC name="supplierName" label="供应商" labelCol="1" fieldCol="2" required="true" wrapper="select"/>
<x:inputC name="quotedPriceDate" label="报价日期" labelCol="1" fieldCol="2" required="true" wrapper="date"/> <x:inputC name="quotedPriceDate" label="报价日期" labelCol="1" fieldCol="2" required="true" wrapper="date"/>
......
...@@ -301,8 +301,11 @@ public class ResourceSearchController { ...@@ -301,8 +301,11 @@ public class ResourceSearchController {
@EasySearch(queryName = "sapProductSelect") @EasySearch(queryName = "sapProductSelect")
public Map<String, Object> sapProductSelect(SDO sdo) throws IOException { public Map<String, Object> sapProductSelect(SDO sdo) throws IOException {
String param = sdo.getString("paramValue"); String param = sdo.getString("paramValue");
List<Map<String,String>> mapList = new ArrayList<>();
String processQuotedType = sdo.getString("processQuotedType");
if ("normal".equals(processQuotedType)){//常规工序报价查询SAP物料信息
SapDialogQuery queryRequest = sdo.toObject(SapDialogQuery.class); SapDialogQuery queryRequest = sdo.toObject(SapDialogQuery.class);
List<Map<String,String>> mapList = sapMaterialApplication.getSapMaterial(queryRequest); mapList = sapMaterialApplication.getSapMaterial(queryRequest);
if (CollectionUtil.isNotEmpty(mapList)){ if (CollectionUtil.isNotEmpty(mapList)){
mapList = mapList mapList = mapList
.stream() .stream()
...@@ -311,11 +314,14 @@ public class ResourceSearchController { ...@@ -311,11 +314,14 @@ public class ResourceSearchController {
)) ))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
}else {//打样工序报价查询EP打样产品信息
mapList = epApplication.queryEpProofingProduct();
}
if (CollectionUtil.isNotEmpty(mapList)){ if (CollectionUtil.isNotEmpty(mapList)){
if (StringUtil.isNotBlank(param)){//模糊条件过滤 if (StringUtil.isNotBlank(param)){//模糊条件过滤
mapList = mapList mapList = mapList
.stream() .stream()
.filter(map -> map.values().stream().anyMatch(value->value.contains(param))) .filter(map -> map.values().stream().anyMatch(value->value!= null && value.contains(param)))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
} }
...@@ -328,6 +334,7 @@ public class ResourceSearchController { ...@@ -328,6 +334,7 @@ public class ResourceSearchController {
Arrays.asList( Arrays.asList(
new QuerySchemeField("工厂", "WERKS", "string", 60L), new QuerySchemeField("工厂", "WERKS", "string", 60L),
new QuerySchemeField("工厂名称", "NAME1", "string", 160L), new QuerySchemeField("工厂名称", "NAME1", "string", 160L),
new QuerySchemeField("打样单号", "PROOFING_NO", "string", 160L),
new QuerySchemeField("物料编码", "MATNR", "string", 140L), new QuerySchemeField("物料编码", "MATNR", "string", 140L),
new QuerySchemeField("物料名称", "MAKTX", "string", 400L), new QuerySchemeField("物料名称", "MAKTX", "string", 400L),
new QuerySchemeField("计量单位", "MSEHL", "string", 100L), new QuerySchemeField("计量单位", "MSEHL", "string", 100L),
...@@ -685,11 +692,16 @@ public class ResourceSearchController { ...@@ -685,11 +692,16 @@ public class ResourceSearchController {
@EasySearch(queryName = "selectEpProcess") @EasySearch(queryName = "selectEpProcess")
public Map<String, Object> selectEpProcess(SDO sdo) { public Map<String, Object> selectEpProcess(SDO sdo) {
String param = sdo.getString("paramValue"); String paramValue = sdo.getString("paramValue");
String itemCode = sdo.getString("itemCode"); String itemCode = sdo.getString("itemCode");
String proofingNo = sdo.getString("proofingNo");
List<Map<String, String>> mapList = new ArrayList<>(); List<Map<String, String>> mapList = new ArrayList<>();
if (StringUtil.isNotBlank(proofingNo)){//打样产品信息
mapList = epApplication.queryEpProductProcessByProofingNo(proofingNo);
}else {
mapList = epApplication.queryEpProductProcess(itemCode); mapList = epApplication.queryEpProductProcess(itemCode);
return sapDictionaryApplication.initEasySearchModel( mapList, param, sdo); }
return sapDictionaryApplication.initEasySearchModel( mapList, paramValue, sdo);
} }
@EasySearch(queryName = "selectEpBrandByItemCode") @EasySearch(queryName = "selectEpBrandByItemCode")
......
...@@ -37,4 +37,16 @@ public interface EpApplication { ...@@ -37,4 +37,16 @@ public interface EpApplication {
* @return * @return
*/ */
List<Map<String, String>> queryEpBrandByItemCode(String itemCode); List<Map<String, String>> queryEpBrandByItemCode(String itemCode);
/**
* 查询ep打样产品信息
*/
List<Map<String,String>> queryEpProofingProduct();
/**
* 根据打样单号查询打样产品信息
* @param proofingNo
* @return
*/
List<Map<String,String>> queryEpProductProcessByProofingNo(String proofingNo);
} }
...@@ -158,4 +158,46 @@ public class EpApplicationImpl implements EpApplication { ...@@ -158,4 +158,46 @@ public class EpApplicationImpl implements EpApplication {
} }
return mapList; return mapList;
} }
@Override
public List<Map<String, String>> queryEpProofingProduct() {
Map<String,Object> map = new HashMap<>();
List<Map<String, String>> mapList = new ArrayList<>();
String message = "";
try {
String executeForEp = httpClient.executeHttpGetForEp(map, "pro/listPrototypeMake");
Map<String, Object> resultMap = JSONObject.parseObject(executeForEp, Map.class);
if ("200".equals(resultMap.get("code").toString())) {
ObjectMapper objectMapper = SAPUtils.objectMapper();
mapList = objectMapper.readValue(com.huigou.util.JSONUtil.toString(resultMap.get("data")), new TypeReference<List<Map<String, String>>>() {});
}else {
message =(String) resultMap.get("msg");
throw new RuntimeException("查询EP打样产品信息出错:" + message);
}
} catch (IOException e) {
throw new RuntimeException("查询EP打样产品信息出错:" + e.getMessage());
}
return mapList;
}
@Override
public List<Map<String,String>> queryEpProductProcessByProofingNo(String proofingNo) {
Map<String,Object> map = new HashMap<>();
List<Map<String, String>> mapList = new ArrayList<>();
String message = "";
try {
//md/mdItem/queryBrandByItemCode/{itemCode}
String executeForEp = httpClient.executeHttpGetForEp(map, "pro/listProcessByPrototypeMakeCode?prototypeMakeCode="+proofingNo);
Map<String, Object> resultMap = JSONObject.parseObject(executeForEp, Map.class);
if ("200".equals(resultMap.get("code").toString())) {
ObjectMapper objectMapper = SAPUtils.objectMapper();
mapList = objectMapper.readValue(com.huigou.util.JSONUtil.toString(resultMap.get("data")), new TypeReference<List<Map<String, String>>>() {});
}else {
message =(String) resultMap.get("msg");
}
} catch (IOException e) {
throw new RuntimeException("查询工序出错:" + e.getMessage());
}
return mapList;
}
} }
...@@ -78,6 +78,20 @@ public class DefaultHttpClient extends BaseApplication implements HttpClient { ...@@ -78,6 +78,20 @@ public class DefaultHttpClient extends BaseApplication implements HttpClient {
*/ */
@Override @Override
public String executeForEp(Object param,String url) throws IOException { public String executeForEp(Object param,String url) throws IOException {
return this.buildHttpClient(param, getEPHttpUrlMsg(url),"");
}
@Override
public String executeHttpGetForEp(Object param, String url) throws IOException {
return this.buildHttpGetClient(param, getEPHttpUrlMsg(url),"");
}
/**
* 返回URL拼接
* @param url
* @return
*/
public String getEPHttpUrlMsg(String url){
//系统接口地址 //系统接口地址
// ip地址 // ip地址
String ip = SystemCache.getParameter("ep.service.ip", String.class); String ip = SystemCache.getParameter("ep.service.ip", String.class);
...@@ -89,7 +103,7 @@ public class DefaultHttpClient extends BaseApplication implements HttpClient { ...@@ -89,7 +103,7 @@ public class DefaultHttpClient extends BaseApplication implements HttpClient {
.append(ip) .append(ip)
.append(applicationContext) .append(applicationContext)
.append(url); .append(url);
return this.buildHttpClient(param, String.valueOf(serverUrl),""); return String.valueOf(serverUrl);
} }
/** /**
...@@ -192,7 +206,7 @@ public class DefaultHttpClient extends BaseApplication implements HttpClient { ...@@ -192,7 +206,7 @@ public class DefaultHttpClient extends BaseApplication implements HttpClient {
if (StringUtil.isNotBlank(usernameAndPassword)){ if (StringUtil.isNotBlank(usernameAndPassword)){
get.addHeader("Authorization", "Basic " + Base64.getEncoder().encodeToString(usernameAndPassword.getBytes())); get.addHeader("Authorization", "Basic " + Base64.getEncoder().encodeToString(usernameAndPassword.getBytes()));
} }
LOG.info("post={}", get); LOG.info("get={}", get);
HttpResponse response; HttpResponse response;
String responseText = ""; String responseText = "";
try { try {
......
...@@ -19,6 +19,7 @@ public interface HttpClient { ...@@ -19,6 +19,7 @@ public interface HttpClient {
public String execute(Object param,String url) throws IOException; public String execute(Object param,String url) throws IOException;
public String executeForEp(Object param,String url) throws IOException; public String executeForEp(Object param,String url) throws IOException;
public String executeHttpGetForEp(Object param,String url) throws IOException;
public String executeForMes(Object param,String url) throws IOException; public String executeForMes(Object param,String url) throws IOException;
......
...@@ -37,4 +37,7 @@ public interface SapCostReimbursementApplication { ...@@ -37,4 +37,7 @@ public interface SapCostReimbursementApplication {
Map<String, Object> queryKostlByPersonCode(String personCode); Map<String, Object> queryKostlByPersonCode(String personCode);
Map<String, Object> slicedAdvancePaymentList(SapCostReimbursementQueryRequest queryRequest); Map<String, Object> slicedAdvancePaymentList(SapCostReimbursementQueryRequest queryRequest);
List<Map<String, Object>> excludeCompletePartnerInvs(String partner);
} }
\ No newline at end of file
...@@ -392,6 +392,13 @@ public class SapCostReimbursementApplicationImpl extends FlowBroker implements S ...@@ -392,6 +392,13 @@ public class SapCostReimbursementApplicationImpl extends FlowBroker implements S
return this.sqlExecutorDao.executeSlicedQuery(model); return this.sqlExecutorDao.executeSlicedQuery(model);
} }
@Override
public List<Map<String, Object>> excludeCompletePartnerInvs(String partner) {
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "excludeCompletePartnerInvs");
String sql = queryDescriptor.getSql();
return this.sqlExecutorDao.queryToListMap(sql, partner);
}
public void makeACopyFor(SapCostReimbursement reimbursement) { public void makeACopyFor(SapCostReimbursement reimbursement) {
// 流程结束给申请人发送抄送 // 流程结束给申请人发送抄送
List<String> executorIds = new ArrayList<>(1); List<String> executorIds = new ArrayList<>(1);
......
...@@ -19,6 +19,7 @@ import org.slf4j.Logger; ...@@ -19,6 +19,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
...@@ -249,6 +250,21 @@ public class SapCostReimbursementController extends CommonController { ...@@ -249,6 +250,21 @@ public class SapCostReimbursementController extends CommonController {
SDO sdo = this.getSDO(); SDO sdo = this.getSDO();
SapCostReimbursementQueryRequest queryRequest = sdo.toQueryRequest(SapCostReimbursementQueryRequest.class); SapCostReimbursementQueryRequest queryRequest = sdo.toQueryRequest(SapCostReimbursementQueryRequest.class);
List<Map<String, String>> mapList = sapPaymentApplication.getPartnerInvs(queryRequest.getBukrs(),queryRequest.getPartner(),queryRequest.getZepFtype()); List<Map<String, String>> mapList = sapPaymentApplication.getPartnerInvs(queryRequest.getBukrs(),queryRequest.getPartner(),queryRequest.getZepFtype());
//查询申请中、审批中、已完成的发票号
List<Map<String, Object>> excludeCompletePartnerInvs = costReimbursementApplication.excludeCompletePartnerInvs(queryRequest.getPartner());
//遍历mapList,把采购发票号相同的排除掉
if (!CollectionUtils.isEmpty(mapList) && !CollectionUtils.isEmpty(excludeCompletePartnerInvs)){
for (Map<String, String> stringStringMap : mapList) {
String belnr2 = stringStringMap.get("BELNR2");
for (Map<String, Object> partnerInv : excludeCompletePartnerInvs) {
String belnr2DB = (String)partnerInv.get("belnr2");
if (belnr2.equals(belnr2DB)){
mapList.remove(stringStringMap);
}
}
}
}
return packGridDataAndResult(mapList); return packGridDataAndResult(mapList);
} }
} }
\ No newline at end of file
...@@ -56,6 +56,14 @@ public class ProcessQuotedPrice extends FlowBillAbstractEntity { ...@@ -56,6 +56,14 @@ public class ProcessQuotedPrice extends FlowBillAbstractEntity {
@Column(name = "remark") @Column(name = "remark")
private String remark; private String remark;
/**
* 工序报价类别
* normal 常规
* proofing 打样
*/
@Column(name = "process_quoted_type")
private String processQuotedType;
@Override @Override
protected String getCodeRuleId() { protected String getCodeRuleId() {
return "processQuotedPrice"; return "processQuotedPrice";
......
...@@ -143,6 +143,15 @@ ...@@ -143,6 +143,15 @@
<condition column="belnr1" name="belnr1" type="java.lang.String" symbol="like" alias="d"/> <condition column="belnr1" name="belnr1" type="java.lang.String" symbol="like" alias="d"/>
</query> </query>
<query name="excludeCompletePartnerInvs">
<sql-query>
SELECT d.BELNR2
FROM sap_cost_reimbursement_base_info b
LEFT JOIN sap_cost_reimbursement_detail d ON b.id = d.reimbursement_base_info_id
WHERE b.`status` IN ( 0, 1, 3 ) AND d.BELNR2 IS NOT NULL AND d.BELNR2 != '' AND b.PARTNER = ?
</sql-query>
</query>
</query-mappings> </query-mappings>
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