|  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.plugins.Page; | 
|---|
|  |  |  | import com.core.common.DateUtils; | 
|---|
|  |  |  | import com.zy.asrs.entity.LocCheck; | 
|---|
|  |  |  | import com.zy.asrs.entity.ManLocDetl; | 
|---|
|  |  |  | import com.zy.asrs.service.LocCheckService; | 
|---|
|  |  |  | import com.core.annotations.ManagerAuth; | 
|---|
|  |  |  | import com.core.common.BaseRes; | 
|---|
|  |  |  | import com.core.common.Cools; | 
|---|
|  |  |  | import com.core.common.R; | 
|---|
|  |  |  | import com.zy.asrs.service.ManLocDetlService; | 
|---|
|  |  |  | import com.zy.common.web.BaseController; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.*; | 
|---|
|  |  |  | @Slf4j | 
|---|
|  |  |  | @RestController | 
|---|
|  |  |  | public class LocCheckController extends BaseController { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private LocCheckService locCheckService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ManLocDetlService manLocDetlService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/locCheck/{id}/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping("/locCheck/create/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R autoCreate(@RequestParam(value = "prec") String prec){ | 
|---|
|  |  |  | int precInt = Integer.parseInt(prec); | 
|---|
|  |  |  | EntityWrapper<ManLocDetl> manLocDetlEntityWrapper = new EntityWrapper<>(); | 
|---|
|  |  |  | int count = manLocDetlService.selectCount(manLocDetlEntityWrapper); | 
|---|
|  |  |  | List<ManLocDetl> countLocDetl; | 
|---|
|  |  |  | switch (precInt){ | 
|---|
|  |  |  | case 100: | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case 80: | 
|---|
|  |  |  | count = (int)(count * 0.8); break; | 
|---|
|  |  |  | case 60: | 
|---|
|  |  |  | count = (int)(count * 0.6); break; | 
|---|
|  |  |  | case 40: | 
|---|
|  |  |  | count = (int)(count * 0.4); break; | 
|---|
|  |  |  | case 10: | 
|---|
|  |  |  | count = (int)(count * 0.1); break; | 
|---|
|  |  |  | default: | 
|---|
|  |  |  | return R.ok("数量"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | countLocDetl = locCheckService.getCountLocDetl(count); | 
|---|
|  |  |  | locCheckService.deleteAll(); | 
|---|
|  |  |  | for (ManLocDetl manLocDetl :countLocDetl){ | 
|---|
|  |  |  | LocCheck locCheck = new LocCheck(); | 
|---|
|  |  |  | locCheck.setLocNo(manLocDetl.getLocNo()); | 
|---|
|  |  |  | locCheck.setType(1); | 
|---|
|  |  |  | locCheck.setMatnr(manLocDetl.getMatnr()); | 
|---|
|  |  |  | locCheck.setAnfme(manLocDetl.getAnfme()); | 
|---|
|  |  |  | if (!locCheckService.insert(locCheck)){ | 
|---|
|  |  |  | return R.error("插入失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return R.ok("插入成功"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|