自动化立体仓库 - WMS系统
dubin
2025-12-19 b00eeab31bd13ba34a03301aa441b0751d6a93e4
src/main/java/com/zy/ints/controller/WaitMatoutController.java
@@ -9,16 +9,16 @@
import com.core.common.Cools;
import com.core.common.DateUtils;
import com.core.common.R;
import com.core.exception.CoolException;
import com.zy.common.web.BaseController;
import com.zy.ints.entity.WaitMatin;
import com.zy.ints.entity.WaitMatout;
import com.zy.ints.service.WaitMatoutService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
@RestController
public class WaitMatoutController extends BaseController {
@@ -30,6 +30,24 @@
    @ManagerAuth
    public R get(@PathVariable("id") String id) {
        return R.ok(waitMatoutService.selectById(String.valueOf(id)));
    }
    @RequestMapping(value = "/waitMatout/head/page/auth")
    @ManagerAuth
    public R headPage(@RequestParam(defaultValue = "1")Integer curr,
                      @RequestParam(defaultValue = "10")Integer limit,
                      @RequestParam Map<String, Object> param){
        if (!Cools.isEmpty(param.get("appe_time"))){
            String val = String.valueOf(param.get("appe_time"));
            if (val.contains(RANGE_TIME_LINK)) {
                String[] dates = val.split(RANGE_TIME_LINK);
                param.put("startTime", DateUtils.convert(dates[0]));
                param.put("endTime", DateUtils.convert(dates[1]));
                param.remove("appe_time");
            }
        }
        return R.ok(waitMatoutService.getHeadPage(toPage(curr, limit, param, WaitMatout.class)));
    }
    @RequestMapping(value = "/waitMatout/list/auth")
@@ -44,6 +62,20 @@
        excludeTrash(param);
        convert(param, wrapper);
        allLike(WaitMatout.class, param.keySet(), wrapper, condition);
        if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));}
        return R.ok(waitMatoutService.selectPage(new Page<>(curr, limit), wrapper));
    }
    @RequestMapping(value = "/waitMatout/list/auth2")
    @ManagerAuth
    public R list(@RequestParam(defaultValue = "1")Integer curr,
                  @RequestParam(defaultValue = "10")Integer limit,
                  @RequestParam(required = false)String orderByField,
                  @RequestParam(required = false)String orderByType,
                  @RequestParam(required = false)String condition,
                  @RequestParam(name = "billNo") String bill_no){
        EntityWrapper<WaitMatout> wrapper = new EntityWrapper<>();
        wrapper.eq("bill_no", bill_no);
        if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));}
        return R.ok(waitMatoutService.selectPage(new Page<>(curr, limit), wrapper));
    }
@@ -63,28 +95,81 @@
    @RequestMapping(value = "/waitMatout/add/auth")
    @ManagerAuth
    public R add(WaitMatout waitMatout) {
        waitMatoutService.insert(waitMatout);
        return R.ok();
    @Transactional
    public R add(@RequestBody List<WaitMatout> waitMatouts) {
        if (Cools.isEmpty(waitMatouts)) {
            return R.parse(BaseRes.PARAM);
        }
        if (waitMatoutService.selectCount(new EntityWrapper<WaitMatout>().eq("bill_no", waitMatouts.get(0).getBillNo())) > 0) {
            return R.error("单据编号已存在");
        }
        int i = 1;
        Date now = new Date();
        for (WaitMatout waitMatout : waitMatouts) {
            waitMatout.setSeqNo(i);
            waitMatout.setAppeTime(now);
            waitMatout.setAppeUser(getUserId());
            waitMatout.setModiTime(now);
            waitMatout.setModiUser(getUserId());
            if (!waitMatoutService.insert(waitMatout)) {
                throw new CoolException("添加单据明细失败");
            }
            i++;
        }
        return R.ok("添加成功");
    }
   @RequestMapping(value = "/waitMatout/update/auth")
   @ManagerAuth
    public R update(WaitMatout waitMatout){
        if (Cools.isEmpty(waitMatout) || null==waitMatout.getSeqNo()){
    @RequestMapping(value = "/waitMatout/modify/auth")
    @ManagerAuth
    @Transactional
    public R update(@RequestBody List<WaitMatout> waitMatouts){
        if (Cools.isEmpty(waitMatouts)) {
            return R.parse(BaseRes.PARAM);
        }
        Date now = new Date();
        List<WaitMatout> oldWaitMatouts = waitMatoutService.selectList(new EntityWrapper<WaitMatout>().eq("bill_no", waitMatouts.get(0).getBillNo()));
        Date appeTime = oldWaitMatouts!=null?oldWaitMatouts.get(0).getAppeTime():now;
        Long appeUser = oldWaitMatouts!=null?oldWaitMatouts.get(0).getAppeUser():getUserId();
        if (!waitMatoutService.delete(new EntityWrapper<WaitMatout>().eq("bill_no", waitMatouts.get(0).getBillNo()))) {
            return R.error();
        }
        waitMatoutService.updateById(waitMatout);
        return R.ok();
        int i = 1;
        for (WaitMatout waitMatout : waitMatouts) {
            waitMatout.setSeqNo(i);
            waitMatout.setAppeTime(appeTime);
            waitMatout.setAppeUser(appeUser);
            waitMatout.setModiTime(now);
            waitMatout.setModiUser(getUserId());
            if (!waitMatoutService.insert(waitMatout)) {
                throw new CoolException("修改单据明细失败");
            }
            i++;
        }
        return R.ok("修改成功");
    }
    @RequestMapping(value = "/waitMatout/detl/list/auth")
    @ManagerAuth
    public R detlPage(@RequestParam String billNo){
        if (Cools.isEmpty(billNo)){
            return R.parse(BaseRes.PARAM);
        }
        List<WaitMatout> waitMatins = waitMatoutService.selectList(new EntityWrapper<WaitMatout>().eq("bill_no", billNo));
        if (Cools.isEmpty(waitMatins)) {
            return R.parse(BaseRes.EMPTY);
        }
        return R.ok().add(waitMatins);
    }
    @RequestMapping(value = "/waitMatout/delete/auth")
    @ManagerAuth
    public R delete(@RequestParam(value="ids[]") Long[] ids){
         for (Long id : ids){
            waitMatoutService.deleteById(id);
    public R delete(@RequestParam String billNo){
        if (!waitMatoutService.delete(new EntityWrapper<WaitMatout>().eq("bill_no", billNo))) {
            throw new CoolException("删除单据明细失败");
        }
        return R.ok();
        return R.ok("删除成功");
    }
    @RequestMapping(value = "/waitMatout/export/auth")