From 42314319782a84d844fea853d04812fbae343b5e Mon Sep 17 00:00:00 2001 From: zjj <3272660260@qq.com> Date: 星期三, 20 九月 2023 08:06:11 +0800 Subject: [PATCH] #组托显示操作人 --- src/main/java/com/zy/asrs/controller/OrderController.java | 118 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 114 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/zy/asrs/controller/OrderController.java b/src/main/java/com/zy/asrs/controller/OrderController.java index 518712b..650e9bf 100644 --- a/src/main/java/com/zy/asrs/controller/OrderController.java +++ b/src/main/java/com/zy/asrs/controller/OrderController.java @@ -9,18 +9,26 @@ import com.core.annotations.ManagerAuth; import com.core.common.*; import com.core.exception.CoolException; +import com.sun.org.apache.xpath.internal.operations.Or; import com.zy.asrs.entity.*; import com.zy.asrs.entity.param.OrderDomainParam; +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; import java.util.*; @@ -92,7 +100,16 @@ @RequestMapping(value = "/order/detl/all/auth") @ManagerAuth public R head(@RequestParam Long orderId){ - return R.ok().add(orderDetlService.selectList(new EntityWrapper<OrderDetl>().eq("order_id", orderId))); + List<OrderDetl> orderDetls = orderDetlService.selectList(new EntityWrapper<OrderDetl>().eq("order_id", orderId)); + List<OrderDetl> orderDetls1 = new ArrayList<>(); + for (OrderDetl orderDetl : orderDetls){ + double v = orderDetl.getAnfme() - orderDetl.getWorkQty(); + double v1 = new BigDecimal(v).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + if (v1!=0.0){ + orderDetls1.add(orderDetl); + } + } + return R.ok().add(orderDetls1); } @RequestMapping(value = "/order/form/add/auth") @@ -114,6 +131,15 @@ } 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( @@ -205,6 +231,17 @@ 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(); // 淇敼涓绘。 @@ -388,7 +425,22 @@ EntityWrapper<OrderDetl> locCheckEntityWrapper = new EntityWrapper<>(); locCheckEntityWrapper.eq("order_no",orderNo); List<OrderDetl> list = orderDetlService.selectList(locCheckEntityWrapper); - + List<OrderDetlVo> orderDetlVos=new ArrayList<>(); + OrderDetlVo orderDetlVo=new OrderDetlVo(); + for (OrderDetl o: + list) { + orderDetlVo.setOrderNo(o.getOrderNo()); + orderDetlVo.setMatnr(o.getMatnr()); + orderDetlVo.setMaktx(o.getMaktx()); + orderDetlVo.setSpecs(o.getSpecs()); + orderDetlVo.setOwner(o.getOwner$()); + orderDetlVo.setPayment(o.getPayment$()); + orderDetlVo.setAnfme(o.getAnfme()); + orderDetlVo.setQty(o.getQty()); + orderDetlVo.setWorkQty(o.getWorkQty()); + orderDetlVo.setWeight(o.getWeight()); + orderDetlVos.add(orderDetlVo); + } response.setContentType("application/vnd.ms-excel"); response.setCharacterEncoding("utf-8"); String fileName = URLEncoder.encode("鍗曟嵁", "UTF-8"); @@ -404,11 +456,69 @@ includeColumnFiledNames.add("qty"); includeColumnFiledNames.add("workQty"); includeColumnFiledNames.add("weight"); - EasyExcel.write(response.getOutputStream(), OrderDetl.class) + EasyExcel.write(response.getOutputStream(), OrderDetlVo.class) .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) .includeColumnFiledNames(includeColumnFiledNames) .sheet("琛�1") - .doWrite(list); + .doWrite(orderDetlVos); } + @RequestMapping(value = "/order/list/all") + public R orderList() { + + return R.ok(orderService.selectAllorderNo()); + } + + //璁㈠崟缁勬墭2 + @RequestMapping(value = "/order/list/orderNo") + public R orderListorderNo(@RequestParam String orderNo) { + //鏁伴噺淇敼鎴愪负瀹屾垚鏁伴噺 + List<OrderDetl> orderDetl1=orderDetlService.selectList(new EntityWrapper<OrderDetl>().eq("order_no",orderNo)); + List<OrderDetl> orderDetls= new ArrayList<OrderDetl>(); + for (OrderDetl o: orderDetl1) { + o.setAnfme(o.getAnfme()-o.getWorkQty()); + BigDecimal c1 = new BigDecimal(o.getAnfme()).setScale(2,BigDecimal.ROUND_HALF_UP); + o.setAnfme(c1.doubleValue()); + orderDetls.add(o); + } + 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(); + } + + + } -- Gitblit v1.9.1