原材料车间剩余量

This commit is contained in:
2026-05-15 15:10:25 +08:00
parent b4b550a3de
commit 5678ab82ba
9 changed files with 478 additions and 0 deletions

View File

@@ -0,0 +1,84 @@
package org.jeecg.modules.xslmes.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.xslmes.entity.MesXslRawMaterialWorkshopRemain;
import org.jeecg.modules.xslmes.service.IMesXslRawMaterialWorkshopRemainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
/**
* 原材料车间剩余量
*/
@Tag(name = "原材料车间剩余量")
@RestController
@RequestMapping("/xslmes/mesXslRawMaterialWorkshopRemain")
@Slf4j
public class MesXslRawMaterialWorkshopRemainController
extends JeecgController<MesXslRawMaterialWorkshopRemain, IMesXslRawMaterialWorkshopRemainService> {
@Autowired
private IMesXslRawMaterialWorkshopRemainService mesXslRawMaterialWorkshopRemainService;
@Operation(summary = "原材料车间剩余量-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<MesXslRawMaterialWorkshopRemain>> queryPageList(
MesXslRawMaterialWorkshopRemain query,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<MesXslRawMaterialWorkshopRemain> queryWrapper =
QueryGenerator.initQueryWrapper(query, req.getParameterMap());
Page<MesXslRawMaterialWorkshopRemain> page = new Page<>(pageNo, pageSize);
return Result.OK(mesXslRawMaterialWorkshopRemainService.page(page, queryWrapper));
}
@AutoLog(value = "原材料车间剩余量-批量设置优先使用")
@Operation(summary = "原材料车间剩余量-批量设置优先使用")
@RequiresPermissions("xslmes:mes_xsl_raw_material_workshop_remain:edit")
@PutMapping(value = "/batchUpdatePriority")
public Result<String> batchUpdatePriority(
@RequestParam(name = "ids") String ids,
@RequestParam(name = "priorityPickup") String priorityPickup) {
List<String> idList =
Arrays.stream(ids.split(","))
.map(String::trim)
.filter(StringUtils::isNotBlank)
.toList();
if (idList.isEmpty()) {
return Result.error("请先选择记录");
}
if (!"0".equals(priorityPickup) && !"1".equals(priorityPickup)) {
return Result.error("priorityPickup 仅支持 0 或 1");
}
UpdateWrapper<MesXslRawMaterialWorkshopRemain> uw = new UpdateWrapper<>();
uw.in("id", idList).set("priority_pickup", priorityPickup);
mesXslRawMaterialWorkshopRemainService.update(uw);
return Result.OK("批量更新成功!");
}
@RequiresPermissions("xslmes:mes_xsl_raw_material_workshop_remain:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, MesXslRawMaterialWorkshopRemain query) {
return super.exportXls(request, query, MesXslRawMaterialWorkshopRemain.class, "原材料车间剩余量");
}
}

View File

@@ -0,0 +1,82 @@
package org.jeecg.modules.xslmes.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecg.common.system.base.entity.JeecgEntity;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
/**
* 原材料车间剩余量
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("mes_xsl_raw_material_card")
@Schema(description = "原材料车间剩余量")
public class MesXslRawMaterialWorkshopRemain extends JeecgEntity {
private static final long serialVersionUID = 1L;
@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;
@Excel(name = "物料名称", width = 20)
@Schema(description = "物料名称")
private String materialName;
@Excel(name = "供应商", width = 20)
@Schema(description = "供应商")
private String supplierName;
@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 = 12, dicCode = "xslmes_test_result")
@Dict(dicCode = "xslmes_test_result")
@Schema(description = "检测结果")
private String testResult;
@Excel(name = "状态", width = 10, dicCode = "xslmes_card_status")
@Dict(dicCode = "xslmes_card_status")
@Schema(description = "状态")
private String status;
@Excel(name = "优先使用", width = 10, dicCode = "yn")
@Dict(dicCode = "yn")
@TableField("priority_pickup")
@Schema(description = "优先使用(yn:1是 0否)")
private String priorityPickup;
}

View File

@@ -0,0 +1,12 @@
package org.jeecg.modules.xslmes.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.jeecg.modules.xslmes.entity.MesXslRawMaterialWorkshopRemain;
/**
* 原材料车间剩余量 Mapper
*/
@Mapper
public interface MesXslRawMaterialWorkshopRemainMapper extends BaseMapper<MesXslRawMaterialWorkshopRemain> {
}

View File

@@ -0,0 +1,10 @@
package org.jeecg.modules.xslmes.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.xslmes.entity.MesXslRawMaterialWorkshopRemain;
/**
* 原材料车间剩余量
*/
public interface IMesXslRawMaterialWorkshopRemainService extends IService<MesXslRawMaterialWorkshopRemain> {
}

View File

@@ -0,0 +1,16 @@
package org.jeecg.modules.xslmes.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.xslmes.entity.MesXslRawMaterialWorkshopRemain;
import org.jeecg.modules.xslmes.mapper.MesXslRawMaterialWorkshopRemainMapper;
import org.jeecg.modules.xslmes.service.IMesXslRawMaterialWorkshopRemainService;
import org.springframework.stereotype.Service;
/**
* 原材料车间剩余量
*/
@Service
public class MesXslRawMaterialWorkshopRemainServiceImpl
extends ServiceImpl<MesXslRawMaterialWorkshopRemainMapper, MesXslRawMaterialWorkshopRemain>
implements IMesXslRawMaterialWorkshopRemainService {
}