From 34a93b4b34e056ac7c20891efe5630245dc9766c Mon Sep 17 00:00:00 2001 From: zjj <3272660260@qq.com> Date: 星期五, 09 六月 2023 16:57:25 +0800 Subject: [PATCH] #出库修改完成数量变更修改工作数量 --- src/main/java/com/zy/asrs/controller/OrderCheckController.java | 169 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 168 insertions(+), 1 deletions(-) diff --git a/src/main/java/com/zy/asrs/controller/OrderCheckController.java b/src/main/java/com/zy/asrs/controller/OrderCheckController.java index 7609be4..9aa5069 100644 --- a/src/main/java/com/zy/asrs/controller/OrderCheckController.java +++ b/src/main/java/com/zy/asrs/controller/OrderCheckController.java @@ -1,5 +1,8 @@ package com.zy.asrs.controller; + +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.mapper.Wrapper; @@ -12,6 +15,7 @@ import com.zy.asrs.entity.param.MatnrDto; import com.zy.asrs.entity.param.OrderCheckParam; import com.zy.asrs.entity.param.OrderDomainParam; +import com.zy.asrs.entity.result.KeyValueVo; import com.zy.asrs.service.*; import com.zy.common.CodeRes; import com.zy.common.config.AdminInterceptor; @@ -24,9 +28,11 @@ import org.springframework.web.bind.annotation.*; import javax.imageio.ImageIO; +import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import java.awt.image.BufferedImage; import java.io.IOException; +import java.net.URLEncoder; import java.util.*; @RestController @@ -55,6 +61,9 @@ @Autowired private ManLocDetlService manLocDetlService; + + @Autowired + private LocCheckTrimService locCheckTrimService; @RequestMapping(value = "/orderCheck/nav/list/auth") @ManagerAuth @@ -143,6 +152,9 @@ locCheck.setAnfme(manLocDetl.getAnfme()); locCheck.setRealAnfme(0.0); locCheck.setDiffAnfme(0.0); + locCheck.setExamine(0); + locCheck.setOwner(manLocDetl.getOwner()); + locCheck.setPayment(manLocDetl.getPayment()); locCheck.setCreateTime(now); locCheck.setUpdateTime(now); locCheck.setOrderNo(param.getOrderNo()); @@ -379,5 +391,160 @@ return R.ok(); } + @RequestMapping("/orderCheck/create/loc/auth") + @ManagerAuth + public R autolocCreate(@RequestBody CheckDTO checkDTO){ + Double prec = Double.valueOf(checkDTO.getPrec()); + List<CheckDTO.data> data = checkDTO.getData(); + EntityWrapper<ManLocDetl> manLocDetlEntityWrapper = new EntityWrapper<>(); + int count = manLocDetlService.selectCount(manLocDetlEntityWrapper); + List<ManLocDetl> countLocDetl = new ArrayList<>(); + double precDpuble = prec / 100; + count = (int)(count * precDpuble); + if (checkDTO.getData() == null){ + countLocDetl = locCheckService.getCountLocDetl(count); + }else { + for (CheckDTO.data a :data){ + String locno = a.getValue(); + EntityWrapper<ManLocDetl> manLocDetlEntityWrapper2 = new EntityWrapper<>(); + manLocDetlEntityWrapper2.eq("loc_no",locno); + int countfor = manLocDetlService.selectCount(manLocDetlEntityWrapper2); + countfor = (countfor * precDpuble)>1? Math.round((float)(countfor * precDpuble)) : 1 ; + for (ManLocDetl manLocDetl: locCheckService.getLocCountLocDetl(countfor,a.getValue())){ + countLocDetl.add(manLocDetl); + } + } + } -} \ No newline at end of file + return R.ok().add(countLocDetl); + } + + @RequestMapping("/orderCheck/create/owner/auth") + @ManagerAuth + public R autoOwnerlocCreate(@RequestBody CheckDTO checkDTO){ + Double prec = Double.valueOf(checkDTO.getPrec()); + List<CheckDTO.data> data = checkDTO.getData(); + EntityWrapper<ManLocDetl> manLocDetlEntityWrapper = new EntityWrapper<>(); + int count = manLocDetlService.selectCount(manLocDetlEntityWrapper); + List<ManLocDetl> countLocDetl = new ArrayList<>(); + double precDpuble = prec / 100; + count = (int)(count * precDpuble); + if (checkDTO.getData() == null){ + countLocDetl = locCheckService.getCountLocDetl(count); + }else { + for (CheckDTO.data a :data){ + String owner = a.getValue(); + EntityWrapper<ManLocDetl> manLocDetlEntityWrapper2 = new EntityWrapper<>(); + manLocDetlEntityWrapper2.eq("owner",owner); + int countfor = manLocDetlService.selectCount(manLocDetlEntityWrapper2); + countfor = (countfor * precDpuble)>1? Math.round((float)(countfor * precDpuble)) : 1 ; + for (ManLocDetl manLocDetl: locCheckService.getOwnerCountLocDetl(countfor,a.getValue())){ + countLocDetl.add(manLocDetl); + } + } + } + + return R.ok().add(countLocDetl); + } + + @RequestMapping(value = "/orderCheck/mxamine") + public R mxamine(@RequestBody LocCheck locCheck){ //瀹℃牳 + locCheck.setDiffAnfme(locCheck.getRealAnfme() - locCheck.getAnfme()); + locCheck.setExamine(1); + locCheck.setType(2); + if (!locCheckService.updateById(locCheck)){ + return R.error("鐘舵�佹洿鏂板け璐�"); + } + EntityWrapper<ManLocDetl> manLocDetlEntityWrapper = new EntityWrapper<>(); + manLocDetlEntityWrapper.eq("loc_no",locCheck.getLocNo()); + manLocDetlEntityWrapper.eq("matnr",locCheck.getMatnr()); + ManLocDetl manLocDetl = new ManLocDetl(); + manLocDetl.setAnfme(locCheck.getRealAnfme()); + if (!manLocDetlService.update(manLocDetl,manLocDetlEntityWrapper)){ + return R.error("鏇存柊骞冲簱搴撳瓨澶辫触"); + } + + Date now = new Date(); + Long userId = getUserId(); + LocCheckTrim locCheckTrim = new LocCheckTrim(); + locCheckTrim.setLocNo(locCheck.getLocNo()); + locCheckTrim.setMaktx(locCheck.getMaktx()); + locCheckTrim.setType(locCheck.getType()); + locCheckTrim.setExamine(locCheck.getExamine()); + locCheckTrim.setMatnr(locCheck.getMatnr()); + locCheckTrim.setAnfme(locCheck.getAnfme()); + locCheckTrim.setRealAnfme(locCheck.getRealAnfme()); + locCheckTrim.setDiffAnfme(locCheck.getDiffAnfme()); + locCheckTrim.setCreateTime(now); + locCheckTrim.setCreateBy(userId); + locCheckTrim.setOrderNo(locCheck.getOrderNo()); + if (!locCheckTrimService.insert(locCheckTrim)){ + return R.error("鍘嗗彶妗f彃鍏ュけ璐�"); + } + + + + return R.ok("瀹℃牳瀹屾垚锛�"); + } + @RequestMapping(value = "/orderCheck/all/get/loc") + public R mxamine(){ + List<String> list = locCheckService.getLocCount(); + List<KeyValueVo> keyValueVoList = new ArrayList<>(); + for (int i=0;i<list.size();i++){ + KeyValueVo vo = new KeyValueVo(); + vo.setName(list.get(i)); + vo.setValue(list.get(i)); + keyValueVoList.add(vo); + } + return R.ok(keyValueVoList); + + } + + @RequestMapping(value = "/orderCheck/all/get/owner") + public R mxamineOwner(){ + List<LocOwner> list = locCheckService.getOwnerCount(); + List<KeyValueVo> keyValueVoList = new ArrayList<>(); + for (LocOwner basLocOwner: list){ + KeyValueVo vo = new KeyValueVo(); + vo.setName(basLocOwner.getOwner()); + vo.setValue(basLocOwner.getId()); + keyValueVoList.add(vo); + } + return R.ok(keyValueVoList); + + } + + @RequestMapping(value = "/orderCheck/printExport/auth") + // @ManagerAuth(memo = "鐩樼偣鍗曞鍑�") + public void export(HttpServletResponse response,@RequestParam String orderNo) throws IOException { + //浠庢暟鎹簱鏌ヨ鏁版嵁 + EntityWrapper<LocCheck> locCheckEntityWrapper = new EntityWrapper<>(); + locCheckEntityWrapper.eq("order_no",orderNo); + List<LocCheck> list = locCheckService.selectList(locCheckEntityWrapper); + for (LocCheck locCheck:list){ + locCheck.setRealAnfme(null); + } + + response.setContentType("application/vnd.ms-excel"); + response.setCharacterEncoding("utf-8"); + String fileName = URLEncoder.encode("鐩樼偣鍗�", "UTF-8"); + response.setHeader("Content-disposition", "attachment;filename=" + fileName+ orderNo + ".xlsx"); + Set<String> includeColumnFiledNames = new HashSet<String>(); + includeColumnFiledNames.add("orderNo"); + includeColumnFiledNames.add("matnr"); + includeColumnFiledNames.add("maktx"); + includeColumnFiledNames.add("locNo"); + includeColumnFiledNames.add("anfme"); + includeColumnFiledNames.add("owner"); + includeColumnFiledNames.add("payment"); + includeColumnFiledNames.add("createTime"); + includeColumnFiledNames.add("realAnfme"); + EasyExcel.write(response.getOutputStream(), LocCheck.class) + .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) + .includeColumnFiledNames(includeColumnFiledNames) + .sheet("琛�1") + .doWrite(list); + } + + +} -- Gitblit v1.9.1