From 164a53adaed58ad0519bc214b08c0bfb287723f4 Mon Sep 17 00:00:00 2001
From: czt <czt18638530771@163.com>
Date: 星期三, 21 一月 2026 14:40:45 +0800
Subject: [PATCH] 数据导入提交2

---
 fzzy-igdss-core/src/main/java/com/fzzy/igds/service/InoutRecordService.java |  543 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 524 insertions(+), 19 deletions(-)

diff --git a/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/InoutRecordService.java b/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/InoutRecordService.java
index 80327b4..7b8097e 100644
--- a/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/InoutRecordService.java
+++ b/fzzy-igdss-core/src/main/java/com/fzzy/igds/service/InoutRecordService.java
@@ -2,19 +2,32 @@
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fzzy.igds.bill.InoutBill;
 import com.fzzy.igds.constant.Constant;
+import com.fzzy.igds.constant.FoodVariety;
 import com.fzzy.igds.constant.RedisConst;
+import com.fzzy.igds.data.IgdsBaseParam;
+import com.fzzy.igds.data.InoutData;
 import com.fzzy.igds.data.InoutParam;
+import com.fzzy.igds.data.InoutPrintBill;
+import com.fzzy.igds.domain.Depot;
 import com.fzzy.igds.domain.InoutRecord;
 import com.fzzy.igds.mapper.InoutRecordMapper;
 import com.fzzy.igds.utils.ContextUtil;
 import com.fzzy.igds.utils.DateUtil;
+import com.fzzy.igds.utils.MoneyUtil;
+import com.fzzy.igds.utils.NumberUtil;
+import com.ruoyi.common.core.domain.entity.SysDept;
 import com.ruoyi.common.core.redis.RedisCache;
 import com.ruoyi.common.utils.StringUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.time.DateFormatUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
+
 import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.text.DecimalFormat;
 import java.util.Date;
 import java.util.List;
 
@@ -30,43 +43,81 @@
     @Resource
     private InoutRecordMapper inoutRecordMapper;
     @Resource
