no message

main
HUOJIN\92525 2026-03-05 11:55:16 +08:00
parent 0b81b55e59
commit c579cab7dd
4 changed files with 278 additions and 242 deletions

View File

@ -12,9 +12,12 @@ import java.net.URLDecoder;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.cpte.modules.base.entity.Area;
import org.cpte.modules.base.service.IAreaService;
import org.cpte.modules.constant.enums.AreaTypeEnum;
import org.cpte.modules.constant.enums.CommonStatusEnum;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.cpte.modules.base.entity.Point;
@ -26,6 +29,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.system.base.controller.JeecgController;
import org.json.simple.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -195,4 +199,21 @@ public class PointController extends JeecgController<Point, IPointService> {
return super.importExcel(request, response, Point.class);
}
@Operation(summary = "查询出库工作站")
@GetMapping(value = "/queryOutWorkStation")
public Result<List<String>> queryOutWorkStation(@RequestParam(name = "areaId_dictText", required = true) String areaId_dictText) {
String areaCode="";
if(AreaTypeEnum.CPCCQ.getDesc().equals(areaId_dictText)){
areaCode=AreaTypeEnum.CK_DOCK.getValue();
}else{
areaCode=AreaTypeEnum.MJCK_DOCK.getValue();
}
List<Point> points = pointService.queryPoints(null, CommonStatusEnum.FREE.getValue(), areaCode);
if (CollectionUtils.isEmpty(points)) {
return Result.error("未找到对应数据");
}
List<String> pointCodes = points.stream().map(Point::getPointCode).collect(Collectors.toList());
return Result.OK(pointCodes);
}
}

View File

