package com.prolog.cs.biz.outbound.controller;

import com.prolog.cs.biz.outbound.model.WmsRepPre;
import com.prolog.cs.biz.outbound.service.WmsRepPreService;
import com.prolog.framework.common.message.RestMessage;
import com.prolog.framework.utils.UUIDUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@Api(tags = "预补货")
@RestController
@RequestMapping("/wms-pre-rep")

public class WmsRepPreController {

    @Autowired
    private WmsRepPreService wmsRepPreService;

    @ApiOperation(value = "定时-生成补货任务")
    @PostMapping("/auto-rep")
    public RestMessage autoRep() {
        wmsRepPreService.autoRep();
        return RestMessage.doSuccess(null);
    }


    @ApiOperation(value = "定时-生成补货任务")
    @PostMapping("/test-save")
    public RestMessage testSave() {
        WmsRepPre wmsRepPre = new WmsRepPre();
        wmsRepPre.setId(UUIDUtils.generateWithoutSeperator());
        wmsRepPre.setItemId("ssssslhbh002");
        wmsRepPre.setWarehouseId("901884530611326976");
        wmsRepPre.setEnterpriseId("900356013474058240");
        wmsRepPre.setStatus("0");
        wmsRepPre.setCreator("sys");
        wmsRepPre.setGmtCreate(new Date());
        wmsRepPre.setModifier("sys");
        wmsRepPre.setGmtModified(new Date());
        wmsRepPreService.save(wmsRepPre);
        return RestMessage.doSuccess(null);
    }
}
