|
@@ -1,8 +1,8 @@
|
|
|
package org.jeecg.modules.documents.syShippingOrder.service.impl;
|
|
|
|
|
|
+import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
-import org.apache.poi.util.StringUtil;
|
|
|
import org.apache.shiro.SecurityUtils;
|
|
|
import org.jeecg.common.exception.JeecgBootException;
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
@@ -10,12 +10,13 @@ import org.jeecg.common.util.oConvertUtils;
|
|
|
import org.jeecg.modules.documents.letterDeposit.entity.SyRmb;
|
|
|
import org.jeecg.modules.documents.letterDeposit.entity.SyUsd;
|
|
|
import org.jeecg.modules.documents.letterDeposit.mapper.SyLetterDepositMapper;
|
|
|
-import org.jeecg.modules.documents.shippingDetails.entity.SyShippingDetails;
|
|
|
import org.jeecg.modules.documents.syShippingOrder.entity.SyShippingOrder;
|
|
|
import org.jeecg.modules.documents.syShippingOrder.entity.SyShippingOrderItem;
|
|
|
+import org.jeecg.modules.documents.syShippingOrder.entity.VO.SalePayVouchVo;
|
|
|
import org.jeecg.modules.documents.syShippingOrder.entity.VO.SyPackingList;
|
|
|
import org.jeecg.modules.documents.syShippingOrder.mapper.SyShippingOrderMapper;
|
|
|
import org.jeecg.modules.documents.syShippingOrder.service.ISyShippingOrderService;
|
|
|
+import org.jeecg.modules.openApi.mapper.PurchaseWarehousingMapper;
|
|
|
import org.jeecg.modules.splfi.entity.SyPackingListFabric;
|
|
|
import org.jeecg.modules.splfi.entity.SyPackingListFabricItem;
|
|
|
import org.jeecg.modules.splfi.service.impl.SyPackingListFabricItemServiceImpl;
|
|
@@ -24,6 +25,7 @@ import org.jeecg.modules.splt.entity.SyPackingListTailoring;
|
|
|
import org.jeecg.modules.splt.entity.SyPackingListTailoringItem;
|
|
|
import org.jeecg.modules.splt.service.impl.SyPackingListTailoringItemServiceImpl;
|
|
|
import org.jeecg.modules.splt.service.impl.SyPackingListTailoringServiceImpl;
|
|
|
+import org.jeecgframework.codegenerate.generate.util.SimpleFormat;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -34,9 +36,7 @@ import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* @Description: 托书主表实体类
|
|
@@ -62,6 +62,8 @@ public class SyShippingOrderServiceImpl extends ServiceImpl<SyShippingOrderMappe
|
|
|
private SyPackingListTailoringServiceImpl syPackingListTailoringService;
|
|
|
@Autowired
|
|
|
private SyPackingListTailoringItemServiceImpl syPackingListTailoringItemService;
|
|
|
+ @Resource
|
|
|
+ private PurchaseWarehousingMapper purchaseWarehousingMapper;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -487,4 +489,177 @@ public class SyShippingOrderServiceImpl extends ServiceImpl<SyShippingOrderMappe
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Integer saveSalePayVouchOne(SyShippingOrder syShippingOrder) {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Integer saveSalePayVouchTwo(SyShippingOrder syShippingOrder) {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ @DS("multi-three")
|
|
|
+ @Override
|
|
|
+ public Integer saveSalePayVouchThree(Map<String,Object> map,List<Map<String,Object>> itemList,List<Map<String,Object>> rmbList,List<Map<String,Object>> udsList) {
|
|
|
+
|
|
|
+ int i = this.saveSalePayVouch(map,itemList,rmbList,udsList);
|
|
|
+ return i;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增
|
|
|
+ * @param map1
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Integer saveSalePayVouch(Map<String,Object> map1,List<Map<String,Object>> itemList,List<Map<String,Object>> rmbList,List<Map<String,Object>> usdList){
|
|
|
+
|
|
|
+ //主表集合
|
|
|
+ List<Map<String,Object>> listmap = new ArrayList<>();
|
|
|
+ //子表集合
|
|
|
+ List<Map<String,Object>> listmaps = new ArrayList<>();
|
|
|
+
|
|
|
+ SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd 00:00:00.000");
|
|
|
+
|
|
|
+ //记录每次ID
|
|
|
+ String id = "";
|
|
|
+ //记录每次单据号
|
|
|
+ String cCode = "";
|
|
|
+ String cVouchID = "";
|
|
|
+ //获取单据号加1
|
|
|
+ cCode= org.jeecg.modules.system.util.oConvertUtils.addOne(purchaseWarehousingMapper.getMaxCode("cSPVCode","SalePayVouch","dcreatesystime"));
|
|
|
+ //获取ID
|
|
|
+ id = org.jeecg.modules.system.util.oConvertUtils.addOne(purchaseWarehousingMapper.getMaxCode("ID","SalePayVouch","dcreatesystime"));
|
|
|
+ //单据id
|
|
|
+ //cVouchID = org.jeecg.modules.system.util.oConvertUtils.addOne(purchaseWarehousingMapper.getMaxCode("cVouchID","SalePayVouch","dcreatesystime"));
|
|
|
+
|
|
|
+ int ii = 0;
|
|
|
+
|
|
|
+ try {
|
|
|
+
|
|
|
+ //业务场景
|
|
|
+ //一张托书有五个销售订单号,美元代币有三个,人民币代币有三个,此时需要生成30张销售费用支出单,每一个销售订单需要生成6个费用支出单,所以(5*6=30)
|
|
|
+ for(Map<String,Object> li: itemList){
|
|
|
+ //人民币信息
|
|
|
+ for(Map<String,Object> rmb:rmbList){
|
|
|
+ ii++;
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
+ Map<String,Object> mapPo;
|
|
|
+
|
|
|
+ String orderId = li.get("orderId").toString();
|
|
|
+ mapPo = syShippingOrderMapper.querySOMain(orderId.substring(3,orderId.length()));//li.get("orderId").toString()
|
|
|
+
|
|
|
+ if(ii>1){
|
|
|
+ cCode = org.jeecg.modules.system.util.oConvertUtils.addOne(cCode);
|
|
|
+ //cVouchID = org.jeecg.modules.system.util.oConvertUtils.addOne(cVouchID);
|
|
|
+ id = org.jeecg.modules.system.util.oConvertUtils.addOne(id);
|
|
|
+ map.put("cSPVCode",cCode);//单据号
|
|
|
+ // map.put("cVouchID",cVouchID);
|
|
|
+ map.put("ID",id);//ID
|
|
|
+ }else{
|
|
|
+ map.put("cSPVCode",cCode);//单据号
|
|
|
+ //map.put("cVouchID",cVouchID);
|
|
|
+ map.put("ID",id);//ID
|
|
|
+ }
|
|
|
+ map.put("dDate",sf.format(new Date()));//日期
|
|
|
+ map.put("cPersonCode",mapPo.get("cPersonCode"));//业务员
|
|
|
+ map.put("cDepCode",mapPo.get("cDepCode"));//部门
|
|
|
+ map.put("cCusCode",mapPo.get("cCusCode"));//客户简称
|
|
|
+ map.put("cDefine10",map1.get("shippingOrderNumber"));//外销发票号
|
|
|
+ map.put("cVouchType","PO");//单据类型
|
|
|
+ map.put("cMaker",map1.get("createBy"));//制单人
|
|
|
+ map.put("iSourceId",mapPo.get("ID"));//来源ID、
|
|
|
+ map.put("cSourceCode",li.get("orderNumber"));//订单号
|
|
|
+ map.put("cSOCode",li.get("orderNumber"));//订单号
|
|
|
+ map.put("cnextsystem","其他应付单");//单据流向
|
|
|
+ map.put("iexchrate","1");//汇率
|
|
|
+ map.put("Cexch_Name","人民币");
|
|
|
+ map.put("iVTid","57");
|
|
|
+
|
|
|
+ map.put("cvencode","");
|
|
|
+ listmap.add(map);
|
|
|
+
|
|
|
+
|
|
|
+ //添加子表信息
|
|
|
+ Map<String,Object> maps = new HashMap<>();
|
|
|
+ maps.put("cSPVCode",cCode);//销售支出单号
|
|
|
+ maps.put("iMoney",new BigDecimal(li.get("grossWeight").toString()).multiply(new BigDecimal(rmb.get("amount").toString())));
|
|
|
+ maps.put("cExpCode","0000"+ii);//项目编码
|
|
|
+ maps.put("ID", id);
|
|
|
+ maps.put("irowno","1");//行号
|
|
|
+ listmaps.add(maps);
|
|
|
+ }
|
|
|
+
|
|
|
+ //美元信息
|
|
|
+ for(Map<String,Object> usd:usdList){
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
+ Map<String,Object> mapPo;
|
|
|
+
|
|
|
+ String orderId = li.get("orderId").toString();
|
|
|
+ mapPo = syShippingOrderMapper.querySOMain(orderId.substring(3,orderId.length()));//li.get("orderId").toString()
|
|
|
+
|
|
|
+ cCode = org.jeecg.modules.system.util.oConvertUtils.addOne(cCode);
|
|
|
+ //cVouchID = org.jeecg.modules.system.util.oConvertUtils.addOne(cVouchID);
|
|
|
+ id = org.jeecg.modules.system.util.oConvertUtils.addOne(id);
|
|
|
+ map.put("cSPVCode",cCode);//单据号
|
|
|
+ map.put("ID",id);//ID
|
|
|
+ //map.put("cVouchID",cVouchID);
|
|
|
+
|
|
|
+ map.put("dDate",sf.format(new Date()));//日期
|
|
|
+ map.put("cPersonCode",mapPo.get("cPersonCode"));//业务员
|
|
|
+ map.put("cDepCode",mapPo.get("cDepCode"));//部门
|
|
|
+ map.put("cCusCode",mapPo.get("cCusCode"));//客户简称
|
|
|
+ map.put("cDefine10",map1.get("shippingOrderNumber"));//外销发票号
|
|
|
+ map.put("cVouchType","PO");//单据类型
|
|
|
+ map.put("cMaker",map1.get("createBy"));//制单人
|
|
|
+ map.put("iSourceId",mapPo.get("ID"));//来源ID、
|
|
|
+ map.put("cSourceCode","SYW440-马菲羊-面料");//订单号li.get("orderNumber")
|
|
|
+ map.put("cSOCode","SYW440-马菲羊-面料");//订单号
|
|
|
+ map.put("cnextsystem","其他应付单");//单据流向
|
|
|
+ map.put("iexchrate","1");//汇率
|
|
|
+ map.put("Cexch_Name","美元");
|
|
|
+ map.put("iVTid","57");//单据模板号
|
|
|
+
|
|
|
+ listmap.add(map);
|
|
|
+
|
|
|
+
|
|
|
+ //添加子表信息
|
|
|
+ Map<String,Object> maps = new HashMap<>();
|
|
|
+ maps.put("cSPVCode",cCode);//销售支出单号
|
|
|
+ maps.put("iMoney",new BigDecimal(li.get("grossWeight").toString()).multiply(new BigDecimal(usd.get("amount").toString())));
|
|
|
+ maps.put("cExpCode","0000"+ii);//项目编码
|
|
|
+
|
|
|
+ maps.put("ID", id);
|
|
|
+ maps.put("irowno","1");//行号
|
|
|
+ listmaps.add(maps);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //循环新增主表
|
|
|
+ for(Map<String,Object> ma:listmap){
|
|
|
+ // syShippingOrderMapper.saveSalePayVouch(ma);
|
|
|
+ }
|
|
|
+
|
|
|
+ //循环新增子表
|
|
|
+ for(Map<String,Object> ma:listmaps){
|
|
|
+ // syShippingOrderMapper.saveSalePayVouchs(ma);
|
|
|
+ }
|
|
|
+
|
|
|
+ //修改最大编码
|
|
|
+ // purchaseWarehousingMapper.updateVoucherHistoryCNumber(org.jeecg.modules.system.util.oConvertUtils.maxNumber(cCode),"09");
|
|
|
+
|
|
|
+
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ throw new JeecgBootException("失败:"+e.getMessage());
|
|
|
+
|
|
|
+ }
|
|
|
+ return 1;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|