Commit 40aa49ce sunke

镁光20031API

1 个父辈 63434ac1
...@@ -46,12 +46,23 @@ public class HttpHelper { ...@@ -46,12 +46,23 @@ public class HttpHelper {
private static final int READ_DATA_TIMEOUT = 10000; private static final int READ_DATA_TIMEOUT = 10000;
public static String postJson(String url, Map<String, Object> params) throws ApiException { public static String postJson(String url, Map<String, Object> params) throws ApiException {
// 设置请求参数
if (params == null || params.isEmpty()) {
params = null;
}
return postJsonWithAuth(url,params, null);
}
public static String postJsonWithAuth(String url, Object params, String auth) throws ApiException {
HttpPost httpPost = new HttpPost(url); HttpPost httpPost = new HttpPost(url);
httpPost.addHeader("Content-Type", "application/json;charset=utf-8"); httpPost.addHeader("Content-Type", "application/json;charset=utf-8");
if (auth != null && !auth.isEmpty()){
httpPost.addHeader("Authorization",auth);
}
// 设置请求参数 // 设置请求参数
if (params != null && !params.isEmpty()) { if (params != null) {
ObjectMapper mapper = new ObjectMapper();
try { try {
ObjectMapper mapper = new ObjectMapper();
String requestBody = mapper.writeValueAsString(params); String requestBody = mapper.writeValueAsString(params);
httpPost.setEntity(new StringEntity(requestBody,CONTENT_CHARSET)); httpPost.setEntity(new StringEntity(requestBody,CONTENT_CHARSET));
} catch (JsonProcessingException e) { } catch (JsonProcessingException e) {
...@@ -71,7 +82,6 @@ public class HttpHelper { ...@@ -71,7 +82,6 @@ public class HttpHelper {
}catch (Exception e){ }catch (Exception e){
throw new ApiException("Request to [" + url + "] failed:" + e.getMessage()); throw new ApiException("Request to [" + url + "] failed:" + e.getMessage());
} }
} }
/** /**
......
...@@ -225,6 +225,35 @@ public class Barcode extends BasePo implements Serializable { ...@@ -225,6 +225,35 @@ public class Barcode extends BasePo implements Serializable {
* 呆滞到期时间(入库时间+呆滞日期) * 呆滞到期时间(入库时间+呆滞日期)
*/ */
private Date sluggishTime; private Date sluggishTime;
/**
* 自定义的附加信息
*/
private Map<String,Object> appendData = new HashMap<>();
/**
* 添加或更新自定义附加信息
* @param appendKey
* @param appendValue
*/
public void updateAppendData(String appendKey, Object appendValue){
appendData.put(appendKey, appendValue);
}
/**
* 获取自定义附加信息
* @param appendKey
* @param <T>
* @return
*/
public <T> T getAppendData(String appendKey){
Object value = appendData.get(appendKey);
if(value != null){
return (T)value;
}
return null;
}
/** /**
* 添加相关联条码 * 添加相关联条码
* *
......
package com.neotel.smfcore.custom.micron20031.bean;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
/**
* @author sunke
* @date 2023/1/3 3:28 PM
*/
@Data
public class DepositMatReqBean{
/**
* {
* * "MatReqNo": "0730000956",
* * "MaterialType": "SOLDER_PASTE"
* * }
* * //Input: MatReqNo, MaterialType
* * //Output: MatReqNo, Micron Part Number, Lot No, Quantity, UnitOfMeasures, MaterialType, Message, Status
*/
@JsonProperty("MicronPN")
private String micronPN;
@JsonProperty("LotNo")
private String lotNo;
@JsonProperty("Quantity")
private Integer quantity;
@JsonProperty("UnitOfMeasures")
private String unitOfMeasures;
@JsonProperty("MaterialType")
private String materialType;
@JsonProperty("MatReqNo")
private String matReqNo;
@JsonProperty("Message")
private String message;
@JsonProperty("Status")
private String status;
}
...@@ -8,7 +8,7 @@ import lombok.Data; ...@@ -8,7 +8,7 @@ import lombok.Data;
* @date 2022/12/21 9:33 AM * @date 2022/12/21 9:33 AM
*/ */
@Data @Data
public class MatOrderBean { public class MatOrderBean{
@JsonProperty("MicronPN") @JsonProperty("MicronPN")
private String micronPN; private String micronPN;
...@@ -19,4 +19,13 @@ public class MatOrderBean { ...@@ -19,4 +19,13 @@ public class MatOrderBean {
@JsonProperty("MaterialType") @JsonProperty("MaterialType")
private String materialType; private String materialType;
private Integer stockRoomQty;
@JsonProperty("MatReqNo")
private String matReqNo;
@JsonProperty("Message")
private String message;
@JsonProperty("Status")
private String status;
} }
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!