From d210be88a9bccdc1c98d466c5dacbf14d7528711 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期五, 09 十二月 2022 14:52:45 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/common/service/erp/ErpService.java | 42 ++++++++++++++++++++++++++++++++++++++++--
1 files changed, 40 insertions(+), 2 deletions(-)
diff --git a/src/main/java/com/zy/common/service/erp/ErpService.java b/src/main/java/com/zy/common/service/erp/ErpService.java
index 8c17af7..91e38a9 100644
--- a/src/main/java/com/zy/common/service/erp/ErpService.java
+++ b/src/main/java/com/zy/common/service/erp/ErpService.java
@@ -1,6 +1,7 @@
package com.zy.common.service.erp;
import com.core.common.Cools;
+import com.core.common.DateUtils;
import com.zy.common.service.erp.dto.VoucherDto;
import com.zy.common.service.erp.entity.Goods;
import com.zy.common.service.erp.entity.Voucher;
@@ -12,6 +13,7 @@
import java.text.MessageFormat;
import java.util.ArrayList;
+import java.util.Date;
import java.util.List;
/**
@@ -34,6 +36,16 @@
public List<Goods> selectGoods(Integer state) {
String sql = "select * from Goods where state = '" + state + "'";
return erpSqlServer.select(sql, Goods.class);
+ }
+
+ public Goods selectGoodsOne(String barCode) {
+ String sql = "select top 1 * from Goods where BarCode = '" + barCode + "'";
+ List<Goods> select = erpSqlServer.select(sql, Goods.class);
+ if (Cools.isEmpty(select)) {
+ return null;
+ } else {
+ return select.get(0);
+ }
}
public List<VoucherDto> selectOrder(Integer state) {
@@ -77,10 +89,36 @@
* 淇敼 Goods 琛� state
*/
public boolean updateStateForGoods(String barcode, Integer state){
- String sql = "update Goods set State = ''{1}'' where BarCode = ''{0}''";
- sql = MessageFormat.format(sql, barcode, state);
+ String sql = "update Goods set State = ''{1}'', LastUpdatedDate = ''{2}'' where BarCode = ''{0}''";
+ sql = MessageFormat.format(sql, barcode, state, DateUtils.convert(new Date()));
return erpSqlServer.update(sql) > 0;
}
+ /**
+ * 淇敼 Goods 琛� state, location
+ */
+ public boolean updateStateAndLocForGoods(String barcode, Integer state, String loc){
+ String sql = "update Goods set State = ''{1}'', LastUpdatedDate = ''{2}'', Location = ''{3}'' where BarCode = ''{0}''";
+ sql = MessageFormat.format(sql, barcode, state, DateUtils.convert(new Date()), loc);
+ return erpSqlServer.update(sql) > 0;
+ }
+
+ /**
+ * 淇敼 Voucher 琛� state
+ */
+ public boolean updateStateForVoucher(String voucherID, Integer state){
+ String sql = "update Voucher set State = ''{1}'', LastUpdatedDate = ''{2}'' where VoucherID = ''{0}''";
+ sql = MessageFormat.format(sql, voucherID, state, DateUtils.convert(new Date()));
+ return erpSqlServer.update(sql) > 0;
+ }
+
+ /**
+ * 淇敼 VoucherDetail 琛�
+ */
+ public boolean updateTimeForVoucherDetail(String voucherID){
+ String sql = "update VoucherDetail set LastUpdatedDate = ''{1}'' where VoucherID = ''{0}''";
+ sql = MessageFormat.format(sql, voucherID, DateUtils.convert(new Date()));
+ return erpSqlServer.update(sql) > 0;
+ }
}
--
Gitblit v1.9.1