|  |  | 
 |  |  | package com.zy.asrs.wms.asrs.controller; | 
 |  |  |  | 
 |  |  | import com.alibaba.fastjson.JSON; | 
 |  |  | import com.alibaba.fastjson.parser.Feature; | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
 |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
 |  |  | import com.zy.asrs.framework.common.Cools; | 
 |  |  | import com.zy.asrs.framework.common.R; | 
 |  |  | import com.zy.asrs.wms.asrs.entity.*; | 
 |  |  | import com.zy.asrs.wms.asrs.service.LocDetlFieldService; | 
 |  |  | import com.zy.asrs.wms.asrs.service.MatFieldService; | 
 |  |  | import com.zy.asrs.wms.common.annotation.OperationLog; | 
 |  |  | import com.zy.asrs.wms.common.domain.BaseParam; | 
 |  |  | import com.zy.asrs.wms.common.domain.KeyValVo; | 
 |  |  | import com.zy.asrs.wms.common.domain.PageParam; | 
 |  |  | import com.zy.asrs.wms.asrs.service.LocDetlService; | 
 |  |  | import com.zy.asrs.wms.system.controller.BaseController; | 
 |  |  | import com.zy.asrs.wms.utils.ExcelUtil; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.security.access.prepost.PreAuthorize; | 
 |  |  | import org.springframework.web.bind.annotation.*; | 
 |  |  |  | 
 |  |  | import javax.servlet.http.HttpServletResponse; | 
 |  |  | import java.util.*; | 
 |  |  |  | 
 |  |  | @RestController | 
 |  |  | @RequestMapping("/api") | 
 |  |  | public class LocDetlController extends BaseController { | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private LocDetlService locDetlService; | 
 |  |  |     @Autowired | 
 |  |  |     private MatFieldService matFieldService; | 
 |  |  |     @Autowired | 
 |  |  |     private LocDetlFieldService locDetlFieldService; | 
 |  |  |  | 
 |  |  |     @PreAuthorize("hasAuthority('asrs:locDetl:list')") | 
 |  |  |     @PostMapping("/locDetl/page") | 
 |  |  |     public R page(@RequestBody Map<String, Object> map) { | 
 |  |  | //        BaseParam baseParam = buildParam(map, BaseParam.class); | 
 |  |  | //        PageParam<LocDetl, BaseParam> pageParam = new PageParam<>(baseParam, LocDetl.class); | 
 |  |  | // | 
 |  |  | //        PageParam<LocDetl, BaseParam> page = locDetlService.page(pageParam, pageParam.buildWrapper(true)); | 
 |  |  | //        JSONObject data = JSON.parseObject(JSON.toJSONString(page)); | 
 |  |  | // | 
 |  |  | //        List<LocDetl> records = page.getRecords(); | 
 |  |  | //        data.put("records", records); | 
 |  |  | //        for (LocDetl locDetl : records) { | 
 |  |  | //            List<LocDetlField> list = locDetlFieldService.list(new LambdaQueryWrapper<LocDetlField>().eq(LocDetlField::getDetlId, locDetl.getId())); | 
 |  |  | //            locDetl.syncField(list); | 
 |  |  | //        } | 
 |  |  |  | 
 |  |  |         BaseParam baseParam = buildParam(map, BaseParam.class); | 
 |  |  |         PageParam<ViewLocDetl, BaseParam> pageParam = new PageParam<>(baseParam, ViewLocDetl.class); | 
 |  |  |         PageParam<ViewLocDetl, BaseParam> data = locDetlService.getPage(pageParam, pageParam.buildWrapper(true)); | 
 |  |  |         return R.ok().add(data); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PreAuthorize("hasAuthority('asrs:locDetl:list')") | 
 |  |  |     @PostMapping("/locDetl/list") | 
 |  |  |     public R list(@RequestBody Map<String, Object> map) { | 
 |  |  |         List<LocDetl> list = locDetlService.getLocDetlList(map); | 
 |  |  |         return R.ok().add(list); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PreAuthorize("hasAuthority('asrs:locDetl:list')") | 
 |  |  |     @GetMapping("/locDetl/locId/{locId}") | 
 |  |  |     public R list(@PathVariable("locId") Long locId) { | 
 |  |  |         List<LocDetl> list = locDetlService.list(new LambdaQueryWrapper<LocDetl>().eq(LocDetl::getLocId, locId)); | 
 |  |  |         List<LocDetl> locDetls = locDetlService.parseLocDetl(list); | 
 |  |  |         return R.ok().add(locDetls); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PreAuthorize("hasAuthority('asrs:locDetl:list')") | 
 |  |  |     @GetMapping("/locDetl/{id}") | 
 |  |  |     public R get(@PathVariable("id") Long id) { | 
 |  |  |         return R.ok().add(locDetlService.getById(id)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PreAuthorize("hasAuthority('asrs:locDetl:save')") | 
 |  |  |     @OperationLog("批量插入库存明细") | 
 |  |  |     @PostMapping("/locDetl/batchAdd") | 
 |  |  |     public R save(@RequestBody List<LocDetl> locDetls) { | 
 |  |  |  | 
 |  |  |         return R.ok().add(locDetls); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PreAuthorize("hasAuthority('asrs:locDetl:save')") | 
 |  |  |     @OperationLog("添加库存明细") | 
 |  |  |     @PostMapping("/locDetl/save") | 
 |  |  |     public R save(@RequestBody LocDetl locDetl) { | 
 |  |  |         if (!locDetlService.save(locDetl)) { | 
 |  |  |             return R.error("添加失败"); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         //插入库存明细字段 | 
 |  |  |         List<MatField> matFields = matFieldService.list(new LambdaQueryWrapper<MatField>().eq(MatField::getUnique, 1)); | 
 |  |  |         for (MatField matField : matFields) { | 
 |  |  |             LocDetlField locDetlField = new LocDetlField(); | 
 |  |  |             locDetlField.setDetlId(locDetl.getId()); | 
 |  |  |             locDetlField.setFieldId(matField.getId()); | 
 |  |  |             locDetlField.setName(matField.getName()); | 
 |  |  |             locDetlFieldService.save(locDetlField); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         return R.ok("添加成功"); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PreAuthorize("hasAuthority('asrs:locDetl:update')") | 
 |  |  |     @OperationLog("修改库存明细") | 
 |  |  |     @PostMapping("/locDetl/update") | 
 |  |  |     public R update(@RequestBody HashMap<String,Object> param) { | 
 |  |  |         LocDetl locDetl = JSON.parseObject(JSON.toJSONString(param), LocDetl.class, Feature.DisableCircularReferenceDetect); | 
 |  |  |         //设置扩展字段 | 
 |  |  |         setLocDetlField(param, locDetl); | 
 |  |  |  | 
 |  |  |         if (!locDetlService.updateById(locDetl)) { | 
 |  |  |             return R.error("修改失败"); | 
 |  |  |         } | 
 |  |  |         return R.ok("修改成功"); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PreAuthorize("hasAuthority('asrs:locDetl:remove')") | 
 |  |  |     @OperationLog("删除库存明细") | 
 |  |  |     @PostMapping("/locDetl/remove/{ids}") | 
 |  |  |     public R remove(@PathVariable Long[] ids) { | 
 |  |  |         if (!locDetlService.removeByIds(Arrays.asList(ids))) { | 
 |  |  |             return R.error("删除失败"); | 
 |  |  |         } | 
 |  |  |         return R.ok("删除成功"); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PreAuthorize("hasAuthority('asrs:locDetl:list')") | 
 |  |  |     @PostMapping("/locDetl/query") | 
 |  |  |     public R query(@RequestParam(required = false) String condition) { | 
 |  |  |         List<KeyValVo> vos = new ArrayList<>(); | 
 |  |  |         LambdaQueryWrapper<LocDetl> wrapper = new LambdaQueryWrapper<>(); | 
 |  |  |         if (!Cools.isEmpty(condition)) { | 
 |  |  |             wrapper.like(LocDetl::getId, condition); | 
 |  |  |         } | 
 |  |  |         locDetlService.page(new Page<>(1, 30), wrapper).getRecords().forEach( | 
 |  |  |                 item -> vos.add(new KeyValVo(item.getId(), item.getId())) | 
 |  |  |         ); | 
 |  |  |         return R.ok().add(vos); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PreAuthorize("hasAuthority('asrs:locDetl:list')") | 
 |  |  |     @PostMapping("/locDetl/export") | 
 |  |  |     public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { | 
 |  |  |         List<LocDetl> locDetls = locDetlService.parseLocDetl(locDetlService.list()); | 
 |  |  |         List<MatField> locFields = matFieldService.getLocFields(); | 
 |  |  |         ExcelUtil.build(ExcelUtil.create(locDetls, LocDetl.class, locFields), response); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     private void setLocDetlField(HashMap<String, Object> param, LocDetl locDetl) { | 
 |  |  |         //获取扩展字段 | 
 |  |  |         List<MatField> matFields = matFieldService.list(new LambdaQueryWrapper<MatField>().eq(MatField::getFieldType, 1)); | 
 |  |  |         for (MatField matField : matFields) { | 
 |  |  |             if (param.containsKey(matField.getName())) { | 
 |  |  |                 LocDetlField fieldValue = locDetlFieldService.getOne(new LambdaQueryWrapper<LocDetlField>() | 
 |  |  |                         .eq(LocDetlField::getDetlId, locDetl.getId()) | 
 |  |  |                         .eq(LocDetlField::getFieldId, matField.getId())); | 
 |  |  |                 if (fieldValue == null) { | 
 |  |  |                     fieldValue = new LocDetlField(); | 
 |  |  |                     fieldValue.setDetlId(locDetl.getId()); | 
 |  |  |                     fieldValue.setFieldId(matField.getId()); | 
 |  |  |                     fieldValue.setName(matField.getName()); | 
 |  |  |                     fieldValue.setValue(param.get(matField.getName()).toString()); | 
 |  |  |                     locDetlFieldService.save(fieldValue); | 
 |  |  |                 }else { | 
 |  |  |                     fieldValue.setValue(param.get(matField.getName()).toString()); | 
 |  |  |                     locDetlFieldService.updateById(fieldValue); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 |  |  | package com.zy.asrs.wms.asrs.controller;
 | 
 |  |  | 
 | 
 |  |  | import com.alibaba.fastjson.JSON;
 | 
 |  |  | import com.alibaba.fastjson.parser.Feature;
 | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
 |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 | 
 |  |  | import com.zy.asrs.framework.common.Cools;
 | 
 |  |  | import com.zy.asrs.framework.common.R;
 | 
 |  |  | import com.zy.asrs.framework.exception.CoolException;
 | 
 |  |  | import com.zy.asrs.wms.asrs.entity.*;
 | 
 |  |  | import com.zy.asrs.wms.asrs.entity.enums.LocStsType;
 | 
 |  |  | import com.zy.asrs.wms.asrs.entity.param.LocDetlFreezeParam;
 | 
 |  |  | import com.zy.asrs.wms.asrs.service.LocDetlFieldService;
 | 
 |  |  | import com.zy.asrs.wms.asrs.service.LocService;
 | 
 |  |  | import com.zy.asrs.wms.asrs.service.MatFieldService;
 | 
 |  |  | import com.zy.asrs.wms.common.annotation.CacheData;
 | 
 |  |  | import com.zy.asrs.wms.common.annotation.OperationLog;
 | 
 |  |  | import com.zy.asrs.wms.common.domain.BaseParam;
 | 
 |  |  | import com.zy.asrs.wms.common.domain.KeyValVo;
 | 
 |  |  | import com.zy.asrs.wms.common.domain.PageParam;
 | 
 |  |  | import com.zy.asrs.wms.asrs.service.LocDetlService;
 | 
 |  |  | import com.zy.asrs.wms.system.controller.BaseController;
 | 
 |  |  | import com.zy.asrs.wms.utils.ExcelUtil;
 | 
 |  |  | import org.springframework.beans.BeanUtils;
 | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
 |  |  | import org.springframework.security.access.prepost.PreAuthorize;
 | 
 |  |  | import org.springframework.web.bind.annotation.*;
 | 
 |  |  | 
 | 
 |  |  | import javax.servlet.http.HttpServletResponse;
 | 
 |  |  | import java.util.*;
 | 
 |  |  | 
 | 
 |  |  | @RestController
 | 
 |  |  | @RequestMapping("/api")
 | 
 |  |  | public class LocDetlController extends BaseController {
 | 
 |  |  | 
 | 
 |  |  |     @Autowired
 | 
 |  |  |     private LocService locService;
 | 
 |  |  |     @Autowired
 | 
 |  |  |     private LocDetlService locDetlService;
 | 
 |  |  |     @Autowired
 | 
 |  |  |     private MatFieldService matFieldService;
 | 
 |  |  |     @Autowired
 | 
 |  |  |     private LocDetlFieldService locDetlFieldService;
 | 
 |  |  | 
 | 
 |  |  |     @PreAuthorize("hasAuthority('asrs:locDetl:list')")
 | 
 |  |  |     @PostMapping("/locDetl/page")
 | 
 |  |  |     @CacheData(tableName = {"man_loc_detl"})
 | 
 |  |  |     public R page(@RequestBody Map<String, Object> map) {
 | 
 |  |  | //        String orderType = null;
 | 
 |  |  | //        if (Objects.isNull(map.get("orderType"))) {
 | 
 |  |  | //             orderType = map.get("orderType").toString();
 | 
 |  |  | //             map.remove("orderType");
 | 
 |  |  | //        }
 | 
 |  |  |         BaseParam baseParam = buildParam(map, BaseParam.class);
 | 
 |  |  |         PageParam<ViewLocDetl, BaseParam> pageParam = new PageParam<>(baseParam, ViewLocDetl.class);
 | 
 |  |  |         PageParam<ViewLocDetl, BaseParam> data = locDetlService.getPage(pageParam, pageParam.buildWrapper(true));
 | 
 |  |  | 
 | 
 |  |  |         return R.ok(data);
 | 
 |  |  |     }
 | 
 |  |  | 
 | 
 |  |  |     @PreAuthorize("hasAuthority('asrs:locDetl:list')")
 | 
 |  |  |     @PostMapping("/locDetl/outPage")
 | 
 |  |  |     @CacheData(tableName = {"man_loc_detl"})
 | 
 |  |  |     public R outPage(@RequestBody Map<String, Object> map) {
 | 
 |  |  |         BaseParam baseParam = buildParam(map, BaseParam.class);
 | 
 |  |  |         PageParam<ViewLocDetl, BaseParam> pageParam = new PageParam<>(baseParam, ViewLocDetl.class);
 | 
 |  |  | 
 | 
 |  |  |         QueryWrapper<ViewLocDetl> queryWrapper = pageParam.buildWrapper(true);
 | 
 |  |  | //        List<Long> locIds = locService.listBySts(LocStsType.F.val());
 | 
 |  |  | //        if (locIds.isEmpty()) {
 | 
 |  |  | //            locIds.add(-1L);
 | 
 |  |  | //        }
 | 
 |  |  | //        queryWrapper.in("loc_id", locIds);
 | 
 |  |  |         PageParam<ViewLocDetl, BaseParam> data = locDetlService.getPage(pageParam, queryWrapper);
 | 
 |  |  |         return R.ok().add(data);
 | 
 |  |  |     }
 | 
 |  |  | 
 | 
 |  |  |     @PreAuthorize("hasAuthority('asrs:locDetl:list')")
 | 
 |  |  |     @PostMapping("/locDetl/list")
 | 
 |  |  |     @CacheData(tableName = {"man_loc_detl"})
 | 
 |  |  |     public R list(@RequestBody Map<String, Object> map) {
 | 
 |  |  |         List<LocDetl> list = locDetlService.getLocDetlList(map);
 | 
 |  |  |         return R.ok().add(list);
 | 
 |  |  |     }
 | 
 |  |  | 
 | 
 |  |  |     @PreAuthorize("hasAuthority('asrs:locDetl:list')")
 | 
 |  |  |     @PostMapping("/locDetl/listByIds")
 | 
 |  |  |     @CacheData(tableName = {"man_loc_detl"})
 | 
 |  |  |     public R listByIds(@RequestBody List<Long> ids) {
 | 
 |  |  |         List<LocDetl> list = locDetlService.listByIds(ids);
 | 
 |  |  |         List<LocDetl> locDetls = locDetlService.parseLocDetl(list);
 | 
 |  |  |         return R.ok().add(locDetls);
 | 
 |  |  |     }
 | 
 |  |  | 
 | 
 |  |  |     @PreAuthorize("hasAuthority('asrs:locDetl:list')")
 | 
 |  |  |     @GetMapping("/locDetl/locId/{locId}")
 | 
 |  |  |     @CacheData(tableName = {"man_loc_detl"})
 | 
 |  |  |     public R list(@PathVariable("locId") Long locId) {
 | 
 |  |  |         List<LocDetl> list = locDetlService.list(new LambdaQueryWrapper<LocDetl>().eq(LocDetl::getLocId, locId));
 | 
 |  |  |         List<LocDetl> locDetls = locDetlService.parseLocDetl(list);
 | 
 |  |  |         return R.ok().add(locDetls);
 | 
 |  |  |     }
 | 
 |  |  | 
 | 
 |  |  |     @PreAuthorize("hasAuthority('asrs:locDetl:list')")
 | 
 |  |  |     @GetMapping("/locDetl/locNo/{locNo}")
 | 
 |  |  |     @CacheData(tableName = {"man_loc_detl"})
 | 
 |  |  |     public R list(@PathVariable("locNo") String locNo) {
 | 
 |  |  |         Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, locNo));
 | 
 |  |  |         if (loc == null) {
 | 
 |  |  |             return R.error("库位不存在");
 | 
 |  |  |         }
 | 
 |  |  |         List<LocDetl> list = locDetlService.list(new LambdaQueryWrapper<LocDetl>().eq(LocDetl::getLocId, loc.getId()));
 | 
 |  |  |         List<LocDetl> locDetls = locDetlService.parseLocDetl(list);
 | 
 |  |  |         return R.ok().add(locDetls);
 | 
 |  |  |     }
 | 
 |  |  | 
 | 
 |  |  |     @PreAuthorize("hasAuthority('asrs:locDetl:list')")
 | 
 |  |  |     @GetMapping("/locDetl/{id}")
 | 
 |  |  |     @CacheData(tableName = {"man_loc_detl"})
 | 
 |  |  |     public R get(@PathVariable("id") Long id) {
 | 
 |  |  |         return R.ok().add(locDetlService.getById(id));
 | 
 |  |  |     }
 | 
 |  |  | 
 | 
 |  |  |     @PreAuthorize("hasAuthority('asrs:locDetl:save')")
 | 
 |  |  |     @OperationLog("批量插入库存明细")
 | 
 |  |  |     @PostMapping("/locDetl/batchAdd")
 | 
 |  |  |     public R save(@RequestBody List<LocDetl> locDetls) {
 | 
 |  |  | 
 | 
 |  |  |         return R.ok().add(locDetls);
 | 
 |  |  |     }
 | 
 |  |  | 
 | 
 |  |  |     @PreAuthorize("hasAuthority('asrs:locDetl:save')")
 | 
 |  |  |     @OperationLog("添加库存明细")
 | 
 |  |  |     @PostMapping("/locDetl/save")
 | 
 |  |  |     public R save(@RequestBody LocDetl locDetl) {
 | 
 |  |  |         if (!locDetlService.save(locDetl)) {
 | 
 |  |  |             return R.error("添加失败");
 | 
 |  |  |         }
 | 
 |  |  | 
 | 
 |  |  |         //插入库存明细字段
 | 
 |  |  |         List<MatField> matFields = matFieldService.list(new LambdaQueryWrapper<MatField>().eq(MatField::getUnique, 1));
 | 
 |  |  |         for (MatField matField : matFields) {
 | 
 |  |  |             LocDetlField locDetlField = new LocDetlField();
 | 
 |  |  |             locDetlField.setDetlId(locDetl.getId());
 | 
 |  |  |             locDetlField.setFieldId(matField.getId());
 | 
 |  |  |             locDetlField.setName(matField.getName());
 | 
 |  |  |             locDetlFieldService.save(locDetlField);
 | 
 |  |  |         }
 | 
 |  |  |         return R.ok("添加成功");
 | 
 |  |  |     }
 | 
 |  |  | 
 | 
 |  |  |     @PreAuthorize("hasAuthority('asrs:locDetl:update')")
 | 
 |  |  |     @OperationLog("修改库存明细")
 | 
 |  |  |     @PostMapping("/locDetl/update")
 | 
 |  |  |     public R update(@RequestBody HashMap<String,Object> param) {
 | 
 |  |  |         LocDetl locDetl = JSON.parseObject(JSON.toJSONString(param), LocDetl.class, Feature.DisableCircularReferenceDetect);
 | 
 |  |  |         //设置扩展字段
 | 
 |  |  |         setLocDetlField(param, locDetl);
 | 
 |  |  | 
 | 
 |  |  |         if (!locDetlService.updateById(locDetl)) {
 | 
 |  |  |             return R.error("修改失败");
 | 
 |  |  |         }
 | 
 |  |  |         return R.ok("修改成功");
 | 
 |  |  |     }
 | 
 |  |  | 
 | 
 |  |  |     @PreAuthorize("hasAuthority('asrs:locDetl:remove')")
 | 
 |  |  |     @OperationLog("删除库存明细")
 | 
 |  |  |     @PostMapping("/locDetl/remove/{ids}")
 | 
 |  |  |     public R remove(@PathVariable Long[] ids) {
 | 
 |  |  |         if (!locDetlService.removeByIds(Arrays.asList(ids))) {
 | 
 |  |  |             return R.error("删除失败");
 | 
 |  |  |         }
 | 
 |  |  |         return R.ok("删除成功");
 | 
 |  |  |     }
 | 
 |  |  | 
 | 
 |  |  |     @PreAuthorize("hasAuthority('asrs:locDetl:list')")
 | 
 |  |  |     @PostMapping("/locDetl/query")
 | 
 |  |  |     public R query(@RequestParam(required = false) String condition) {
 | 
 |  |  |         List<KeyValVo> vos = new ArrayList<>();
 | 
 |  |  |         LambdaQueryWrapper<LocDetl> wrapper = new LambdaQueryWrapper<>();
 | 
 |  |  |         if (!Cools.isEmpty(condition)) {
 | 
 |  |  |             wrapper.like(LocDetl::getId, condition);
 | 
 |  |  |         }
 | 
 |  |  |         locDetlService.page(new Page<>(1, 30), wrapper).getRecords().forEach(
 | 
 |  |  |                 item -> vos.add(new KeyValVo(item.getId(), item.getId()))
 | 
 |  |  |         );
 | 
 |  |  |         return R.ok().add(vos);
 | 
 |  |  |     }
 | 
 |  |  | 
 | 
 |  |  |     @PreAuthorize("hasAuthority('asrs:locDetl:list')")
 | 
 |  |  |     @PostMapping("/locDetl/export")
 | 
 |  |  |     public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception {
 | 
 |  |  |         BaseParam baseParam = buildParam(map, BaseParam.class);
 | 
 |  |  |         PageParam<LocDetl, BaseParam> pageParam = new PageParam<>(baseParam, LocDetl.class);
 | 
 |  |  |         List<LocDetl> data = locDetlService.list(pageParam.buildWrapper(true));
 | 
 |  |  | 
 | 
 |  |  |         List<LocDetl> locDetls = locDetlService.parseLocDetl(data);
 | 
 |  |  |         List<MatField> locFields = matFieldService.getLocFields();
 | 
 |  |  |         ExcelUtil.build(ExcelUtil.create(locDetls, LocDetl.class, locFields), response);
 | 
 |  |  |     }
 | 
 |  |  | 
 | 
 |  |  |     private void setLocDetlField(HashMap<String, Object> param, LocDetl locDetl) {
 | 
 |  |  |         //获取扩展字段
 | 
 |  |  |         List<MatField> matFields = matFieldService.list(new LambdaQueryWrapper<MatField>().eq(MatField::getFieldType, 1));
 | 
 |  |  |         for (MatField matField : matFields) {
 | 
 |  |  |             if (param.containsKey(matField.getName())) {
 | 
 |  |  |                 LocDetlField fieldValue = locDetlFieldService.getOne(new LambdaQueryWrapper<LocDetlField>()
 | 
 |  |  |                         .eq(LocDetlField::getDetlId, locDetl.getId())
 | 
 |  |  |                         .eq(LocDetlField::getFieldId, matField.getId()));
 | 
 |  |  |                 if (fieldValue == null) {
 | 
 |  |  |                     fieldValue = new LocDetlField();
 | 
 |  |  |                     fieldValue.setDetlId(locDetl.getId());
 | 
 |  |  |                     fieldValue.setFieldId(matField.getId());
 | 
 |  |  |                     fieldValue.setName(matField.getName());
 | 
 |  |  |                     fieldValue.setValue(param.get(matField.getName()).toString());
 | 
 |  |  |                     locDetlFieldService.save(fieldValue);
 | 
 |  |  |                 }else {
 | 
 |  |  |                     fieldValue.setValue(param.get(matField.getName()).toString());
 | 
 |  |  |                     locDetlFieldService.updateById(fieldValue);
 | 
 |  |  |                 }
 | 
 |  |  |             }
 | 
 |  |  |         }
 | 
 |  |  |     }
 | 
 |  |  | 
 | 
 |  |  |     @PreAuthorize("hasAuthority('asrs:locDetl:update')")
 | 
 |  |  |     @OperationLog("库存冻结")
 | 
 |  |  |     @PostMapping("/locDetl/freeze")
 | 
 |  |  |     public R freeze(@RequestBody LocDetlFreezeParam param) {
 | 
 |  |  |         locDetlService.locDetlFreeze(param);
 | 
 |  |  |         return R.ok();
 | 
 |  |  |     }
 | 
 |  |  | 
 | 
 |  |  | }
 |