出入库 物料接口

出入库 物料接口
pull/1/head
siontion 9 months ago
parent 61045751f3
commit e00b5e3af7

@ -39,6 +39,7 @@ public interface ErrorCodeConstants {
ErrorCode RG_NOT_EXISTS = new ErrorCode(1_003_002, "库区不存在"); ErrorCode RG_NOT_EXISTS = new ErrorCode(1_003_002, "库区不存在");
ErrorCode PN_NOT_EXISTS = new ErrorCode(1_003_003, "库位不存在"); ErrorCode PN_NOT_EXISTS = new ErrorCode(1_003_003, "库位不存在");
ErrorCode STORAGE_NOT_EXISTS = new ErrorCode(1_003_004,"库存不存在"); ErrorCode STORAGE_NOT_EXISTS = new ErrorCode(1_003_004,"库存不存在");
ErrorCode STORAGE_MAT_NOT_EXISTS = new ErrorCode(1_003_005, "物料不存在");
/************订单管理***********/ /************订单管理***********/
ErrorCode PROJECT_ORDER_NOT_EXISTS = new ErrorCode(1_004_001, "项目订单不存在"); ErrorCode PROJECT_ORDER_NOT_EXISTS = new ErrorCode(1_004_001, "项目订单不存在");

@ -55,6 +55,11 @@ public class StorageRespVO {
@ExcelProperty("仓库Id对应 wms_wh 表中的Id") @ExcelProperty("仓库Id对应 wms_wh 表中的Id")
private Long whId; private Long whId;
@Schema(description = "创建人")
@ExcelProperty("创建人")
private Long creator;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间") @ExcelProperty("创建时间")
private LocalDateTime createTime; private LocalDateTime createTime;

@ -1,63 +1,62 @@
package com.chanko.yunxi.mes.module.heli.controller.admin.storage.vo; package com.chanko.yunxi.mes.module.heli.controller.admin.storage.vo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.*;
import java.util.*; import java.util.*;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import java.util.*; import java.util.*;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@Schema(description = "管理后台 - 入/出库新增/修改 Request VO") @Schema(description = "管理后台 - 入/出库新增/修改 Request VO")
@Data @Data
public class StorageSaveReqVO { public class StorageSaveReqVO {
@Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "24890") @Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "24890")
private Long id; private Long id;
@Schema(description = "入库出库大类型1为入库2为出库", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") @Schema(description = "入库出库大类型1为入库2为出库", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotNull(message = "入库出库大类型1为入库2为出库不能为空") @NotNull(message = "入库出库大类型1为入库2为出库不能为空")
private Integer stockType; private Integer stockType;
@Schema(description = "入库类型(字典)1为采购入库2为盘盈入库3为其他入库", example = "1") @Schema(description = "入库类型(字典)1为采购入库2为盘盈入库3为其他入库", example = "1")
private Integer stockInType; private Integer stockInType;
@Schema(description = "出库类型(字典)1为领料出库2为销售出库3为盘亏出库4为其他出库", example = "2") @Schema(description = "出库类型(字典)1为领料出库2为销售出库3为盘亏出库4为其他出库", example = "2")
private Integer stockOutType; private Integer stockOutType;
@Schema(description = "入/出库单号", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "入/出库单号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "入/出库单号不能为空") private String stockNo;
private String stockNo;
@Schema(description = "上游单号")
@Schema(description = "上游单号") private Long headerNo;
private Long headerNo;
@Schema(description = "备注", example = "你说的对")
@Schema(description = "备注", example = "你说的对") private String description;
private String description;
@Schema(description = "状态1为保存2为提交3为作废", example = "1")
@Schema(description = "状态1为保存2为提交3为作废", example = "1") private Integer status;
private Integer status;
@Schema(description = "仓库Id对应 wms_wh 表中的Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "28079")
@Schema(description = "仓库Id对应 wms_wh 表中的Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "28079") @NotNull(message = "仓库Id对应 wms_wh 表中的Id不能为空")
@NotNull(message = "仓库Id对应 wms_wh 表中的Id不能为空") private Long whId;
private Long whId;
@Schema(description = "入库人")
@Schema(description = "入库人") private Long keeper;
private Long keeper;
@Schema(description = "入库时间")
@Schema(description = "入库时间") private LocalDateTime keeperTime;
private LocalDateTime keeperTime;
@Schema(description = "出库人")
@Schema(description = "出库人") private Long outbound;
private Long outbound;
@Schema(description = "出库时间")
@Schema(description = "出库时间") private LocalDateTime outboundTime;
private LocalDateTime outboundTime;
@Schema(description = "作废人")
@Schema(description = "作废人") private Long cancel;
private Long cancel;
@Schema(description = "作废时间")
@Schema(description = "作废时间") private LocalDateTime cancelTime;
private LocalDateTime cancelTime;
}
}

@ -0,0 +1,105 @@
package com.chanko.yunxi.mes.module.heli.controller.admin.storagemat;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
import com.chanko.yunxi.mes.framework.common.pojo.CommonResult;
import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils;
import static com.chanko.yunxi.mes.framework.common.pojo.CommonResult.success;
import com.chanko.yunxi.mes.framework.excel.core.util.ExcelUtils;
import com.chanko.yunxi.mes.framework.operatelog.core.annotations.OperateLog;
import static com.chanko.yunxi.mes.framework.operatelog.core.enums.OperateTypeEnum.*;
import com.chanko.yunxi.mes.module.heli.controller.admin.storagemat.vo.*;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.storagemat.StorageMatDO;
import com.chanko.yunxi.mes.module.heli.service.storagemat.StorageMatService;
@Tag(name = "管理后台 - 入/出库物料")
@RestController
@RequestMapping("/heli/storage-mat")
@Validated
public class StorageMatController {
@Resource
private StorageMatService storageMatService;
@PostMapping("/create")
@Operation(summary = "创建入/出库物料")
@PreAuthorize("@ss.hasPermission('heli:storage-mat:create')")
public CommonResult<Long> createStorageMat(@Valid @RequestBody StorageMatSaveReqVO createReqVO) {
return success(storageMatService.createStorageMat(createReqVO));
}
@PostMapping("/create-batch")
@Operation(summary = "批量创建入/出库物料")
@PreAuthorize("@ss.hasPermission('heli:storage-mat:create')")
public CommonResult<Long> createStorageMat(@Valid @RequestBody List<StorageMatSaveReqVO> createReqVO) {
for (StorageMatSaveReqVO item :createReqVO){
storageMatService.createStorageMat(item);
};
return success(1L);
}
@PutMapping("/update")
@Operation(summary = "更新入/出库物料")
@PreAuthorize("@ss.hasPermission('heli:storage-mat:update')")
public CommonResult<Boolean> updateStorageMat(@Valid @RequestBody StorageMatSaveReqVO updateReqVO) {
storageMatService.updateStorageMat(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除入/出库物料")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('heli:storage-mat:delete')")
public CommonResult<Boolean> deleteStorageMat(@RequestParam("id") Long id) {
storageMatService.deleteStorageMat(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得入/出库物料")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('heli:storage-mat:query')")
public CommonResult<StorageMatRespVO> getStorageMat(@RequestParam("id") Long id) {
StorageMatDO storageMat = storageMatService.getStorageMat(id);
return success(BeanUtils.toBean(storageMat, StorageMatRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得入/出库物料分页")
@PreAuthorize("@ss.hasPermission('heli:storage-mat:query')")
public CommonResult<PageResult<StorageMatRespVO>> getStorageMatPage(@Valid StorageMatPageReqVO pageReqVO) {
PageResult<StorageMatDO> pageResult = storageMatService.getStorageMatPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, StorageMatRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出入/出库物料 Excel")
@PreAuthorize("@ss.hasPermission('heli:storage-mat:export')")
@OperateLog(type = EXPORT)
public void exportStorageMatExcel(@Valid StorageMatPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<StorageMatDO> list = storageMatService.getStorageMatPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "入/出库物料.xls", "数据", StorageMatRespVO.class,
BeanUtils.toBean(list, StorageMatRespVO.class));
}
}

@ -0,0 +1,57 @@
package com.chanko.yunxi.mes.module.heli.controller.admin.storagemat.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static com.chanko.yunxi.mes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 入/出库物料分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class StorageMatPageReqVO extends PageParam {
@Schema(description = "入/出库Id", example = "19477")
private Long stockId;
@Schema(description = "物料 Id,对应 base_material表中的 Id 列", example = "3400")
private Long matId;
@Schema(description = "仓库 Id对应 wms_wh 表中的Id", example = "31860")
private Long whId;
@Schema(description = "库区 Id对应 wms_rg 表中的Id", example = "13060")
private Long rgId;
@Schema(description = "库区 Id对应 wms_rg 表中的Id", example = "25544")
private Long pnId;
@Schema(description = "库存良品数量")
private BigDecimal storageOkQty;
@Schema(description = "批次号")
private String lotNo;
@Schema(description = "备注", example = "你猜")
private String description;
@Schema(description = "记录的创建人,对应员工表中的 Id")
private String creator;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "记录的修改人,对应员工表中的 Id")
private String updater;
@Schema(description = "更新时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] updateTime;
}

@ -0,0 +1,57 @@
package com.chanko.yunxi.mes.module.heli.controller.admin.storagemat.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.util.*;
import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 入/出库物料 Response VO")
@Data
@ExcelIgnoreUnannotated
public class StorageMatRespVO {
@Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "29383")
@ExcelProperty("主键id")
private Long id;
@Schema(description = "入/出库Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "19477")
@ExcelProperty("入/出库Id")
private Long stockId;
@Schema(description = "物料 Id,对应 base_material表中的 Id 列", requiredMode = Schema.RequiredMode.REQUIRED, example = "3400")
@ExcelProperty("物料 Id,对应 base_material表中的 Id 列")
private Long matId;
@Schema(description = "仓库 Id对应 wms_wh 表中的Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "31860")
@ExcelProperty("仓库 Id对应 wms_wh 表中的Id")
private Long whId;
@Schema(description = "库区 Id对应 wms_rg 表中的Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "13060")
@ExcelProperty("库区 Id对应 wms_rg 表中的Id")
private Long rgId;
@Schema(description = "库区 Id对应 wms_rg 表中的Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "25544")
@ExcelProperty("库区 Id对应 wms_rg 表中的Id")
private Long pnId;
@Schema(description = "库存良品数量")
@ExcelProperty("库存良品数量")
private BigDecimal storageOkQty;
@Schema(description = "批次号")
@ExcelProperty("批次号")
private String lotNo;
@Schema(description = "备注", example = "你猜")
@ExcelProperty("备注")
private String description;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

@ -0,0 +1,46 @@
package com.chanko.yunxi.mes.module.heli.controller.admin.storagemat.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
import java.util.*;
import java.math.BigDecimal;
@Schema(description = "管理后台 - 入/出库物料新增/修改 Request VO")
@Data
public class StorageMatSaveReqVO {
@Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "29383")
private Long id;
@Schema(description = "入/出库Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "19477")
@NotNull(message = "入/出库Id不能为空")
private Long stockId;
@Schema(description = "物料 Id,对应 base_material表中的 Id 列", requiredMode = Schema.RequiredMode.REQUIRED, example = "3400")
@NotNull(message = "物料 Id,对应 base_material表中的 Id 列不能为空")
private Long matId;
@Schema(description = "仓库 Id对应 wms_wh 表中的Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "31860")
@NotNull(message = "仓库 Id对应 wms_wh 表中的Id不能为空")
private Long whId;
@Schema(description = "库区 Id对应 wms_rg 表中的Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "13060")
@NotNull(message = "库区 Id对应 wms_rg 表中的Id不能为空")
private Long rgId;
@Schema(description = "库区 Id对应 wms_rg 表中的Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "25544")
@NotNull(message = "库区 Id对应 wms_rg 表中的Id不能为空")
private Long pnId;
@Schema(description = "库存良品数量")
private BigDecimal storageOkQty;
@Schema(description = "批次号")
private String lotNo;
@Schema(description = "备注", example = "你猜")
private String description;
}

@ -0,0 +1,64 @@
package com.chanko.yunxi.mes.module.heli.dal.dataobject.storagemat;
import lombok.*;
import java.util.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.chanko.yunxi.mes.framework.mybatis.core.dataobject.BaseDO;
/**
* / DO
*
* @author
*/
@TableName("wms_storage_mat")
@KeySequence("wms_storage_mat_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class StorageMatDO extends BaseDO {
/**
* id
*/
@TableId
private Long id;
/**
* /Id
*/
private Long stockId;
/**
* Id, base_material Id
*/
private Long matId;
/**
* Id wms_wh Id
*/
private Long whId;
/**
* Id wms_rg Id
*/
private Long rgId;
/**
* Id wms_rg Id
*/
private Long pnId;
/**
*
*/
private BigDecimal storageOkQty;
/**
*
*/
private String lotNo;
/**
*
*/
private String description;
}

@ -0,0 +1,37 @@
package com.chanko.yunxi.mes.module.heli.dal.mysql.storagemat;
import java.util.*;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
import com.chanko.yunxi.mes.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.chanko.yunxi.mes.framework.mybatis.core.mapper.BaseMapperX;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.storagemat.StorageMatDO;
import org.apache.ibatis.annotations.Mapper;
import com.chanko.yunxi.mes.module.heli.controller.admin.storagemat.vo.*;
/**
* / Mapper
*
* @author
*/
@Mapper
public interface StorageMatMapper extends BaseMapperX<StorageMatDO> {
default PageResult<StorageMatDO> selectPage(StorageMatPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<StorageMatDO>()
.eqIfPresent(StorageMatDO::getStockId, reqVO.getStockId())
.eqIfPresent(StorageMatDO::getMatId, reqVO.getMatId())
.eqIfPresent(StorageMatDO::getWhId, reqVO.getWhId())
.eqIfPresent(StorageMatDO::getRgId, reqVO.getRgId())
.eqIfPresent(StorageMatDO::getPnId, reqVO.getPnId())
.eqIfPresent(StorageMatDO::getStorageOkQty, reqVO.getStorageOkQty())
.eqIfPresent(StorageMatDO::getLotNo, reqVO.getLotNo())
.eqIfPresent(StorageMatDO::getDescription, reqVO.getDescription())
.eqIfPresent(StorageMatDO::getCreator, reqVO.getCreator())
.betweenIfPresent(StorageMatDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(StorageMatDO::getUpdater, reqVO.getUpdater())
.betweenIfPresent(StorageMatDO::getUpdateTime, reqVO.getUpdateTime())
.orderByDesc(StorageMatDO::getId));
}
}

@ -1,74 +1,81 @@
package com.chanko.yunxi.mes.module.heli.service.storage; package com.chanko.yunxi.mes.module.heli.service.storage;
import org.springframework.stereotype.Service; import cn.hutool.core.lang.UUID;
import javax.annotation.Resource; import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated; import javax.annotation.Resource;
import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import com.chanko.yunxi.mes.module.heli.controller.admin.storage.vo.*; import java.util.*;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.storage.StorageDO; import com.chanko.yunxi.mes.module.heli.controller.admin.storage.vo.*;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult; import com.chanko.yunxi.mes.module.heli.dal.dataobject.storage.StorageDO;
import com.chanko.yunxi.mes.framework.common.pojo.PageParam; import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils; import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils;
import com.chanko.yunxi.mes.module.heli.dal.mysql.storage.StorageMapper;
import com.chanko.yunxi.mes.module.heli.dal.mysql.storage.StorageMapper;
import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.*; import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.chanko.yunxi.mes.module.heli.enums.CodeEnum.STOCK_IN;
/** import static com.chanko.yunxi.mes.module.heli.enums.CodeEnum.WAREHOUSE;
* / Service import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.*;
*
* @author /**
*/ * / Service
@Service *
@Validated * @author
public class StorageServiceImpl implements StorageService { */
@Service
@Resource @Validated
private StorageMapper storageMapper; public class StorageServiceImpl implements StorageService {
@Override @Resource
public Long createStorage(StorageSaveReqVO createReqVO) { private StorageMapper storageMapper;
// 插入
StorageDO storage = BeanUtils.toBean(createReqVO, StorageDO.class); @Override
storageMapper.insert(storage); public Long createStorage(StorageSaveReqVO createReqVO) {
// 返回 // 插入
return storage.getId(); StorageDO storage = BeanUtils.toBean(createReqVO, StorageDO.class);
} storage.setStockNo(UUID.fastUUID().toString(true));
storageMapper.insert(storage);
@Override
public void updateStorage(StorageSaveReqVO updateReqVO) { storage.setStockNo(STOCK_IN.getCode(storage.getId().toString()));
// 校验存在 storageMapper.updateById(storage);
validateStorageExists(updateReqVO.getId()); // 返回
// 更新 return storage.getId();
StorageDO updateObj = BeanUtils.toBean(updateReqVO, StorageDO.class); }
storageMapper.updateById(updateObj);
} @Override
public void updateStorage(StorageSaveReqVO updateReqVO) {
@Override // 校验存在
public void deleteStorage(Long id) { validateStorageExists(updateReqVO.getId());
// 校验存在 // 更新
validateStorageExists(id); StorageDO updateObj = BeanUtils.toBean(updateReqVO, StorageDO.class);
// 删除 storageMapper.updateById(updateObj);
storageMapper.deleteById(id); }
}
@Override
private void validateStorageExists(Long id) { public void deleteStorage(Long id) {
if (storageMapper.selectById(id) == null) { // 校验存在
throw exception(STORAGE_NOT_EXISTS); validateStorageExists(id);
} // 删除
} storageMapper.deleteById(id);
}
@Override
public StorageDO getStorage(Long id) { private void validateStorageExists(Long id) {
return storageMapper.selectById(id); if (storageMapper.selectById(id) == null) {
} throw exception(STORAGE_NOT_EXISTS);
}
@Override }
public PageResult<StorageDO> getStoragePage(StoragePageReqVO pageReqVO) {
return storageMapper.selectPage(pageReqVO); @Override
} public StorageDO getStorage(Long id) {
return storageMapper.selectById(id);
} }
@Override
public PageResult<StorageDO> getStoragePage(StoragePageReqVO pageReqVO) {
return storageMapper.selectPage(pageReqVO);
}
}

@ -0,0 +1,55 @@
package com.chanko.yunxi.mes.module.heli.service.storagemat;
import java.util.*;
import javax.validation.*;
import com.chanko.yunxi.mes.module.heli.controller.admin.storagemat.vo.*;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.storagemat.StorageMatDO;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
/**
* / Service
*
* @author
*/
public interface StorageMatService {
/**
* /
*
* @param createReqVO
* @return
*/
Long createStorageMat(@Valid StorageMatSaveReqVO createReqVO);
/**
* /
*
* @param updateReqVO
*/
void updateStorageMat(@Valid StorageMatSaveReqVO updateReqVO);
/**
* /
*
* @param id
*/
void deleteStorageMat(Long id);
/**
* /
*
* @param id
* @return /
*/
StorageMatDO getStorageMat(Long id);
/**
* /
*
* @param pageReqVO
* @return /
*/
PageResult<StorageMatDO> getStorageMatPage(StorageMatPageReqVO pageReqVO);
}

@ -0,0 +1,74 @@
package com.chanko.yunxi.mes.module.heli.service.storagemat;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import com.chanko.yunxi.mes.module.heli.controller.admin.storagemat.vo.*;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.storagemat.StorageMatDO;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
import com.chanko.yunxi.mes.framework.common.pojo.PageParam;
import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils;
import com.chanko.yunxi.mes.module.heli.dal.mysql.storagemat.StorageMatMapper;
import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.*;
/**
* / Service
*
* @author
*/
@Service
@Validated
public class StorageMatServiceImpl implements StorageMatService {
@Resource
private StorageMatMapper storageMatMapper;
@Override
public Long createStorageMat(StorageMatSaveReqVO createReqVO) {
// 插入
StorageMatDO storageMat = BeanUtils.toBean(createReqVO, StorageMatDO.class);
storageMatMapper.insert(storageMat);
// 返回
return storageMat.getId();
}
@Override
public void updateStorageMat(StorageMatSaveReqVO updateReqVO) {
// 校验存在
validateStorageMatExists(updateReqVO.getId());
// 更新
StorageMatDO updateObj = BeanUtils.toBean(updateReqVO, StorageMatDO.class);
storageMatMapper.updateById(updateObj);
}
@Override
public void deleteStorageMat(Long id) {
// 校验存在
validateStorageMatExists(id);
// 删除
storageMatMapper.deleteById(id);
}
private void validateStorageMatExists(Long id) {
if (storageMatMapper.selectById(id) == null) {
throw exception(STORAGE_MAT_NOT_EXISTS);
}
}
@Override
public StorageMatDO getStorageMat(Long id) {
return storageMatMapper.selectById(id);
}
@Override
public PageResult<StorageMatDO> getStorageMatPage(StorageMatPageReqVO pageReqVO) {
return storageMatMapper.selectPage(pageReqVO);
}
}

@ -0,0 +1,12 @@
<?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="com.chanko.yunxi.mes.module.heli.dal.mysql.storagemat.StorageMatMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

@ -1,49 +1,49 @@
import request from '@/config/axios' import request from '@/config/axios'
export interface StorageVO { export interface StorageVO {
id: number id: number
stockType: number stockType: number
stockInType: number stockInType: number
stockOutType: number stockOutType: number
stockNo: string stockNo: string
headerNo: number headerNo: number
description: string description: string
status: number status: number
whId: number whId: number
keeper: number keeper: number
keeperTime: Date keeperTime: Date
outbound: number outbound: number
outboundTime: Date outboundTime: Date
cancel: number cancel: number
cancelTime: Date cancelTime: Date
} }
// 查询入/出库分页 // 查询入/出库分页
export const getStoragePage = async (params) => { export const getStoragePage = async (params) => {
return await request.get({ url: `/heli/storage/page`, params }) return await request.get({ url: `/heli/storage/page`, params })
} }
// 查询入/出库详情 // 查询入/出库详情
export const getStorage = async (id: number) => { export const getStorage = async (id: number) => {
return await request.get({ url: `/heli/storage/get?id=` + id }) return await request.get({ url: `/heli/storage/get?id=` + id })
} }
// 新增入/出库 // 新增入/出库
export const createStorage = async (data: StorageVO) => { export const createStorage = async (data: StorageVO) => {
return await request.post({ url: `/heli/storage/create`, data }) return await request.post({ url: `/heli/storage/create`, data })
} }
// 修改入/出库 // 修改入/出库
export const updateStorage = async (data: StorageVO) => { export const updateStorage = async (data: StorageVO) => {
return await request.put({ url: `/heli/storage/update`, data }) return await request.put({ url: `/heli/storage/update`, data })
} }
// 删除入/出库 // 删除入/出库
export const deleteStorage = async (id: number) => { export const deleteStorage = async (id: number) => {
return await request.delete({ url: `/heli/storage/delete?id=` + id }) return await request.delete({ url: `/heli/storage/delete?id=` + id })
} }
// 导出入/出库 Excel // 导出入/出库 Excel
export const exportStorage = async (params) => { export const exportStorage = async (params) => {
return await request.download({ url: `/heli/storage/export-excel`, params }) return await request.download({ url: `/heli/storage/export-excel`, params })
} }

@ -0,0 +1,49 @@
import request from '@/config/axios'
export interface StorageMatVO {
id: number
stockId: number
matId: number
whId: number
rgId: number
pnId: number
storageOkQty: number
lotNo: string
description: string
}
// 查询入/出库物料分页
export const getStorageMatPage = async (params) => {
return await request.get({ url: `/heli/storage-mat/page`, params })
}
// 查询入/出库物料详情
export const getStorageMat = async (id: number) => {
return await request.get({ url: `/heli/storage-mat/get?id=` + id })
}
// 新增入/出库物料
export const createStorageMat = async (data: StorageMatVO) => {
return await request.post({ url: `/heli/storage-mat/create`, data })
}
// 批量新增入/出库物料
export const createStorageMatBatch = async (data: StorageMatVO[]) => {
return await request.post({ url: `/heli/storage-mat/create-batch`, data })
}
// 修改入/出库物料
export const updateStorageMat = async (data: StorageMatVO) => {
return await request.put({ url: `/heli/storage-mat/update`, data })
}
// 删除入/出库物料
export const deleteStorageMat = async (id: number) => {
return await request.delete({ url: `/heli/storage-mat/delete?id=` + id })
}
// 导出入/出库物料 Excel
export const exportStorageMat = async (params) => {
return await request.download({ url: `/heli/storage-mat/export-excel`, params })
}

@ -39,8 +39,8 @@
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item prop="code" label="上游单号"> <el-form-item prop="headerNo" label="上游单号">
<el-input v-model="formData.code" /> <el-input v-model="formData.headerNo" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -91,7 +91,7 @@
</el-col> </el-col>
<el-table :data="formData.productBomItemDOList" class="hl-table" @cell-click="handleCellClick" <el-table :data="formData.productBomItemDOList" class="hl-table" @cell-click="handleCellClick"
@cell-blur="handleCellBlur"> @cell-blur="handleCellBlur">
<el-table-column prop="id" label="序号" :width="80" /> <el-table-column prop="cid" label="序号" :width="80" />
<el-table-column prop="matCode" label="物料编码" required> <el-table-column prop="matCode" label="物料编码" required>
<template #default="scope"> <template #default="scope">
<el-select v-model="scope.row.matCode" placeholder="物料编码" :remote-method="remoteMatCodeSearch" <el-select v-model="scope.row.matCode" placeholder="物料编码" :remote-method="remoteMatCodeSearch"
@ -116,26 +116,26 @@
</el-table-column> </el-table-column>
<el-table-column prop="matType" label="物料类型"> <el-table-column prop="matType" label="物料类型">
<template #default="scope"> <template #default="scope">
<dict-tag :type="DICT_TYPE.HELI_MATERIAL_TYPE" :value="scope.row.matType" /> <dict-tag :type="DICT_TYPE.HELI_MATERIAL_TYPE" :value="scope.row.matType" v-if="scope.row.matType?true:false"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="matSpec" label="规格/型号" /> <el-table-column prop="matSpec" label="规格/型号" />
<el-table-column prop="matUnit" label="系统单位"> <el-table-column prop="matUnit" label="系统单位">
<template #default="scope"> <template #default="scope">
<dict-tag :type="DICT_TYPE.HELI_MATERIAL_UNIT" :value="scope.row.matUnit" /> <dict-tag :type="DICT_TYPE.HELI_MATERIAL_UNIT" :value="scope.row.matUnit" v-if="scope.row.matUnit?true:false" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="rgid" width="140" label="入库库区" required> <el-table-column prop="rgId" width="140" label="入库库区" required>
<template #default="scope"> <template #default="scope">
<el-select v-model="scope.row.rgid" placeholder="" style="width: 100%" @change="handleRg(scope)"> <el-select v-model="scope.row.rgId" placeholder="" style="width: 100%" @change="handleRg(scope)">
<el-option v-for="dict in rgList" :key="dict.id" :label="dict.rgName" :value="dict.id" /> <el-option v-for="dict in rgList" :key="dict.id" :label="dict.rgName" :value="dict.id" />
</el-select> </el-select>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="pnid" width="140" label="入库库位" required> <el-table-column prop="pnId" width="140" label="入库库位" required>
<template #default="scope"> <template #default="scope">
<el-select v-model="scope.row.pnid" placeholder="" style="width: 100%"> <el-select v-model="scope.row.pnId" placeholder="" style="width: 100%">
<el-option v-for="dict in scope.row.pnlist" :key="dict.id" :label="dict.pnName" :value="dict.id" /> <el-option v-for="dict in scope.row.pnlist" :key="dict.id" :label="dict.pnName" :value="dict.id" />
</el-select> </el-select>
</template> </template>
@ -272,7 +272,8 @@ import { ElMessage, ElMessageBox } from 'element-plus'
import type { UploadProps, UploadUserFile } from 'element-plus' import type { UploadProps, UploadUserFile } from 'element-plus'
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict' import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
import * as MouldTypeApi from '@/api/heli/mouldtype' import * as StorageApi from '@/api/heli/storage'
import * as StorageMatApi from '@/api/heli/storagemat'
import * as MaterialApi from '@/api/heli/material' import * as MaterialApi from '@/api/heli/material'
import * as WarehouseApi from '@/api/heli/warehouse' import * as WarehouseApi from '@/api/heli/warehouse'
@ -283,6 +284,7 @@ import download from "@/utils/download";
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
const router = useRoute();
const isShow = ref(false) const isShow = ref(false)
const dialogVisible = ref(false) // const dialogVisible = ref(false) //
@ -291,13 +293,13 @@ const formLoading = ref(false) // 表单的加载中1修改时的数据加
const formType = ref('') // create - update - const formType = ref('') // create - update -
const formData = ref({ const formData = ref({
id: undefined, id: undefined,
stockType: undefined, stockType: 1,
stockInType: undefined, stockInType: undefined,
stockOutType: undefined, stockOutType: undefined,
stockNo: undefined, stockNo: undefined,
headerNo: undefined, headerNo: undefined,
description: undefined, description: undefined,
status: undefined, status: 1,
whId: undefined, whId: undefined,
creator: undefined, creator: undefined,
createTime: undefined, createTime: undefined,
@ -328,13 +330,14 @@ const open = async (type: string, id?: number) => {
if (id) { if (id) {
formLoading.value = true formLoading.value = true
try { try {
formData.value = await MouldTypeApi.getMouldType(id) formData.value = await StorageApi.getStorage(id)
} finally { } finally {
formLoading.value = false formLoading.value = false
} }
} }
} }
defineExpose({ open }) // open defineExpose({ open }) // open
const storageid = ref()
/** 提交表单 */ /** 提交表单 */
const emit = defineEmits(['success']) // success const emit = defineEmits(['success']) // success
@ -344,12 +347,22 @@ const submitForm = async () => {
// //
formLoading.value = true formLoading.value = true
try { try {
const data = formData.value as unknown as MouldTypeApi.MouldTypeVO const data = formData.value as unknown as StorageApi.StorageVO
if (formType.value === 'create') { if (router.query.type === 'create') {
await MouldTypeApi.createMouldType(data) storageid.value = await StorageApi.createStorage(data)
formData.value.productBomItemDOList.forEach( item=>{
item.stockId = storageid.value
item.whId = formData.value.whId
})
const dataMats = formData.value.productBomItemDOList as unknown as StorageMatApi.StorageMatVO[]
var aa = await StorageMatApi.createStorageMatBatch(dataMats)
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
} else { } else {
await MouldTypeApi.updateMouldType(data) await StorageApi.updateStorage(data)
message.success(t('common.updateSuccess')) message.success(t('common.updateSuccess'))
} }
// //
@ -377,16 +390,17 @@ var matCount = 1
const onAddItem = () => { const onAddItem = () => {
const newData = { const newData = {
// //
id : matCount, cid : matCount,
stockId : 0,
matId: '', matId: '',
matName: '', matName: '',
matCode: '', matCode: '',
matType :'', matType : '',
matSpec: '', matSpec: '',
matUnit: '', matUnit: '',
whid: '', whId: '',
rgid: '', rgId: '',
pnid: '', pnId: '',
pnlist : ref([]), pnlist : ref([]),
storageOkQty: '', storageOkQty: '',
lotNo: '', lotNo: '',
@ -405,16 +419,17 @@ const handlefuke = (index, item) => {
// //
const newData: any = { const newData: any = {
...data, ...data,
id : matCount, cid : matCount,
stockId : item.stockId,
matId: item.matId, matId: item.matId,
matName: item.matName, matName: item.matName,
matCode: item.matCode, matCode: item.matCode,
matType : item.matType, matType : item.matType,
matSpec: item.matSpec, matSpec: item.matSpec,
matUnit: item.matUnit, matUnit: item.matUnit,
whid: item.whid, whId: item.whId,
rgid: item.rgid, rgId: item.rgId,
pnid: item.pnid, pnId: item.pnId,
pnlist : item.pnlist, pnlist : item.pnlist,
storageOkQty: item.storageOkQty, storageOkQty: item.storageOkQty,
lotNo: item.lotNo, lotNo: item.lotNo,
@ -539,8 +554,8 @@ const handleWh = (async (wid) => {
rgList.value = dataRg.list rgList.value = dataRg.list
formData.value.productBomItemDOList.forEach( item =>{ formData.value.productBomItemDOList.forEach( item =>{
item.rgid = '' item.rgId = ''
item.pnid = '' item.pnId = ''
item.pnlist.value = [] item.pnlist.value = []
}) })
//------------------- //-------------------
@ -550,7 +565,7 @@ const handleRg = (async (scope) => {
const queryParamsRPn = reactive({ const queryParamsRPn = reactive({
pageNo: 1, pageNo: 1,
pageSize: 99, pageSize: 99,
rgId: scope.row.rgid, rgId: scope.row.rgId,
pnStatus: 1 pnStatus: 1
}) })
const dataPn = await PnApi.getPnPage(queryParamsRPn) const dataPn = await PnApi.getPnPage(queryParamsRPn)
@ -615,7 +630,7 @@ const handleMatCode = async (scope,matid) =>{
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
const router = useRoute();
dialogTitle.value = t('action.' + router.query.type) dialogTitle.value = t('action.' + router.query.type)
isShow.value = router.query.type == "create" ? false : true isShow.value = router.query.type == "create" ? false : true

@ -35,7 +35,7 @@
class="!w-240px" class="!w-240px"
/> />
</el-form-item> </el-form-item>
<el-form-item label="物料名称" prop="matName"> <!-- <el-form-item label="物料名称" prop="matName">
<el-input <el-input
v-model="queryParams.matName" v-model="queryParams.matName"
placeholder="物料名称" placeholder="物料名称"
@ -43,7 +43,7 @@
@keyup.enter="handleQuery" @keyup.enter="handleQuery"
class="!w-240px" class="!w-240px"
/> />
</el-form-item> </el-form-item> -->
<el-form-item label="入库类型" prop="stockInType"> <el-form-item label="入库类型" prop="stockInType">
<el-select <el-select
v-model="queryParams.stockInType" v-model="queryParams.stockInType"
@ -131,7 +131,11 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="备注" align="center" prop="description" /> <el-table-column label="备注" align="center" prop="description" />
<el-table-column label="创建人" align="center" prop="creator" >
<template #default="scope">
{{ userList.find((user) => user.id === scope.row.creator)?.nickname }}
</template>
</el-table-column>
<el-table-column <el-table-column
label="创建时间" label="创建时间"
align="center" align="center"
@ -139,23 +143,24 @@
:formatter="dateFormatter" :formatter="dateFormatter"
width="180px" width="180px"
/> />
<el-table-column label="创建人" align="center" prop="creator" />
<el-table-column <el-table-column label="提交人" align="center" prop="keeper" >
label="创建时间" <template #default="scope">
align="center" {{ userList.find((user) => user.id == scope.row.keeper)?.nickname }}
prop="creatorTime" </template>
:formatter="dateFormatter" </el-table-column>
width="180px"
/>
<el-table-column label="入库人" align="center" prop="keeper" />
<el-table-column <el-table-column
label="入库时间" label="提交时间"
align="center" align="center"
prop="keeperTime" prop="keeperTime"
:formatter="dateFormatter" :formatter="dateFormatter"
width="180px" width="180px"
/> />
<el-table-column label="作废人" align="center" prop="cancel" /> <el-table-column label="作废人" align="center" prop="cancel" >
<template #default="scope">
{{ userList.find((user) => user.id == scope.row.cancel)?.nickname }}
</template>
</el-table-column>
<el-table-column <el-table-column
label="作废时间" label="作废时间"
align="center" align="center"
@ -165,7 +170,7 @@
/> />
<el-table-column label="单据状态" align="center" prop="status"> <el-table-column label="单据状态" align="center" prop="status">
<template #default="scope"> <template #default="scope">
<dict-tag :type="DICT_TYPE.HELI_COMMON_STATUS" :value="scope.row.status" /> <dict-tag :type="DICT_TYPE.HELI_STORAGE_STATUS" :value="scope.row.status" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center"> <el-table-column label="操作" align="center">
@ -211,6 +216,7 @@ import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download' import download from '@/utils/download'
import * as StorageApi from '@/api/heli/storage' import * as StorageApi from '@/api/heli/storage'
import * as WarehouseApi from '@/api/heli/warehouse' import * as WarehouseApi from '@/api/heli/warehouse'
import * as UserApi from "@/api/system/user";
defineOptions({ name: 'Storage' }) defineOptions({ name: 'Storage' })
@ -224,7 +230,7 @@ const total = ref(0) // 列表的总页数
const queryParams = reactive({ const queryParams = reactive({
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
stockType: undefined, stockType: 1,
stockInType: undefined, stockInType: undefined,
stockOutType: undefined, stockOutType: undefined,
stockNo: undefined, stockNo: undefined,
@ -248,6 +254,7 @@ const queryParams = reactive({
const queryFormRef = ref() // const queryFormRef = ref() //
const exportLoading = ref(false) // const exportLoading = ref(false) //
const warehouseList = ref([]) const warehouseList = ref([])
const userList = ref<UserApi.UserVO[]>([]) //
/** 查询列表 */ /** 查询列表 */
const getList = async () => { const getList = async () => {
@ -299,6 +306,8 @@ onMounted(async () => {
warehouseList.value = data.list warehouseList.value = data.list
userList.value = await UserApi.getSimpleUserList()
await getList() await getList()
}) })
</script> </script>
Loading…
Cancel
Save