王佳豪
2021-03-09 cc344f433bf14d966207255ac0c8f93a9a46dec2
src/main/java/com/zy/asrs/controller/LocNormalController.java
@@ -11,6 +11,7 @@
import com.core.common.DateUtils;
import com.core.common.R;
import com.zy.asrs.entity.LocNormal;
import com.zy.asrs.entity.param.LocNormalParam;
import com.zy.asrs.service.LocNormalService;
import com.zy.common.utils.excel.locNomal.LocNormalExcel;
import com.zy.common.utils.excel.locNomal.LocNormalExcelListener;
@@ -27,6 +28,7 @@
import java.io.IOException;
import java.util.Date;
import java.util.List;
import java.util.Map;
import static jdk.nashorn.api.scripting.ScriptUtils.convert;
@@ -48,7 +50,9 @@
        EntityWrapper<LocNormal> wrapper = new EntityWrapper<>();
        convert(param, wrapper);
        allLike(LocNormal.class, param.keySet(), wrapper, condition);
        if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));}
        if (!Cools.isEmpty(orderByField)) {
            wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));
        }
        wrapper.eq("state", "1").or().eq("state", "2");
        return R.ok(locNormalService.selectPage(new Page<>(curr, limit), wrapper));
    }
@@ -114,13 +118,28 @@
        locNormalService.removeLocNormal(param.getMatnr(), modiUser, modiTime);
    }
    // 导入
    /* 导入 */
    @RequestMapping(value = "/locNormal/import/auth")
    @ManagerAuth(memo = "平仓管理导入")
    @Transactional
    public R matCodeImport(MultipartFile file) throws IOException, InterruptedException {
    public R locNormalImport(MultipartFile file) throws IOException, InterruptedException {
        LocNormalExcelListener listener = new LocNormalExcelListener(getUserId());
        EasyExcel.read(file.getInputStream(), LocNormalExcel.class, listener).sheet().doRead();
        return R.ok("成功导入"+listener.getTotal()+"条物料信息");
    }
    /* pda入库 */
    @RequestMapping(value = "/locNormal/pda/in")
    @ManagerAuth(memo = "平仓管理pda入库")
    @Transactional
    public R locNormalPdaIn(@RequestBody LocNormalParam param) {
        Long userId = getUserId();
        Date timeNow = new Date();
        for (Integer i = 0; i < param.getNormalList().size(); i++) {
            param.getNormalList().get(i).setAppeUser(userId);
            param.getNormalList().get(i).setAppeTime(timeNow);
        }
        locNormalService.pdaLocNormalIn(param.getNormalList());
        return R.ok();
    }
}