出入库 优化

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

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

@ -1,14 +1,19 @@
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.mybatis.core.mapper.BaseMapperX;
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.pn.PnDO;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.supplier.SupplierDO;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.util.StringUtils;
import java.util.List;
import java.util.Map;
/**
* Mapper
*
@ -32,4 +37,9 @@ public interface MaterialMapper extends BaseMapperX<MaterialDO> {
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() {
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) {
MPJLambdaWrapper<StorageMatDO> query = new MPJLambdaWrapper<>();
query.selectAll(StorageMatDO.class)
.eq(StorageMatDO::getStockId, stockId);
query.selectAll(StorageMatDO.class).eq(stockId!= null && stockId!= 0,StorageMatDO::getStockId, stockId);
return selectList(query);
}
List<StorageMatValidRespVO> selectStorageMatValid();
List<StorageMatValidRespVO> selectStorageMatValid(Long whId);
}

@ -52,4 +52,6 @@ public interface MaterialService {
*/
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 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.module.heli.enums.ErrorCodeConstants.CODE_REPEAT;
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);
}
@Override
public List<Map<String, Object>> getSimpleList() {
return materialMapper.selectSimpleList();
}
}

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

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

@ -22,7 +22,10 @@
<result property="matRest" column="mat_rest"/>
<result property="storageOkQty" column="storage_ok_qty"/>
</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
<if test="wh_id != null and wh_id != ''">
AND wh_id = #{wh_id}
</if>
</select>
</mapper>

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

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

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

