Commit db0c64b4 zshaohui

还原

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