feat(库位信息): 添加根据库位信息查找库存
This commit is contained in:
parent
5f346e6f85
commit
88030f5ae6
|
|
@ -5,6 +5,7 @@ import com.github.pagehelper.PageHelper;
|
|||
import com.github.pagehelper.PageInfo;
|
||||
import com.wms.constants.enums.ResponseCode;
|
||||
import com.wms.entity.app.ResponseEntity;
|
||||
import com.wms.entity.dto.stock.StockQueryReuqest;
|
||||
import com.wms.entity.page.PageDomain;
|
||||
import com.wms.entity.page.TableRequest;
|
||||
import com.wms.entity.page.TableResponse;
|
||||
|
|
@ -21,9 +22,11 @@ import org.springframework.transaction.annotation.Isolation;
|
|||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -85,6 +88,38 @@ public class StockController extends BaseController {
|
|||
return JSON.toJSONString(tblResp);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据库位号查询库存
|
||||
*/
|
||||
@PostMapping("/getStockByLocation")
|
||||
@ResponseBody
|
||||
public String getStocksByLocation( @RequestBody StockQueryReuqest stockQueryReuqest){
|
||||
logger.info("请求的ip地址:{}", HttpUtils.getIpAddr(servletRequest));
|
||||
logger.info("接收到根据位置id查询库存请求:{}", JSON.toJSONString(stockQueryReuqest.getLocationId()));
|
||||
// 创建响应信息
|
||||
ResponseEntity rsp = new ResponseEntity();
|
||||
if (StringUtils.isEmpty(stockQueryReuqest.getLocationId())) {
|
||||
logger.error("查询的库位编号为空");
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("查询的库位编号为空");
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
Stock stock = new Stock();
|
||||
stock.setLocationId(stockQueryReuqest.getLocationId());
|
||||
List<Stock> queryStocks = stockService.selStocks(stock);
|
||||
if(CollectionUtils.isEmpty(queryStocks)) {
|
||||
logger.info("位置信息{},库存为空",stockQueryReuqest.getLocationId());
|
||||
rsp.setCode(ResponseCode.ERROR.getCode());
|
||||
rsp.setMessage("位置信息库存为空");
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
rsp.setCode(ResponseCode.OK.getCode());
|
||||
rsp.setMessage("查询库存成功!");
|
||||
rsp.setReturnData(queryStocks.get(0));
|
||||
return JSON.toJSONString(rsp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找所有库存---按物料汇总
|
||||
*/
|
||||
|
|
@ -184,7 +219,6 @@ public class StockController extends BaseController {
|
|||
Stock tempStock = new Stock();
|
||||
tempStock.setStockId(WmsUtils.generateId("ST"));
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
// 回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
package com.wms.entity.dto.stock;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Classname StockQueryReuqest
|
||||
* @Date 2025-02-23 0:00
|
||||
* @Created by luyifan
|
||||
*/
|
||||
@Data
|
||||
public class StockQueryReuqest implements Serializable {
|
||||
private String locationId;
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
@ -33,7 +33,7 @@ public class Task extends BaseEntity {
|
|||
|
||||
|
||||
/**
|
||||
* 任务类型
|
||||
* 任务类型 (1:入库;2:出库;9:移库)
|
||||
*/
|
||||
@ExcelExport("任务类型")
|
||||
private Integer taskType;
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@
|
|||
<where>
|
||||
<if test="query != null and query != ''"> vehicle_id = #{query} or goods_id like concat('%', #{query}, '%') or goods_name like concat('%', #{query}, '%') or batch_no = #{query}</if>
|
||||
</where>
|
||||
order by create_time
|
||||
</select>
|
||||
|
||||
<select id="selStocksByGoodsId" parameterType="Stock" resultMap="StockMap">
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@
|
|||
<if test="kateTaskId != null and kateTaskId != ''"> and kate_task_id = #{kateTaskId}</if>
|
||||
<if test="remark1 != null and remark1 != ''"> and remark1 = #{remark1}</if>
|
||||
</where>
|
||||
order by task_priority desc, task_status desc, create_time desc
|
||||
order by create_time desc, task_priority desc, task_status desc
|
||||
</select>
|
||||
|
||||
<select id="selTasksByTaskId" parameterType="Task" resultMap="TaskMap">
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user