自动化立体仓库 - WMS系统
#
Junjie
2025-04-07 3015d66dae1fef9850c9c990570e8ca90f0ded60
src/main/java/com/zy/asrs/controller/ManLocDetlController.java
@@ -1,5 +1,6 @@
package com.zy.asrs.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.core.annotations.ManagerAuth;
@@ -10,12 +11,14 @@
import com.zy.asrs.entity.param.LocDetlAdjustParam;
import com.zy.asrs.service.ManLocDetlService;
import com.zy.common.web.BaseController;
import com.zy.system.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
@RestController
@@ -54,6 +57,7 @@
                param.remove("update_time");
            }
        }
        Page<ManLocDetl> page = manLocDetlService.getPage(toPage(curr, limit, param, ManLocDetl.class));
        return R.ok(page);
    }
@@ -75,7 +79,8 @@
    @RequestMapping("/manLocDetl/adjust/start")
    @ManagerAuth(memo = "库存调整")
    public R locDetlAdjustStart(@RequestBody LocDetlAdjustParam param) {
        manLocDetlService.adjustLocDetl(param, getUserId(),getUser());
        User user = getUser();
        manLocDetlService.adjustLocDetl(param, getUserId(), user == null ? "" : user.getUsername());
        return R.ok("库存调整成功");
    }
@@ -92,6 +97,16 @@
        Page<ManLocDetl> all = manLocDetlService.selectAllPage(manLocDetlPage);
        return R.ok().add(all);
    }
    /*
   平库移库
    */
    @RequestMapping("/node/move/start")
    public R nodeMoveStart(@RequestParam String sourceLocNo, @RequestParam String targetLocNo){
        manLocDetlService.updateLocNo(targetLocNo,sourceLocNo);
        return R.ok();
    }
    private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){
        for (Map.Entry<String, Object> entry : map.entrySet()){
            String val = String.valueOf(entry.getValue());
@@ -109,7 +124,34 @@
        }
    }
    @RequestMapping(value = "/manLocDetl/export/auth")
    @ManagerAuth(memo = "库位明细导出")
    public synchronized R export(@RequestBody JSONObject param){
        List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class);
        EntityWrapper<ManLocDetl> wrapper = new EntityWrapper<>();
        Map<String, Object> map = excludeTrash(param.getJSONObject("locDetl"));
        String row = "";
        if (map.get("row") != null) {
            String chooseRow = (String) map.get("row");
            if (chooseRow.length() == 1) {
                row = "0" + chooseRow;
                map.remove("row");
            }else {
                row = chooseRow;
                map.remove("row");
            }
        }
        convert(map, wrapper);
        if (!row.equals("")){
            wrapper.and()
                    .where("loc_no like '" +row +"%'");
        }
        List<ManLocDetl> list = manLocDetlService.selectList(wrapper);
        list.forEach(m -> {
            m.setMatnr(m.getMatnr() + " ");
        });
        return R.ok(exportSupport(list, fields));
    }
}