出入库 优化

出入库 优化
pull/3/head
siontion 9 months ago
parent b949dfd2ec
commit e4d37d22cb

@ -92,4 +92,12 @@ public class MaterialController {
BeanUtils.toBean(list, MaterialRespVO.class)); BeanUtils.toBean(list, MaterialRespVO.class));
} }
@GetMapping({"/all-simples"})
@Operation(summary = "TODO:获取物料精简信息列表", description = "只包含被开启的物料,主要用于前端的下拉选项")
public CommonResult<List<Map<String, Object>> > getSimpleList() {
List<Map<String, Object>> list = materialService.getSimpleList();
// 拼接数据
return success(list);
}
} }

@ -87,8 +87,8 @@ public class StorageMatController {
@GetMapping("/page") @GetMapping("/page")
@Operation(summary = "获得入/出库物料分页") @Operation(summary = "获得入/出库物料分页")
@PreAuthorize("@ss.hasPermission('heli:storage-mat:query')") @PreAuthorize("@ss.hasPermission('heli:storage-mat:query')")
public CommonResult<PageResult<StorageMatRespVO>> getStorageMatPage(@Valid StorageMatPageReqVO pageReqVO) { public CommonResult<List<StorageMatRespVO>> getStorageMatPage(@Valid StorageMatPageReqVO pageReqVO) {
PageResult<StorageMatDO> pageResult = storageMatService.getStorageMatPage(pageReqVO); List<StorageMatDO> pageResult = storageMatService.getStorageMatPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, StorageMatRespVO.class)); return success(BeanUtils.toBean(pageResult, StorageMatRespVO.class));
} }
@ -99,7 +99,7 @@ public class StorageMatController {
public void exportStorageMatExcel(@Valid StorageMatPageReqVO pageReqVO, public void exportStorageMatExcel(@Valid StorageMatPageReqVO pageReqVO,
HttpServletResponse response) throws IOException { HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<StorageMatDO> list = storageMatService.getStorageMatPage(pageReqVO).getList(); List<StorageMatDO> list = storageMatService.getStorageMatPage(pageReqVO);
// 导出 Excel // 导出 Excel
ExcelUtils.write(response, "入/出库物料.xls", "数据", StorageMatRespVO.class, ExcelUtils.write(response, "入/出库物料.xls", "数据", StorageMatRespVO.class,
BeanUtils.toBean(list, StorageMatRespVO.class)); BeanUtils.toBean(list, StorageMatRespVO.class));
@ -110,8 +110,8 @@ public class StorageMatController {
@Operation(summary = "获得入/出库物料") @Operation(summary = "获得入/出库物料")
@Parameter(name = "id", description = "编号", required = true, example = "1024") @Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('heli:storage-mat:query')") @PreAuthorize("@ss.hasPermission('heli:storage-mat:query')")
public CommonResult<List<StorageMatValidRespVO>> getStorageMatList() { public CommonResult<List<StorageMatValidRespVO>> getStorageMatList(@RequestParam("whId") Long whId) {
List<StorageMatValidRespVO> list = storageMatService.getStorageMatList(); List<StorageMatValidRespVO> list = storageMatService.getStorageMatList(whId);
return success(BeanUtils.toBean(list, StorageMatValidRespVO.class)); return success(BeanUtils.toBean(list, StorageMatValidRespVO.class));
} }

@ -1,14 +1,19 @@
package com.chanko.yunxi.mes.module.heli.dal.mysql.material; package com.chanko.yunxi.mes.module.heli.dal.mysql.material;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.chanko.yunxi.mes.framework.common.pojo.PageResult; import com.chanko.yunxi.mes.framework.common.pojo.PageResult;
import com.chanko.yunxi.mes.framework.mybatis.core.mapper.BaseMapperX; import com.chanko.yunxi.mes.framework.mybatis.core.mapper.BaseMapperX;
import com.chanko.yunxi.mes.module.heli.controller.admin.material.vo.MaterialPageReqVO; import com.chanko.yunxi.mes.module.heli.controller.admin.material.vo.MaterialPageReqVO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.material.MaterialDO; import com.chanko.yunxi.mes.module.heli.dal.dataobject.material.MaterialDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.pn.PnDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.supplier.SupplierDO; import com.chanko.yunxi.mes.module.heli.dal.dataobject.supplier.SupplierDO;
import com.github.yulichang.wrapper.MPJLambdaWrapper; import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.util.List;
import java.util.Map;
/** /**
* Mapper * Mapper
* *
@ -32,4 +37,9 @@ public interface MaterialMapper extends BaseMapperX<MaterialDO> {
return selectPage(reqVO, query); return selectPage(reqVO, query);
} }
default List<Map<String, Object>> selectSimpleList() {
return selectMaps(new QueryWrapper<MaterialDO>().select("id", "name","code","material_type","spec","unit").lambda());
}
} }

@ -37,7 +37,7 @@ public interface PnMapper extends BaseMapperX<PnDO> {
} }
default List<Map<String, Object>> selectSimpleList() { default List<Map<String, Object>> selectSimpleList() {
return selectMaps(new QueryWrapper<PnDO>().select("id", "pn_name","rg_id").lambda()); return selectMaps(new QueryWrapper<PnDO>().select("id", "pn_name","rg_id","wh_id").lambda());
} }
} }

@ -42,9 +42,8 @@ public interface StorageMatMapper extends BaseMapperX<StorageMatDO> {
default List<StorageMatDO> selectMatByStorckID(Long stockId) { default List<StorageMatDO> selectMatByStorckID(Long stockId) {
MPJLambdaWrapper<StorageMatDO> query = new MPJLambdaWrapper<>(); MPJLambdaWrapper<StorageMatDO> query = new MPJLambdaWrapper<>();
query.selectAll(StorageMatDO.class) query.selectAll(StorageMatDO.class).eq(stockId!= null && stockId!= 0,StorageMatDO::getStockId, stockId);
.eq(StorageMatDO::getStockId, stockId);
return selectList(query); return selectList(query);
} }
List<StorageMatValidRespVO> selectStorageMatValid(); List<StorageMatValidRespVO> selectStorageMatValid(Long whId);
} }

@ -52,4 +52,6 @@ public interface MaterialService {
*/ */
PageResult<MaterialDO> getMaterialPage(MaterialPageReqVO pageReqVO); PageResult<MaterialDO> getMaterialPage(MaterialPageReqVO pageReqVO);
List<Map<String, Object>> getSimpleList();
} }

@ -12,6 +12,9 @@ import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.chanko.yunxi.mes.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.CODE_REPEAT; import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.CODE_REPEAT;
import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.MATERIAL_NOT_EXISTS; import static com.chanko.yunxi.mes.module.heli.enums.ErrorCodeConstants.MATERIAL_NOT_EXISTS;
@ -85,4 +88,8 @@ public class MaterialServiceImpl implements MaterialService {
return materialMapper.selectPage(pageReqVO); return materialMapper.selectPage(pageReqVO);
} }
@Override
public List<Map<String, Object>> getSimpleList() {
return materialMapper.selectSimpleList();
}
} }

