Commit ccbe598e authored by 1650842865's avatar 1650842865

品质异常报告增加客户异常根据生产单号来选择

parent 1a84050f
...@@ -61,11 +61,10 @@ function initialize() { ...@@ -61,11 +61,10 @@ function initialize() {
} }
showPurchaseDiv(); showPurchaseDiv();
} else { } else {
if ($('#exceptionType').val()=="out"){ // if ($('#exceptionType').val()=="out" && v.value== "2"){
Public.tip("生产和客户异常的异常类型只能是内部!"); // Public.tip("生产异常的异常类型只能是内部!");
clearExceptionType(); // clearExceptionType();
// return false; // }
}
if (v.value== "3"){ if (v.value== "3"){
checkbox = true checkbox = true
initSerachBox(); initSerachBox();
...@@ -89,13 +88,14 @@ function initialize() { ...@@ -89,13 +88,14 @@ function initialize() {
clearExceptionType(); clearExceptionType();
return false; return false;
} }
} else {
if ($('#exceptionReasonType').val()!=""&&$('#exceptionReasonType').val()!=1){
Public.tip("生产和客户异常的异常类型只能是内部!");
clearExceptionType();
return false;
}
} }
// else {
// if ($('#exceptionReasonType').val()!="" && $('#exceptionReasonType').val()!=1 && $('#exceptionReasonType').val()!=3){
// Public.tip("生产异常的异常类型只能是内部!");
// clearExceptionType();
// return false;
// }
// }
} }
}); });
...@@ -122,6 +122,9 @@ function showProduceDiv() { ...@@ -122,6 +122,9 @@ function showProduceDiv() {
$("#produceDiv").show(); $("#produceDiv").show();
$("#producegridDiv").show(); $("#producegridDiv").show();
$("#clientgridDiv").hide(); $("#clientgridDiv").hide();
$("#produceNoDiv").hide();
$("#customerOrderNo_label").text("生产单号");
$("#produceNo").val("");
try { try {
produceGridManager.loadData(); produceGridManager.loadData();
} catch(e){ } catch(e){
...@@ -137,6 +140,8 @@ function showClientDiv() { ...@@ -137,6 +140,8 @@ function showClientDiv() {
$("#produceDiv").show(); $("#produceDiv").show();
$("#clientgridDiv").show(); $("#clientgridDiv").show();
$("#producegridDiv").hide(); $("#producegridDiv").hide();
$("#produceNoDiv").show();
$("#customerOrderNo_label").text("客户单号")
try { try {
clientGridManager.loadData(); clientGridManager.loadData();
} catch(e){ } catch(e){
...@@ -240,6 +245,49 @@ function initSerachBox(){ ...@@ -240,6 +245,49 @@ function initSerachBox(){
$('#customerOrderNo').val(value.value); $('#customerOrderNo').val(value.value);
} }
}); });
$('#produceNo').searchbox({
type: "system", name: "sapCustomerProduceNoByProduceNo",
getParam: function (item) {
if (Public.isBlank($('#werksName').val())) {
Public.tip("请先选择工厂!")
return false
}
if ($('#exceptionReasonType').val()=="3"&&Public.isBlank($('#customerNo').val())) {
Public.tip("请先输入客户编号!")
return false
}
return {
werks: $('#werks').val(),
kunnr: $('#customerNo').val(),
reasonType:$('#exceptionReasonType').val(),
}
},
onChange: function (value, row) {
var dates = clientGridManager.getData();
if (dates != null && dates.length > 0){
for (let j = 0; j < dates.length; j++) {
var data = dates[j];
if (data.produceNo == row.AUFNR){
Public.tip("生产单号:"+row.AUFNR+" 已选择,请取消勾选!");
return false;
}
}
}
clientGridManager.addRow({
produceNo: row.AUFNR,
productCode: row.MATNR,
productName: row.MAKTX,
number: row.PSMNG,
unitName: row.MEINS,
currencyName: row.KOEIN,
money: row.KWERT,
price: row.NETWR,
sendDate: row.LFDAT
});
$('#produceNo').val(row.AUFNR);
}
});
//产品类别 //产品类别
$('#productTypeName').searchbox({ $('#productTypeName').searchbox({
type: "system", name: "dictionary", type: "system", name: "dictionary",
......
...@@ -66,9 +66,12 @@ ...@@ -66,9 +66,12 @@
</div> </div>
<div class="hg-form-cols" id="produceDiv"> <div class="hg-form-cols" id="produceDiv">
<div class="hg-form-row"> <div class="hg-form-row">
<x:inputC name="customerNo" label="客户编号" labelCol="1" fieldCol="2" required="false" wrapper="select"/> <x:inputC name="customerNo" label="客户编号" labelCol="1" fieldCol="2" required="false" wrapper="select"/>
<x:inputC name="customerOrderNo" label="生产单号/客户单号" labelCol="2" fieldCol="4" wrapper="select" required="false"/> <x:inputC name="customerOrderNo" label="客户单号" labelCol="1" fieldCol="2" wrapper="select" required="false"/>
<x:inputC name="customerName" label="客户名称" labelCol="1" fieldCol="2" required="false" readonly="true"/> <div id="produceNoDiv">
<x:inputC name="produceNo" label="生产单号" labelCol="1" fieldCol="2" wrapper="select" required="false"/>
</div>
<x:inputC name="customerName" label="客户名称" labelCol="1" fieldCol="2" required="false" readonly="true"/>
</div> </div>
<x:title title="单号信息" name="group" hideTable="#info" /> <x:title title="单号信息" name="group" hideTable="#info" />
<div class="hg-form-cols" id="producegridDiv"> <div class="hg-form-cols" id="producegridDiv">
......
...@@ -409,6 +409,38 @@ public class ResourceSearchController { ...@@ -409,6 +409,38 @@ public class ResourceSearchController {
return model; return model;
} }
@EasySearch(queryName = "sapCustomerProduceNoByProduceNo")
public Map<String, Object> sapCustomerProduceNoByProduceNo(SDO sdo) throws IOException {
String param = sdo.getString("paramValue");
SapDialogOrderQuery queryRequest = sdo.toObject(SapDialogOrderQuery.class);
List <Map<String,String>>mapList = sapMaterialApplication.sapCustomerProduceNoByProduceNo(queryRequest);
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("客户单号", "BSTNK", "string", 140L),
new QuerySchemeField("物料编号", "MATNR", "string", 140L),
new QuerySchemeField("物料名称", "MAKTX", "string", 200L),
new QuerySchemeField("生产单号", "AUFNR", "string", 200L),
new QuerySchemeField("生产数量", "PSMNG", "string", 100L),
new QuerySchemeField("单位", "MEINS", "string", 100L),
new QuerySchemeField("单位", "NETWR", "string", 100L),
new QuerySchemeField("币别", "KOEIN", "string", 100L),
new QuerySchemeField("金额", "KWERT", "string", 200L),
new QuerySchemeField("出货日期", "LFDAT", "string", 100L)
);
easySearchParse.setFields(fields);
easySearchParse.setWidth(500L);
MemEasySearcher<Map<String, String>> memEasySearcher = new MemEasySearcherImpl<>();
Map<String, Object> model = memEasySearcher.search(mapList, easySearchParse, pageRequest, null);
return model;
}
@EasySearch(queryName = "dictionarySelect") @EasySearch(queryName = "dictionarySelect")
public Map<String, Object> dictionarySelect(SDO sdo) throws IOException { public Map<String, Object> dictionarySelect(SDO sdo) throws IOException {
String param = sdo.getString("paramValue"); String param = sdo.getString("paramValue");
......
...@@ -211,6 +211,9 @@ public class ExceptionReport extends FlowBillAbstractEntity { ...@@ -211,6 +211,9 @@ public class ExceptionReport extends FlowBillAbstractEntity {
@Column(name = "source_bill_code") @Column(name = "source_bill_code")
private String sourceBillCode; private String sourceBillCode;
@Column(name = "produce_no")
private String produceNo;
@Override @Override
protected String getCodeRuleId() { protected String getCodeRuleId() {
return "exceptionReport"; return "exceptionReport";
......
...@@ -18,4 +18,5 @@ public interface SapMaterialApplication { ...@@ -18,4 +18,5 @@ public interface SapMaterialApplication {
List<Map<String,String>> getSapCustomerOrder(SapDialogOrderQuery queryRequest) throws IOException; List<Map<String,String>> getSapCustomerOrder(SapDialogOrderQuery queryRequest) throws IOException;
List<Map<String, String>> sapCustomerProduceNoByProduceNo(SapDialogOrderQuery queryRequest);
} }
...@@ -266,4 +266,89 @@ public class SapMaterialApplicationImpl implements SapMaterialApplication { ...@@ -266,4 +266,89 @@ public class SapMaterialApplicationImpl implements SapMaterialApplication {
} }
return sapOrderVoList; return sapOrderVoList;
} }
@Override
public List<Map<String, String>> sapCustomerProduceNoByProduceNo(SapDialogOrderQuery queryRequest) {
List<Map<String,String>> sapOrderVoList= new ArrayList<>();
OrderQueryVo orderQueryVo=new OrderQueryVo();
SignVo signVo=null;
String InterfaceName="SALES_ORDERS/SALES"; //客户异常 查询销售订单接口
if (StringUtils.isNotBlank(queryRequest.getWerks())) { //工厂
signVo=new SignVo();
signVo.setLow(queryRequest.getWerks());
List <SignVo> werksList=new ArrayList<>();
werksList.add(signVo);
orderQueryVo.setWERKS(werksList);
}
if (StringUtils.isNotBlank(queryRequest.getKunnr())&&"3".equals(queryRequest.getReasonType())) { //客户编号
signVo = new SignVo();
signVo.setLow(queryRequest.getKunnr());
List<SignVo> kunnrList = new ArrayList<>();
kunnrList.add(signVo);
orderQueryVo.setKUNNR(kunnrList);
}
if (StringUtils.isNotBlank(queryRequest.getParamValue())) { //过滤参数 按订单号查询
List <SignVo> vbelnList=new ArrayList<>();
String aufnr = queryRequest.getParamValue();
String[] split = aufnr.split(",");
List<String> aufnrs = Arrays.asList(split);
for (String s : aufnrs) {
signVo=new SignVo();
String newStr = s.replaceFirst("^0*", "");
signVo.setLow(newStr);
signVo.setOption("EQ");
vbelnList.add(signVo);
}
orderQueryVo.setAUFNR(vbelnList);
}
Object obj = JSONObject.toJSON(orderQueryVo);
try {
String json ="";
List<Map<String, Object>> mapList=new ArrayList<>();
if ("3".equals(queryRequest.getReasonType())) { //如果是客户异常
if (StringUtils.isNotBlank(queryRequest.getParamValue())) { //必须输入参数
json = httpClient.execute(obj, InterfaceName);
mapList = JSONUtil.toListMap(json);
}
}
for (Map map : mapList) {
List<Map<String, Object>> mapList2=(List<Map<String, Object>>)map.get("ITEM");
for (Map mapItem:mapList2) {
Map newMap = new HashMap();
newMap.put("BSTNK", map.get("BSTNK")); //客户单号
newMap.put("MATNR", mapItem.get("MATNR")); //物料编号
newMap.put("MAKTX", mapItem.get("MAKTX")); //物料名称
newMap.put("AUFNR", mapItem.get("AUFNR")); //生产单号
newMap.put("PSMNG", mapItem.get("PSMNG")); //生产数量
String sendDate="";
if (!"00000000".equals(mapItem.get("LFDAT").toString())){
sendDate=mapItem.get("LFDAT").toString();
sendDate=sendDate.substring(0,4)+"-"+sendDate.substring(4,6)+"-"+sendDate.substring(6,8);
}
newMap.put("LFDAT", sendDate); //出货日期
newMap.put("MEINS", mapItem.get("MEINS_O")); //单位
newMap.put("NETWR", mapItem.get("NETWR")); //单位
// KPEIN //定价单位
newMap.put("KWERT", mapItem.get("KWERT")); // //折前总金额
newMap.put("KOEIN", mapItem.get("KOEIN")); // 币别
if (StringUtils.isNotBlank(queryRequest.getParamValue())){ //过滤参数
if (mapItem.get("MATNR").toString().contains(queryRequest.getParamValue())
||mapItem.get("MAKTX").toString().contains(queryRequest.getParamValue())
||mapItem.get("AUFNR").toString().contains(queryRequest.getParamValue())
){
sapOrderVoList.add(newMap);
}
} else {
sapOrderVoList.add(newMap);
}
}
}
} catch (Exception ex){
throw new RuntimeException("查询客户订单失败:"+ex.getMessage());
}
return sapOrderVoList;
}
} }
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