1 rok temu
rodzic
commit
c0b2a7a766

+ 56 - 57
platform-service/src/main/java/com/platform/service/yongyou/impl/YongyouServiceImpl.java

@@ -1116,21 +1116,23 @@ public class YongyouServiceImpl implements YongyouService {
 
         PuAppMain puAppMain = new PuAppMain();
         List<PuAppDetail> puAppDetails = new ArrayList<>();
-        for (LongYanPurchaseOrderVO vo:list){
-            if (vo.getOldOrNew()==null){
-                throw new BusinessException("采购单未选择新老厂!采购单id:"+vo.getId());
+        for (LongYanPurchaseOrderVO vo:list) {
+            if (vo.getOldOrNew() == null) {
+                throw new BusinessException("采购单未选择新老厂!采购单id:" + vo.getId());
             }
             LongYanPurchaseDetailDTO longYanPurchaseDetailDTO = new LongYanPurchaseDetailDTO();
             longYanPurchaseDetailDTO.setLongYangPurchaseOrderId(vo.getId());
             List<LongYanPurchaseDetailVO> detailVOS = longYanPurchaseDetailMapper.selectList(longYanPurchaseDetailDTO);
-            if (vo.getSbId()!=null) {
-                addBom(vo,detailVOS);
+            if (vo.getSbId() != null) {
+                addBom(vo, detailVOS);
             }
 //        puAppMain.setCpersoncode(vo.getCreatedUserName());
             SbInfo sbInfo = null;
-            if (puAppMain.getCdefine1()==null) {
-                puAppMain.setCbustype(vo.getCbustype());
-                puAppMain.setCdepcode(vo.getCdepcode());
+            if (puAppMain.getCdefine1() == null) {
+                puAppMain.setCdefine1(DictCache.getLabelByValue("LONG_YAN_PURCHASE_TYPE", vo.getType()));
+            }
+            puAppMain.setCbustype(vo.getCbustype());
+            puAppMain.setCdepcode(vo.getCdepcode());
 
 //        if (list.get(0).getOldOrNew()==1){
 //            puAppMain.setCdepcode(DictCache.getValueByCode("YONG_YOU_DEPT",list.get(0).getCdepcode()));
@@ -1141,39 +1143,38 @@ public class YongyouServiceImpl implements YongyouService {
 
 //        puAppMain.setCcode(vo.getPurchaseNo());
 
-                puAppMain.setCpersoncode(vo.getCpersoncode());
-                puAppMain.setCdefine1(DictCache.getLabelByValue("LONG_YAN_PURCHASE_TYPE", vo.getType()));
-                // 获取项目信息
-                if (StringUtils.isNotBlank(vo.getProjectId())) {
-                    String fzr = projectMapper.selectByPrimaryKey(vo.getProjectId()).getFzr();
-                    if (!StringUtils.isBlank(fzr) && !"无".equals(fzr)) {
-                        puAppMain.setCdefine3(fzr);
-                    }
-                }
-                if (vo.getSbId() != null) {
-                    sbInfo = sbInfoMapper.selectByPrimaryKey(vo.getSbId());
-                    puAppMain.setCdefine11(sbInfo.getPositionNo() + "-" + sbInfo.getName());
+            puAppMain.setCpersoncode(vo.getCpersoncode());
+            // 获取项目信息
+            if (StringUtils.isNotBlank(vo.getProjectId())) {
+                String fzr = projectMapper.selectByPrimaryKey(vo.getProjectId()).getFzr();
+                if (!StringUtils.isBlank(fzr) && !"无".equals(fzr)) {
+                    puAppMain.setCdefine3(fzr);
                 }
-                puAppMain.setCmemo(vo.getRemark());
-                puAppMain.setCmaker(vo.getCreatedUserName());
-                puAppMain.setDdate(DateUtils.dateToString(vo.getCreatedTime()));
-                puAppMain.setCptcode(vo.getCptcode());
-                puAppMain.setCdefine12(vo.getCdefine12());
+            }
+            if (vo.getSbId() != null) {
+                sbInfo = sbInfoMapper.selectByPrimaryKey(vo.getSbId());
+                puAppMain.setCdefine11(sbInfo.getPositionNo() + "-" + sbInfo.getName());
+            }
+            puAppMain.setCmemo(vo.getRemark());
+            puAppMain.setCmaker(vo.getCreatedUserName());
+            puAppMain.setDdate(DateUtils.dateToString(vo.getCreatedTime()));
+            puAppMain.setCptcode(vo.getCptcode());
+            puAppMain.setCdefine12(vo.getCdefine12());
 
 //        puAppMain.setCbmemo(vo.getCbmemo());
-                puAppMain.setCdefine6(vo.getPlanGetDate().toString());
+            puAppMain.setCdefine6(vo.getPlanGetDate().toString());
+
+            String dept = null;
+            if (list.get(0).getOldOrNew() == 2) {
+                dept = DictCache.getLabelByValue("YONG_YOU_DEPT", list.get(0).getCdepcode());
+            } else if (list.get(0).getOldOrNew() == 1) {
+                dept = DictCache.getLabelByValue("YONG_YOU_DEPT_NEW", list.get(0).getCdepcode());
             }
-                String dept = null;
-                if (list.get(0).getOldOrNew()==2){
-                    dept = DictCache.getLabelByValue("YONG_YOU_DEPT",list.get(0).getCdepcode());
-                }else if (list.get(0).getOldOrNew()==1){
-                    dept = DictCache.getLabelByValue("YONG_YOU_DEPT_NEW",list.get(0).getCdepcode());
-                }
-            for (LongYanPurchaseDetailVO orderVO:detailVOS){
+            for (LongYanPurchaseDetailVO orderVO : detailVOS) {
                 PuAppDetail detail = new PuAppDetail();
-                if (sbInfo!=null){
-                    detail.setCdefine30(vo.getPositionNo()+"-"+sbInfo.getName());
-                }else {
+                if (sbInfo != null) {
+                    detail.setCdefine30(vo.getPositionNo() + "-" + sbInfo.getName());
+                } else {
                     detail.setCdefine30(vo.getPositionNo());
                 }
 
@@ -1189,37 +1190,35 @@ public class YongyouServiceImpl implements YongyouService {
                 detail.setCitem_name(orderVO.getProjectSecondName());
                 detail.setCitemcode(orderVO.getProjectSecondNo());
 
-                detail.setFmoney(MathUtils.formatDouble1(orderVO.getFmoney(),2));//本币含税合计
-                detail.setFunitprice(MathUtils.formatDouble1(orderVO.getFunitprice(),4));//本币无税单价 = 本币不含税金额 /数量
+                detail.setFmoney(MathUtils.formatDouble1(orderVO.getFmoney(), 2));//本币含税合计
+                detail.setFunitprice(MathUtils.formatDouble1(orderVO.getFunitprice(), 4));//本币无税单价 = 本币不含税金额 /数量
 
-                Double iorisum = orderVO.getFmoney()/orderVO.getIexchrate();//原币价税合计111
-                Double ioritaxprice = (iorisum/(1+orderVO.getIpertaxrate()/100))*orderVO.getIpertaxrate()/100 ;//原币税额111
-                Double iorimoney = iorisum-ioritaxprice;//原币不含税金额 = 原币价税合计 - 原币税额111
-                Double ioricost = iorimoney/orderVO.getNum().doubleValue();//原币不含税单价 = 原币不含税金额 / 数量
-                Double ioritaxcost = iorisum/orderVO.getNum().doubleValue();//原币含税单价
-                Double ftaxprice = orderVO.getFmoney()/orderVO.getNum().doubleValue();//本币含税单价111111
+                Double iorisum = orderVO.getFmoney() / orderVO.getIexchrate();//原币价税合计111
+                Double ioritaxprice = (iorisum / (1 + orderVO.getIpertaxrate() / 100)) * orderVO.getIpertaxrate() / 100;//原币税额111
+                Double iorimoney = iorisum - ioritaxprice;//原币不含税金额 = 原币价税合计 - 原币税额111
+                Double ioricost = iorimoney / orderVO.getNum().doubleValue();//原币不含税单价 = 原币不含税金额 / 数量
+                Double ioritaxcost = iorisum / orderVO.getNum().doubleValue();//原币含税单价
+                Double ftaxprice = orderVO.getFmoney() / orderVO.getNum().doubleValue();//本币含税单价111111
 //            Double itaxprice = ftaxprice*orderVO.getNum().doubleValue()/(1+orderVO.getIpertaxrate());//本币税额
-                Double itaxprice = (orderVO.getFmoney()/(1+orderVO.getIpertaxrate()/100))*orderVO.getIpertaxrate()/100;//本币税额111
-
-                Double imoney = ftaxprice*orderVO.getNum().doubleValue()-itaxprice;///本币不含税金额 = 本币含税单价 * 数量 - 本币税额
-
-                detail.setIorisum(MathUtils.formatDouble1(iorisum,2));
-                detail.setIoritaxprice(MathUtils.formatDouble1(ioritaxprice,2));
+                Double itaxprice = (orderVO.getFmoney() / (1 + orderVO.getIpertaxrate() / 100)) * orderVO.getIpertaxrate() / 100;//本币税额111
 
-                detail.setIorimoney(MathUtils.formatDouble1(iorimoney,2));
-                detail.setIoricost(MathUtils.formatDouble1(ioricost,4));
+                Double imoney = ftaxprice * orderVO.getNum().doubleValue() - itaxprice;///本币不含税金额 = 本币含税单价 * 数量 - 本币税额
 
-                detail.setIoritaxcost(MathUtils.formatDouble1(ioritaxcost,4));
-                detail.setFtaxprice(MathUtils.formatDouble1(ftaxprice,4));
-                detail.setItaxprice(MathUtils.formatDouble1(itaxprice,2));
-                detail.setImoney(MathUtils.formatDouble1(imoney,2));
+                detail.setIorisum(MathUtils.formatDouble1(iorisum, 2));
+                detail.setIoritaxprice(MathUtils.formatDouble1(ioritaxprice, 2));
 
+                detail.setIorimoney(MathUtils.formatDouble1(iorimoney, 2));
+                detail.setIoricost(MathUtils.formatDouble1(ioricost, 4));
 
+                detail.setIoritaxcost(MathUtils.formatDouble1(ioritaxcost, 4));
+                detail.setFtaxprice(MathUtils.formatDouble1(ftaxprice, 4));
+                detail.setItaxprice(MathUtils.formatDouble1(itaxprice, 2));
+                detail.setImoney(MathUtils.formatDouble1(imoney, 2));
 
 
                 detail.setCbmemo(orderVO.getCbmemo());
 //            detail.setFtaxprice(MathUtils.formatDouble1(orderVO.getIpertaxrate(),2));
-                detail.setIpertaxrate(MathUtils.formatDouble1(orderVO.getIpertaxrate(),2));
+                detail.setIpertaxrate(MathUtils.formatDouble1(orderVO.getIpertaxrate(), 2));
 //            detail.setIorisum(MathUtils.formatDouble1(orderVO.getIorisum(),2));