| | |
| | | import com.zy.asrs.entity.result.OrderDetlVo; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.common.CodeRes; |
| | | import com.zy.common.config.AdminInterceptor; |
| | | import com.zy.common.model.DetlDto; |
| | | import com.zy.common.utils.BarcodeUtils; |
| | | import com.zy.common.utils.QrCode; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.imageio.ImageIO; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.net.URLEncoder; |
| | |
| | | if (orderLog != null) { |
| | | return R.error("单据编号在历史档中已存在"); |
| | | } |
| | | OrderDetl orderDetl1 = new OrderDetl(); |
| | | for (OrderDetl orderDetl : param.getOrderDetlList()) { |
| | | if (orderDetl1.getId() == null){ |
| | | orderDetl1.sync(orderDetl); |
| | | } |
| | | if (orderDetl1.getOwner() != orderDetl.getOwner()){ |
| | | return R.error("同个单据中只能存在一个货主代码"); |
| | | } |
| | | } |
| | | Date now = new Date(); |
| | | order = new Order( |
| | | String.valueOf(snowflakeIdWorker.nextId()), // 编号[非空] |
| | |
| | | if (order == null || order.getStatus() == 0) { |
| | | return R.error("订单不存在"); |
| | | } |
| | | |
| | | OrderDetl orderDetl1 = new OrderDetl(); |
| | | for (OrderDetl orderDetl : param.getOrderDetlList()) { |
| | | if (orderDetl1.getId() == null){ |
| | | orderDetl1.sync(orderDetl); |
| | | } |
| | | if (orderDetl1.getOwner() != orderDetl.getOwner()){ |
| | | return R.error("同个单据中只能存在一个货主代码"); |
| | | } |
| | | } |
| | | |
| | | Date now = new Date(); |
| | | Long userId = getUserId(); |
| | | // 修改主档 |
| | |
| | | locCheckEntityWrapper.eq("order_no",orderNo); |
| | | List<OrderDetl> list = orderDetlService.selectList(locCheckEntityWrapper); |
| | | List<OrderDetlVo> orderDetlVos=new ArrayList<>(); |
| | | OrderDetlVo orderDetlVo=new OrderDetlVo(); |
| | | for (OrderDetl o: |
| | | list) { |
| | | for (OrderDetl o:list) { |
| | | OrderDetlVo orderDetlVo=new OrderDetlVo(); |
| | | orderDetlVo.setOrderNo(o.getOrderNo()); |
| | | orderDetlVo.setMatnr(o.getMatnr()); |
| | | orderDetlVo.setMaktx(o.getMaktx()); |
| | |
| | | return R.ok(orderDetls); |
| | | } |
| | | |
| | | @RequestMapping(value = "/order/print2/auth") |
| | | @ManagerAuth(memo = "订单编码打印") |
| | | public R manPakOutPrint(@RequestParam(value = "param[]") String[] param) { |
| | | if(Cools.isEmpty(param)) { |
| | | return R.parse(CodeRes.EMPTY); |
| | | } |
| | | List<OrderDetl> res = new ArrayList<>(); |
| | | for (String orderNo : param){ |
| | | res = orderDetlService.selectList(new EntityWrapper<OrderDetl>().eq("order_no", orderNo)); |
| | | } |
| | | return R.ok().add(res); |
| | | } |
| | | @RequestMapping(value = "/order/code/auth") |
| | | // @ManagerAuth(memo = "物料编码条形码获取(type:1(条形码);2(二维码)") |
| | | public R manPakOutCodeBarcode(@RequestParam(defaultValue = "2") Integer type |
| | | , @RequestParam String param |
| | | , HttpServletResponse response) throws Exception { |
| | | AdminInterceptor.cors(response); |
| | | if (Cools.isEmpty(param)){ |
| | | return R.parse(BaseRes.EMPTY); |
| | | } |
| | | BufferedImage img; |
| | | if (type == 1) { |
| | | img = BarcodeUtils.encode(param); |
| | | } else { |
| | | img = QrCode.createImg(param); |
| | | } |
| | | if (!ImageIO.write(img, "jpg", response.getOutputStream())) { |
| | | throw new IOException("Could not write an image of format jpg"); |
| | | } |
| | | response.getOutputStream().flush(); |
| | | response.getOutputStream().close(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | } |