package com.yc.wms.controller;

import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.yc.wms.service.Jianhuojiemian;
import com.yc.wms.until.QueryPageUtil;
import com.yc.wms.until.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


@RestController
@Slf4j
@RequestMapping("/Jianhuojiemian")
public class JianhuojiemianController {

    @Autowired
    private Jianhuojiemian jianhuojiemian;

    @PostMapping("/queryJian")
    public Result queryUser(@RequestBody String  json) {

        QueryPageUtil query =new QueryPageUtil();
        JSONObject jsonObject= JSONUtil.parseObj(json);
        query.setPageSize((int)jsonObject.get("pageSize"));
        query.setPageNum((int)jsonObject.get("pageNum"));

        JSONObject param= (JSONObject)jsonObject.get("param");

       com.yc.wms.bean.Jianhuojiemian j = JSONUtil.toBean(param.toString(), com.yc.wms.bean.Jianhuojiemian.class);


        return jianhuojiemian.QueryJson(query,j);
    }

    //单据类型
    @PostMapping("/dj")
    public Result Dj() {
       return jianhuojiemian.Dj();
    }

    //工作站
    @PostMapping("/gz")
    public Result Gz() {
        return jianhuojiemian.Gz();
    }

    //拣货人
    @PostMapping("/jhr")
    public Result Jhr() {
       return jianhuojiemian.Jhr();
    }

    //库位
    @PostMapping("/kw")
    public Result Kw(@RequestBody String query) {

        JSONObject jsonObject= JSONUtil.parseObj(query);
        String w= (String) jsonObject.get("query");


        return  jianhuojiemian.Kw(w);
    }

    //加急标记
    @PostMapping("/bj")
    public Result Bj() {
        return  jianhuojiemian.Bj();
    }

    //下发人
    @PostMapping("xf")
    public Result Xf() {
        return jianhuojiemian.Xf();
    }
}
