增强原材料卡片管理功能,新增免密接口和数据处理逻辑,支持原材料卡片的增删改查操作。更新前端视图以支持多行拆码明细拼接,优化用户体验和系统实时数据同步能力。

This commit is contained in:
geht
2026-05-11 14:32:44 +08:00
parent 936375bb2c
commit cffe32d896
49 changed files with 4594 additions and 390 deletions

View File

@@ -14,11 +14,13 @@ import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.xslmes.constant.MesXslCustomerBizStatus;
import org.jeecg.modules.xslmes.entity.MesXslCustomer;
import org.jeecg.modules.xslmes.entity.MesXslRawMaterialCard;
import org.jeecg.modules.xslmes.entity.MesXslRawMaterialEntry;
import org.jeecg.modules.xslmes.entity.MesXslSupplier;
import org.jeecg.modules.xslmes.entity.MesXslVehicle;
import org.jeecg.modules.xslmes.entity.MesXslWeightRecord;
import org.jeecg.modules.xslmes.service.IMesXslCustomerService;
import org.jeecg.modules.xslmes.service.IMesXslRawMaterialCardService;
import org.jeecg.modules.xslmes.service.IMesXslRawMaterialEntryService;
import org.jeecg.modules.xslmes.service.IMesXslSupplierService;
import org.jeecg.modules.xslmes.service.IMesXslVehicleService;
@@ -49,6 +51,7 @@ public class MesXslDesktopAnonController {
private final IMesXslSupplierService supplierService;
private final IMesXslWeightRecordService weightRecordService;
private final IMesXslRawMaterialEntryService rawMaterialEntryService;
private final IMesXslRawMaterialCardService rawMaterialCardService;
private final MesXslStompNotifyService stompNotify;
// ═══════════════════════════ 车辆管理 ═══════════════════════════
@@ -502,6 +505,66 @@ public class MesXslDesktopAnonController {
return Result.OK("批量删除成功!");
}
// ═══════════════════════════ 原材料卡片 ═══════════════════════════
@Operation(summary = "原材料卡片-免密分页列表查询")
@GetMapping("/xslmes/mesXslRawMaterialCard/anon/list")
public Result<IPage<MesXslRawMaterialCard>> rawMaterialCardAnonList(
MesXslRawMaterialCard entity,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<MesXslRawMaterialCard> qw = QueryGenerator.initQueryWrapper(entity, req.getParameterMap());
qw.orderByDesc("create_time");
IPage<MesXslRawMaterialCard> page = rawMaterialCardService.page(new Page<>(pageNo, pageSize), qw);
return Result.OK(page);
}
@Operation(summary = "原材料卡片-免密通过id查询")
@GetMapping("/xslmes/mesXslRawMaterialCard/anon/queryById")
public Result<MesXslRawMaterialCard> rawMaterialCardAnonQueryById(@RequestParam(name = "id") String id) {
MesXslRawMaterialCard entity = rawMaterialCardService.getById(id);
return entity != null ? Result.OK(entity) : Result.error("未找到对应数据");
}
@Operation(summary = "原材料卡片-免密添加")
@PostMapping("/xslmes/mesXslRawMaterialCard/anon/add")
public Result<String> rawMaterialCardAnonAdd(@RequestBody MesXslRawMaterialCard entity) {
rawMaterialCardService.save(entity);
stompNotify.publishRawMaterialCardChanged("add", entity.getId());
return Result.OK("添加成功!");
}
@Operation(summary = "原材料卡片-免密编辑")
@RequestMapping(value = "/xslmes/mesXslRawMaterialCard/anon/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> rawMaterialCardAnonEdit(@RequestBody MesXslRawMaterialCard entity) {
if (oConvertUtils.isEmpty(entity.getId())) {
return Result.error("主键不能为空");
}
boolean ok = rawMaterialCardService.updateById(entity);
if (!ok) {
return Result.error("数据已被他人修改,请刷新后重试");
}
stompNotify.publishRawMaterialCardChanged("edit", entity.getId());
return Result.OK("编辑成功!");
}
@Operation(summary = "原材料卡片-免密删除")
@DeleteMapping("/xslmes/mesXslRawMaterialCard/anon/delete")
public Result<String> rawMaterialCardAnonDelete(@RequestParam(name = "id") String id) {
rawMaterialCardService.removeById(id);
stompNotify.publishRawMaterialCardChanged("delete", id);
return Result.OK("删除成功!");
}
@Operation(summary = "原材料卡片-免密批量删除")
@DeleteMapping("/xslmes/mesXslRawMaterialCard/anon/deleteBatch")
public Result<String> rawMaterialCardAnonDeleteBatch(@RequestParam(name = "ids") String ids) {
rawMaterialCardService.removeByIds(Arrays.asList(ids.split(",")));
stompNotify.publishRawMaterialCardChanged("batchDelete", ids);
return Result.OK("批量删除成功!");
}
// ─────────────────────────── 车辆私有辅助 ────────────────────────────
private void applyWeightBillType(MesXslWeightRecord record) {

View File

@@ -0,0 +1,155 @@
package org.jeecg.modules.xslmes.controller;
import java.util.Arrays;
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.modules.xslmes.entity.MesXslRawMaterialCard;
import org.jeecg.modules.xslmes.service.IMesXslRawMaterialCardService;
import org.jeecg.modules.xslmes.service.MesXslStompNotifyService;
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.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
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: jeecg-boot
* @Date: 2026-05-11
* @Version: V1.0
*/
@Tag(name = "原材料卡片")
@RestController
@RequestMapping("/xslmes/mesXslRawMaterialCard")
@Slf4j
public class MesXslRawMaterialCardController extends JeecgController<MesXslRawMaterialCard, IMesXslRawMaterialCardService> {
@Autowired
private IMesXslRawMaterialCardService mesXslRawMaterialCardService;
@Autowired
private MesXslStompNotifyService stompNotify;
/**
* 分页列表查询
*/
@Operation(summary = "原材料卡片-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<MesXslRawMaterialCard>> queryPageList(MesXslRawMaterialCard mesXslRawMaterialCard,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<MesXslRawMaterialCard> queryWrapper = QueryGenerator.initQueryWrapper(mesXslRawMaterialCard, req.getParameterMap());
Page<MesXslRawMaterialCard> page = new Page<>(pageNo, pageSize);
IPage<MesXslRawMaterialCard> pageList = mesXslRawMaterialCardService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*/
@AutoLog(value = "原材料卡片-添加")
@Operation(summary = "原材料卡片-添加")
@RequiresPermissions("xslmes:mes_xsl_raw_material_card:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody MesXslRawMaterialCard mesXslRawMaterialCard) {
mesXslRawMaterialCardService.save(mesXslRawMaterialCard);
stompNotify.publishRawMaterialCardChanged("add", mesXslRawMaterialCard.getId());
return Result.OK("添加成功!");
}
/**
* 编辑
*/
@AutoLog(value = "原材料卡片-编辑")
@Operation(summary = "原材料卡片-编辑")
@RequiresPermissions("xslmes:mes_xsl_raw_material_card:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody MesXslRawMaterialCard mesXslRawMaterialCard) {
mesXslRawMaterialCardService.updateById(mesXslRawMaterialCard);
stompNotify.publishRawMaterialCardChanged("edit", mesXslRawMaterialCard.getId());
return Result.OK("编辑成功!");
}
/**
* 设置优先出库(列表可直接切换)
*/
@AutoLog(value = "原材料卡片-设置优先出库")
@Operation(summary = "原材料卡片-设置优先出库")
@RequiresPermissions("xslmes:mes_xsl_raw_material_card:edit")
@PutMapping(value = "/updatePriority")
public Result<String> updatePriority(@RequestParam String id, @RequestParam String priorityPickup) {
MesXslRawMaterialCard card = new MesXslRawMaterialCard();
card.setId(id);
card.setPriorityPickup(priorityPickup);
mesXslRawMaterialCardService.updateById(card);
stompNotify.publishRawMaterialCardChanged("edit", id);
return Result.OK("更新成功!");
}
/**
* 通过id删除
*/
@AutoLog(value = "原材料卡片-通过id删除")
@Operation(summary = "原材料卡片-通过id删除")
@RequiresPermissions("xslmes:mes_xsl_raw_material_card:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
mesXslRawMaterialCardService.removeById(id);
stompNotify.publishRawMaterialCardChanged("delete", id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*/
@AutoLog(value = "原材料卡片-批量删除")
@Operation(summary = "原材料卡片-批量删除")
@RequiresPermissions("xslmes:mes_xsl_raw_material_card:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
this.mesXslRawMaterialCardService.removeByIds(Arrays.asList(ids.split(",")));
stompNotify.publishRawMaterialCardChanged("batchDelete", ids);
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*/
@Operation(summary = "原材料卡片-通过id查询")
@GetMapping(value = "/queryById")
public Result<MesXslRawMaterialCard> queryById(@RequestParam(name = "id", required = true) String id) {
MesXslRawMaterialCard mesXslRawMaterialCard = mesXslRawMaterialCardService.getById(id);
if (mesXslRawMaterialCard == null) {
return Result.error("未找到对应数据");
}
return Result.OK(mesXslRawMaterialCard);
}
/**
* 导出excel
*/
@RequiresPermissions("xslmes:mes_xsl_raw_material_card:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, MesXslRawMaterialCard mesXslRawMaterialCard) {
return super.exportXls(request, mesXslRawMaterialCard, MesXslRawMaterialCard.class, "原材料卡片");
}
/**
* 通过excel导入数据
*/
@RequiresPermissions("xslmes:mes_xsl_raw_material_card:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, MesXslRawMaterialCard.class);
}
}

View File

@@ -0,0 +1,133 @@
package org.jeecg.modules.xslmes.entity;
import java.io.Serializable;
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 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;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Description: 原材料卡片
* @Author: jeecg-boot
* @Date: 2026-05-11
* @Version: V1.0
*/
@Data
@TableName("mes_xsl_raw_material_card")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@Schema(description = "原材料卡片")
public class MesXslRawMaterialCard implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "主键")
private String id;
@Excel(name = "条码", width = 20)
@Schema(description = "条码")
private String barcode;
@Excel(name = "批次号", width = 20)
@Schema(description = "批次号")
private String batchNo;
@Excel(name = "入场日期", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Schema(description = "入场日期")
private Date entryDate;
@Schema(description = "物料ID")
private String materialId;
@Excel(name = "物料名称", width = 20)
@Schema(description = "物料名称")
private String materialName;
@Excel(name = "物料描述", width = 30)
@Schema(description = "物料描述")
private String materialDesc;
@Schema(description = "供应商ID")
private String supplierId;
@Excel(name = "供应商名称", width = 20)
@Schema(description = "供应商名称")
private String supplierName;
@Excel(name = "厂家物料名称", width = 20)
@Schema(description = "厂家物料名称")
private String manufacturerMaterialName;
@Excel(name = "保质期", width = 15)
@Schema(description = "保质期")
private String shelfLife;
@Excel(name = "总重", width = 12)
@Schema(description = "总重")
private BigDecimal totalWeight;
@Excel(name = "剩余重量", width = 12)
@Schema(description = "剩余重量")
private BigDecimal remainingWeight;
@Excel(name = "剩余数量", width = 12)
@Schema(description = "剩余数量")
private Integer remainingQuantity;
@Excel(name = "状态", width = 10, dicCode = "xslmes_card_status")
@Dict(dicCode = "xslmes_card_status")
@Schema(description = "状态xslmes_card_status1正常 0异常")
private String status;
@Excel(name = "检测结果", width = 12, dicCode = "xslmes_test_result")
@Dict(dicCode = "xslmes_test_result")
@Schema(description = "检测结果xslmes_test_result0未检 1合格 2不合格")
private String testResult;
@Excel(name = "库区", width = 15)
@Schema(description = "库区")
private String warehouseArea;
@Excel(name = "卸货人", width = 15)
@Schema(description = "卸货人")
private String unloadOperator;
@Excel(name = "优先出库", width = 10, dicCode = "yn")
@Dict(dicCode = "yn")
@Schema(description = "设置优先出库yn1是 0否")
private String priorityPickup;
/**创建人*/
@Schema(description = "创建人")
private String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Schema(description = "创建日期")
private Date createTime;
/**更新人*/
@Schema(description = "更新人")
private String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Schema(description = "更新日期")
private Date updateTime;
@Schema(description = "租户ID")
private Integer tenantId;
}

View File

@@ -1,8 +1,8 @@
package org.jeecg.modules.xslmes.entity;
import java.io.Serializable;
import java.util.Date;
import java.math.BigDecimal;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
@@ -88,17 +88,19 @@ public class MesXslRawMaterialEntry implements Serializable {
@Schema(description = "总重(KG)")
private BigDecimal totalWeight;
@Excel(name = "总份数", width = 10)
@Schema(description = "总份数")
private Integer totalPortions;
// 总份数 / 每份总重 / 每份包数:从 数值类型 升级为 字符串类型,
// 支持桌面端「拆码明细」多行拼接保存(如 20/1/ 与 100/200/)。
@Excel(name = "总份数", width = 12)
@Schema(description = "总份数(支持多行拆码明细拼接,如 20/1/")
private String totalPortions;
@Excel(name = "每份总重(KG)", width = 12)
@Schema(description = "每份总重(KG)")
private BigDecimal portionWeight;
@Excel(name = "每份总重(KG)", width = 14)
@Schema(description = "每份总重(KG)(支持多行拆码明细拼接,如 100/200/")
private String portionWeight;
@Excel(name = "每份包数", width = 10)
@Schema(description = "每份包数")
private Integer portionPackages;
@Excel(name = "每份包数", width = 12)
@Schema(description = "每份包数(支持多行拆码明细拼接)")
private String portionPackages;
@Excel(name = "检测结果", width = 12, dicCode = "xslmes_test_result")
@Dict(dicCode = "xslmes_test_result")

View File

@@ -0,0 +1,13 @@
package org.jeecg.modules.xslmes.mapper;
import org.jeecg.modules.xslmes.entity.MesXslRawMaterialCard;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 原材料卡片
* @Author: jeecg-boot
* @Date: 2026-05-11
* @Version: V1.0
*/
public interface MesXslRawMaterialCardMapper extends BaseMapper<MesXslRawMaterialCard> {
}

View File

@@ -0,0 +1,4 @@
<?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.jeecg.modules.xslmes.mapper.MesXslRawMaterialCardMapper">
</mapper>

View File

@@ -0,0 +1,13 @@
package org.jeecg.modules.xslmes.service;
import org.jeecg.modules.xslmes.entity.MesXslRawMaterialCard;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description: 原材料卡片
* @Author: jeecg-boot
* @Date: 2026-05-11
* @Version: V1.0
*/
public interface IMesXslRawMaterialCardService extends IService<MesXslRawMaterialCard> {
}

View File

@@ -55,6 +55,11 @@ public class MesXslStompNotifyService {
publish("/topic/sync/sys-categories", "SYS_CATEGORY_CHANGED", "categoryId", categoryId, action);
}
/** 广播原材料卡片数据变更事件到 /topic/sync/mes-raw-material-cards */
public void publishRawMaterialCardChanged(String action, String cardId) {
publish("/topic/sync/mes-raw-material-cards", "RAW_MATERIAL_CARD_CHANGED", "cardId", cardId, action);
}
/** 广播数据字典变更事件到 /topic/sync/sys-dicts */
public void publishSysDictChanged(String action, String dictId) {
publish("/topic/sync/sys-dicts", "SYS_DICT_CHANGED", "dictId", dictId, action);

View File

@@ -0,0 +1,17 @@
package org.jeecg.modules.xslmes.service.impl;
import org.jeecg.modules.xslmes.entity.MesXslRawMaterialCard;
import org.jeecg.modules.xslmes.mapper.MesXslRawMaterialCardMapper;
import org.jeecg.modules.xslmes.service.IMesXslRawMaterialCardService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: 原材料卡片
* @Author: jeecg-boot
* @Date: 2026-05-11
* @Version: V1.0
*/
@Service
public class MesXslRawMaterialCardServiceImpl extends ServiceImpl<MesXslRawMaterialCardMapper, MesXslRawMaterialCard> implements IMesXslRawMaterialCardService {
}