From be175fe739e687cd1d45da58f2cb7dd0c36d001f Mon Sep 17 00:00:00 2001
From: jiazx0107@163.com <jiazx0107@163.com>
Date: 星期五, 11 八月 2023 11:48:10 +0800
Subject: [PATCH] 调整Pressure的接口包位置到COre中,然后增加modBus-TCP协议通讯报道

---
 igds-inout/src/main/java/com/ld/igds/inout/service/HInoutSettleService.java |  248 ++++++++++++++++++++++++++++--------------------
 1 files changed, 144 insertions(+), 104 deletions(-)

diff --git a/igds-inout/src/main/java/com/ld/igds/inout/service/HInoutSettleService.java b/igds-inout/src/main/java/com/ld/igds/inout/service/HInoutSettleService.java
index 6444a53..8d8c919 100644
--- a/igds-inout/src/main/java/com/ld/igds/inout/service/HInoutSettleService.java
+++ b/igds-inout/src/main/java/com/ld/igds/inout/service/HInoutSettleService.java
@@ -23,127 +23,167 @@
 
 @Component
 public class HInoutSettleService extends HibernateDao {
-	
-	
-	public void pageIoutRecord(Page<InoutRecord> page, InoutParam param) throws Exception {
-		String hql = " from " + InoutRecord.class.getName()
-				+ " where companyId =:companyId and progress =:progress";
-		Map<String, Object> args = new HashMap<String, Object>();
 
-		args.put("companyId", ContextUtil.getCompanyId());
-		args.put("progress", InoutConstant.PROGRESS_RECORD);
 
-		if (StringUtils.isNotEmpty(param.getType())) {
-			hql += " and type =:type";
-			args.put("type", param.getType());
-		}
+    public void pageIoutRecord(Page<InoutRecord> page, InoutParam param) throws Exception {
+        String hql = " from " + InoutRecord.class.getName()
+                + " where companyId =:companyId and progress =:progress";
+        Map<String, Object> args = new HashMap<String, Object>();
 
-		if (StringUtils.isNotEmpty(param.getId())) {
-			hql += " and id like:id";
-			args.put("id", "%" + param.getId() + "%");
-		}
+        args.put("companyId", ContextUtil.getCompanyId());
+        args.put("progress", InoutConstant.PROGRESS_RECORD);
 
-		if (StringUtils.isNotEmpty(param.getPlateNum())) {
-			hql += " and plateNum like:plateNum";
-			args.put("plateNum", "%" + param.getPlateNum() + "%");
-		}
+        if (StringUtils.isNotEmpty(param.getType())) {
+            hql += " and type =:type";
+            args.put("type", param.getType());
+        }
 
-		if (StringUtils.isNotEmpty(param.getCustomerId())) {
-			hql += " and customerId =:customerId";
-			args.put("customerId", param.getCustomerId());
-		}
+        if (StringUtils.isNotEmpty(param.getId())) {
+            hql += " and id like:id";
+            args.put("id", "%" + param.getId() + "%");
+        }
 
-		if (StringUtils.isNotEmpty(param.getDepotId())) {
-			hql += " and depotId =:depotId";
-			args.put("depotId", param.getDepotId());
-		}
+        if (StringUtils.isNotEmpty(param.getPlateNum())) {
+            hql += " and plateNum like:plateNum";
+            args.put("plateNum", "%" + param.getPlateNum() + "%");
+        }
 
-		if (StringUtils.isNotEmpty(param.getFoodVariety())) {
-			hql += " and foodVariety =:foodVariety";
-			args.put("foodVariety", param.getFoodVariety());
-		}
+        if (StringUtils.isNotEmpty(param.getCustomerId())) {
+            hql += " and customerId =:customerId";
+            args.put("customerId", param.getCustomerId());
+        }
 
-		if (StringUtils.isNotEmpty(param.getSettleTag())) {
-			hql += " and settleTag =:settleTag";
-			args.put("settleTag", param.getSettleTag());
-		}
+        if (StringUtils.isNotEmpty(param.getDepotId())) {
+            hql += " and depotId =:depotId";
+            args.put("depotId", param.getDepotId());
+        }
 
-		if (null != param.getStart()) {
-			hql += " and completeTime >=:start";
-			args.put("start", DateUtil.getCurZero(param.getStart()));
-		}
+        if (StringUtils.isNotEmpty(param.getFoodVariety())) {
+            hql += " and foodVariety =:foodVariety";
+            args.put("foodVariety", param.getFoodVariety());
+        }
 
-		if (null != param.getEnd()) {
-			hql += " and completeTime <=:end";
-			args.put("end", DateUtil.getNextZero(param.getEnd()));
-		}
 
-		hql += " and RECORD_STATUS_ <> 'ERROR' and RECORD_STATUS_ <> 'DEL'";
+        if (null != param.getStart()) {
+            hql += " and completeTime >=:start";
+            args.put("start", DateUtil.getCurZero(param.getStart()));
+        }
 
-		String countHql = " select count(*) " + hql;
-		
-		hql += " order by id desc ";
+        if (null != param.getEnd()) {
+            hql += " and completeTime <=:end";
+            args.put("end", DateUtil.getNextZero(param.getEnd()));
+        }
 
-		this.pagingQuery(page, hql, countHql, args);
-	}
+        hql += " and RECORD_STATUS_ <> 'ERROR' and RECORD_STATUS_ <> 'DEL'";
 
-	public InoutSettle getSettleById(String companyId, String id) {
-		String hql = " from " + InoutSettle.class.getName()
-				+ " where companyId=:companyId";
+        String countHql = " select count(*) " + hql;
 
-		Map<String, Object> args = new HashMap<String, Object>();
-		if (StringUtils.isEmpty(companyId)) {
-			companyId = ContextUtil.getCompanyId();
-		}
-		args.put("companyId", ContextUtil.getCompanyId());
-		if (StringUtils.isNotEmpty(id)) {
-			hql += " and id=:id";
-			args.put("id", id);
-		}
+        hql += " order by id desc ";
 
-		hql += " order by payTime desc";
-		List<InoutSettle> list = this.query(hql, args);
-		if (list != null && list.size() > 0) {
-			return list.get(0);
-		}
-		return null;
-	}
+        this.pagingQuery(page, hql, countHql, args);
+    }
 
-	
-	public String saveOrUpdateData(InoutSettle data) {
-		Session session = this.getSessionFactory().openSession();
-		
-		try {
-			if(null == data.getPayTime()){
-				data.setPayTime(new Date());
-			}
-			
-			if (null == data.getCompanyId()) {
-				data.setCompanyId(ContextUtil.getCompanyId());
-				session.save(data);
-			} else {
-				session.update(data);
-			}
-		} finally {
-			session.flush();
-			session.close();
-		}
-		return null;
-	}
+    public InoutSettle getSettleById(String companyId, String id) {
+        String hql = " from " + InoutSettle.class.getName()
+                + " where companyId=:companyId";
 
-	public void updateInoutRecordPay(String id) {
-		String hql = " update "+InoutRecord.class.getName() +" set settleTag=:settleTag where id=:id";
-		Session session = this.getSessionFactory().openSession();
-		try {
-			Query query = session.createQuery(hql);
-			query.setString("settleTag", Constant.YN_Y);
-			query.setString("id", id);
-			query.executeUpdate();
-		} finally {
-			session.flush();
-			session.close();
-		}
-	}
+        Map<String, Object> args = new HashMap<String, Object>();
+        if (StringUtils.isEmpty(companyId)) {
+            companyId = ContextUtil.getCompanyId();
+        }
+        args.put("companyId", ContextUtil.getCompanyId());
+        if (StringUtils.isNotEmpty(id)) {
+            hql += " and id=:id";
+            args.put("id", id);
+        }
 
-	
+        hql += " order by payTime desc";
+        List<InoutSettle> list = this.query(hql, args);
+        if (list != null && list.size() > 0) {
+            return list.get(0);
+        }
+        return null;
+    }
+
+
+    public String saveOrUpdateData(InoutSettle data) {
+        Session session = this.getSessionFactory().openSession();
+
+        try {
+            if (null == data.getPayTime()) {
+                data.setPayTime(new Date());
+            }
+
+            if (null == data.getCompanyId()) {
+                data.setCompanyId(ContextUtil.getCompanyId());
+                session.save(data);
+            } else {
+                session.update(data);
+            }
+        } finally {
+            session.flush();
+            session.close();
+        }
+        return null;
+    }
+
+    public void updateInoutRecordPay(String id) {
+        String hql = " update " + InoutRecord.class.getName() + " set settleTag=:settleTag where id=:id";
+        Session session = this.getSessionFactory().openSession();
+        try {
+            Query query = session.createQuery(hql);
+            query.setString("settleTag", Constant.YN_Y);
+            query.setString("id", id);
+            query.executeUpdate();
+        } finally {
+            session.flush();
+            session.close();
+        }
+    }
+
+    /**
+     * 鏍规嵁鏉′欢鍒嗛〉鑾峰彇缁撶畻淇℃伅
+     *
+     * @param page
+     * @param param
+     */
+    public void pageSettle(Page<InoutSettle> page, InoutParam param) throws Exception {
+        String hql = " from " + InoutSettle.class.getName()
+                + " where companyId =:companyId and deptId=:deptId";
+        Map<String, Object> args = new HashMap<>();
+
+        args.put("companyId", param.getCompanyId());
+        args.put("deptId", param.getDeptId());
+
+        if (StringUtils.isNotEmpty(param.getType())) {
+            hql += " and inoutType =:inoutType";
+            args.put("inoutType", param.getType());
+        }
+
+        if (StringUtils.isNotEmpty(param.getId())) {
+            hql += " and id like:id";
+            args.put("id", "%" + param.getId() + "%");
+        }
+
+        if (StringUtils.isNotEmpty(param.getDepotId())) {
+            hql += " and depotId =:depotId";
+            args.put("depotId", param.getDepotId());
+        }
+        if (null != param.getStart()) {
+            hql += " and payTime >=:start";
+            args.put("start", DateUtil.getCurZero(param.getStart()));
+        }
+        if (null != param.getEnd()) {
+            hql += " and payTime <=:end";
+            args.put("end", DateUtil.getNextZero(param.getEnd()));
+        }
+
+        String countHql = " select count(*) " + hql;
+
+        hql += " order by id desc ";
+
+        this.pagingQuery(page, hql, countHql, args);
+    }
+
+
 }

--
Gitblit v1.9.3