From e7cfae909181ab9e7ffacd0370b0ad9d4ad50123 Mon Sep 17 00:00:00 2001
From: YYC <1833023622@qq.com>
Date: 星期五, 30 六月 2023 20:15:09 +0800
Subject: [PATCH] 质检管理

---
 igds-inout/src/main/java/com/ld/igds/inout/manager/InoutReportManager.java |   70 ++++++++++++++++++++++++-----------
 1 files changed, 48 insertions(+), 22 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..e8e762e 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,11 @@
 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.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 +265,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 +272,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 +307,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 +335,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 (mark == FoodVariety.FOOD_VARIETY_WHEAT) {
+            htmlStr = InoutBill.IN_CHECK_WHEAT;
+        } else if (mark == FoodVariety.FOOD_VARIETY_PADDY) {
+            htmlStr = InoutBill.IN_CHECK_PADDY;
+        } else if (mark == FoodVariety.FOOD_VARIETY_CORN) {
+            htmlStr = InoutBill.IN_CHECK_CORN;
+        } else if (data.getFoodVariety() == FoodVariety.FOOD_VARIETY_SOYBEAN) {
+            htmlStr = InoutBill.IN_CHECK_SOYBEAN;
+        } else {
+            return "妯℃澘鏆傛湭纭畾锛侊紒";
+        }
+
 
         DefaultDept dept = sysDeptService.getCacheDept(data.getCompanyId(),
                 data.getDeptId());
@@ -367,24 +365,30 @@
         // 鏇挎崲鍩虹鏁版嵁
         String time = DateFormatUtils.format(data.getRegisterTime(),
                 "yyyy-MM-dd");
-        htmlStr = htmlStr.replace("time", time);
+//        htmlStr = htmlStr.replace("time", time);
         htmlStr = htmlStr.replace("customerName", data.getCustomerName());
         htmlStr = htmlStr.replace("serId", data.getId());
+        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());
         Depot depot = commonService.getCacheDepot(data.getCompanyId(), data.getDepotId());
+        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 ? "/" : data.getFoodLevel());
         Map<String, String> checkBillItems = getCheckBillItems();
         // 閬嶅巻鍖栭獙缁撴灉锛屽瓨鍏ap闆嗗悎涓�
         String key;
         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());
         }
 
@@ -717,6 +721,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 +759,6 @@
         List<String> strings3 = result.subList(6, 8);
         System.out.println(strings3);
     }
+
+
 }
\ No newline at end of file

--
Gitblit v1.9.3