@ -50,14 +50,14 @@ public interface StorageMatService {
* @param pageReqVO * @param pageReqVO
* @return / * @return /
*/ */
PageResult<StorageMatDO> getStorageMatPage(StorageMatPageReqVO pageReqVO); List<StorageMatDO> getStorageMatPage(StorageMatPageReqVO pageReqVO);
/** /**
* / * /
* *
* @return / * @return /
*/ */
List<StorageMatValidRespVO> getStorageMatList(); List<StorageMatValidRespVO> getStorageMatList(Long whId);
int deleteStorageMatList(Long stockId); int deleteStorageMatList(Long stockId);

@ -73,13 +73,13 @@ public class StorageMatServiceImpl implements StorageMatService {
} }
@Override @Override
public PageResult<StorageMatDO> getStorageMatPage(StorageMatPageReqVO pageReqVO) { public List<StorageMatDO> getStorageMatPage(StorageMatPageReqVO pageReqVO) {
return storageMatMapper.selectPage(pageReqVO); return storageMatMapper.selectMatByStorckID(pageReqVO.getStockId());
} }
@Override @Override
public List<StorageMatValidRespVO> getStorageMatList() { public List<StorageMatValidRespVO> getStorageMatList(Long whId) {
return storageMatMapper.selectStorageMatValid(); return storageMatMapper.selectStorageMatValid(whId);
} }
@Override @Override

@ -22,7 +22,10 @@
<result property="matRest" column="mat_rest"/> <result property="matRest" column="mat_rest"/>
<result property="storageOkQty" column="storage_ok_qty"/> <result property="storageOkQty" column="storage_ok_qty"/>
</resultMap> </resultMap>
<select id="selectStorageMatValid" resultType="com.chanko.yunxi.mes.module.heli.controller.admin.storagemat.vo.StorageMatValidRespVO"> <select id="selectStorageMatValid" resultType="com.chanko.yunxi.mes.module.heli.controller.admin.storagemat.vo.StorageMatValidRespVO" parameterType="java.lang.Long">
select mat_id,mat_name,mat_code,mat_rest,material_type,wh_id,rg_id,pn_id,spec as mat_spec,unit as mat_unit,'' as lot_no,storage_ok_qty from v_storage_material_amount where mat_rest > 0 select mat_id,mat_name,mat_code,mat_rest,material_type,wh_id,rg_id,pn_id,spec as mat_spec,unit as mat_unit,'' as lot_no,storage_ok_qty from v_storage_material_amount where mat_rest > 0
<if test="wh_id != null and wh_id != ''">
AND wh_id = #{wh_id}
</if>
</select> </select>
</mapper> </mapper>

