From 5790d7573a83278667878e0f73104f8fc8ec5cf3 Mon Sep 17 00:00:00 2001
From: sgj <1442489573@qq.com>
Date: 星期二, 10 三月 2026 11:03:51 +0800
Subject: [PATCH] 巡检统计信息纠正
---
fzzy-igdss-core/src/main/java/com/fzzy/igds/service/InoutRecordService.java | 746 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 729 insertions(+), 17 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 1c17e61..6413c9d 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,33 @@
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.FoodLevel;
+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,18 +44,25 @@
@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())){
+ if (StringUtils.isBlank(param.getCompanyId())) {
param.setCompanyId(ContextUtil.getCompanyId());
}
- if(StringUtils.isBlank(param.getDeptId())){
+ if (StringUtils.isBlank(param.getDeptId())) {
param.setDeptId(ContextUtil.subDeptId(null));
}
QueryWrapper<InoutRecord> queryWrapper = getQueryWrapper(param);
@@ -50,13 +71,14 @@
/**
* 鏌ヨ鏁版嵁闆嗗悎
+ *
* @param param
*/
public List<InoutRecord> listInout(InoutParam param) {
- if(StringUtils.isBlank(param.getCompanyId())){
+ if (StringUtils.isBlank(param.getCompanyId())) {
param.setCompanyId(ContextUtil.getCompanyId());
}
- if(StringUtils.isBlank(param.getDeptId())){
+ if (StringUtils.isBlank(param.getDeptId())) {
param.setDeptId(ContextUtil.subDeptId(null));
}
QueryWrapper<InoutRecord> queryWrapper = getQueryWrapper(param);
@@ -66,6 +88,7 @@
/**
* 灏佽鏌ヨ鏉′欢
+ *
* @param param
*/
public QueryWrapper<InoutRecord> getQueryWrapper(InoutParam param) {
@@ -74,7 +97,7 @@
queryWrapper.eq("company_id", param.getCompanyId());
}
if (StringUtils.isNotBlank(param.getDeptId())) {
- queryWrapper.eq("dept_id", param.getDeptId());
+ queryWrapper.likeRight("dept_id", param.getDeptId());
}
if (StringUtils.isNotBlank(param.getCustomerName())) {
queryWrapper.like("customer_name", param.getCustomerName());
@@ -84,7 +107,7 @@
queryWrapper.eq("id", param.getId());
}
if (StringUtils.isNotBlank(param.getPlateNum())) {
- queryWrapper.eq("plate_num", param.getPlateNum());
+ queryWrapper.like("plate_num", param.getPlateNum());
}
if (StringUtils.isNotBlank(param.getWeightTag())) {
//鏌ヨ寰呯О閲嶇殑
@@ -109,26 +132,53 @@
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()));
+ queryWrapper.ge("complete_time", DateUtil.getCurZero(param.getStart()));
}
if (null != param.getEnd()) {
- queryWrapper.le("create_time", DateUtil.getNextZero(param.getEnd()));
+ queryWrapper.le("complete_time", DateUtil.getNextZero(param.getEnd()));
}
- queryWrapper.eq("record_status", "NORMAL"); //姝e父鐘舵�佺殑鍗曞瓙
- queryWrapper.orderByDesc("create_time");
+ queryWrapper.ne("record_status", Constant.RECORD_STATUS_DEL); //涓嶆槸鍒犻櫎鐨勫崟瀛愶紝鍗虫甯哥殑鍗曞瓙
+ queryWrapper.orderByDesc("complete_time");
return queryWrapper;
}
+ /**
+ * 鏍规嵁鏃堕棿绫诲瀷锛岃幏鍙栧凡瀹屾垚鐨勬甯稿崟鎹�
+ *
+ * @param timeType
+ * @param param
+ * @return
+ */
+ public List<InoutRecord> getCompleteInoutByTime(String timeType, IgdsBaseParam param) {
+ if (StringUtils.isBlank(timeType)) {
+ return null;
+ }
+
+ 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())){
+ if (StringUtils.isBlank(param.getCompanyId())) {
param.setCompanyId(ContextUtil.getCompanyId());
}
QueryWrapper<InoutRecord> queryWrapper = getQueryWrapper(param);
@@ -138,6 +188,7 @@
/**
* 楠岃瘉杞︾墝鍙锋槸鍚﹀湪娴佺▼涓�
+ *
* @param companyId
* @param plateNum
* @return
@@ -151,9 +202,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;
}
/**
@@ -170,7 +288,7 @@
data.setId("R_" + id);
} else if (Constant.TYPE_OUT.equals(data.getType())) {
data.setId("C_" + id);
- }else {
+ } else {
data.setId("M_" + id);
}
}
@@ -181,9 +299,9 @@
int num = inoutRecordMapper.insert(data);
//TODO 鏇存柊缂撳瓨
- //updateInoutCache(data);
+
return num;
-
+
}
/**
@@ -205,7 +323,274 @@
}
/**
+ * 鏁版嵁淇敼锛屼繚鐣欎慨鏀硅褰�
+ *
+ * @param updateData
+ * @return
+ */
+ public int checkAndUpdate(InoutRecord updateData) {
+
+ //鑾峰彇鍘熸潵鐨勬暟鎹�
+ InoutParam param = new InoutParam();
+ param.setId(updateData.getId());
+ InoutRecord record = this.selectOne(param);
+
+ String updateLog = checkRemarks(updateData, record);
+ updateData.setUpdateLog(updateLog);
+
+ return updateInoutRecord(updateData);
+ }
+
+ /**
+ * 鏍¢獙淇敼淇℃伅
+ *
+ * @param updateData 淇敼鏁版嵁
+ * @param record 鍘熷鏁版嵁
+ * @return
+ */
+ public String checkRemarks(InoutRecord updateData, InoutRecord record) {
+
+ String updateLog0 = "銆�" + ContextUtil.getLoginUserName() + "銆戜簬[" + DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss") + "]淇敼鏁版嵁锛�";
+ String updateLog = "";
+
+ boolean updateTag = false;
+ //鏍¢獙浠撳簱淇℃伅
+ if (null != updateData.getDepotId() && null != record.getDepotId()) {
+ updateTag = !updateData.getDepotId().equals(record.getDepotId());
+ if (updateTag) {
+ updateLog += "[浠撳簱缂栫爜](" + record.getDepotId() + ")淇敼涓�(" + updateData.getDepotId() + "),";
+ }
+ }
+
+ //鏍¢獙鍝佺淇℃伅
+ if (null != updateData.getFoodVariety() && null != record.getFoodVariety()) {
+ updateTag = !updateData.getFoodVariety().equals(record.getFoodVariety());
+ if (updateTag) {
+ updateLog += "[鍝佺](" + FoodVariety.getMsg(record.getFoodVariety()) + ")淇敼涓�(" + FoodVariety.getMsg(updateData.getFoodVariety()) + "),";
+ }
+ }
+
+ //绮浜у湴
+ if (null != updateData.getFoodLocation() && null != record.getFoodLocation()) {
+ updateTag = !updateData.getFoodLocation().equals(record.getFoodLocation());
+ if (updateTag) {
+ updateLog += "[绮浜у湴](" + record.getFoodLocation() + ")淇敼涓�(" + updateData.getFoodLocation() + "),";
+ }
+ }
+
+ //绮绛夌骇
+ if (null != updateData.getFoodLevel() && null != record.getFoodLevel()) {
+ updateTag = !updateData.getFoodLevel().equals(record.getFoodLevel());
+ if (updateTag) {
+ updateLog += "[绮绛夌骇](" + FoodLevel.getMsg(record.getFoodLevel()) + ")淇敼涓�(" + FoodLevel.getMsg(updateData.getFoodLevel()) + "),";
+ }
+ }
+
+ //绮骞翠唤
+ if (null != updateData.getFoodYear() && null != record.getFoodYear()) {
+ updateTag = !updateData.getFoodYear().equals(record.getFoodYear());
+ if (updateTag) {
+ updateLog += "[绮骞翠唤](" + record.getFoodYear() + ")淇敼涓�(" + updateData.getFoodYear() + "),";
+ }
+ }
+
+ //鎵胯繍浜�
+ if (null != updateData.getUserName() && null != record.getUserName()) {
+ updateTag = !updateData.getUserName().equals(record.getUserName());
+ if (updateTag) {
+ updateLog += "[鎵胯繍浜篯(" + record.getUserName() + ")淇敼涓�(" + updateData.getUserName() + "),";
+ }
+ }
+
+ //鏍¢獙閫氱煡鍗曚俊鎭�
+ if (null != updateData.getNoticeId() && null != record.getNoticeId()) {
+ updateTag = !updateData.getNoticeId().equals(record.getNoticeId());
+ if (updateTag) {
+ updateLog += "[閫氱煡鍗曠紪鐮乚(" + record.getNoticeId() + ")淇敼涓�(" + updateData.getNoticeId() + "),";
+ }
+ }
+
+ //鏍¢獙寰�鏉ュ崟浣嶄俊鎭�
+ if (null != updateData.getCustomerName() && null != record.getCustomerName()) {
+ updateTag = !updateData.getCustomerName().equals(record.getCustomerName());
+ if (updateTag) {
+ updateLog += "[寰�鏉ュ崟浣峕(" + record.getCustomerName() + ")淇敼涓�(" + updateData.getCustomerName() + "),";
+ }
+ }
+
+ //鍗曚环
+ if (null != updateData.getPrice() && null != record.getPrice()) {
+ updateTag = !updateData.getPrice().equals(record.getPrice());
+ if (updateTag) {
+ updateLog += "[鍗曚环](" + record.getPrice() + ")淇敼涓�(" + updateData.getPrice() + "),";
+ }
+ }
+
+ //缁撶畻閲戦
+ if (null != updateData.getSettleMoney() && null != record.getSettleMoney()) {
+ updateTag = !updateData.getSettleMoney().equals(record.getSettleMoney());
+ if (updateTag) {
+ updateLog += "[缁撶畻閲戦](" + record.getSettleMoney() + ")淇敼涓�(" + updateData.getSettleMoney() + "),";
+ }
+ }
+
+ //姘村垎
+ if (null != updateData.getPerWet() && null != record.getPerWet()) {
+ updateTag = !updateData.getPerWet().equals(record.getPerWet());
+ if (updateTag) {
+ updateLog += "[姘村垎](" + record.getPerWet() + ")淇敼涓�(" + updateData.getPerWet() + "),";
+ }
+ }
+
+ //鏉傝川
+ if (null != updateData.getPerImpurity() && null != record.getPerImpurity()) {
+ updateTag = !updateData.getPerImpurity().equals(record.getPerImpurity());
+ if (updateTag) {
+ updateLog += "[鏉傝川](" + record.getPerImpurity() + ")淇敼涓�(" + updateData.getPerImpurity() + "),";
+ }
+ }
+
+ //姣涢噸
+ if (null != updateData.getFullWeight() && null != record.getFullWeight()) {
+ updateTag = !updateData.getFullWeight().equals(record.getFullWeight());
+ if (updateTag) {
+ updateLog += "[姣涢噸](" + record.getFullWeight() + ")淇敼涓�(" + updateData.getFullWeight() + "),";
+ }
+ }
+
+ //鐨噸
+ if (null != updateData.getEmptyWeight() && null != record.getEmptyWeight()) {
+ updateTag = !updateData.getEmptyWeight().equals(record.getEmptyWeight());
+ if (updateTag) {
+ updateLog += "[鐨噸](" + record.getEmptyWeight() + ")淇敼涓�(" + updateData.getEmptyWeight() + "),";
+ }
+ }
+
+ //鎵i噸
+ if (null != updateData.getDeOther() && null != record.getDeOther()) {
+ updateTag = !updateData.getDeOther().equals(record.getDeOther());
+ if (updateTag) {
+ updateLog += "[鎵i噸](" + record.getDeOther() + ")淇敼涓�(" + updateData.getDeOther() + "),";
+ }
+ }
+
+ //缁撶畻閲嶉噺
+ if (null != updateData.getSettleWeight() && null != record.getSettleWeight()) {
+ updateTag = !updateData.getSettleWeight().equals(record.getSettleWeight());
+ if (updateTag) {
+ updateLog += "[缁撶畻閲嶉噺](" + record.getSettleWeight() + ")淇敼涓�(" + updateData.getSettleWeight() + "),";
+ }
+ }
+
+ //鍑哄叆搴撻噸閲�
+ if (null != updateData.getRecordWeight() && null != record.getRecordWeight()) {
+ updateTag = !updateData.getRecordWeight().equals(record.getRecordWeight());
+ if (updateTag) {
+ updateLog += "[鍑哄叆搴撻噸閲廬(" + record.getRecordWeight() + ")淇敼涓�(" + updateData.getRecordWeight() + "),";
+ }
+ }
+
+ //鐧昏鏃堕棿
+ if (null != updateData.getRegisterTime() && null != record.getRegisterTime()) {
+ updateTag = !updateData.getRegisterTime().equals(record.getRegisterTime());
+ if (updateTag) {
+ updateLog += "[鐧昏鏃堕棿](" + DateFormatUtils.format(record.getRegisterTime(), "yyyy-MM-dd HH:mm:ss") + ")淇敼涓�(" + DateFormatUtils.format(updateData.getRegisterTime(), "yyyy-MM-dd HH:mm:ss") + "),";
+ }
+ }
+
+ //婊¤溅鏃堕棿
+ if (null != updateData.getFullWeightTime() && null != record.getFullWeightTime()) {
+ updateTag = !updateData.getFullWeightTime().equals(record.getFullWeightTime());
+ if (updateTag) {
+ updateLog += "[婊¤溅鏃堕棿](" + DateFormatUtils.format(record.getFullWeightTime(), "yyyy-MM-dd HH:mm:ss") + ")淇敼涓�(" + DateFormatUtils.format(updateData.getFullWeightTime(), "yyyy-MM-dd HH:mm:ss") + "),";
+ }
+ }
+
+ //绌鸿溅鏃堕棿
+ if (null != updateData.getEmptyWeightTime() && null != record.getEmptyWeightTime()) {
+ updateTag = !updateData.getEmptyWeightTime().equals(record.getEmptyWeightTime());
+ if (updateTag) {
+ updateLog += "[绌鸿溅鏃堕棿](" + DateFormatUtils.format(record.getEmptyWeightTime(), "yyyy-MM-dd HH:mm:ss") + ")淇敼涓�(" + DateFormatUtils.format(updateData.getEmptyWeightTime(), "yyyy-MM-dd HH:mm:ss") + "),";
+ }
+ }
+
+ //瀹屾垚鏃堕棿
+ if (null != updateData.getCompleteTime() && null != record.getCompleteTime()) {
+ updateTag = !updateData.getCompleteTime().equals(record.getCompleteTime());
+ if (updateTag) {
+ updateLog += "[瀹屾垚鏃堕棿](" + DateFormatUtils.format(record.getCompleteTime(), "yyyy-MM-dd HH:mm:ss") + ")淇敼涓�(" + DateFormatUtils.format(updateData.getCompleteTime(), "yyyy-MM-dd HH:mm:ss") + "),";
+ }
+ }
+
+ //婊¤溅绉伴噸浜�
+ if (null != updateData.getFullWeightUser() && null != record.getFullWeightUser()) {
+ updateTag = !updateData.getFullWeightUser().equals(record.getFullWeightUser());
+ if (updateTag) {
+ updateLog += "[婊¤溅绉伴噸浜篯(" + record.getFullWeightUser() + ")淇敼涓�(" + updateData.getFullWeightUser() + "),";
+ }
+ }
+
+ //绌鸿溅绉伴噸浜�
+ if (null != updateData.getEmptyWeightUser() && null != record.getEmptyWeightUser()) {
+ updateTag = !updateData.getEmptyWeightUser().equals(record.getEmptyWeightUser());
+ if (updateTag) {
+ updateLog += "[绌鸿溅绉伴噸浜篯(" + record.getEmptyWeightUser() + ")淇敼涓�(" + updateData.getEmptyWeightUser() + "),";
+ }
+ }
+
+ //澶囨敞璇存槑
+ if (null != updateData.getRemarks() && null != record.getRemarks()) {
+ updateTag = !updateData.getRemarks().equals(record.getRemarks());
+ if (updateTag) {
+ updateLog += "[澶囨敞璇存槑](" + record.getRemarks() + ")淇敼涓�(" + updateData.getRemarks() + "),";
+ }
+ }
+
+ if (StringUtils.isBlank(updateLog)) {
+ return record.getUpdateLog() == null ? "" : record.getUpdateLog();
+ }
+
+ updateLog0 = updateLog0 + updateLog;
+
+ return record.getUpdateLog() == null ? updateLog0 : (record.getUpdateLog() + "锛�" + updateLog0);
+ }
+
+ /**
+ * 寮傚父缁堟
+ *
+ * @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
@@ -269,6 +654,7 @@
/**
* 鏌ヨ鏈�澶d鍙凤紝涓虹┖鍒欒繑鍥瀗ull
+ *
* @param companyId
* @param timeKey
* @return
@@ -285,11 +671,337 @@
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_NEW;
+
+ 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", "");
+ 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:ss"));
+
+ 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());
+ htmlStr = htmlStr.replaceAll("createUser",ContextUtil.getLoginUserName());
+
+ return htmlStr;
+ }
+
+ /**
+ * 鑾峰彇鍑哄簱杩囩鍗�
+ *
+ * @param data
+ * @return
+ */
+ public String outWeightBill(InoutRecord data) {
+ // 鑾峰彇琛ㄥ崟鏁版嵁
+ InoutPrintBill bill = this.createBillData(data, "鍑哄簱鍗�");
+
+ //榛樿妯$増
+ String htmlStr = InoutBill.OUT_WEIGHT_DEFAULT_NEW;
+
+ 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", "");
+
+ 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:ss"));
+
+ htmlStr = htmlStr.replaceAll("weightUser", getValue(bill.getWeightUser()));
+ htmlStr = htmlStr.replace("handleUser", getValue(bill.getHandleUser()));
+ htmlStr = htmlStr.replaceAll("keeperName", getValue(bill.getKeeperUser()));
+ htmlStr = htmlStr.replaceAll("createUser",ContextUtil.getLoginUserName());
+
+ 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:ss"));
+
+ if (null == data.getCompleteTime()) {
+ data.setCompleteTime(new Date());
+ }
+ bill.setCompleteTime(DateFormatUtils.format(data.getCompleteTime(),
+ "yyyy-MM-dd HH:mm:ss"));
+
+ 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 ? "" : String.format("%.2f", 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