库存数据保存

库存数据保存
pull/1/head
siontion 9 months ago
parent 645c8a52f6
commit d5f99a48e0

@ -48,14 +48,13 @@ public class StorageMatController {
@PostMapping("/create-batch")
@Operation(summary = "批量创建入/出库物料")
@PreAuthorize("@ss.hasPermission('heli:storage-mat:create')")
public CommonResult<Long> createStorageMat(@Valid @RequestBody List<StorageMatSaveReqVO> createReqVO) {
for (StorageMatSaveReqVO item :createReqVO){
if(item.getId() != null && item.getId()>0){
storageMatService.deleteStorageMat(item.getId());
item.setId(null);
}
public CommonResult<Long> createStorageMat(@Valid @RequestBody List<StorageMatSaveReqVO> createReqVO,@RequestParam("stockid") Long stockid) {
storageMatService.deleteStorageMatList(stockid);
for (StorageMatSaveReqVO item : createReqVO) {
item.setId(null);
storageMatService.createStorageMat(item);
};
}
return success(1L);
}

@ -59,4 +59,6 @@ public interface StorageMatService {
*/
List<StorageMatValidRespVO> getStorageMatList();
int deleteStorageMatList(Long stockid);
}

@ -2,6 +2,7 @@ package com.chanko.yunxi.mes.module.heli.service.storagemat;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.chanko.yunxi.mes.module.heli.dal.dataobject.projectorder.ProjectOrderDO;
import com.google.common.collect.Maps;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
@ -81,4 +82,13 @@ public class StorageMatServiceImpl implements StorageMatService {
return storageMatMapper.selectStorageMatValid();
}
@Override
public int deleteStorageMatList(Long stockid) {
//删除条件
Map<String, Object> columnMap = Maps.newHashMap();
columnMap.put("stock_id", stockid);
return storageMatMapper.deleteByMap(columnMap);
}
}

@ -34,8 +34,8 @@ export const createStorageMat = async (data: StorageMatVO) => {
}
// 批量新增入/出库物料
export const createStorageMatBatch = async (data: StorageMatVO[]) => {
return await request.post({ url: `/heli/storage-mat/create-batch`, data })
export const createStorageMatBatch = async (data: StorageMatVO[],id:number) => {
return await request.post({ url: `/heli/storage-mat/create-batch?stockid=`+id, data })
}

@ -468,7 +468,7 @@ const submitForm = async () => {
item.whId = formData.value.whId
})
const dataMats = formData.value.matItemDOList as unknown as StorageMatApi.StorageMatVO[]
await StorageMatApi.createStorageMatBatch(dataMats)
await StorageMatApi.createStorageMatBatch(dataMats, storageid.value)
//
matUploadFiles.value = { 'businessType': 'STORAGE', 'businessId': storageid, 'businessFileType': '' }

@ -126,7 +126,7 @@
<el-table-column prop="rgId" width="140" label="出库库区" required>
<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)">
<el-select v-model="scope.row.rgId" placeholder="" style="width: 100%" @change="handleRg(scope)" disabled="">
<el-option v-for="dict in rgList" :key="dict.id" :label="dict.rgName" :value="dict.id" />
</el-select>
</el-form-item>
@ -450,7 +450,7 @@ const submitForm = async () => {
item.whId = formData.value.whId
})
const dataMats = formData.value.matItemDOList as unknown as StorageMatApi.StorageMatVO[]
await StorageMatApi.createStorageMatBatch(dataMats)
await StorageMatApi.createStorageMatBatch(dataMats, storageid.value)
//
matUploadFiles.value = { 'businessType': 'STORAGE', 'businessId': storageid, 'businessFileType': '' }
@ -563,7 +563,7 @@ const remoteMatCodeSearch = async (name) => {
const handleMatCode = async (scope, matid) => {
if (matid) {
if (matid && matLastData.value.find((item) => item.matId === matid)) {
const matVo = matLastData.value.find((item) => item.matId === matid)
scope.row.matId = matVo.matId
scope.row.matName = matVo.matName
@ -700,22 +700,22 @@ onMounted(async () => {
const matVos = await MaterialApi.getMaterialPage(queryParamsMat2)
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
// 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
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
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
})

Loading…
Cancel
Save