自动化立体仓库 - WMS系统
13
zhang
2 天以前 ab41622d30946f83b34e5a5d881741237628f6f1
src/main/java/com/zy/asrs/controller/AgvWrkMastController.java
@@ -10,8 +10,8 @@
import com.core.common.Cools;
import com.core.common.DateUtils;
import com.core.common.R;
import com.zy.asrs.entity.WrkMast;
import com.zy.asrs.service.WrkMastService;
import com.zy.asrs.entity.AgvWrkMast;
import com.zy.asrs.service.AgvWrkMastService;
import com.zy.common.web.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -22,12 +22,12 @@
public class AgvWrkMastController extends BaseController {
    @Autowired
    private WrkMastService wrkMastService;
    private AgvWrkMastService agvWrkMastService;
    @RequestMapping(value = "/agvWrkMast/{id}/auth")
    @ManagerAuth
    public R get(@PathVariable("id") String id) {
        return R.ok(wrkMastService.selectById(String.valueOf(id)));
        return R.ok(agvWrkMastService.selectById(String.valueOf(id)));
    }
    @RequestMapping(value = "/agvWrkMast/list/auth")
@@ -39,9 +39,9 @@
                  @RequestParam(required = false) String condition,
                  @RequestParam Map<String, Object> param) {
        excludeTrash(param);
        EntityWrapper<WrkMast> wrapper = new EntityWrapper<>();
        EntityWrapper<AgvWrkMast> wrapper = new EntityWrapper<>();
        convert(param, wrapper);
        allLike(WrkMast.class, param.keySet(), wrapper, condition);
        allLike(AgvWrkMast.class, param.keySet(), wrapper, condition);
        if (!Cools.isEmpty(orderByField)) {
            if (orderByField.endsWith("$")) {
                orderByField = orderByField.substring(0, orderByField.length() - 1);
@@ -50,7 +50,7 @@
        } else {
            wrapper.orderBy("io_time", false);
        }
        return R.ok(wrkMastService.selectPage(new Page<>(curr, limit), wrapper));
        return R.ok(agvWrkMastService.selectPage(new Page<>(curr, limit), wrapper));
    }
    private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) {
@@ -68,36 +68,36 @@
    @RequestMapping(value = "/agvWrkMast/add/auth")
    @ManagerAuth(memo = "工作档添加")
    public R add(WrkMast wrkMast) {
    public R add(AgvWrkMast wrkMast) {
        wrkMast.setModiUser(getUserId());
        wrkMast.setModiTime(new Date());
        wrkMast.setAppeUser(getUserId());
        wrkMast.setAppeTime(new Date());
        wrkMastService.insert(wrkMast);
        agvWrkMastService.insert(wrkMast);
        return R.ok();
    }
    @RequestMapping(value = "/agvWrkMast/update/auth")
    @ManagerAuth(memo = "工作档修改")
    public R update(WrkMast wrkMast) {
    public R update(AgvWrkMast wrkMast) {
        if (Cools.isEmpty(wrkMast) || null == wrkMast.getWrkNo()) {
            return R.error();
        }
        wrkMast.setModiUser(getUserId());
        wrkMast.setModiTime(new Date());
        wrkMastService.updateById(wrkMast);
        agvWrkMastService.updateById(wrkMast);
        return R.ok();
    }
    @RequestMapping(value = "/agvWrkMast/delete/auth")
    @ManagerAuth(memo = "工作档删除")
    public R delete(@RequestParam String param) {
        List<WrkMast> list = JSONArray.parseArray(param, WrkMast.class);
        List<AgvWrkMast> list = JSONArray.parseArray(param, AgvWrkMast.class);
        if (Cools.isEmpty(list)) {
            return R.error();
        }
        for (WrkMast entity : list) {
            wrkMastService.delete(new EntityWrapper<>(entity));
        for (AgvWrkMast entity : list) {
            agvWrkMastService.delete(new EntityWrapper<>(entity));
        }
        return R.ok();
    }
@@ -106,21 +106,21 @@
    @ManagerAuth(memo = "工作档导出")
    public R export(@RequestBody JSONObject param) {
        List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class);
        EntityWrapper<WrkMast> wrapper = new EntityWrapper<>();
        EntityWrapper<AgvWrkMast> wrapper = new EntityWrapper<>();
        Map<String, Object> map = excludeTrash(param.getJSONObject("wrkMast"));
        convert(map, wrapper);
        List<WrkMast> list = wrkMastService.selectList(wrapper);
        List<AgvWrkMast> list = agvWrkMastService.selectList(wrapper);
        return R.ok(exportSupport(list, fields));
    }
    @RequestMapping(value = "/agvWrkMastQuery/auth")
    @ManagerAuth
    public R query(String condition) {
        EntityWrapper<WrkMast> wrapper = new EntityWrapper<>();
        EntityWrapper<AgvWrkMast> wrapper = new EntityWrapper<>();
        wrapper.like("wrk_no", condition);
        Page<WrkMast> page = wrkMastService.selectPage(new Page<>(0, 10), wrapper);
        Page<AgvWrkMast> page = agvWrkMastService.selectPage(new Page<>(0, 10), wrapper);
        List<Map<String, Object>> result = new ArrayList<>();
        for (WrkMast wrkMast : page.getRecords()) {
        for (AgvWrkMast wrkMast : page.getRecords()) {
            Map<String, Object> map = new HashMap<>();
            map.put("id", wrkMast.getWrkNo());
            map.put("value", wrkMast.getWrkNo());
@@ -132,36 +132,36 @@
    @RequestMapping(value = "/agvWrkMast/check/column/auth")
    @ManagerAuth
    public R query(@RequestBody JSONObject param) {
        Wrapper<WrkMast> wrapper = new EntityWrapper<WrkMast>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val"));
        if (null != wrkMastService.selectOne(wrapper)) {
            return R.parse(BaseRes.REPEAT).add(getComment(WrkMast.class, String.valueOf(param.get("key"))));
        Wrapper<AgvWrkMast> wrapper = new EntityWrapper<AgvWrkMast>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val"));
        if (null != agvWrkMastService.selectOne(wrapper)) {
            return R.parse(BaseRes.REPEAT).add(getComment(AgvWrkMast.class, String.valueOf(param.get("key"))));
        }
        return R.ok();
    }
    @RequestMapping(value = "/agvWrkMast/add/pri/auth")
    @ManagerAuth(memo = "工作档增加优先级")
    public R addPri(@RequestBody List<WrkMast> list) {
    public R addPri(@RequestBody List<AgvWrkMast> list) {
        if (list.isEmpty()) {
            return R.error("请至少选择一行数据");
        }
        for (WrkMast entity : list) {
        for (AgvWrkMast entity : list) {
            entity.setIoPri(entity.getIoPri() + 1);
        }
        wrkMastService.updateBatchById(list);
        agvWrkMastService.updateBatchById(list);
        return R.ok();
    }
    @RequestMapping(value = "/agvWrkMast/red/pri/auth")
    @ManagerAuth(memo = "工作档降低优先级")
    public R redPri(@RequestBody List<WrkMast> list) {
    public R redPri(@RequestBody List<AgvWrkMast> list) {
        if (list.isEmpty()) {
            return R.error("请至少选择一行数据");
        }
        for (WrkMast entity : list) {
        for (AgvWrkMast entity : list) {
            entity.setIoPri(entity.getIoPri() - 1);
        }
        wrkMastService.updateBatchById(list);
        agvWrkMastService.updateBatchById(list);
        return R.ok();
    }