| | |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.AgvLocDetl; |
| | | import com.zy.asrs.entity.DocType; |
| | | import com.zy.asrs.entity.Mat; |
| | | import com.zy.asrs.entity.OrderDetl; |
| | | import com.zy.asrs.service.AgvLocDetlService; |
| | | import com.zy.asrs.service.DocTypeService; |
| | | import com.zy.asrs.service.MatService; |
| | | import com.zy.asrs.service.OrderDetlService; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | private AgvLocDetlService agvLocDetlService; |
| | | @Autowired |
| | | private MatService matService; |
| | | @Autowired |
| | | private OrderDetlService orderDetlService; |
| | | @Autowired |
| | | private DocTypeService docTypeService; |
| | | |
| | | @RequestMapping(value = "/locDetl/list/auth") |
| | | @ManagerAuth |
| | |
| | | return R.ok(agvLocDetlService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/locDetl/list/auth/v2") |
| | | @ManagerAuth |
| | | public R listV2(@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 Map<String, Object> param, |
| | | @RequestParam(required = false)Boolean unreason){ |
| | | if (!Cools.isEmpty(unreason) && unreason) { |
| | | |
| | | return R.ok(agvLocDetlService.selectPage(new Page<>(curr, limit), new EntityWrapper<AgvLocDetl>() |
| | | .where(" DATALENGTH( batch ) != 11 or\n" + |
| | | " batch LIKE '%[a-z]%'"))); |
| | | } |
| | | param.remove("unreason"); |
| | | String row = ""; |
| | | EntityWrapper<AgvLocDetl> wrapper = new EntityWrapper<>(); |
| | | if (param.get("row") != null) { |
| | | String chooseRow = (String) param.get("row"); |
| | | if (chooseRow.length() == 1) { |
| | | row = "0" + chooseRow; |
| | | param.remove("row"); |
| | | }else { |
| | | row = chooseRow; |
| | | param.remove("row"); |
| | | } |
| | | } |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | allLike(AgvLocDetl.class, param.keySet(), wrapper, condition); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | if (!row.equals("")){ |
| | | wrapper.and() |
| | | .where("loc_no like '" +row +"%'"); |
| | | } |
| | | Page<AgvLocDetl> agvLocDetlPage = agvLocDetlService.selectPage(new Page<>(curr, limit), wrapper); |
| | | List<DocType> pakins = docTypeService.selectList(new EntityWrapper<DocType>().eq("pakout", 1)); |
| | | List<Long> docIds = new ArrayList<>(); |
| | | for (DocType pakin : pakins) { |
| | | if (pakin.getDocId() != 33 && pakin.getDocId() != 35) { |
| | | docIds.add(pakin.getDocId()); |
| | | } |
| | | } |
| | | for (AgvLocDetl record : agvLocDetlPage.getRecords()) { |
| | | OrderDetl orderDetl = orderDetlService.selectOne(new EntityWrapper<OrderDetl>() |
| | | .eq("three_code", record.getThreeCode()) |
| | | .eq("matnr", record.getMatnr()) |
| | | .in("source",docIds)); |
| | | // if (orderDetl.getAnfme() - orderDetl.getQty() > 0) { |
| | | // record.setStock(orderDetl.getAnfme() - orderDetl.getQty()); |
| | | // } else { |
| | | // record.setStock(-1D); |
| | | // } |
| | | if (Cools.isEmpty(orderDetl)) { |
| | | record.setStock(0D); |
| | | } else { |
| | | record.setStock(orderDetl.getAnfme() - orderDetl.getQty()); |
| | | record.setOrderNo(orderDetl.getOrderNo()); |
| | | } |
| | | |
| | | } |
| | | return R.ok(agvLocDetlPage); |
| | | } |
| | | |
| | | @RequestMapping(value = "/locDetl/statis/auth") |
| | | @ManagerAuth(memo = "AGV库存明细统计") |
| | | public R statis(@RequestParam(defaultValue = "1")Integer curr, |