Commit b2f482c0 authored by 1650842865's avatar 1650842865

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

parent 63b63665
......@@ -40,6 +40,11 @@ function loadItemGrid() {
toolbarOptions = UICtrl.getDefaultToolbarOptions({
// 添加一行表格
addHandler: function () {
var processQuotedType = $("#processQuotedType").val();
if (Public.isBlank(processQuotedType)){
Public.tip("请先选择工序报价类别");
return false;
}
UICtrl.addGridRow(itemGridManager,
{
// 行号加一
......@@ -180,17 +185,21 @@ function getOrderColumns(){
name: "sapProductSelect",
getParam: function (item) {
return {
//filterValue:item.werks
processQuotedType:$("#processQuotedType").val()
}
},
back: {
MATNR: "productCode",
MAKTX: "productName",
MSEHL: "unitName"
MSEHL: "unitName",
PROOFING_NO: "proofingNo"
}
},
}
},);
columns.push({
display: "打样单号", name: "proofingNo", width: 300, minWidth: 60, type: "string", align: "left",
},);
columns.push({
display: "产品名称", name: "productName", width: 300, minWidth: 60, type: "string", align: "left",
},);
......@@ -210,7 +219,8 @@ function getOrderColumns(){
return false;
}
return {
itemCode:item.productCode
itemCode:item.productCode,
proofingNo:item.proofingNo
}
},
back: {
......@@ -367,6 +377,7 @@ function getExtendedData(processAction) {
if (!datas) {
return false;
}
checkProcessQuotedType(datas);
extendedData.items = Public.encodeJSONURI(datas);
}
return extendedData;
......@@ -388,6 +399,7 @@ function checkConstraints(){
Public.tip("报价单明细必填");
return false;
}
checkProcessQuotedType(datas)
var hasItemNumber = true;
var no = 0;
//如果没保存,从datas中取数据判断有没有报价规则
......@@ -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(){
$('#supplierName').searchbox({
type: "system", name: "selectSuppliersDatas",
......
......@@ -26,6 +26,7 @@
<x:hidden name="personMemberName"/>
<div class="hg-form-cols">
<div class="hg-form-row">
<x:selectC name="processQuotedType" label="工序报价类别" labelCol="1" fieldCol="2" required="true" dictionary="processQuotedType"/>
<x:hidden name="supplier"/>
<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"/>
......
......@@ -301,21 +301,27 @@ public class ResourceSearchController {
@EasySearch(queryName = "sapProductSelect")
public Map<String, Object> sapProductSelect(SDO sdo) throws IOException {
String param = sdo.getString("paramValue");
SapDialogQuery queryRequest = sdo.toObject(SapDialogQuery.class);
List<Map<String,String>> mapList = sapMaterialApplication.getSapMaterial(queryRequest);
if (CollectionUtil.isNotEmpty(mapList)){
mapList = mapList
.stream()
.filter(map -> (map.containsValue("ZZCP")
|| map.containsValue("ZBCP")
))
.collect(Collectors.toList());
List<Map<String,String>> mapList = new ArrayList<>();
String processQuotedType = sdo.getString("processQuotedType");
if ("normal".equals(processQuotedType)){//常规工序报价查询SAP物料信息
SapDialogQuery queryRequest = sdo.toObject(SapDialogQuery.class);
mapList = sapMaterialApplication.getSapMaterial(queryRequest);
if (CollectionUtil.isNotEmpty(mapList)){
mapList = mapList
.stream()
.filter(map -> (map.containsValue("ZZCP")
|| map.containsValue("ZBCP")
))
.collect(Collectors.toList());
}
}else {//打样工序报价查询EP打样产品信息
mapList = epApplication.queryEpProofingProduct();
}
if (CollectionUtil.isNotEmpty(mapList)){
if (StringUtil.isNotBlank(param)){//模糊条件过滤
mapList = mapList
.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());
}
}
......@@ -328,6 +334,7 @@ public class ResourceSearchController {
Arrays.asList(
new QuerySchemeField("工厂", "WERKS", "string", 60L),
new QuerySchemeField("工厂名称", "NAME1", "string", 160L),
new QuerySchemeField("打样单号", "PROOFING_NO", "string", 160L),
new QuerySchemeField("物料编码", "MATNR", "string", 140L),
new QuerySchemeField("物料名称", "MAKTX", "string", 400L),
new QuerySchemeField("计量单位", "MSEHL", "string", 100L),
......@@ -685,11 +692,16 @@ public class ResourceSearchController {
@EasySearch(queryName = "selectEpProcess")
public Map<String, Object> selectEpProcess(SDO sdo) {
String param = sdo.getString("paramValue");
String paramValue = sdo.getString("paramValue");
String itemCode = sdo.getString("itemCode");
String proofingNo = sdo.getString("proofingNo");
List<Map<String, String>> mapList = new ArrayList<>();
mapList = epApplication.queryEpProductProcess(itemCode);
return sapDictionaryApplication.initEasySearchModel( mapList, param, sdo);
if (StringUtil.isNotBlank(proofingNo)){//打样产品信息
mapList = epApplication.queryEpProductProcessByProofingNo(proofingNo);
}else {
mapList = epApplication.queryEpProductProcess(itemCode);
}
return sapDictionaryApplication.initEasySearchModel( mapList, paramValue, sdo);
}
@EasySearch(queryName = "selectEpBrandByItemCode")
......
......@@ -37,4 +37,16 @@ public interface EpApplication {
* @return
*/
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 {
}
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 {
*/
@Override
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地址
String ip = SystemCache.getParameter("ep.service.ip", String.class);
......@@ -89,7 +103,7 @@ public class DefaultHttpClient extends BaseApplication implements HttpClient {
.append(ip)
.append(applicationContext)
.append(url);
return this.buildHttpClient(param, String.valueOf(serverUrl),"");
return String.valueOf(serverUrl);
}
/**
......@@ -192,7 +206,7 @@ public class DefaultHttpClient extends BaseApplication implements HttpClient {
if (StringUtil.isNotBlank(usernameAndPassword)){
get.addHeader("Authorization", "Basic " + Base64.getEncoder().encodeToString(usernameAndPassword.getBytes()));
}
LOG.info("post={}", get);
LOG.info("get={}", get);
HttpResponse response;
String responseText = "";
try {
......
......@@ -19,6 +19,7 @@ public interface HttpClient {
public String execute(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;
......
......@@ -37,4 +37,7 @@ public interface SapCostReimbursementApplication {
Map<String, Object> queryKostlByPersonCode(String personCode);
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
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) {
// 流程结束给申请人发送抄送
List<String> executorIds = new ArrayList<>(1);
......
......@@ -19,6 +19,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
......@@ -249,6 +250,21 @@ public class SapCostReimbursementController extends CommonController {
SDO sdo = this.getSDO();
SapCostReimbursementQueryRequest queryRequest = sdo.toQueryRequest(SapCostReimbursementQueryRequest.class);
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);
}
}
\ No newline at end of file
......@@ -56,6 +56,14 @@ public class ProcessQuotedPrice extends FlowBillAbstractEntity {
@Column(name = "remark")
private String remark;
/**
* 工序报价类别
* normal 常规
* proofing 打样
*/
@Column(name = "process_quoted_type")
private String processQuotedType;
@Override
protected String getCodeRuleId() {
return "processQuotedPrice";
......
......@@ -143,6 +143,15 @@
<condition column="belnr1" name="belnr1" type="java.lang.String" symbol="like" alias="d"/>
</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>
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