+    private FileService fileService;
+    @Resource
+    private SysDeptService sysDeptService;
+    @Resource
+    private DepotService depotService;
+    @Resource
     private RedisCache redisCache;
 
     /**
      * 鍒嗛〉鏌ヨ鏁版嵁
+     *
      * @param page
      * @param param
      */
     public void listPageInout(Page<InoutRecord> page, InoutParam param) {
+        if (StringUtils.isBlank(param.getCompanyId())) {
+            param.setCompanyId(ContextUtil.getCompanyId());
+        }
+        if (StringUtils.isBlank(param.getDeptId())) {
+            param.setDeptId(ContextUtil.subDeptId(null));
+        }
         QueryWrapper<InoutRecord> queryWrapper = getQueryWrapper(param);
         inoutRecordMapper.selectPage(page, queryWrapper);
     }
 
     /**
      * 鏌ヨ鏁版嵁闆嗗悎
+     *
      * @param param
      */
     public List<InoutRecord> listInout(InoutParam param) {
+        if (StringUtils.isBlank(param.getCompanyId())) {
+            param.setCompanyId(ContextUtil.getCompanyId());
+        }
+        if (StringUtils.isBlank(param.getDeptId())) {
+            param.setDeptId(ContextUtil.subDeptId(null));
+        }
         QueryWrapper<InoutRecord> queryWrapper = getQueryWrapper(param);
+
         return inoutRecordMapper.selectList(queryWrapper);
     }
 
     /**
      * 灏佽鏌ヨ鏉′欢
+     *
      * @param param
      */
     public QueryWrapper<InoutRecord> getQueryWrapper(InoutParam param) {
         QueryWrapper<InoutRecord> queryWrapper = new QueryWrapper<>();
-
-        param.setCompanyId(ContextUtil.getCompanyId());
-        param.setDeptId(ContextUtil.subDeptId(null));
-        queryWrapper.eq("company_id", param.getCompanyId());
-        queryWrapper.eq("dept_id", param.getDeptId());
+        if (StringUtils.isNotBlank(param.getCompanyId())) {
+            queryWrapper.eq("company_id", param.getCompanyId());
+        }
+        if (StringUtils.isNotBlank(param.getDeptId())) {
+            queryWrapper.likeRight("dept_id", param.getDeptId());
+        }
         if (StringUtils.isNotBlank(param.getCustomerName())) {
             queryWrapper.like("customer_name", param.getCustomerName());
         }
+
+        if (StringUtils.isNotBlank(param.getId())) {
+            queryWrapper.eq("id", param.getId());
+        }
+        if (StringUtils.isNotBlank(param.getPlateNum())) {
+            queryWrapper.like("plate_num", param.getPlateNum());
+        }
         if (StringUtils.isNotBlank(param.getWeightTag())) {
+            //鏌ヨ寰呯О閲嶇殑
             queryWrapper.likeRight("progress", param.getWeightTag());
+        }
+        if (StringUtils.isNotBlank(param.getProgressTag())) {
+            //鏈畬鎴愮殑
+            queryWrapper.ne("progress", param.getProgressTag());
+        }
+        if (StringUtils.isNotBlank(param.getProgress())) {
+            queryWrapper.eq("progress", param.getProgress());
         }
         if (StringUtils.isNotBlank(param.getFoodVariety())) {
             queryWrapper.eq("food_variety", param.getFoodVariety());
@@ -80,34 +131,62 @@
         if (StringUtils.isNotBlank(param.getType())) {
             queryWrapper.eq("type", param.getType());
         }
+        if (StringUtils.isNotBlank(param.getSettleTag())) {
+            queryWrapper.eq("settle_tag", param.getSettleTag());
+        }
         if (null != param.getStart()) {
             queryWrapper.ge("create_time", DateUtil.getCurZero(param.getStart()));
         }
         if (null != param.getEnd()) {
             queryWrapper.le("create_time", DateUtil.getNextZero(param.getEnd()));
         }
-        queryWrapper.eq("record_status", "NORMAL"); //姝e父鐘舵�佺殑鍗曞瓙
+        queryWrapper.ne("record_status", Constant.RECORD_STATUS_DEL); //涓嶆槸鍒犻櫎鐨勫崟瀛愶紝鍗虫甯哥殑鍗曞瓙
         queryWrapper.orderByDesc("create_time");
 
         return queryWrapper;
     }
 
-
     /**
-     * 鏍规嵁id鏌ヨ鏁版嵁
-     * @param id
+     * 鏍规嵁鏃堕棿绫诲瀷锛岃幏鍙栧凡瀹屾垚鐨勬甯稿崟鎹�
+     * @param timeType
+     * @param param
      * @return
      */
-    public InoutRecord selectById(String id) {
-        if(StringUtils.isBlank(id)){
-            return null;
-
+    public List<InoutRecord> getCompleteInoutByTime(String timeType, IgdsBaseParam param) {
+        if(StringUtils.isBlank(timeType)){
+             return null;
         }
-        return inoutRecordMapper.selectById(id);
+
+        QueryWrapper<InoutRecord> queryWrapper = new QueryWrapper<>();
+
+        queryWrapper.likeRight("dept_id", param.getDeptId());
+        queryWrapper.likeRight("progress", Constant.PROGRESS_RECORD); //宸插畬鎴愮殑鍗曟嵁
+        queryWrapper.ne("record_status", Constant.RECORD_STATUS_DEL); //涓嶆槸鍒犻櫎鐨勫崟瀛愶紝鍗虫甯哥殑鍗曞瓙
+        queryWrapper.ge(timeType, param.getStart());
+        queryWrapper.le(timeType, param.getEnd());
+        queryWrapper.orderByAsc("complete_time");
+
+        return inoutRecordMapper.selectList(queryWrapper);
+    }
+
+    /**
+     * 鏌ヨ鏁版嵁
+     *
+     * @param param
+     * @return
+     */
+    public InoutRecord selectOne(InoutParam param) {
+        if (StringUtils.isBlank(param.getCompanyId())) {
+            param.setCompanyId(ContextUtil.getCompanyId());
+        }
+        QueryWrapper<InoutRecord> queryWrapper = getQueryWrapper(param);
+
+        return inoutRecordMapper.selectOne(queryWrapper);
     }
 
     /**
      * 楠岃瘉杞︾墝鍙锋槸鍚﹀湪娴佺▼涓�
+     *
      * @param companyId
      * @param plateNum
      * @return
@@ -121,9 +200,76 @@
         queryWrapper.eq("company_id", companyId);
         queryWrapper.eq("plate_num", plateNum);
         queryWrapper.ne("progress", Constant.PROGRESS_RECORD);
-        queryWrapper.eq("record_status", "NORMAL");
 
         return inoutRecordMapper.selectCount(queryWrapper);
+    }
+
+    /**
+     * 鎵嬪姩琛ュ崟
+     *
+     * @param data
+     * @return
+     */
+    public String handAddInoutRecord(InoutData data) {
+
+        //琛ュ崟鏁版嵁鐩存帴鍒扮粨鏋滅姸鎬�
+        data.setRecordStatus(Constant.RECORD_STATUS_ADD);
+        data.setProgress(Constant.PROGRESS_RECORD);
+        if (null != data.getPerWet() && data.getPerWet() > 0) {
+            data.setCheckStatus(Constant.STATUS_CHECK);
+        }
+        String loginUser = ContextUtil.getLoginUserName();
+        if (StringUtils.isEmpty(data.getRegisterUser())) {
+            data.setRegisterUser(loginUser);
+        }
+        if (StringUtils.isEmpty(data.getFullWeightUser())) {
+            data.setFullWeightUser(loginUser);
+        }
+        if (StringUtils.isEmpty(data.getEmptyWeightUser())) {
+            data.setEmptyWeightUser(loginUser);
+        }
+        if (StringUtils.isEmpty(data.getHandleUser())) {
+            data.setHandleUser(loginUser);
+        }
+        if (StringUtils.isEmpty(data.getCompleteUser())) {
+            data.setCompleteUser(loginUser);
+        }
+
+        if (null == data.getCompleteTime()) {
+            data.setCompleteTime(new Date());
+        }
+
+        InoutRecord record = new InoutRecord();
+        BeanUtils.copyProperties(data, record);
+        //淇濆瓨
+        int num = this.addInoutRecord(record);
+
+        //闄勪欢澶勭悊
+        fileService.saveInoutFiles(data.getFiles(), record.getId(), null, "INOUT");
+
+        if (num > 0) {
+            return null;
+        } else {
+            return "淇濆瓨澶辫触锛�";
+        }
+    }
+
+    /**
+     * 鏂板鍑哄叆搴撹褰�
+     *
+     * @param list
+     * @return
+     */
+    public String addInoutRecordList(List<InoutRecord> list) {
+        if(null == list || list.isEmpty()){
+            return "鏂板澶辫触";
+        }
+
+        for (InoutRecord inoutRecord : list) {
+            addInoutRecord(inoutRecord);
+        }
+
+        return null;
     }
 
     /**
@@ -140,7 +286,7 @@
                 data.setId("R_" + id);
             } else if (Constant.TYPE_OUT.equals(data.getType())) {
                 data.setId("C_" + id);
-            }else {
+            } else {
                 data.setId("M_" + id);
             }
         }
@@ -153,7 +299,7 @@
         //TODO 鏇存柊缂撳瓨
         //updateInoutCache(data);
         return num;
-        
+
     }
 
     /**
@@ -175,7 +321,41 @@
     }
 
     /**
+     * 寮傚父缁堟
+     *
+     * @param data
+     * @return
+     */
+    public String errorInoutData(InoutRecord data) {
+
+        InoutParam param = new InoutParam();
+        param.setId(data.getId());
+        data = this.selectOne(param);
+        if (Constant.RECORD_STATUS_DEL.equals(data.getRecordStatus())) {
+            return "褰撳墠淇℃伅宸插仛寮傚父澶勭悊锛屼笉鏀寔閲嶅鎵ц锛�";
+        }
+
+        String msg = " 浜�" + DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm") + " 琚� " + ContextUtil.getLoginUserName() + " 鎵ц缁堟锛屽師鍥狅細" + data.getRemarks();
+
+        data.setRemarks(msg);
+        data.setProgress(Constant.PROGRESS_RECORD);
+        data.setRecordStatus(Constant.RECORD_STATUS_DEL);
+        data.setCompleteTime(new Date());
+
+        int i = this.updateInoutRecord(data);
+
+        //TODO 鍒犻櫎缂撳瓨
+
+        if (i > 0) {
+            return null;
+        } else {
+            return "鎿嶄綔澶辫触锛�";
+        }
+    }
+
+    /**
      * 鍑哄叆搴撴祦绋婭D鍒涘缓 202001030001 202001030001
+     *
      * @param registerTime
      * @param companyId
      * @return
@@ -239,6 +419,7 @@
 
     /**
      * 鏌ヨ鏈�澶d鍙凤紝涓虹┖鍒欒繑鍥瀗ull
+     *
      * @param companyId
      * @param timeKey
      * @return
@@ -255,11 +436,335 @@
         queryWrapper.orderByDesc("create_time");
 
         List<InoutRecord> inoutRecords = inoutRecordMapper.selectList(queryWrapper);
-        if(null == inoutRecords || inoutRecords.isEmpty()){
+        if (null == inoutRecords || inoutRecords.isEmpty()) {
             return null;
-        }else {
+        } else {
             return inoutRecords.get(0).getId();
         }
     }
 
+    /**
+     * 鑾峰彇鍏ュ簱杩囩鍗曟暟鎹俊鎭�
+     *
+     * @param data
+     * @return
+     */
+    public String inWeightBill(InoutRecord data) {
+
+        // 鑾峰彇琛ㄥ崟鏁版嵁
+        InoutPrintBill bill = this.createBillData(data, "鍏ュ簱鍒掔爜鍗�");
+
+        // 璋冩暣妯$増鏁版嵁骞惰繑鍥�
+        String htmlStr = InoutBill.IN_WEIGHT_DEFAULT;
+
+        htmlStr = htmlStr.replace("billTitle", bill.getBillTitle());
+
+        htmlStr = htmlStr.replace("registerTime", bill.getRegisterTime());
+        htmlStr = htmlStr.replace("completeTime", bill.getCompleteTime());
+        htmlStr = htmlStr.replace("fullTime", bill.getFullTime());
+        htmlStr = htmlStr.replace("emptyTime", bill.getEmptyTime());
+        htmlStr = htmlStr.replace("serId", bill.getSerId());
+
+        htmlStr = htmlStr.replace("customerName", bill.getCustomerName());
+        htmlStr = htmlStr.replace("deptName", bill.getUnitName());
+
+        htmlStr = htmlStr.replace("driverName", bill.getDriverName());
+        htmlStr = htmlStr.replace("userNumberId", bill.getUserId());
+        htmlStr = htmlStr.replace("userContact", bill.getUserContact());
+        htmlStr = htmlStr.replace("userAddress", bill.getUserAddress());
+        htmlStr = htmlStr.replace("foodVariety", bill.getFoodVariety());
+        htmlStr = htmlStr.replace("depotName", bill.getDepotName());
+        htmlStr = htmlStr.replace("foodLocation", bill.getFoodLocation());
+
+        htmlStr = htmlStr.replace("plateNum", bill.getPlateNum());
+        htmlStr = htmlStr.replace("fullWeight",
+                new DecimalFormat("0.00").format(bill.getFullWeight()));
+        htmlStr = htmlStr.replace("emptyWeight",
+                new DecimalFormat("0.00").format(bill.getEmptyWeight()));
+        htmlStr = htmlStr.replace("netWeight",
+                new DecimalFormat("0.00").format(bill.getNetWeight()));
+
+        htmlStr = htmlStr.replace("deImpurity", bill.getDeImpurity() + "");
+        htmlStr = htmlStr.replace("deWet", bill.getDeWet() + "");
+
+        htmlStr = htmlStr.replace("recordWeight", new DecimalFormat("0.00").format(bill.getRecordWeight()));
+        htmlStr = htmlStr.replace("deCheck", bill.getDeCheck() + "");
+        htmlStr = htmlStr.replace("addCheck", bill.getAddCheck() + "");
+
+        htmlStr = htmlStr.replace("deSum", bill.getDeSum() + "");
+        htmlStr = htmlStr.replace("settleWeight",
+                new DecimalFormat("0.00").format(bill.getSettleWeight()));
+
+        htmlStr = htmlStr.replace("dePackage", bill.getDePackage() + "");
+        htmlStr = htmlStr.replace("deHandle", bill.getDeHandle() + "");
+        htmlStr = htmlStr.replace("deOther", bill.getDeOther() + "");
+        htmlStr = htmlStr.replace("price", bill.getPrice());
+        htmlStr = htmlStr.replace("settleMoney", bill.getSettleMoney() + "");
+        htmlStr = htmlStr.replace("wet", bill.getWet() + "");
+        htmlStr = htmlStr.replace("impurity", bill.getImpurity() + "");
+
+        htmlStr = htmlStr.replace("checkStatus", bill.getCheckStatus());
+        htmlStr = htmlStr.replace("remark", bill.getRemark());
+        htmlStr = htmlStr.replace("moneyName", bill.getMoneyName());
+
+        htmlStr = htmlStr.replace("unitName", bill.getUnitName());
+        htmlStr = htmlStr.replace("time", bill.getRegisterTime());
+        htmlStr = htmlStr.replace("handleStart", "");
+        htmlStr = htmlStr.replace("handleEnd", "");
+        htmlStr = htmlStr.replace("noticeId", bill.getNoticeId() == null ? "" : bill.getNoticeId());
+        htmlStr = htmlStr.replace("phone", data.getUserContact() == null ? "" : data.getUserContact() + "");
+        htmlStr = htmlStr.replace("printTime", DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm"));
+
+        htmlStr = htmlStr.replaceAll("weightUser",
+                bill.getWeightUser() == null ? "" : bill.getWeightUser());
+        htmlStr = htmlStr.replaceAll("handleUser",
+                bill.getHandleUser() == null ? "" : bill.getHandleUser());
+        htmlStr = htmlStr.replaceAll("keeperName",
+                bill.getKeeperUser() == null ? "" : bill.getKeeperUser());
+
+
+        return htmlStr;
+    }
+
+    /**
+     * 鑾峰彇鍑哄簱杩囩鍗�
+     *
+     * @param data
+     * @return
+     */
+    public String outWeightBill(InoutRecord data) {
+        // 鑾峰彇琛ㄥ崟鏁版嵁
+        InoutPrintBill bill = this.createBillData(data, "鍑哄簱鍒掔爜鍗�");
+
+        //榛樿妯$増
+        String htmlStr = InoutBill.OUT_WEIGHT_DEFAULT;
+
+        htmlStr = htmlStr.replace("billTitle", bill.getBillTitle());
+
+        htmlStr = htmlStr.replace("registerTime", bill.getRegisterTime());
+        htmlStr = htmlStr.replace("completeTime", bill.getCompleteTime());
+        htmlStr = htmlStr.replace("fullTime", bill.getFullTime());
+        htmlStr = htmlStr.replace("emptyTime", bill.getEmptyTime());
+        htmlStr = htmlStr.replace("serId", bill.getSerId());
+
+        htmlStr = htmlStr.replace("customerName", bill.getCustomerName());
+        htmlStr = htmlStr.replace("deptName", bill.getUnitName());
+
+        htmlStr = htmlStr.replace("driverName", bill.getDriverName());
+        htmlStr = htmlStr.replace("userNumberId", bill.getUserId());
+        htmlStr = htmlStr.replace("userContact", bill.getUserContact());
+        htmlStr = htmlStr.replace("userAddress", bill.getUserAddress());
+        htmlStr = htmlStr.replace("foodVariety", bill.getFoodVariety());
+        htmlStr = htmlStr.replace("depotName", bill.getDepotName());
+        htmlStr = htmlStr.replace("foodLocation", bill.getFoodLocation());
+
+        htmlStr = htmlStr.replace("plateNum", bill.getPlateNum());
+        htmlStr = htmlStr.replace("fullWeight",
+                new DecimalFormat("0.00").format(bill.getFullWeight()));
+        htmlStr = htmlStr.replace("emptyWeight",
+                new DecimalFormat("0.00").format(bill.getEmptyWeight()));
+        htmlStr = htmlStr.replace("netWeight",
+                new DecimalFormat("0.00").format(bill.getNetWeight()));
+        htmlStr = htmlStr.replace("dePackage",
+                new DecimalFormat("0.00").format(bill.getDePackage()));
+        htmlStr = htmlStr.replace("remark", bill.getRemark());
+
+        htmlStr = htmlStr.replace("settleWeight",
+                new DecimalFormat("0.00").format(bill.getSettleWeight()));
+        htmlStr = htmlStr.replace("deHandle", bill.getDeHandle() + "");
+        htmlStr = htmlStr.replace("recordWeight", new DecimalFormat("0.00").format(bill.getRecordWeight()));
+        htmlStr = htmlStr.replace("deSum", bill.getDeSum() + "");
+        htmlStr = htmlStr.replace("deOther", bill.getDeOther() + "");
+        htmlStr = htmlStr.replace("price", bill.getPrice());
+        htmlStr = htmlStr.replace("settleMoney", bill.getSettleMoney() + "");
+        htmlStr = htmlStr.replace("wet", bill.getWet() + "");
+        htmlStr = htmlStr.replace("impurity", bill.getImpurity() + "");
+
+        htmlStr = htmlStr.replace("unitName", getValue(bill.getUnitName()));
+        htmlStr = htmlStr.replace("time", bill.getRegisterTime());
+        htmlStr = htmlStr.replace("handleStart", "");
+        htmlStr = htmlStr.replace("handleEnd", "");
+        htmlStr = htmlStr.replace("noticeId", bill.getNoticeId() == null ? "" : bill.getNoticeId());
+        htmlStr = htmlStr.replace("phone", data.getUserContact() == null ? "" : data.getUserContact() + "");
+        htmlStr = htmlStr.replace("printTime", DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm"));
+
+        htmlStr = htmlStr.replaceAll("weightUser", getValue(bill.getWeightUser()));
+        htmlStr = htmlStr.replace("handleUser", getValue(bill.getHandleUser()));
+        htmlStr = htmlStr.replaceAll("keeperName", getValue(bill.getKeeperUser()));
+        return htmlStr;
+    }
+
+
+    public String getValue(String value) {
+        if (null == value) return "";
+        return value;
+    }
+
+    /**
+     * 灏佽杩囩鍗曟暟鎹�
+     *
+     * @param data
+     * @param billTitle
+     * @return
+     */
+    private InoutPrintBill createBillData(InoutRecord data, String billTitle) {
+        InoutPrintBill bill = new InoutPrintBill();
+
+        bill.setBillTitle(billTitle);
+
+        SysDept dept = sysDeptService.getCacheDept(data.getCompanyId(), data.getDeptId());
+        if (null != dept && StringUtils.isNotEmpty(dept.getDeptName())) {
+            bill.setBillTitle(dept.getDeptName() + billTitle);
+            bill.setDeptId(dept.getDeptId() + "");
+            bill.setDeptName(dept.getDeptName() + "");
+            bill.setUnitName(dept.getDeptName());
+        }
+
+        bill.setCompanyId(data.getCompanyId() == null ? "" : data
+                .getCompanyId());
+        if (null == data.getRegisterTime()) {
+            data.setRegisterTime(new Date());
+        }
+        bill.setRegisterTime(DateFormatUtils.format(data.getRegisterTime(),
+                "yyyy-MM-dd HH:mm"));
+
+        if (null == data.getCompleteTime()) {
+            data.setCompleteTime(new Date());
+        }
+        bill.setCompleteTime(DateFormatUtils.format(data.getCompleteTime(),
+                "yyyy-MM-dd HH:mm"));
+
+        bill.setEmptyTime(DateFormatUtils.format(data.getEmptyWeightTime(),
+                "yyyy-MM-dd HH:mm:ss"));
+        bill.setFullTime(DateFormatUtils.format(data.getFullWeightTime(),
+                "yyyy-MM-dd HH:mm:ss"));
+        bill.setSerId(data.getId());
+        if ("5016".equals(data.getCompanyId()) || "5347".equals(data.getCompanyId()) || "5352".equals(data.getCompanyId())) {
+            bill.setCompleteTime(DateFormatUtils.format(data.getCompleteTime(), "yyyy-MM-dd"));
+            bill.setSerId(data.getId().substring(2));
+
+        }
+
+        //瀹㈡埛淇℃伅
+        bill.setCustomerName(data.getCustomerName() == null ? "" : data.getCustomerName());
+        bill.setUserId(data.getUserId() == null ? "" : data.getUserId());
+        bill.setUserAddress(data.getUserAddress() == null ? "" : data.getUserAddress());
+        bill.setUserContact(data.getUserContact() == null ? "" : data.getUserContact());
+
+
+        bill.setNoticeId(data.getNoticeId());
+
+
+        bill.setDriverName(data.getUserName() == null ? "" : data.getUserName());
+
+        // 鑾峰彇浠撳簱淇℃伅
+        Depot depot = depotService.getCacheDepot(data.getCompanyId(),
+                data.getDepotId());
+        if (depot != null) {
+            bill.setDepotName(depot.getName() == null ? "" : depot.getName());
+            bill.setHandleUser(depot.getStoreKeeperName() == null ? "" : depot
+                    .getStoreKeeperName());
+        }
+
+        bill.setFoodVariety(FoodVariety.getMsg(data.getFoodVariety()));
+        bill.setFoodLocation(data.getFoodLocation() == null ? "" : data
+                .getFoodLocation());
+        bill.setPlateNum(data.getPlateNum());
+
+        bill.setFullWeight(data.getFullWeight());
+        bill.setEmptyWeight(data.getEmptyWeight());
+        bill.setNetWeight(data.getNetWeight());
+        bill.setRecordWeight(data.getRecordWeight());
+        bill.setCheckStatus(data.getCheckStatus().equals(Constant.STATUS_CHECK) ? "鍚堟牸" : "涓嶅悎鏍�");
+
+        bill.setDeOther(data.getDeOther());
+        bill.setSettleWeight(data.getSettleWeight());
+
+        bill.setPrice(data.getPrice() == null ? "" : data.getPrice() + "");
+        if (data.getSettleMoney() <= 0) {
+            if (null != data.getPrice() && null != data.getRecordWeight()) {
+                data.setSettleMoney(NumberUtil.keepPrecision(data.getPrice() * data.getRecordWeight(), 2));
+            }
+        }
+        bill.setSettleMoney(data.getSettleMoney() == null ? "" : data.getSettleMoney() + "");
+        bill.setRemark(data.getRemarks() == null ? "" : data.getRemarks());
+
+        if (Constant.TYPE_IN.equals(data.getType())) {
+            bill.setWeightUser(data.getFullWeightUser());
+        }
+        if (Constant.TYPE_OUT.equals(data.getType())) {
+            bill.setWeightUser(data.getEmptyWeightUser());
+        }
+        bill.setHandleUser(data.getHandleUser());
+        bill.setKeeperUser(depot.getStoreKeeperName());
+        return bill;
+    }
+
+    /**
+     * 鑾峰彇缁撶畻鍗�
+     *
+     * @param
+     * @return
+     */
+    public String printPay(InoutRecord data) {
+
+        // 璋冩暣妯$増鏁版嵁骞惰繑鍥�
+        String htmlStr = InoutBill.IN_SETTLE_DEFAULT;
+        //鏍囬
+        //娓呰繙鍑哄彂璐у崟浣嶅強鏍囬锛屼娇鐢ㄥ叕鍙稿悕
+        String billTitle = data.getType().equals("IN") ? "鍏ュ簱缁撶畻鍗�" : "鍑哄簱缁撶畻鍗�";
+
+        htmlStr = htmlStr.replace("[billTitle]", billTitle);
+        //搴撳尯鍚嶇О
+        SysDept dept = sysDeptService.getCacheDept(data.getCompanyId(), data.getDeptId());
+        if (dept != null) {
+            htmlStr = htmlStr.replace("[deptId]", null == data.getDeptId() ? "" : dept.getDeptName());
+        } else {
+            htmlStr = htmlStr.replace("[deptId]", "");
+        }
+
+        //涓氬姟鍗曞彿
+        htmlStr = htmlStr.replace("[id]", data.getId());
+        //鎵撳嵃鏃堕棿
+        htmlStr = htmlStr.replace("[payTime]", null == data.getSettleTime() ? "" : DateFormatUtils.format(data.getSettleTime(), "yyyy骞碝M鏈坉d鏃�"));
+        //瀹㈡埛鍚嶇О
+        htmlStr = htmlStr.replace("[customerName]", null == data.getCustomerName() ? "" : data.getCustomerName());
+        //鎵胯繍浜�
+        htmlStr = htmlStr.replace("[userName]", null == data.getUserName() ? "" : data.getUserName());
+        //鎵胯繍浜鸿仈绯荤數璇�
+        htmlStr = htmlStr.replace("[userContact]", null == data.getUserContact() ? "" : data.getUserContact());
+        //鎵胯繍浜鸿韩浠借瘉鍙�
+        htmlStr = htmlStr.replace("[userId]", null == data.getUserId() ? "" : data.getUserId());
+        //鎵胯繍浜鸿溅鐗屽彿
+        htmlStr = htmlStr.replace("[plateNum]", null == data.getPlateNum() ? "" : data.getPlateNum());
+        //鑾峰彇浠撳簱淇℃伅
+        Depot depot = depotService.getCacheDepot(data.getCompanyId(), data.getDepotId());
+        if (null != depot) {
+            //璐т綅淇℃伅
+            htmlStr = htmlStr.replace("[depotId]", depot.getName());
+        }
+        //绮鍚嶇О
+        htmlStr = htmlStr.replace("[foodVariety]", null == data.getFoodVariety() ? "" : FoodVariety.getMsg(data.getFoodVariety()));
+
+        //澶囨敞
+        htmlStr = htmlStr.replace("[remark]", null == data.getRemarks() ? "" : data.getRemarks());
+        //姣涢噸
+        htmlStr = htmlStr.replace("[fullWeight]", null == data.getFullWeight() ? "" : String.format("%.2f", data.getFullWeight()));
+        //鐨噸
+        htmlStr = htmlStr.replace("[emptyWeight]", null == data.getEmptyWeight() ? "" : String.format("%.2f", data.getEmptyWeight()));
+        //鎵i噸
+        htmlStr = htmlStr.replace("[deOther]", null == data.getDeOther() ? "" : String.format("%.2f", data.getDeOther()));
+        //绮补浠锋牸
+        htmlStr = htmlStr.replace("[payPrice]", null == data.getPrice() ? "" : String.format("%.3f", data.getPrice()));
+        //缁撶畻閲嶉噺
+        htmlStr = htmlStr.replace("[settleWeight]", String.format("%.2f", data.getSettleWeight()));
+        //缁撶畻閲戦
+        htmlStr = htmlStr.replace("[payMoney]", null == data.getSettleMoney() ? "" : String.format("%.3f", data.getSettleMoney()));
+
+        //缁撶畻閲嶉噺鍚嶇О
+        htmlStr = htmlStr.replace("[payMoneyName]", MoneyUtil.formatToCN(new BigDecimal(String.format("%.2f", data.getSettleMoney()))));
+
+        return htmlStr;
+    }
+
 }

--
Gitblit v1.9.3