@ -29,6 +29,11 @@ export interface MaterialVO {
logo: string logo: string
} }
// 查询物料
export const getSimpList = async () => {
return await request.get({ url: `/heli/material/all-simples` })
}
// 查询物料分页 // 查询物料分页
export const getMaterialPage = async (params) => { export const getMaterialPage = async (params) => {
return await request.get({ url: `/heli/material/page`, params }) return await request.get({ url: `/heli/material/page`, params })

@ -14,8 +14,8 @@ export interface StorageMatVO {
} }
// 查询入/出库物料详情 // 查询入/出库物料详情
export const getStorageMatList = async () => { export const getStorageMatList = async (whId:number) => {
return await request.get({ url: `/heli/storage-mat/get-materials`}) return await request.get({ url: `/heli/storage-mat/get-materials?whId=`+whId})
} }
// 查询入/出库物料分页 // 查询入/出库物料分页

@ -27,7 +27,7 @@
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item prop="stockInType" label="入库类型"> <el-form-item prop="stockInType" label="入库类型">
<el-select v-model="formData.stockInType" clearable style="width: 100%" @change="handleStockType" v-bind:disabled="btnView || btnSave"> <el-select v-model="formData.stockInType" clearable style="width: 100%" @change="handleStockType" v-bind:disabled="ctrView || ctrSave">
<el-option v-for="dict in getIntDictOptions(DICT_TYPE.HELI_STORAGE_IN_TYPE)" :key="dict.value" <el-option v-for="dict in getIntDictOptions(DICT_TYPE.HELI_STORAGE_IN_TYPE)" :key="dict.value"
:label="dict.label" :value="dict.value" /> :label="dict.label" :value="dict.value" />
</el-select> </el-select>
@ -49,7 +49,7 @@
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item prop="headerNo" label="上游单号"> <el-form-item prop="headerNo" label="上游单号">
<el-input v-model="formData.headerNo" class="!w-700px" v-bind:disabled="btnView || btnSave || enableHeadNo" /> <el-input v-model="formData.headerNo" class="!w-700px" v-bind:disabled="ctrView || ctrSave || enableHeadNo" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -67,8 +67,8 @@
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item prop="whId" label="入库仓库"> <el-form-item prop="whId" label="入库仓库">
<el-select v-model="formData.whId" placeholder="下拉选择" clearable class="!w-400px" @change="handleWh" v-bind:disabled="btnView || btnSave"> <el-select v-model="formData.whId" placeholder="下拉选择" clearable class="!w-400px" @change="handleWh" v-bind:disabled="ctrView || ctrSave">
<el-option v-for="dict in warehouseList" :key="dict.id" :label="dict.whName" :value="dict.id" /> <el-option v-for="dict in whList" :key="dict.id" :label="dict.whName" :value="dict.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -78,7 +78,7 @@
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="备注" prop="description"> <el-form-item label="备注" prop="description">
<el-input type="textarea" v-model="formData.description" show-word-limit maxlength="200" v-bind:disabled="btnView || btnSave" /> <el-input type="textarea" v-model="formData.description" show-word-limit maxlength="200" v-bind:disabled="ctrView || ctrSave" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -92,7 +92,7 @@
<el-col> <el-col>
<el-card class="hl-incard"> <el-card class="hl-incard">
<el-col> <el-col>
<el-button class="hl-addbutton" type="primary" size="large" @click="onAddItem" v-bind:disabled="btnView || btnSave">新增</el-button> <el-button class="hl-addbutton" type="primary" size="large" @click="onAddItem" v-bind:disabled="ctrView || ctrSave">新增</el-button>
</el-col> </el-col>
<el-form ref="matSubFormRef" :model="formData.matItemDOList" :rules="subFormRules" <el-form ref="matSubFormRef" :model="formData.matItemDOList" :rules="subFormRules"
v-loading="subFormLoading" label-width="0"> v-loading="subFormLoading" label-width="0">
@ -102,7 +102,7 @@
<template #header> <span class="hl-table_header">*</span> 物料编码 </template> <template #header> <span class="hl-table_header">*</span> 物料编码 </template>
<template #default="scope"> <template #default="scope">
<el-form-item :prop="`${scope.$index}.matId`" :rules="subFormRules.matId" class="mb-0px!"> <el-form-item :prop="`${scope.$index}.matId`" :rules="subFormRules.matId" class="mb-0px!">
<el-select v-model="scope.row.matId" placeholder="物料编码" :remote-method="remoteMatCodeSearch" v-bind:disabled="btnView || btnSave" <el-select v-model="scope.row.matId" placeholder="物料编码" :remote-method="remoteMatCodeSearch" v-bind:disabled="ctrView || ctrSave"
remote-show-suffix remote clearable reserve-keyword filterable :loading="matSelectLoading" remote-show-suffix remote clearable reserve-keyword filterable :loading="matSelectLoading"
@change="(val) => handleMatCode(scope, val)" class="!w-180px"> @change="(val) => handleMatCode(scope, val)" class="!w-180px">
<el-option v-for="item in matList" :key="item.id" :label="item.code" :value="item.id" /> <el-option v-for="item in matList" :key="item.id" :label="item.code" :value="item.id" />
@ -129,8 +129,8 @@
<template #header> <span class="hl-table_header">*</span> 入库库区 </template> <template #header> <span class="hl-table_header">*</span> 入库库区 </template>
<template #default="scope"> <template #default="scope">
<el-form-item :prop="`${scope.$index}.rgId`" :rules="subFormRules.rgId" class="mb-0px!"> <el-form-item :prop="`${scope.$index}.rgId`" :rules="subFormRules.rgId" class="mb-0px!">
<el-select v-model="scope.row.rgId" placeholder="" style="width: 100%" @change="handleRg(scope)" v-bind:disabled="btnView || btnSave"> <el-select v-model="scope.row.rgId" placeholder="" style="width: 100%" @change="handleRg(scope)" v-bind:disabled="ctrView || ctrSave">
<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.rg_name" :value="dict.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</template> </template>
@ -139,8 +139,8 @@
<template #header> <span class="hl-table_header">*</span> 入库库位 </template> <template #header> <span class="hl-table_header">*</span> 入库库位 </template>
<template #default="scope"> <template #default="scope">
<el-form-item :prop="`${scope.$index}.pnId`" :rules="subFormRules.pnId" class="mb-0px!"> <el-form-item :prop="`${scope.$index}.pnId`" :rules="subFormRules.pnId" class="mb-0px!">
<el-select v-model="scope.row.pnId" placeholder="" style="width: 100%" v-bind:disabled="btnView || btnSave"> <el-select v-model="scope.row.pnId" placeholder="" style="width: 100%" v-bind:disabled="ctrView || ctrSave">
<el-option v-for="dict in scope.row.pnlist" :key="dict.id" :label="dict.pnName" <el-option v-for="dict in scope.row.pnlist" :key="dict.id" :label="dict.pn_name"
:value="dict.id" /> :value="dict.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -151,29 +151,29 @@
<template #default="scope"> <template #default="scope">
<el-form-item :prop="`${scope.$index}.storageOkQty`" :rules="subFormRules.storageOkQty" <el-form-item :prop="`${scope.$index}.storageOkQty`" :rules="subFormRules.storageOkQty"
class="mb-0px!"> class="mb-0px!">
<el-input v-model="scope.row.storageOkQty" v-bind:disabled="btnView || btnSave"/> <el-input v-model="scope.row.storageOkQty" v-bind:disabled="ctrView || ctrSave"/>
</el-form-item> </el-form-item>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="lotNo" label="批次号" align="center" min-width="120" v-if="false"> <el-table-column prop="lotNo" label="批次号" align="center" min-width="120" v-if="false">
<template #default="scope"> <template #default="scope">
<el-input v-model="scope.row.lotNo" v-bind:disabled="btnView || btnSave"/> <el-input v-model="scope.row.lotNo" v-bind:disabled="ctrView || ctrSave"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="projectNo" label="子项目编号" align="center" min-width="120"> <el-table-column prop="projectNo" label="子项目编号" align="center" min-width="120">
<template #default="scope"> <template #default="scope">
<el-input v-model="scope.row.projectNo" v-bind:disabled="btnView || btnSave"/> <el-input v-model="scope.row.projectNo" v-bind:disabled="ctrView || ctrSave"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="description" label="备注" align="center" min-width="180"> <el-table-column prop="description" label="备注" align="center" min-width="180">
<template #default="scope"> <template #default="scope">
<el-input v-model="scope.row.description" v-bind:disabled="btnView || btnSave" /> <el-input v-model="scope.row.description" v-bind:disabled="ctrView || ctrSave" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" min-width="120" fixed="right"> <el-table-column label="操作" align="center" min-width="120" fixed="right">
<template #default="scope"> <template #default="scope">
<el-button link type="danger" @click.prevent="handleDelete2(scope.$index)" v-bind:disabled="btnView || btnDelete"> <el-button link type="danger" @click.prevent="handleDelete2(scope.$index)" v-bind:disabled="ctrView || ctrDelete">
删除 删除
</el-button> </el-button>
</template> </template>
@ -199,7 +199,7 @@
'tenant-id': getTenantId() 'tenant-id': getTenantId()
}" name="files" :show-file-list="false" :auto-upload="false" :data="matUploadData" }" name="files" :show-file-list="false" :auto-upload="false" :data="matUploadData"
:on-change="matUploadChange" class="upload-file-uploader"> :on-change="matUploadChange" class="upload-file-uploader">
<el-button type="primary" v-bind:disabled="btnView || btnSave"> <el-button type="primary" v-bind:disabled="ctrView || ctrSave">
<Icon icon="ep:upload-filled" />上传 <Icon icon="ep:upload-filled" />上传
</el-button> </el-button>
</el-upload> </el-upload>
@ -215,11 +215,11 @@
<el-table-column label="操作" align="center"> <el-table-column label="操作" align="center">
<template #default="scope"> <template #default="scope">
<el-button link type="danger" size="small" v-bind:disabled="btnView || btnDelete" <el-button link type="danger" size="small" v-bind:disabled="ctrView || ctrDelete"
@click="handleDeleteAttachment(scope.$index, scope.row.businessFileType)" > @click="handleDeleteAttachment(scope.$index, scope.row.businessFileType)" >
删除 删除
</el-button> </el-button>
<el-button link type="primary" size="small" v-bind:disabled="btnView || btnDelete" <el-button link type="primary" size="small" v-bind:disabled="ctrView || ctrDelete"
@click="downloadAttachment(scope.row.name, scope.row.url)"> @click="downloadAttachment(scope.row.name, scope.row.url)">
下载 下载
</el-button> </el-button>
@ -276,11 +276,11 @@
</el-form> </el-form>
<div class="text-center hl-footer"> <div class="text-center hl-footer">
<el-button @click="() => router.go(-1)" size="large"> </el-button> <el-button @click="() => router.go(-1)" size="large"> </el-button>
<el-button @click="submitForm" type="success" :disabled="btnView || btnSave" size="large"> <el-button @click="submitForm" type="success" :disabled="ctrView || ctrSave" size="large">
</el-button> </el-button>
<el-button @click="handleStatus(2)" type="primary" :disabled="btnView || btnSave" size="large"> <el-button @click="handleStatus(2)" type="primary" :disabled="ctrView || ctrSave" size="large">
</el-button> </el-button>
<el-button @click="handleStatus(3)" type="danger" :disabled="btnView || btnCancel" size="large"> <el-button @click="handleStatus(3)" type="danger" :disabled="ctrView || ctrCancel" size="large">
</el-button> </el-button>
</div> </div>
</el-card> </el-card>
@ -350,7 +350,11 @@ const subFormRules = reactive({
pnId: [{ required: true, message: '库位不能为空', trigger: 'blur' }], pnId: [{ required: true, message: '库位不能为空', trigger: 'blur' }],
storageOkQty: [{ required: true, message: '入库数量不能为空', trigger: 'blur' }] storageOkQty: [{ required: true, message: '入库数量不能为空', trigger: 'blur' }]
}) })
//
const handleStatus = async (num) => { const handleStatus = async (num) => {
// //
await formRef.value.validate() await formRef.value.validate()
if (formData.value.matItemDOList.length === 0) { if (formData.value.matItemDOList.length === 0) {
@ -363,7 +367,10 @@ const handleStatus = async (num) => {
} catch (e) { } catch (e) {
return return
} }
//
await message.confirm('确认'+(num==2?'提交':'报废')+'入库信息?')
formData.value.status = num formData.value.status = num
// //
await saveFormData() await saveFormData()
@ -383,18 +390,16 @@ const handleStatus = async (num) => {
query.type= 'update' query.type= 'update'
reload() reload()
} }
const userList = ref<UserApi.UserVO[]>([]) //
//
const enableHeadNo = ref(false) const enableHeadNo = ref(false)
const handleStockType = async (typeid) => { const handleStockType = async (typeid) => {
formData.value.headerNo = '' formData.value.headerNo = ''
if (typeid == 1) { if (typeid == 1) {
enableHeadNo.value = false enableHeadNo.value = false
} else { } else {
enableHeadNo.value = true enableHeadNo.value = true
} }
} }
// ==================== ======================================= // ==================== =======================================
const uploadUrl = ref(import.meta.env.VITE_UPLOAD_BATCH_URL) const uploadUrl = ref(import.meta.env.VITE_UPLOAD_BATCH_URL)
@ -488,6 +493,8 @@ const saveFormData = async () => {
} }
} }
const submitForm = async () => { const submitForm = async () => {
// //
await formRef.value.validate() await formRef.value.validate()
if (formData.value.matItemDOList.length === 0) { if (formData.value.matItemDOList.length === 0) {
@ -500,6 +507,8 @@ const submitForm = async () => {
} catch (e) { } catch (e) {
return return
} }
//
await message.confirm('确认保存入库信息?')
// //
await saveFormData() await saveFormData()
@ -508,6 +517,7 @@ const submitForm = async () => {
query.type = 'update' query.type = 'update'
// //
reload() reload()
} }
var matCount = 1 var matCount = 1
@ -542,45 +552,32 @@ const handleDelete2 = (index: number) => {
} }
// //
const warehouseList = ref([]) const whList = ref([])
// //
var rgList = ref([]) const rgList = ref([])
// //
var pnList = ref([]) const pnList = ref([])
const handleWh = async (wid) => { const handleWh = async (wid) => {
//------------------- //-------------------
const queryParamsRg = reactive({ //
pageNo: 1, const dataRgList = await RgApi.getSimpList()
pageSize: 99, rgList.value = dataRgList.filter( rg => rg.wh_id == wid)
whId: wid
})
const dataRg = await RgApi.getRgPage(queryParamsRg)
rgList.value = []
pnList.value = []
rgList.value = dataRg.list
formData.value.matItemDOList.forEach((item) => { formData.value.matItemDOList.forEach((item) => {
item.rgId = '' item.rgId = ''
item.pnId = '' item.pnId = ''
item.pnlist.value = [] item.pnlist.value = []
}) })
//-------------------
} }
const handleRg = async (scope) => { const handleRg = async (scope) => {
//------------------- //-------------------
const queryParamsRPn = reactive({ const dataPnList = await PnApi.getSimpList()
pageNo: 1,
pageSize: 99,
rgId: scope.row.rgId,
pnStatus: 1
})
const dataPn = await PnApi.getPnPage(queryParamsRPn)
scope.row.pnid = '' scope.row.pnid = ''
scope.row.pnlist = dataPn.list scope.row.pnlist = dataPnList.filter( pn => pn.rg_id == scope.row.rgId)
//------------------- //-------------------
} }
//
const matList = ref<MaterialApi.MaterialVO[]>([]) // const matList = ref<MaterialApi.MaterialVO[]>([]) //
const matSelectLoading = ref(false) const matSelectLoading = ref(false)
const remoteMatCodeSearch = async (code) => { const remoteMatCodeSearch = async (code) => {
@ -592,19 +589,19 @@ const remoteMatCodeSearch = async (code) => {
code: code, code: code,
status: '1' status: '1'
} }
const dataMat = await MaterialApi.getMaterialPage(matParams)
matList.value = [] matList.value = (await MaterialApi.getMaterialPage(matParams)).list
matList.value = dataMat.list
matSelectLoading.value = false matSelectLoading.value = false
} }
//
const handleMatCode = async (scope, matid) => { const handleMatCode = async (scope, matid) => {
if (matid) { if (matid) {
const matVo = await MaterialApi.getMaterial(scope.row.matId) const matVo = matSimpList.value.find( (item) => item.id == scope.row.matId)
scope.row.matId = matVo.id scope.row.matId = matVo.id
scope.row.matName = matVo.name scope.row.matName = matVo.name
scope.row.matCode = matVo.code
scope.row.matSpec = matVo.spec scope.row.matSpec = matVo.spec
scope.row.matType = matVo.materialType scope.row.matType = matVo.material_type
scope.row.matUnit = matVo.unit scope.row.matUnit = matVo.unit
} else { } else {
scope.row.matId = '' scope.row.matId = ''
@ -617,92 +614,74 @@ const handleMatCode = async (scope, matid) => {
} }
// //
const btnView = ref(false) const ctrView = ref(false)
const btnSave = ref(false) const ctrSave = ref(false)
const btnCancel = ref(true) const ctrCancel = ref(true)
const btnDelete = ref(false) const ctrDelete = ref(false)
// //
const initStatus = async (status) =>{ const initStatus = async (status) =>{
switch(status){ switch(status){
case 1: case 1:
btnView.value = false ctrView.value = false
btnSave.value = false ctrSave.value = false
btnCancel.value = true ctrCancel.value = true
btnDelete.value = false ctrDelete.value = false
break break
case 2: case 2:
btnView.value = false ctrView.value = false
btnSave.value = true ctrSave.value = true
btnCancel.value = false ctrCancel.value = false
btnDelete.value = true ctrDelete.value = true
break break
case 3: case 3:
btnView.value = true ctrView.value = true
btnSave.value = true ctrSave.value = true
btnCancel.value = true ctrCancel.value = true
btnDelete.value = true ctrDelete.value = true
break break
default: default:
break break
} }
// //
if(query.type === 'review'){ if(query.type === 'review'){
btnView.value = true ctrView.value = true
btnSave.value = true ctrSave.value = true
btnCancel.value = true ctrCancel.value = true
btnDelete.value = true ctrDelete.value = true
} }
} }
const userList = ref<UserApi.UserVO[]>([]) //
const matSimpList = ref([]) //
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
//
let matParams = {
pageNo: 1,
pageSize: 99,
status: '1'
}
const dataMat = await MaterialApi.getMaterialPage(matParams)
matList.value = []
matList.value = dataMat.list
dialogTitle.value = t('action.' + query.type) //
dialogTitle.value = query.type === 'review' ? '查看' : t('action.' + query.type)
dialogTitle.value = query.type === 'review' ? '查看' : dialogTitle.value //-
whList.value = await WarehouseApi.getWarehouseSimpList()
//
matSimpList.value = await MaterialApi.getSimpList()
//------------------- //
const data = await WarehouseApi.getWarehouseSimpList()
warehouseList.value = data
//-------------------
if (query.id) { if (query.id) {
matList.value = matSimpList.value
// //
formData.value = await StorageApi.getStorage(query.id) formData.value = await StorageApi.getStorage(query.id)
//
await initStatus(formData.value.status) await initStatus(formData.value.status)
// //
const queryParamsRg = reactive({ const dataRgList = await RgApi.getSimpList()
pageNo: 1, rgList.value = dataRgList.filter( rg => rg.wh_id == formData.value.whId)
pageSize: 99,
status: 1,
whId: formData.value.whId
})
const dataRg = await RgApi.getRgPage(queryParamsRg)
rgList.value = []
rgList.value = dataRg.list
// //
const queryParamsPn = reactive({ const dataPnList = await PnApi.getSimpList()
pageNo: 1, pnList.value = dataPnList.filter( pn => pn.wh_id == formData.value.whId)
pageSize: 99
})
const dataPn = await PnApi.getPnPage(queryParamsPn)
pnList.value = []
pnList.value = dataPn.list
// //
const queryParamsMat = reactive({ const queryParamsMat = reactive({
@ -711,25 +690,17 @@ onMounted(async () => {
stockId: query.id stockId: query.id
}) })
const dataMats = await StorageMatApi.getStorageMatPage(queryParamsMat) const dataMats = await StorageMatApi.getStorageMatPage(queryParamsMat)
formData.value.matItemDOList = dataMats.list formData.value.matItemDOList = dataMats
//
//
const queryParamsMat2 = reactive({
pageNo: 1,
pageSize: 99,
status: 1
})
const matVos = await MaterialApi.getMaterialPage(queryParamsMat2)
formData.value.matItemDOList.forEach((item) => { formData.value.matItemDOList.forEach((item) => {
item.cid = matCount item.cid = matCount
item.matId = matVos.list.find((record) => record.id === item.matId)?.id item.matId = matSimpList.value.find((record) => record.id === item.matId)?.id
//item.matCode = matVos.list.find( (record) => record.id === item.matId)?.id item.matCode = matSimpList.value.find( (record) => record.id === item.matId)?.code
item.matName = matVos.list.find((record) => record.id === item.matId)?.name item.matName = matSimpList.value.find((record) => record.id === item.matId)?.name
item.matSpec = matVos.list.find((record) => record.id === item.matId)?.spec item.matSpec = matSimpList.value.find((record) => record.id === item.matId)?.spec
item.matType = matVos.list.find((record) => record.id === item.matId)?.materialType item.matType = matSimpList.value.find((record) => record.id === item.matId)?.material_type
item.matUnit = matVos.list.find((record) => record.id === item.matId)?.unit item.matUnit = matSimpList.value.find((record) => record.id === item.matId)?.unit
item.pnlist = pnList.value.filter((pn) => pn.rgId === item.rgId) item.pnlist = pnList.value.filter((pn) => pn.rg_id === item.rgId)
matCount = matCount + 1 matCount = matCount + 1
}) })
@ -743,7 +714,7 @@ onMounted(async () => {
formData.value.attachments = (await getFilePage(attParams)).list formData.value.attachments = (await getFilePage(attParams)).list
} }
// //
userList.value = await UserApi.getSimpleUserList() userList.value = await UserApi.getSimpleUserList()
}) })
</script> </script>

@ -28,7 +28,7 @@
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item prop="stockInType" label="出库类型"> <el-form-item prop="stockInType" label="出库类型">
<el-select v-model="formData.stockInType" clearable style="width: 100%" @change="handleStockType" v-bind:disabled="btnView || btnSave"> <el-select v-model="formData.stockInType" clearable style="width: 100%" @change="handleStockType" v-bind:disabled="ctrView || ctrSave">
<el-option v-for="dict in getIntDictOptions(DICT_TYPE.HELI_STORAGE_OUT_TYPE)" :key="dict.value" <el-option v-for="dict in getIntDictOptions(DICT_TYPE.HELI_STORAGE_OUT_TYPE)" :key="dict.value"
:label="dict.label" :value="dict.value" /> :label="dict.label" :value="dict.value" />
</el-select> </el-select>
@ -50,7 +50,7 @@
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item prop="headerNo" label="上游单号"> <el-form-item prop="headerNo" label="上游单号">
<el-input v-model="formData.headerNo" class="!w-700px" v-bind:disabled="btnView || btnSave || enableHeadNo"/> <el-input v-model="formData.headerNo" class="!w-700px" v-bind:disabled="ctrView || ctrSave || enableHeadNo"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -68,8 +68,8 @@
<el-col :span="24"> <el-col :span="24">
<el-form-item prop="whId" label="出库仓库" required> <el-form-item prop="whId" label="出库仓库" required>
<el-select v-model="formData.whId" placeholder="下拉选择" clearable class="!w-400px" @change="handleWh" <el-select v-model="formData.whId" placeholder="下拉选择" clearable class="!w-400px" @change="handleWh"
v-bind:disabled="btnView || btnSave"> v-bind:disabled="ctrView || ctrSave">
<el-option v-for="dict in warehouseList" :key="dict.id" :label="dict.whName" :value="dict.id" /> <el-option v-for="dict in whList" :key="dict.id" :label="dict.whName" :value="dict.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -79,7 +79,7 @@
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="备注" prop="description"> <el-form-item label="备注" prop="description">
<el-input type="textarea" v-model="formData.description" show-word-limit maxlength="200" class="!w-2080px" v-bind:disabled="btnView || btnSave"/> <el-input type="textarea" v-model="formData.description" show-word-limit maxlength="200" class="!w-2080px" v-bind:disabled="ctrView || ctrSave"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -93,7 +93,7 @@
<el-col> <el-col>
<el-card class="hl-incard"> <el-card class="hl-incard">
<el-col> <el-col>
<el-button class="hl-addbutton" type="primary" size="large" v-bind:disabled="btnView || btnSave" @click="onAddItem"></el-button> <el-button class="hl-addbutton" type="primary" size="large" v-bind:disabled="ctrView || ctrSave" @click="onAddItem"></el-button>
</el-col> </el-col>
<el-form ref="matSubFormRef" :model="formData.matItemDOList" :rules="subFormRules" <el-form ref="matSubFormRef" :model="formData.matItemDOList" :rules="subFormRules"
v-loading="subFormLoading" label-width="0"> v-loading="subFormLoading" label-width="0">
@ -103,7 +103,7 @@
<template #header> <span class="hl-table_header">*</span>物料名称 </template> <template #header> <span class="hl-table_header">*</span>物料名称 </template>
<template #default="scope"> <template #default="scope">
<el-form-item :prop="`${scope.$index}.matId`" :rules="subFormRules.matId" class="mb-0px!"> <el-form-item :prop="`${scope.$index}.matId`" :rules="subFormRules.matId" class="mb-0px!">
<el-select v-model="scope.row.matId" placeholder="物料名称" :remote-method="remoteMatCodeSearch" v-bind:disabled="btnView || btnSave" <el-select v-model="scope.row.matId" placeholder="物料名称" :remote-method="remoteMatCodeSearch" v-bind:disabled="ctrView || ctrSave"
remote-show-suffix remote clearable reserve-keyword filterable :loading="matSelectLoading" remote-show-suffix remote clearable reserve-keyword filterable :loading="matSelectLoading"
@change="(val) => handleMatCode(scope, val)" class="!w-180px"> @change="(val) => handleMatCode(scope, val)" class="!w-180px">
<el-option v-for="item in matList" :key="item.id" :label="item.name" :value="item.id" /> <el-option v-for="item in matList" :key="item.id" :label="item.name" :value="item.id" />
@ -130,9 +130,9 @@
<template #header> <span class="hl-table_header">*</span>出库库区 </template> <template #header> <span class="hl-table_header">*</span>出库库区 </template>
<template #default="scope"> <template #default="scope">
<el-form-item :prop="`${scope.$index}.rgId`" :rules="subFormRules.rgId" class="mb-0px!"> <el-form-item :prop="`${scope.$index}.rgId`" :rules="subFormRules.rgId" class="mb-0px!">
<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%"
v-bind:disabled="btnView || btnSave"> v-bind:disabled="true">
<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.rg_name" :value="dict.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</template> </template>
@ -141,8 +141,8 @@
<template #header> <span class="hl-table_header">*</span>出库库位 </template> <template #header> <span class="hl-table_header">*</span>出库库位 </template>
<template #default="scope"> <template #default="scope">
<el-form-item :prop="`${scope.$index}.pnId`" :rules="subFormRules.pnId" class="mb-0px!"> <el-form-item :prop="`${scope.$index}.pnId`" :rules="subFormRules.pnId" class="mb-0px!">
<el-select v-model="scope.row.pnId" placeholder="" style="width: 100%" v-bind:disabled="btnView || btnSave" @change="handlePn(scope)"> <el-select v-model="scope.row.pnId" placeholder="" style="width: 100%" v-bind:disabled="ctrView || ctrSave" @change="handlePn(scope)">
<el-option v-for="dict in scope.row.pnlist" :key="dict.id" :label="dict.pnName" <el-option v-for="dict in pnList" :key="dict.id" :label="dict.pn_name"
:value="dict.id" /> :value="dict.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -154,14 +154,14 @@
<template #default="scope"> <template #default="scope">
<el-form-item :prop="`${scope.$index}.storageOkQty`" :rules="subFormRules.storageOkQty" <el-form-item :prop="`${scope.$index}.storageOkQty`" :rules="subFormRules.storageOkQty"
class="mb-0px!"> class="mb-0px!">
<el-input v-model="scope.row.storageOkQty" v-bind:disabled="btnView || btnSave"/> <el-input v-model="scope.row.storageOkQty" v-bind:disabled="ctrView || ctrSave"/>
</el-form-item> </el-form-item>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="lotNo" min-width="120" label="批次号" align="center" v-if="false" /> <el-table-column prop="lotNo" min-width="120" label="批次号" align="center" v-if="false" />
<el-table-column prop="description" min-width="180" label="备注" align="center"> <el-table-column prop="description" min-width="180" label="备注" align="center">
<template #default="scope"> <template #default="scope">
<el-input v-model="scope.row.description" v-bind:disabled="btnView || btnSave"/> <el-input v-model="scope.row.description" v-bind:disabled="ctrView || ctrSave"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" width="240"> <el-table-column label="操作" align="center" width="240">
@ -176,7 +176,7 @@
<el-button link type="primary" @click="handlefuke(scope.$index, scope.row)">复制</el-button> --> <el-button link type="primary" @click="handlefuke(scope.$index, scope.row)">复制</el-button> -->
<el-button link type="danger" size="small" @click.prevent="handleDelete2(scope.$index)" <el-button link type="danger" size="small" @click.prevent="handleDelete2(scope.$index)"
v-bind:disabled="btnView || btnDelete"> v-bind:disabled="ctrView || ctrDelete">
删除 删除
</el-button> </el-button>
</template> </template>
@ -202,7 +202,7 @@
'tenant-id': getTenantId() 'tenant-id': getTenantId()
}" name="files" :show-file-list="false" :auto-upload="false" :data="matUploadData" }" name="files" :show-file-list="false" :auto-upload="false" :data="matUploadData"
:on-change="matUploadChange" class="upload-file-uploader" > :on-change="matUploadChange" class="upload-file-uploader" >
<el-button type="primary" v-bind:disabled="btnView || btnSave"> <el-button type="primary" v-bind:disabled="ctrView || ctrSave">
<Icon icon="ep:upload-filled" />上传 <Icon icon="ep:upload-filled" />上传
</el-button> </el-button>
</el-upload> </el-upload>
@ -218,11 +218,11 @@
<el-table-column label="操作" align="center"> <el-table-column label="操作" align="center">
<template #default="scope"> <template #default="scope">
<el-button link type="danger" size="small" v-bind:disabled="btnView || btnDelete" <el-button link type="danger" size="small" v-bind:disabled="ctrView || ctrDelete"
@click="handleDeleteAttachment(scope.$index, scope.row.businessFileType)"> @click="handleDeleteAttachment(scope.$index, scope.row.businessFileType)">
删除 删除
</el-button> </el-button>
<el-button link type="primary" size="small" v-bind:disabled="btnView || btnDelete" <el-button link type="primary" size="small" v-bind:disabled="ctrView || ctrDelete"
@click="downloadAttachment(scope.row.name, scope.row.url)"> @click="downloadAttachment(scope.row.name, scope.row.url)">
下载 下载
</el-button> </el-button>
@ -279,11 +279,11 @@
</el-form> </el-form>
<div class="text-center hl-footer"> <div class="text-center hl-footer">
<el-button @click="() => router.go(-1)" size="large"> </el-button> <el-button @click="() => router.go(-1)" size="large"> </el-button>
<el-button @click="submitForm" type="success" :disabled="btnView || btnSave" size="large"> <el-button @click="submitForm" type="success" :disabled="ctrView || ctrSave" size="large">
</el-button> </el-button>
<el-button @click="handleStatus(2)" type="primary" :disabled="btnView || btnSave" size="large"> <el-button @click="handleStatus(2)" type="primary" :disabled="ctrView || ctrSave" size="large">
</el-button> </el-button>
<el-button @click="handleStatus(3)" type="danger" :disabled="btnView || btnCancel" size="large"> <el-button @click="handleStatus(3)" type="danger" :disabled="ctrView || ctrCancel" size="large">
</el-button> </el-button>
</div> </div>
</el-card> </el-card>
@ -355,6 +355,8 @@ const subFormRules = reactive({
pnId: [{ required: true, message: '库位不能为空', trigger: 'blur' }], pnId: [{ required: true, message: '库位不能为空', trigger: 'blur' }],
storageOkQty: [{ required: true, message: '出库数量不能为空', trigger: 'blur' }] storageOkQty: [{ required: true, message: '出库数量不能为空', trigger: 'blur' }]
}) })
//
const enableHeadNo = ref(false) const enableHeadNo = ref(false)
const handleStockType = async (typeid) => { const handleStockType = async (typeid) => {
formData.value.headerNo = '' formData.value.headerNo = ''
@ -379,6 +381,28 @@ const handleStatus = async (num) => {
} catch (e) { } catch (e) {
return return
} }
//
const matCurrentData = await StorageMatApi.getStorageMatList(0)
var hasRestNum = true
formData.value.matItemDOList.forEach((rest) => {
if (
matCurrentData.find(
(mat) =>
mat.matId == rest.matId &&
mat.pnId == rest.pnId &&
mat.matRest < Number(rest.storageOkQty)
) !== undefined || rest.storageOkQty.length ==0
) {
hasRestNum = false
}
})
if (!hasRestNum) {
message.alertWarning('物料库存不足')
return
}
//
await message.confirm('确认'+(num==2?'提交':'报废')+'出库信息?')
// //
await saveFormData() await saveFormData()
@ -398,7 +422,7 @@ const handleStatus = async (num) => {
query.type = 'update' query.type = 'update'
reload() reload()
} }
const userList = ref<UserApi.UserVO[]>([]) //
// ==================== ======================================= // ==================== =======================================
const uploadUrl = ref(import.meta.env.VITE_UPLOAD_BATCH_URL) const uploadUrl = ref(import.meta.env.VITE_UPLOAD_BATCH_URL)
@ -459,26 +483,6 @@ var commonResult = ''
const emit = defineEmits(['success']) // success const emit = defineEmits(['success']) // success
const saveFormData = async () => { const saveFormData = async () => {
//
const matCurrentData = await StorageMatApi.getStorageMatList()
var hasRestNum = true
formData.value.matItemDOList.forEach((rest) => {
if (
matCurrentData.find(
(mat) =>
mat.matId == rest.matId &&
mat.pnId == rest.pnId &&
mat.matRest < Number(rest.storageOkQty)
)
) {
hasRestNum = false
}
})
if (!hasRestNum) {
message.alertWarning('物料库存不足')
return
}
// //
formLoading.value = true formLoading.value = true
try { try {
@ -524,8 +528,33 @@ const submitForm = async () => {
} catch (e) { } catch (e) {
return return
} }
//
const matCurrentData = await StorageMatApi.getStorageMatList(0)
var hasRestNum = true
formData.value.matItemDOList.forEach((rest) => {
if (
matCurrentData.find(
(mat) =>
mat.matId == rest.matId &&
mat.pnId == rest.pnId &&
mat.matRest < Number(rest.storageOkQty)
) !== undefined || rest.storageOkQty.length ==0
) {
hasRestNum = false
}
})
if (!hasRestNum) {
message.alertWarning('物料库存不足')
return
}
//
await message.confirm('确认保存出库信息?')
// //
await saveFormData() await saveFormData()
// //
query.id = formData.value.id query.id = formData.value.id
query.type = 'update' query.type = 'update'
@ -568,78 +597,41 @@ const handleDelete2 = (index: number) => {
} }
// //
const warehouseList = ref([]) const whList = ref([])
// //
var rgList = ref([]) const rgList = ref([])
// //
var pnList = ref([]) const pnList = ref([])
const handleWh = async (wid) => { const handleWh = async (wid) => {
//------------------- matCount = 1
const queryParamsRg = reactive({ formData.value.matItemDOList = []
pageNo: 1,
pageSize: 99,
whId: wid
})
const dataRg = await RgApi.getRgPage(queryParamsRg)
rgList.value = []
pnList.value = []
rgList.value = dataRg.list
const matLastRemoteData = await StorageMatApi.getStorageMatList() formData.value.rgId = ''
//
rgList.value = (await RgApi.getSimpList()).filter( rg => rg.wh_id == wid)
let matParams = { //
pageNo: 1, pnList.value = (await PnApi.getSimpList()).filter( pn => pn.wh_id == wid)
pageSize: 99,
status: '1'
}
const dataMat = await MaterialApi.getMaterialPage(matParams)
matList.value = []
matList.value = dataMat.list.filter(
(item) =>
matLastRemoteData.find((fish) => fish.matId === item.id && fish.whId == wid) !== undefined
)
formData.value.matItemDOList = []
// formData.value.matItemDOList.forEach(item => {
// item.rgId = ''
// item.pnId = ''
// item.pnlist.value = []
// })
//-------------------
}
const handleRg = async (scope) => {
//-------------------
const queryParamsRPn = reactive({
pageNo: 1,
pageSize: 99,
rgId: scope.row.rgId,
pnStatus: 1
})
const dataPn = await PnApi.getPnPage(queryParamsRPn)
scope.row.pnid = ''
scope.row.pnlist = dataPn.list
//-------------------
} }
const handlePn = async (scope) =>{ const handlePn = async (scope) =>{
if (matLastData.value.find((item) => item.matId === scope.row.matId && item.whId== formData.value.whId && item.rgId == scope.row.rgId && item.pnId == scope.row.pnId)) { if (matLastData.value.find((item) => item.matId === scope.row.matId && item.whId== formData.value.whId && item.pnId == scope.row.pnId)) {
const matVo = matLastData.value.find((item) => item.matId === scope.row.matId && item.whId== formData.value.whId && item.rgId == scope.row.rgId && item.pnId == scope.row.pnId) const matVo = matLastData.value.find((item) => item.matId === scope.row.matId && item.whId== formData.value.whId && item.pnId == scope.row.pnId)
scope.row.matId = matVo.matId // scope.row.matId = matVo.matId
scope.row.matName = matVo.matName // scope.row.matName = matVo.matName
scope.row.matCode = matVo.matCode // scope.row.matCode = matVo.matCode
scope.row.matSpec = matVo.matSpec // scope.row.matSpec = matVo.matSpec
scope.row.matType = matVo.materialType // scope.row.matType = matVo.materialType
scope.row.matUnit = matVo.matUnit // scope.row.matUnit = matVo.matUnit
scope.row.rgId = matVo.rgId scope.row.rgId = matVo.rgId
scope.row.pnId = matVo.pnId scope.row.pnId = matVo.pnId
scope.row.matRest = matVo.matRest scope.row.matRest = matVo.matRest
scope.row.storageOkQty = matVo.storageOkQty // scope.row.storageOkQty = matVo.storageOkQty
scope.row.lotNo = matVo.lotNo // scope.row.lotNo = matVo.lotNo
scope.row.description = matVo.description // scope.row.description = matVo.description
} else{ } else{
scope.row.rgId = ''
scope.row.matRest = '' scope.row.matRest = ''
} }
} }
@ -656,7 +648,7 @@ const remoteMatCodeSearch = async (name) => {
status: '1' status: '1'
} }
const matLastRemoteData = await StorageMatApi.getStorageMatList() const matLastRemoteData = await StorageMatApi.getStorageMatList(0)
const dataMat = await MaterialApi.getMaterialPage(matParams) const dataMat = await MaterialApi.getMaterialPage(matParams)
matList.value = [] matList.value = []
@ -678,21 +670,14 @@ const handleMatCode = async (scope, matid) => {
scope.row.matSpec = matVo.matSpec scope.row.matSpec = matVo.matSpec
scope.row.matType = matVo.materialType scope.row.matType = matVo.materialType
scope.row.matUnit = matVo.matUnit scope.row.matUnit = matVo.matUnit
scope.row.rgId = matVo.rgId // scope.row.rgId = matVo.rgId
scope.row.pnId = matVo.pnId // scope.row.pnId = matVo.pnId
scope.row.matRest = matVo.matRest // scope.row.matRest = matVo.matRest
scope.row.storageOkQty = matVo.storageOkQty // scope.row.storageOkQty = matVo.storageOkQty
scope.row.lotNo = matVo.lotNo // scope.row.lotNo = matVo.lotNo
scope.row.description = matVo.description // scope.row.description = matVo.description
const queryParamsRPn = reactive({ scope.row.pnlist = pnList.value
pageNo: 1,
pageSize: 99,
rgId: scope.row.rgId,
pnStatus: 1
})
const dataPn = await PnApi.getPnPage(queryParamsRPn)
scope.row.pnlist = dataPn.list
} else { } else {
scope.row.matId = '' scope.row.matId = ''
scope.row.matName = '' scope.row.matName = ''
@ -710,93 +695,80 @@ const handleMatCode = async (scope, matid) => {
} }
} }
const matLastData = ref([]) const matLastData = ref([])
// //
const btnView = ref(false) const ctrView = ref(false)
const btnSave = ref(false) const ctrSave = ref(false)
const btnCancel = ref(true) const ctrCancel = ref(true)
const btnDelete = ref(false) const ctrDelete = ref(false)
// //
const initStatus = async (status) => { const initStatus = async (status) => {
switch (status) { switch (status) {
case 1: case 1:
btnView.value = false ctrView.value = false
btnSave.value = false ctrSave.value = false
btnCancel.value = true ctrCancel.value = true
btnDelete.value = false ctrDelete.value = false
break break
case 2: case 2:
btnView.value = false ctrView.value = false
btnSave.value = true ctrSave.value = true
btnCancel.value = false ctrCancel.value = false
btnDelete.value = true ctrDelete.value = true
break break
case 3: case 3:
btnView.value = true ctrView.value = true
btnSave.value = true ctrSave.value = true
btnCancel.value = true ctrCancel.value = true
btnDelete.value = true ctrDelete.value = true
break break
default: default:
break break
} }
// //
if (query.type === 'review') { if (query.type === 'review') {
btnView.value = true ctrView.value = true
btnSave.value = true ctrSave.value = true
btnCancel.value = true ctrCancel.value = true
btnDelete.value = true ctrDelete.value = true
} }
} }
const userList = ref<UserApi.UserVO[]>([]) //
const matSimpList = ref([]) //
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
matLastData.value = await StorageMatApi.getStorageMatList() //
matLastData.value = await StorageMatApi.getStorageMatList(0)
//
dialogTitle.value = query.type === 'review' ? '查看' : t('action.' + query.type)
// //-
let matParams = { whList.value = await WarehouseApi.getWarehouseSimpList()
pageNo: 1,
pageSize: 99,
status: '1'
}
const dataMat = await MaterialApi.getMaterialPage(matParams)
matList.value = []
matList.value = dataMat.list
dialogTitle.value = t('action.' + query.type) //
dialogTitle.value = query.type === 'review' ? '查看' : dialogTitle.value matSimpList.value = await MaterialApi.getSimpList()
//------------------- //
const data = await WarehouseApi.getWarehouseSimpList()
warehouseList.value = data
//-------------------
if (query.id) { if (query.id) {
matList.value = matSimpList.value
// //
formData.value = await StorageApi.getStorage(query.id) formData.value = await StorageApi.getStorage(query.id)
//
await initStatus(formData.value.status) await initStatus(formData.value.status)
//
const queryParamsRg = reactive({
pageNo: 1,
pageSize: 99,
status: 1,
whId: formData.value.whId
})
const dataRg = await RgApi.getRgPage(queryParamsRg)
rgList.value = []
rgList.value = dataRg.list
// //
const queryParamsPn = reactive({ const dataRgList = await RgApi.getSimpList()
pageNo: 1, rgList.value = dataRgList.filter( rg => rg.wh_id == formData.value.whId)
pageSize: 99
})
const dataPn = await PnApi.getPnPage(queryParamsPn)
pnList.value = [] //
pnList.value = dataPn.list const dataPnList = await PnApi.getSimpList()
pnList.value = dataPnList.filter( pn => pn.wh_id == formData.value.whId)
// //
const queryParamsMat = reactive({ const queryParamsMat = reactive({
@ -805,35 +777,18 @@ onMounted(async () => {
stockId: query.id stockId: query.id
}) })
const dataMats = await StorageMatApi.getStorageMatPage(queryParamsMat) const dataMats = await StorageMatApi.getStorageMatPage(queryParamsMat)
formData.value.matItemDOList = dataMats.list formData.value.matItemDOList = dataMats
//
//
const queryParamsMat2 = reactive({
pageNo: 1,
pageSize: 99,
status: 1
})
const matVos = await MaterialApi.getMaterialPage(queryParamsMat2)
formData.value.matItemDOList.forEach((item) => { formData.value.matItemDOList.forEach((item) => {
item.cid = matCount item.cid = matCount
item.matId = matVos.list.find((record) => record.id === item.matId)?.id item.matId = matSimpList.value.find((record) => record.id === item.matId)?.id
//item.matCode = matVos.list.find( (record) => record.id === item.matId)?.id item.matCode = matSimpList.value.find( (record) => record.id === item.matId)?.code
item.matCode = matVos.list.find((record) => record.id == item.matId)?.code item.matName = matSimpList.value.find((record) => record.id === item.matId)?.name
item.matSpec = matVos.list.find((record) => record.id == item.matId)?.spec item.matSpec = matSimpList.value.find((record) => record.id === item.matId)?.spec
item.matType = matVos.list.find((record) => record.id == item.matId)?.materialType item.matType = matSimpList.value.find((record) => record.id === item.matId)?.material_type
item.matUnit = matVos.list.find((record) => record.id == item.matId)?.unit item.matUnit = matSimpList.value.find((record) => record.id === item.matId)?.unit
item.pnlist = pnList.value.filter((pn) => pn.rgId == item.rgId) item.pnlist = pnList.value.filter((pn) => pn.rg_id === item.rgId)
item.matRest = matLastData.value.find(
(rest) => rest.rgId == item.rgId && rest.pnId == item.pnId
)?.matRest
item.matRest = item.matRest == undefined ? 0 : item.matRest
matCount = matCount + 1 matCount = matCount + 1
// item = matLastData.value.find((rest) => rest.rgId === item.rgId && rest.pnId === item.pnId)
// item.pnlist = pnList.value.filter((pn) => pn.rgId === item.rgId)
// item.cid = matCount
// matCount = matCount + 1
}) })
// //
@ -846,7 +801,7 @@ onMounted(async () => {
formData.value.attachments = (await getFilePage(attParams)).list formData.value.attachments = (await getFilePage(attParams)).list
} }
// //
userList.value = await UserApi.getSimpleUserList() userList.value = await UserApi.getSimpleUserList()
}) })
</script> </script>

Loading…
Cancel
Save