| | |
| | | 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; |
| | |
| | | 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 |
| | |
| | | param.remove("update_time"); |
| | | } |
| | | } |
| | | |
| | | Page<ManLocDetl> page = manLocDetlService.getPage(toPage(curr, limit, param, ManLocDetl.class)); |
| | | return R.ok(page); |
| | | } |
| | |
| | | @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("库存调整成功"); |
| | | } |
| | | |
| | |
| | | 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()); |
| | |
| | | } |
| | | } |
| | | |
| | | @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)); |
| | | } |
| | | |
| | | } |