Compare commits

..

4 Commits

Author SHA1 Message Date
曹鹏飞 174617214f Merge branch 'develop' into qms/develop 2026-05-13 17:59:25 +08:00
曹鹏飞 03f2f88ad8 feat(material): 支持批量保存时上传Base64格式图片
- 在批量保存物料时,判断并处理Base64格式的图片数据
- 实现Base64图片的上传功能并设置物料图片字段
- 保证图片上传与物料信息同步保存
2026-05-13 17:58:51 +08:00
曹鹏飞 af1a0f53aa fix(controller): 修正库存筛选及设置库位位置
- 修正库存筛选条件中物料编号匹配的错误,改用二维码主表的物料编码进行匹配
- 添加设置库存DTO中的库位字段,确保库位信息正确传递
- 优化库存数据处理逻辑,提升准确性和规范性
2026-05-13 16:55:28 +08:00
曹鹏飞 cf746ceb00 fix(service): 修正物料分类接口和添加统一HTTP异常处理
- 修改物料分类API请求路径,去除多余/api前缀
- 在全局异常处理类中新增对HttpClientErrorException的捕获处理
- 记录HTTP请求错误的详细日志,返回统一错误状态和信息
- 在状态常量中新增HTTP错误状态码和描述
2026-05-13 08:51:57 +08:00
5 changed files with 17 additions and 4 deletions

View File

@ -474,7 +474,7 @@ public class NormalPGIController extends BaseController {
.forEach(qrCodeMaster -> {
// 库存
InventoryInDTO inventoryDTO = inventories.stream()
.filter(inventoriesDTO -> inventoriesDTO.getMaterialNo().equals(item.getItemCode())
.filter(inventoriesDTO -> inventoriesDTO.getMaterialNo().equals(qrCodeMaster.getMaterialCode())
&& inventoriesDTO.getBatchNo().equals(qrCodeMaster.getBatchNo())
&& inventoriesDTO.getSerialNo().equals(qrCodeMaster.getSerialNo())
&& inventoriesDTO.getFactoryNo().equals(qrCodeMaster.getFactoryCode())
@ -489,6 +489,7 @@ public class NormalPGIController extends BaseController {
.setWarehouseNo(qrCodeMaster.getStorageLocation())
.setBatchNo(qrCodeMaster.getBatchNo())
.setSerialNo(qrCodeMaster.getSerialNo())
.setBinLocation(qrCodeMaster.getBinLocation())
.setNum(qrCodeMaster.getQuantity());
inventories.add(inventoryDTO);
} else {

View File

@ -27,7 +27,8 @@ public enum STATE {
InconsistentDataError(117, "需要用户确认"),
NoOrderData(118, "订单不存在"),
SAPErr(119, "SAP错误"),
OutOfStock(120, "库存不足");
OutOfStock(120, "库存不足"),
HttpError(121, "HTTP错误");
@Getter
private final Integer state;

View File

@ -194,6 +194,9 @@ public class MaterialController extends BaseController {
if (CollectionUtil.isNotEmpty(datas)) {
shipmentMaterialService.saveBatch(datas.stream().map(data -> {
WmsShipmentMaterial material = Convert.convert(WmsShipmentMaterial.class, data);
if (StrUtil.isNotBlank(data.getImageBase64())) {
material.setImage(uploadBase64(data.getImageBase64()));
}
material.setCreateBy("同步");
material.setCreateTime(LocalDateTime.now());
return material;

View File

@ -20,6 +20,7 @@ import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.servlet.resource.NoResourceFoundException;
import java.util.ArrayList;
@ -88,10 +89,17 @@ public class GlobalRestControllerAdvice {
@ExceptionHandler(DataAlertException.class)
public ApiResult<Void> handleDataAlertException(DataAlertException ex) {
printLog("返回数据错误", ex);
printLog("返回数据错误", ex);
return ApiResult.errorWithExtras(ex.getState(), ex.getObj());
}
@ExceptionHandler(HttpClientErrorException.class)
public ApiResult<Void> handleHttpClientErrorException(HttpClientErrorException ex) {
Throwable rootCause = ex.getRootCause() != null ? ex.getRootCause() : ex;
printLog("HTTP请求错误", rootCause);
return ApiResult.error(STATE.HttpError, rootCause.getMessage());
}
private void printLog(String msg, Throwable ex) {
log.error("{}:{},{}", msg, ex.getMessage(), ExceptionUtil.stacktraceToString(ex));
}

View File

@ -71,7 +71,7 @@ public class BomMaterialService {
headers.add("authorization", getToken());
HttpEntity<MaterialCategoryQO> requestEntity = new HttpEntity<>(qo, headers);
ResponseEntity<BomResultDTO<List<MaterialCategoryVO>>> response = restTemplate.exchange(
baseUrl + "/api/material/category/getAlllist",
baseUrl + "/material/category/getAlllist",
HttpMethod.POST,
requestEntity,
new ParameterizedTypeReference<>() {