north-glass-erp/northglass-erp/src/views/mm/ingredientStock/SelectIngredientsStock.vue
@@ -5,7 +5,7 @@ import request from "@/utils/request"; import deepClone from "@/utils/deepClone"; import useUserInfoStore from "@/stores/userInfo"; import {ElMessage} from "element-plus"; import {ElMessage, ElMessageBox} from "element-plus"; import {Search} from "@element-plus/icons-vue"; import { useI18n } from 'vue-i18n' import {toolbarButtonClickEvent} from "@/hook/mouseMove"; @@ -289,6 +289,7 @@ buttons: [ {'code': 'out', 'name': t('ingredientsStock.materialOutbound'),status: 'primary'}, {'code': 'add', 'name': t('ingredients.materialAddition'),status: 'primary'}, {'code': 'delete', 'name': t('basicData.delete'),status: 'primary'}, ], /*import: false, export: true, @@ -384,6 +385,64 @@ } case 'delete': { const selectRecords = $grid.getCheckboxRecords() if (selectRecords.length === 0) { ElMessage.warning(t('productStock.unselectedData')) return } ElMessageBox.confirm("确认删除?", { confirmButtonText: t('basicData.confirmButtonText'), cancelButtonText: t('basicData.cancelButtonText'), distinguishCancelAndClose: true, type: 'warning', } ).then(()=>{ let id = "" const array = []; if (values.value===t('ingredientsStock.inventory')){ for (let i = 0; i < selectRecords.length; i++) { array.push(selectRecords[i].id) if (i + 1 === selectRecords.length) { id += selectRecords[i].id } else { id += selectRecords[i].id + "|" } } }else{ for (let i = 0; i < selectRecords.length; i++) { array.push(selectRecords[i].useId) if (i + 1 === selectRecords.length) { id += selectRecords[i].useId } else { id += selectRecords[i].useId + "|" } } } console.log(selectRecords) let flowData = ref({ materialInventory: selectRecords, ids: id, creator: userStore.user.userName }) request.post(`/materialInventory/deleteMaterialInventory`,flowData.value).then((res) => { if(res.code==200 && res.data===true){ ElMessage.success(t('searchOrder.msgDeleteSuccess')) router.push({path:'/main/ingredientsStock/selectIngredientsStock', query:{random:Math.random()}}) }else{ ElMessage.warning(res.msg) } }) }).catch((action)=>{ }) break } } } } north-glass-erp/src/main/java/com/example/erp/controller/mm/MaterialInventoryController.java
@@ -167,6 +167,13 @@ return Result.seccess(materialInventoryService.getMaterialLogReport(type,pageNum,pageSize,selectDate,materialLog)); } @ApiOperation("物料库存删除") @SaCheckPermission("createOutbound.search") @PostMapping("/deleteMaterialInventory") public Result deleteMaterialInventory(@RequestBody Map<String,Object> object){ return Result.seccess(materialInventoryService.deleteMaterialInventory(object)); } @ApiOperation("物料报表导出") @PostMapping("/exportMaterialLogReport/{type}") public void exportMaterialLogReport(@PathVariable String type, HttpServletResponse response, @RequestBody List<LocalDate> dates) throws IOException, IllegalAccessException, InstantiationException { north-glass-erp/src/main/java/com/example/erp/mapper/mm/MaterialInventoryMapper.java
@@ -51,6 +51,8 @@ Boolean insertMaterialStore(@Param("type") String type, @Param("json") String json); Boolean deleteMaterialInventory(@Param("ids") List<Long> ids); Boolean updateMaterialStore(@Param("type") String type, @Param("json") String json, @Param("id") Long id); north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialInventoryService.java
@@ -851,6 +851,29 @@ } public Boolean deleteMaterialInventory(Map<String,Object> object) { String creator = ""; if (object.get("creator") != null) { creator = object.get("creator").toString(); } String ids = ""; if (object.get("ids") != null) { ids = object.get("ids").toString(); } List<Long> id=new ArrayList<>(); if(!ids.isEmpty()){ List<String> result = StrUtil.split(ids, '|'); id=result.stream().map(Long::valueOf).collect(Collectors.toList()); } materialInventoryMapper.deleteMaterialInventory(id); Log log = new Log(); log.setOperator(creator); log.setContent(object.toString()); log.setFunction("deleteMaterialInventory:"+ids); logService.saveLog(log); return true; } north-glass-erp/src/main/resources/mapper/mm/MaterialInventory.xml
@@ -1063,5 +1063,19 @@ </select> <select id="deleteMaterialInventory"> delete from mm.material_inventory mi <where> <if test="ids != null and ids != ''"> and mi.id in <foreach item="id" collection="ids" open="(" separator="," close=")"> #{id} </foreach> </if> </where> </select> </mapper>