From edb36cfc687830ba840e01347c54313413faa651 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=93=B2=E5=A5=87?= <13840175730@139.com> Date: Sun, 15 Dec 2024 21:00:46 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=9B=BE=E7=BA=B8=E8=AE=A1=E5=88=92=E6=B4=BE?= =?UTF-8?q?=E5=B7=A5=E5=8D=95=20=E5=8F=96=E6=B6=88=E5=88=86=E6=AE=B5=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BC=96=E5=88=B6=E4=BA=BA=E7=BC=96=E5=88=B6?= =?UTF-8?q?=E6=97=A5=E6=9C=9F=E8=AE=B0=E5=BD=95=202.=E6=8A=9B=E4=B8=B8=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20=E7=90=86=E6=96=99=E5=9E=9B=E4=BD=8D=20?= =?UTF-8?q?=E5=B1=82=E6=95=B0=20=E6=89=B9=E9=87=8F=E9=80=89=E6=8B=A9=203.?= =?UTF-8?q?=E4=B8=8A=E6=96=99=E5=9E=AE=E4=BD=8D=E6=9F=A5=E8=AF=A2=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=20=E6=94=B9=E4=B8=BA=E5=8D=95=E6=8D=AE=E5=8F=B7=20?= =?UTF-8?q?=E5=8D=95=E6=8D=AE=E5=8F=B7=E6=9F=A5=E8=AF=A2=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E6=9C=AA=E7=9F=A5=204.=E5=88=92=E7=BA=BF=E5=9E=9B=E4=BD=8D=20?= =?UTF-8?q?=E5=B1=82=E6=95=B0=E5=8F=96=E6=B6=88=205.=E6=8C=89=E5=B7=A5?= =?UTF-8?q?=E5=BA=8F=E6=9F=A5=E7=9C=8B=E4=BD=9C=E4=B8=9A=E8=AE=A1=E5=88=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/dsic/gj_erp/bean/zyjh/PwExcel.java | 6 +++ .../com/dsic/gj_erp/bean/zyjh/YcldwInfo.java | 2 +- .../controller/jhgk/DmSygdMxController.java | 2 +- .../controller/zyjh/ZyjhController.java | 43 +++++++++++++++++++ .../service/jhgk/impl/YdjhImportService.java | 8 +++- .../resources/mappers/jhgk/DmYdjhMapper.xml | 2 +- 6 files changed, 59 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/dsic/gj_erp/bean/zyjh/PwExcel.java b/src/main/java/com/dsic/gj_erp/bean/zyjh/PwExcel.java index b0e86a3..bdb47dd 100644 --- a/src/main/java/com/dsic/gj_erp/bean/zyjh/PwExcel.java +++ b/src/main/java/com/dsic/gj_erp/bean/zyjh/PwExcel.java @@ -23,4 +23,10 @@ public class PwExcel { @ExcelProperty(value = "备注") public String bz; + @ExcelProperty(value = "理料垛位") + public String lldw; + + @ExcelProperty(value = "层数") + private String llcs; + } diff --git a/src/main/java/com/dsic/gj_erp/bean/zyjh/YcldwInfo.java b/src/main/java/com/dsic/gj_erp/bean/zyjh/YcldwInfo.java index 614072d..73f8c3d 100644 --- a/src/main/java/com/dsic/gj_erp/bean/zyjh/YcldwInfo.java +++ b/src/main/java/com/dsic/gj_erp/bean/zyjh/YcldwInfo.java @@ -59,7 +59,7 @@ public class YcldwInfo { this.baifang(); } - private void baifang(){ + public void baifang(){ this.zt=ZtEnum.BF; } diff --git a/src/main/java/com/dsic/gj_erp/controller/jhgk/DmSygdMxController.java b/src/main/java/com/dsic/gj_erp/controller/jhgk/DmSygdMxController.java index 3b190f6..9b93b26 100644 --- a/src/main/java/com/dsic/gj_erp/controller/jhgk/DmSygdMxController.java +++ b/src/main/java/com/dsic/gj_erp/controller/jhgk/DmSygdMxController.java @@ -154,7 +154,7 @@ public class DmSygdMxController { EasyExcel.read(file.getInputStream(), JhxfExcel.class, objectListener).sheet(0).headRowNumber(1).doRead(); List objList = objectListener.getObjectList(); - ydjhImportService.handler(objList); + ydjhImportService.handler(objList,req); // service.ydjhImport(objList); return new ResultBean(); diff --git a/src/main/java/com/dsic/gj_erp/controller/zyjh/ZyjhController.java b/src/main/java/com/dsic/gj_erp/controller/zyjh/ZyjhController.java index 76d51d8..0766792 100644 --- a/src/main/java/com/dsic/gj_erp/controller/zyjh/ZyjhController.java +++ b/src/main/java/com/dsic/gj_erp/controller/zyjh/ZyjhController.java @@ -5,6 +5,7 @@ import cn.hutool.core.util.ObjUtil; import cn.hutool.core.util.StrUtil; import com.alibaba.excel.EasyExcel; import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.dsic.gj_erp.annotation.AuthFunction; import com.dsic.gj_erp.bean.ResultBean; @@ -53,16 +54,31 @@ public class ZyjhController { */ @PostMapping("pwdr") @AuthFunction + @Transactional(rollbackFor = Exception.class) public ResultBean pwdr(MultipartFile file,HttpServletRequest request) throws IOException { String yhdm= (String) request.getAttribute("yhdm"); + String yhms= (String) request.getAttribute("yhms"); String date=DateUtil.date().toString("yyyy/MM/dd HH:mm:ss"); ExcelPwListener excelPwListener = new ExcelPwListener(); EasyExcel.read(file.getInputStream(), PwExcel.class, excelPwListener).sheet(0).headRowNumber(1).doRead(); List objList = excelPwListener.getObjectList(); objList.forEach(item-> { + Ycldw ycldw = ycldwService.getOne(new QueryWrapper().select("top 1 *").eq("name", item.getLldw())); + Integer dwId=null; + if (ycldw!=null){ + dwId=ycldw.getId(); + + } + DmYdjh ydjh = zyjhService.getOne(new QueryWrapper() + .eq("dc_ch", item.getDcCh()) + .eq("dc_pl", item.getDcPl()) + .eq("dc_fd", item.getDcFd()) + .eq("tzbh", item.getTlth()) + ); zyjhService.update(Wrappers.lambdaUpdate() .set(DmYdjh::getPwfkrq,date).set(DmYdjh::getPwfkry,yhdm) + .set(DmYdjh::getLldw,dwId).set(DmYdjh::getLlcs,item.getLlcs()) .eq(DmYdjh::getDcCh, item.getDcCh()) .eq(DmYdjh::getDcPl, item.getDcPl()) .eq(DmYdjh::getDcFd, item.getDcFd()) @@ -74,6 +90,33 @@ public class ZyjhController { .eq(YcldwInfo::getFd, item.getDcFd()) .eq(YcldwInfo::getTlth, item.getTlth()) ); + + YcldwInfo ycldwInfo = new YcldwInfo(); + ycldwInfo.setDwId(dwId); + try { + ycldwInfo.setCeng(Integer.parseInt(item.getLlcs())); + }catch (Exception ignored){} + try { + ycldwInfo.setYdid(ydjh.getId()); + ycldwInfo.setKw(ydjh.getKw()); + ycldwInfo.setZl(ydjh.getZl()); + ycldwInfo.setWph(ydjh.getWpxh()); + ycldwInfo.setWlh(ydjh.getSlwlh()); + ycldwInfo.setLph(ydjh.getSllph()); + ycldwInfo.setWpgg(ydjh.getWpgg()); + ycldwInfo.setNbsbm(ydjh.getNbsbm()); + ycldwInfo.setSljhrq(ydjh.getSljhrq()); + ycldwInfo.setQgjhrq(ydjh.getQgjhrq()); + ycldwInfo.setBfr(yhms); + ycldwInfo.setBfrq(date); + }catch (Exception ignored){} + ycldwInfo.setCzbh(item.getDcCh()); + ycldwInfo.setPl(item.getDcPl()); + ycldwInfo.setFd(item.getDcFd()); + ycldwInfo.setTlth(item.getTlth()); + ycldwInfo.baifang(); + ycldwInfoService.save(ycldwInfo); + }); return new ResultBean<>(); diff --git a/src/main/java/com/dsic/gj_erp/service/jhgk/impl/YdjhImportService.java b/src/main/java/com/dsic/gj_erp/service/jhgk/impl/YdjhImportService.java index ca36692..08be70b 100644 --- a/src/main/java/com/dsic/gj_erp/service/jhgk/impl/YdjhImportService.java +++ b/src/main/java/com/dsic/gj_erp/service/jhgk/impl/YdjhImportService.java @@ -1,6 +1,7 @@ package com.dsic.gj_erp.service.jhgk.impl; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -20,6 +21,7 @@ import lombok.AllArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import javax.servlet.http.HttpServletRequest; import java.util.*; import java.util.stream.Collectors; @@ -41,7 +43,7 @@ public class YdjhImportService extends ServiceImpl { } @Transactional(rollbackFor = Exception.class) - public void handler(List objList) { + public void handler(List objList, HttpServletRequest request) { List ydjhImports = this.executeYdjhImport(objList); ydjhImports.forEach(item->{ @@ -79,6 +81,8 @@ public class YdjhImportService extends ServiceImpl { ydjhImports.forEach(importService::saveOrUpdate); //没有基础数据的计划生成图纸计划 + String yhms= (String) request.getAttribute("yhms"); + String date= DateUtil.date().toString("yyyy/MM/dd"); List tzjhList = new ArrayList<>(); ydjhImports.stream() .filter(item -> !StrUtil.equals(item.getExtData(), "1")) @@ -96,6 +100,8 @@ public class YdjhImportService extends ServiceImpl { String[] dcfd=item.getDcFd().split("\\."); for(String dcFd:dcfd){ PgdTzjh dmTzjh = PgdTzjh.of(item,dcPl, dcFd); + dmTzjh.setBzry(yhms); + dmTzjh.setBzrq(date); tzjhList.add(dmTzjh); } } diff --git a/src/main/resources/mappers/jhgk/DmYdjhMapper.xml b/src/main/resources/mappers/jhgk/DmYdjhMapper.xml index ee75ad0..b01067a 100644 --- a/src/main/resources/mappers/jhgk/DmYdjhMapper.xml +++ b/src/main/resources/mappers/jhgk/DmYdjhMapper.xml @@ -931,7 +931,7 @@ where dc_ch=#{dcch} and dc_pl =#{dcpl} from dm_ydjh - where zt>=11 + where zt>=11 and zt>=#{zt} and isnull(qgfkrq,'')=''