@ -28,7 +28,7 @@
<el-row>
<el-col :span="24">
<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"
:label="dict.label" :value="dict.value" />
</el-select>
@ -50,7 +50,7 @@
<el-row>
<el-col :span="24">
<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-col>
</el-row>
@ -68,8 +68,8 @@
<el-col :span="24">
<el-form-item prop="whId" label="出库仓库" required>
<el-select v-model="formData.whId" placeholder="下拉选择" clearable class="!w-400px" @change="handleWh"
v-bind:disabled="btnView || btnSave">
<el-option v-for="dict in warehouseList" :key="dict.id" :label="dict.whName" :value="dict.id" />
v-bind:disabled="ctrView || ctrSave">
<el-option v-for="dict in whList" :key="dict.id" :label="dict.whName" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
@ -79,7 +79,7 @@
<el-row>
<el-col :span="24">
<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-col>
</el-row>
@ -93,7 +93,7 @@
<el-col>
<el-card class="hl-incard">
<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-form ref="matSubFormRef" :model="formData.matItemDOList" :rules="subFormRules"
v-loading="subFormLoading" label-width="0">
@ -103,7 +103,7 @@
<template #header> <span class="hl-table_header">*</span>物料名称 </template>
<template #default="scope">
<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"
@change="(val) => handleMatCode(scope, val)" class="!w-180px">
<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 #default="scope">
<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-option v-for="dict in rgList" :key="dict.id" :label="dict.rgName" :value="dict.id" />
<el-select v-model="scope.row.rgId" placeholder="" style="width: 100%"
v-bind:disabled="true">
<el-option v-for="dict in rgList" :key="dict.id" :label="dict.rg_name" :value="dict.id" />
</el-select>
</el-form-item>
</template>
@ -141,8 +141,8 @@
<template #header> <span class="hl-table_header">*</span>出库库位 </template>
<template #default="scope">
<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-option v-for="dict in scope.row.pnlist" :key="dict.id" :label="dict.pnName"
<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 pnList" :key="dict.id" :label="dict.pn_name"
:value="dict.id" />
</el-select>
</el-form-item>
@ -154,14 +154,14 @@
<template #default="scope">
<el-form-item :prop="`${scope.$index}.storageOkQty`" :rules="subFormRules.storageOkQty"
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>
</template>
</el-table-column>
<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">
<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>
</el-table-column>
<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="danger" size="small" @click.prevent="handleDelete2(scope.$index)"
v-bind:disabled="btnView || btnDelete">
v-bind:disabled="ctrView || ctrDelete">
删除
</el-button>
</template>
@ -202,7 +202,7 @@
'tenant-id': getTenantId()
}" name="files" :show-file-list="false" :auto-upload="false" :data="matUploadData"
: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" />上传
</el-button>
</el-upload>
@ -218,11 +218,11 @@
<el-table-column label="操作" align="center">
<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)">
删除
</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)">
下载
</el-button>
@ -279,11 +279,11 @@
</el-form>
<div class="text-center hl-footer">
<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 @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 @click="handleStatus(3)" type="danger" :disabled="btnView || btnCancel" size="large">
<el-button @click="handleStatus(3)" type="danger" :disabled="ctrView || ctrCancel" size="large">
</el-button>
</div>
</el-card>
@ -355,6 +355,8 @@ const subFormRules = reactive({
pnId: [{ required: true, message: '库位不能为空', trigger: 'blur' }],
storageOkQty: [{ required: true, message: '出库数量不能为空', trigger: 'blur' }]
})
//
const enableHeadNo = ref(false)
const handleStockType = async (typeid) => {
formData.value.headerNo = ''
@ -379,6 +381,28 @@ const handleStatus = async (num) => {
} catch (e) {
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()
@ -398,7 +422,7 @@ const handleStatus = async (num) => {
query.type = 'update'
reload()
}
const userList = ref<UserApi.UserVO[]>([]) //
// ==================== =======================================
const uploadUrl = ref(import.meta.env.VITE_UPLOAD_BATCH_URL)
@ -459,26 +483,6 @@ var commonResult = ''
const emit = defineEmits(['success']) // success
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
try {
@ -524,8 +528,33 @@ const submitForm = async () => {
} catch (e) {
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()
//
query.id = formData.value.id
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 queryParamsRg = reactive({
pageNo: 1,
pageSize: 99,
whId: wid
})
const dataRg = await RgApi.getRgPage(queryParamsRg)
rgList.value = []
pnList.value = []
rgList.value = dataRg.list
matCount = 1
formData.value.matItemDOList = []
const matLastRemoteData = await StorageMatApi.getStorageMatList()
formData.value.rgId = ''
//
rgList.value = (await RgApi.getSimpList()).filter( rg => rg.wh_id == wid)
let matParams = {
pageNo: 1,
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
//-------------------
//
pnList.value = (await PnApi.getSimpList()).filter( pn => pn.wh_id == wid)
}
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)) {
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)
scope.row.matId = matVo.matId
scope.row.matName = matVo.matName
scope.row.matCode = matVo.matCode
scope.row.matSpec = matVo.matSpec
scope.row.matType = matVo.materialType
scope.row.matUnit = matVo.matUnit
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.pnId == scope.row.pnId)
// scope.row.matId = matVo.matId
// scope.row.matName = matVo.matName
// scope.row.matCode = matVo.matCode
// scope.row.matSpec = matVo.matSpec
// scope.row.matType = matVo.materialType
// scope.row.matUnit = matVo.matUnit
scope.row.rgId = matVo.rgId
scope.row.pnId = matVo.pnId
scope.row.matRest = matVo.matRest
scope.row.storageOkQty = matVo.storageOkQty
scope.row.lotNo = matVo.lotNo
scope.row.description = matVo.description
// scope.row.storageOkQty = matVo.storageOkQty
// scope.row.lotNo = matVo.lotNo
// scope.row.description = matVo.description
} else{
scope.row.rgId = ''
scope.row.matRest = ''
}
}
@ -656,7 +648,7 @@ const remoteMatCodeSearch = async (name) => {
status: '1'
}
const matLastRemoteData = await StorageMatApi.getStorageMatList()
const matLastRemoteData = await StorageMatApi.getStorageMatList(0)
const dataMat = await MaterialApi.getMaterialPage(matParams)
matList.value = []
@ -678,21 +670,14 @@ const handleMatCode = async (scope, matid) => {
scope.row.matSpec = matVo.matSpec
scope.row.matType = matVo.materialType
scope.row.matUnit = matVo.matUnit
scope.row.rgId = matVo.rgId
scope.row.pnId = matVo.pnId
scope.row.matRest = matVo.matRest
scope.row.storageOkQty = matVo.storageOkQty
scope.row.lotNo = matVo.lotNo
scope.row.description = matVo.description
const queryParamsRPn = reactive({
pageNo: 1,
pageSize: 99,
rgId: scope.row.rgId,
pnStatus: 1
})
const dataPn = await PnApi.getPnPage(queryParamsRPn)
scope.row.pnlist = dataPn.list
// scope.row.rgId = matVo.rgId
// scope.row.pnId = matVo.pnId
// scope.row.matRest = matVo.matRest
// scope.row.storageOkQty = matVo.storageOkQty
// scope.row.lotNo = matVo.lotNo
// scope.row.description = matVo.description
scope.row.pnlist = pnList.value
} else {
scope.row.matId = ''
scope.row.matName = ''
@ -710,93 +695,80 @@ const handleMatCode = async (scope, matid) => {
}
}
const matLastData = ref([])
//
const btnView = ref(false)
const btnSave = ref(false)
const btnCancel = ref(true)
const btnDelete = ref(false)
const ctrView = ref(false)
const ctrSave = ref(false)
const ctrCancel = ref(true)
const ctrDelete = ref(false)
//
const initStatus = async (status) => {
switch (status) {
case 1:
btnView.value = false
btnSave.value = false
btnCancel.value = true
btnDelete.value = false
ctrView.value = false
ctrSave.value = false
ctrCancel.value = true
ctrDelete.value = false
break
case 2:
btnView.value = false
btnSave.value = true
btnCancel.value = false
btnDelete.value = true
ctrView.value = false
ctrSave.value = true
ctrCancel.value = false
ctrDelete.value = true
break
case 3:
btnView.value = true
btnSave.value = true
btnCancel.value = true
btnDelete.value = true
ctrView.value = true
ctrSave.value = true
ctrCancel.value = true
ctrDelete.value = true
break
default:
break
}
//
if (query.type === 'review') {
btnView.value = true
btnSave.value = true
btnCancel.value = true
btnDelete.value = true
ctrView.value = true
ctrSave.value = true
ctrCancel.value = true
ctrDelete.value = true
}
}
const userList = ref<UserApi.UserVO[]>([]) //
const matSimpList = ref([]) //
/** 初始化 **/
onMounted(async () => {
matLastData.value = await StorageMatApi.getStorageMatList()
//
matLastData.value = await StorageMatApi.getStorageMatList(0)
//
dialogTitle.value = query.type === 'review' ? '查看' : t('action.' + query.type)
//
let matParams = {
pageNo: 1,
pageSize: 99,
status: '1'
}
const dataMat = await MaterialApi.getMaterialPage(matParams)
matList.value = []
matList.value = dataMat.list
//-
whList.value = await WarehouseApi.getWarehouseSimpList()
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) {
matList.value = matSimpList.value
//
formData.value = await StorageApi.getStorage(query.id)
//
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({
pageNo: 1,
pageSize: 99
})
const dataPn = await PnApi.getPnPage(queryParamsPn)
const dataRgList = await RgApi.getSimpList()
rgList.value = dataRgList.filter( rg => rg.wh_id == formData.value.whId)
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({
@ -805,35 +777,18 @@ onMounted(async () => {
stockId: query.id
})
const dataMats = await StorageMatApi.getStorageMatPage(queryParamsMat)
formData.value.matItemDOList = dataMats.list
//
const queryParamsMat2 = reactive({
pageNo: 1,
pageSize: 99,
status: 1
})
const matVos = await MaterialApi.getMaterialPage(queryParamsMat2)
formData.value.matItemDOList = dataMats
//
formData.value.matItemDOList.forEach((item) => {
item.cid = matCount
item.matId = matVos.list.find((record) => record.id === item.matId)?.id
//item.matCode = matVos.list.find( (record) => record.id === item.matId)?.id
item.matCode = matVos.list.find((record) => record.id == item.matId)?.code
item.matSpec = matVos.list.find((record) => record.id == item.matId)?.spec
item.matType = matVos.list.find((record) => record.id == item.matId)?.materialType
item.matUnit = matVos.list.find((record) => record.id == item.matId)?.unit
item.pnlist = pnList.value.filter((pn) => pn.rgId == 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
item.matId = matSimpList.value.find((record) => record.id === item.matId)?.id
item.matCode = matSimpList.value.find( (record) => record.id === item.matId)?.code
item.matName = matSimpList.value.find((record) => record.id === item.matId)?.name
item.matSpec = matSimpList.value.find((record) => record.id === item.matId)?.spec
item.matType = matSimpList.value.find((record) => record.id === item.matId)?.material_type
item.matUnit = matSimpList.value.find((record) => record.id === item.matId)?.unit
item.pnlist = pnList.value.filter((pn) => pn.rg_id === item.rgId)
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
}
//
//
userList.value = await UserApi.getSimpleUserList()
})
</script>

Loading…
Cancel
Save