|  |  |  | 
|---|
|  |  |  | import com.zy.asrs.entity.*; | 
|---|
|  |  |  | import com.zy.asrs.entity.param.EmptyPlateOutParam; | 
|---|
|  |  |  | import com.zy.asrs.entity.result.FindLocNoAttributeVo; | 
|---|
|  |  |  | import com.zy.asrs.mapper.LocMastMapper; | 
|---|
|  |  |  | import com.zy.asrs.service.*; | 
|---|
|  |  |  | import com.zy.common.CodeRes; | 
|---|
|  |  |  | import com.zy.common.model.LocTypeDto; | 
|---|
|  |  |  | 
|---|
|  |  |  | import org.springframework.transaction.annotation.Transactional; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import javax.annotation.Resource; | 
|---|
|  |  |  | import java.util.*; | 
|---|
|  |  |  | import java.util.stream.Collectors; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | 
|---|
|  |  |  | private RowLastnoService rowLastnoService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private WorkService workService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Resource | 
|---|
|  |  |  | private LocMastMapper locMastMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PostMapping("/pakin/loc/v1") | 
|---|
|  |  |  | @ResponseBody | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PostMapping("auto/emptyOut/v1") | 
|---|
|  |  |  | @ResponseBody | 
|---|
|  |  |  | public R autoEmptyOut(){ | 
|---|
|  |  |  | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>() | 
|---|
|  |  |  | .eq("loc_sts", "D")); | 
|---|
|  |  |  | if (Cools.isEmpty(locMast)) { | 
|---|
|  |  |  | return R.error("库存没有空板"); | 
|---|
|  |  |  | public R autoEmptyOut(@RequestBody Map<String,String> emptyPalletSite){ | 
|---|
|  |  |  | // 空托盘类型 | 
|---|
|  |  |  | String type = emptyPalletSite.get("flag"); | 
|---|
|  |  |  | // 出库站点 | 
|---|
|  |  |  | Integer site = Integer.valueOf(emptyPalletSite.get("site")); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | LocMast locMast; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 先找浅库位 | 
|---|
|  |  |  | locMast = locMastMapper.queryLocMasterByLocStsAndRow(Arrays.asList(2, 3), type); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 浅库位没有则查询所有 | 
|---|
|  |  |  | if (locMast == null) { | 
|---|
|  |  |  | locMast = locMastMapper.queryLocMasterByLocStsAndRow(null, type); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (locMast == null) { | 
|---|
|  |  |  | return R.error("库存没有"+type+"类型空托盘"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | String locNo = locMast.getLocNo(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | EmptyPlateOutParam emptyPlateOutParam = new EmptyPlateOutParam(); | 
|---|
|  |  |  | emptyPlateOutParam.setOutSite(12); | 
|---|
|  |  |  | emptyPlateOutParam.setLocNos(new ArrayList<String>(){{add(locMast.getLocNo()+"");}}); | 
|---|
|  |  |  | emptyPlateOutParam.setOutSite(site); | 
|---|
|  |  |  | emptyPlateOutParam.setLocNos(new ArrayList<String>(){{add(locNo);}}); | 
|---|
|  |  |  | WrkMast wrkMast = workService.emptyPlateOut(emptyPlateOutParam); | 
|---|
|  |  |  | return R.ok(!Cools.isEmpty(wrkMast)? R.ok("自动空托出库成功,工作号:" + wrkMast.getWrkNo()) : R.error("生成自动空托出库失败")); | 
|---|
|  |  |  | } | 
|---|