Commit db0c64b4 zshaohui

还原

1 个父辈 8802f0e5
......@@ -8,14 +8,11 @@ import com.neotel.smfcore.common.exception.ApiException;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.HttpHelper;
import com.neotel.smfcore.common.utils.JsonUtil;
import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.api.listener.BaseSmfApiListener;
import com.neotel.smfcore.core.api.listener.DefaultSmfApiListener;
import com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.device.enums.OP;
import com.neotel.smfcore.core.device.enums.OP_STATUS;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.order.LiteOrderCache;
import com.neotel.smfcore.core.order.service.po.LiteOrder;
......@@ -23,7 +20,6 @@ import com.neotel.smfcore.core.storage.enums.DeviceType;
import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager;
import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.core.system.service.manager.IDataLogManager;
import com.neotel.smfcore.core.system.service.po.DataLog;
import com.neotel.smfcore.custom.lizhen.agvBox.bean.GrLabel;
import com.neotel.smfcore.custom.lizhen.innerBox.bean.PreWarningItem;
......@@ -31,14 +27,10 @@ import com.neotel.smfcore.custom.lizhen.innerBox.util.PreWarningItemCache;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import javax.swing.*;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
......@@ -54,9 +46,6 @@ public class LizhenApi extends DefaultSmfApiListener {
private IStoragePosManager storagePosManager;
@Autowired
private IDataLogManager dataLogManager;
@Autowired
private DataCache dataCache;
@Value("${api.fetchGRUrl}")
......@@ -82,18 +71,16 @@ public class LizhenApi extends DefaultSmfApiListener {
@Value("${api.checkReelMeasure}")
private String checkReelMeasureUrl = "";
@Value("${api.CommonGIRecord}")
private String CommonGIRecordUrl;
@PostConstruct
public void init() {
fetchGRUrl = dataCache.getConfigCache("fetchGRUrl", fetchGRUrl);
brandQtyUrl = dataCache.getConfigCache("brandQtyUrl", brandQtyUrl);
plant = dataCache.getConfigCache("plant", plant);
barcodeInfoUrl = dataCache.getConfigCache("barcodeInfoUrl", barcodeInfoUrl);
werks = dataCache.getConfigCache("werks", werks);
outNotifyUrlPK = dataCache.getConfigCache("api.outNotifyUrlPK", outNotifyUrlPK);
batchCheckUrl = dataCache.getConfigCache("api.batchCheckUrl", batchCheckUrl);
public void init(){
fetchGRUrl = dataCache.getConfigCache("fetchGRUrl",fetchGRUrl);
brandQtyUrl = dataCache.getConfigCache("brandQtyUrl",brandQtyUrl);
plant = dataCache.getConfigCache("plant",plant);
barcodeInfoUrl = dataCache.getConfigCache("barcodeInfoUrl",barcodeInfoUrl);
werks = dataCache.getConfigCache("werks",werks);
outNotifyUrlPK = dataCache.getConfigCache("api.outNotifyUrlPK",outNotifyUrlPK);
batchCheckUrl = dataCache.getConfigCache("api.batchCheckUrl",batchCheckUrl);
//checkReelMeasureUrl = dataCache.getConfigCache("api.checkReelMeasure",checkReelMeasureUrl);
}
......@@ -104,10 +91,10 @@ public class LizhenApi extends DefaultSmfApiListener {
* @param brand
* @return
*/
public Map<String, Object> brandQty(String partnumber, String brand) {
public Map<String,Object> brandQty(String partnumber, String brand) {
log.info("brandQty--material_code:" + partnumber + ",brand:" + brand);
Map<String, Object> resultMap = new HashMap<>();
if (StringUtils.isBlank(brandQtyUrl)) {
if (StringUtils.isBlank(brandQtyUrl)){
resultMap.put("qty", 0);
resultMap.put("reelSize", 0);
return resultMap;
......@@ -166,8 +153,8 @@ public class LizhenApi extends DefaultSmfApiListener {
JSONObject dataObject = dataArrray.getJSONObject(0);
String brand = dataObject.getString("brand");
resultMap.put("brand", brand);
resultMap.put("keeperCode", dataObject.getString("keeper_code"));
resultMap.put("warehouseCode", dataObject.getString("warehouse_code"));
resultMap.put("keeperCode",dataObject.getString("keeper_code"));
resultMap.put("warehouseCode",dataObject.getString("warehouse_code"));
}
}
} catch (ApiException e) {
......@@ -290,11 +277,11 @@ public class LizhenApi extends DefaultSmfApiListener {
//保存禁用料记录
Barcode barcodeOri = barcodeManager.findByBarcode(barcode.getBarcode());
if (barcodeOri != null) {
if (barcodeOri != null){
barcodeOri.setDisableMsg(resultStr);
barcode = barcodeManager.save(barcodeOri);
StoragePos storagePos = storagePosManager.getByBarcode(barcode.getBarcode());
if (storagePos != null) {
if (storagePos != null){
storagePos.setBarcode(barcode);
storagePosManager.save(storagePos);
}
......@@ -315,17 +302,15 @@ public class LizhenApi extends DefaultSmfApiListener {
*/
@Override
public void inTaskStatusChange(String inNotifyUrl, DataLog task) {
if (!task.isFinished()) {
if (!task.isFinished()){
return;
}
DataLog oldTask = dataLogManager.findOne(new Query(Criteria.where("barcode").is(task.getBarcode()).is(OP.CHECKOUT).and("createDate")
.and("status").is(OP_STATUS.FINISHED.name()).lte(new Date())).with(Sort.by(Sort.Direction.DESC, "createDate")));
if (oldTask == null) {
Map<String, Object> dataMap = new HashMap<>();
dataMap.put("pickingid", "");
dataMap.put("wo", "");
dataMap.put("reelno", task.getBarcode());
dataMap.put("ipn", task.getPartNumber());
Barcode barcode = barcodeManager.findByBarcode(task.getBarcode());
if (barcode != null) {
dataMap.put("qty", barcode.getAmount());
......@@ -333,10 +318,10 @@ public class LizhenApi extends DefaultSmfApiListener {
dataMap.put("lot", barcode.getBatch());
dataMap.put("vendor", barcode.getProvider());
dataMap.put("batch", "");
dataMap.put("vendorcode", barcode.getProviderNumber());
dataMap.put("vendorcode",barcode.getProviderNumber());
}
dataMap.put("werks", werks);
dataMap.put("reelid", "");
dataMap.put("werks",werks);
dataMap.put("reelid","");
String param = JsonUtil.toJsonStr(Arrays.asList(dataMap));
log.info("保存物料入参为:" + param);
try {
......@@ -344,32 +329,7 @@ public class LizhenApi extends DefaultSmfApiListener {
log.info("保存物料出参为:" + result);
} catch (ApiException e) {
e.printStackTrace();
log.info(barcode.getBarcode() + "保存物料异常:" + e.getMessage());
}
} else {
Map<String, Object> dataMap = new HashMap<>();
dataMap.put("line", oldTask.getLine());
dataMap.put("reel_id", oldTask.getBarcode());
dataMap.put("rm_type", 2);
Storage storage = dataCache.getStorageById(oldTask.getStorageId());
if (storage.isVirtual()) {
dataMap.put("rm_type", 1);
}
dataMap.put("create_empno", SecurityUtils.getLoginUsername());
Date date = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
format.setTimeZone(TimeZone.getTimeZone("UTC")); // 设置为UTC时间
String nowDateStr = format.format(date);
dataMap.put("create_time", nowDateStr);
String param = JsonUtil.toJsonStr(Arrays.asList(dataMap));
log.info("退料:" + param);
try {
String result = HttpHelper.postJson(CommonGIRecordUrl, Arrays.asList(dataMap));
log.info("退料出参为:" + result);
} catch (ApiException e) {
e.printStackTrace();
log.info(oldTask.getBarcode() + "退料异常:" + e.getMessage());
}
log.info(barcode.getBarcode()+"保存物料异常:"+e.getMessage());
}
}
......@@ -390,7 +350,7 @@ public class LizhenApi extends DefaultSmfApiListener {
if (!task.isFinished()) {
return;
}
if (task.isBoxOut()) {
if (task.isBoxOut()){
return;
}
Map<String, Object> dataMap = new HashMap<>();
......@@ -398,7 +358,7 @@ public class LizhenApi extends DefaultSmfApiListener {
if (StringUtils.isNotBlank(task.getSourceName()) && StringUtils.isNotBlank(task.getLine()) && !task.isManualUpload()) {
dataMap.put("pickingid", task.getSourceName());
outNotifyUrl = outNotifyUrlPK;
log.info("出库pk不为空:" + outNotifyUrl);
log.info("出库pk不为空:"+outNotifyUrl);
}
dataMap.put("wo", "");
dataMap.put("reelno", task.getBarcode());
......@@ -415,7 +375,7 @@ public class LizhenApi extends DefaultSmfApiListener {
List<Map<String, Object>> paramList = new ArrayList();
paramList.add(dataMap);
JSONObject jsonObject = new JSONObject();
jsonObject.put("data", paramList);
jsonObject.put("data",paramList);
String param = JsonUtil.toJsonStr(jsonObject);
log.info("保存物料入参为:" + param + "地址为:" + outNotifyUrl);
try {
......@@ -506,7 +466,7 @@ public class LizhenApi extends DefaultSmfApiListener {
return StringUtils.isBlank(pickingid);
}).collect(Collectors.toList());
if (noPickingidList != null && !noPickingidList.isEmpty()) {
if (noPickingidList != null && !noPickingidList.isEmpty()){
String param = JsonUtil.toJsonStr(paramList);
log.info("保存物料入参为:" + param + "地址为:" + outNotifyUrl);
try {
......@@ -557,7 +517,7 @@ public class LizhenApi extends DefaultSmfApiListener {
}
}
if (items != null && !items.isEmpty()) {
return PreWarningItemCache.createAndExecuteLiteOrder(items, false);
return PreWarningItemCache.createAndExecuteLiteOrder(items,false);
}
}
return null;
......@@ -584,7 +544,7 @@ public class LizhenApi extends DefaultSmfApiListener {
paramList.add(paramMap);
}
String paramStr = JSON.toJSONString(paramList);
log.info("批量禁用料,入参为:" + paramStr + ",地址为:" + batchCheckUrl);
log.info("批量禁用料,入参为:" + paramStr+",地址为:"+batchCheckUrl);
try {
String result = HttpHelper.postJson(batchCheckUrl, paramList);
log.info("批量禁用料,出参为:" + result);
......@@ -619,7 +579,7 @@ public class LizhenApi extends DefaultSmfApiListener {
paramMap.put("reelID", barcode.getBarcode());
paramMap.put("ipn", barcode.getPartNumber());
try {
log.info(barcode.getBarcode() + "散料量测接口入参为-----" + JSON.toJSONString(paramMap) + ",接口地址为:" + checkReelMeasureUrl);
log.info(barcode.getBarcode() + "散料量测接口入参为-----" + JSON.toJSONString(paramMap)+",接口地址为:"+checkReelMeasureUrl);
String result = HttpHelper.postJson(checkReelMeasureUrl, paramMap);
log.info(barcode.getBarcode() + "散料量测接口出参为-----" + result);
JSONObject jsonObject = JSON.parseObject(result);
......
......@@ -14,7 +14,6 @@ api:
brandQtyUrl: #http://172.30.170.199:8082/api/wcs/brandQty #gr标签满卷数
importUrl: #http://10.42.222.52:8001/smf-core/ext/forward/getDataLogs #内仓导入外仓picking虚拟仓数据
checkReelMeasure: #http://10.190.25.124:8001/Sct/CheckReelMeasure #散料量测接口
CommonGIRecord: http://localhost:4000/Sct/CommonRMRecord
plant: #2810
werks: #2810
outerFactory:
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!