自动化立体仓库 - WMS系统
whycq
2023-08-26 82bcd0328dddbaad65933e2fada22bc68e82b3d5
src/main/java/com/zy/asrs/controller/WaitPakinController.java
@@ -11,7 +11,9 @@
import com.core.common.DateUtils;
import com.core.common.R;
import com.zy.asrs.entity.WaitPakin;
import com.zy.asrs.entity.WrkMast;
import com.zy.asrs.service.WaitPakinService;
import com.zy.asrs.service.WrkMastService;
import com.zy.common.web.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -26,6 +28,9 @@
    @Autowired
    private WaitPakinService waitPakinService;
    @Autowired
    private WrkMastService wrkMastService;
    @RequestMapping(value = "/waitPakin/{id}/auth")
    @ManagerAuth
@@ -44,17 +49,21 @@
        EntityWrapper<WaitPakin> wrapper = new EntityWrapper<>();
        convert(param, wrapper);
        if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));}
        else {
            wrapper.orderBy("modi_time", false);
        }
        return R.ok(waitPakinService.selectPage(new Page<>(curr, limit), wrapper));
    }
    private void convert(Map<String, Object> map, EntityWrapper wrapper){
        for (Map.Entry<String, Object> entry : map.entrySet()){
            if (entry.getKey().endsWith(">")) {
                wrapper.ge(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue())));
            } else if (entry.getKey().endsWith("<")) {
                wrapper.le(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue())));
            String val = String.valueOf(entry.getValue());
            if (val.contains(RANGE_TIME_LINK)){
                String[] dates = val.split(RANGE_TIME_LINK);
                wrapper.ge(entry.getKey(), DateUtils.convert(dates[0]));
                wrapper.le(entry.getKey(), DateUtils.convert(dates[1]));
            } else {
                wrapper.like(entry.getKey(), String.valueOf(entry.getValue()));
                wrapper.like(entry.getKey(), val);
            }
        }
    }
@@ -69,7 +78,7 @@
   @RequestMapping(value = "/waitPakin/update/auth")
   @ManagerAuth
    public R update(WaitPakin waitPakin){
        if (Cools.isEmpty(waitPakin) || null==waitPakin.getId()){
        if (Cools.isEmpty(waitPakin)){
            return R.error();
        }
        waitPakinService.updateById(waitPakin);
@@ -84,7 +93,13 @@
            return R.error();
        }
        for (WaitPakin entity : list){
            waitPakinService.delete(new EntityWrapper<>(entity));
            WrkMast wrkMast = wrkMastService.selectByBarcode(entity.getBarcode());
            if (Cools.isEmpty(wrkMast)) {
                waitPakinService.delete(new EntityWrapper<>(entity));
            } else {
                return R.error("工作档数据已存在,无法删除!!");
            }
        }
        return R.ok();
    }
@@ -109,8 +124,8 @@
        List<Map<String, Object>> result = new ArrayList<>();
        for (WaitPakin waitPakin : page.getRecords()){
            Map<String, Object> map = new HashMap<>();
            map.put("id", waitPakin.getId());
            map.put("value", waitPakin.getId());
            map.put("id", waitPakin.getZpallet());
            map.put("value", waitPakin.getZpallet());
            result.add(map);
        }
        return R.ok(result);