From db67639449287bcec461916a7dca6003ee5dd03c Mon Sep 17 00:00:00 2001
From: czt <czt18638530771@163.com>
Date: 星期五, 05 十二月 2025 16:27:18 +0800
Subject: [PATCH] 出入库详单及补单页面及逻辑
---
fzzy-igdss-core/src/main/java/com/fzzy/igds/service/InoutRecordService.java | 361 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 359 insertions(+), 2 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..21012e6 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,28 @@
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.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.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.text.DecimalFormat;
import java.util.Date;
import java.util.List;
@@ -29,6 +38,12 @@
@Resource
private InoutRecordMapper inoutRecordMapper;
+ @Resource
+ private FileService fileService;
+ @Resource
+ private SysDeptService sysDeptService;
+ @Resource
+ private DepotService depotService;
@Resource
private RedisCache redisCache;
@@ -84,7 +99,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())) {
//鏌ヨ寰呯О閲嶇殑
@@ -115,7 +130,9 @@
if (null != param.getEnd()) {
queryWrapper.le("create_time", DateUtil.getNextZero(param.getEnd()));
}
- queryWrapper.eq("record_status", "NORMAL"); //姝e父鐘舵�佺殑鍗曞瓙
+ queryWrapper.eq("record_status", Constant.RECORD_STATUS_NORMAL); //姝e父鐘舵�佺殑鍗曞瓙
+ queryWrapper.or();
+ queryWrapper.eq("record_status", Constant.RECORD_STATUS_ADD); //琛ュ綍鍗曞瓙鐨勫崟瀛�
queryWrapper.orderByDesc("create_time");
return queryWrapper;
@@ -152,8 +169,59 @@
queryWrapper.eq("plate_num", plateNum);
queryWrapper.ne("progress", Constant.PROGRESS_RECORD);
queryWrapper.eq("record_status", "NORMAL");
+ queryWrapper.or();
+ queryWrapper.eq("record_status", Constant.RECORD_STATUS_ADD); //琛ュ綍鍗曞瓙鐨勫崟瀛�
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 "淇濆瓨澶辫触锛�";
+ }
}
/**
@@ -202,6 +270,38 @@
//updateInoutCache(data);
return num;
+ }
+
+ /**
+ * 寮傚父缁堟
+ * @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 "鎿嶄綔澶辫触锛�";
+ }
}
/**
@@ -292,4 +392,261 @@
}
}
+ /**
+ * 鑾峰彇鍏ュ簱杩囩鍗曟暟鎹俊鎭�
+ *
+ * @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;
+ }
+
}
--
Gitblit v1.9.3