| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 移动端接口控制器 |
| | |
| | | @Autowired |
| | | private WrkDetlLogService wrkDetlLogService; |
| | | |
| | | @PostMapping("/pda/OutOrder") |
| | | @ManagerAuth(memo = "获得出库单") |
| | | @Transactional |
| | | public R OutOrder(@RequestParam String orderNo) { |
| | | List<Order> orders=new ArrayList<Order>(); |
| | | List<Order> OrderList=new ArrayList<Order>(); |
| | | if(Cools.isEmpty(orderNo)){ |
| | | orders= orderService.selectList(new EntityWrapper<Order>() |
| | | .in("settle",1,2) |
| | | ); |
| | | }else{ |
| | | orders= orderService.selectList(new EntityWrapper<Order>() |
| | | .like("order_no",orderNo) |
| | | .in("settle",1,2) |
| | | ); |
| | | } |
| | | if(Cools.isEmpty(orders)){ |
| | | return R.parse("无数据"); |
| | | } |
| | | for (Order o:orders |
| | | ) { |
| | | DocType docType=docTypeService.selectOne(new EntityWrapper<DocType>() |
| | | .eq("doc_id",o.getDocType())); |
| | | if(docType.getPakout()==1){ |
| | | OrderList.add(o); |
| | | } |
| | | } |
| | | |
| | | |
| | | return R.ok(OrderList); |
| | | } |
| | | |
| | | @PostMapping("/pda/OutLocNo") |
| | | @ManagerAuth(memo = "获得平库出库的对应库位号") |
| | | @Transactional |
| | | public R OutLocNo(@RequestParam Long orderId) { |
| | | List<OrderDetl> orderDetls = orderDetlService.selectList(new EntityWrapper<OrderDetl>() |
| | | .eq("order_id", orderId) |
| | | ); |
| | | if (Cools.isEmpty(orderDetls)) { |
| | | return R.error("订单明细不存在"); |
| | | } |
| | | List<String> list = new ArrayList<>(); |
| | | for (OrderDetl o : orderDetls |
| | | ) { |
| | | if (o.getAnfme() <= o.getWorkQty()) { |
| | | continue; |
| | | } else { |
| | | //查看库位明细中有的物料 |
| | | List<ManLocDetl> locDetls = manLocDetlMapper.selectList(new EntityWrapper<ManLocDetl>() |
| | | .eq("matnr", o.getMatnr()).eq("batch",o.getBatch()) |
| | | ); |
| | | if (Cools.isEmpty(locDetls)) { |
| | | continue; |
| | | } else { |
| | | for (ManLocDetl l : locDetls |
| | | ) { |
| | | String s = l.getLocNo().substring(0, 2); |
| | | if (Integer.parseInt(s) > 8) { |
| | | list.add(l.getLocNo()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | List<String> myList = list.stream().distinct().collect(Collectors.toList()); |
| | | return R.ok(myList); |
| | | } |
| | | |
| | | @PostMapping("/pda/OrderDetlContrastLocDetl") |
| | | @ManagerAuth(memo = "获得订单明细对应的库存明细") |
| | | @Transactional |
| | | public R OrderDetlContrastLocDetl(@RequestParam Long orderId, @RequestParam String locNo) { |
| | | List<ManLocDetl> locDetlList = new ArrayList<ManLocDetl>(); |
| | | List<OrderDetl> orderDetls = orderDetlService.selectList(new EntityWrapper<OrderDetl>() |
| | | .eq("order_id", orderId) |
| | | ); |
| | | if (Cools.isEmpty(orderDetls)) { |
| | | return R.error("订单明细不存在"); |
| | | } |
| | | List<ManLocDetl> locDetls = manLocDetlMapper.selectList(new EntityWrapper<ManLocDetl>() |
| | | .eq("loc_no", locNo)); |
| | | if (Cools.isEmpty(locDetls)) { |
| | | return R.error("库位为空"); |
| | | } |
| | | for (OrderDetl o : orderDetls |
| | | ) { |
| | | if(o.getAnfme().equals(o.getQty())){ |
| | | continue; |
| | | } |
| | | for (ManLocDetl l : locDetls |
| | | ) { |
| | | if (o.getMatnr().equals(l.getMatnr()) && o.getBatch().equals(l.getBatch())) { |
| | | if (o.getAnfme() - o.getWorkQty() >= l.getAnfme()) { |
| | | |
| | | } else { |
| | | l.setAnfme(o.getAnfme() - o.getWorkQty()); |
| | | } |
| | | locDetlList.add(l); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | return R.ok(locDetlList); |
| | | } |
| | | |
| | | /** |
| | | * 平庫下架 |
| | | */ |
| | | @RequestMapping("/pda/WarehouseOut") |
| | | @ManagerAuth |
| | | public R WarehouseOut(@RequestBody CombParam combParam) { |
| | | return mobileService.WarehouseOut(combParam, getUserId()); |
| | | } |
| | | |
| | | /** |
| | | * 平庫上架 |
| | | */ |
| | | @RequestMapping("/pda/WarehouseIn") |
| | | @ManagerAuth |
| | | public R WarehouseIn(@RequestParam String locNo, @RequestParam String barcode) { |
| | | return mobileService.WarehouseIn(locNo, barcode, getUserId()); |
| | | } |
| | | |
| | | // 商品上架 |
| | | @RequestMapping("/mat/onSale/auth") |
| | |
| | | import com.zy.asrs.entity.BasDevp; |
| | | import com.zy.asrs.entity.LocDetl; |
| | | import com.zy.asrs.entity.OrderDetl; |
| | | import com.zy.asrs.mapper.LocDetlMapper; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.common.model.LocDto; |
| | | import com.zy.common.model.TaskDto; |
| | |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | private WorkService workService; |
| | | @Autowired |
| | | private BasDevpService basDevpService; |
| | | |
| | | @Resource |
| | | private LocDetlMapper locDetlMapper; |
| | | |
| | | |
| | | @PostMapping("/out/pakout/orderDetlIds/auth") |
| | |
| | | break; |
| | | } |
| | | } |
| | | List<LocDetl> locDetls2 = locDetlMapper.queryStockByManLoc(orderDetl.getMatnr(), orderDetl.getBatch(), null, exist); |
| | | for (LocDetl locDetl : locDetls2) { |
| | | if (issued > 0) { |
| | | LocDto locDto = new LocDto(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getMaktx(), locDetl.getBatch(), orderDetl.getOrderNo(), |
| | | issued >= locDetl.getAnfme() ? locDetl.getAnfme() : issued); |
| | | // List<Integer> staNos = staDescService.queryOutStaNosByLocNo(locDetl.getLocNo(), issued >= locDetl.getAnfme() ? 101 : 103); |
| | | // locDto.setStaNos(staNos); |
| | | locDto.setLocNo("平库" + locDetl.getLocNo()); |
| | | locDtos.add(locDto); |
| | | exist.add(locDetl.getLocNo()); |
| | | // 剩余待出数量递减 |
| | | issued = issued - locDetl.getAnfme(); |
| | | } else { |
| | | break; |
| | | } |
| | | } |
| | | if (issued > 0) { |
| | | LocDto locDto = new LocDto(null, orderDetl.getMatnr(), orderDetl.getMaktx(), orderDetl.getBatch(), orderDetl.getOrderNo(), issued); |
| | | locDto.setLack(Boolean.TRUE); |
| | |
| | | if (Cools.isEmpty(locDtos)) { |
| | | return R.parse(BaseRes.PARAM); |
| | | } |
| | | locDtos = locDtos.stream().filter(locDto -> locDto.getLocNo() != null && !locDto.getLocNo().startsWith("平库")).collect(Collectors.toList()); |
| | | if (Cools.isEmpty(locDtos)) { |
| | | return R.parse("平库库存/库存不足"); |
| | | } |
| | | boolean lack = true; |
| | | for (LocDto locDto : locDtos) { |
| | | if (!locDto.isLack()) { |
| | |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.WaitPakin; |
| | | import com.zy.asrs.entity.WrkDetl; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.service.OrderDetlService; |
| | | import com.zy.asrs.service.WaitPakinService; |
| | |
| | | @Autowired |
| | | private WrkMastService wrkMastService; |
| | | |
| | | @RequestMapping(value = "/waitPakin/forBarcode/auth") |
| | | @ManagerAuth |
| | | public R forBarcode(@RequestParam("barcode") String barcode) { |
| | | List<WaitPakin> list = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", barcode)); |
| | | if (Cools.isEmpty(list)){ |
| | | return R.error("未找到组托信息"); |
| | | } |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @RequestMapping(value = "/waitPakin/{id}/auth") |
| | | @ManagerAuth |
| | | public R get(@PathVariable("id") String id) { |
| | |
| | | package com.zy.asrs.entity.param; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | |
| | | // 库位编号 |
| | | private String locno; |
| | | |
| | | // 货主 |
| | | private String owner; |
| | | |
| | | //组托物料 |
| | | private List<CombMat> combMats; |
| | | |
| | | /* |
| | | 满板 |
| | | */ |
| | | private String fullPlt; |
| | | |
| | | @Data |
| | | public static class CombMat { |
| | | |
| | | private String orderNo; |
| | | |
| | | //料想码 |
| | | private String containerCode; |
| | | |
| | | //销售订单号 |
| | | private String csocode; |
| | | |
| | | //销售订单行号 |
| | | private String isoseq; |
| | | |
| | | // 物料编号 |
| | | private String matnr; |
| | |
| | | // 规格 |
| | | private String specs; |
| | | |
| | | private String zpallet; |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | List<LocDetl> queryStock(@Param("matnr")String matnr, @Param("batch")String batch, @Param("orderNo")String orderNo, @Param("locNos") Set<String> locNos); |
| | | |
| | | /** |
| | | * 在平库里面查询库存 |
| | | */ |
| | | List<LocDetl> queryStockByManLoc(@Param("matnr")String matnr, @Param("batch")String batch, @Param("orderNo")String orderNo, @Param("locNos") Set<String> locNos); |
| | | |
| | | Double queryStockAnfme(String matnr, String batch); |
| | | |
| | | List<StockVo> queryStockTotal(); |
| | |
| | | int addToLogTable(OrderDetl orderDetl); |
| | | |
| | | int increaseQtyByOrderNo(@Param("orderNo")String orderNo, @Param("matnr")String matnr, @Param("batch")String batch, @Param("qty")Double qty); |
| | | int increaseWorkQtyByOrderNo(@Param("orderNo") String orderNo, @Param("matnr") String matnr, @Param("batch") String batch, @Param("qty") Double qty); |
| | | |
| | | int increaseWorkQty(@Param("orderId")Long orderId, @Param("matnr")String matnr, @Param("batch")String batch, @Param("workQty")Double workQty); |
| | | } |
| | |
| | | package com.zy.asrs.service; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.BasDevp; |
| | | import com.zy.asrs.entity.LocDetl; |
| | | import com.zy.asrs.entity.OrderDetl; |
| | |
| | | |
| | | void stockOut(OrderDetl orderDetl, BasDevp staNo, LocDetl locDetl, |
| | | Double curOutQty, Integer ioType, Long userId, Date now); |
| | | |
| | | /** |
| | | * 平库下架 |
| | | */ |
| | | R WarehouseOut(CombParam combParam, Long userId); |
| | | |
| | | /** |
| | | * 平库上架 |
| | | */ |
| | | R WarehouseIn(String locNo, String barcode, Long userId); |
| | | } |
| | |
| | | manLocDetl.setUnit(mat.getUnit()); |
| | | manLocDetl.setBarcode(mat.getBarcode()); |
| | | manLocDetl.setPrice(mat.getPrice()); |
| | | SaasUtils.insertLog(3,manLocDetl.getLocNo(), manLocDetl.getMatnr(),manLocDetl.getAnfme(),userId); |
| | | SaasUtils.insertLog(3,manLocDetl.getLocNo(), manLocDetl.getMatnr(),manLocDetl.getAnfme(),userId,manLocDetl.getBatch()); |
| | | this.baseMapper.insert(manLocDetl); |
| | | } |
| | | } |
| | |
| | | import com.zy.asrs.entity.param.OffSaleParam; |
| | | import com.zy.asrs.entity.param.OpenOrderPakinParam; |
| | | import com.zy.asrs.mapper.ManLocDetlMapper; |
| | | import com.zy.asrs.mapper.OrderDetlMapper; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.MatUtils; |
| | | import com.zy.asrs.utils.SaasUtils; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.Iterator; |
| | |
| | | private MatService matService; |
| | | @Autowired |
| | | private WaitPakinService waitPakinService; |
| | | |
| | | @Resource |
| | | private WaitPakinLogService waitPakinLogService; |
| | | |
| | | @Autowired |
| | | private OrderService orderService; |
| | | @Autowired |
| | |
| | | @Autowired |
| | | private ManLocDetlMapper manLocDetlMapper; |
| | | |
| | | @Resource |
| | | private OrderDetlMapper orderDetlMapper; |
| | | |
| | | @Override |
| | | @Transactional |
| | | public R WarehouseOut(CombParam combParam, Long userId) { |
| | | |
| | | //查询库存数据 |
| | | for (CombParam.CombMat combMat : combParam.getCombMats()) { |
| | | ManLocDetl locDetl = manLocDetlService.selectOne(new EntityWrapper<ManLocDetl>() |
| | | .eq("loc_no", combParam.getLocno()) |
| | | .eq("zpallet", combMat.getZpallet()) |
| | | .eq("matnr", combMat.getMatnr()) |
| | | // .eq(LocDetl::getBatch, combMat.getBatch()) |
| | | ); |
| | | if (Cools.isEmpty(locDetl)) { |
| | | return R.error("未查询到库存数据"); |
| | | } |
| | | if (combMat.getAnfme() > locDetl.getAnfme()) { |
| | | return R.error("下架数量错误,超出库存数量"); |
| | | } |
| | | if (!Cools.isEmpty(combParam.getOrderNo())) { |
| | | Order order = orderService.selectByNo(combParam.getOrderNo()); |
| | | if (Cools.isEmpty(order)) { |
| | | continue; |
| | | } |
| | | if (order.getSettle() == 1) { |
| | | orderService.updateSettle(order.getId(), 2L, userId); |
| | | } |
| | | OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), combMat.getMatnr(), combMat.getBatch()); |
| | | if (Cools.isEmpty(orderDetl)) { |
| | | continue; |
| | | } |
| | | if (orderDetl.getAnfme() < orderDetl.getWorkQty() + combMat.getAnfme()) { |
| | | combMat.setAnfme(orderDetl.getAnfme() - orderDetl.getWorkQty()); |
| | | } |
| | | // 修改订单明细作业数量 |
| | | if (orderDetlMapper.increaseWorkQtyByOrderNo(combParam.getOrderNo(), combMat.getMatnr(), combMat.getBatch(), combMat.getAnfme()) <= 0) { |
| | | throw new CoolException("修改单据明细工作数量失败"); |
| | | } |
| | | // 修改订单明细完成数量 |
| | | if (!orderDetlService.increase(order.getId(), combMat.getMatnr(), combMat.getBatch(), combMat.getAnfme())) { |
| | | throw new CoolException("修改单据明细完成数量失败"); |
| | | } |
| | | // 修改订单状态 作业中 ===>> 已完成 |
| | | orderService.checkComplete(combParam.getOrderNo()); |
| | | } |
| | | try { |
| | | double i = 0.0; |
| | | double j = locDetl.getAnfme(); |
| | | //处理库存信息 |
| | | if (combMat.getAnfme().equals(locDetl.getAnfme())) { |
| | | //库存相等删除数据 |
| | | manLocDetlMapper.deleteLocNo0(combParam.getLocno(), combMat.getMatnr()); |
| | | int count = manLocDetlMapper.selectCount(new EntityWrapper<ManLocDetl>().eq("loc_no", combParam.getLocno())); |
| | | if (count == 0) { |
| | | Node node = nodeService.selectByUuid(combParam.getLocno()); |
| | | node.setUpdateTime(new Date()); |
| | | node.setUpdateBy(userId); |
| | | node.setBarcode(""); |
| | | nodeService.updateById(node); |
| | | } |
| | | } else { |
| | | BigDecimal subtract = BigDecimal.valueOf(locDetl.getAnfme()).subtract(BigDecimal.valueOf(combMat.getAnfme())); |
| | | i = subtract.byteValue(); |
| | | locDetl.setAnfme(subtract.doubleValue()); |
| | | // 更新库存 |
| | | manLocDetlMapper.updateAnfme(subtract.doubleValue(), combParam.getLocno(), combMat.getMatnr(), combMat.getBatch()); |
| | | } |
| | | // 记录日志 |
| | | SaasUtils.insertLog(1, combParam.getLocno(), combMat.getMatnr(), combMat.getAnfme(), userId,combMat.getBatch()); |
| | | } catch (Exception e) { |
| | | throw new CoolException("更新库存数据出错" + e.getMessage()); |
| | | } |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public R WarehouseIn(String locNo, String barcode, Long userId) { |
| | | |
| | | //查询组托数据 |
| | | List<WaitPakin> list = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", barcode)); |
| | | if (Cools.isEmpty(list)) { |
| | | return R.error("未找到组托信息"); |
| | | } |
| | | Date now = new Date(); |
| | | |
| | | //插入库存数据 |
| | | for (WaitPakin waitPakin : list) { |
| | | |
| | | Mat mat = matService.selectOne(new EntityWrapper<Mat>() |
| | | .eq("matnr", waitPakin.getMatnr())); |
| | | |
| | | ManLocDetl locDetl1 = manLocDetlService.selectOne(new EntityWrapper<ManLocDetl>().eq("loc_no", locNo).eq("matnr", waitPakin.getMatnr()). |
| | | eq("batch", waitPakin.getBatch())); |
| | | |
| | | Node node = nodeService.selectByUuid(locNo); |
| | | if (Cools.isEmpty(node)) { |
| | | throw new CoolException(locNo + ":库位不存在"); |
| | | } |
| | | if (!Cools.isEmpty(locDetl1)) { |
| | | locDetl1.setAnfme(waitPakin.getAnfme() + waitPakin.getAnfme()); |
| | | locDetl1.setUpdateBy(userId); |
| | | locDetl1.setModiTime(now); |
| | | manLocDetlService.update(locDetl1, new EntityWrapper<ManLocDetl>().eq("loc_no", locNo).eq("matnr", waitPakin.getMatnr()). |
| | | eq("batch", waitPakin.getBatch())); |
| | | } else { |
| | | ManLocDetl manLocDetl = new ManLocDetl(); |
| | | manLocDetl.setLocNo(locNo); |
| | | // manLocDetl.setBarcode(barcode); |
| | | manLocDetl.setZpallet(barcode); |
| | | manLocDetl.setNodeId(node.getId()); |
| | | manLocDetl.setMaktx(mat.getMaktx()); |
| | | manLocDetl.setMatnr(mat.getMatnr()); |
| | | manLocDetl.setSpecs(mat.getSpecs()); |
| | | manLocDetl.setBatch(Cools.isEmpty(waitPakin.getBatch()) ? "" : waitPakin.getBatch()); |
| | | manLocDetl.setAnfme(waitPakin.getAnfme()); |
| | | manLocDetl.setCreateBy(userId); |
| | | manLocDetl.setCreateTime(now); |
| | | manLocDetl.setUpdateBy(userId); |
| | | manLocDetl.setModiTime(now); |
| | | if (!manLocDetlService.insert(manLocDetl)) { |
| | | throw new CoolException("商品上架失败!"); |
| | | } |
| | | |
| | | // 更新库位条码 |
| | | node.setBarcode(barcode); |
| | | node.setUpdateBy(userId); |
| | | node.setUpdateTime(now); |
| | | nodeService.updateById(node); |
| | | } |
| | | |
| | | // 记录日志 |
| | | SaasUtils.insertLog(0, locNo, waitPakin.getMatnr(), waitPakin.getAnfme(), userId,waitPakin.getBatch()); |
| | | |
| | | //是否属于订单数据 |
| | | // if (!Cools.isEmpty(waitPakin.getOrderNo())){ |
| | | // Order order = orderService.selectByNo(waitPakin.getOrderNo(), hostId); |
| | | // if (Cools.isEmpty(order)){ |
| | | // continue; |
| | | // } |
| | | // OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), waitPakin.getMatnr(), waitPakin.getBatch(),hostId); |
| | | // if (Cools.isEmpty(orderDetl)){ |
| | | // continue; |
| | | // } |
| | | // // 修改订单明细完成数量 |
| | | // if (!orderDetlService.increase(order.getId(), hostId, waitPakin.getMatnr(), waitPakin.getBatch(), waitPakin.getAnfme())) { |
| | | // throw new CoolException("修改单据明细数量失败"); |
| | | // } |
| | | // // 修改订单状态 作业中 ===>> 已完成 |
| | | // orderService.checkComplete(waitPakin.getOrderNo(), hostId); |
| | | // |
| | | // } |
| | | |
| | | // 更新入库工作档 |
| | | waitPakin.setLocNo(locNo); |
| | | waitPakin.setIoStatus("Y"); |
| | | waitPakin.setModiUser(userId); |
| | | waitPakin.setModiTime(now); |
| | | waitPakinService.update(waitPakin,new EntityWrapper<WaitPakin>().eq("zpallet", barcode).eq("matnr",waitPakin.getMatnr()) |
| | | .eq("batch",waitPakin.getBatch())); |
| | | |
| | | // 保存入库通知档历史档 |
| | | if (!waitPakinLogService.save(barcode)) { |
| | | throw new CoolException("保存组托数据失败"); |
| | | } |
| | | // 删除入库通知档 |
| | | if (!waitPakinService.delete(new EntityWrapper<WaitPakin>().eq("zpallet", barcode))) { |
| | | throw new CoolException("删除组托数据失败"); |
| | | } |
| | | } |
| | | |
| | | return R.ok("上架成功"); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | |
| | | node.setUpdateBy(userId); |
| | | node.setUpdateTime(now); |
| | | nodeService.updateById(node); |
| | | SaasUtils.insertLog(0,manLocDetl.getLocNo(), manLocDetl.getMatnr(),combMat.getAnfme(),userId); |
| | | SaasUtils.insertLog(0,manLocDetl.getLocNo(), manLocDetl.getMatnr(),combMat.getAnfme(),userId,manLocDetl.getBatch()); |
| | | |
| | | } |
| | | } |
| | |
| | | if (anfme < 0) { |
| | | throw new CoolException("商品库存不足!"); |
| | | } else if (anfme == 0){ |
| | | SaasUtils.insertLog(1,manLocDetl.getLocNo(), manLocDetl.getMatnr(),offSaleParam.getAnfme(),userId); |
| | | SaasUtils.insertLog(1,manLocDetl.getLocNo(), manLocDetl.getMatnr(),offSaleParam.getAnfme(),userId,manLocDetl.getBatch()); |
| | | manLocDetlMapper.deleteLocNo0(offSaleParam.getLocNo(), offSaleParam.getMatnr()); |
| | | // 清空库位条码 |
| | | Node node = nodeService.selectByUuid(offSaleParam.getLocNo()); |
| | |
| | | manLocDetl.setCreateTime(now); |
| | | manLocDetl.setModiTime(now); |
| | | manLocDetl.setCreateBy(userId); |
| | | SaasUtils.insertLog(0,manLocDetl.getLocNo(),manLocDetl.getMatnr(), manLocDetl.getAnfme(),userId); |
| | | SaasUtils.insertLog(0,manLocDetl.getLocNo(),manLocDetl.getMatnr(), manLocDetl.getAnfme(),userId, manLocDetl.getBatch()); |
| | | manLocDetlService.insert(manLocDetl); |
| | | }else { |
| | | check.setAnfme(dto.getCount() + check.getAnfme()); |
| | |
| | | if (manLocDetl.getAnfme() - param.getCount() < 0) { |
| | | return R.error("物料:"+ param.getMatnr() + " 在库位中数量不足"); |
| | | } else if (manLocDetl.getAnfme() - param.getCount() == 0) { |
| | | SaasUtils.insertLog(1,manLocDetl.getLocNo(), manLocDetl.getMatnr(),param.getCount(),userId); |
| | | SaasUtils.insertLog(1,manLocDetl.getLocNo(), manLocDetl.getMatnr(),param.getCount(),userId,manLocDetl.getBatch()); |
| | | manLocDetlService.delete(new EntityWrapper<ManLocDetl>() |
| | | .eq("loc_no",node.getUuid()) |
| | | .eq("matnr",param.getMatnr())); |
| | |
| | | manLocDetlService.update(manLocDetl,new EntityWrapper<ManLocDetl>() |
| | | .eq("loc_no",node.getUuid()) |
| | | .eq("matnr",param.getMatnr())); |
| | | SaasUtils.insertLog(1,manLocDetl.getLocNo(), manLocDetl.getMatnr(),param.getCount(),userId); |
| | | SaasUtils.insertLog(1,manLocDetl.getLocNo(), manLocDetl.getMatnr(),param.getCount(),userId,manLocDetl.getBatch()); |
| | | } |
| | | } |
| | | } |
| | |
| | | source.setLocNo(targetNode.getUuid()); |
| | | source.setNodeId(targetNode.getId()); |
| | | |
| | | SaasUtils.insertLog(2,source.getLocNo(), source.getMatnr(), source.getAnfme(),userId); |
| | | SaasUtils.insertLog(2,source.getLocNo(), source.getMatnr(), source.getAnfme(),userId,source.getBatch()); |
| | | manLocDetlService.insert(source); |
| | | }else { |
| | | check.setAnfme(check.getAnfme() + source.getAnfme()); |
| | |
| | | } |
| | | } |
| | | if (complete) { |
| | | // 出库订单重新整理明细 |
| | | DocType docType = docTypeService.selectById(order.getDocType()); |
| | | if (null != docType && docType.getPakout() == 1) { |
| | | if (!orderDetlService.delete(new EntityWrapper<OrderDetl>().eq("order_id", order.getId()))) { |
| | | throw new CoolException("重整出库订单【orderNo = " + order.getOrderNo() + "】明细失败"); |
| | | } |
| | | List<WrkDetl> wrkDetls = wrkDetlService.selectAndLogByOrderNo(orderNo); |
| | | for (WrkDetl wrkDetl : wrkDetls) { |
| | | OrderDetl orderDetl = new OrderDetl(); |
| | | orderDetl.sync(wrkDetl); |
| | | orderDetl.setQty(orderDetl.getAnfme()); |
| | | orderDetl.setOrderId(order.getId()); |
| | | orderDetl.setOrderNo(orderNo); |
| | | orderDetl.setStatus(1); |
| | | orderDetl.setCreateTime(order.getCreateTime()); |
| | | orderDetl.setCreateBy(order.getCreateBy()); |
| | | orderDetl.setUpdateTime(order.getUpdateTime()); |
| | | orderDetl.setUpdateBy(order.getUpdateBy()); |
| | | if (!orderDetlService.insert(orderDetl)) { |
| | | throw new CoolException("重整出库订单【orderNo = " + order.getOrderNo() + "】明细失败"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (!this.updateSettle(order.getId(), 4L, null)) { |
| | | throw new CoolException("修改订单【orderNo = " + order.getOrderNo() + "】状态为已完成失败"); |
| | | } |
| | |
| | | import java.util.Date; |
| | | |
| | | public class SaasUtils { |
| | | public static void insertLog(Integer type, String locNo, String matnr,Double anfme, Long userId){ |
| | | public static void insertLog(Integer type, String locNo, String matnr,Double anfme, Long userId,String batch){ |
| | | SaasLogService bean = SpringUtils.getBean(SaasLogService.class); |
| | | SaasLog saasLog = new SaasLog(); |
| | | saasLog.setType(type); |
| | |
| | | saasLog.setIoTime(new Date()); |
| | | saasLog.setAnfme(anfme); |
| | | saasLog.setCreateBy(userId); |
| | | saasLog.setBatch(batch); |
| | | bean.insert(saasLog); |
| | | } |
| | | } |
| | |
| | | package com.zy.system.entity; |
| | | |
| | | import com.core.common.Cools;import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import com.core.common.Cools; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @TableName("sys_saas_log") |
| | |
| | | @ApiModelProperty(value= "") |
| | | private String matnr; |
| | | |
| | | @ApiModelProperty(value= "批次") |
| | | private String batch; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | @TableField("io_time") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | |
| | | and lm.row1 in (31,32) |
| | | order by row1 |
| | | </select> |
| | | <select id="queryStockByManLoc" resultMap="BaseResultMap"> |
| | | select a.* |
| | | from man_loc_detl a |
| | | where 1=1 |
| | | and a.matnr = #{matnr} |
| | | <if test="batch != null and batch != ''"> |
| | | and a.batch = #{batch} |
| | | </if> |
| | | <if test="orderNo != null and orderNo != ''"> |
| | | and a.doc_num = #{orderNo} |
| | | </if> |
| | | <if test="locNos != null and locNos.size > 0"> |
| | | and a.loc_no not in |
| | | <foreach item="item" collection="locNos" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | order by |
| | | DATEPART(yyyy,a.modi_time),DATEPART(mm,a.modi_time),DATEPART(dd,a.modi_time), a.anfme |
| | | desc, |
| | | NEWID(), |
| | | case |
| | | when (left(a.loc_no, 2) = '01') then 0 |
| | | when (left(a.loc_no, 2) = '02') then 1 |
| | | when (left(a.loc_no, 2) = '03') then 1 |
| | | when (left(a.loc_no, 2) = '04') then 0 |
| | | when (left(a.loc_no, 2) = '05') then 0 |
| | | when (left(a.loc_no, 2) = '06') then 1 |
| | | when (left(a.loc_no, 2) = '07') then 1 |
| | | when (left(a.loc_no, 2) = '08') then 0 |
| | | when (left(a.loc_no, 2) = '09') then 0 |
| | | when (left(a.loc_no, 2) = '10') then 1 |
| | | when (left(a.loc_no, 2) = '11') then 1 |
| | | when (left(a.loc_no, 2) = '12') then 0 |
| | | when (left(a.loc_no, 2) = '13') then 0 |
| | | when (left(a.loc_no, 2) = '14') then 1 |
| | | when (left(a.loc_no, 2) = '15') then 1 |
| | | when (left(a.loc_no, 2) = '16') then 0 |
| | | when (left(a.loc_no, 2) = '17') then 0 |
| | | when (left(a.loc_no, 2) = '18') then 1 |
| | | when (left(a.loc_no, 2) = '19') then 1 |
| | | when (left(a.loc_no, 2) = '20') then 0 |
| | | when (left(a.loc_no, 2) = '21') then 0 |
| | | when (left(a.loc_no, 2) = '22') then 1 |
| | | when (left(a.loc_no, 2) = '23') then 1 |
| | | when (left(a.loc_no, 2) = '24') then 0 |
| | | when (left(a.loc_no, 2) = '25') then 0 |
| | | when (left(a.loc_no, 2) = '26') then 1 |
| | | when (left(a.loc_no, 2) = '27') then 1 |
| | | when (left(a.loc_no, 2) = '28') then 0 |
| | | when (left(a.loc_no, 2) = '29') then 0 |
| | | when (left(a.loc_no, 2) = '30') then 1 |
| | | when (left(a.loc_no, 2) = '31') then 1 |
| | | when (left(a.loc_no, 2) = '32') then 0 |
| | | when (left(a.loc_no, 2) = '33') then 0 |
| | | when (left(a.loc_no, 2) = '34') then 1 |
| | | when (left(a.loc_no, 2) = '35') then 1 |
| | | when (left(a.loc_no, 2) = '36') then 0 |
| | | when (left(a.loc_no, 2) = '37') then 0 |
| | | when (left(a.loc_no, 2) = '38') then 1 |
| | | when (left(a.loc_no, 2) = '39') then 1 |
| | | when (left(a.loc_no, 2) = '40') then 0 |
| | | when (left(a.loc_no, 2) = '41') then 0 |
| | | when (left(a.loc_no, 2) = '42') then 1 |
| | | when (left(a.loc_no, 2) = '43') then 1 |
| | | when (left(a.loc_no, 2) = '44') then 0 |
| | | when (left(a.loc_no, 2) = '45') then 0 |
| | | when (left(a.loc_no, 2) = '46') then 1 |
| | | when (left(a.loc_no, 2) = '47') then 1 |
| | | when (left(a.loc_no, 2) = '48') then 0 |
| | | else 0 |
| | | end |
| | | desc |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | update man_loc_detl set anfme = #{anfme} |
| | | where node_id = #{nodeId} ; |
| | | </update> |
| | | <update id="updateAnfme"> |
| | | update man_loc_detl set anfme = #{anfme} |
| | | where loc_no = #{locNo} and matnr = #{matnr} |
| | | <choose> |
| | | <when test="batch != null and batch != ''"> |
| | | and batch = #{batch} |
| | | </when> |
| | | <otherwise> |
| | | and (batch IS NULL OR batch = '') |
| | | </otherwise> |
| | | </choose> |
| | | </update> |
| | | |
| | | </mapper> |
| | |
| | | </otherwise> |
| | | </choose> |
| | | </update> |
| | | <update id="increaseWorkQtyByOrderNo"> |
| | | update man_order_detl |
| | | set work_qty = work_qty + #{qty} |
| | | where 1=1 |
| | | and order_no = #{orderNo} |
| | | and matnr = #{matnr} |
| | | <choose> |
| | | <when test="batch != null and batch != ''"> |
| | | and batch = #{batch} |
| | | </when> |
| | | <otherwise> |
| | | and (batch IS NULL OR batch = '') |
| | | </otherwise> |
| | | </choose> |
| | | </update> |
| | | |
| | | </mapper> |
| | |
| | | ] |
| | | |
| | | var detlCols = [ |
| | | {field: 'matnr', align: 'center',title: '商品编号(品号)', sort:true} |
| | | ,{field: 'maktx', align: 'center',title: '商品名称(品名)', sort:true} |
| | | {field: 'zpallet', align: 'center',title: '托盘条码', hide: false} |
| | | ,{field: 'orderNo', align: 'center',title: '单据编号', hide: false} |
| | | ,{field: 'batch', align: 'center',title: '货品特征', sort:true} |
| | | ,{field: 'matnr', align: 'center',title: '商品编号(品号)', sort:true} |
| | | ,{field: 'maktx', align: 'center',title: '商品名称(品名)', sort:true} |
| | | ,{field: 'batch', align: 'center',title: '批次', sort:true} |
| | | ,{field: 'anfme', align: 'center',title: '数量', hide: false} |
| | | ,{field: 'zpallet', align: 'center',title: '托盘条码', hide: false} |
| | | |
| | | ,{field: 'specs', align: 'center',title: '规格', hide: false} |
| | | ,{field: 'model', align: 'center',title: '代码', hide: true} |
| | | ,{field: 'color', align: 'center',title: '颜色', hide: true} |
| | | ,{field: 'brand', align: 'center',title: '品牌', hide: true} |
| | | ,{field: 'unit', align: 'center',title: '单位', hide: false} |
| | | ,{field: 'locNo', align: 'center',title: '库位', hide: false} |
| | | ,{field: 'price', align: 'center',title: '单价', hide: true} |
| | | ,{field: 'sku', align: 'center',title: 'sku', hide: true} |
| | | ,{field: 'units', align: 'center',title: '单位量', hide: true} |
| | |
| | | function getCol() { |
| | | var cols = [ |
| | | {field: 'locNo', align: 'center',title: '库位号'}, |
| | | {field: 'zpallet', align: 'center',title: '托盘条码'}, |
| | | {field: 'matnr', align: 'center',title: '商品编号', sort:true} |
| | | ,{field: 'maktx', align: 'center',title: '商品名称', sort:true} |
| | | ,{field: 'anfme', align: 'center',title: '数量'} |
| | | ,{field: 'orderNo', align: 'center',title: '单据编号', hide: false} |
| | | ,{field: 'batch', align: 'center',title: '批号', width: 300, sort:true} |
| | | //,{field: 'zpallet', align: 'center',title: '托盘条码'} |
| | | ,{field: 'orderNo', align: 'center',title: '单据编号', hide: true} |
| | | ,{field: 'batch', align: 'center',title: '批号', sort:true} |
| | | ,{field: 'specs', align: 'center',title: '规格'} |
| | | ,{field: 'model', align: 'center',title: '代码', hide: true} |
| | | ,{field: 'color', align: 'center',title: '颜色', hide: true} |
| | |
| | | cols: [[ |
| | | {type: 'checkbox'} |
| | | ,{field: 'id', align: 'center',title: 'id', hide:true} |
| | | ,{field: 'locNo', align: 'center',title: '库位'} |
| | | ,{field: 'type$', align: 'center',title: '操作类型'} |
| | | ,{field: 'matnr', align: 'center',title: '物料号'} |
| | | ,{field: 'locNo', align: 'center',title: '库位'} |
| | | ,{field: 'matnr', align: 'center',title: '物料'} |
| | | ,{field: 'batch', align: 'center',title: '批次'} |
| | | ,{field: 'anfme', align: 'center',title: '数量'} |
| | | ,{field: 'createBy', align: 'center',title: '操作账号'} |
| | | ,{field: 'ioTime$', align: 'center',title: '操作时间'} |
| | | ,{field: 'createBy', align: 'center',title: '', hide:true} |
| | | |
| | | ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:120} |
| | | // ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:120} |
| | | ]], |
| | | request: { |
| | | pageName: 'curr', |