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,'')=''