From 585e878b169bdeb2bc8cc452b9d2e640d00caa6d Mon Sep 17 00:00:00 2001
From: YYC <1833023622@qq.com>
Date: 星期二, 04 七月 2023 09:00:35 +0800
Subject: [PATCH] 质检报告

---
 igds-inout/src/main/java/com/ld/igds/inout/manager/InoutReportManager.java |  153 +++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 112 insertions(+), 41 deletions(-)

diff --git a/igds-inout/src/main/java/com/ld/igds/inout/manager/InoutReportManager.java b/igds-inout/src/main/java/com/ld/igds/inout/manager/InoutReportManager.java
index 99927be..39ad1ad 100644
--- a/igds-inout/src/main/java/com/ld/igds/inout/manager/InoutReportManager.java
+++ b/igds-inout/src/main/java/com/ld/igds/inout/manager/InoutReportManager.java
@@ -4,13 +4,12 @@
 import com.ld.igds.check.dto.CheckItemData;
 import com.ld.igds.check.service.CoreCheckStandardService;
 import com.ld.igds.common.CoreCommonService;
+import com.ld.igds.common.bar.BarCodeUtils;
+import com.ld.igds.constant.FoodLevel;
 import com.ld.igds.constant.FoodVariety;
 import com.ld.igds.inout.InoutBill;
 import com.ld.igds.inout.InoutConstant;
-import com.ld.igds.inout.dto.InoutData;
-import com.ld.igds.inout.dto.InoutRecordItemData;
-import com.ld.igds.inout.dto.InoutRecordItemParam;
-import com.ld.igds.inout.dto.WeightBill;
+import com.ld.igds.inout.dto.*;
 import com.ld.igds.inout.service.InoutRecordItemService;
 import com.ld.igds.m.dto.NoticeDto;
 import com.ld.igds.m.service.HInoutNoticeService;
@@ -267,7 +266,6 @@
         bill.setFullTime(DateFormatUtils.format(data.getFullWeightTime(),
                 "yyyy-MM-dd HH:mm:ss"));
         bill.setSerId(data.getId());
-//        bill.setSpecType(StringUtils.isEmpty(data.getSpecType()) ? "鏁g伯" : data.getSpecType());
         if ("5016".equals(data.getCompanyId())) {
             bill.setCompleteTime(DateFormatUtils.format(data.getCompleteTime(), "yyyy-MM-dd"));
             bill.setSerId(data.getId().substring(2));
@@ -275,7 +273,6 @@
         }
 
         //瀹㈡埛淇℃伅
-        // bill.setCustomerId(data.getCustomerId() == null ? "" : data.getCustomerId());
         bill.setCustomerName(data.getCustomerName() == null ? "" : data.getCustomerName());
         bill.setUserId(data.getUserId() == null ? "" : data.getUserId());
         bill.setUserAddress(data.getUserAddress() == null ? "" : data.getUserAddress());
@@ -311,19 +308,10 @@
         bill.setRecordWeight(data.getRecordWeight());
         bill.setCheckStatus(data.getCheckStatus().equals(InoutConstant.STATUS_PASS) ? "鍚堟牸" : "涓嶅悎鏍�");
 
-//        bill.setDeWet(data.getDeWet());
-//        bill.setDeImpurity(data.getDeImpurity());
         bill.setDeHandle(data.getDeHandle());
         bill.setDeOther(data.getDeOther());
-//        bill.setDeSum(data.getDeSum() == null ? 0.0 :data.getDeSum());
 
         bill.setSettleWeight(data.getSettleWeight());
