| | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.jilongda.common.Ticket.TAddOptometryVO; |
| | | import com.jilongda.common.Ticket.TOptometryDetailVO; |
| | | import com.jilongda.common.Ticket.TOrderGoodsPrintVO; |
| | | import com.jilongda.common.Ticket.TicketUtil; |
| | | import com.jilongda.common.basic.ApiResult; |
| | |
| | | } |
| | | @Autowired |
| | | private TTicketService tTicketService; |
| | | @Autowired |
| | | private TStoreService storeService; |
| | | @ApiOperation(value = "添加订单") |
| | | @PostMapping(value = "/addOrder") |
| | | public ApiResult addOrder(@RequestBody TOrderDTO dto) { |
| | |
| | | // 减少对应库存 |
| | | one.setTotal(one.getTotal()-1); |
| | | tLensGoods.add(one); |
| | | // // 生成销售订单主表 |
| | | // |
| | | // TWarehousing tWarehousing = new TWarehousing(); |
| | | // tWarehousing.setStatus(5); |
| | | // tWarehousing.setType(2); |
| | | // tWarehousing.setStoreId(dto.getStoreId()); |
| | | // tWarehousing.setRemark("销售订单-镜片"); |
| | | // tWarehousing.setOrderNum(dto.getId()+""); |
| | | // warehousingService.save(tWarehousing); |
| | | // // 生成明细记录 |
| | | // TLensWarehousingDetail tLensWarehousingDetail = new TLensWarehousingDetail(); |
| | | // tLensWarehousingDetail.setBrand(orderGood.getBrandName()); |
| | | // TSupplier supplier = supplierService.getById(lensSeries.getSupplierId()); |
| | | // if (supplier!=null){ |
| | | // tLensWarehousingDetail.setSupplier(supplier.getName()); |
| | | // } |
| | | // tLensWarehousingDetail.setSeries(lensSeries.getName()); |
| | | // tLensWarehousingDetail.setRefractiveIndex(orderGood.getRefractiveIndex()); |
| | | // if (StringUtils.hasLength(orderGood.getLLens())){ |
| | | // tLensWarehousingDetail.setBallMirror(orderGood.getLLens().split(",")[0]); |
| | | // tLensWarehousingDetail.setColumnMirror(orderGood.getLLens().split(",")[0]); |
| | | // } |
| | | // if (StringUtils.hasLength(orderGood.getRLens())){ |
| | | // tLensWarehousingDetail.setBallMirror(orderGood.getRLens().split(",")[0]); |
| | | // tLensWarehousingDetail.setColumnMirror(orderGood.getRLens().split(",")[0]); |
| | | // } |
| | | // tLensWarehousingDetail.setType(orderGood.getType()); |
| | | // tLensWarehousingDetail.setTotal(1); |
| | | // tLensWarehousingDetail.setSeriesId(lensSeries.getId()); |
| | | // tLensWarehousingDetail.setWarehousingId(tWarehousing.getId()); |
| | | // tLensWarehousingDetail.setOrderId(dto.getId()); |
| | | // lensWarehousingDetailService.save(tLensWarehousingDetail); |
| | | // 生成销售订单主表 |
| | | |
| | | TWarehousing tWarehousing = new TWarehousing(); |
| | | tWarehousing.setStatus(5); |
| | | tWarehousing.setType(2); |
| | | tWarehousing.setStoreId(dto.getStoreId()); |
| | | tWarehousing.setRemark("销售订单-镜片"); |
| | | tWarehousing.setOrderNum(dto.getId()+""); |
| | | warehousingService.save(tWarehousing); |
| | | // 生成明细记录 |
| | | TLensWarehousingDetail tLensWarehousingDetail = new TLensWarehousingDetail(); |
| | | tLensWarehousingDetail.setBrand(orderGood.getBrandName()); |
| | | TSupplier supplier = supplierService.getById(lensSeries.getSupplierId()); |
| | | if (supplier!=null){ |
| | | tLensWarehousingDetail.setSupplier(supplier.getName()); |
| | | } |
| | | tLensWarehousingDetail.setSeries(lensSeries.getName()); |
| | | tLensWarehousingDetail.setRefractiveIndex(orderGood.getRefractiveIndex()); |
| | | if (StringUtils.hasLength(orderGood.getLLens())){ |
| | | tLensWarehousingDetail.setBallMirror(orderGood.getLLens().split(",")[0]); |
| | | tLensWarehousingDetail.setColumnMirror(orderGood.getLLens().split(",")[0]); |
| | | } |
| | | if (StringUtils.hasLength(orderGood.getRLens())){ |
| | | tLensWarehousingDetail.setBallMirror(orderGood.getRLens().split(",")[0]); |
| | | tLensWarehousingDetail.setColumnMirror(orderGood.getRLens().split(",")[0]); |
| | | } |
| | | tLensWarehousingDetail.setType(orderGood.getType()); |
| | | tLensWarehousingDetail.setTotal(1); |
| | | tLensWarehousingDetail.setSeriesId(lensSeries.getId()); |
| | | tLensWarehousingDetail.setWarehousingId(tWarehousing.getId()); |
| | | tLensWarehousingDetail.setOrderId(dto.getId()); |
| | | lensWarehousingDetailService.save(tLensWarehousingDetail); |
| | | |
| | | }else { |
| | | return ApiResult.failed("商品库存不足"); |
| | |
| | | String format = simpleDateFormat.format(new Date()); |
| | | tAddOptometryVO.setTime(format); |
| | | tAddOptometryVO.setMachiningCode(dto.getMachiningCode()); |
| | | List<TOptometryDetailVO> tOptometryDetailVOS = new ArrayList<>(); |
| | | for (TOptometryDetail optometryDetail : dto.getOptometryDetails()) { |
| | | TOptometryDetailVO tOptometryDetailVO = new TOptometryDetailVO(); |
| | | BeanUtils.copyProperties(optometryDetail,tOptometryDetailVO); |
| | | tOptometryDetailVOS.add(tOptometryDetailVO); |
| | | } |
| | | tAddOptometryVO.setOptometryDetailVOS(tOptometryDetailVOS); |
| | | tAddOptometryVO.setShopName(storeService.getById(dto.getStoreId()).getName()); |
| | | System.err.println("加工单数据"); |
| | | System.err.println(tAddOptometryVO); |
| | | if (dto.getIsMachining()==1){ |
| | | // 打印加工单 |
| | | TicketUtil.printMatch(tAddOptometryVO); |