| | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | return CommonResponse.ok(); |
| | | } |
| | | |
| | | @ApiOperation("库存查询明细(表单提交)") |
| | | @PostMapping(value = "/inventory/details", consumes = "application/x-www-form-urlencoded") |
| | | public CommonResponse queryInventoryDetailsForm(HttpServletRequest request) { |
| | | // 从表单参数构建查询条件 |
| | | InventoryQueryCondition condition = buildConditionFromRequestParams(request); |
| | | // 调用JSON处理方法 |
| | | return queryInventoryDetails(condition); |
| | | } |
| | | |
| | | @ApiOperation("库存查询明细") |
| | | @PostMapping("/inventory/details") |
| | | public CommonResponse queryInventoryDetails(@RequestBody InventoryQueryCondition condition) { |
| | | @PostMapping(value = "/inventory/details", consumes = "application/json") |
| | | public CommonResponse queryInventoryDetails(@RequestBody(required = false) InventoryQueryCondition condition) { |
| | | // JSON方式:支持不传递参数({}或null或空请求体),创建默认的空查询条件对象 |
| | | if (condition == null) { |
| | | condition = new InventoryQueryCondition(); |
| | | } |
| | | |
| | | if (SIMULATED_DATA_ENABLE.equals("1")) { |
| | | String x = "[\n" + |
| | | " {\n" + |
| | |
| | | if (wmsServerFeignClient == null) { |
| | | log.warn("WmsServerFeignClient未注入,无法进行调用"); |
| | | return CommonResponse.error("服务未初始化"); |
| | | } |
| | | |
| | | // 参数验证 |
| | | if (condition == null) { |
| | | return CommonResponse.error("查询条件不能为空"); |
| | | } |
| | | |
| | | log.info("库存查询明细请求参数: {}", JSON.toJSONString(condition)); |
| | |
| | | } |
| | | // endregion |
| | | |
| | | |
| | | /** |
| | | * 从请求参数(表单数据)构建查询条件对象 |
| | | * 支持 application/x-www-form-urlencoded 格式 |
| | | */ |
| | | private InventoryQueryCondition buildConditionFromRequestParams(HttpServletRequest request) { |
| | | InventoryQueryCondition condition = new InventoryQueryCondition(); |
| | | |
| | | // 从请求参数中获取字段值 |
| | | String wareHouseId = request.getParameter("wareHouseId"); |
| | | String locId = request.getParameter("locId"); |
| | | String matNr = request.getParameter("matNr"); |
| | | String matGroup = request.getParameter("matGroup"); |
| | | String orderNo = request.getParameter("orderNo"); |
| | | String planNo = request.getParameter("planNo"); |
| | | String batch = request.getParameter("batch"); |
| | | |
| | | // 设置字段值(如果存在) |
| | | if (wareHouseId != null && !wareHouseId.isEmpty()) { |
| | | condition.setWareHouseId(wareHouseId); |
| | | } |
| | | if (locId != null && !locId.isEmpty()) { |
| | | condition.setLocId(locId); |
| | | } |
| | | if (matNr != null && !matNr.isEmpty()) { |
| | | condition.setMatNr(matNr); |
| | | } |
| | | if (matGroup != null && !matGroup.isEmpty()) { |
| | | condition.setMatGroup(matGroup); |
| | | } |
| | | if (orderNo != null && !orderNo.isEmpty()) { |
| | | condition.setOrderNo(orderNo); |
| | | } |
| | | if (planNo != null && !planNo.isEmpty()) { |
| | | condition.setPlanNo(planNo); |
| | | } |
| | | if (batch != null && !batch.isEmpty()) { |
| | | condition.setBatch(batch); |
| | | } |
| | | |
| | | return condition; |
| | | } |
| | | |
| | | } |