新建入库,赛意WMS下发入库,生成AGV任务
parent
88297c8ce5
commit
68c3773cfc
|
|
@ -31,7 +31,8 @@ public class ResourceUtil {
|
|||
*/
|
||||
private final static String[] BASE_SCAN_PACKAGES = {
|
||||
"org.jeecg.common.constant.enums",
|
||||
"org.jeecg.modules.message.enums"
|
||||
"org.jeecg.modules.message.enums",
|
||||
"org.cpte.modules.constant.enums"
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||
import org.jeecg.common.constant.SymbolConstant;
|
||||
import org.jeecg.common.handler.IFillRuleHandler;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -74,7 +74,21 @@ public class FillRuleUtil {
|
|||
formData = new JSONObject();
|
||||
}
|
||||
// 通过反射执行配置的类里的方法
|
||||
IFillRuleHandler ruleHandler = (IFillRuleHandler) Class.forName(ruleClass).newInstance();
|
||||
IFillRuleHandler ruleHandler;
|
||||
try {
|
||||
// 先尝试从 Spring 容器获取
|
||||
ruleHandler = (IFillRuleHandler) SpringContextUtils.getBean(Class.forName(ruleClass));
|
||||
} catch (Exception e) {
|
||||
// 如果获取失败,回退到原来的反射方式
|
||||
log.warn("从Spring容器获取{}失败,使用反射创建实例", ruleClass);
|
||||
ruleHandler = (IFillRuleHandler) Class.forName(ruleClass).newInstance();
|
||||
|
||||
// 如果是新创建的实例,尝试手动注入依赖
|
||||
if (ruleHandler instanceof ApplicationContextAware) {
|
||||
((ApplicationContextAware) ruleHandler).setApplicationContext(SpringContextUtils.getApplicationContext());
|
||||
}
|
||||
}
|
||||
// IFillRuleHandler ruleHandler = (IFillRuleHandler) Class.forName(ruleClass).newInstance();
|
||||
return ruleHandler.execute(params, formData);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,181 @@
|
|||
package org.cpte.modules.agvTask.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.query.QueryRuleEnum;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.cpte.modules.agvTask.entity.AgvTask;
|
||||
import org.cpte.modules.agvTask.service.IAgvTaskService;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
/**
|
||||
* @Description: AGV任务表
|
||||
* @author: cpte
|
||||
* @Date: 2025-11-06
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Tag(name="AGV任务表")
|
||||
@RestController
|
||||
@RequestMapping("/agvTask")
|
||||
@Slf4j
|
||||
public class AgvTaskController extends JeecgController<AgvTask, IAgvTaskService> {
|
||||
@Autowired
|
||||
private IAgvTaskService agvTaskService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param agvTask
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "AGV任务表-分页列表查询")
|
||||
@Operation(summary="AGV任务表-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<AgvTask>> queryPageList(AgvTask agvTask,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
|
||||
|
||||
QueryWrapper<AgvTask> queryWrapper = QueryGenerator.initQueryWrapper(agvTask, req.getParameterMap());
|
||||
Page<AgvTask> page = new Page<AgvTask>(pageNo, pageSize);
|
||||
IPage<AgvTask> pageList = agvTaskService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param agvTask
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "AGV任务表-添加")
|
||||
@Operation(summary="AGV任务表-添加")
|
||||
@RequiresPermissions("agvTask:data_agv_task:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody AgvTask agvTask) {
|
||||
agvTaskService.save(agvTask);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param agvTask
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "AGV任务表-编辑")
|
||||
@Operation(summary="AGV任务表-编辑")
|
||||
@RequiresPermissions("agvTask:data_agv_task:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody AgvTask agvTask) {
|
||||
agvTaskService.updateById(agvTask);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "AGV任务表-通过id删除")
|
||||
@Operation(summary="AGV任务表-通过id删除")
|
||||
@RequiresPermissions("agvTask:data_agv_task:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
agvTaskService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "AGV任务表-批量删除")
|
||||
@Operation(summary="AGV任务表-批量删除")
|
||||
@RequiresPermissions("agvTask:data_agv_task:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.agvTaskService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "AGV任务表-通过id查询")
|
||||
@Operation(summary="AGV任务表-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<AgvTask> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
AgvTask agvTask = agvTaskService.getById(id);
|
||||
if(agvTask==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(agvTask);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param agvTask
|
||||
*/
|
||||
@RequiresPermissions("agvTask:data_agv_task:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, AgvTask agvTask) {
|
||||
return super.exportXls(request, agvTask, AgvTask.class, "AGV任务表");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("agvTask:data_agv_task:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, AgvTask.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
package org.jeecg.modules.agvTask;
|
||||
|
||||
public class eee {
|
||||
}
|
||||
|
|
@ -0,0 +1,144 @@
|
|||
package org.cpte.modules.agvTask.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: AGV任务表
|
||||
* @author: cpte
|
||||
* @Date: 2025-11-06
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Schema(description = "AGV任务表")
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName("data_agv_task")
|
||||
public class AgvTask implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "id")
|
||||
private java.lang.String id;
|
||||
|
||||
/**
|
||||
* 任务编号
|
||||
*/
|
||||
@Excel(name = "任务编号", width = 15)
|
||||
@Schema(description = "任务编号")
|
||||
private java.lang.String agvCode;
|
||||
|
||||
/**
|
||||
* 载具编号
|
||||
*/
|
||||
@Excel(name = "载具编号", width = 15)
|
||||
@Schema(description = "载具编号")
|
||||
private java.lang.String carrierCode;
|
||||
/**
|
||||
* 载具类型
|
||||
*/
|
||||
@Excel(name = "载具类型", width = 15)
|
||||
@Schema(description = "载具类型")
|
||||
private java.lang.String carrierType;
|
||||
/**
|
||||
* 任务类型
|
||||
*/
|
||||
@Excel(name = "任务类型", width = 15)
|
||||
@Schema(description = "任务类型")
|
||||
private java.lang.String taskType;
|
||||
/**
|
||||
* 业务类型
|
||||
*/
|
||||
@Excel(name = "业务类型", width = 15)
|
||||
@Schema(description = "业务类型")
|
||||
@Dict(dicCode = "business_type")
|
||||
private java.lang.String type;
|
||||
/**
|
||||
* 任务状态
|
||||
*/
|
||||
@Excel(name = "任务状态", width = 15)
|
||||
@Schema(description = "任务状态")
|
||||
@Dict(dicCode = "agv_task_status")
|
||||
private java.lang.String status;
|
||||
/**
|
||||
* 优先级
|
||||
*/
|
||||
@Excel(name = "优先级", width = 15)
|
||||
@Schema(description = "优先级")
|
||||
private java.lang.Integer priority;
|
||||
/**
|
||||
* 起点位置
|
||||
*/
|
||||
@Excel(name = "起点位置", width = 15)
|
||||
@Schema(description = "起点位置")
|
||||
private java.lang.String startCode;
|
||||
/**
|
||||
* 终点位置
|
||||
*/
|
||||
@Excel(name = "终点位置", width = 15)
|
||||
@Schema(description = "终点位置")
|
||||
private java.lang.String endCode;
|
||||
/**
|
||||
* 返回报文
|
||||
*/
|
||||
@Excel(name = "返回报文", width = 15)
|
||||
@Schema(description = "返回报文")
|
||||
private java.lang.String resMessage;
|
||||
/**
|
||||
* 返回时间
|
||||
*/
|
||||
@Excel(name = "返回时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "返回时间")
|
||||
private java.util.Date resMessageTime;
|
||||
/**
|
||||
* 所属部门
|
||||
*/
|
||||
@Schema(description = "所属部门")
|
||||
private java.lang.String sysOrgCode;
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
@Excel(name = "租户ID", width = 15)
|
||||
@Schema(description = "租户ID")
|
||||
private java.lang.Integer tenantId;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@Schema(description = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**
|
||||
* 创建日期
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
@Schema(description = "更新人")
|
||||
private java.lang.String updateBy;
|
||||
/**
|
||||
* 更新日期
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package org.cpte.modules.agvTask.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.cpte.modules.agvTask.entity.AgvTask;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: AGV任务表
|
||||
* @author: cpte
|
||||
* @Date: 2025-11-06
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface AgvTaskMapper extends BaseMapper<AgvTask> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.cpte.modules.agvTask.mapper.AgvTaskMapper">
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package org.cpte.modules.agvTask.service;
|
||||
|
||||
import org.cpte.modules.agvTask.entity.AgvTask;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @Description: AGV任务表
|
||||
* @author: cpte
|
||||
* @Date: 2025-11-06
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IAgvTaskService extends IService<AgvTask> {
|
||||
/**
|
||||
* 创建agvTask任务
|
||||
*
|
||||
* @param status 状态
|
||||
* @param carrierCode 容器
|
||||
* @param startCode 起点
|
||||
* @param endCode 终点
|
||||
* @param taskType 任务类型
|
||||
* @param type 业务类型
|
||||
*/
|
||||
AgvTask createAgvTask(String status, String carrierCode, String startCode, String endCode, String taskType,String type);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package org.cpte.modules.agvTask.service.impl;
|
||||
|
||||
import org.cpte.modules.agvTask.entity.AgvTask;
|
||||
import org.cpte.modules.agvTask.mapper.AgvTaskMapper;
|
||||
import org.cpte.modules.agvTask.service.IAgvTaskService;
|
||||
import org.cpte.modules.constant.enums.StockTypeEnum;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* @Description: AGV任务表
|
||||
* @author: cpte
|
||||
* @Date: 2025-11-06
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class AgvTaskServiceImpl extends ServiceImpl<AgvTaskMapper, AgvTask> implements IAgvTaskService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AgvTask createAgvTask(String status, String carrierCode, String startCode, String endCode, String taskType, String type) {
|
||||
AgvTask agvTask = AgvTask.builder()
|
||||
.carrierCode(carrierCode)
|
||||
.type(type)
|
||||
.status(status)
|
||||
.startCode(startCode)
|
||||
.endCode(endCode)
|
||||
.carrierType(StockTypeEnum.TRAY.getValue())
|
||||
.taskType(taskType)
|
||||
.priority(99)
|
||||
.build();
|
||||
return this.save(agvTask) ? agvTask : null;
|
||||
}
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ import java.util.Map;
|
|||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.query.QueryRuleEnum;
|
||||
|
|
@ -60,10 +61,10 @@ public class AreaController extends JeecgController<Area, IAreaService> {
|
|||
customeRuleMap.put("areaCode", QueryRuleEnum.RIGHT_LIKE);
|
||||
customeRuleMap.put("areaName", QueryRuleEnum.RIGHT_LIKE);
|
||||
QueryWrapper<Area> queryWrapper = QueryGenerator.initQueryWrapper(area, req.getParameterMap(), customeRuleMap);
|
||||
// 如果提供了 keyword,则同时对 areaCode 和 areaName 进行模糊搜索
|
||||
if (keyword != null && !keyword.trim().isEmpty()) {
|
||||
queryWrapper.and(wrapper -> wrapper.likeRight("area_code", keyword).or().likeRight("area_name", keyword));
|
||||
}
|
||||
// 如果提供了 keyword,则同时对 areaCode 和 areaName 进行模糊搜索
|
||||
if (StringUtils.isNotBlank(keyword)) {
|
||||
queryWrapper.and(wrapper -> wrapper.likeRight("area_code", keyword).or().likeRight("area_name", keyword));
|
||||
}
|
||||
Page<Area> page = new Page<Area>(pageNo, pageSize);
|
||||
IPage<Area> pageList = areaService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
|
|
|
|||
|
|
@ -8,8 +8,10 @@ import java.util.stream.Collectors;
|
|||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.query.QueryRuleEnum;
|
||||
|
|
@ -38,128 +40,136 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
|||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
/**
|
||||
|
||||
/**
|
||||
* @Description: 物料
|
||||
* @author: cpte
|
||||
* @Date: 2025-10-27
|
||||
* @Date: 2025-10-27
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Tag(name="物料")
|
||||
@Tag(name = "物料")
|
||||
@RestController
|
||||
@RequestMapping("/base/item")
|
||||
@Slf4j
|
||||
public class ItemController extends JeecgController<Item, IItemService> {
|
||||
@Autowired
|
||||
private IItemService itemService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param item
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "物料-分页列表查询")
|
||||
@Operation(summary="物料-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<Item>> queryPageList(Item item,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
|
||||
|
||||
QueryWrapper<Item> queryWrapper = QueryGenerator.initQueryWrapper(item, req.getParameterMap());
|
||||
Page<Item> page = new Page<Item>(pageNo, pageSize);
|
||||
IPage<Item> pageList = itemService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param item
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "物料-添加")
|
||||
@Operation(summary="物料-添加")
|
||||
@RequiresPermissions("base:base_item:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody Item item) {
|
||||
itemService.save(item);
|
||||
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param item
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "物料-编辑")
|
||||
@Operation(summary="物料-编辑")
|
||||
@RequiresPermissions("base:base_item:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody Item item) {
|
||||
itemService.updateById(item);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "物料-通过id删除")
|
||||
@Operation(summary="物料-通过id删除")
|
||||
@RequiresPermissions("base:base_item:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
itemService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "物料-批量删除")
|
||||
@Operation(summary="物料-批量删除")
|
||||
@RequiresPermissions("base:base_item:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.itemService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "物料-通过id查询")
|
||||
@Operation(summary="物料-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<Item> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
Item item = itemService.getById(id);
|
||||
if(item==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(item);
|
||||
}
|
||||
@Autowired
|
||||
private IItemService itemService;
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param item
|
||||
*/
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param item
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "物料-分页列表查询")
|
||||
@Operation(summary = "物料-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<Item>> queryPageList(Item item,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "keyword", required = false) String keyword,
|
||||
HttpServletRequest req) {
|
||||
// 自定义查询规则
|
||||
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
|
||||
customeRuleMap.put("itemCode", QueryRuleEnum.RIGHT_LIKE);
|
||||
customeRuleMap.put("itemName", QueryRuleEnum.RIGHT_LIKE);
|
||||
QueryWrapper<Item> queryWrapper = QueryGenerator.initQueryWrapper(item, req.getParameterMap(),customeRuleMap);
|
||||
// 如果提供了 keyword,则同时对 areaCode 和 areaName 进行模糊搜索
|
||||
if (StringUtils.isNotBlank(keyword)) {
|
||||
queryWrapper.and(wrapper -> wrapper.likeRight("item_code", keyword).or().likeRight("item_name", keyword));
|
||||
}
|
||||
Page<Item> page = new Page<Item>(pageNo, pageSize);
|
||||
IPage<Item> pageList = itemService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param item
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "物料-添加")
|
||||
@Operation(summary = "物料-添加")
|
||||
@RequiresPermissions("base:base_item:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody Item item) {
|
||||
itemService.save(item);
|
||||
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param item
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "物料-编辑")
|
||||
@Operation(summary = "物料-编辑")
|
||||
@RequiresPermissions("base:base_item:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody Item item) {
|
||||
itemService.updateById(item);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "物料-通过id删除")
|
||||
@Operation(summary = "物料-通过id删除")
|
||||
@RequiresPermissions("base:base_item:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
itemService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "物料-批量删除")
|
||||
@Operation(summary = "物料-批量删除")
|
||||
@RequiresPermissions("base:base_item:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
this.itemService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "物料-通过id查询")
|
||||
@Operation(summary = "物料-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<Item> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
Item item = itemService.getById(id);
|
||||
if (item == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param item
|
||||
*/
|
||||
@RequiresPermissions("base:base_item:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, Item item) {
|
||||
|
|
@ -167,12 +177,12 @@ public class ItemController extends JeecgController<Item, IItemService> {
|
|||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("base:base_item:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
|
|
|
|||
|
|
@ -8,8 +8,10 @@ import java.util.stream.Collectors;
|
|||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoDict;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
|
|
@ -39,128 +41,136 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
|||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
/**
|
||||
|
||||
/**
|
||||
* @Description: 库位
|
||||
* @author: cpte
|
||||
* @Date: 2025-10-28
|
||||
* @Date: 2025-10-28
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Tag(name="库位")
|
||||
@Tag(name = "库位")
|
||||
@RestController
|
||||
@RequestMapping("/base/point")
|
||||
@Slf4j
|
||||
public class PointController extends JeecgController<Point, IPointService> {
|
||||
@Autowired
|
||||
private IPointService pointService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param point
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "库位-分页列表查询")
|
||||
@Operation(summary="库位-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<Point>> queryPageList(Point point,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
|
||||
|
||||
QueryWrapper<Point> queryWrapper = QueryGenerator.initQueryWrapper(point, req.getParameterMap());
|
||||
Page<Point> page = new Page<Point>(pageNo, pageSize);
|
||||
IPage<Point> pageList = pointService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param point
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "库位-添加")
|
||||
@Operation(summary="库位-添加")
|
||||
@RequiresPermissions("base:base_point:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody Point point) {
|
||||
pointService.save(point);
|
||||
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param point
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "库位-编辑")
|
||||
@Operation(summary="库位-编辑")
|
||||
@RequiresPermissions("base:base_point:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody Point point) {
|
||||
pointService.updateById(point);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "库位-通过id删除")
|
||||
@Operation(summary="库位-通过id删除")
|
||||
@RequiresPermissions("base:base_point:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
pointService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "库位-批量删除")
|
||||
@Operation(summary="库位-批量删除")
|
||||
@RequiresPermissions("base:base_point:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.pointService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "库位-通过id查询")
|
||||
@Operation(summary="库位-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<Point> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
Point point = pointService.getById(id);
|
||||
if(point==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(point);
|
||||
}
|
||||
@Autowired
|
||||
private IPointService pointService;
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param point
|
||||
*/
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param point
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "库位-分页列表查询")
|
||||
@Operation(summary = "库位-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<Point>> queryPageList(Point point,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "keyword", required = false) String keyword,
|
||||
HttpServletRequest req) {
|
||||
|
||||
// 自定义查询规则
|
||||
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
|
||||
customeRuleMap.put("pointCode", QueryRuleEnum.RIGHT_LIKE);
|
||||
QueryWrapper<Point> queryWrapper = QueryGenerator.initQueryWrapper(point, req.getParameterMap(), customeRuleMap);
|
||||
// 如果提供了 keyword,则同时对 pointCode 模糊搜索
|
||||
if (StringUtils.isNotBlank(keyword)) {
|
||||
queryWrapper.and(wrapper -> wrapper.likeRight("point_code", keyword));
|
||||
}
|
||||
Page<Point> page = new Page<Point>(pageNo, pageSize);
|
||||
IPage<Point> pageList = pointService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param point
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "库位-添加")
|
||||
@Operation(summary = "库位-添加")
|
||||
@RequiresPermissions("base:base_point:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody Point point) {
|
||||
pointService.save(point);
|
||||
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param point
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "库位-编辑")
|
||||
@Operation(summary = "库位-编辑")
|
||||
@RequiresPermissions("base:base_point:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody Point point) {
|
||||
pointService.updateById(point);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "库位-通过id删除")
|
||||
@Operation(summary = "库位-通过id删除")
|
||||
@RequiresPermissions("base:base_point:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
pointService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "库位-批量删除")
|
||||
@Operation(summary = "库位-批量删除")
|
||||
@RequiresPermissions("base:base_point:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
this.pointService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "库位-通过id查询")
|
||||
@Operation(summary = "库位-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<Point> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
Point point = pointService.getById(id);
|
||||
if (point == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(point);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param point
|
||||
*/
|
||||
@RequiresPermissions("base:base_point:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, Point point) {
|
||||
|
|
@ -168,12 +178,12 @@ public class PointController extends JeecgController<Point, IPointService> {
|
|||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("base:base_point:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
|
|
|
|||
|
|
@ -8,8 +8,10 @@ import java.util.stream.Collectors;
|
|||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.query.QueryRuleEnum;
|
||||
|
|
@ -38,128 +40,135 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
|||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
/**
|
||||
|
||||
/**
|
||||
* @Description: 容器
|
||||
* @author: cpte
|
||||
* @Date: 2025-10-28
|
||||
* @Date: 2025-10-28
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Tag(name="容器")
|
||||
@Tag(name = "容器")
|
||||
@RestController
|
||||
@RequestMapping("/base/stock")
|
||||
@Slf4j
|
||||
public class StockController extends JeecgController<Stock, IStockService> {
|
||||
@Autowired
|
||||
private IStockService stockService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param stock
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "容器-分页列表查询")
|
||||
@Operation(summary="容器-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<Stock>> queryPageList(Stock stock,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
|
||||
|
||||
QueryWrapper<Stock> queryWrapper = QueryGenerator.initQueryWrapper(stock, req.getParameterMap());
|
||||
Page<Stock> page = new Page<Stock>(pageNo, pageSize);
|
||||
IPage<Stock> pageList = stockService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param stock
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "容器-添加")
|
||||
@Operation(summary="容器-添加")
|
||||
@RequiresPermissions("base:base_stock:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody Stock stock) {
|
||||
stockService.save(stock);
|
||||
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param stock
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "容器-编辑")
|
||||
@Operation(summary="容器-编辑")
|
||||
@RequiresPermissions("base:base_stock:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody Stock stock) {
|
||||
stockService.updateById(stock);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "容器-通过id删除")
|
||||
@Operation(summary="容器-通过id删除")
|
||||
@RequiresPermissions("base:base_stock:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
stockService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "容器-批量删除")
|
||||
@Operation(summary="容器-批量删除")
|
||||
@RequiresPermissions("base:base_stock:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.stockService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "容器-通过id查询")
|
||||
@Operation(summary="容器-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<Stock> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
Stock stock = stockService.getById(id);
|
||||
if(stock==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(stock);
|
||||
}
|
||||
@Autowired
|
||||
private IStockService stockService;
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param stock
|
||||
*/
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param stock
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "容器-分页列表查询")
|
||||
@Operation(summary = "容器-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<Stock>> queryPageList(Stock stock,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "keyword", required = false) String keyword,
|
||||
HttpServletRequest req) {
|
||||
// 自定义查询规则
|
||||
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
|
||||
customeRuleMap.put("stockCode", QueryRuleEnum.RIGHT_LIKE);
|
||||
QueryWrapper<Stock> queryWrapper = QueryGenerator.initQueryWrapper(stock, req.getParameterMap(), customeRuleMap);
|
||||
// 如果提供了 keyword,则同时对 pointCode 模糊搜索
|
||||
if (StringUtils.isNotBlank(keyword)) {
|
||||
queryWrapper.and(wrapper -> wrapper.likeRight("stock_code", keyword));
|
||||
}
|
||||
Page<Stock> page = new Page<Stock>(pageNo, pageSize);
|
||||
IPage<Stock> pageList = stockService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param stock
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "容器-添加")
|
||||
@Operation(summary = "容器-添加")
|
||||
@RequiresPermissions("base:base_stock:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody Stock stock) {
|
||||
stockService.save(stock);
|
||||
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param stock
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "容器-编辑")
|
||||
@Operation(summary = "容器-编辑")
|
||||
@RequiresPermissions("base:base_stock:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody Stock stock) {
|
||||
stockService.updateById(stock);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "容器-通过id删除")
|
||||
@Operation(summary = "容器-通过id删除")
|
||||
@RequiresPermissions("base:base_stock:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
stockService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "容器-批量删除")
|
||||
@Operation(summary = "容器-批量删除")
|
||||
@RequiresPermissions("base:base_stock:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
this.stockService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "容器-通过id查询")
|
||||
@Operation(summary = "容器-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<Stock> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
Stock stock = stockService.getById(id);
|
||||
if (stock == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(stock);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param stock
|
||||
*/
|
||||
@RequiresPermissions("base:base_stock:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, Stock stock) {
|
||||
|
|
@ -167,12 +176,12 @@ public class StockController extends JeecgController<Stock, IStockService> {
|
|||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("base:base_stock:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import java.io.Serializable;
|
|||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
|
@ -22,47 +23,88 @@ import lombok.experimental.Accessors;
|
|||
/**
|
||||
* @Description: 物料
|
||||
* @author: cpte
|
||||
* @Date: 2025-10-27
|
||||
* @Date: 2025-10-27
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("base_item")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description="物料")
|
||||
@Schema(description = "物料")
|
||||
public class Item implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "主键")
|
||||
private java.lang.String id;
|
||||
/**物料编码*/
|
||||
@Excel(name = "物料编码", width = 15)
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
@Excel(name = "物料编码", width = 15)
|
||||
@Schema(description = "物料编码")
|
||||
private java.lang.String itemCode;
|
||||
/**物料名称*/
|
||||
@Excel(name = "物料名称", width = 15)
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
@Excel(name = "物料名称", width = 15)
|
||||
@Schema(description = "物料名称")
|
||||
private java.lang.String itemName;
|
||||
/**租户ID*/
|
||||
@Excel(name = "租户ID", width = 15)
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Excel(name = "描述", width = 15)
|
||||
@Schema(description = "描述")
|
||||
private java.lang.String description;
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@Excel(name = "是否删除", width = 15)
|
||||
@Schema(description = "是否删除")
|
||||
@TableLogic
|
||||
private java.lang.Integer delFlag;
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
@Excel(name = "是否启用", width = 15)
|
||||
@Schema(description = "是否启用")
|
||||
private java.lang.Integer izActive;
|
||||
|
||||
/**
|
||||
* 所属部门
|
||||
*/
|
||||
@Schema(description = "所属部门")
|
||||
private java.lang.String sysOrgCode;
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
@Excel(name = "租户ID", width = 15)
|
||||
@Schema(description = "租户ID")
|
||||
private java.lang.Integer tenantId;
|
||||
/**创建人*/
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@Schema(description = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
/**
|
||||
* 创建日期
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
/**更新人*/
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
@Schema(description = "更新人")
|
||||
private java.lang.String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
/**
|
||||
* 更新日期
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,19 +61,19 @@ public class Point implements Serializable {
|
|||
*/
|
||||
@Excel(name = "排", width = 15)
|
||||
@Schema(description = "排")
|
||||
private java.lang.String row;
|
||||
private java.lang.String rows;
|
||||
/**
|
||||
* 列
|
||||
*/
|
||||
@Excel(name = "列", width = 15)
|
||||
@Schema(description = "列")
|
||||
private java.lang.String col;
|
||||
private java.lang.String cols;
|
||||
/**
|
||||
* 层
|
||||
*/
|
||||
@Excel(name = "层", width = 15)
|
||||
@Schema(description = "层")
|
||||
private java.lang.String layer;
|
||||
private java.lang.String layers;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -4,10 +4,8 @@ import java.io.Serializable;
|
|||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import org.jeecg.common.constant.ProvinceCityArea;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import lombok.Data;
|
||||
|
|
@ -22,55 +20,107 @@ import lombok.experimental.Accessors;
|
|||
/**
|
||||
* @Description: 容器
|
||||
* @author: cpte
|
||||
* @Date: 2025-10-28
|
||||
* @Date: 2025-10-28
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("base_stock")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description="容器")
|
||||
@Schema(description = "容器")
|
||||
public class Stock implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "主键")
|
||||
private java.lang.String id;
|
||||
/**容器编码*/
|
||||
@Excel(name = "容器编码", width = 15)
|
||||
/**
|
||||
* 库位ID
|
||||
*/
|
||||
@Excel(name = "库位ID", width = 15)
|
||||
@Schema(description = "库位ID")
|
||||
@Dict(dictTable = "base_point", dicCode = "id", dicText = "point_code")
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private java.lang.String pointId;
|
||||
/**
|
||||
* 容器编码
|
||||
*/
|
||||
@Excel(name = "容器编码", width = 15)
|
||||
@Schema(description = "容器编码")
|
||||
private java.lang.String stockCode;
|
||||
/**描述*/
|
||||
@Excel(name = "描述", width = 15)
|
||||
|
||||
/**
|
||||
* 容器类型
|
||||
*/
|
||||
@Excel(name = "容器类型", width = 15)
|
||||
@Schema(description = "容器类型")
|
||||
@Dict(dicCode = "stock_type")
|
||||
private java.lang.String stockType;
|
||||
|
||||
/**
|
||||
* 容器状态
|
||||
*/
|
||||
@Excel(name = "容器状态", width = 15)
|
||||
@Schema(description = "容器状态")
|
||||
@Dict(dicCode = "common_status")
|
||||
private java.lang.Integer status;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Excel(name = "描述", width = 15)
|
||||
@Schema(description = "描述")
|
||||
private java.lang.String description;
|
||||
/**删除状态*/
|
||||
@Excel(name = "删除状态", width = 15)
|
||||
/**
|
||||
* 删除状态
|
||||
*/
|
||||
@Excel(name = "删除状态", width = 15)
|
||||
@Schema(description = "删除状态")
|
||||
@TableLogic
|
||||
private java.lang.String delFlag;
|
||||
/**租户ID*/
|
||||
@Excel(name = "租户ID", width = 15)
|
||||
@Schema(description = "租户ID")
|
||||
private java.lang.Integer tenantId;
|
||||
/**创建人*/
|
||||
@Schema(description = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
/**更新人*/
|
||||
@Schema(description = "更新人")
|
||||
private java.lang.String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
/**所属部门*/
|
||||
private java.lang.Integer delFlag;
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
@Excel(name = "是否启用", width = 15)
|
||||
@Schema(description = "是否启用")
|
||||
private java.lang.Integer izActive;
|
||||
/**
|
||||
* 所属部门
|
||||
*/
|
||||
@Schema(description = "所属部门")
|
||||
private java.lang.String sysOrgCode;
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
@Excel(name = "租户ID", width = 15)
|
||||
@Schema(description = "租户ID")
|
||||
private java.lang.Integer tenantId;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@Schema(description = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**
|
||||
* 创建日期
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
@Schema(description = "更新人")
|
||||
private java.lang.String updateBy;
|
||||
/**
|
||||
* 更新日期
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package org.cpte.modules.base.mapper;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.cpte.modules.base.entity.Area;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,10 @@ package org.cpte.modules.base.mapper;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.cpte.modules.base.entity.Item;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.cpte.modules.receive.entity.Asn;
|
||||
|
||||
/**
|
||||
* @Description: 物料
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
package org.cpte.modules.base.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.cpte.modules.base.entity.Stock;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
|
|
|
|||
|
|
@ -10,5 +10,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
* @Version: V1.0
|
||||
*/
|
||||
public interface IAreaService extends IService<Area> {
|
||||
|
||||
/**
|
||||
* 验证库区
|
||||
*
|
||||
* @param areaCode 库区编码/库区名称
|
||||
*/
|
||||
Area validateArea(String areaCode);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,13 +2,39 @@ package org.cpte.modules.base.service;
|
|||
|
||||
import org.cpte.modules.base.entity.Item;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 物料
|
||||
* @author: cpte
|
||||
* @Date: 2025-10-27
|
||||
* @Date: 2025-10-27
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IItemService extends IService<Item> {
|
||||
|
||||
/**
|
||||
* 验证物料
|
||||
*
|
||||
* @param itemCode 物料
|
||||
*/
|
||||
Item validateItem(String itemCode);
|
||||
|
||||
/**
|
||||
* 根据物料编码集合查询物料信息
|
||||
*
|
||||
* @param itemCodes 物料编码集合
|
||||
* @return List<Item>
|
||||
*/
|
||||
List<Item> queryByItemCodes(List<String> itemCodes);
|
||||
|
||||
/**
|
||||
* 根据物料编码集合查询物料信息
|
||||
*
|
||||
* @param itemCodes 物料集合
|
||||
* @return Map<String, ItemEntity>
|
||||
*/
|
||||
Map<String, Item> queryByItemCodesToMap(List<String> itemCodes);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
package org.cpte.modules.base.service;
|
||||
|
||||
import org.cpte.modules.base.entity.Point;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 库位
|
||||
|
|
@ -11,4 +12,38 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
*/
|
||||
public interface IPointService extends IService<Point> {
|
||||
|
||||
/**
|
||||
* 验证点位
|
||||
*
|
||||
* @param pointCode 点位
|
||||
*/
|
||||
Point validatePoint(String pointCode);
|
||||
|
||||
/**
|
||||
* 根据库位编码集合查询库位信息
|
||||
*
|
||||
* @param pointCodes 库位编码集合
|
||||
* @return List<point>
|
||||
*/
|
||||
List<Point> queryByPointCodes(List<String> pointCodes);
|
||||
|
||||
/**
|
||||
* 根据库位编码集合查询库位信息
|
||||
*
|
||||
* @param pointCodes 库位集合
|
||||
* @return Map<String, pointEntity>
|
||||
*/
|
||||
Map<String, Point> queryByPointCodesToMap(List<String> pointCodes);
|
||||
|
||||
|
||||
/**
|
||||
* 查询库位信息
|
||||
*
|
||||
* @param pointCode 库位编码
|
||||
* @param status 状态
|
||||
* @param areaName 区域名称
|
||||
* @return List<point>
|
||||
*/
|
||||
List<Point> queryPoints(String pointCode, Integer status, String areaName);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,39 @@ package org.cpte.modules.base.service;
|
|||
import org.cpte.modules.base.entity.Stock;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 容器
|
||||
* @author: cpte
|
||||
* @Date: 2025-10-28
|
||||
* @Date: 2025-10-28
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IStockService extends IService<Stock> {
|
||||
|
||||
/**
|
||||
* 验证容器
|
||||
*
|
||||
* @param stockCode 容器
|
||||
*/
|
||||
Stock validateStock(String stockCode);
|
||||
|
||||
/**
|
||||
* 根据容器编码集合查询容器信息
|
||||
*
|
||||
* @param stockCodes 容器料编码集合
|
||||
* @return List<Stock>
|
||||
*/
|
||||
List<Stock> queryByStockCodes(List<String> stockCodes);
|
||||
|
||||
/**
|
||||
* 根据容器编码集合查询容器信息
|
||||
*
|
||||
* @param stockCodes 容器编码集合
|
||||
* @return Map<String, Stock>
|
||||
*/
|
||||
Map<String, Stock> queryByStockCodesToMap(List<String> stockCodes);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package org.cpte.modules.base.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.cpte.modules.base.entity.Area;
|
||||
import org.cpte.modules.base.mapper.AreaMapper;
|
||||
import org.cpte.modules.base.service.IAreaService;
|
||||
|
|
@ -10,10 +11,27 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
/**
|
||||
* @Description: 库区
|
||||
* @author: cpte
|
||||
* @Date: 2025-10-29
|
||||
* @Date: 2025-10-29
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class AreaServiceImpl extends ServiceImpl<AreaMapper, Area> implements IAreaService {
|
||||
|
||||
@Override
|
||||
public Area validateArea(String areaCode) {
|
||||
LambdaQueryWrapper<Area> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(Area::getAreaCode, areaCode).or().eq(Area::getAreaName, areaCode);
|
||||
|
||||
Area area = this.getOne(queryWrapper);
|
||||
if (area == null) {
|
||||
throw new RuntimeException("系统无【" + areaCode + "】库区,请维护");
|
||||
}
|
||||
if (area.getIzActive() == 0) {
|
||||
throw new RuntimeException("此【" + areaCode + "】库区已禁用");
|
||||
}
|
||||
if (area.getDelFlag() == 1) {
|
||||
throw new RuntimeException("此【" + areaCode + "】库区已删除");
|
||||
}
|
||||
return area;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,19 +1,85 @@
|
|||
package org.cpte.modules.base.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.google.common.collect.Maps;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.cpte.modules.base.entity.Item;
|
||||
import org.cpte.modules.base.mapper.ItemMapper;
|
||||
import org.cpte.modules.base.service.IItemService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 物料
|
||||
* @author: cpte
|
||||
* @Date: 2025-10-27
|
||||
* @Date: 2025-10-27
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class ItemServiceImpl extends ServiceImpl<ItemMapper, Item> implements IItemService {
|
||||
|
||||
/**
|
||||
* 验证物料
|
||||
*
|
||||
* @param itemCode 物料编码
|
||||
* @return Point
|
||||
*/
|
||||
@Override
|
||||
public Item validateItem(String itemCode) {
|
||||
LambdaQueryWrapper<Item> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(Item::getItemCode, itemCode);
|
||||
Item item = this.getOne(queryWrapper);
|
||||
if (item == null) {
|
||||
throw new RuntimeException("系统无【" + itemCode + "】物料,请维护");
|
||||
}
|
||||
if (item.getIzActive() == 0) {
|
||||
throw new RuntimeException("此【" + itemCode + "】物料已禁用");
|
||||
}
|
||||
if (item.getDelFlag() == 1) {
|
||||
throw new RuntimeException("此【" + itemCode + "】物料已删除");
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据物料编码集合查询物料信息
|
||||
*
|
||||
* @param itemCodes 物料编码集合
|
||||
* @return List<ItemEntity>
|
||||
*/
|
||||
public List<Item> queryByItemCodes(List<String> itemCodes) {
|
||||
if (CollectionUtils.isEmpty(itemCodes)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
//查询物料
|
||||
LambdaQueryWrapper<Item> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(Item::getItemCode, itemCodes);
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据物料编码集合查询物料信息
|
||||
*
|
||||
* @param itemCodes 物料集合
|
||||
* @return Map<String, ItemEntity>
|
||||
*/
|
||||
public Map<String, Item> queryByItemCodesToMap(List<String> itemCodes) {
|
||||
if (CollectionUtils.isEmpty(itemCodes)) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
//查询物料
|
||||
List<Item> itemList = queryByItemCodes(itemCodes);
|
||||
//封装成map
|
||||
Map<String, Item> itemMap = Maps.newHashMap();
|
||||
for (Item item : itemList) {
|
||||
itemMap.put(item.getItemCode(), item);
|
||||
}
|
||||
return itemMap;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,19 +1,117 @@
|
|||
package org.cpte.modules.base.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.google.common.collect.Maps;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.cpte.modules.base.entity.Area;
|
||||
import org.cpte.modules.base.entity.Point;
|
||||
import org.cpte.modules.base.mapper.AreaMapper;
|
||||
import org.cpte.modules.base.mapper.PointMapper;
|
||||
import org.cpte.modules.base.service.IAreaService;
|
||||
import org.cpte.modules.base.service.IPointService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 库位
|
||||
* @author: cpte
|
||||
* @Date: 2025-10-28
|
||||
* @Date: 2025-10-28
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class PointServiceImpl extends ServiceImpl<PointMapper, Point> implements IPointService {
|
||||
|
||||
@Autowired
|
||||
private IAreaService iAreaService;
|
||||
|
||||
/**
|
||||
* 验证库位
|
||||
*
|
||||
* @param pointCode 库位编码
|
||||
* @return Point
|
||||
*/
|
||||
@Override
|
||||
public Point validatePoint(String pointCode) {
|
||||
LambdaQueryWrapper<Point> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(Point::getPointCode, pointCode);
|
||||
Point point = this.getOne(queryWrapper);
|
||||
if (point == null) {
|
||||
throw new RuntimeException("系统无【" + pointCode + "】库位,请维护");
|
||||
}
|
||||
if (point.getIzActive() == 0) {
|
||||
throw new RuntimeException("此【" + pointCode + "】库位已禁用");
|
||||
}
|
||||
if (point.getDelFlag() == 1) {
|
||||
throw new RuntimeException("此【" + pointCode + "】库位已删除");
|
||||
}
|
||||
return point;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据库位编码集合查询库位信息
|
||||
*
|
||||
* @param pointCodes 库位编码集合
|
||||
* @return List<PointEntity>
|
||||
*/
|
||||
public List<Point> queryByPointCodes(List<String> pointCodes) {
|
||||
if (CollectionUtils.isEmpty(pointCodes)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
//查询库位
|
||||
LambdaQueryWrapper<Point> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(Point::getPointCode, pointCodes);
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据库位编码集合查询库位信息
|
||||
*
|
||||
* @param pointCodes 库位集合
|
||||
* @return Map<String, PointEntity>
|
||||
*/
|
||||
public Map<String, Point> queryByPointCodesToMap(List<String> pointCodes) {
|
||||
if (CollectionUtils.isEmpty(pointCodes)) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
//查询库位
|
||||
List<Point> PointList = queryByPointCodes(pointCodes);
|
||||
//封装成map
|
||||
Map<String, Point> PointMap = Maps.newHashMap();
|
||||
for (Point Point : PointList) {
|
||||
PointMap.put(Point.getPointCode(), Point);
|
||||
}
|
||||
return PointMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Point> queryPoints(String pointCode, Integer status, String areaName) {
|
||||
//查询库位
|
||||
LambdaQueryWrapper<Point> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
//点位编码
|
||||
if (StringUtils.isNotBlank(pointCode)) {
|
||||
queryWrapper.eq(Point::getPointCode, pointCode);
|
||||
}
|
||||
|
||||
//状态
|
||||
if (status != null) {
|
||||
queryWrapper.eq(Point::getStatus, status);
|
||||
}
|
||||
|
||||
//库区
|
||||
if (StringUtils.isNotBlank(areaName)) {
|
||||
Area area = iAreaService.validateArea(areaName);
|
||||
queryWrapper.eq(Point::getAreaId, area.getId());
|
||||
}
|
||||
|
||||
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,19 +1,88 @@
|
|||
package org.cpte.modules.base.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.google.common.collect.Maps;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.cpte.modules.base.entity.Stock;
|
||||
import org.cpte.modules.base.entity.Stock;
|
||||
import org.cpte.modules.base.mapper.StockMapper;
|
||||
import org.cpte.modules.base.mapper.StockMapper;
|
||||
import org.cpte.modules.base.service.IStockService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @Description: 容器
|
||||
* @author: cpte
|
||||
* @Date: 2025-10-28
|
||||
* @Date: 2025-10-28
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements IStockService {
|
||||
|
||||
/**
|
||||
* 验证容器
|
||||
*
|
||||
* @param StockCode 容器编码
|
||||
* @return Stock
|
||||
*/
|
||||
@Override
|
||||
public Stock validateStock(String StockCode) {
|
||||
LambdaQueryWrapper<Stock> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(Stock::getStockCode, StockCode);
|
||||
Stock stock = this.getOne(queryWrapper);
|
||||
if (stock == null) {
|
||||
throw new RuntimeException("系统无【" + StockCode + "】容器,请维护");
|
||||
}
|
||||
if(stock.getIzActive()==0){
|
||||
throw new RuntimeException("此【" + StockCode + "】容器已禁用");
|
||||
}
|
||||
if(stock.getDelFlag()==1){
|
||||
throw new RuntimeException("此【" + StockCode + "】容器已删除");
|
||||
}
|
||||
return stock;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据容器编码集合查询容器信息
|
||||
*
|
||||
* @param stockCodes 容器料编码集合
|
||||
* @return List<StockEntity>
|
||||
*/
|
||||
public List<Stock> queryByStockCodes(List<String> stockCodes) {
|
||||
if (CollectionUtils.isEmpty(stockCodes)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
LambdaQueryWrapper<Stock> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(Stock::getStockCode, stockCodes);
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据容器编码集合查询容器信息
|
||||
*
|
||||
* @param stockCodes 容器编码集合
|
||||
* @return Map<String, StockEntity>
|
||||
*/
|
||||
public Map<String, Stock> queryByStockCodesToMap(List<String> stockCodes) {
|
||||
if (CollectionUtils.isEmpty(stockCodes)) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
//查询容器
|
||||
List<Stock> stockList = queryByStockCodes(stockCodes);
|
||||
//封装map
|
||||
Map<String, Stock> stockMap = Maps.newHashMap();
|
||||
for (Stock stock : stockList) {
|
||||
stockMap.put(stock.getStockCode(), stock);
|
||||
}
|
||||
return stockMap;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
package org.cpte.modules.constant.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* agvTask任务状态
|
||||
*
|
||||
* @author: cpte
|
||||
*/
|
||||
@Getter
|
||||
public enum AgvStatusEnum {
|
||||
|
||||
CREATED("CREATED", "已创建"),
|
||||
|
||||
EXECUTING("EXECUTING", "执行中"),
|
||||
|
||||
ARRIVED("ARRIVED", "已到达"),
|
||||
|
||||
COMPLETED("COMPLETED", "已完成"),
|
||||
|
||||
CANCELLED("CANCELLED", "已取消"),
|
||||
|
||||
;
|
||||
/**
|
||||
* 值
|
||||
*/
|
||||
private final String value;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private final String desc;
|
||||
|
||||
AgvStatusEnum(String value, String desc) {
|
||||
this.value = value;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package org.cpte.modules.constant.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum AreaTypeEnum {
|
||||
|
||||
RKQ("RKQ", "入库区"),
|
||||
|
||||
CKQ("CKQ", "出库区"),
|
||||
|
||||
CTQ("CTQ", "拆托区"),
|
||||
|
||||
RK_DOCK("RK_DOCK", "入库输送线接驳口"),
|
||||
|
||||
CK_DOCK("CK_DOCK", "出库输送线接驳口"),
|
||||
;
|
||||
/**
|
||||
* 值
|
||||
*/
|
||||
private final String value;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private final String desc;
|
||||
|
||||
AreaTypeEnum(String value, String desc) {
|
||||
this.value = value;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
package org.cpte.modules.constant.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 入库单状态
|
||||
*
|
||||
* @author: cpte
|
||||
*/
|
||||
@Getter
|
||||
public enum AsnStatusEnum {
|
||||
|
||||
CREATED("CREATED", "已创建"),
|
||||
|
||||
ACTIVE("ACTIVE", "已审核"),
|
||||
|
||||
RECEIVING("RECEIVING", "部分收货"),
|
||||
|
||||
RECEIVED("RECEIVED", "收货完成"),
|
||||
|
||||
CLOSE("CLOSE", "已关闭"),
|
||||
|
||||
CANCEL("CANCEL", "已取消"),
|
||||
|
||||
;
|
||||
|
||||
AsnStatusEnum(String value, String desc) {
|
||||
this.value = value;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* 值
|
||||
*/
|
||||
final String value;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
final String desc;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package org.cpte.modules.constant.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 业务类型枚举
|
||||
*
|
||||
* @author: cpte
|
||||
*/
|
||||
@Getter
|
||||
public enum BusinessTypeEnum {
|
||||
|
||||
INBOUND("INBOUND", "入库"),
|
||||
|
||||
OUTBOUND("OUTBOUND", "出库"),
|
||||
|
||||
INVENTORY("INVENTORY", "盘点");
|
||||
|
||||
private final String value;
|
||||
private final String desc;
|
||||
|
||||
BusinessTypeEnum(String value, String desc) {
|
||||
this.value = value;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package org.cpte.modules.constant.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 通用状态枚举
|
||||
*
|
||||
* @author: cpte
|
||||
*/
|
||||
@Getter
|
||||
public enum CommonStatusEnum {
|
||||
|
||||
FREE(0, "空闲"),
|
||||
|
||||
USED(1, "占用"),
|
||||
|
||||
;
|
||||
/**
|
||||
* 值
|
||||
*/
|
||||
private final Integer value;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private final String desc;
|
||||
|
||||
CommonStatusEnum(Integer value, String desc) {
|
||||
this.value = value;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package org.cpte.modules.constant.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum StockTypeEnum {
|
||||
BOX("BOX", "料箱"),
|
||||
|
||||
TRAY("TRAY", "托盘"),
|
||||
|
||||
RACK("RECEIVING", "货架"),
|
||||
|
||||
;
|
||||
|
||||
StockTypeEnum(String value, String desc) {
|
||||
this.value = value;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* 值
|
||||
*/
|
||||
final String value;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
final String desc;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,274 @@
|
|||
package org.cpte.modules.receive.controller;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.io.IOException;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.HashMap;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.cpte.modules.utils.CodeGeneratorUtil;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.query.QueryRuleEnum;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.cpte.modules.receive.entity.AsnDetail;
|
||||
import org.cpte.modules.receive.entity.Asn;
|
||||
import org.cpte.modules.receive.vo.AsnPage;
|
||||
import org.cpte.modules.receive.service.IAsnService;
|
||||
import org.cpte.modules.receive.service.IAsnDetailService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 入库单
|
||||
* @author: cpte
|
||||
* @Date: 2025-11-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Tag(name="入库单")
|
||||
@RestController
|
||||
@RequestMapping("/receive/asn")
|
||||
@Slf4j
|
||||
public class AsnController {
|
||||
@Autowired
|
||||
private IAsnService asnService;
|
||||
@Autowired
|
||||
private IAsnDetailService asnDetailService;
|
||||
@Autowired
|
||||
private CodeGeneratorUtil codeGeneratorUtil;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param asn
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "入库单-分页列表查询")
|
||||
@Operation(summary="入库单-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<Asn>> queryPageList(Asn asn,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<Asn> queryWrapper = QueryGenerator.initQueryWrapper(asn, req.getParameterMap());
|
||||
Page<Asn> page = new Page<Asn>(pageNo, pageSize);
|
||||
IPage<Asn> pageList = asnService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param asnPage
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "入库单-添加")
|
||||
@Operation(summary="入库单-添加")
|
||||
@RequiresPermissions("receive:data_asn:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody AsnPage asnPage) {
|
||||
Asn asn = new Asn();
|
||||
asn.setOrderNo(codeGeneratorUtil.generateCode("RK"));
|
||||
BeanUtils.copyProperties(asnPage, asn);
|
||||
asnService.saveMain(asn, asnPage.getAsnDetailList());
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param asnPage
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "入库单-编辑")
|
||||
@Operation(summary="入库单-编辑")
|
||||
@RequiresPermissions("receive:data_asn:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody AsnPage asnPage) {
|
||||
Asn existingAsn = asnService.getById(asnPage.getId());
|
||||
if(existingAsn==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
// 将更新数据从 asnPage 复制到 existingAsn
|
||||
BeanUtils.copyProperties(asnPage, existingAsn);
|
||||
asnService.updateMain(existingAsn, asnPage.getAsnDetailList());
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "入库单-通过id删除")
|
||||
@Operation(summary="入库单-通过id删除")
|
||||
@RequiresPermissions("receive:data_asn:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
asnService.delMain(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "入库单-批量删除")
|
||||
@Operation(summary="入库单-批量删除")
|
||||
@RequiresPermissions("receive:data_asn:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.asnService.delBatchMain(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "入库单-通过id查询")
|
||||
@Operation(summary="入库单-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<Asn> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
Asn asn = asnService.getById(id);
|
||||
if(asn==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(asn);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "入库明细通过主表ID查询")
|
||||
@Operation(summary="入库明细主表ID查询")
|
||||
@GetMapping(value = "/queryAsnDetailByMainId")
|
||||
public Result<List<AsnDetail>> queryAsnDetailListByMainId(@RequestParam(name="id",required=true) String id) {
|
||||
List<AsnDetail> asnDetailList = asnDetailService.selectByMainId(id);
|
||||
return Result.OK(asnDetailList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param asn
|
||||
*/
|
||||
@RequiresPermissions("receive:data_asn:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, Asn asn) {
|
||||
|
||||
// Step.1 组装查询条件查询数据
|
||||
QueryWrapper<Asn> queryWrapper = QueryGenerator.initQueryWrapper(asn, request.getParameterMap());
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
|
||||
//配置选中数据查询条件
|
||||
String selections = request.getParameter("selections");
|
||||
if(oConvertUtils.isNotEmpty(selections)) {
|
||||
List<String> selectionList = Arrays.asList(selections.split(","));
|
||||
queryWrapper.in("id",selectionList);
|
||||
}
|
||||
//Step.2 获取导出数据
|
||||
List<Asn> asnList = asnService.list(queryWrapper);
|
||||
|
||||
// Step.3 组装pageList
|
||||
List<AsnPage> pageList = new ArrayList<AsnPage>();
|
||||
for (Asn main : asnList) {
|
||||
AsnPage vo = new AsnPage();
|
||||
BeanUtils.copyProperties(main, vo);
|
||||
List<AsnDetail> asnDetailList = asnDetailService.selectByMainId(main.getId());
|
||||
vo.setAsnDetailList(asnDetailList);
|
||||
pageList.add(vo);
|
||||
}
|
||||
|
||||
// Step.4 AutoPoi 导出Excel
|
||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
||||
mv.addObject(NormalExcelConstants.FILE_NAME, "入库单列表");
|
||||
mv.addObject(NormalExcelConstants.CLASS, AsnPage.class);
|
||||
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("入库单数据", "导出人:"+sysUser.getRealname(), "入库单"));
|
||||
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
|
||||
return mv;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("receive:data_asn:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
||||
// 获取上传文件对象
|
||||
MultipartFile file = entity.getValue();
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(2);
|
||||
params.setHeadRows(1);
|
||||
params.setNeedSave(true);
|
||||
try {
|
||||
List<AsnPage> list = ExcelImportUtil.importExcel(file.getInputStream(), AsnPage.class, params);
|
||||
for (AsnPage page : list) {
|
||||
Asn po = new Asn();
|
||||
BeanUtils.copyProperties(page, po);
|
||||
asnService.saveMain(po, page.getAsnDetailList());
|
||||
}
|
||||
return Result.OK("文件导入成功!数据行数:" + list.size());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(),e);
|
||||
return Result.error("文件导入失败:"+e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.OK("文件导入失败!");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,145 @@
|
|||
package org.cpte.modules.receive.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.jeecg.common.constant.ProvinceCityArea;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* @Description: 入库单
|
||||
* @author: cpte
|
||||
* @Date: 2025-11-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Schema(description = "入库单")
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName("data_asn")
|
||||
public class Asn implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "主键")
|
||||
private java.lang.String id;
|
||||
/**
|
||||
* 系统单号
|
||||
*/
|
||||
@Excel(name = "系统单号", width = 15)
|
||||
@Schema(description = "系统单号")
|
||||
private java.lang.String orderNo;
|
||||
/**
|
||||
* 外部单号
|
||||
*/
|
||||
@Excel(name = "外部单号", width = 15)
|
||||
@Schema(description = "外部单号")
|
||||
private java.lang.String thirdPartyOrderNo;
|
||||
/**
|
||||
* 任务号
|
||||
*/
|
||||
@Excel(name = "任务号", width = 15)
|
||||
@Schema(description = "任务号")
|
||||
private java.lang.String no;
|
||||
/**
|
||||
* 外部仓库
|
||||
*/
|
||||
@Excel(name = "外部仓库", width = 15)
|
||||
@Schema(description = "外部仓库")
|
||||
private java.lang.String whCode;
|
||||
/**
|
||||
* 供应商
|
||||
*/
|
||||
@Excel(name = "供应商", width = 15)
|
||||
@Schema(description = "供应商")
|
||||
private java.lang.String supplierCode;
|
||||
/**
|
||||
* 单据类型
|
||||
* 0.成品入库;1.配件入库;2.成品拆托入库;3.配件拆托入库;4.成品出库;5.配件出库;6.返工出库;7.检验出库;8.其他出库
|
||||
*/
|
||||
@Excel(name = "单据类型", width = 15)
|
||||
@Schema(description = "单据类型")
|
||||
@Dict(dicCode = "asn_order_type")
|
||||
private java.lang.Integer orderType;
|
||||
/**
|
||||
* 订单状态
|
||||
*/
|
||||
@Excel(name = "订单状态", width = 15)
|
||||
@Schema(description = "订单状态")
|
||||
@Dict(dicCode = "asn_status")
|
||||
private java.lang.String status;
|
||||
/**
|
||||
* 需求数量
|
||||
*/
|
||||
@Excel(name = "需求数量", width = 15)
|
||||
@Schema(description = "需求数量")
|
||||
private java.math.BigDecimal orderQty;
|
||||
/**
|
||||
* 收货数量
|
||||
*/
|
||||
@Excel(name = "收货数量", width = 15)
|
||||
@Schema(description = "收货数量")
|
||||
private java.math.BigDecimal receivedQty;
|
||||
/**
|
||||
* 订单日期
|
||||
*/
|
||||
@Excel(name = "订单日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "订单日期")
|
||||
private java.util.Date orderDate;
|
||||
/**
|
||||
* 所属部门
|
||||
*/
|
||||
@Schema(description = "所属部门")
|
||||
private java.lang.String sysOrgCode;
|
||||
/**
|
||||
* 仓库ID
|
||||
*/
|
||||
@Excel(name = "仓库ID", width = 15)
|
||||
@Schema(description = "仓库ID")
|
||||
private java.lang.Integer tenantId;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@Schema(description = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**
|
||||
* 创建日期
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
@Schema(description = "更新人")
|
||||
private java.lang.String updateBy;
|
||||
/**
|
||||
* 更新日期
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
}
|
||||
|
|
@ -0,0 +1,188 @@
|
|||
package org.cpte.modules.receive.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.jeecg.common.constant.ProvinceCityArea;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
/**
|
||||
* @Description: 入库明细
|
||||
* @author: cpte
|
||||
* @Date: 2025-11-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Schema(description = "入库明细")
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName("data_asn_detail")
|
||||
public class AsnDetail implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "主键")
|
||||
private java.lang.String id;
|
||||
/**
|
||||
* 入库单
|
||||
*/
|
||||
@Schema(description = "入库单")
|
||||
private java.lang.String asnId;
|
||||
/**
|
||||
* 物料
|
||||
*/
|
||||
@Excel(name = "物料", width = 15)
|
||||
@Schema(description = "物料")
|
||||
private java.lang.String itemId;
|
||||
|
||||
/**
|
||||
* 容器
|
||||
*/
|
||||
@Excel(name = "容器", width = 15)
|
||||
@Schema(description = "容器")
|
||||
private java.lang.String stockId;
|
||||
/**
|
||||
* 库位
|
||||
*/
|
||||
@Excel(name = "库位", width = 15)
|
||||
@Schema(description = "库位")
|
||||
private java.lang.String pointId;
|
||||
/**
|
||||
* 行号
|
||||
*/
|
||||
@Excel(name = "行号", width = 15)
|
||||
@Schema(description = "行号")
|
||||
private java.lang.Integer lineNo;
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
@Excel(name = "单位", width = 15)
|
||||
@Schema(description = "单位")
|
||||
private java.lang.String unit;
|
||||
/**
|
||||
* 项目号
|
||||
*/
|
||||
@Excel(name = "项目号", width = 15)
|
||||
@Schema(description = "项目号")
|
||||
private java.lang.String project;
|
||||
/**
|
||||
* 任务号
|
||||
*/
|
||||
@Excel(name = "任务号", width = 15)
|
||||
@Schema(description = "任务号")
|
||||
private java.lang.String taskNo;
|
||||
/**
|
||||
* 需求数量
|
||||
*/
|
||||
@Excel(name = "需求数量", width = 15)
|
||||
@Schema(description = "需求数量")
|
||||
private java.math.BigDecimal orderQty;
|
||||
/**
|
||||
* 收货数量
|
||||
*/
|
||||
@Excel(name = "收货数量", width = 15)
|
||||
@Schema(description = "收货数量")
|
||||
private java.math.BigDecimal receivedQty;
|
||||
/**
|
||||
* 批次号
|
||||
*/
|
||||
@Excel(name = "批次号", width = 15)
|
||||
@Schema(description = "批次号")
|
||||
private java.lang.String propC1;
|
||||
/**
|
||||
* 序列号
|
||||
*/
|
||||
@Excel(name = "序列号", width = 15)
|
||||
@Schema(description = "序列号")
|
||||
private java.lang.String propC2;
|
||||
/**
|
||||
* 库存状态
|
||||
*/
|
||||
@Excel(name = "库存状态", width = 15)
|
||||
@Schema(description = "库存状态")
|
||||
private java.lang.String propC3;
|
||||
/**
|
||||
* 扩展字段
|
||||
*/
|
||||
@Excel(name = "扩展字段", width = 15)
|
||||
@Schema(description = "扩展字段")
|
||||
private java.lang.String propC4;
|
||||
/**
|
||||
* 生产日期
|
||||
*/
|
||||
@Excel(name = "生产日期", width = 15, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@Schema(description = "生产日期")
|
||||
private java.util.Date propD1;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Excel(name = "备注", width = 15)
|
||||
@Schema(description = "备注")
|
||||
private java.lang.String description;
|
||||
/**
|
||||
* 来源ID
|
||||
*/
|
||||
@Excel(name = "来源ID", width = 15)
|
||||
@Schema(description = "来源ID")
|
||||
private java.lang.String sourceId;
|
||||
/**
|
||||
* 来源
|
||||
*/
|
||||
@Excel(name = "来源", width = 15)
|
||||
@Schema(description = "来源")
|
||||
private java.lang.String sourceName;
|
||||
/**
|
||||
* 仓库ID
|
||||
*/
|
||||
@Excel(name = "仓库ID", width = 15)
|
||||
@Schema(description = "仓库ID")
|
||||
private java.lang.Integer tenantId;
|
||||
/**
|
||||
* 所属部门
|
||||
*/
|
||||
@Schema(description = "所属部门")
|
||||
private java.lang.String sysOrgCode;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@Schema(description = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**
|
||||
* 创建日期
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
@Schema(description = "更新人")
|
||||
private java.lang.String updateBy;
|
||||
/**
|
||||
* 更新日期
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package org.cpte.modules.receive.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import org.cpte.modules.receive.entity.AsnDetail;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @Description: 入库明细
|
||||
* @author: cpte
|
||||
* @Date: 2025-11-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface AsnDetailMapper extends BaseMapper<AsnDetail> {
|
||||
|
||||
/**
|
||||
* 通过主表id删除子表数据
|
||||
*
|
||||
* @param mainId 主表id
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean deleteByMainId(@Param("mainId") String mainId);
|
||||
|
||||
/**
|
||||
* 通过主表id查询子表数据
|
||||
*
|
||||
* @param mainId 主表id
|
||||
* @return List<AsnDetail>
|
||||
*/
|
||||
public List<AsnDetail> selectByMainId(@Param("mainId") String mainId);
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package org.cpte.modules.receive.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.cpte.modules.receive.entity.Asn;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 入库单
|
||||
* @author: cpte
|
||||
* @Date: 2025-11-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface AsnMapper extends BaseMapper<Asn> {
|
||||
/**
|
||||
* 根据任务号查询入库单
|
||||
*
|
||||
* @param no 任务号
|
||||
* @return Asn
|
||||
*/
|
||||
@Select("select * from data_asn where no = #{no}")
|
||||
Asn queryByNo(@Param("no") String no);
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.cpte.modules.receive.mapper.AsnDetailMapper">
|
||||
|
||||
<delete id="deleteByMainId" parameterType="java.lang.String">
|
||||
DELETE
|
||||
FROM data_asn_detail
|
||||
WHERE
|
||||
asn_id = #{mainId} </delete>
|
||||
|
||||
<select id="selectByMainId" parameterType="java.lang.String" resultType="org.cpte.modules.receive.entity.AsnDetail">
|
||||
SELECT *
|
||||
FROM data_asn_detail
|
||||
WHERE
|
||||
asn_id = #{mainId} </select>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.cpte.modules.receive.mapper.AsnMapper">
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package org.cpte.modules.receive.service;
|
||||
|
||||
import org.cpte.modules.receive.entity.AsnDetail;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 入库明细
|
||||
* @author: cpte
|
||||
* @Date: 2025-11-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IAsnDetailService extends IService<AsnDetail> {
|
||||
|
||||
/**
|
||||
* 通过主表id查询子表数据
|
||||
*
|
||||
* @param mainId 主表id
|
||||
* @return List<AsnDetail>
|
||||
*/
|
||||
public List<AsnDetail> selectByMainId(String mainId);
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
package org.cpte.modules.receive.service;
|
||||
|
||||
import org.cpte.modules.receive.entity.AsnDetail;
|
||||
import org.cpte.modules.receive.entity.Asn;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 入库单
|
||||
* @author: cpte
|
||||
* @Date: 2025-11-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IAsnService extends IService<Asn> {
|
||||
|
||||
/**
|
||||
* 添加一对多
|
||||
*
|
||||
* @param asn
|
||||
* @param asnDetailList
|
||||
*/
|
||||
public void saveMain(Asn asn,List<AsnDetail> asnDetailList) ;
|
||||
|
||||
/**
|
||||
* 修改一对多
|
||||
*
|
||||
* @param asn
|
||||
* @param asnDetailList
|
||||
*/
|
||||
public void updateMain(Asn asn,List<AsnDetail> asnDetailList);
|
||||
|
||||
/**
|
||||
* 删除一对多
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public void delMain (String id);
|
||||
|
||||
/**
|
||||
* 批量删除一对多
|
||||
*
|
||||
* @param idList
|
||||
*/
|
||||
public void delBatchMain (Collection<? extends Serializable> idList);
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package org.cpte.modules.receive.service.impl;
|
||||
|
||||
import org.cpte.modules.receive.entity.AsnDetail;
|
||||
import org.cpte.modules.receive.mapper.AsnDetailMapper;
|
||||
import org.cpte.modules.receive.service.IAsnDetailService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* @Description: 入库明细
|
||||
* @author: cpte
|
||||
* @Date: 2025-11-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class AsnDetailServiceImpl extends ServiceImpl<AsnDetailMapper, AsnDetail> implements IAsnDetailService {
|
||||
|
||||
@Autowired
|
||||
private AsnDetailMapper asnDetailMapper;
|
||||
|
||||
@Override
|
||||
public List<AsnDetail> selectByMainId(String mainId) {
|
||||
return asnDetailMapper.selectByMainId(mainId);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
package org.cpte.modules.receive.service.impl;
|
||||
|
||||
import org.cpte.modules.constant.enums.AsnStatusEnum;
|
||||
import org.cpte.modules.receive.entity.Asn;
|
||||
import org.cpte.modules.receive.entity.AsnDetail;
|
||||
import org.cpte.modules.receive.mapper.AsnDetailMapper;
|
||||
import org.cpte.modules.receive.mapper.AsnMapper;
|
||||
import org.cpte.modules.receive.service.IAsnService;
|
||||
import org.cpte.modules.utils.BigDecimalUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
* @Description: 入库单
|
||||
* @author: cpte
|
||||
* @Date: 2025-11-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class AsnServiceImpl extends ServiceImpl<AsnMapper, Asn> implements IAsnService {
|
||||
|
||||
@Autowired
|
||||
private AsnMapper asnMapper;
|
||||
@Autowired
|
||||
private AsnDetailMapper asnDetailMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveMain(Asn asn, List<AsnDetail> asnDetailList) {
|
||||
asnMapper.insert(asn);
|
||||
if (asnDetailList != null && !asnDetailList.isEmpty()) {
|
||||
AtomicInteger lineNoCounter = new AtomicInteger(1);
|
||||
for (AsnDetail entity : asnDetailList) {
|
||||
if (entity.getLineNo() == null || entity.getLineNo() == 0) {
|
||||
entity.setLineNo(lineNoCounter.getAndIncrement());
|
||||
}
|
||||
entity.setAsnId(asn.getId());
|
||||
asnDetailMapper.insert(entity);
|
||||
}
|
||||
|
||||
}
|
||||
//刷新入库单
|
||||
refreshAsn(asn, asnDetailList);
|
||||
}
|
||||
|
||||
public void refreshAsn(Asn asn, List<AsnDetail> asnDetails) {
|
||||
|
||||
if (asnDetails == null) {
|
||||
asnDetails = new ArrayList<>();
|
||||
}
|
||||
|
||||
//需求数量
|
||||
BigDecimal orderQty = asnDetails.stream().map(AsnDetail::getOrderQty).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
|
||||
//收货数量
|
||||
BigDecimal receivedQty = asnDetails.stream().map(AsnDetail::getReceivedQty).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
|
||||
//当前状态
|
||||
String status = asn.getStatus();
|
||||
|
||||
if (orderQty.compareTo(BigDecimal.ZERO) >= 0 && receivedQty.compareTo(BigDecimal.ZERO) == 0) {
|
||||
status = AsnStatusEnum.CREATED.getValue();
|
||||
} else if (BigDecimalUtil.subtract(orderQty, receivedQty, 0).compareTo(BigDecimal.ZERO) > 0 && receivedQty.compareTo(BigDecimal.ZERO) > 0) {
|
||||
status = AsnStatusEnum.RECEIVING.getValue();
|
||||
} else if (BigDecimalUtil.subtract(orderQty, receivedQty, 0).compareTo(BigDecimal.ZERO) == 0 && receivedQty.compareTo(BigDecimal.ZERO) > 0) {
|
||||
status = AsnStatusEnum.RECEIVED.getValue();
|
||||
}
|
||||
|
||||
asn.setOrderQty(orderQty);
|
||||
asn.setReceivedQty(receivedQty);
|
||||
asn.setStatus(status);
|
||||
asnMapper.updateById(asn);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateMain(Asn asn, List<AsnDetail> asnDetailList) {
|
||||
asnMapper.updateById(asn);
|
||||
|
||||
//1.先删除子表数据
|
||||
asnDetailMapper.deleteByMainId(asn.getId());
|
||||
|
||||
//2.子表数据重新插入
|
||||
if (asnDetailList != null && !asnDetailList.isEmpty()) {
|
||||
AtomicInteger lineNoCounter = new AtomicInteger(1);
|
||||
for (AsnDetail entity : asnDetailList) {
|
||||
if (entity.getLineNo() == null || entity.getLineNo() == 0) {
|
||||
entity.setLineNo(lineNoCounter.getAndIncrement());
|
||||
}
|
||||
entity.setAsnId(asn.getId());
|
||||
asnDetailMapper.insert(entity);
|
||||
}
|
||||
}
|
||||
refreshAsn(asn, asnDetailList);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delMain(String id) {
|
||||
asnDetailMapper.deleteByMainId(id);
|
||||
asnMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delBatchMain(Collection<? extends Serializable> idList) {
|
||||
for (Serializable id : idList) {
|
||||
asnDetailMapper.deleteByMainId(id.toString());
|
||||
asnMapper.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,138 @@
|
|||
package org.cpte.modules.receive.vo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.cpte.modules.receive.entity.Asn;
|
||||
import org.cpte.modules.receive.entity.AsnDetail;
|
||||
import lombok.Data;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecgframework.poi.excel.annotation.ExcelEntity;
|
||||
import org.jeecgframework.poi.excel.annotation.ExcelCollection;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.jeecg.common.constant.ProvinceCityArea;
|
||||
import org.jeecg.common.util.SpringContextUtils;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* @Description: 入库单
|
||||
* @author: cpte
|
||||
* @Date: 2025-11-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "入库单")
|
||||
public class AsnPage {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Schema(description = "主键")
|
||||
private java.lang.String id;
|
||||
|
||||
@Excel(name = "外部单号", width = 15)
|
||||
@Schema(description = "外部单号")
|
||||
private java.lang.String thirdPartyOrderNo;
|
||||
|
||||
/**
|
||||
* 任务号
|
||||
*/
|
||||
@Excel(name = "任务号", width = 15)
|
||||
@Schema(description = "任务号")
|
||||
private java.lang.String no;
|
||||
|
||||
/**
|
||||
* 外部仓库
|
||||
*/
|
||||
@Excel(name = "外部仓库", width = 15)
|
||||
@Schema(description = "外部仓库")
|
||||
private java.lang.String whCode;
|
||||
|
||||
/**
|
||||
* 供应商
|
||||
*/
|
||||
@Excel(name = "供应商", width = 15)
|
||||
@Schema(description = "供应商")
|
||||
private java.lang.String supplierCode;
|
||||
|
||||
/**
|
||||
* 单据类型
|
||||
* 0.成品入库;1.配件入库;2.成品拆托入库;3.配件拆托入库;4.成品出库;5.配件出库;6.返工出库;7.检验出库;8.其他出库
|
||||
*/
|
||||
@Excel(name = "单据类型", width = 15)
|
||||
@Schema(description = "单据类型")
|
||||
private java.lang.Integer orderType;
|
||||
|
||||
/**
|
||||
* 订单状态
|
||||
*/
|
||||
@Excel(name = "订单状态", width = 15)
|
||||
@Schema(description = "订单状态")
|
||||
private java.lang.String status;
|
||||
|
||||
/**
|
||||
* 需求数量
|
||||
*/
|
||||
@Excel(name = "需求数量", width = 15)
|
||||
@Schema(description = "需求数量")
|
||||
private java.math.BigDecimal orderQty;
|
||||
/**
|
||||
* 收货数量
|
||||
*/
|
||||
@Excel(name = "收货数量", width = 15)
|
||||
@Schema(description = "收货数量")
|
||||
private java.math.BigDecimal receivedQty;
|
||||
/**
|
||||
* 订单日期
|
||||
*/
|
||||
@Excel(name = "订单日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "订单日期")
|
||||
private java.util.Date orderDate;
|
||||
/**
|
||||
* 所属部门
|
||||
*/
|
||||
@Schema(description = "所属部门")
|
||||
private java.lang.String sysOrgCode;
|
||||
/**
|
||||
* 仓库ID
|
||||
*/
|
||||
@Excel(name = "仓库ID", width = 15)
|
||||
@Schema(description = "仓库ID")
|
||||
private java.lang.String tenantId;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@Schema(description = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**
|
||||
* 创建日期
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
@Schema(description = "更新人")
|
||||
private java.lang.String updateBy;
|
||||
/**
|
||||
* 更新日期
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
|
||||
@ExcelCollection(name = "入库明细")
|
||||
@Schema(description = "入库明细")
|
||||
private List<AsnDetail> asnDetailList;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
package org.cpte.modules.saiWms.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import kotlin.jvm.Volatile;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.cpte.modules.base.entity.Area;
|
||||
import org.cpte.modules.base.service.IAreaService;
|
||||
import org.cpte.modules.saiWms.request.inbound.InboundRequest;
|
||||
import org.cpte.modules.saiWms.service.IInBoundService;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.config.shiro.IgnoreAuth;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Tag(name = "赛意WMS")
|
||||
@RestController
|
||||
@RequestMapping("/saiWms/inBound")
|
||||
@Slf4j
|
||||
public class InBoundController {
|
||||
|
||||
@Autowired
|
||||
private IInBoundService iInBoundService;
|
||||
|
||||
/**
|
||||
* 入库任务下发
|
||||
*
|
||||
* @param inboundRequest 请求参数
|
||||
*/
|
||||
@AutoLog(value = "入库任务下发")
|
||||
@Operation(summary = "赛意WMS-入库任务下发")
|
||||
@PostMapping(value = "/inBoundTask")
|
||||
@IgnoreAuth
|
||||
public Result<String> inBoundTask(@RequestBody @Valid InboundRequest inboundRequest) {
|
||||
iInBoundService.inBoundTask(inboundRequest);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package org.cpte.modules.saiWms.request.inbound;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class InboundDetail {
|
||||
// 行号
|
||||
@NotBlank(message = "行号不能为空")
|
||||
@JsonProperty("LineNo")
|
||||
private String lineNo;
|
||||
|
||||
// 物料
|
||||
@NotBlank(message = "物料不能为空")
|
||||
@JsonProperty("Item")
|
||||
private String item;
|
||||
|
||||
// 单位
|
||||
@NotBlank(message = "单位不能为空")
|
||||
@JsonProperty("Unit")
|
||||
private String unit;
|
||||
|
||||
// 数量
|
||||
@NotNull(message = "数量不能为空")
|
||||
@JsonProperty("Qty")
|
||||
private BigDecimal qty;
|
||||
|
||||
// 托盘号
|
||||
@NotNull(message = "托盘号不能为空")
|
||||
@JsonProperty("Lpn")
|
||||
private String lpn;
|
||||
|
||||
// 项目号
|
||||
@JsonProperty("Project")
|
||||
private String project;
|
||||
|
||||
// 任务号
|
||||
@JsonProperty("TaskNo")
|
||||
private String taskNo;
|
||||
|
||||
// 批次号
|
||||
@JsonProperty("LotAtt04")
|
||||
private String lotAtt04;
|
||||
|
||||
// 库存状态
|
||||
@JsonProperty("LotAtt010")
|
||||
private String lotAtt010;
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
package org.cpte.modules.saiWms.request.inbound;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 赛意WMS-任务下发请求参数
|
||||
*/
|
||||
@Data
|
||||
public class InboundRequest {
|
||||
// 任务号
|
||||
@NotBlank(message = "任务号不能为空")
|
||||
@JsonProperty("No")
|
||||
private String no;
|
||||
|
||||
// 单号
|
||||
@NotBlank(message = "单号不能为空")
|
||||
@JsonProperty("OrderNo")
|
||||
private String orderNo;
|
||||
|
||||
// 仓库
|
||||
@NotBlank(message = "仓库不能为空")
|
||||
@JsonProperty("WhCode")
|
||||
private String whCode;
|
||||
|
||||
// 供应商编码
|
||||
@JsonProperty("SupplierCode")
|
||||
private String supplierCode;
|
||||
|
||||
// 单据类型:0.成品入库;1.配件入库;2.成品拆托入库;3.配件拆托入库;4.成品出库;5.配件出库;6.返工出库;7.检验出库;8.其他出库
|
||||
@NotNull(message = "单据类型不能为空")
|
||||
@JsonProperty("Type")
|
||||
private Integer type;
|
||||
|
||||
// 起点
|
||||
@NotBlank(message = "起点不能为空")
|
||||
@JsonProperty("LocationFrom")
|
||||
private String locationFrom;
|
||||
|
||||
// 入库明细列表
|
||||
@NotNull(message = "入库明细不能为空")
|
||||
@JsonProperty("details")
|
||||
@Valid
|
||||
private List<InboundDetail> details;
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package org.cpte.modules.saiWms.service;
|
||||
|
||||
import org.cpte.modules.saiWms.request.inbound.InboundRequest;
|
||||
|
||||
public interface IInBoundService {
|
||||
/**
|
||||
* 入库任务下发
|
||||
*
|
||||
* @param inboundRequest 请求参数
|
||||
*/
|
||||
void inBoundTask(InboundRequest inboundRequest);
|
||||
}
|
||||
|
|
@ -0,0 +1,139 @@
|
|||
package org.cpte.modules.saiWms.service.impl;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.cpte.modules.agvTask.entity.AgvTask;
|
||||
import org.cpte.modules.agvTask.service.IAgvTaskService;
|
||||
import org.cpte.modules.base.entity.Item;
|
||||
import org.cpte.modules.base.entity.Point;
|
||||
import org.cpte.modules.base.entity.Stock;
|
||||
import org.cpte.modules.base.mapper.ItemMapper;
|
||||
import org.cpte.modules.base.mapper.StockMapper;
|
||||
import org.cpte.modules.base.service.IItemService;
|
||||
import org.cpte.modules.base.service.IPointService;
|
||||
import org.cpte.modules.base.service.IStockService;
|
||||
import org.cpte.modules.constant.enums.*;
|
||||
import org.cpte.modules.receive.entity.Asn;
|
||||
import org.cpte.modules.receive.entity.AsnDetail;
|
||||
import org.cpte.modules.receive.mapper.AsnMapper;
|
||||
import org.cpte.modules.receive.service.IAsnService;
|
||||
import org.cpte.modules.saiWms.request.inbound.InboundDetail;
|
||||
import org.cpte.modules.saiWms.request.inbound.InboundRequest;
|
||||
import org.cpte.modules.saiWms.service.IInBoundService;
|
||||
import org.cpte.modules.utils.CodeGeneratorUtil;
|
||||
import org.jeecg.common.config.TenantContext;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class IInBoundServiceImpl implements IInBoundService {
|
||||
|
||||
@Autowired
|
||||
private AsnMapper asnMapper;
|
||||
|
||||
@Autowired
|
||||
private IItemService itemService;
|
||||
|
||||
@Autowired
|
||||
private IStockService iStockService;
|
||||
|
||||
@Autowired
|
||||
private IPointService iPointService;
|
||||
|
||||
@Autowired
|
||||
private IAsnService asnService;
|
||||
|
||||
@Autowired
|
||||
private IAgvTaskService iAgvTaskService ;
|
||||
|
||||
@Autowired
|
||||
private CodeGeneratorUtil codeGeneratorUtil;
|
||||
|
||||
@Override
|
||||
public void inBoundTask(InboundRequest inboundRequest) {
|
||||
//任务号
|
||||
String no = inboundRequest.getNo();
|
||||
|
||||
// 验证任务号是否存在
|
||||
if (asnMapper.queryByNo(no) != null) {
|
||||
throw new RuntimeException("【" + no + "】" + "任务号系统已接收,请勿重复下发");
|
||||
}
|
||||
|
||||
// 获取唯一的明细
|
||||
InboundDetail detail = inboundRequest.getDetails().get(0);
|
||||
|
||||
// 验证基础数据
|
||||
String srcPointCode = inboundRequest.getLocationFrom();
|
||||
String itemCode = detail.getItem();
|
||||
String stockCode = detail.getLpn();
|
||||
|
||||
Point srcPoint = iPointService.validatePoint(srcPointCode);
|
||||
Item item = itemService.validateItem(itemCode);
|
||||
Stock stock = iStockService.validateStock(stockCode);
|
||||
|
||||
//获取目标库位
|
||||
List<Point> dstPointList = iPointService.queryPoints(null, CommonStatusEnum.FREE.getValue(), AreaTypeEnum.RK_DOCK.getValue());
|
||||
if(dstPointList.isEmpty()){
|
||||
throw new RuntimeException("【" + AreaTypeEnum.RK_DOCK.getDesc() + "】" + "无空闲库位");
|
||||
}
|
||||
Point dstPoint = dstPointList.get(0);
|
||||
|
||||
// 创建入库单和明细
|
||||
Asn createAsn = buildAsn(inboundRequest);
|
||||
AsnDetail asnDetail = buildAsnDetail(detail, srcPoint, item, stock);
|
||||
|
||||
// 保存入库单和入库明细
|
||||
asnService.saveMain(createAsn, Collections.singletonList(asnDetail));
|
||||
|
||||
//创建AGV任务
|
||||
iAgvTaskService.createAgvTask(AgvStatusEnum.CREATED.getValue(), stock.getStockCode(), srcPoint.getPointCode(), dstPoint.getPointCode(), "PF-LMR-COMMON", BusinessTypeEnum.INBOUND.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建入库单
|
||||
*/
|
||||
private Asn buildAsn(InboundRequest inboundRequest) {
|
||||
int tenantId = oConvertUtils.getInt(TenantContext.getTenant(), 0);
|
||||
return Asn.builder()
|
||||
.orderNo(codeGeneratorUtil.generateCode("RK"))
|
||||
.thirdPartyOrderNo(inboundRequest.getOrderNo())
|
||||
.no(inboundRequest.getNo())
|
||||
.whCode(inboundRequest.getWhCode())
|
||||
.supplierCode(inboundRequest.getSupplierCode())
|
||||
.orderType(inboundRequest.getType())
|
||||
.status(AsnStatusEnum.CREATED.getValue())
|
||||
.orderDate(new Date())
|
||||
.sysOrgCode("A05")
|
||||
.tenantId(tenantId)
|
||||
.createBy("赛意")
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建入库明细
|
||||
*/
|
||||
private AsnDetail buildAsnDetail(InboundDetail detail, Point srcPoint, Item item, Stock stock) {
|
||||
// 由于明细只有一条,直接构建单个明细对象
|
||||
return AsnDetail.builder()
|
||||
.lineNo(Integer.parseInt(detail.getLineNo()))
|
||||
.itemId(item.getId())
|
||||
.unit(detail.getUnit())
|
||||
.orderQty(detail.getQty())
|
||||
.stockId(stock.getId())
|
||||
.pointId(srcPoint.getId())
|
||||
.project(detail.getProject())
|
||||
.taskNo(detail.getTaskNo())
|
||||
.propC1(detail.getLotAtt04())
|
||||
.propC2(detail.getLotAtt010())
|
||||
.receivedQty(BigDecimal.ZERO)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,237 @@
|
|||
package org.cpte.modules.utils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
public class BigDecimalUtil {
|
||||
/**
|
||||
* 金额 保留小数点 2
|
||||
*/
|
||||
public static final int AMOUNT_DECIMAL_POINT = 2;
|
||||
|
||||
public static final BigDecimal ONE_HUNDRED = new BigDecimal("100");
|
||||
|
||||
/**
|
||||
* 金额相关计算方法:四舍五入 保留2位小数点
|
||||
*/
|
||||
public static class Amount {
|
||||
|
||||
public static BigDecimal add(BigDecimal num1, BigDecimal num2) {
|
||||
return setScale(num1.add(num2), AMOUNT_DECIMAL_POINT);
|
||||
}
|
||||
|
||||
public static BigDecimal multiply(BigDecimal num1, BigDecimal num2) {
|
||||
return setScale(num1.multiply(num2), AMOUNT_DECIMAL_POINT);
|
||||
}
|
||||
|
||||
public static BigDecimal subtract(BigDecimal num1, BigDecimal num2) {
|
||||
return setScale(num1.subtract(num2), AMOUNT_DECIMAL_POINT);
|
||||
}
|
||||
|
||||
public static BigDecimal divide(BigDecimal num1, BigDecimal num2) {
|
||||
return setScale(num1.divide(num2, RoundingMode.HALF_UP), AMOUNT_DECIMAL_POINT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* BigDecimal 加法 num1 + num2
|
||||
* 未做非空校验
|
||||
*
|
||||
* @param num1
|
||||
* @param num2
|
||||
* @param point 请使用BigDecimalUtils.PRICE_DECIMAL_POINT | BigDecimalUtils.WEIGHT_DECIMAL_POINT
|
||||
* @return BigDecimal
|
||||
*/
|
||||
public static BigDecimal add(BigDecimal num1, BigDecimal num2, int point) {
|
||||
return setScale(num1.add(num2), point);
|
||||
}
|
||||
|
||||
/**
|
||||
* 累加
|
||||
*
|
||||
* @param point
|
||||
* @param array
|
||||
* @return
|
||||
*/
|
||||
public static BigDecimal add(int point, BigDecimal... array) {
|
||||
BigDecimal res = new BigDecimal(0);
|
||||
for (BigDecimal item : array) {
|
||||
if (item == null) {
|
||||
res = res.add(BigDecimal.ZERO);
|
||||
} else {
|
||||
res = res.add(item);
|
||||
}
|
||||
}
|
||||
return setScale(res, point);
|
||||
}
|
||||
|
||||
/**
|
||||
* BigDecimal 乘法 num1 x num2
|
||||
* 未做非空校验
|
||||
*
|
||||
* @param num1
|
||||
* @param num2
|
||||
* @param point 请使用BigDecimalUtils.PRICE_DECIMAL_POINT | BigDecimalUtils.WEIGHT_DECIMAL_POINT
|
||||
* @return BigDecimal
|
||||
*/
|
||||
public static BigDecimal multiply(BigDecimal num1, BigDecimal num2, int point) {
|
||||
return setScale(num1.multiply(num2), point);
|
||||
}
|
||||
|
||||
/**
|
||||
* BigDecimal 减法 num1 - num2
|
||||
* 未做非空校验
|
||||
*
|
||||
* @param num1
|
||||
* @param num2
|
||||
* @param point 请使用BigDecimalUtils.PRICE_DECIMAL_POINT | BigDecimalUtils.WEIGHT_DECIMAL_POINT
|
||||
* @return BigDecimal
|
||||
*/
|
||||
public static BigDecimal subtract(BigDecimal num1, BigDecimal num2, int point) {
|
||||
return setScale(num1.subtract(num2), point);
|
||||
}
|
||||
|
||||
/**
|
||||
* BigDecimal 除法 num1/num2
|
||||
* 未做非空校验
|
||||
*
|
||||
* @param num1
|
||||
* @param num2
|
||||
* @param point 请使用BigDecimalUtils.PRICE_DECIMAL_POINT | BigDecimalUtils.WEIGHT_DECIMAL_POINT
|
||||
* @return BigDecimal
|
||||
*/
|
||||
public static BigDecimal divide(BigDecimal num1, BigDecimal num2, int point) {
|
||||
return num1.divide(num2, point, RoundingMode.HALF_UP);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置小数点类型为 四舍五入
|
||||
*
|
||||
* @param num
|
||||
* @param point
|
||||
* @return BigDecimal
|
||||
*/
|
||||
public static BigDecimal setScale(BigDecimal num, int point) {
|
||||
return num.setScale(point, RoundingMode.HALF_UP);
|
||||
}
|
||||
|
||||
/**
|
||||
* 比较 num1 是否大于 num2
|
||||
*
|
||||
* @param num1
|
||||
* @param num2
|
||||
* @return boolean
|
||||
*/
|
||||
public static boolean isGreaterThan(BigDecimal num1, BigDecimal num2) {
|
||||
return num1.compareTo(num2) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 比较 num1 是否大于等于 num2
|
||||
*
|
||||
* @param num1
|
||||
* @param num2
|
||||
* @return boolean
|
||||
*/
|
||||
public static boolean isGreaterOrEqual(BigDecimal num1, BigDecimal num2) {
|
||||
return isGreaterThan(num1, num2) || equals(num1, num2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 比较 num1 是否小于 num2
|
||||
*
|
||||
* @param num1
|
||||
* @param num2
|
||||
* @return boolean
|
||||
*/
|
||||
public static boolean isLessThan(BigDecimal num1, BigDecimal num2) {
|
||||
return num1.compareTo(num2) < 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 比较 num1 是否小于等于 num2
|
||||
*
|
||||
* @param num1
|
||||
* @param num2
|
||||
* @return boolean
|
||||
*/
|
||||
public static boolean isLessOrEqual(BigDecimal num1, BigDecimal num2) {
|
||||
return isLessThan(num1, num2) || equals(num1, num2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 比较 num1 是否等于 num2
|
||||
*
|
||||
* @param num1
|
||||
* @param num2
|
||||
* @return
|
||||
*/
|
||||
public static boolean equals(BigDecimal num1, BigDecimal num2) {
|
||||
return num1.compareTo(num2) == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算 num1 / num2 的百分比
|
||||
*
|
||||
* @param num1
|
||||
* @param num2
|
||||
* @param point 保留几位小数
|
||||
* @return String
|
||||
*/
|
||||
public static BigDecimal percent(Integer num1, Integer num2, int point) {
|
||||
if (num1 == null || num2 == null) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
if (num2.equals(0)) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
return percent(new BigDecimal(num1), new BigDecimal(num2), point);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算 num1 / num2 的百分比
|
||||
*
|
||||
* @param num1
|
||||
* @param num2
|
||||
* @param point 保留几位小数
|
||||
* @return String
|
||||
*/
|
||||
public static BigDecimal percent(BigDecimal num1, BigDecimal num2, int point) {
|
||||
if (num1 == null || num2 == null) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
if (equals(BigDecimal.ZERO, num2)) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
BigDecimal percent = num1.divide(num2, point + 2, RoundingMode.HALF_UP);
|
||||
return percent.multiply(ONE_HUNDRED).setScale(point);
|
||||
}
|
||||
|
||||
/**
|
||||
* 比较 num1,num2 返回最大的值
|
||||
*
|
||||
* @param num1
|
||||
* @param num2
|
||||
* @return BigDecimal
|
||||
*/
|
||||
public static BigDecimal max(BigDecimal num1, BigDecimal num2) {
|
||||
return num1.compareTo(num2) > 0 ? num1 : num2;
|
||||
}
|
||||
|
||||
/**
|
||||
* 比较 num1,num2 返回最小的值
|
||||
*
|
||||
* @param num1
|
||||
* @param num2
|
||||
* @return BigDecimal
|
||||
*/
|
||||
public static BigDecimal min(BigDecimal num1, BigDecimal num2) {
|
||||
return num1.compareTo(num2) < 0 ? num1 : num2;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(percent(new BigDecimal("3"), new BigDecimal("11"), 2));
|
||||
System.out.println(percent(new BigDecimal("8"), new BigDecimal("11"), 2));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
package org.cpte.modules.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.handler.IFillRuleHandler;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class CodeGeneratorUtil implements IFillRuleHandler {
|
||||
|
||||
@Autowired
|
||||
public JdbcTemplate jdbcTemplate;
|
||||
|
||||
private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyMMdd");
|
||||
|
||||
/**
|
||||
* 生成业务编号
|
||||
*
|
||||
* @param type 业务类型,如 RK、CK、PD
|
||||
* @return 完整业务编号
|
||||
*/
|
||||
@Transactional
|
||||
public String generateCode(String type) {
|
||||
String dateStr = LocalDate.now().format(DATE_FORMATTER);
|
||||
|
||||
// 尝试更新当前序列号
|
||||
String updateSql = "UPDATE generator_sequence SET current_seq = current_seq + 1 WHERE type = ? AND date_str = ?";
|
||||
int updated = jdbcTemplate.update(updateSql, type, dateStr);
|
||||
|
||||
if (updated == 0) {
|
||||
// 如果没有记录,则插入初始记录
|
||||
String insertSql = "INSERT IGNORE INTO generator_sequence (type, date_str, current_seq) VALUES (?, ?, 1)";
|
||||
jdbcTemplate.update(insertSql, type, dateStr);
|
||||
}
|
||||
|
||||
// 查询最新的序列号
|
||||
String selectSql = "SELECT current_seq FROM generator_sequence WHERE type = ? AND date_str = ?";
|
||||
Integer currentSeq = jdbcTemplate.queryForObject(selectSql, Integer.class, type, dateStr);
|
||||
|
||||
// 格式化为6位数字
|
||||
String seqStr = String.format("%06d", currentSeq);
|
||||
|
||||
return type + dateStr + seqStr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object execute(JSONObject params, JSONObject formData) {
|
||||
String prefix = params.getString("prefix");
|
||||
Object code = generateCode(prefix);
|
||||
log.info("生成业务编号:{}", code);
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
// 在 FillRuleUtil 中修改
|
||||
IFillRuleHandler ruleHandler;
|
||||
try{
|
||||
// 先尝试从 Spring 容器获取
|
||||
ruleHandler =(IFillRuleHandler)SpringContextUtils.
|
||||
|
||||
getBean(Class.forName(ruleClass));
|
||||
}catch(
|
||||
Exception e){
|
||||
// 如果获取失败,回退到原来的反射方式
|
||||
log.
|
||||
|
||||
warn("从Spring容器获取{}失败,使用反射创建实例",ruleClass);
|
||||
|
||||
ruleHandler =(IFillRuleHandler)Class.
|
||||
|
||||
forName(ruleClass).
|
||||
|
||||
newInstance();
|
||||
|
||||
// 如果是新创建的实例,尝试手动注入依赖
|
||||
if(ruleHandler instanceof ApplicationContextAware){
|
||||
((ApplicationContextAware)ruleHandler).
|
||||
|
||||
setApplicationContext(SpringContextUtils.getApplicationContext());
|
||||
}
|
||||
}*/
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package org.jeecg.modules.quartz.job;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.util.DateUtils;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
|
||||
@Slf4j
|
||||
public class AgvTaskJob implements Job {
|
||||
/**
|
||||
* 若参数变量名修改 QuartzJobController中也需对应修改
|
||||
*/
|
||||
private String parameter;
|
||||
|
||||
public void setParameter(String parameter) {
|
||||
this.parameter = parameter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
log.info(" Job Execution key:" + jobExecutionContext.getJobDetail().getKey());
|
||||
log.info(String.format("welcome %s! Jeecg-Boot 带参数定时任务 SampleParamJob ! 时间:" + DateUtils.now(), this.parameter));
|
||||
}
|
||||
}
|
||||
|
|
@ -23,7 +23,7 @@ import java.util.Map;
|
|||
* 报错提醒: 未集成mongo报错,可以打开启动类上面的注释 exclude={MongoAutoConfiguration.class}
|
||||
*/
|
||||
@Slf4j
|
||||
@SpringBootApplication(scanBasePackages = {"org.jeecg","org.cpte"})
|
||||
@SpringBootApplication(scanBasePackages = {"org.jeecg","org.cpte","org.cpte.modules"})
|
||||
@EnableAutoConfiguration(exclude = {MongoAutoConfiguration.class})
|
||||
@ImportAutoConfiguration(JustAuthAutoConfiguration.class) // spring boot 3.x justauth 兼容性处理
|
||||
public class CpteSystemApplication extends SpringBootServletInitializer {
|
||||
|
|
|
|||
|
|
@ -142,9 +142,9 @@ spring:
|
|||
slow-sql-millis: 5000
|
||||
datasource:
|
||||
master:
|
||||
url: jdbc:mysql://127.0.0.1:3306/cpte-wms?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
||||
url: jdbc:mysql://10.180.9.60:3306/cpte-wms?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: Youchain@56
|
||||
password: cpte@123
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# 多数据源配置
|
||||
#multi-datasource1:
|
||||
|
|
@ -156,12 +156,12 @@ spring:
|
|||
data:
|
||||
redis:
|
||||
database: 0
|
||||
host: 127.0.0.1
|
||||
host: 10.180.9.60
|
||||
port: 6379
|
||||
password:
|
||||
password: cpte@123
|
||||
#mybatis plus 设置
|
||||
mybatis-plus:
|
||||
mapper-locations: classpath*:org/jeecg/**/xml/*Mapper.xml,,classpath*:org/cpte/**/xml/*Mapper.xml
|
||||
mapper-locations: classpath*:org/jeecg/**/xml/*Mapper.xml,classpath*:org/cpte/**/xml/*Mapper.xml
|
||||
global-config:
|
||||
# 关闭MP3.0自带的banner
|
||||
banner: false
|
||||
|
|
@ -213,9 +213,9 @@ jeecg:
|
|||
app: http://localhost:8051
|
||||
path:
|
||||
#文件上传根目录 设置
|
||||
upload: /opt/cpte-wms/upload
|
||||
upload: /home/wms/upload
|
||||
#webapp文件路径
|
||||
webapp: /opt/cpte-wms/webapp
|
||||
webapp: /home/wms/webapp
|
||||
shiro:
|
||||
excludeUrls: /test/cpteDemo/demo3,/test/cpteDemo/redisDemo/**,/bigscreen/category/**,/bigscreen/visual/**,/bigscreen/map/**,/jmreport/bigscreen2/**,/api/getUserInfo
|
||||
#阿里云oss存储和大鱼短信秘钥配置
|
||||
|
|
|
|||
Loading…
Reference in New Issue