-//        if(data.getWet() != null && data.getWet() > 0){
-//            bill.setWet(data.getWet() +"");
-//        }
-//        if(data.getImpurity() != null && data.getImpurity() > 0){
-//            bill.setImpurity(data.getImpurity()+"");
-//        }
 
         bill.setPrice(data.getPrice() == null ? "" : data.getPrice() + "");
         if (data.getSettleMoney() <= 0) {
@@ -348,15 +336,26 @@
         // 鑾峰彇鍖栭獙鏁版嵁
         List<CheckItemData> checkLst = data.getCheckItems();
         if (null == checkLst)
-            checkStandardService.getCheckItemById(data.getCheckId(),
-                    data.getCompanyId());
+            checkStandardService.getCheckItemById(data.getCheckId(), data.getCompanyId());
 
         if (checkLst == null || checkLst.size() < 1) {
             return "鏃犲寲楠屾暟鎹紝涓嶆墦鍗帮紒";
         }
-
+        String mark = data.getFoodVariety().substring(0, 3);
         // 璋冩暣妯$増鏁版嵁骞惰繑鍥�
-        String htmlStr = InoutBill.IN_CHECK_DEFAULT;
+        String htmlStr = "";
+        if (FoodVariety.FOOD_VARIETY_WHEAT.equals(mark)) {
+            htmlStr = InoutBill.IN_CHECK_WHEAT;
+        } else if (FoodVariety.FOOD_VARIETY_PADDY.equals(mark)) {
+            htmlStr = InoutBill.IN_CHECK_PADDY;
+        } else if (FoodVariety.FOOD_VARIETY_CORN.equals(mark)) {
+            htmlStr = InoutBill.IN_CHECK_CORN;
+        } else if (FoodVariety.FOOD_VARIETY_SOYBEAN.equals(data.getFoodVariety())) {
+            htmlStr = InoutBill.IN_CHECK_SOYBEAN;
+        } else {
+            return "妯℃澘鏆傛湭纭畾锛侊紒";
+        }
+
 
         DefaultDept dept = sysDeptService.getCacheDept(data.getCompanyId(),
                 data.getDeptId());
@@ -367,16 +366,34 @@
         // 鏇挎崲鍩虹鏁版嵁
         String time = DateFormatUtils.format(data.getRegisterTime(),
                 "yyyy-MM-dd");
-        htmlStr = htmlStr.replace("time", time);
+        String checkTime = data.getCheckTime() == null ? "-" : DateFormatUtils.format(data.getCheckTime(), "yyyy-MM-dd HH:mm:ss");
+        String sampleTime = data.getSampleTime() == null ? "-" : DateFormatUtils.format(data.getSampleTime(), "yyyy-MM-dd HH:mm:ss");
+        String reportTime = DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss");
+//        htmlStr = htmlStr.replace("time", time);
         htmlStr = htmlStr.replace("customerName", data.getCustomerName());
-        htmlStr = htmlStr.replace("serId", data.getId());
+        htmlStr = htmlStr.replace("serId", data.getId().substring(2));
+        htmlStr = htmlStr.replace("deptName", dept.getName());
         htmlStr = htmlStr.replace("foodVariety", FoodVariety.getMsg(data.getFoodVariety()));
         htmlStr = htmlStr.replace("plateNum", data.getPlateNum());
         htmlStr = htmlStr.replace("userName", data.getUserName());
-        htmlStr = htmlStr.replace("foodYear", data.getFoodYear() == null ? "/" : data.getFoodYear());
+        htmlStr = htmlStr.replace("foodYear", data.getFoodYear() == null ? "-" : data.getFoodYear());
         Depot depot = commonService.getCacheDepot(data.getCompanyId(), data.getDepotId());
-        htmlStr = htmlStr.replace("depotName", depot == null ? "/" : depot.getName());
-        htmlStr = htmlStr.replace("checkUser", data.getCheckUser() == null ? "/" : data.getCheckUser());
+        htmlStr = htmlStr.replace("storeKeeperName", depot == null ? "" : (depot.getStoreKeeperName() == null ? "" : depot.getStoreKeeperName()));
+        htmlStr = htmlStr.replace("depotName", depot == null ? "-" : depot.getName());
+        htmlStr = htmlStr.replace("checkUser", data.getCheckUser() == null ? "-" : data.getCheckUser());
+        htmlStr = htmlStr.replace("foodType", data.getFoodType() == null ? "-" : data.getFoodType());
+        htmlStr = htmlStr.replace("foodNumber", data.getSettleWeight() + "");
+        htmlStr = htmlStr.replace("checkNum", data.getDeCheck() + "");
+        htmlStr = htmlStr.replace("foodLocation", data.getFoodLocation() == null ? "-" : data.getFoodLocation());
+        htmlStr = htmlStr.replace("foodLevel", data.getFoodLevel() == null ? "-" : FoodLevel.getMsg(data.getFoodLevel()));
+        htmlStr = htmlStr.replace("hwmc", "");
+
+        htmlStr = htmlStr.replace("unit", "");
+        htmlStr = htmlStr.replace("sampleUser", data.getSampleUser() == null ? "-" : data.getSampleUser());
+        htmlStr = htmlStr.replace("checkTime", checkTime);
+        htmlStr = htmlStr.replace("sampleTime", sampleTime);
+        htmlStr = htmlStr.replace("bgcjsj", reportTime);
+        htmlStr = htmlStr.replace("remark", data.getRemarks() == null ? "鏃�" : data.getRemarks());
 
         Map<String, String> checkBillItems = getCheckBillItems();
         // 閬嶅巻鍖栭獙缁撴灉锛屽瓨鍏ap闆嗗悎涓�
@@ -384,7 +401,7 @@
         for (CheckItemData item : checkLst) {
             key = item.getStandardId() + "_ST";
             // checkBillItems.put(key, item.getStandardValue());
-            key = item.getStandardId() + "_VAL";
+//            key = item.getStandardId() + "_VAL";
             checkBillItems.put(key, item.getValue());
         }
 
@@ -409,44 +426,76 @@
      */
     private Map<String, String> getCheckBillItems() {
         Map<String, String> map = new HashMap<>();
-        map.put("C03_ST", "");
-        map.put("C03_VAL", "");
         map.put("C01_ST", "");
         map.put("C01_VAL", "");
         map.put("C02_ST", "");
         map.put("C02_VAL", "");
+        map.put("C03_ST", "");
+        map.put("C03_VAL", "");
+        map.put("C04_ST", "");
+        map.put("C04_VAL", "");
+        map.put("C05_ST", "");
+        map.put("C05_VAL", "");
+        map.put("C06_ST", "");
+        map.put("C06_VAL", "");
+        map.put("C07_ST", "");
+        map.put("C07_VAL", "");
+        map.put("C08_ST", "");
+        map.put("C08_VAL", "");
         map.put("C09_ST", "");
         map.put("C09_VAL", "");
+        map.put("C10_ST", "");
+        map.put("C10_VAL", "");
+        map.put("C11_ST", "");
+        map.put("C11_VAL", "");
+        map.put("C12_ST", "");
+        map.put("C12_VAL", "");
+        map.put("C13_ST", "");
+        map.put("C13_VAL", "");
+        map.put("C14_ST", "");
+        map.put("C14_VAL", "");
+        map.put("C15_ST", "");
+        map.put("C15_VAL", "");
+        map.put("C16_ST", "");
+        map.put("C16_VAL", "");
+        map.put("C17_ST", "");
+        map.put("C17_VAL", "");
+        map.put("C18_ST", "");
+        map.put("C18_VAL", "");
+        map.put("C19_ST", "");
+        map.put("C19_VAL", "");
+        map.put("C20_ST", "");
+        map.put("C20_VAL", "");
+        map.put("C21_ST", "");
+        map.put("C21_VAL", "");
         map.put("C22_ST", "");
         map.put("C22_VAL", "");
         map.put("C23_ST", "");
         map.put("C23_VAL", "");
-        map.put("C10_ST", "");
-        map.put("C10_VAL", "");
-        map.put("C04_ST", "");
-        map.put("C04_VAL", "");
         map.put("C24_ST", "");
         map.put("C24_VAL", "");
-        map.put("C08_ST", "");
-        map.put("C08_VAL", "");
-        map.put("C12_ST", "");
-        map.put("C12_VAL", "");
         map.put("C25_ST", "");
         map.put("C25_VAL", "");
-        map.put("C14_ST", "");
-        map.put("C14_VAL", "");
-        map.put("C29_ST", "");
-        map.put("C29_VAL", "");
-        map.put("C11_ST", "");
-        map.put("C11_VAL", "");
+        map.put("C26_ST", "");
+        map.put("C26_VAL", "");
         map.put("C27_ST", "");
         map.put("C27_VAL", "");
         map.put("C28_ST", "");
         map.put("C28_VAL", "");
+        map.put("C29_ST", "");
+        map.put("C29_VAL", "");
         map.put("C30_ST", "");
         map.put("C30_VAL", "");
         map.put("C31_ST", "");
         map.put("C31_VAL", "");
+        map.put("C32_ST", "");
+        map.put("C32_VAL", "");
+        map.put("C33_ST", "");
+        map.put("C33_VAL", "");
+        map.put("C34_ST", "");
+        map.put("C34_VAL", "");
+        map.put("C35_ST", "");
+        map.put("C35_VAL", "");
         return map;
     }
 
@@ -717,6 +766,26 @@
         return htmlStr;
     }
 
+    /**
+     * 鎵撳嵃鎵︽牱鍗曪紝鐩存帴杩斿洖鏉″舰鐮丅ase64鍥剧墖
+     *
+     * @param data
+     * @return
+     */
+    public String simpleBill(InoutCheckData data) {
+
+        if (null == data.getId()) return null;
+        if (null == data.getCheckId()) return null;
+
+        if (null == data.getCheckTime()) {
+            data.setCheckTime(new Date());
+        }
+
+        String imgBase64 = BarCodeUtils.getBarCodeImageBase64(data.getId(), data.getCheckId(), "绮鏍峰搧鍗曟潯鐮�", DateFormatUtils.format(data.getCheckTime(), "yyyy-MM-dd HH:mm"));
+
+        return imgBase64;
+    }
+
     public static void main(String[] args) {
         List<String> result = new ArrayList<>();
         result.add("1");
@@ -735,4 +804,6 @@
         List<String> strings3 = result.subList(6, 8);
         System.out.println(strings3);
     }
+
+
 }
\ No newline at end of file

--
Gitblit v1.9.3