出入库 物料接口

出入库 物料接口
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 PN_NOT_EXISTS = new ErrorCode(1_003_003, "库位不存在");
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, "项目订单不存在");

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

@ -26,7 +26,6 @@ public class StorageSaveReqVO {
private Integer stockOutType;
@Schema(description = "入/出库单号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "入/出库单号不能为空")
private String stockNo;
@Schema(description = "上游单号")

@ -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,5 +1,6 @@
package com.chanko.yunxi.mes.module.heli.service.storage;
import cn.hutool.core.lang.UUID;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
@ -15,6 +16,8 @@ import com.chanko.yunxi.mes.framework.common.util.object.BeanUtils;
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.CodeEnum.STOCK_IN;
import static com.chanko.yunxi.mes.module.heli.enums.CodeEnum.WAREHOUSE;
import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.*;
/**
@ -33,7 +36,11 @@ public class StorageServiceImpl implements StorageService {
public Long createStorage(StorageSaveReqVO createReqVO) {
// 插入
StorageDO storage = BeanUtils.toBean(createReqVO, StorageDO.class);
storage.setStockNo(UUID.fastUUID().toString(true));
storageMapper.insert(storage);
storage.setStockNo(STOCK_IN.getCode(storage.getId().toString()));
storageMapper.updateById(storage);
// 返回
return storage.getId();
}

@ -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>

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

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