|
|
|
|
@ -7,10 +7,8 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
import com.zhehekeji.core.util.Assert;
|
|
|
|
|
import com.zhehekeji.web.entity.Stock;
|
|
|
|
|
import com.zhehekeji.web.entity.CheckLog;
|
|
|
|
|
import com.zhehekeji.web.entity.StockLog;
|
|
|
|
|
import com.zhehekeji.web.entity.Street;
|
|
|
|
|
import com.zhehekeji.web.config.ConfigProperties;
|
|
|
|
|
import com.zhehekeji.web.entity.*;
|
|
|
|
|
import com.zhehekeji.web.mapper.CheckLogMapper;
|
|
|
|
|
import com.zhehekeji.web.mapper.StockLogMapper;
|
|
|
|
|
import com.zhehekeji.web.mapper.StockMapper;
|
|
|
|
|
@ -20,9 +18,14 @@ import com.zhehekeji.web.pojo.stock.*;
|
|
|
|
|
import io.swagger.models.auth.In;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
import org.springframework.web.client.ResourceAccessException;
|
|
|
|
|
import org.springframework.web.client.RestClientException;
|
|
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
@ -45,6 +48,9 @@ public class StockService {
|
|
|
|
|
@Resource
|
|
|
|
|
private StreetMapper streetMapper;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
ConfigProperties configProperties;
|
|
|
|
|
|
|
|
|
|
public void importExcel(MultipartFile file) {
|
|
|
|
|
log.info("import excel stock");
|
|
|
|
|
// try {
|
|
|
|
|
@ -74,6 +80,7 @@ public class StockService {
|
|
|
|
|
List<Stock> stocks = stockMapper.selectList(new QueryWrapper<Stock>().eq("street_id", streetId).orderByAsc("`direction`", "`side`", "`row`", "`column`"));
|
|
|
|
|
return stocks;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<Stock> list() {
|
|
|
|
|
|
|
|
|
|
//List<String> shelves = streetService.check(street);
|
|
|
|
|
@ -112,11 +119,15 @@ public class StockService {
|
|
|
|
|
columnTabStatus.put(column, 0);
|
|
|
|
|
}
|
|
|
|
|
//获取全部盘点内容
|
|
|
|
|
List<Stock> stocks = stockMapper.selectList(new QueryWrapper<Stock>().select("status", "`row`", "`column`")
|
|
|
|
|
List<Stock> stocks = stockMapper.selectList(new QueryWrapper<Stock>()
|
|
|
|
|
.select("status", "`row`", "`column`", "export_Time")
|
|
|
|
|
.eq("`street_id`", rowColumnStatus.getStreetId())
|
|
|
|
|
.eq("direction", rowColumnStatus.getDirection())
|
|
|
|
|
.eq("side", rowColumnStatus.getSide()));
|
|
|
|
|
.eq("side", rowColumnStatus.getSide())
|
|
|
|
|
.orderByDesc("export_Time"));
|
|
|
|
|
Set<String> seen = new HashSet<>();
|
|
|
|
|
Map<Integer, Map<Integer, Stock>> stocksMap = stocks.stream()
|
|
|
|
|
.filter(f -> seen.add(f.getRow() + "-" + f.getColumn()))
|
|
|
|
|
//修改盘点范围值
|
|
|
|
|
.peek(stock -> {
|
|
|
|
|
|
|
|
|
|
@ -174,6 +185,7 @@ public class StockService {
|
|
|
|
|
checkStatus.setStocks(stockList);
|
|
|
|
|
return checkStatus;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public CheckStatus statusByRowColumn(RowColumnStatus rowColumnStatus) {
|
|
|
|
|
CheckStatus checkStatus = new CheckStatus();
|
|
|
|
|
checkStatus.setColumnStart(rowColumnStatus.getColumnStart());
|
|
|
|
|
@ -473,12 +485,44 @@ public class StockService {
|
|
|
|
|
} else {
|
|
|
|
|
stock.setStatus(StockStatus.ERROR.getStatus());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (stock.getReply() == 1) {
|
|
|
|
|
uploadResultsWMS(stock, stockCheck.getOk());
|
|
|
|
|
}
|
|
|
|
|
stockMapper.updateById(stock);
|
|
|
|
|
checkLog(stock);
|
|
|
|
|
return stock;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void uploadResultsWMS(Stock stock, Integer stockStatus) {
|
|
|
|
|
|
|
|
|
|
ResponseEntity<String> body = null;
|
|
|
|
|
RestTemplate restTemplate = new RestTemplate();
|
|
|
|
|
String url = configProperties.getUploadResultsApiUrl();
|
|
|
|
|
|
|
|
|
|
UploadCheckResults uploadCheckResults = new UploadCheckResults();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//String url = "http://127.0.0.1:8083"+"/visionCompute";
|
|
|
|
|
|
|
|
|
|
uploadCheckResults.setWcsTaskId(stock.getCheckNum().split("_")[1]);
|
|
|
|
|
uploadCheckResults.setWmsTaskId(stock.getTaskWMSId());
|
|
|
|
|
uploadCheckResults.setPalno(stock.getWmsCode());
|
|
|
|
|
uploadCheckResults.setFlag(stockStatus == 1 ? 1 : 0);
|
|
|
|
|
uploadCheckResults.setAddre(stock.getAddre());
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
// String jsonString = gson.toJson(algorithmPojo);
|
|
|
|
|
body = restTemplate.postForEntity(url, uploadCheckResults, String.class);
|
|
|
|
|
JSONObject.parseObject(body.getBody(), UploadCheckResults.class);
|
|
|
|
|
|
|
|
|
|
System.out.println(body);
|
|
|
|
|
} catch (RestClientException e) {
|
|
|
|
|
log.error("上传结果失败", e);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private CheckLogMapper checkLogMapper;
|
|
|
|
|
|
|
|
|
|
|