@ -53,13 +53,13 @@ import org.jeecg.common.aspect.annotation.AutoLog;
import org.apache.shiro.authz.annotation.RequiresPermissions;
/**
/**
* @Description:
* @author: cpte
* @Date: 2025-12-23
* @Version: V1.0
*/
@Tag(name="盘点")
@Tag(name = "盘点")
@RestController
@RequestMapping("/count/countPlan")
@Slf4j
@ -85,11 +85,11 @@ public class CountPlanController {
* @return
*/
//@AutoLog(value = "盘点-分页列表查询")
@Operation(summary="盘点-分页列表查询")
@Operation(summary = "盘点-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<CountPlan>> queryPageList(CountPlan countPlan,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<CountPlan> queryWrapper = QueryGenerator.initQueryWrapper(countPlan, req.getParameterMap());
Page<CountPlan> page = new Page<CountPlan>(pageNo, pageSize);
@ -104,7 +104,7 @@ public class CountPlanController {
* @return
*/
@AutoLog(value = "盘点-添加")
@Operation(summary="盘点-添加")
@Operation(summary = "盘点-添加")
@RequiresPermissions("count:data_count_plan:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody CountPlanPage countPlanPage) {
@ -121,12 +121,12 @@ public class CountPlanController {
* @return
*/
@AutoLog(value = "盘点-编辑")
@Operation(summary="盘点-编辑")
@Operation(summary = "盘点-编辑")
@RequiresPermissions("count:data_count_plan:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody CountPlanPage countPlanPage) {
CountPlan existingCountPlan = countPlanService.getById(countPlanPage.getId());
if(existingCountPlan==null) {
if (existingCountPlan == null) {
return Result.error("未找到对应数据");
}
BeanUtils.copyProperties(countPlanPage, existingCountPlan);
@ -141,10 +141,10 @@ public class CountPlanController {
* @return
*/
@AutoLog(value = "盘点-通过id删除")
@Operation(summary="盘点-通过id删除")
@Operation(summary = "盘点-通过id删除")
@RequiresPermissions("count:data_count_plan:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name="id",required=true) Long id) {
public Result<String> delete(@RequestParam(name = "id", required = true) Long id) {
countPlanService.delMain(id);
return Result.OK("删除成功!");
}
@ -156,10 +156,10 @@ public class CountPlanController {
* @return
*/
@AutoLog(value = "盘点-批量删除")
@Operation(summary="盘点-批量删除")
@Operation(summary = "盘点-批量删除")
@RequiresPermissions("count:data_count_plan:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
this.countPlanService.delBatchMain(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
@ -171,11 +171,11 @@ public class CountPlanController {
* @return
*/
//@AutoLog(value = "盘点-通过id查询")
@Operation(summary="盘点-通过id查询")
@Operation(summary = "盘点-通过id查询")
@GetMapping(value = "/queryById")
public Result<CountPlan> queryById(@RequestParam(name="id",required=true) Long id) {
public Result<CountPlan> queryById(@RequestParam(name = "id", required = true) Long id) {
CountPlan countPlan = countPlanService.getById(id);
if(countPlan==null) {
if (countPlan == null) {
return Result.error("未找到对应数据");
}
return Result.OK(countPlan);
@ -189,34 +189,34 @@ public class CountPlanController {
* @return
*/
//@AutoLog(value = "盘点明细通过主表ID查询")
@Operation(summary="盘点明细主表ID查询")
@Operation(summary = "盘点明细主表ID查询")
@GetMapping(value = "/queryCountDetailByMainId")
public Result<List<CountDetail>> queryCountDetailListByMainId(@RequestParam(name="id",required=true) Long id) {
public Result<List<CountDetail>> queryCountDetailListByMainId(@RequestParam(name = "id", required = true) Long id) {
List<CountDetail> countDetailList = countDetailService.selectByMainId(id);
if(CollectionUtils.isNotEmpty(countDetailList)){
if (CollectionUtils.isNotEmpty(countDetailList)) {
//物料
List<Long> itemIds=countDetailList.stream().map(CountDetail::getItemId).distinct().toList();
Map<Long,Item> itemMap=itemService.queryByItemIdsToMap(itemIds);
List<Long> itemIds = countDetailList.stream().map(CountDetail::getItemId).distinct().toList();
Map<Long, Item> itemMap = itemService.queryByItemIdsToMap(itemIds);
//库位
List<Long> pointIds=countDetailList.stream().map(CountDetail::getPointId).distinct().toList();
Map<Long, Point> pointMap=pointService.queryByPointIdsToMap(pointIds);
List<Long> pointIds = countDetailList.stream().map(CountDetail::getPointId).distinct().toList();
Map<Long, Point> pointMap = pointService.queryByPointIdsToMap(pointIds);
//容器
List<Long> stockIds=countDetailList.stream().map(CountDetail::getStockId).distinct().toList();
Map<Long, Stock> stockMap=stockService.queryByStockIdsToMap(stockIds);
List<Long> stockIds = countDetailList.stream().map(CountDetail::getStockId).distinct().toList();
Map<Long, Stock> stockMap = stockService.queryByStockIdsToMap(stockIds);
for(CountDetail detail:countDetailList){
for (CountDetail detail : countDetailList) {
Item item = itemMap.get(detail.getItemId());
Point point = pointMap.get(detail.getPointId());
Stock stock = stockMap.get(detail.getStockId());
if(item!=null){
if (item != null) {
detail.setItemCode(item.getItemCode());
}
if(point!=null){
if (point != null) {
detail.setPointCode(point.getPointCode());
}
if(stock!=null){
if (stock != null) {
detail.setStockCode(stock.getStockCode());
}
}
@ -241,9 +241,9 @@ public class CountPlanController {
//配置选中数据查询条件
String selections = request.getParameter("selections");
if(oConvertUtils.isNotEmpty(selections)) {
if (oConvertUtils.isNotEmpty(selections)) {
List<String> selectionList = Arrays.asList(selections.split(","));
queryWrapper.in("id",selectionList);
queryWrapper.in("id", selectionList);
}
//Step.2 获取导出数据
List<CountPlan> countPlanList = countPlanService.list(queryWrapper);
@ -262,7 +262,7 @@ public class CountPlanController {
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
mv.addObject(NormalExcelConstants.FILE_NAME, "盘点列表");
mv.addObject(NormalExcelConstants.CLASS, CountPlanPage.class);
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("盘点数据", "导出人:"+sysUser.getRealname(), "盘点"));
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("盘点数据", "导出人:" + sysUser.getRealname(), "盘点"));
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv;
}
@ -295,8 +295,8 @@ public class CountPlanController {
}
return Result.OK("文件导入成功!数据行数:" + list.size());
} catch (Exception e) {
log.error(e.getMessage(),e);
return Result.error("文件导入失败:"+e.getMessage());
log.error(e.getMessage(), e);
return Result.error("文件导入失败:" + e.getMessage());
} finally {
try {
file.getInputStream().close();
@ -308,4 +308,15 @@ public class CountPlanController {
return Result.OK("文件导入失败!");
}
@AutoLog(value = "盘点-任务下发")
@Operation(summary = "盘点-任务下发")
@RequiresPermissions("count:data_count_plan:countIssueTask")
@GetMapping(value = "/countIssueTask")
public Result<String> countIssueTask(@RequestParam(name = "workStations", required = true) List<String> workStations) {
for (String workStation : workStations){
log.info("任务下发中,工作台:{}", workStation);
}
return Result.OK("任务下发成功");
}
}

View File

@ -171,7 +171,6 @@ public class CountPlanServiceImpl extends ServiceImpl<CountPlanMapper, CountPlan
private void processInventory(CountPlan countPlan, List<Inventory> inventories) {
List<CountDetail> countDetails = new ArrayList<>();
List<Inventory> inventoriesToUpdate = new ArrayList<>();
for (Inventory inventory : inventories) {
// 创建盘点明细
@ -180,14 +179,13 @@ public class CountPlanServiceImpl extends ServiceImpl<CountPlanMapper, CountPlan
// 更新库存状态
inventory.setStatus(InventoryStatusEnum.COUNTING.getValue());
inventoriesToUpdate.add(inventory);
}
if (CollectionUtils.isNotEmpty(countDetails)) {
countDetailMapper.insert(countDetails);
}
if (CollectionUtils.isNotEmpty(inventoriesToUpdate)) {
inventoryMapper.updateById(inventoriesToUpdate);
if (CollectionUtils.isNotEmpty(inventories)) {
inventoryMapper.updateById(inventories);
}
}

View File

@ -32,20 +32,26 @@
<select id="queryByAreaIdAndCountTypeAndCodes" resultType="org.cpte.modules.inventory.entity.Inventory">
SELECT inv.* FROM data_inventory inv
JOIN base_point point ON point.id = inv.point_id
AND point.area_id = #{areaId}
WHERE inv.status =1
AND inv.quantity > 0
INNER JOIN base_point point ON point.id = inv.point_id
<choose>
<when test="countType == 0">
INNER JOIN base_item item ON item.id = inv.item_id
</when>
<when test="countType == 1">
INNER JOIN base_stock stock ON stock.id = inv.stock_id
</when>
</choose>
WHERE inv.status = 1
AND inv.quantity > 0
AND point.area_id = #{areaId}
<choose>
<when test="countType == 0">
JOIN base_item item ON item.id=inv.item_id
AND item.item_code IN
<foreach collection="codes" item="code" open="(" separator="," close=")">
#{code}
</foreach>
</when>
<when test="countType == 1">
JOIN base_stock stock ON stock.id=inv.stock_id
AND stock.stock_code IN
<foreach collection="codes" item="code" open="(" separator="," close=")">
#{code}