| | |
| | | import com.zy.asrs.mapper.ManLocDetlMapper; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.MatUtils; |
| | | import com.zy.common.CodeRes; |
| | | import com.zy.asrs.utils.SaasUtils; |
| | | import com.zy.common.constant.MesConstant; |
| | | import com.zy.common.entity.Parameter; |
| | | import com.zy.common.model.DetlDto; |
| | |
| | | if (Cools.isEmpty(param.getBarcode(), param.getCombMats())) { |
| | | throw new CoolException(BaseRes.PARAM); |
| | | } |
| | | if(param.getCombMats().size()>1){ |
| | | throw new CoolException("请提取一个商品,或者刷新重新组托!"); |
| | | } |
| | | // 判断是否有相同条码的数据 |
| | | if (waitPakinService.selectCount(new EntityWrapper<WaitPakin>(). |
| | | eq("zpallet", param.getBarcode()).eq("io_status", "N")) > 0) { |
| | |
| | | // 关联组托 |
| | | } else { |
| | | Order order = orderService.selectByNo(param.getOrderNo()); |
| | | if (order.getSettle() > 2) { |
| | | if (Cools.isEmpty(order) || order.getSettle() > 2) { |
| | | throw new CoolException("单据编号已过期"); |
| | | } |
| | | // 生成入库通知档 |
| | |
| | | |
| | | // 商品上架 |
| | | @Override |
| | | public void onSale(CombParam param) { |
| | | public void onSale(CombParam param, Long userId) { |
| | | |
| | | Date now = new Date(); |
| | | // 获取库位号 |
| | | String locno = param.getLocno(); |
| | | Node node = nodeService.selectByUuid(locno); |
| | | if (Cools.isEmpty(node)) { |
| | | throw new CoolException(param.getLocno() + ":库位不存在"); |
| | | } |
| | | |
| | | String barcode = param.getBarcode(); |
| | | if (Cools.isEmpty(barcode)) { |
| | | throw new CoolException("条码不能为空!"); |
| | | } |
| | | |
| | | // 获取商品列表 |
| | |
| | | if (Cools.isEmpty(combMat.getAnfme()) || combMat.getAnfme()==0){ |
| | | throw new CoolException(combMat.getMatnr() + ":商品数量有误!"); |
| | | } |
| | | if (Cools.isEmpty(combMat.getBatch())){ |
| | | // throw new CoolException(combMat.getMatnr() + ":商品批号有误!"); |
| | | } |
| | | |
| | | 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(combMat.getBatch()) ? "" : combMat.getBatch()); |
| | | manLocDetl.setAnfme(combMat.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,manLocDetl.getLocNo(), manLocDetl.getMatnr(),combMat.getAnfme(),userId); |
| | | |
| | | } |
| | | } |
| | | |
| | | // 商品下架 |
| | | @Override |
| | | public void offSale(OffSaleParam offSaleParam) { |
| | | public void offSale(OffSaleParam offSaleParam, Long userId) { |
| | | ManLocDetl manLocDetl = manLocDetlMapper.selectLocNo0(offSaleParam.getLocNo(), offSaleParam.getMatnr()); |
| | | if (Cools.isEmpty(manLocDetl)){ |
| | | throw new CoolException("无此商品!"); |
| | |
| | | if (anfme < 0) { |
| | | throw new CoolException("商品库存不足!"); |
| | | } else if (anfme == 0){ |
| | | SaasUtils.insertLog(1,manLocDetl.getLocNo(), manLocDetl.getMatnr(),offSaleParam.getAnfme(),userId); |
| | | manLocDetlMapper.deleteLocNo0(offSaleParam.getLocNo(), offSaleParam.getMatnr()); |
| | | // 清空库位条码 |
| | | Node node = nodeService.selectByUuid(offSaleParam.getLocNo()); |
| | | node.setUpdateTime(new Date()); |
| | | node.setUpdateBy(userId); |
| | | node.setBarcode(""); |
| | | } |
| | | manLocDetlMapper.updateAnfme0(anfme,manLocDetl.getNodeId()); |
| | | } |