Forráskód Böngészése

1.增加分类监管导出逻辑
2.增加金港导出对账时,显示业务编号逻辑
3.给出入库统计返回 fid 值,方便前台处理跳转到出入库数据跳到详情页逻辑

nzf 3 éve
szülő
commit
ffec29950a

+ 11 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/reportManagement/TWhgenlegController.java

@@ -68,6 +68,17 @@ public class TWhgenlegController extends BaseController {
     }
 
     /**
+     * 导出分类监管数据
+     */
+    @PreAuthorize("@ss.hasPermi('warehouseBusiness:whgenleg:superviseExport')")
+    @Log(title = "分类监管数据导出",businessType = BusinessType.EXPORT)
+    @DataScope(deptAlias = "d",userAlias = "u")
+    @GetMapping("/superviseExport")
+    public AjaxResult superviseExport(TWhgenleg tWhgenleg) {
+        return tWhgenlegService.superviseExport(tWhgenleg);
+    }
+
+    /**
      * 获取库存总账详细信息
      */
     @PreAuthorize("@ss.hasPermi('warehouseBusiness:whgenleg:query')")

+ 14 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/finance/excel/Contrast.java

@@ -61,11 +61,25 @@ public class Contrast {
     private Float fAmtcr;
 
     /**
+     * 业务编号
+     */
+    @Excel(name = "业务编号")
+    private String fSrcBillno;
+
+    /**
      * 备注
      */
     @Excel(name = "备注")
     private String fRemarks;
 
+    public String getfSrcBillno() {
+        return fSrcBillno;
+    }
+
+    public void setfSrcBillno(String fSrcBillno) {
+        this.fSrcBillno = fSrcBillno;
+    }
+
     public String getfBillno() {
         return fBillno;
     }

+ 12 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/finance/service/impl/TFeeServiceImpl.java

@@ -1486,6 +1486,18 @@ public class TFeeServiceImpl implements ITFeeService {
     @Override
     public List<Contrast> contrastExport(TFee tFee) throws Exception {
         List<Map<String, Object>> list = tFeeMapper.selectTFeeList1(tFee);
+        for (Map<String,Object> map : list) {
+            List<TFeeDo> tfd = tFeeDoMapper.selectTFeeDoByfPid(Long.valueOf(map.get("fId").toString()));
+            if (tfd.size()!=0) {
+                StringBuilder stringBuilder = new StringBuilder();
+                for (TFeeDo tFeeDo : tfd) {
+                    if (StringUtils.isNotNull(tFeeDo.getfSrcBillno())) {
+                        stringBuilder.append(tFeeDo.getfSrcBillno()).append(",");
+                    }
+                }
+                map.put("fSrcBillno",StringUtils.removeTheLastComma(stringBuilder));
+            }
+        }
         List<Contrast> list1 = ListMapToBeanUtils.castMapToBean(list, Contrast.class);
         return list1;
     }

+ 2 - 1
ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/excel/Whgenleg.java

@@ -17,7 +17,8 @@ public class Whgenleg {
     /**
      * 客户名称,t_corps 中的no或 name,模糊查找选择后,存储id,显示name
      */
-    @Excel(name = "货权方")
+    @Excel(name = "客户")
+    //@Excel(name = "货权方")
     private String fCorpid;
 
 

+ 8 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/service/ITWhgenlegService.java

@@ -19,6 +19,14 @@ import java.util.Map;
  * @date 2020-12-11
  */
 public interface ITWhgenlegService {
+
+    /**
+     * 分类监管导出
+     * @param tWhgenleg 传递的库存总账数据对象
+     * @return 状态以及数据
+     */
+    AjaxResult superviseExport(TWhgenleg tWhgenleg);
+
     /**
      * 查询库存总账
      *

+ 215 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/service/impl/TWhgenlegServiceImpl.java

@@ -6,6 +6,7 @@ import com.github.pagehelper.PageHelper;
 import com.ruoyi.basicData.domain.TCustomerContact;
 import com.ruoyi.basicData.mapper.TCustomerContactMapper;
 import com.ruoyi.basicData.mapper.TWarehouseMapper;
+import com.ruoyi.common.config.RuoYiConfig;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.core.domain.entity.TWarehouse;
@@ -30,6 +31,7 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.io.*;
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.util.*;
@@ -58,6 +60,219 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
     @Autowired
     private TWarehousebillsitemsMapper tWarehousebillsitemsMapper;
 
+    @Override
+    public AjaxResult superviseExport(TWhgenleg tWhgenleg) {
+        List<Map<String,Object>> list = tWhgenlegMapper.selectWhgenlegList(tWhgenleg);
+        Date nowDate = new Date();
+        String fileName = "LHHT_STOCKAPPLY_" + new SimpleDateFormat("yyyyMMdd").format(nowDate) + ".FLJGRX";
+        // 应用号
+        String APP_CODE = "SAS";
+        // 环节号
+        String APP_STEP_ID = "8910000438957";
+        // 序列化类名
+        String CLASS_NAME = "XMLOject";
+        // 版本号
+        String CLASS_VER = "1.0";
+        // 生成时间
+        String FILE_DATE_TIME = new SimpleDateFormat("yyyy-MM-dd").format(nowDate);
+        // 生成人
+        String FILE_GERATER = "青岛道合供应链";
+        // 顺序
+        String FILE_ORDER = "1";
+        // 文件名
+        String FILE_ORIGINAL_NAME = fileName;
+        // 大小
+        String FILE_SIZE = String.valueOf(getFileSize(fileName));
+        // 类型
+        String XML_TYPE = "W3C";
+        // 经营单位代码
+        String TRADE_CODE = "35034092-9";
+        // 经营单位名称
+        String TRADE_NAME = "青岛道合供应链管理有限公司";
+        // 报送日期
+        String APPLY_DATE = new SimpleDateFormat("yyyyMMdd").format(nowDate);
+        try {
+            FileWriter fw =new FileWriter(getAbsoluteFile(fileName));
+            BufferedWriter bw = new BufferedWriter(fw);
+            // 写入头部
+            bw.write(
+                    "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" +
+                            "<XMLObject>\n" +
+                            "  <APP_CODE>"+ APP_CODE +"</APP_CODE>\n" +
+                            "  <APP_STEP_ID>"+ APP_STEP_ID +"</APP_STEP_ID>\n" +
+                            "  <CLASS_NAME>"+ CLASS_NAME +"</CLASS_NAME>\n" +
+                            "  <CLASS_VER>"+ CLASS_VER +"</CLASS_VER>\n" +
+                            "  <FILE_DATE_TIME>"+ FILE_DATE_TIME +"</FILE_DATE_TIME>\n" +
+                            "  <FILE_GERATER>"+ FILE_GERATER +"</FILE_GERATER>\n" +
+                            "  <FILE_ORDER>"+ FILE_ORDER +"</FILE_ORDER>\n" +
+                            "  <FILE_ORIGINAL_NAME>"+ FILE_ORIGINAL_NAME +"</FILE_ORIGINAL_NAME>\n" +
+                            "  <FILE_SIZE>"+ FILE_SIZE +"</FILE_SIZE>\n" +
+                            "  <XML_TYPE>"+ XML_TYPE +"</XML_TYPE>\n" +
+                            "  <SDEPORT_DATA>\n" +
+                            "    <StockRecordMessage>"
+            );bw.newLine();
+            // 注册号
+            String EMS_NO = "SJK1115";
+            // 注册序号
+            String EMS_SEQ_NO = "119000005430521";
+            // 仓储物料号
+            String WMS_MTS_NO = "TEMU9296408";
+            // 商品料号
+            String GOODS_MTS_NO = "TEMU9296408";
+            // 商品编码
+            String CODE_TS = "02032200";
+            // 商品名称
+            String GOODS_NAME = "冷冻带骨猪后腿0|3|冷冻|带骨|35.8千克/纸箱|P-20129";
+            // 商品规格型号
+            String GOODS_MODEL_DESC = "75CL";
+            // 申报计量单位
+            String WMS_DCL_UNIT = "吨";
+            // 申报数量
+            String WMS_DCL_QTY = "154";
+            // 法定单位
+            String WMS_LAW_UNIT = "吨";
+            // 法定数量
+            String WMS_LAW_QTY = "154";
+            // 库区号
+            String PLACE_IDS = "4";
+            // 库位号
+            String LOCATION_IDS = "4-01-01-1";
+            // 入库状态
+            String STOCK_STATUS = "0";
+            // 货物类型
+            String GOODS_TYPE = "1";
+            for (Map<String,Object> map : list) {
+                bw.write("      <StockInfo>\n" +
+                        "        <EmsNo>"+ EMS_NO +"</EmsNo>\n" +
+                        "        <EmsSeqNo>"+ EMS_SEQ_NO +"</EmsSeqNo>\n" +
+                        "        <WmsMtsNo>"+ map.get("fMblno") +"</WmsMtsNo>\n" +
+                        "        <GoodsMtsNo>"+ map.get("fMblno") +"</GoodsMtsNo>\n" +
+                        "        <CodeTs>"+ map.get("fGoodsno") +"</CodeTs>\n" +
+                        "        <GoodsName>"+ map.get("fGoodsids") +"</GoodsName>\n" +
+                        "        <GoodsModelDesc>"+ map.get("f_packagespecs") +"</GoodsModelDesc>\n" +
+                        "        <WmsDclUnit>"+ WMS_DCL_UNIT +"</WmsDclUnit>\n" +
+                        "        <WmsDclQty>"+ map.get("fQtyC") +"</WmsDclQty>\n" +
+                        "        <WmsLawUnit>"+ WMS_LAW_UNIT +"</WmsLawUnit>\n" +
+                        "        <WmsLawQty>"+ map.get("fQtyC") +"</WmsLawQty>\n" +
+                        "        <PlaceIds>"+ map.get("fWLID") +"</PlaceIds>\n" +
+                        "        <LocationIds>"+ map.get("fWarehouseids") +"</LocationIds>\n" +
+                        "        <StockStatus>"+ map.get("fLegStatus") +"</StockStatus>\n" +
+                        "        <GoodsType>"+ map.get("goodsPackageId") +"</GoodsType>\n" +
+                        "      </StockInfo>");
+                bw.newLine();
+            }
+            bw.write(
+                    "       <TradeCode>"+ TRADE_CODE +"</TradeCode>\n" +
+                            "       <TradeName>"+ TRADE_NAME +"</TradeName>\n" +
+                            "       <ApplyDate>"+ APPLY_DATE +"</ApplyDate>"
+            );bw.newLine();
+            // 理论申报单位
+            String DCL_UNIT = "035";
+            // 理论申报数量
+            String DCL_QTY = "154";
+            // 理论法定单位
+            String LAW_UNIT = "035";
+            // 理论法定数量
+            String LAW_QTY = "154";
+            for (Map<String,Object> map : list) {
+                bw.write(
+                        "       <SasStockInfo>\n" +
+                                "        <EmsNo>"+ EMS_NO +"</EmsNo>\n" +
+                                "        <EmsSeqNo>"+ EMS_SEQ_NO +"</EmsSeqNo>\n" +
+                                "        <CodeTs>"+ map.get("fGoodsno") +"</CodeTs>\n" +
+                                "        <GoodsName>"+ map.get("fGoodsids") +"</GoodsName>\n" +
+                                "        <GoodsModelDesc>"+ map.get("f_packagespecs") +"</GoodsModelDesc>\n" +
+                                "        <DclUnit>"+ DCL_UNIT +"</DclUnit>\n" +
+                                "        <DclQty>"+ map.get("fQtyC") +"</DclQty>\n" +
+                                "        <LawUnit>"+ map.get("fCorpid") +"</LawUnit>\n" +
+                                "        <LawQty>"+ map.get("fQtyC") +"</LawQty>\n" +
+                                "      </SasStockInfo>"
+                );
+                bw.newLine();
+            }
+            bw.write(
+                    "   </StockRecordMessage>\n" +
+                            "  </SDEPORT_DATA>\n" +
+                            "</XMLObject>"
+            );bw.newLine();
+            bw.close();
+            fw.close();
+            return AjaxResult.success(fileName);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return AjaxResult.error("导出分类监管数据失败");
+        }
+    }
+
+    /**
+     * 任意位置插入数据
+     * @param path
+     * @param points 指定的位置
+     * @param insertContent 待插入的内容
+     */
+    public void randomInsert(String path, long points, String insertContent) {
+        RandomAccessFile rw = null;
+        BufferedReader reader = null;
+        BufferedWriter writer = null;
+        File temp = null;
+        try {
+            rw = new RandomAccessFile(path,"rw");
+            // 创建临时文件
+            // prefix -- 前缀字符串定义的文件名;必须至少有三个字符长
+            // suffix -- 后缀字符串定义文件的扩展名;如果为null后缀".tmp" 将被使用
+            temp = File.createTempFile("save","null");
+            // 临时文件的读取
+            reader = new BufferedReader(new FileReader(temp));
+            // 临时文件的写入
+            writer = new BufferedWriter(new FileWriter(temp));
+            // 定位到 points,把后面的数据写入临时文件
+            rw.seek(points);
+            byte[] bytes = new byte[100];
+            int num = 0;
+            while ((num = rw.read(bytes)) != -1) {
+                // 将 pos 后面的内容写入临时文件
+                writer.write(new String(bytes, 0, num));
+            }
+            writer.flush();
+            rw.seek(points); // 定位到 points,将插入的内容和临时文件写入 rw
+            rw.write(insertContent.getBytes());
+            String amp = null;
+            while ((amp = reader.readLine()) != null) {
+                // 临时文件已被读取
+                rw.write(amp.getBytes());
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                writer.close();
+                reader.close();
+                rw.close();
+                temp.deleteOnExit();// 关闭流操作和删除临时文件
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    // 文件大小
+    public static long getFileSize(String filename) {
+        File file = new File(filename);
+        if (!file.exists() || !file.isFile()) {
+            return -1;
+        }
+        return file.length();
+    }
+
+    private String getAbsoluteFile(String fileName) {
+        String downloadPath = RuoYiConfig.getDownloadPath() + fileName;
+        File desc = new File(downloadPath);
+        if (!desc.getParentFile().exists()) {
+            desc.getParentFile().mkdirs();
+        }
+        return downloadPath;
+    }
+
     /**
      * 查询库存总账
      *

+ 12 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/excel/TWareHouseExcelItem.java

@@ -16,6 +16,10 @@ public class TWareHouseExcelItem {
     @Excel(name = "提单号")
     private String fMblno;
 
+    /** 业务编号 */
+    @Excel(name = "业务编号")
+    private String fSrcBillno;
+
     /** 业务日期 */
     @JsonFormat(pattern = "yyyy-MM-dd")
     @Excel(name = "业务日期", width = 30, dateFormat = "yyyy-MM-dd")
@@ -95,6 +99,14 @@ public class TWareHouseExcelItem {
     @Excel(name = "备注")
     private String fRemarks;
 
+    public String getfSrcBillno() {
+        return fSrcBillno;
+    }
+
+    public void setfSrcBillno(String fSrcBillno) {
+        this.fSrcBillno = fSrcBillno;
+    }
+
     public String getfId() {
         return fId;
     }

+ 1 - 0
ruoyi-warehouse/src/main/resources/mapper/finance/TFeeMapper.xml

@@ -1847,6 +1847,7 @@
                wi.f_qty              AS fBillingQty,
                wi.f_unitprice        AS fUnitprice,
                w.f_amt               AS fAmt,
+               w.f_src_billno        AS fSrcBillno,
                wi.f_business_type    AS fBusinessType,
                CASE
                    wi.f_billtype

+ 5 - 0
ruoyi-warehouse/src/main/resources/mapper/reportManagement/TWhgenlegMapper.xml

@@ -1071,6 +1071,11 @@
             ware.f_warehouse_information AS fWarehouseids,
             leg.f_mblno AS fMblno,
             goods.f_name AS fGoodsids,
+            goods.f_no AS fGoodsno,
+            goods.f_packageid AS goodsPackageId,
+            leg.f_qtyC AS fQtyC,
+            leg.f_warehouse_locationid AS fWLID,
+            leg.f_status AS fLegStatus,
             dict.dict_label AS fBusinessTypes,
             leg.f_marks AS fMarks,
             leg.f_qtyblc AS fQtyblc,

+ 29 - 1
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsMapper.xml

@@ -328,7 +328,11 @@
             bill.f_vslid AS fVslid,
             bill.f_voyid AS fVoyid,
             bill.f_storekeeper AS fStorekeeper,
-            bill.f_remarks_fees AS fRemarksFees
+            bill.f_remarks_fees AS fRemarksFees,
+            twfD.f_amount as fReceivable,
+            twfD.f_accamount as fRecycle,
+            twfC.f_amount as fDue,
+            twfC.f_accamount as fPay
         FROM
             t_warehousebills bill
             LEFT JOIN t_goods g ON g.f_id = bill.f_goodsid
@@ -343,6 +347,28 @@
             LEFT JOIN t_warehousebillsitems item ON item.f_pid = bill.f_id
             LEFT JOIN t_goods goods ON goods.f_id = item.f_goodsid
             LEFT JOIN sys_dict_data dictIn ON dictIn.dict_value = bill.f_business_type
+            LEFT JOIN (
+            SELECT
+            f_id,
+            f_pid,
+            SUM(f_amount) AS f_amount,
+            SUM(f_accamount) AS f_accamount
+            FROM
+            t_warehousebillsfees
+            WHERE f_dc = 'D'
+            GROUP BY f_pid
+            ) twfD ON twfD.f_pid = bill.f_id
+            LEFT JOIN (
+            SELECT
+            f_id,
+            f_pid,
+            SUM(f_amount) AS f_amount,
+            SUM(f_accamount) AS f_accamount
+            FROM
+            t_warehousebillsfees
+            WHERE f_dc = 'C'
+            GROUP BY f_pid
+            ) twfC ON twfC.f_pid = bill.f_id
         <where>
             <if test="fTypeid == null or fTypeid == ''">and bill.f_typeid IS NULL</if>
             <if test="fTypeid != null and fTypeid != ''">and bill.f_typeid = #{fTypeid}</if>
@@ -781,6 +807,7 @@
 
     <select id="selectInventorySJRKList" parameterType="TWarehousebills" resultType="Map">
         SELECT
+        leg.f_id AS fId,
         co.f_name AS fName,
         leg.f_shipper AS fShipper,
         it.f_bsdate AS fBsdate,
@@ -850,6 +877,7 @@
 
     <select id="selectInventorySJCKList" parameterType="TWarehousebills"  resultType="Map">
         SELECT
+            leg.f_id AS fId,
             co.f_name AS fName,
             leg.f_shipper AS fShipper,
             it.f_bsdate AS fBsdate,