From 557cda61a3c85a620335d28b9c0e1f0d482cd41e Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@63.com> Date: 星期四, 08 十二月 2022 15:58:39 +0800 Subject: [PATCH] # --- src/main/java/com/zy/common/service/erp/ErpService.java | 83 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 83 insertions(+), 0 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 a3439b2..4f03054 100644 --- a/src/main/java/com/zy/common/service/erp/ErpService.java +++ b/src/main/java/com/zy/common/service/erp/ErpService.java @@ -1,9 +1,20 @@ 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; +import com.zy.common.service.erp.entity.VoucherDetail; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Service; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; /** * Created by vincent on 2020/11/27 @@ -19,4 +30,76 @@ //////////////////////鎴愬搧銆佸師鏉愭枡鍏ュ簱閫氱煡鍗曟暟鎹彁鍙�////////////////////////////////////////////////// + /** + * 鑾峰彇GOODS琛� + */ + public List<Goods> selectGoods(Integer state) { + String sql = "select * from Goods where state = '" + state + "'"; + return erpSqlServer.select(sql, Goods.class); + } + + public List<VoucherDto> selectOrder(Integer state) { + List<VoucherDto> list = new ArrayList<>(); + List<Voucher> voucherList = this.selectVoucher(state); + if (!Cools.isEmpty(voucherList)) { + for (Voucher voucher : voucherList) { + List<VoucherDetail> voucherDetails = this.selectVoucherDetail(voucher.getVoucherID()); + if (!Cools.isEmpty(voucherDetails)) { + VoucherDto dto = new VoucherDto(); + list.add(dto); + dto.setVoucher(voucher); + dto.setDetails(voucherDetails); + } else { + log.error("{}鍗曟嵁鎵句笉鍒版槑缁嗭紝璇锋敞鎰忔鏌�", voucher.getVoucherID()); + } + } + } + return list; + } + + + /** + * 鑾峰彇Voucher琛� + */ + public List<Voucher> selectVoucher(Integer state) { + String sql = "select * from Voucher where state = '" + state + "'"; + return erpSqlServer.select(sql, Voucher.class); + } + + /** + * 鑾峰彇VoucherDetail琛� + */ + public List<VoucherDetail> selectVoucherDetail(String VoucherID) { + String sql = "select * from VoucherDetail where VoucherID = '" + VoucherID + "'"; + return erpSqlServer.select(sql, VoucherDetail.class); + } + + + /** + * 淇敼 Goods 琛� state + */ + public boolean updateStateForGoods(String barcode, Integer 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; + } + + /** + * 淇敼 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