对接吉客云代码

This commit is contained in:
yuqh 2025-07-16 09:11:09 +08:00
parent b294f5e274
commit b24828951a
75 changed files with 3222 additions and 196 deletions

View File

@ -26,7 +26,7 @@ import javax.annotation.Resource;
* @Author xiangerlin
* @Date 2024/8/27 14:43
**/
@Component
//@Component
public class GenericEventSubscribe {
Logger logger = LoggerFactory.getLogger(getClass());

View File

@ -1,5 +1,6 @@
package com.hzya.frame.plugin.kjs.plugin;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.Jackyun.goodsdocin.service.IGoodsdocInService;
import com.hzya.frame.base.PluginBaseEntity;
@ -9,6 +10,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.util.Date;
/**
* @Description
* @Author xiangerlin
@ -95,8 +100,44 @@ public class JeckYunGoodsdocInToU8PluginInitializer extends PluginBaseEntity {
**/
@Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
logger.info("开始执行入库单推送U8单据");
String minDate = "";
String maxDate = "";
Date now = new Date();
//判断今天是否是周一周一在前
// 获取当前日期
LocalDate today = LocalDate.now();
// 获取星期几返回 DayOfWeek 枚举
DayOfWeek dayOfWeek = today.getDayOfWeek();
if (dayOfWeek.getValue() == 1) {//判断是否为周一如果为周一开始执行逻辑//todo dayOfWeek.getValue() == 1
logger.info("今天是周一");
Date fiveDaysAgo = DateUtil.offsetDay(now, -7);
Date fiveDaysAgoMax = DateUtil.offsetDay(now, -1);
minDate = DateUtil.format(fiveDaysAgo, "yyyy-MM-dd");
maxDate = DateUtil.format(fiveDaysAgoMax, "yyyy-MM-dd");
logger.info(minDate + " 00:00:00");
logger.info(maxDate + " 23:59:59");
requestJson.put("minDate", minDate+ " 00:00:00");
requestJson.put("maxDate", maxDate+ " 23:59:59");
logger.info("开始执行" + getPluginName() + requestJson.toString());
logger.info("开始执行今天是周一");
goodsdocInService.getJeckGoodsdocInToU8(requestJson);
}
//判断是否月底执行
boolean isLastDay = DateUtil.isSameDay(now, DateUtil.endOfMonth(now));
if (isLastDay) {
Date firstDayOfMonth = DateUtil.beginOfMonth(now);
minDate = DateUtil.format(firstDayOfMonth, "yyyy-MM-dd");
Date fiveDaysAgoMax = DateUtil.offsetDay(now, -1);
maxDate = DateUtil.format(fiveDaysAgoMax, "yyyy-MM-dd");
logger.info(minDate + " 00:00:00");
logger.info(maxDate + " 23:59:59");
logger.info("今天是本月最后一天");
requestJson.put("minDate", minDate+ " 00:00:00");
requestJson.put("maxDate", maxDate+ " 23:59:59");
logger.info("开始执行" + getPluginName() + requestJson.toString());
goodsdocInService.getJeckGoodsdocInToU8(requestJson);
}
return BaseResult.getSuccessMessageEntity("操作成功");
}
}

View File

@ -0,0 +1,161 @@
package com.hzya.frame.plugin.kjs.plugin;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.Jackyun.goodsdocin.service.IGoodsdocInService;
import com.hzya.frame.Jackyun.goodsdocout.service.IGoodsdocOutService;
import com.hzya.frame.base.PluginBaseEntity;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import java.time.LocalDate;
import java.util.Date;
/**
* @Description
* @Author xiangerlin
* @Date 2024/8/22 16:39
**/
public class JeckYunGoodsdocOutToU8PluginInitializer extends PluginBaseEntity {
Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private IGoodsdocOutService goodsdocOutService;
/***
* 插件初始化方法
* @Author 👻👻👻👻👻👻👻👻 gjh
* @Date 2023-08-02 10:48
* @Param []
* @return void
**/
@Override
public void initialize() {
logger.info(getPluginLabel() + "執行初始化方法initialize()");
}
/****
* 插件销毁方法
* @author 👻👻👻👻👻👻👻👻 gjh
* @date 2023-08-02 10:48
* @return void
**/
@Override
public void destroy() {
logger.info(getPluginLabel() + "執行銷毀方法destroy()");
}
/****
* 插件的ID
* @author 👻👻👻👻👻👻👻👻 gjh
* @date 2023-08-02 10:48
* @return void
**/
@Override
public String getPluginId() {
return "JeckYunGoodsdocOutToU8PluginInitializer";
}
/****
* 插件的名称
* @author 👻👻👻👻👻👻👻👻 gjh
* @date 2023-08-02 10:48
* @return void
**/
@Override
public String getPluginName() {
return "吉客云入库单同步WMS插件";
}
/****
* 插件的显示值
* @author 👻👻👻👻👻👻👻👻 gjh
* @date 2023-08-02 10:48
* @return void
**/
@Override
public String getPluginLabel() {
return "吉客云入库单同步WMS插件";
}
/***
* 插件类型 1场景插件
* @Author 👻👻👻👻👻👻👻👻 gjh
* @Date 2023-08-02 14:01
* @Param []
* @return java.lang.String
**/
@Override
public String getPluginType() {
return "1";
}
/***
* 执行业务代码
* @Author 👻👻👻👻👻👻👻👻 gjh
* @Date 2023-08-07 11:20
* @param requestJson 执行业务代码的参数
* @return void
**/
@Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
boolean flag = false;
String minDate = "";
String maxDate = "";
// Date now = new Date();
Date now = DateUtil.parse("2025-07-06 05:10:11");
boolean isLastDay = DateUtil.isSameDay(now, DateUtil.endOfMonth(now));
// isLastDay = true;
if (isLastDay) {
flag = true;
// 获取当月第一天
Date firstDayOfMonth = DateUtil.beginOfMonth(now);
// 获取上月最后一天
// Date lastDayOfPreviousMonth = DateUtil.endOfMonth(DateUtil.offsetMonth(now, -1));
// Date firstDayOfMonth = DateUtil.beginOfMonth(now);
// minDate = DateUtil.format(lastDayOfPreviousMonth, "yyyy-MM-dd");
Date fiveDaysAgoMax = DateUtil.offsetDay(now, -1);
maxDate = DateUtil.format(fiveDaysAgoMax, "yyyy-MM-dd");
minDate = DateUtil.format(now, "yyyy-MM"+"-26 ");
// requestJson.put("outDate", outDate+"-26 "+ "00:00:00");
logger.info(minDate + " 00:00:00");
logger.info(maxDate + " 23:59:59");
logger.info("今天是本月最后一天");
} else {
LocalDate today = LocalDate.now();
int dayOfMonth = today.getDayOfMonth();
dayOfMonth = 6;
boolean isTargetDate = (dayOfMonth == 6 || dayOfMonth == 11 ||
dayOfMonth == 16 || dayOfMonth == 21 ||
dayOfMonth == 26);
if(isTargetDate){
logger.info("今天是{}号",dayOfMonth);
flag = true;
Date fiveDaysAgo = null;
if(dayOfMonth == 6){
fiveDaysAgo = DateUtil.offsetDay(now, -6);
}else{
fiveDaysAgo = DateUtil.offsetDay(now, -5);
}
Date fiveDaysAgoMax = DateUtil.offsetDay(now, -1);
minDate = DateUtil.format(fiveDaysAgo, "yyyy-MM-dd");
maxDate = DateUtil.format(fiveDaysAgoMax, "yyyy-MM-dd");
logger.info(minDate + " 00:00:00");
logger.info(maxDate + " 23:59:59");
}
}
// requestJson.put("minDate", minDate+ " 00:00:00");
requestJson.put("minDate", "2025-07-01 00:00:00");
requestJson.put("maxDate", maxDate+ " 23:59:59");
if(flag){
logger.info("开始执行"+getPluginName()+requestJson.toString());
goodsdocOutService.getJeckGoodsdocOutToU8(requestJson);
}else{
logger.info("出库单今天不是指定日期");
}
return BaseResult.getSuccessMessageEntity("操作成功");
}
}

View File

@ -0,0 +1,109 @@
package com.hzya.frame.plugin.kjs.plugin;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.Jackyun.goodsdocin.service.IGoodsdocInService;
import com.hzya.frame.Jackyun.goodsdocout.service.IGoodsdocOutService;
import com.hzya.frame.base.PluginBaseEntity;
import com.hzya.frame.u8.delivery.service.IDeliveryOrderService;
import com.hzya.frame.u8.util.U8ResultEntity;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import java.time.LocalDate;
import java.util.Date;
/**
* @Description
* @Author xiangerlin
* @Date 2024/8/22 16:39
**/
public class U8DeliveryAutoOutPluginInitializer extends PluginBaseEntity {
Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private IDeliveryOrderService deliveryOrderService;
/***
* 插件初始化方法
* @Author 👻👻👻👻👻👻👻👻 gjh
* @Date 2023-08-02 10:48
* @Param []
* @return void
**/
@Override
public void initialize() {
logger.info(getPluginLabel() + "執行初始化方法initialize()");
}
/****
* 插件销毁方法
* @author 👻👻👻👻👻👻👻👻 gjh
* @date 2023-08-02 10:48
* @return void
**/
@Override
public void destroy() {
logger.info(getPluginLabel() + "執行銷毀方法destroy()");
}
/****
* 插件的ID
* @author 👻👻👻👻👻👻👻👻 gjh
* @date 2023-08-02 10:48
* @return void
**/
@Override
public String getPluginId() {
return "U8DeliveryAutoOutPluginInitializer";
}
/****
* 插件的名称
* @author 👻👻👻👻👻👻👻👻 gjh
* @date 2023-08-02 10:48
* @return void
**/
@Override
public String getPluginName() {
return "U8发货单自动出库";
}
/****
* 插件的显示值
* @author 👻👻👻👻👻👻👻👻 gjh
* @date 2023-08-02 10:48
* @return void
**/
@Override
public String getPluginLabel() {
return "U8发货单自动出库";
}
/***
* 插件类型 1场景插件
* @Author 👻👻👻👻👻👻👻👻 gjh
* @Date 2023-08-02 14:01
* @Param []
* @return java.lang.String
**/
@Override
public String getPluginType() {
return "1";
}
/***
* 执行业务代码
* @Author 👻👻👻👻👻👻👻👻 gjh
* @Date 2023-08-07 11:20
* @param requestJson 执行业务代码的参数
* @return void
**/
@Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
logger.info("开始执行"+getPluginName()+requestJson.toString());
U8ResultEntity res = deliveryOrderService.u8DeliveryAutoOut(requestJson);
return BaseResult.getSuccessMessageEntity("操作成功");
}
}

View File

@ -5,10 +5,12 @@ import cn.hutool.core.map.MapBuilder;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.plugin.kjs.service.IDeliveryOrderPluginService;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService;
import com.hzya.frame.u8.delivery.dao.IDeliveryOrderDao;
import com.hzya.frame.u8.delivery.dto.DeliveryDetailDTO;
import com.hzya.frame.u8.delivery.dto.DeliveryOrderDTO;
import com.hzya.frame.u8.delivery.entity.DeliveryDetailEntity;
@ -38,6 +40,8 @@ public class DeliveryOrderPluginServiceImpl extends KjsPluginBaseService impleme
private IDeliveryOrderService deliveryOrderService;
@Autowired
private IDeliveryDetaiService deliveryDetaiService;
@Autowired
private IDeliveryOrderDao deliveryOrderDao;
@Resource
private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
@ -97,7 +101,17 @@ public class DeliveryOrderPluginServiceImpl extends KjsPluginBaseService impleme
String body = HttpRequest.post("http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface").addHeaders(headerMap).body(reqParams).timeout(60000).execute().body();
//保存自定义项 标记推送状态
order.setDataSourceCode(datasourceCode);
//deliveryOrderService.saveExtradefine(order);
logger.info("发货单返回结果{}",body);
JSONObject responseJson = JSONObject.parseObject(body);
boolean responseFlag = responseJson.getBoolean("flag");
if(responseFlag){
order.setSync_flag("Y");
}else{
order.setSync_flag("N");
}
order.setSync_flag("Y");
logger.info("开始修改发货单更新后状态{}", JSONArray.toJSONString(order));
deliveryOrderDao.updateSengStatus(order);
if (StrUtil.isNotEmpty(body)){
JSONObject jsonObject = JSONObject.parseObject(body);
Boolean flag = jsonObject.getBoolean("flag");

View File

@ -1,34 +1,40 @@
#######################本地环境#######################
#######################dev环境#######################
logging:
#日志级别 指定目录级别
level:
root: info
root: INFO
encodings: UTF-8
file:
# 日志保存路径
path: /Users/xiangerlin/work/app/logs/yuecheng
path: D:\yongansystem\log
spring:
datasource:
dynamic:
datasource:
master:
url: jdbc:mysql://ufidahz.com.cn:9014/businesscenter_kjs?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
url: jdbc:mysql://192.168.2.58:3306/businesscenter_test?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=120000&autoReconnectForPools=true
username: root
password: 62e4295b615a30dbf3b8ee96f41c820b
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
savefile:
# 文件保存路径
path: /Users/xiangerlin/work/app/logs/yuecheng
path: D:\yongansystem\file
cbs8:
appId: 1Prpz
appSecret: 24bbe3a5abf39e1bea9cd3a
appId: 1P4AGrpz
appSecret: 2c2369ae5dc04382844bbe3a5abf39e1bea9cd3a
url: https://cbs8-openapi-reprd.csuat.cmburl.cn
# 测试用这个 这个是银行给的,和下面的公钥不是一对密钥
ya_private_key: 31FF9A51C1EFA520FC52AF828C2337F88E91CF119B07F44
ya_private_key: 83BA7EC821D35F4CB31FF9A51C1EFA520FC52AF828C2337F88E91CF119B07F44
# 这个私钥到时候上传到cbs和下面到是同一对
#ya_private_key: e1eacfdee9b8d4184437d5a2071e17ce31befc3d93395f9f05709ed562e8dc46
ya_public_key: 044fa399d2223760f17b81b864c4516f8a605dea1475ec09e720eaa98468715e5ad509a592a0b426061551c5a3df236966c23253a7d894eac0dcde
cbs_public_key: 0469146F06BF3B01236E84632441E826F30836A06007869CD351FBBE388B51F742859388BBC1DE089923AAFBC69E448F15141DDF30EE6CE90185
ya_public_key: 044fa399d2223760f17b81b863cb482b009294c4516f8a605dea1475ec09e720eaa98468715e5ad509a592a0b426061551c5a3df236966c23253a7d894eac0dcde
cbs_public_key: 0469146F06BF3B01236E84632441E826
#电子回单下载临时存放位置
elec_path: /Users/xiangerlin/Downloads/
OA:
data_source_code: yc_oa
zt:
url: http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface
dingtalk:
appKey: dingq3vbsswvyujiuwa7
appSecret: m4IRNcKQn-W9QBLERHWt0iW2hSirvxPS684xiNw-4QFMNg2gsBCur9T4QMvvAR4I

View File

@ -1,5 +1,5 @@
server:
port: 9999
port: 9990
servlet:
context-path: /kangarooDataCenterV3
localIP: 127.0.0.1
@ -57,22 +57,23 @@ spring:
maxWait: 60000 # 获取连接时最大等待时间单位毫秒。配置了maxWait之后缺省启用公平锁并发效率会有所下降如果需要可以通过配置
timeBetweenEvictionRunsMillis: 60000 # 关闭空闲连接的检测时间间隔.Destroy线程会检测连接的间隔时间如果连接空闲时间大于等于minEvictableIdleTimeMillis则关闭物理连接。
minEvictableIdleTimeMillis: 300000 # 连接的最小生存时间.连接保持空闲而不被驱逐的最小时间
max-evictable-idle-time-millis: 900000 # 添加最大空闲时间控制15分钟
validationQuery: SELECT 1 FROM DUAL # 验证数据库服务可用性的sql.用来检测连接是否有效的sql 因数据库方言而差, 例如 oracle 应该写成 SELECT 1 FROM DUAL
testWhileIdle: true # 申请连接时检测空闲时间,根据空闲时间再检测连接是否有效.建议配置为true不影响性能并且保证安全性。申请连接的时候检测如果空闲时间大于timeBetweenEvictionRun
testOnBorrow: false # 申请连接时直接检测连接是否有效.申请连接时执行validationQuery检测连接是否有效做了这个配置会降低性能。
testOnReturn: false # 归还连接时检测连接是否有效.归还连接时执行validationQuery检测连接是否有效做了这个配置会降低性能。
poolPreparedStatements: true # 开启PSCache
maxPoolPreparedStatementPerConnectionSize: 20 #设置PSCache值
connectionErrorRetryAttempts: 3 # 连接出错后再尝试连接三次
maxPoolPreparedStatementPerConnectionSize: 50 #设置PSCache值
connectionErrorRetryAttempts: 5 # 连接出错后再尝试连接三次
breakAfterAcquireFailure: true # 数据库服务宕机自动重连机制
timeBetweenConnectErrorMillis: 300000 # 连接出错后重试时间间隔
timeBetweenConnectErrorMillis: 10000 # 连接出错后重试时间间隔
asyncInit: true # 异步初始化策略
remove-abandoned: true # 是否自动回收超时连接
remove-abandoned-timeout: 1800 # 超时时间(以秒数为单位)
transaction-query-timeout: 6000 # 事务超时时间
remove-abandoned-timeout: 180 # 超时时间(以秒数为单位)
transaction-query-timeout: 600 # 事务超时时间
filters: stat,wall,log4j2
useGlobalDataSourceStat: true #合并多个DruidDataSource的监控数据
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000 #通过connectProperties属性来打开mergeSql功能慢SQL记录
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=2000 #通过connectProperties属性来打开mergeSql功能慢SQL记录
batch:
job:
enabled: false

View File

@ -17,5 +17,6 @@
<bean name="JeckYunGoodsdocOutBakPluginInitializer" class="com.hzya.frame.plugin.kjs.plugin.JeckYunGoodsdocOutBakPluginInitializer" />
<bean name="JeckYunGoodsdocInToU8PluginInitializer" class="com.hzya.frame.plugin.kjs.plugin.JeckYunGoodsdocInToU8PluginInitializer" />
<bean name="DingRobotPluginInitializer" class="com.hzya.frame.plugin.kjs.plugin.DingRobotPluginInitializer" />
<bean name="JeckYunGoodsdocOutToU8PluginInitializer" class="com.hzya.frame.plugin.kjs.plugin.JeckYunGoodsdocOutToU8PluginInitializer" />
</beans>

View File

@ -0,0 +1,14 @@
package com.hzya.frame.Jackyun.contrast.currency.dao;
import com.hzya.frame.basedao.dao.IBaseDao;
import com.hzya.frame.Jackyun.contrast.currency.entity.CurrencyEntity;
/**
* @description: 币种档案对照表 dao
* @tableName: contrast_currency
* @entityName: CurrencyEntity
* @author: gjh
* @history: 1.0
*/
public interface ICurrencyDao extends IBaseDao<CurrencyEntity , Long>{
}

View File

@ -0,0 +1,17 @@
package com.hzya.frame.Jackyun.contrast.currency.dao.impl;
import com.hzya.frame.Jackyun.contrast.currency.entity.CurrencyEntity;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import org.springframework.stereotype.Repository;
import com.hzya.frame.Jackyun.contrast.currency.dao.ICurrencyDao;
/**
* @description: 币种档案对照表 dao
* @tableName: contrast_currency
* @entityName: CurrencyEntity
* @author: gjh
* @history:1.0
*/
@Repository("contrast_currencydao")
public class CurrencyDaoImpl extends MybatisGenericDao<CurrencyEntity, Long> implements ICurrencyDao{
}

View File

@ -0,0 +1,65 @@
package com.hzya.frame.Jackyun.contrast.currency.entity;
import java.util.Date;
import com.hzya.frame.web.entity.BaseEntity;
/**
* @description: 币种档案对照表
* @tableName: contrast_currency
* @entityName: CurrencyEntity
* @author: gjh
* @history: 1.0
*/
public class CurrencyEntity extends BaseEntity {
/** 无备注 */
private String jeck_code;
/** 无备注 */
private String jeck_name;
/** 无备注 */
private String u8_code;
/** 无备注 */
private String u8_name;
/** 无备注 */
public void setJeck_code(String jeck_code) {
this.jeck_code = jeck_code;
}
/** 无备注 */
public String getJeck_code() {
return jeck_code;
}
/** 无备注 */
public void setJeck_name(String jeck_name) {
this.jeck_name = jeck_name;
}
/** 无备注 */
public String getJeck_name() {
return jeck_name;
}
/** 无备注 */
public void setU8_code(String u8_code) {
this.u8_code = u8_code;
}
/** 无备注 */
public String getU8_code() {
return u8_code;
}
/** 无备注 */
public void setU8_name(String u8_name) {
this.u8_name = u8_name;
}
/** 无备注 */
public String getU8_name() {
return u8_name;
}
}

View File

@ -0,0 +1,159 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hzya.frame.Jackyun.contrast.currency.entity.CurrencyEntity">
<resultMap id="get-CurrencyEntity-result" type="com.hzya.frame.Jackyun.contrast.currency.entity.CurrencyEntity">
<!--无备注 -->
<result property="jeck_code" column="jeck_code" />
<!--无备注 -->
<result property="jeck_name" column="jeck_name" />
<!--无备注 -->
<result property="u8_code" column="u8_code" />
<!--无备注 -->
<result property="u8_name" column="u8_name" />
</resultMap>
<sql id="CurrencyEntity_Base_Column_List">
jeck_code,
jeck_name,
u8_code,
u8_name
</sql>
<!--通过ID获取数据 -->
<select id="CurrencyEntity_get" resultMap="get-CurrencyEntity-result">
select
<include refid="CurrencyEntity_Base_Column_List" />
from contrast_currency where id = #{ id } and sts='Y'
</select>
<!-- 查询 采用==查询 -->
<select id="CurrencyEntity_list_base" resultMap="get-CurrencyEntity-result" parameterType="com.hzya.frame.Jackyun.contrast.currency.entity.CurrencyEntity">
select
<include refid="CurrencyEntity_Base_Column_List" />
from contrast_currency
<trim prefix="where" prefixOverrides="and">
<if test="jeck_code != null and jeck_code !='' ">jeck_code = #{jeck_code} </if>
<if test="jeck_name != null and jeck_name !='' "> and jeck_name = #{jeck_name}</if>
<if test="u8_code != null and u8_code !='' "> and u8_code = #{u8_code}</if>
<if test="u8_name != null and u8_name !='' "> and u8_name = #{u8_name}</if>
and sts='Y'
</trim>
<if test=" sort =='' "> order by id desc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
<!-- 查询符合条件的数量 -->
<select id="CurrencyEntity_count" resultType="Integer" parameterType="com.hzya.frame.Jackyun.contrast.currency.entity.CurrencyEntity">
select count(1) from contrast_currency
<trim prefix="where" prefixOverrides="and">
<if test="jeck_code != null and jeck_code !='' ">jeck_code = #{jeck_code} </if>
<if test="jeck_name != null and jeck_name !='' "> and jeck_name = #{jeck_name} </if>
<if test="u8_code != null and u8_code !='' "> and u8_code = #{u8_code} </if>
<if test="u8_name != null and u8_name !='' "> and u8_name = #{u8_name} </if>
and sts='Y'
</trim>
<if test=" sort =='' "> order by id desc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null "> order by ${sort} ${order}</if>
</select>
<!-- 分页查询列表 采用like格式 -->
<select id="CurrencyEntity_list_like" resultMap="get-CurrencyEntity-result" parameterType="com.hzya.frame.Jackyun.contrast.currency.entity.CurrencyEntity">
select
<include refid="CurrencyEntity_Base_Column_List" />
from contrast_currency
<trim prefix="where" prefixOverrides="and">
<if test="jeck_code != null and jeck_code !='' "> jeck_code like concat('%',#{jeck_code},'%') </if>
<if test="jeck_name != null and jeck_name !='' "> and jeck_name like concat('%',#{jeck_name},'%') </if>
<if test="u8_code != null and u8_code !='' "> and u8_code like concat('%',#{u8_code},'%') </if>
<if test="u8_name != null and u8_name !='' "> and u8_name like concat('%',#{u8_name},'%') </if>
and sts='Y'
</trim>
<if test=" sort =='' "> order by id desc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
<!-- 查询列表 字段采用or格式 -->
<select id="CurrencyEntity_list_or" resultMap="get-CurrencyEntity-result" parameterType="com.hzya.frame.Jackyun.contrast.currency.entity.CurrencyEntity">
select
<include refid="CurrencyEntity_Base_Column_List" />
from contrast_currency
<trim prefix="where" prefixOverrides="or">
<if test="jeck_code != null and jeck_code !='' ">jeck_code = #{jeck_code} </if>
<if test="jeck_name != null and jeck_name !='' "> or jeck_name = #{jeck_name} </if>
<if test="u8_code != null and u8_code !='' "> or u8_code = #{u8_code} </if>
<if test="u8_name != null and u8_name !='' "> or u8_name = #{u8_name} </if>
and sts='Y'
</trim>
<if test=" sort =='' "> order by id desc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
<!-- 新增 -->
<insert id="CurrencyEntity_insert" parameterType="com.hzya.frame.Jackyun.contrast.currency.entity.CurrencyEntity">
insert into contrast_currency(
<trim suffix="" suffixOverrides=",">
<if test="jeck_code != null and jeck_code !='' "> jeck_code, </if>
<if test="jeck_name != null and jeck_name !='' "> jeck_name, </if>
<if test="u8_code != null and u8_code !='' "> u8_code, </if>
<if test="u8_name != null and u8_name !='' "> u8_name, </if>
create_time,
modify_time,
sts
</trim>
)values
(
<trim suffix="" suffixOverrides=",">
<if test="jeck_code != null and jeck_code !='' "> #{jeck_code}, </if>
<if test="jeck_name != null and jeck_name !='' "> #{jeck_name}, </if>
<if test="u8_code != null and u8_code !='' "> #{u8_code}, </if>
<if test="u8_name != null and u8_name !='' "> #{u8_name}, </if>
<if test="create_time != null "> #{create_time} ,</if>
<if test="create_time == null "> now(),</if>
<if test="modify_time != null "> #{modify_time},</if>
<if test="modify_time == null "> now(),</if>
'Y'
</trim>
)
<selectKey keyProperty="id" resultType="Long" order="AFTER">
select
last_insert_id() as id
</selectKey>
</insert>
<!-- 修改 -->
<update id="CurrencyEntity_update" parameterType="com.hzya.frame.Jackyun.contrast.currency.entity.CurrencyEntity">
update contrast_currency set
<trim suffix="" suffixOverrides=",">
<if test="jeck_code != null and jeck_code !='' "> jeck_code = #{jeck_code},</if>
<if test="jeck_name != null and jeck_name !='' "> jeck_name = #{jeck_name},</if>
<if test="u8_code != null and u8_code !='' "> u8_code = #{u8_code},</if>
<if test="u8_name != null and u8_name !='' "> u8_name = #{u8_name},</if>
<if test="modify_time != null "> modify_time =#{modify_time} </if>
<if test="modify_time == null "> modify_time = now()</if>
</trim>
where id = #{id}
</update>
<!-- 逻辑删除 -->
<update id="CurrencyEntity_logicDelete" parameterType="com.hzya.frame.Jackyun.contrast.currency.entity.CurrencyEntity">
update contrast_currency set
sts='N',modify_time = now(),modify_user_id = #{modify_user_id} where
id = #{id}
</update>
<!-- 逻辑删除多条件 -->
<update id="CurrencyEntity_logicDelete_Multi_Condition" parameterType="com.hzya.frame.Jackyun.contrast.currency.entity.CurrencyEntity">
update contrast_currency set
sts='N',modify_time = now(),modify_user_id = #{modify_user_id}
<trim prefix="where" prefixOverrides="and">
<if test="jeck_code != null and jeck_code !='' ">jeck_code = #{jeck_code} </if>
<if test="jeck_name != null and jeck_name !='' "> and jeck_name = #{jeck_name}</if>
<if test="u8_code != null and u8_code !='' "> and u8_code = #{u8_code}</if>
<if test="u8_name != null and u8_name !='' "> and u8_name = #{u8_name}</if>
</trim>
</update>
<!-- 物理删除 -->
<delete id="CurrencyEntity_delete" parameterType="com.hzya.frame.Jackyun.contrast.currency.entity.CurrencyEntity">
delete from contrast_currency where id =#{id}
</delete>
</mapper>

View File

@ -0,0 +1,14 @@
package com.hzya.frame.Jackyun.contrast.currency.service;
import com.hzya.frame.Jackyun.contrast.currency.entity.CurrencyEntity;
import com.hzya.frame.basedao.service.IBaseService;
/**
* @description: 币种档案对照表 service
* @tableName: contrast_currency
* @entityName: CurrencyEntity
* @author: gjh
* @history: 1.0
*/
public interface ICurrencyService extends IBaseService<CurrencyEntity,Long> {
}

View File

@ -0,0 +1,18 @@
package com.hzya.frame.Jackyun.contrast.currency.service.impl;
import com.hzya.frame.basedao.service.impl.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hzya.frame.Jackyun.contrast.currency.entity.CurrencyEntity;
import com.hzya.frame.Jackyun.contrast.currency.service.ICurrencyService;
import com.hzya.frame.Jackyun.contrast.currency.dao.ICurrencyDao;
/**
* @description: 币种档案对照表 service
* @tableName: contrast_currency
* @entityName: CurrencyEntity
* @author: gjh
* @history: 1.0
*/
@Service(value="contrast_currencyService")
public class CurrencyServiceImpl extends BaseService< CurrencyEntity,Long> implements ICurrencyService{
}

View File

@ -0,0 +1,19 @@
package com.hzya.frame.Jackyun.contrast.customer.dao;
import com.hzya.frame.Jackyun.contrast.customer.entity.CustomerEntity;
import com.hzya.frame.basedao.dao.IBaseDao;
import java.util.List;
/**
* @description: 客户账套对照表 dao
* @tableName: contrast_customer
* @entityName: CustomerEntity
* @author: gjh
* @history: 1.0
*/
public interface ICustomerDao extends IBaseDao<CustomerEntity , Long> {
List<CustomerEntity> queryListByJeckYun(CustomerEntity cust);
List<CustomerEntity> quertInvTest(String code);
}

View File

@ -0,0 +1,33 @@
package com.hzya.frame.Jackyun.contrast.customer.dao.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.Jackyun.contrast.customer.entity.CustomerEntity;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import org.springframework.stereotype.Repository;
import com.hzya.frame.Jackyun.contrast.customer.dao.ICustomerDao;
import java.util.List;
/**
* @description: 客户账套对照表 dao
* @tableName: contrast_customer
* @entityName: CustomerEntity
* @author: gjh
* @history:1.0
*/
@Repository("contrast_customerdao")
public class CustomerDaoImpl extends MybatisGenericDao<CustomerEntity, Long> implements ICustomerDao{
@DS("jeckYun")
@Override
public List<CustomerEntity> queryListByJeckYun(CustomerEntity cust) {
return (List<CustomerEntity>) selectList("com.hzya.frame.Jackyun.contrast.customer.entity.CustomerEntity.CustomerEntity_list_base",cust);
}
@DS("YONYOUU8")
@Override
public List<CustomerEntity> quertInvTest(String code) {
CustomerEntity cust = new CustomerEntity();
cust.setU8_code(code);
return (List<CustomerEntity>) selectList("com.hzya.frame.Jackyun.contrast.customer.entity.CustomerEntity.CustomerEntity_list_test",cust);
}
}

View File

@ -0,0 +1,77 @@
package com.hzya.frame.Jackyun.contrast.customer.entity;
import java.util.Date;
import com.hzya.frame.web.entity.BaseEntity;
/**
* @description: 客户账套对照表
* @tableName: contrast_customer
* @entityName: CustomerEntity
* @author: gjh
* @history: 1.0
*/
public class CustomerEntity extends BaseEntity {
/** 无备注 */
private String jeck_code;
/** 无备注 */
private String jeck_name;
/** 无备注 */
private String u8_code;
/** 无备注 */
private String u8_name;
/** 无备注 */
private String u8_accid;
/** 无备注 */
public void setJeck_code(String jeck_code) {
this.jeck_code = jeck_code;
}
/** 无备注 */
public String getJeck_code() {
return jeck_code;
}
/** 无备注 */
public void setJeck_name(String jeck_name) {
this.jeck_name = jeck_name;
}
/** 无备注 */
public String getJeck_name() {
return jeck_name;
}
/** 无备注 */
public void setU8_code(String u8_code) {
this.u8_code = u8_code;
}
/** 无备注 */
public String getU8_code() {
return u8_code;
}
/** 无备注 */
public void setU8_name(String u8_name) {
this.u8_name = u8_name;
}
/** 无备注 */
public String getU8_name() {
return u8_name;
}
/** 无备注 */
public void setU8_accid(String u8_accid) {
this.u8_accid = u8_accid;
}
/** 无备注 */
public String getU8_accid() {
return u8_accid;
}
}

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hzya.frame.Jackyun.contrast.customer.entity.CustomerEntity">
<resultMap id="get-CustomerEntity-result" type="com.hzya.frame.Jackyun.contrast.customer.entity.CustomerEntity">
<!--无备注 -->
<result property="jeck_code" column="jeck_code" />
<!--无备注 -->
<result property="jeck_name" column="jeck_name" />
<!--无备注 -->
<result property="u8_code" column="u8_code" />
<!--无备注 -->
<result property="u8_name" column="u8_name" />
<!--无备注 -->
<result property="u8_accid" column="u8_accid" />
</resultMap>
<sql id="CustomerEntity_Base_Column_List">
jeck_code,
jeck_name,
u8_code,
u8_name,
u8_accid
</sql>
<!-- 查询 采用==查询 -->
<select id="CustomerEntity_list_base" resultMap="get-CustomerEntity-result" parameterType="com.hzya.frame.Jackyun.contrast.customer.entity.CustomerEntity">
select
<include refid="CustomerEntity_Base_Column_List" />
from contrast_customer
<trim prefix="where" prefixOverrides="and">
<if test="jeck_code != null and jeck_code !='' ">jeck_code = #{jeck_code} </if>
<if test="jeck_name != null and jeck_name !='' "> and jeck_name = #{jeck_name}</if>
<if test="u8_code != null and u8_code !='' "> and u8_code = #{u8_code}</if>
<if test="u8_name != null and u8_name !='' "> and u8_name = #{u8_name}</if>
<if test="u8_accid != null and u8_accid !='' "> and u8_accid = #{u8_accid}</if>
</trim>
</select>
<select id="CustomerEntity_list_test" resultMap="get-CustomerEntity-result" parameterType="com.hzya.frame.Jackyun.contrast.customer.entity.CustomerEntity">
select b.cComunitCode as u8_name, CAST(b.iChangRate AS VARCHAR) as jeck_name,a.cinvcode u8_code
from Inventory a inner join ComputationUnit b on a.cGroupCode=b.cGroupCode
where a.cInvCode=#{u8_code} and b.bMainUnit=0
</select>
</mapper>

View File

@ -0,0 +1,14 @@
package com.hzya.frame.Jackyun.contrast.customer.service;
import com.hzya.frame.Jackyun.contrast.customer.entity.CustomerEntity;
import com.hzya.frame.basedao.service.IBaseService;
/**
* @description: 客户账套对照表 service
* @tableName: contrast_customer
* @entityName: CustomerEntity
* @author: gjh
* @history: 1.0
*/
public interface ICustomerService extends IBaseService<CustomerEntity,Long> {
}

View File

@ -0,0 +1,18 @@
package com.hzya.frame.Jackyun.contrast.customer.service.impl;
import com.hzya.frame.basedao.service.impl.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hzya.frame.Jackyun.contrast.customer.entity.CustomerEntity;
import com.hzya.frame.Jackyun.contrast.customer.service.ICustomerService;
import com.hzya.frame.Jackyun.contrast.customer.dao.ICustomerDao;
/**
* @description: 客户账套对照表 service
* @tableName: contrast_customer
* @entityName: CustomerEntity
* @author: gjh
* @history: 1.0
*/
@Service(value="contrast_customerService")
public class CustomerServiceImpl extends BaseService< CustomerEntity,Long> implements ICustomerService{
}

View File

@ -0,0 +1,19 @@
package com.hzya.frame.Jackyun.contrast.inventory.dao;
import com.hzya.frame.Jackyun.contrast.inventory.entity.InventoryEntity;
import com.hzya.frame.Jackyun.contrast.inventory.entity.InventoryUnitEntity;
import com.hzya.frame.basedao.dao.IBaseDao;
import java.util.List;
/**
* @description: 存货档案对照表 dao
* @tableName: contrast_inventory
* @entityName: InventoryEntity
* @author: gjh
* @history: 1.0
*/
public interface IInventoryDao extends IBaseDao<InventoryEntity , Long> {
List<InventoryUnitEntity> getInventoryUnitEntity(String code);
List<InventoryEntity> getInventoryEntity(String code);
}

View File

@ -0,0 +1,32 @@
package com.hzya.frame.Jackyun.contrast.inventory.dao.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.Jackyun.contrast.inventory.entity.InventoryEntity;
import com.hzya.frame.Jackyun.contrast.inventory.entity.InventoryUnitEntity;
import com.hzya.frame.Jackyun.goodsdocout.entity.GoodsdocOutEntity;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import org.springframework.stereotype.Repository;
import com.hzya.frame.Jackyun.contrast.inventory.dao.IInventoryDao;
import java.util.List;
/**
* @description: 存货档案对照表 dao
* @tableName: contrast_inventory
* @entityName: InventoryEntity
* @author: gjh
* @history:1.0
*/
@Repository("contrast_inventorydao")
public class InventoryDaoImpl extends MybatisGenericDao<InventoryEntity, Long> implements IInventoryDao{
@DS("YONYOUU8")
@Override
public List<InventoryUnitEntity> getInventoryUnitEntity(String code) {
return (List<InventoryUnitEntity>) super.selectList("com.hzya.frame.Jackyun.contrast.inventory.entity.InventoryEntity.InventoryUnitEntity_get",code);
}
@DS("jeckYun")
@Override
public List<InventoryEntity> getInventoryEntity(String code) {
return (List<InventoryEntity>) super.selectList("com.hzya.frame.Jackyun.contrast.inventory.entity.InventoryEntity.InventoryEntity_get",code);
}
}

View File

@ -0,0 +1,77 @@
package com.hzya.frame.Jackyun.contrast.inventory.entity;
import java.util.Date;
import com.hzya.frame.web.entity.BaseEntity;
/**
* @description: 存货档案对照表
* @tableName: contrast_inventory
* @entityName: InventoryEntity
* @author: gjh
* @history: 1.0
*/
public class InventoryEntity extends BaseEntity {
/** 无备注 */
private String jeck_code;
/** 无备注 */
private String spec;
/** 配比 */
private Integer propor;
/** 无备注 */
private String u8_code;
/** 无备注 */
private String sale_spec;
/** 无备注 */
public void setJeck_code(String jeck_code) {
this.jeck_code = jeck_code;
}
/** 无备注 */
public String getJeck_code() {
return jeck_code;
}
/** 无备注 */
public void setSpec(String spec) {
this.spec = spec;
}
/** 无备注 */
public String getSpec() {
return spec;
}
/** 配比 */
public void setPropor(Integer propor) {
this.propor = propor;
}
/** 配比 */
public Integer getPropor() {
return propor;
}
/** 无备注 */
public void setU8_code(String u8_code) {
this.u8_code = u8_code;
}
/** 无备注 */
public String getU8_code() {
return u8_code;
}
/** 无备注 */
public void setSale_spec(String sale_spec) {
this.sale_spec = sale_spec;
}
/** 无备注 */
public String getSale_spec() {
return sale_spec;
}
}

View File

@ -0,0 +1,184 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hzya.frame.Jackyun.contrast.inventory.entity.InventoryEntity">
<resultMap id="get-InventoryEntity-result" type="com.hzya.frame.Jackyun.contrast.inventory.entity.InventoryEntity">
<!--无备注 -->
<result property="jeck_code" column="jeck_code" />
<!--无备注 -->
<result property="spec" column="spec" />
<!--配比 -->
<result property="propor" column="propor" />
<!--无备注 -->
<result property="u8_code" column="u8_code" />
<!--无备注 -->
<result property="sale_spec" column="sale_spec" />
</resultMap>
<resultMap id="InventoryEntityUnit-result" type="com.hzya.frame.Jackyun.contrast.inventory.entity.InventoryUnitEntity">
<result property="unitid" column="unitid" />
<result property="rate" column="rate" />
<result property="cinvcode" column="cinvcode" />
<result property="ccomcode" column="ccomcode" />
</resultMap>
<sql id="InventoryEntity_Base_Column_List">
jeck_code,
spec,
propor,
u8_code,
sale_spec
</sql>
<!--通过ID获取数据 -->
<select id="InventoryEntity_get" resultMap="get-InventoryEntity-result" parameterType="java.lang.String">
select
<include refid="InventoryEntity_Base_Column_List" />
from contrast_inventory where jeck_code = #{code}
</select>
<select id="InventoryUnitEntity_get" resultMap="InventoryEntityUnit-result" parameterType="java.lang.String">
select CAST(a.cAssComUnitCode AS VARCHAR) as unitid,
CAST(b.iChangRate AS VARCHAR) as rate,a.cinvcode,a.cComUnitCode as ccomcode
from ufdata_001_2023.dbo.Inventory a left join ufdata_001_2023.dbo.ComputationUnit b on a.cAssComUnitCode=b.cComunitCode
where cInvCode=#{code}
</select>
<!-- 查询 采用==查询 -->
<select id="InventoryEntity_list_base" resultMap="get-InventoryEntity-result" parameterType="com.hzya.frame.Jackyun.contrast.inventory.entity.InventoryEntity">
select
<include refid="InventoryEntity_Base_Column_List" />
from contrast_inventory
<trim prefix="where" prefixOverrides="and">
<if test="jeck_code != null and jeck_code !='' ">jeck_code = #{jeck_code} </if>
<if test="spec != null and spec !='' "> and spec = #{spec}</if>
<if test="propor != null "> and propor = #{propor}</if>
<if test="u8_code != null and u8_code !='' "> and u8_code = #{u8_code}</if>
<if test="sale_spec != null and sale_spec !='' "> and sale_spec = #{sale_spec}</if>
and sts='Y'
</trim>
<if test=" sort =='' "> order by id desc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
<!-- 查询符合条件的数量 -->
<select id="InventoryEntity_count" resultType="Integer" parameterType="com.hzya.frame.Jackyun.contrast.inventory.entity.InventoryEntity">
select count(1) from contrast_inventory
<trim prefix="where" prefixOverrides="and">
<if test="jeck_code != null and jeck_code !='' ">jeck_code = #{jeck_code} </if>
<if test="spec != null and spec !='' "> and spec = #{spec} </if>
<if test="propor != null "> and propor = #{propor} </if>
<if test="u8_code != null and u8_code !='' "> and u8_code = #{u8_code} </if>
<if test="sale_spec != null and sale_spec !='' "> and sale_spec = #{sale_spec} </if>
and sts='Y'
</trim>
<if test=" sort =='' "> order by id desc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null "> order by ${sort} ${order}</if>
</select>
<!-- 分页查询列表 采用like格式 -->
<select id="InventoryEntity_list_like" resultMap="get-InventoryEntity-result" parameterType="com.hzya.frame.Jackyun.contrast.inventory.entity.InventoryEntity">
select
<include refid="InventoryEntity_Base_Column_List" />
from contrast_inventory
<trim prefix="where" prefixOverrides="and">
<if test="jeck_code != null and jeck_code !='' "> jeck_code like concat('%',#{jeck_code},'%') </if>
<if test="spec != null and spec !='' "> and spec like concat('%',#{spec},'%') </if>
<if test="propor != null "> and propor = #{propor}</if>
<if test="u8_code != null and u8_code !='' "> and u8_code like concat('%',#{u8_code},'%') </if>
<if test="sale_spec != null and sale_spec !='' "> and sale_spec like concat('%',#{sale_spec},'%') </if>
and sts='Y'
</trim>
<if test=" sort =='' "> order by id desc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
<!-- 查询列表 字段采用or格式 -->
<select id="InventoryEntity_list_or" resultMap="get-InventoryEntity-result" parameterType="com.hzya.frame.Jackyun.contrast.inventory.entity.InventoryEntity">
select
<include refid="InventoryEntity_Base_Column_List" />
from contrast_inventory
<trim prefix="where" prefixOverrides="or">
<if test="jeck_code != null and jeck_code !='' ">jeck_code = #{jeck_code} </if>
<if test="spec != null and spec !='' "> or spec = #{spec} </if>
<if test="propor != null "> or propor = #{propor}</if>
<if test="u8_code != null and u8_code !='' "> or u8_code = #{u8_code} </if>
<if test="sale_spec != null and sale_spec !='' "> or sale_spec = #{sale_spec} </if>
and sts='Y'
</trim>
<if test=" sort =='' "> order by id desc</if>
<if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>
<!-- 新增 -->
<insert id="InventoryEntity_insert" parameterType="com.hzya.frame.Jackyun.contrast.inventory.entity.InventoryEntity">
insert into contrast_inventory(
<trim suffix="" suffixOverrides=",">
<if test="jeck_code != null and jeck_code !='' "> jeck_code, </if>
<if test="spec != null and spec !='' "> spec, </if>
<if test="propor != null ">propor,</if>
<if test="u8_code != null and u8_code !='' "> u8_code, </if>
<if test="sale_spec != null and sale_spec !='' "> sale_spec, </if>
create_time,
modify_time,
sts
</trim>
)values
(
<trim suffix="" suffixOverrides=",">
<if test="jeck_code != null and jeck_code !='' "> #{jeck_code}, </if>
<if test="spec != null and spec !='' "> #{spec}, </if>
<if test="propor != null ">#{propor},</if>
<if test="u8_code != null and u8_code !='' "> #{u8_code}, </if>
<if test="sale_spec != null and sale_spec !='' "> #{sale_spec}, </if>
<if test="create_time != null "> #{create_time} ,</if>
<if test="create_time == null "> now(),</if>
<if test="modify_time != null "> #{modify_time},</if>
<if test="modify_time == null "> now(),</if>
'Y'
</trim>
)
<selectKey keyProperty="id" resultType="Long" order="AFTER">
select
last_insert_id() as id
</selectKey>
</insert>
<!-- 修改 -->
<update id="InventoryEntity_update" parameterType="com.hzya.frame.Jackyun.contrast.inventory.entity.InventoryEntity">
update contrast_inventory set
<trim suffix="" suffixOverrides=",">
<if test="jeck_code != null and jeck_code !='' "> jeck_code = #{jeck_code},</if>
<if test="spec != null and spec !='' "> spec = #{spec},</if>
<if test="propor != null ">propor = #{propor},</if>
<if test="u8_code != null and u8_code !='' "> u8_code = #{u8_code},</if>
<if test="sale_spec != null and sale_spec !='' "> sale_spec = #{sale_spec},</if>
<if test="modify_time != null "> modify_time =#{modify_time} </if>
<if test="modify_time == null "> modify_time = now()</if>
</trim>
where id = #{id}
</update>
<!-- 逻辑删除 -->
<update id="InventoryEntity_logicDelete" parameterType="com.hzya.frame.Jackyun.contrast.inventory.entity.InventoryEntity">
update contrast_inventory set
sts='N',modify_time = now(),modify_user_id = #{modify_user_id} where
id = #{id}
</update>
<!-- 逻辑删除多条件 -->
<update id="InventoryEntity_logicDelete_Multi_Condition" parameterType="com.hzya.frame.Jackyun.contrast.inventory.entity.InventoryEntity">
update contrast_inventory set
sts='N',modify_time = now(),modify_user_id = #{modify_user_id}
<trim prefix="where" prefixOverrides="and">
<if test="jeck_code != null and jeck_code !='' ">jeck_code = #{jeck_code} </if>
<if test="spec != null and spec !='' "> and spec = #{spec}</if>
<if test="propor != null "> and propor = #{propor}</if>
<if test="u8_code != null and u8_code !='' "> and u8_code = #{u8_code}</if>
<if test="sale_spec != null and sale_spec !='' "> and sale_spec = #{sale_spec}</if>
</trim>
</update>
<!-- 物理删除 -->
<delete id="InventoryEntity_delete" parameterType="com.hzya.frame.Jackyun.contrast.inventory.entity.InventoryEntity">
delete from contrast_inventory where id =#{id}
</delete>
</mapper>

View File

@ -0,0 +1,54 @@
package com.hzya.frame.Jackyun.contrast.inventory.entity;
import com.hzya.frame.web.entity.BaseEntity;
/**
* @description: 存货档案对照表
* @tableName: contrast_inventory
* @entityName: InventoryEntity
* @author: gjh
* @history: 1.0
*/
public class InventoryUnitEntity extends BaseEntity {
/** 无备注 */
private String cinvcode;
/** 无备注 */
private String ccomcode;
/** 配比 */
private String unitid;
/** 无备注 */
private String rate;
public String getCinvcode() {
return cinvcode;
}
public void setCinvcode(String cinvcode) {
this.cinvcode = cinvcode;
}
public String getCcomcode() {
return ccomcode;
}
public void setCcomcode(String ccomcode) {
this.ccomcode = ccomcode;
}
public String getUnitid() {
return unitid;
}
public void setUnitid(String unitid) {
this.unitid = unitid;
}
public String getRate() {
return rate;
}
public void setRate(String rate) {
this.rate = rate;
}
}

View File

@ -0,0 +1,14 @@
package com.hzya.frame.Jackyun.contrast.inventory.service;
import com.hzya.frame.Jackyun.contrast.inventory.entity.InventoryEntity;
import com.hzya.frame.basedao.service.IBaseService;
/**
* @description: 存货档案对照表 service
* @tableName: contrast_inventory
* @entityName: InventoryEntity
* @author: gjh
* @history: 1.0
*/
public interface IInventoryService extends IBaseService<InventoryEntity,Long> {
}

View File

@ -0,0 +1,17 @@
package com.hzya.frame.Jackyun.contrast.inventory.service.impl;
import com.hzya.frame.basedao.service.impl.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hzya.frame.Jackyun.contrast.inventory.entity.InventoryEntity;
import com.hzya.frame.Jackyun.contrast.inventory.service.IInventoryService;
/**
* @description: 存货档案对照表 service
* @tableName: contrast_inventory
* @entityName: InventoryEntity
* @author: gjh
* @history: 1.0
*/
@Service(value="contrast_inventoryService")
public class InventoryServiceImpl extends BaseService< InventoryEntity,Long> implements IInventoryService{
}

View File

@ -0,0 +1,17 @@
package com.hzya.frame.Jackyun.contrast.warehouse.dao;
import com.hzya.frame.Jackyun.contrast.warehouse.entity.WarehouseEntity;
import com.hzya.frame.basedao.dao.IBaseDao;
import java.util.List;
/**
* @description: 仓库档案对照表 dao
* @tableName: contrast_warehouse
* @entityName: WarehouseEntity
* @author: gjh
* @history: 1.0
*/
public interface IWarehouseDao extends IBaseDao<WarehouseEntity , Long> {
List<WarehouseEntity> queryListByJeckYun(WarehouseEntity ware);
}

View File

@ -0,0 +1,25 @@
package com.hzya.frame.Jackyun.contrast.warehouse.dao.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.Jackyun.contrast.warehouse.entity.WarehouseEntity;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import org.springframework.stereotype.Repository;
import com.hzya.frame.Jackyun.contrast.warehouse.dao.IWarehouseDao;
import java.util.List;
/**
* @description: 仓库档案对照表 dao
* @tableName: contrast_warehouse
* @entityName: WarehouseEntity
* @author: gjh
* @history:1.0
*/
@Repository("contrast_warehousedao")
public class WarehouseDaoImpl extends MybatisGenericDao<WarehouseEntity, Long> implements IWarehouseDao{
@DS("jeckYun")
@Override
public List<WarehouseEntity> queryListByJeckYun(WarehouseEntity ware) {
return (List<WarehouseEntity>) super.selectList("com.hzya.frame.Jackyun.contrast.warehouse.entity.WarehouseEntity.WarehouseEntity_list_base", ware);
}
}

View File

@ -0,0 +1,65 @@
package com.hzya.frame.Jackyun.contrast.warehouse.entity;
import java.util.Date;
import com.hzya.frame.web.entity.BaseEntity;
/**
* @description: 仓库档案对照表
* @tableName: contrast_warehouse
* @entityName: WarehouseEntity
* @author: gjh
* @history: 1.0
*/
public class WarehouseEntity extends BaseEntity {
/** 无备注 */
private String jeck_code;
/** 无备注 */
private String jeck_name;
/** 无备注 */
private String u8_code;
/** 无备注 */
private String u8_name;
/** 无备注 */
public void setJeck_code(String jeck_code) {
this.jeck_code = jeck_code;
}
/** 无备注 */
public String getJeck_code() {
return jeck_code;
}
/** 无备注 */
public void setJeck_name(String jeck_name) {
this.jeck_name = jeck_name;
}
/** 无备注 */
public String getJeck_name() {
return jeck_name;
}
/** 无备注 */
public void setU8_code(String u8_code) {
this.u8_code = u8_code;
}
/** 无备注 */
public String getU8_code() {
return u8_code;
}
/** 无备注 */
public void setU8_name(String u8_name) {
this.u8_name = u8_name;
}
/** 无备注 */
public String getU8_name() {
return u8_name;
}
}

View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hzya.frame.Jackyun.contrast.warehouse.entity.WarehouseEntity">
<resultMap id="get-WarehouseEntity-result" type="com.hzya.frame.Jackyun.contrast.warehouse.entity.WarehouseEntity">
<!--无备注 -->
<result property="jeck_code" column="jeck_code" />
<!--无备注 -->
<result property="jeck_name" column="jeck_name" />
<!--无备注 -->
<result property="u8_code" column="u8_code" />
<!--无备注 -->
<result property="u8_name" column="u8_name" />
</resultMap>
<sql id="WarehouseEntity_Base_Column_List">
jeck_code,
jeck_name,
u8_code,
u8_name
</sql>
<!-- 查询 采用==查询 -->
<select id="WarehouseEntity_list_base" resultMap="get-WarehouseEntity-result" parameterType="com.hzya.frame.Jackyun.contrast.warehouse.entity.WarehouseEntity">
select
<include refid="WarehouseEntity_Base_Column_List" />
from contrast_warehouse
<trim prefix="where" prefixOverrides="and">
<if test="jeck_code != null and jeck_code !='' ">jeck_code = #{jeck_code} </if>
<if test="jeck_name != null and jeck_name !='' "> and jeck_name = #{jeck_name}</if>
<if test="u8_code != null and u8_code !='' "> and u8_code = #{u8_code}</if>
<if test="u8_name != null and u8_name !='' "> and u8_name = #{u8_name}</if>
</trim>
</select>
</mapper>

View File

@ -0,0 +1,15 @@
package com.hzya.frame.Jackyun.contrast.warehouse.service;
import com.hzya.frame.Jackyun.contrast.warehouse.entity.WarehouseEntity;
import com.hzya.frame.basedao.service.IBaseService;
/**
* @description: 仓库档案对照表 service
* @tableName: contrast_warehouse
* @entityName: WarehouseEntity
* @author: gjh
* @history: 1.0
*/
public interface IWarehouseService extends IBaseService<WarehouseEntity,Long> {
}

View File

@ -0,0 +1,17 @@
package com.hzya.frame.Jackyun.contrast.warehouse.service.impl;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.Jackyun.contrast.warehouse.entity.WarehouseEntity;
import com.hzya.frame.Jackyun.contrast.warehouse.service.IWarehouseService;
import org.springframework.stereotype.Service;
/**
* @description: 仓库档案对照表 service
* @tableName: contrast_warehouse
* @entityName: WarehouseEntity
* @author: gjh
* @history: 1.0
*/
@Service(value="contrast_warehouseService")
public class WarehouseServiceImpl extends BaseService< WarehouseEntity,Long> implements IWarehouseService{
}

View File

@ -38,6 +38,6 @@ public class GoodsdocInLogisticDaoImpl extends MybatisGenericDao<GoodsdocInLogis
@DS("jeckYun")
@Override
public int deleteByMainId(GoodsdocInLogisticEntity logisEntity) {
return super.delete("com.hzya.frame.Jackyun.goodsdocin.dao.impl.GoodsdocInLogisticDaoImpl.entity_delete",logisEntity.getMainId());
return super.delete("com.hzya.frame.Jackyun.goodsdocin.dao.impl.GoodsdocInLogisticDaoImpl.entity_delete",logisEntity);
}
}

View File

@ -15,7 +15,7 @@ import java.util.List;
public class GoodsdocInDetailEntity extends BaseEntity {
/** 入库单明细ID */
private Integer recId;
private String recId;
/** 货品ID */
private String goodsId;
/** 货品编号 */
@ -105,6 +105,34 @@ public class GoodsdocInDetailEntity extends BaseEntity {
/** 出库唯一码关联字段,此值不为空时,需要查询接口获取唯一码信息:erp.storage.goodsdocserial */
private String serialSourceId;
private String mainId;
private String minDate;
private String maxDate;
private String num;
public String getNum() {
return num;
}
public void setNum(String num) {
this.num = num;
}
public String getMinDate() {
return minDate;
}
public void setMinDate(String minDate) {
this.minDate = minDate;
}
public String getMaxDate() {
return maxDate;
}
public void setMaxDate(String maxDate) {
this.maxDate = maxDate;
}
private List<GoodsdocInEntity>goodsdocInEntityList;
public List<GoodsdocInEntity> getGoodsdocInEntityList() {
@ -123,15 +151,13 @@ public class GoodsdocInDetailEntity extends BaseEntity {
this.mainId = mainId;
}
/** 入库单明细ID */
public void setRecId(Integer recId) {
this.recId = recId;
}
/** 入库单明细ID */
public Integer getRecId() {
public String getRecId() {
return recId;
}
public void setRecId(String recId) {
this.recId = recId;
}
/** 货品ID */
public void setGoodsId(String goodsId) {

View File

@ -143,18 +143,32 @@
<!-- 查询 采用==查询 -->
<select id="entity_list_base_group" resultMap="get-entity-result" parameterType="com.hzya.frame.Jackyun.goodsdocin.entity.GoodsdocInDetailEntity">
select
goodsNo,goodsName,unitName,
SUM(CAST(quantity AS DECIMAL(10, 6))) AS quantity,
SUM(CAST(transHasTaxAmount AS DECIMAL(10, 6))) AS transHasTaxAmount
from jeck_goodsdocin_details
where mainId in (
<foreach collection="goodsdocInEntityList" separator="," item="item">
<trim suffix="" suffixOverrides=",">
<if test="item.recId != null and item.recId !='' "> #{item.recId},</if>
</trim>
</foreach>
)
group by goodsNo,goodsName,unitName
case when d.u8_code is not null then d.u8_code else c.cinvcode end as goodsNo,c.cinvname as goodsName,case when d.sale_spec is not null then d.sale_spec else unitName end as unitName,
CAST(SUM(
CASE
WHEN (ISNULL(c.cComUnitName,'')=b.unitName AND ISNUMERIC(c.ichangrate)=1)
THEN CAST(quantity AS DECIMAL(18, 6)) * CAST(c.ichangrate AS DECIMAL(18, 6))
ELSE
CAST(quantity AS DECIMAL(18, 6)) /
NULLIF(CASE WHEN d.jeck_code IS NULL OR ISNUMERIC(d.propor)=0 THEN 1 ELSE CAST(d.propor AS DECIMAL(18, 6)) END, 0)
END
) AS DECIMAL(18, 6)) AS quantity,
SUM(CAST(transHasTaxAmount AS DECIMAL(18, 6))) AS transHasTaxAmount,
max(num)*sum(CAST(quantity AS DECIMAL(18, 6))) as num
from jeck_goodsdocin_details b
left join jeck_goodsdocin a on a.recid = b.mainid
left join v_inventoty c on b.goodsNo = c.cinvcode
left join contrast_inventory d on b.goodsNo= d.jeck_code
left join contrast_inventory_big dd on b.goodsno = dd.invcode
where warehouseName = '退货仓'
and CAST(GETDATE() AS DATE)>inoutdate
and inoutdate >= #{minDate}
and inoutdate &lt;= #{maxDate}
and state is null
and (goodsNo like '5%' or goodsNo like '7%' or d.u8_code like '5%' or d.u8_code like '7%')
/*AND d.u8_code = '70606046'*/
group by c.cinvcode,c.cinvname,unitName,d.u8_code,d.sale_spec
</select>
<!-- 查询 采用==查询 -->
@ -208,6 +222,7 @@
<if test="orderNum != null and orderNum !='' "> and orderNum = #{orderNum}</if>
<if test="serialSourceId != null and serialSourceId !='' "> and serialSourceId = #{serialSourceId}</if>
<if test="mainId != null and mainId !='' "> and mainId = #{mainId}</if>
and goodsNo like '5%'
</trim>
</select>

View File

@ -120,6 +120,24 @@ public class GoodsdocInEntity extends BaseEntity {
private String state;
private String u8BillCode;
private String accId;
private String minDate;
private String maxDate;
public String getMinDate() {
return minDate;
}
public void setMinDate(String minDate) {
this.minDate = minDate;
}
public String getMaxDate() {
return maxDate;
}
public void setMaxDate(String maxDate) {
this.maxDate = maxDate;
}
public String getU8BillCode() {
return u8BillCode;

View File

@ -105,6 +105,8 @@
<result property="deliveryNo" column="deliveryNo" />
<result property="u8BillCode" column="u8BillCode" />
<result property="accId" column="accId" />
<result property="minDate" column="minDate" />
<result property="maxDate" column="maxDate" />
</resultMap>
@ -166,17 +168,15 @@
select
inouttypeName,
warehouseName,
'99999994' as channelName
'99999994' as channelName,
min(inoutdate) as minDate,
max(inoutdate) as maxDate
from jeck_goodsdocin
where warehouseName = '退货仓'
and state is null
and goodsdocNo in (
<foreach collection="groupList" separator="," item="item">
<trim suffix="" suffixOverrides=",">
<if test="item.goodsdocNo != null and item.goodsdocNo !='' "> #{item.goodsdocNo},</if>
</trim>
</foreach>
)
and CAST(GETDATE() AS DATE)>inoutdate
and inoutdate >= #{minDate}
and inoutdate &lt;= #{maxDate}
group by inouttypeName,warehouseName
</select>
@ -198,14 +198,14 @@
top 100
*
from jeck_goodsdocin where state is null and inouttype = '105'
order by inOutDate asc
</select>
<select id="entity_list_base_bak" resultMap="get-entity-result" parameterType="com.hzya.frame.Jackyun.goodsdocin.entity.GoodsdocInEntity">
select
*
from jeck_goodsdocin where state = #{state}
from jeck_goodsdocin where (state = #{state} or warehouseName != '退货仓')
@ -445,18 +445,12 @@
<!-- 修改 -->
<update id="entity_update" parameterType="com.hzya.frame.Jackyun.goodsdocin.entity.GoodsdocInEntity">
update jeck_goodsdocin set
<trim suffix="" suffixOverrides=",">
<if test="state != null and state !='' ">state= #{state} ,</if>
<if test="u8BillCode != null and u8BillCode !='' "> u8BillCode=#{u8BillCode}</if>
</trim>
where goodsdocNo in (
<foreach collection="groupList" separator="," item="item">
<trim suffix="" suffixOverrides=",">
<if test="item.goodsdocNo != null and item.goodsdocNo !='' "> #{item.goodsdocNo},</if>
</trim>
</foreach>
)
update jeck_goodsdocin set state= #{state}
where state is null
and warehouseName = '退货仓'
and inoutdate >= #{minDate}
and inoutdate &lt;= #{maxDate}
and CAST(GETDATE() AS DATE)>inoutdate
</update>
<!-- 物理删除 -->

View File

@ -97,6 +97,6 @@
<!-- 物理删除 -->
<delete id="entity_delete" parameterType="com.hzya.frame.Jackyun.goodsdocin.entity.GoodsdocInLogisticEntity">
delete from jeck_goodsdocin_logistic where recId =#{recId}
delete from jeck_goodsdocin_logistic where mainid =#{mainId}
</delete>
</mapper>

View File

@ -13,6 +13,7 @@ import com.hzya.frame.Jackyun.goodsdocin.entity.GoodsdocInEntity;
import com.hzya.frame.Jackyun.goodsdocin.entity.GoodsdocInLogisticEntity;
import com.hzya.frame.Jackyun.goodsdocin.service.IGoodsdocInService;
import com.hzya.frame.Jackyun.goodsdocout.entity.GoodsdocOutEntity;
import com.hzya.frame.Jackyun.util.JackyunOpenHttpUtils;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.u8.delivery.service.IDeliveryOrderService;
@ -23,9 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
/**
@ -51,11 +50,13 @@ public class GoodsdocInServiceImpl extends BaseService<GoodsdocInEntity,String>
@Override
public void getJeckGoodsdocIn(JSONObject json) {
logger.info("开始执行吉客入出库单获取数据"+json.toString());
JSONArray dataArr = new JSONArray();
int i = 0;
String method = "erp.storage.goodsdocin.v2";
// 创建 Calendar 实例
Date now = json.getDate("startTime");
// Date now = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(now);
@ -78,10 +79,13 @@ public class GoodsdocInServiceImpl extends BaseService<GoodsdocInEntity,String>
JSONObject main = new JSONObject();
main.put("pageSize","50");
main.put("pageIndex",i++);
String fields = "recId,goodsdocNo,billNo,inInDate,gmtCreate,inIntype,inIntypeName,flagData,flagDataName,vendCustomerCode,vendCustomerName,currencyCode,currencyRate,userName,warehouseCode,warehouseName,comment,memo,logisticName,logisticNo,companyId,companyName,logisticType,logisticCode,inInReason,sourceBillNo,channelId,channelCode,channelName,redStatus,field1,field2,field3,field4,field5,financeBillStatus,applyCompanyId,applyCompanyName,applyCompanyCode,applyDepartId,applyDepartName,departCode,applyUserId,applyUserName,InBillNo,gmtModified,companyCode,vendCustomerId,logisticList.id,logisticList.docNo,logisticList.logisticNo,logisticList.logisticCode,logisticList.logisticName,logisticList.logisticType,goodsDocDetailList.recId,goodsDocDetailList.goodsId,goodsDocDetailList.goodsNo,goodsDocDetailList.goodsName,goodsDocDetailList.skuId,goodsDocDetailList.skuName,goodsDocDetailList.skuBarcode,goodsDocDetailList.unitName,goodsDocDetailList.cuPrice,goodsDocDetailList.cuValue,goodsDocDetailList.caseNumber,goodsDocDetailList.rowRemark,goodsDocDetailList.assistUnit,goodsDocDetailList.estCost,goodsDocDetailList.estTax,goodsDocDetailList.estPrice,goodsDocDetailList.estPriceNoTax,goodsDocDetailList.estCostNoTax,goodsDocDetailList.taxRate,goodsDocDetailList.batchNo,goodsDocDetailList.serialNo,goodsDocDetailList.productionDate,goodsDocDetailList.expirationDate,goodsDocDetailList.shelfLife,goodsDocDetailList.shelfLiftUnit,goodsDocDetailList.sourceDetailId,goodsDocDetailList.transNoTaxPrice,goodsDocDetailList.transNoTaxAmount,goodsDocDetailList.transHasTaxPrice,goodsDocDetailList.transHasTaxAmount,goodsDocDetailList.transTaxAmount,goodsDocDetailList.detailField1,goodsDocDetailList.detailField2,goodsDocDetailList.detailField3,goodsDocDetailList.detailField4,goodsDocDetailList.detailField5,goodsDocDetailList.isCertified,goodsDocDetailList.registrationNumber,goodsDocDetailList.approvalDate,goodsDocDetailList.productionDepart,goodsDocDetailList.batchNumber,goodsDocDetailList.quantity,goodsDocDetailList.orderNum,goodsDocDetailList.serialSourceId,deliveryNo";
String fields = "recId,goodsdocNo,billNo,inOutDate,gmtCreate,inouttype,inouttypeName,flagData,flagDataName,vendCustomerCode,vendCustomerName,currencyCode,currencyRate,userName,warehouseCode,warehouseName,comment,memo,logisticName,logisticNo,companyId,companyName,logisticType,logisticCode,inInReason,sourceBillNo,channelId,channelCode,channelName,redStatus,field1,field2,field3,field4,field5,financeBillStatus,applyCompanyId,applyCompanyName,applyCompanyCode,applyDepartId,applyDepartName,departCode,applyUserId,applyUserName,InBillNo,gmtModified,companyCode,vendCustomerId,logisticList.id,logisticList.docNo,logisticList.logisticNo,logisticList.logisticCode,logisticList.logisticName,logisticList.logisticType,goodsDocDetailList.recId,goodsDocDetailList.goodsId,goodsDocDetailList.goodsNo,goodsDocDetailList.goodsName,goodsDocDetailList.skuId,goodsDocDetailList.skuName,goodsDocDetailList.skuBarcode,goodsDocDetailList.unitName,goodsDocDetailList.cuPrice,goodsDocDetailList.cuValue,goodsDocDetailList.caseNumber,goodsDocDetailList.rowRemark,goodsDocDetailList.assistUnit,goodsDocDetailList.estCost,goodsDocDetailList.estTax,goodsDocDetailList.estPrice,goodsDocDetailList.estPriceNoTax,goodsDocDetailList.estCostNoTax,goodsDocDetailList.taxRate,goodsDocDetailList.batchNo,goodsDocDetailList.serialNo,goodsDocDetailList.productionDate,goodsDocDetailList.expirationDate,goodsDocDetailList.shelfLife,goodsDocDetailList.shelfLiftUnit,goodsDocDetailList.sourceDetailId,goodsDocDetailList.transNoTaxPrice,goodsDocDetailList.transNoTaxAmount,goodsDocDetailList.transHasTaxPrice,goodsDocDetailList.transHasTaxAmount,goodsDocDetailList.transTaxAmount,goodsDocDetailList.detailField1,goodsDocDetailList.detailField2,goodsDocDetailList.detailField3,goodsDocDetailList.detailField4,goodsDocDetailList.detailField5,goodsDocDetailList.isCertified,goodsDocDetailList.registrationNumber,goodsDocDetailList.approvalDate,goodsDocDetailList.productionDepart,goodsDocDetailList.batchNumber,goodsDocDetailList.quantity,goodsDocDetailList.orderNum,goodsDocDetailList.serialSourceId,deliveryNo";
main.put("selelctFields",fields);
main.put("startDate", startTime);
main.put("endDate", endTime);
// main.put("startDate", "2025-06-01 00:00:00");
// main.put("endDate", "2025-06-10 00:00:00");
logger.info("获取吉客云入库单开始时间:{} 结束时间:{}",startTime,endTime);
String result = JackyunOpenHttpUtils.post(method, "v1.0", main);
if(StrUtil.isEmpty(result)){
throw new RuntimeException("获取吉客云入库单失败");
@ -101,10 +105,14 @@ public class GoodsdocInServiceImpl extends BaseService<GoodsdocInEntity,String>
AtomicInteger j = new AtomicInteger();
//判断是否有数据处理到如果数组数据不为O则进行数据处理
if(dataArr.size()>0){
// 修复编码
// String fixedJson = JackyunOpenHttpUtils.fixJsonEncoding(dataArr.toString());
// // 解析JSON
// dataArr = JSONObject.parseArray(fixedJson);
logger.info("本次获取的入吉客云数据"+dataArr.toString());
dataArr.forEach(item->{
j.getAndIncrement();
logger.info("失败数据位置====================================="+j);
// logger.info("失败数据位置====================================="+j);
GoodsdocInEntity goodsdocIn = JSONObject.parseObject(JSON.toJSONString(item),GoodsdocInEntity.class);
//判断是否已经存在此单据如果存在则跳过如果不存在则新增写入
GoodsdocInEntity checkEntity = new GoodsdocInEntity();
@ -112,6 +120,7 @@ public class GoodsdocInServiceImpl extends BaseService<GoodsdocInEntity,String>
List<GoodsdocInEntity> goodsdocInEntityList = goodsdocInDao.checkBill(checkEntity);
if(goodsdocInEntityList.size() == 0){
//新增入库单数据
logger.info("本次新增的数据"+JSON.toJSONString(goodsdocIn));
GoodsdocInEntity goodsdocInEntity =goodsdocInDao.saveGoodsdocIn(goodsdocIn);
//判断是否有物流数据如果有则保存
List<GoodsdocInLogisticEntity>goodsdocInLogisticEntityList = goodsdocIn.getLogisticList();
@ -183,45 +192,68 @@ public class GoodsdocInServiceImpl extends BaseService<GoodsdocInEntity,String>
@Override
public void getJeckGoodsdocInToU8(JSONObject requestJson) {
GoodsdocInEntity goodsdocInEntity = new GoodsdocInEntity();
goodsdocInEntity.setMinDate(requestJson.getString("minDate"));
goodsdocInEntity.setMaxDate(requestJson.getString("maxDate"));
// goodsdocInEntity.setState("Y");
//查询所有未处理的出库单信息
List<GoodsdocInEntity> goodsdocInEntityList = goodsdocInDao.getGoodsdocInListAll(goodsdocInEntity);
if (CollectionUtils.isNotEmpty(goodsdocInEntityList)){
goodsdocInEntity.setGroupList(goodsdocInEntityList);
//重新查询 然后进行分组
List<GoodsdocInEntity> goodsdocInList = goodsdocInDao.getGoodsdocInListGroup(goodsdocInEntity);
if(CollectionUtils.isNotEmpty(goodsdocInList)){
goodsdocInList.forEach(item -> {
String minDateStr = goodsdocInEntity.getMinDate() != null
? DateUtil.format(DateUtil.parse(goodsdocInEntity.getMinDate()), "yyyyMMdd")
: "";
String maxDateStr = goodsdocInEntity.getMaxDate() != null
? DateUtil.format(DateUtil.parse(goodsdocInEntity.getMaxDate()), "yyyyMMdd")
: "";
String cmemo = minDateStr + "-" + maxDateStr;
// String cmemo = DateUtil.format(DateUtil.parse(item.getMinDate()),"yyyyMMdd")+"-"+DateUtil.format(DateUtil.parse(item.getMaxDate()),"yyyyMMdd");
//查询明细数据
GoodsdocInDetailEntity detailEntity = new GoodsdocInDetailEntity();
detailEntity.setGoodsdocInEntityList(goodsdocInEntityList);
detailEntity.setMinDate(requestJson.getString("minDate"));
detailEntity.setMaxDate(requestJson.getString("maxDate"));
List<GoodsdocInDetailEntity> goodsdocInDetailEntityList = goodsdocInDetailDao.getGoodsdocInDetailListGroup(detailEntity);
goodsdocInEntity = goodsdocInList.get(0);
JSONObject jsonObject = bdingParm(goodsdocInEntity,goodsdocInDetailEntityList);
List<GoodsdocInDetailEntity> goodsdocInDetailEntityListNew = new ArrayList<>();
// todo 开始获取中间库获取转换数据
//统一处理如果涉及大坛的情况下多添加一次大坛信息
if(CollectionUtils.isNotEmpty(goodsdocInDetailEntityList)){
goodsdocInDetailEntityList.forEach(details -> {
goodsdocInDetailEntityListNew.add(details);
if("502060036".equals(details.getGoodsNo())){
GoodsdocInDetailEntity big = new GoodsdocInDetailEntity();
big.setGoodsNo("50090503");
big.setGoodsName("黄酒大坛");
big.setQuantity(details.getNum());
big.setUnitName("");
big.setTransHasTaxAmount("0");
goodsdocInDetailEntityListNew.add(big);
}
});
}
JSONObject jsonObject = bdingParm(goodsdocInEntity,goodsdocInDetailEntityListNew,cmemo);
//调用U8接口生成退货单
U8ResultEntity u8ResultEntity = deliveryOrderService.addDeliveryT(jsonObject);
// U8ResultEntity u8ResultEntity = new U8ResultEntity();
// if(1==1){
// return;
// }
String state = "";
if(!u8ResultEntity.issuccess()){
goodsdocInEntity.setState("N");
}
goodsdocInEntity.setU8BillCode(u8ResultEntity.getmessage());
//开始组装U8红字销售出库单数据
JSONObject saleOut = bdingParmOut(goodsdocInEntity,goodsdocInDetailEntityList);
JSONObject saleOut = bdingParmOut(goodsdocInEntity,goodsdocInDetailEntityListNew,cmemo);
U8ResultEntity u8ResultOut =saleOutService.addSaleOutT(saleOut);
if(!u8ResultOut.issuccess()){
goodsdocInEntity.setState("N");
}else{
goodsdocInEntity.setState("Y");
}
goodsdocInEntity.setGroupList(goodsdocInEntityList);
goodsdocInDao.updateGoodsdocIn(goodsdocInEntity);
});
}
}
}
/**
*
* @content 开始组装U8红字销售出库单数据
@ -231,7 +263,7 @@ public class GoodsdocInServiceImpl extends BaseService<GoodsdocInEntity,String>
*
*/
private JSONObject bdingParmOut(GoodsdocInEntity goodsdocInEntity, List<GoodsdocInDetailEntity> goodsdocInDetailEntityList) {
private JSONObject bdingParmOut(GoodsdocInEntity goodsdocInEntity, List<GoodsdocInDetailEntity> goodsdocInDetailEntityList,String cmemo) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("AccId", "005");
jsonObject.put("billid", "123");
@ -241,9 +273,12 @@ public class GoodsdocInServiceImpl extends BaseService<GoodsdocInEntity,String>
head.put("cmaker", "吉客云入库单自动生成");//创建人
head.put("cbustype", "普通销售");//创建人
head.put("crdcode", "203");//入库类别编码
head.put("cmemo",cmemo);//TODO 这里填的是发货单的最早日期和最晚日期
head.put("cwhcode", "04009");//仓库编码 todo 正式需要切换为04009
head.put("ddate", DateUtil.format(new Date(),"yyyy-MM-dd"));//销售类型
head.put("ccuscode", "99999994");//todo 正式需要切换未这个客户
// head.put("ddate", "2025-05-31");//销售类型
head.put("ccuscode", "99989922");//todo 正式需要切换未这个客户
head.put("cDefine1", "多组织-红字采购入库");//
// head.put("ccuscode", "01010918");//客户
head.put("csource","发货单");
@ -262,6 +297,8 @@ public class GoodsdocInServiceImpl extends BaseService<GoodsdocInEntity,String>
details.put("cinvcode", item.getGoodsNo());//存货编码
details.put("iquantity",new BigDecimal(item.getQuantity()).subtract(new BigDecimal(item.getQuantity()).add(new BigDecimal(item.getQuantity()))));
// details.put("iquantity", item.getQuantity());//数量
details.put("itaxrate",item.getTaxRate());
body.add(details);
}
}
@ -269,7 +306,7 @@ public class GoodsdocInServiceImpl extends BaseService<GoodsdocInEntity,String>
return jsonObject;
}
private JSONObject bdingParm(GoodsdocInEntity goodsdocInEntity, List<GoodsdocInDetailEntity> goodsdocInDetailEntityList) {
private JSONObject bdingParm(GoodsdocInEntity goodsdocInEntity, List<GoodsdocInDetailEntity> goodsdocInDetailEntityList,String cmemo) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("AccId", "005");
jsonObject.put("billid", "123");
@ -279,11 +316,12 @@ public class GoodsdocInServiceImpl extends BaseService<GoodsdocInEntity,String>
head.put("cbustype", "普通销售");//
head.put("cdepcode", "00702");//销售部门
head.put("cmaker", "吉客云入库单自动生成");//创建人
head.put("cDefine1", "多组织-红字采购入库");//
head.put("ccuscode", "99999994");//todo 正式需要切换未这个客户
head.put("cmemo",cmemo);//TODO 这里填的是发货单的最早日期和最晚日期
head.put("ccuscode", "99989922");//todo 正式需要切换未这个客户
// head.put("ccuscode", "01010918");//客户
head.put("cstcode", "11");//销售类型
head.put("ddate", DateUtil.format(new Date(),"yyyy-MM-dd"));//创建时间
// head.put("ddate", "2025-05-31");//创建时间
jsonObject.put("head",head);
JSONArray body = new JSONArray();
if(CollectionUtils.isNotEmpty(goodsdocInDetailEntityList)){
@ -300,6 +338,7 @@ public class GoodsdocInServiceImpl extends BaseService<GoodsdocInEntity,String>
details.put("isum",item.getTransHasTaxAmount());
details.put("iquantity",new BigDecimal(item.getQuantity()).subtract(new BigDecimal(item.getQuantity()).add(new BigDecimal(item.getQuantity()))));
details.put("itaxrate",item.getTaxRate());
details.put("itaxrate","0.13");
body.add(details);
});
}

View File

@ -25,5 +25,14 @@ public interface IGoodsdocOutDao extends IBaseDao<GoodsdocOutEntity,String> {
GoodsdocOutEntity saveGoodsdocOutBak(GoodsdocOutEntity item);
List<GoodsdocOutEntity> getGoodsdocOutListNew(GoodsdocOutEntity goodsdocOutEntity);
int deleteByRecId(String recId);
List<GoodsdocOutEntity> getGoodsdocOutListAll(GoodsdocOutEntity goodsdocOutEntity);
List<GoodsdocOutEntity> getGoodsdocOutListGroup(GoodsdocOutEntity goodsdocOutEntity);
int updateGoodsdocOut(GoodsdocOutEntity goodsdocOutEntity);
}

View File

@ -1,6 +1,7 @@
package com.hzya.frame.Jackyun.goodsdocout.dao;
import com.hzya.frame.Jackyun.goodsdocout.entity.GoodsdocOutDetailEntity;
import com.hzya.frame.Jackyun.goodsdocout.entity.GoodsdocOutEntity;
import com.hzya.frame.basedao.dao.IBaseDao;
import java.util.List;
@ -22,4 +23,7 @@ public interface IGoodsdocOutDetailDao extends IBaseDao<GoodsdocOutDetailEntity,
GoodsdocOutDetailEntity saveDetailsBak(GoodsdocOutDetailEntity details);
int deleteByMainId(GoodsdocOutDetailEntity details);
//List<GoodsdocOutDetailEntity> getGoodsdocOutDetailListGroup(GoodsdocOutDetailEntity detailEntity);
List<GoodsdocOutDetailEntity> getGoodsdocOutDetailListGroup(GoodsdocOutEntity item);
}

View File

@ -34,6 +34,12 @@ public class GoodsdocOutDaoImpl extends MybatisGenericDao<GoodsdocOutEntity,Stri
public List<GoodsdocOutEntity> getGoodsdocOutList(GoodsdocOutEntity goodsdocOutEntity) {
return (List<GoodsdocOutEntity>) super.selectList("com.hzya.frame.Jackyun.goodsdocout.dao.impl.GoodsdocOutDaoImpl.entity_list_base_bak",goodsdocOutEntity);
}
@DS("jeckYun")
@Override
public List<GoodsdocOutEntity> getGoodsdocOutListNew(GoodsdocOutEntity goodsdocOutEntity) {
return (List<GoodsdocOutEntity>) super.selectList("com.hzya.frame.Jackyun.goodsdocout.dao.impl.GoodsdocOutDaoImpl.entity_list_base_new",goodsdocOutEntity);
}
@DS("jeckYun")
@Override
public GoodsdocOutEntity saveGoodsdocOutBak(GoodsdocOutEntity item) {
@ -44,4 +50,20 @@ public class GoodsdocOutDaoImpl extends MybatisGenericDao<GoodsdocOutEntity,Stri
public int deleteByRecId(String recId) {
return super.delete("com.hzya.frame.Jackyun.goodsdocout.dao.impl.GoodsdocOutDaoImpl.entity_delete", recId);
}
@DS("jeckYun")
@Override
public List<GoodsdocOutEntity> getGoodsdocOutListAll(GoodsdocOutEntity goodsdocOutEntity) {
return (List<GoodsdocOutEntity>) super.selectList("com.hzya.frame.Jackyun.goodsdocout.dao.impl.GoodsdocOutDaoImpl.entity_list_base_all",goodsdocOutEntity);
}
@DS("jeckYun")
@Override
public List<GoodsdocOutEntity> getGoodsdocOutListGroup(GoodsdocOutEntity goodsdocOutEntity) {
return (List<GoodsdocOutEntity>) super.selectList("com.hzya.frame.Jackyun.goodsdocout.dao.impl.GoodsdocOutDaoImpl.entity_list_base_group",goodsdocOutEntity);
}
@DS("jeckYun")
@Override
public int updateGoodsdocOut(GoodsdocOutEntity goodsdocOutEntity) {
return super.update("com.hzya.frame.Jackyun.goodsdocout.dao.impl.GoodsdocOutDaoImpl.entity_update", goodsdocOutEntity);
}
}

View File

@ -3,6 +3,7 @@ package com.hzya.frame.Jackyun.goodsdocout.dao.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.Jackyun.goodsdocout.dao.IGoodsdocOutDetailDao;
import com.hzya.frame.Jackyun.goodsdocout.entity.GoodsdocOutDetailEntity;
import com.hzya.frame.Jackyun.goodsdocout.entity.GoodsdocOutEntity;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import org.springframework.stereotype.Repository;
@ -38,4 +39,9 @@ public class GoodsdocOutDetailDaoImpl extends MybatisGenericDao<GoodsdocOutDetai
public int deleteByMainId(GoodsdocOutDetailEntity details) {
return super.delete("com.hzya.frame.Jackyun.goodsdocout.dao.impl.GoodsdocOutDetailDaoImpl.entity_delete",details.getMainId());
}
@DS("jeckYun")
@Override
public List<GoodsdocOutDetailEntity> getGoodsdocOutDetailListGroup(GoodsdocOutEntity item) {
return (List<GoodsdocOutDetailEntity>) super.selectList("com.hzya.frame.Jackyun.goodsdocout.dao.impl.GoodsdocOutDetailDaoImpl.entity_list_base_group", item);
}
}

View File

@ -1,6 +1,10 @@
package com.hzya.frame.Jackyun.goodsdocout.entity;
import com.hzya.frame.Jackyun.goodsdocin.entity.GoodsdocInEntity;
import com.hzya.frame.web.entity.BaseEntity;
import java.util.List;
/**
*
* @content 吉客云出库单
@ -56,6 +60,43 @@ public class GoodsdocOutDetailEntity extends BaseEntity {
private String cateName;//分类名称
private String serialSourceId;//出库唯一码关联字段此值不为空时需要查询接口获取唯一码信息:erp.storage.goodsdocserial
private String mainId;
private String num;
private String minDate;
private String maxDate;
public String getMinDate() {
return minDate;
}
public void setMinDate(String minDate) {
this.minDate = minDate;
}
public String getMaxDate() {
return maxDate;
}
public void setMaxDate(String maxDate) {
this.maxDate = maxDate;
}
public String getNum() {
return num;
}
public void setNum(String num) {
this.num = num;
}
private List<GoodsdocOutEntity> goodsdocOutEntityList;
public List<GoodsdocOutEntity> getGoodsdocOutEntityList() {
return goodsdocOutEntityList;
}
public void setGoodsdocOutEntityList(List<GoodsdocOutEntity> goodsdocOutEntityList) {
this.goodsdocOutEntityList = goodsdocOutEntityList;
}
public String getMainId() {
return mainId;

View File

@ -92,6 +92,7 @@
<result property="cateName" column="cateName" />
<!--无备注 -->
<result property="serialSourceId" column="serialSourceId" />
<result property="num" column="num" />
</resultMap>
<sql id="GoodsdocOutDetailEntity_Base_Column_List">
recId,
@ -140,6 +141,7 @@
cateName,
serialSourceId
</sql>
<select id="entity_list_base" resultMap="get-entity-result" parameterType="com.hzya.frame.Jackyun.goodsdocout.entity.GoodsdocOutDetailEntity">
select
<include refid="GoodsdocOutDetailEntity_Base_Column_List" />
@ -149,10 +151,45 @@
<if test="goodsId != null and goodsId !='' "> and goodsId = #{goodsId}</if>
<if test="goodsNo != null and goodsNo !='' "> and goodsNo = #{goodsNo}</if>
<if test="mainId != null and mainId !='' "> and mainId = #{mainId}</if>
and goodsNo like '5%'
</trim>
</select>
<!-- 查询 采用==查询 -->
<select id="entity_list_base_group" resultMap="get-entity-result" parameterType="com.hzya.frame.Jackyun.goodsdocout.entity.GoodsdocOutEntity">
select
goodsNo,goodsName,unitName,
CAST(SUM(
CASE
WHEN (ISNULL(c.cComUnitName,'')=b.unitName AND ISNUMERIC(c.ichangrate)=1)
THEN CAST(quantity AS DECIMAL(18, 6)) * CAST(c.ichangrate AS DECIMAL(18, 6))
ELSE
CAST(quantity AS DECIMAL(18, 6)) /
NULLIF(CASE WHEN d.jeck_code IS NULL OR ISNUMERIC(d.propor)=0 THEN 1 ELSE CAST(d.propor AS DECIMAL(18, 6)) END, 0)
END
) AS DECIMAL(18, 6)) AS quantity,
SUM(CAST(transHasTaxAmount AS DECIMAL(18, 6))) AS transHasTaxAmount,
max(num)*sum(CAST(quantity AS DECIMAL(18, 6))) as num
from jeck_goodsdocout_details b
left join jeck_goodsdocout a on a.recid = b.mainid
left join v_inventoty c on b.goodsNo = c.cinvcode
left join contrast_inventory d on b.goodsNo= d.jeck_code
inner join contrast_customer bb on a.channelCode=bb.jeck_code
inner join contrast_warehouse cc on a.warehouseCode=cc.jeck_code
left join contrast_inventory_big dd on b.goodsno = dd.invcode
where a.inouttype = '201'
and b.goodsNo like '5%'
<if test="warehouseCode != null and warehouseCode !='' ">and cc.u8_code = #{warehouseCode} </if>
<if test="channelCode != null and channelCode !='' "> and bb.u8_code = #{channelCode}</if>
and CAST(GETDATE() AS DATE)>inoutdate
and c.cinvcode is not null
/*and inoutdate >='2025-05-01 00:00:00'
and inoutdate &lt; '2025-06-01 00:00:00'*/
and inoutdate >= #{minDate}
and inoutdate &lt;= #{maxDate}
group by goodsNo,goodsName,unitName
</select>
<!-- 新增 -->
<insert id="entity_insert" parameterType="com.hzya.frame.Jackyun.goodsdocout.entity.GoodsdocOutDetailEntity">
insert into jeck_goodsdocout_details(

View File

@ -1,5 +1,6 @@
package com.hzya.frame.Jackyun.goodsdocout.entity;
import com.hzya.frame.Jackyun.goodsdocin.entity.GoodsdocInEntity;
import com.hzya.frame.web.entity.BaseEntity;
import java.util.List;
@ -66,6 +67,42 @@ public class GoodsdocOutEntity extends BaseEntity {
private String state;
private String u8BillCode;
private String accId;
private String custCode;
private String minDate;
private String maxDate;
public String getMinDate() {
return minDate;
}
public void setMinDate(String minDate) {
this.minDate = minDate;
}
public String getMaxDate() {
return maxDate;
}
public void setMaxDate(String maxDate) {
this.maxDate = maxDate;
}
public String getCustCode() {
return custCode;
}
public void setCustCode(String custCode) {
this.custCode = custCode;
}
private List<GoodsdocOutEntity> groupList;
public List<GoodsdocOutEntity> getGroupList() {
return groupList;
}
public void setGroupList(List<GoodsdocOutEntity> groupList) {
this.groupList = groupList;
}
public String getU8BillCode() {
return u8BillCode;
@ -494,4 +531,5 @@ public class GoodsdocOutEntity extends BaseEntity {
public void setOutBillNo(String outBillNo) {
this.outBillNo = outBillNo;
}
}

View File

@ -97,6 +97,9 @@
<result property="u8BillCode" column="u8BillCode" />
<!--公司编号 -->
<result property="companyCode" column="companyCode" />
<result property="accId" column="accId" />
<result property="minDate" column="minDate" />
<result property="maxDate" column="maxDate" />
</resultMap>
<sql id="ReceiptEntity_Base_Column_List">
@ -108,11 +111,48 @@
</select>
<select id="entity_list_base_all" resultMap="get-entity-result" parameterType="com.hzya.frame.Jackyun.goodsdocout.entity.GoodsdocOutEntity">
select * from jeck_goodsdocout where inouttype = '201' and state is null
and channelCode in (select jeck_code from contrast_customer )
and warehouseCode in (select jeck_code from contrast_warehouse where u8_code is not null)
order by inOutDate asc
</select>
<select id="entity_list_base_bak" resultMap="get-entity-result" parameterType="com.hzya.frame.Jackyun.goodsdocout.entity.GoodsdocOutEntity">
select * from jeck_goodsdocout
where state = #{state}
where (state = #{state} or inouttype != '201')
</select>
<select id="entity_list_base_new" resultMap="get-entity-result" parameterType="com.hzya.frame.Jackyun.goodsdocout.entity.GoodsdocOutEntity">
select recId from jeck_goodsdocout
<trim prefix="where" prefixOverrides="and">
<if test="warehouseCode != null and warehouseCode !='' ">warehouseCode = #{warehouseCode} </if>
<if test="channelCode != null and channelCode !='' "> and channelCode = #{channelCode}</if>
</trim>
</select>
<select id="entity_list_base_group" resultMap="get-entity-result" parameterType="com.hzya.frame.Jackyun.goodsdocout.entity.GoodsdocOutEntity">
select distinct c.u8_code as warehouseCode, b.u8_code as channelCode, b.u8_accid as accId,
min(inoutdate) as minDate,
max(inoutdate) as maxDate
from jeck_goodsdocout a
inner join contrast_customer b on a.channelCode=b.jeck_code
inner join contrast_warehouse c on a.warehouseCode=c.jeck_code
where inouttype = '201'
and state is null
and CAST(GETDATE() AS DATE)>inoutdate
and inoutdate >= #{minDate}
and inoutdate &lt;= #{maxDate}
group by c.u8_code,b.u8_code,b.u8_accid
</select>
<!--通过主键修改方法-->
<insert id="entity_insert" parameterType="com.hzya.frame.Jackyun.goodsdocout.entity.GoodsdocOutEntity">
@ -332,7 +372,24 @@
</trim>
);
</insert>
<!-- 修改 -->
<update id="entity_update" parameterType="com.hzya.frame.Jackyun.goodsdocout.entity.GoodsdocOutEntity">
update a set
<trim suffix="" suffixOverrides=",">
<if test="state != null and state !='' ">state= #{state} ,</if>
<if test="u8BillCode != null and u8BillCode !='' "> u8BillCode=#{u8BillCode}</if>
</trim>
from jeck_goodsdocout a
inner join contrast_customer b on a.channelCode=b.jeck_code
inner join contrast_warehouse c on a.warehouseCode=c.jeck_code
where inouttype = '201'
<if test="warehouseCode != null and warehouseCode !='' ">and c.u8_code = #{warehouseCode} </if>
<if test="channelCode != null and channelCode !='' "> and b.u8_code = #{channelCode}</if>
and CAST(GETDATE() AS DATE)>inoutdate
and inoutdate >= #{minDate}
and inoutdate &lt;= #{maxDate}
and state is null
</update>
<!-- 物理删除 -->
<delete id="entity_delete" parameterType="com.hzya.frame.Jackyun.goodsdocout.entity.GoodsdocOutEntity">
delete from jeck_goodsdocout where recId =#{recId}

View File

@ -33,4 +33,14 @@ public interface IGoodsdocOutService extends IBaseService<GoodsdocOutEntity,Stri
*/
void jeckYunGoodsdocOutBak(JSONObject requestJson);
/**
*
* @content 抓取吉客云出库数据推送U8发货单以及出库单
* @className: Administrator
* @author laborer
* @date 2025-05-27 9:56
*
*/
void getJeckGoodsdocOutToU8(JSONObject requestJson);
}

View File

@ -1,11 +1,18 @@
package com.hzya.frame.Jackyun.goodsdocout.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.UUID;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.Jackyun.goodsdocin.entity.GoodsdocInLogisticEntity;
import com.hzya.frame.Jackyun.contrast.customer.dao.ICustomerDao;
import com.hzya.frame.Jackyun.contrast.customer.entity.CustomerEntity;
import com.hzya.frame.Jackyun.contrast.inventory.dao.IInventoryDao;
import com.hzya.frame.Jackyun.contrast.inventory.entity.InventoryEntity;
import com.hzya.frame.Jackyun.contrast.inventory.entity.InventoryUnitEntity;
import com.hzya.frame.Jackyun.contrast.warehouse.dao.IWarehouseDao;
import com.hzya.frame.Jackyun.contrast.warehouse.entity.WarehouseEntity;
import com.hzya.frame.Jackyun.goodsdocout.dao.IGoodsdocOutDao;
import com.hzya.frame.Jackyun.goodsdocout.dao.IGoodsdocOutDetailDao;
import com.hzya.frame.Jackyun.goodsdocout.dao.IGoodsdocOutLogisticDao;
@ -15,13 +22,19 @@ import com.hzya.frame.Jackyun.goodsdocout.entity.GoodsdocOutLogisticEntity;
import com.hzya.frame.Jackyun.goodsdocout.service.IGoodsdocOutService;
import com.hzya.frame.Jackyun.util.JackyunOpenHttpUtils;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.u8.delivery.service.IDeliveryOrderService;
import com.hzya.frame.u8.saleout.service.ISaleOutService;
import com.hzya.frame.u8.util.BaseU8Result;
import com.hzya.frame.u8.util.U8ResultEntity;
import com.hzya.frame.u8.util.U8Util;
import org.apache.commons.collections.CollectionUtils;
import org.apache.ibatis.jdbc.Null;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
/**
*
@ -39,13 +52,25 @@ public class GoodsdocOutServiceImpl extends BaseService<GoodsdocOutEntity,String
private IGoodsdocOutLogisticDao goodsdocOutLogisticDao;
@Autowired
private IGoodsdocOutDetailDao goodsdocOutDetailDao;
@Autowired
private IDeliveryOrderService deliveryOrderService;
@Autowired
private ISaleOutService saleOutService;
@Autowired
private ICustomerDao customerDao;
@Autowired
private IWarehouseDao warehouseDao;
@Autowired
private IInventoryDao iInventoryDao;
@Override
public void getjRckYunGoodsdocOut(JSONObject json) {
logger.info("开始执行吉客云出库单获取数据"+json.toString());
JSONArray dataArr = new JSONArray();
int i = 0;
String method = "erp.storage.goodsdocout.v2";
// 创建 Calendar 实例
Date now = json.getDate("startTime");
// Date now = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(now);
@ -72,6 +97,9 @@ public class GoodsdocOutServiceImpl extends BaseService<GoodsdocOutEntity,String
main.put("selelctFields",fields);
main.put("startDate", startTime);
main.put("endDate", endTime);
// main.put("startDate", "2025-06-01 00:00:00");
// main.put("endDate", "2025-06-11 23:59:59");
logger.info("获取吉客云出库单开始时间:{} 结束时间:{}",startTime,endTime);
String result = JackyunOpenHttpUtils.post(method, "v1.0", main);
if(StrUtil.isEmpty(result)){
throw new RuntimeException("获取吉客云出库单失败");
@ -90,6 +118,11 @@ public class GoodsdocOutServiceImpl extends BaseService<GoodsdocOutEntity,String
}
//判断是否有数据处理到如果数组数据不为O则进行数据处理
if(dataArr.size()>0){
// // 修复编码
// String fixedJson = JackyunOpenHttpUtils.fixJsonEncoding(dataArr.toString());
// // 解析JSON
// dataArr = JSONObject.parseArray(fixedJson);
logger.info("本次获取的吉客云数据"+dataArr.toString());
dataArr.forEach(item->{
GoodsdocOutEntity goodsdocOut = JSONObject.parseObject(JSON.toJSONString(item),GoodsdocOutEntity.class);
//判断是否已经存在此单据如果存在则跳过如果不存在则新增写入
@ -97,6 +130,7 @@ public class GoodsdocOutServiceImpl extends BaseService<GoodsdocOutEntity,String
checkEntity.setRecId(goodsdocOut.getRecId());
List<GoodsdocOutEntity> goodsdocOutEntityList = goodsdocOutDao.checkBill(checkEntity);
if(goodsdocOutEntityList.size() == 0){
logger.info("本次新增的数据"+JSON.toJSONString(goodsdocOut));
//新增出库单数据
GoodsdocOutEntity goodsdocOutEntity =goodsdocOutDao.saveGoodsdocOut(goodsdocOut);
//判断是否有物流数据如果有则保存
@ -128,9 +162,11 @@ public class GoodsdocOutServiceImpl extends BaseService<GoodsdocOutEntity,String
GoodsdocOutEntity goodsdocOutEntity = new GoodsdocOutEntity();
goodsdocOutEntity.setState("Y");
//查询所有所有已经处理完成的出库单
AtomicInteger i = new AtomicInteger();
List<GoodsdocOutEntity> goodsdocOutEntityList = goodsdocOutDao.getGoodsdocOutList(goodsdocOutEntity);
if(CollectionUtils.isNotEmpty(goodsdocOutEntityList)){
goodsdocOutEntityList.forEach(item -> {
i.getAndIncrement();
String recId = item.getRecId();
if(StrUtil.isNotEmpty(recId)){
//查询出库单物流信息
@ -165,4 +201,186 @@ public class GoodsdocOutServiceImpl extends BaseService<GoodsdocOutEntity,String
});
}
}
@Override
public void getJeckGoodsdocOutToU8(JSONObject requestJson) {
GoodsdocOutEntity goodsdocOutEntity = new GoodsdocOutEntity();
goodsdocOutEntity.setMinDate(requestJson.getString("minDate"));
goodsdocOutEntity.setMaxDate(requestJson.getString("maxDate"));
//重新查询 然后进行分组
List<GoodsdocOutEntity> goodsdocOutList = goodsdocOutDao.getGoodsdocOutListGroup(goodsdocOutEntity);
if(CollectionUtils.isNotEmpty(goodsdocOutList)){
// // 获取最大和最小时间
// String minDate = null;
// String maxDate = null;
// // 获取最小时间
// Optional<GoodsdocOutEntity> minEntity = goodsdocOutList.stream()
// .min(Comparator.comparing(GoodsdocOutEntity::getInOutDate));
// minDate = minEntity.isPresent() ? minEntity.get().getInOutDate() : null;
//
// // 获取最大时间
// Optional<GoodsdocOutEntity> maxEntity = goodsdocOutList.stream()
// .max(Comparator.comparing(GoodsdocOutEntity::getInOutDate));
// maxDate = maxEntity.isPresent() ? maxEntity.get().getInOutDate() : null;
// String cmemo = minDate+"-"+maxDate;
//按照分组之后的效果重新或者当前分组下的recid用来获取所属的明细信息
goodsdocOutList.forEach(item -> {
String minDateStr = goodsdocOutEntity.getMinDate() != null
? DateUtil.format(DateUtil.parse(goodsdocOutEntity.getMinDate()), "yyyyMMdd")
: "";
String maxDateStr = goodsdocOutEntity.getMaxDate() != null
? DateUtil.format(DateUtil.parse(goodsdocOutEntity.getMaxDate()), "yyyyMMdd")
: "";
String cmemo = minDateStr + "-" + maxDateStr;
item.setMemo(cmemo);
item.setMinDate(requestJson.getString("minDate"));
item.setMaxDate(requestJson.getString("maxDate"));
//查询明细数据
List<GoodsdocOutDetailEntity> goodsdocOutDetailEntityList = goodsdocOutDetailDao.getGoodsdocOutDetailListGroup(item);
if (goodsdocOutDetailEntityList.size()==0){
item.setState("Y");
goodsdocOutDao.updateGoodsdocOut(item);
return;
}
List<GoodsdocOutDetailEntity> goodsdocOutDetailEntityListNew = new ArrayList<>();
// goodsdocOutEntity = goodsdocOutList.get(0);
// todo 开始获取中间库获取转换数据
//统一处理如果涉及大坛的情况下多添加一次大坛信息
if(CollectionUtils.isNotEmpty(goodsdocOutDetailEntityList)){
goodsdocOutDetailEntityList.forEach(details -> {
goodsdocOutDetailEntityListNew.add(details);
if("502060036".equals(details.getGoodsNo())){
GoodsdocOutDetailEntity big = new GoodsdocOutDetailEntity();
big.setGoodsNo("50090503");
big.setGoodsName("黄酒大坛");
big.setQuantity(details.getNum());
big.setUnitName("");
big.setTransHasTaxAmount("0");
goodsdocOutDetailEntityListNew.add(big);
}
});
}
JSONObject jsonObject = bdingParm(item,goodsdocOutDetailEntityListNew,cmemo);
// if(1==1){
// throw new RuntimeException();
// }
//调用U8接口生成发货单
U8ResultEntity u8ResultEntity = deliveryOrderService.addDelivery(jsonObject);
String state = "";
if (!u8ResultEntity.issuccess()) {
item.setState("N");
}
item.setU8BillCode(u8ResultEntity.getmessage());
JSONObject saleOut = bdingParmOut(item, goodsdocOutDetailEntityListNew,cmemo);
U8ResultEntity u8ResultOut = saleOutService.addSaleOut(saleOut);
if (!u8ResultOut.issuccess()) {
item.setState("N");
} else {
item.setState("Y");
}
goodsdocOutDao.updateGoodsdocOut(item);
});
}
}
/**
*
* @content 开始组装U8红字销售出库单数据
* @className: Administrator
* @author laborer
* @date 2025-04-23 15:11
*
*/
private JSONObject bdingParmOut(GoodsdocOutEntity goodsdocOutEntity, List<GoodsdocOutDetailEntity> goodsdocOutDetailEntityList,String cmemo) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("AccId", goodsdocOutEntity.getAccId());
jsonObject.put("billid", "123");
JSONObject head = new JSONObject();
head.put("cbuscode", goodsdocOutEntity.getU8BillCode());//发货单号
head.put("cdepcode", "005");//todo 部门编码
head.put("cmemo",cmemo);//TODO 这里填的是发货单的最早日期和最晚日期
head.put("cmaker", "吉客云出库单自动生成");//创建人
head.put("cbustype", "普通销售");//创建人
head.put("crdcode", "203");//入库类别编码
head.put("cwhcode", goodsdocOutEntity.getWarehouseCode());//仓库编码 todo 正式需要切换为04009
head.put("ddate", DateUtil.format(new Date(),"yyyy-MM-dd"));//销售类型
head.put("ccuscode", goodsdocOutEntity.getCustCode());//todo 正式需要切换未这个客户
head.put("cDefine1", "多组织-采购订单");//
// head.put("ccuscode", "01010918");//客户
head.put("csource","发货单");
jsonObject.put("head",head);
JSONArray body = new JSONArray();
int i = 0;
if(CollectionUtils.isNotEmpty(goodsdocOutDetailEntityList)){
for(GoodsdocOutDetailEntity item : goodsdocOutDetailEntityList){
i++;
// if("501010323".equals(item.getGoodsNo())){
// continue;
// }
JSONObject details = new JSONObject();
details.put("cbdlcode",goodsdocOutEntity.getU8BillCode());//发货单号
details.put("cdblrowno", i);//行号
details.put("cinvcode", item.getGoodsNo());//存货编码
details.put("iquantity",item.getQuantity());
// details.put("iquantity", item.getQuantity());//数量
body.add(details);
}
}
jsonObject.put("body",body);
JSONObject result = new JSONObject();
result.put("jsonStr", jsonObject);
return result;
}
private JSONObject bdingParm(GoodsdocOutEntity goodsdocOutEntity, List<GoodsdocOutDetailEntity> goodsdocOutDetailEntityList,String cmemo) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("AccId", goodsdocOutEntity.getAccId());
jsonObject.put("billid", "123");
JSONObject head = new JSONObject();
head.put("brdflag", "0");//发货0退货1@
head.put("breturnflag", "0");//发货0退货1
head.put("cbustype", "普通销售");//
// head.put("cbustype", "普通销售");//
head.put("cdepcode", "005");//销售部门 默认
head.put("cmaker", "吉客云出库单自动生成");//创建人
head.put("cmemo",cmemo);//TODO 这里填的是发货单的最早日期和最晚日期
// head.put("cDefine1", "多组织-红字采购入库");//
head.put("ccuscode", goodsdocOutEntity.getChannelCode());
// head.put("ccuscode", "01010918");//客户
head.put("cstcode", "11");//销售类型
head.put("ddate", DateUtil.format(new Date(), "yyyy-MM-dd"));//创建时间
jsonObject.put("head", head);
JSONArray body = new JSONArray();
if (CollectionUtils.isNotEmpty(goodsdocOutDetailEntityList)) {
goodsdocOutDetailEntityList.forEach(item -> {
JSONObject details = new JSONObject();
details.put("cwhcode", goodsdocOutEntity.getWarehouseCode());//todo 正式需要切换为04009
details.put("cinvcode", item.getGoodsNo());
List<CustomerEntity> inv = customerDao.quertInvTest(item.getGoodsNo());
if (inv.size()>0){
details.put("cunitid", inv.get(0).getU8_name());
if (inv.get(0).getJeck_name() != null){
details.put("inum", String.format("%.2f",
Double.parseDouble(item.getQuantity()) /
Double.parseDouble(inv.get(0).getJeck_name())));
}
}
details.put("isum", item.getTransHasTaxAmount());
details.put("iquantity", item.getQuantity());
details.put("itaxrate", "13");
body.add(details);
});
}
jsonObject.put("body", body);
JSONObject result = new JSONObject();
result.put("jsonStr", jsonObject);
return result;
}
}

View File

@ -3,6 +3,7 @@
package com.hzya.frame.Jackyun.util;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.junit.Test;
@ -168,7 +169,7 @@ public void test01(){
* @return HTTP-Post返回结果
*/
public static String postData(String url, String postData) throws IOException {
return postData(url, postData, "UTF-8", 300000);
return postDataNew(url, postData, "UTF-8", 300000);
}
/**
@ -252,6 +253,88 @@ public void test01(){
return resultBuffer.toString();
}
public static String postDataNew(String url, String postData, String encoding, int timeOut) throws IOException {
if (encoding == null || encoding.isEmpty()) {
encoding = "UTF-8";
}
if (timeOut <= 0) {
timeOut = 300000;
}
PrintWriter printWriter = null;
BufferedReader bufferedReader = null;
StringBuffer resultBuffer = null;
URLConnection urlConnection = null;
String result = HttpRequest.post(url)
.header("accept", "application/json; charset=UTF-8")//头信息多个头信息多次调用此方法即可
.header("connection", "Keep-Alive")//头信息多个头信息多次调用此方法即可
.header("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)")//头信息多个头信息多次调用此方法即可
.header("Content-Type", "application/x-www-form-urlencoded")//头信息多个头信息多次调用此方法即可
.body(postData)//表单内容
.timeout(120000)//超时毫秒
.execute().body();
//
//
// // 发送Post请求
// try {
// URL postMethodUrl = new URL(url);
// // 打开连接
// urlConnection = postMethodUrl.openConnection();
// // 设置通用的请求属性
// urlConnection.setRequestProperty("Accept", "application/json; charset=UTF-8");
// urlConnection.setRequestProperty("connection", "Keep-Alive");
//
// urlConnection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
// urlConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
// urlConnection.setConnectTimeout(timeOut);
// // 设置url连接可以用于输入输出
// urlConnection.setDoOutput(true);
// urlConnection.setDoInput(true);
// // 获取URLConnection对象对应的输出流
// printWriter = new PrintWriter(urlConnection.getOutputStream());
// // 发送请求参数
// printWriter.print(postData);
// // flush输出流的缓冲
// printWriter.flush();
// // 定义BufferedReader输入流来读取URL的响应
// bufferedReader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
// resultBuffer = new StringBuffer();
// String temp = "";
// while ((temp = bufferedReader.readLine()) != null) {
// resultBuffer.append(temp);
// }
// } finally {
// if (bufferedReader != null) {
// try {
// bufferedReader.close();
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
//
// if (printWriter != null) {
// try {
// printWriter.close();
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
// }
return result;
}
/**
* 修复JSON编码从ISO-8859-1转为UTF-8
*/
// public static String fixJsonEncoding(String garbledJson) {
// try {
// // 先将乱码字符串按ISO-8859-1转为字节
// byte[] bytes = garbledJson.getBytes("GBK");
//
// // 再按UTF-8重新编码为字符串
// return new String(bytes, "UTF-8");
// } catch (Exception e) {
// throw new RuntimeException("编码修复失败", e);
// }
// }
//endregion
}

View File

@ -0,0 +1,20 @@
package com.hzya.frame.barcode.dao;
import com.hzya.frame.barcode.entity.BarcodeEntity;
import com.hzya.frame.basedao.dao.IBaseDao;
import java.util.List;
/**
* (attendance: table)表数据库访问层
*
* @author makejava
* @since 2024-09-19 13:26:00
*/
public interface IBarcodeDao extends IBaseDao<BarcodeEntity, String> {
List<BarcodeEntity> getBarcodeList(BarcodeEntity entity);
String getBarcodeListCount(BarcodeEntity entity);
}

View File

@ -0,0 +1,33 @@
package com.hzya.frame.barcode.dao.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.barcode.dao.IBarcodeDao;
import com.hzya.frame.barcode.entity.BarcodeEntity;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* (码包)表数据库访问层
*
* @author makejava
* @since 2024-09-19 13:26:00
*/
@Repository("BarcodeDaoImpl")
public class BarcodeDaoImpl extends MybatisGenericDao<BarcodeEntity, String> implements IBarcodeDao {
@DS("barcode")
@Override
public List<BarcodeEntity> getBarcodeList(BarcodeEntity entity) {
return (List<BarcodeEntity>) super.selectList("com.hzya.frame.barcode.dao.impl.BarcodeDaoImpl.entity_list_base",entity);
}
@DS("barcode")
@Override
public String getBarcodeListCount(BarcodeEntity entity) {
BarcodeEntity barcode = (BarcodeEntity) super.selectOne("com.hzya.frame.barcode.dao.impl.BarcodeDaoImpl.entity_list_count",entity);
return barcode.getId();
}
}

View File

@ -0,0 +1,134 @@
package com.hzya.frame.barcode.entity;
import com.hzya.frame.web.entity.BaseEntity;
/**
* (Attendance)实体类
*
* @author makejava
* @since 2024-09-19 13:26:00
*/
public class BarcodeEntity extends BaseEntity {
private String boxCode;
private String productCode;
private String companyId;
private String productId;
private String deleted;
private String creator;
private String createDate;
private String modifier;
private String modifyDate;
private String dealStatus;
private String activeStatus;
private String bakCode;
public String getBoxCode() {
return boxCode;
}
public void setBoxCode(String boxCode) {
this.boxCode = boxCode;
}
public String getProductCode() {
return productCode;
}
public void setProductCode(String productCode) {
this.productCode = productCode;
}
@Override
public String getCompanyId() {
return companyId;
}
@Override
public void setCompanyId(String companyId) {
this.companyId = companyId;
}
public String getProductId() {
return productId;
}
public void setProductId(String productId) {
this.productId = productId;
}
public String getDeleted() {
return deleted;
}
public void setDeleted(String deleted) {
this.deleted = deleted;
}
public String getCreator() {
return creator;
}
public void setCreator(String creator) {
this.creator = creator;
}
public String getCreateDate() {
return createDate;
}
public void setCreateDate(String createDate) {
this.createDate = createDate;
}
public String getModifier() {
return modifier;
}
public void setModifier(String modifier) {
this.modifier = modifier;
}
public String getModifyDate() {
return modifyDate;
}
public void setModifyDate(String modifyDate) {
this.modifyDate = modifyDate;
}
public String getDealStatus() {
return dealStatus;
}
public void setDealStatus(String dealStatus) {
this.dealStatus = dealStatus;
}
public String getActiveStatus() {
return activeStatus;
}
public void setActiveStatus(String activeStatus) {
this.activeStatus = activeStatus;
}
public String getBakCode() {
return bakCode;
}
public void setBakCode(String bakCode) {
this.bakCode = bakCode;
}
}

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hzya.frame.barcode.dao.impl.BarcodeDaoImpl">
<resultMap id="get-entity-result" type="com.hzya.frame.barcode.entity.BarcodeEntity">
<result property="id" column="id" />
<result property="boxCode" column="box_code" />
<result property="productCode" column="product_code" />
<result property="companyId" column="company_id" />
<result property="productId" column="product_id" />
<result property="deleted" column="deleted" />
<result property="creator" column="creator" />
<result property="createDate" column="create_date" />
<result property="modifier" column="modifier" />
<result property="modifyDate" column="modify_date" />
<result property="dealStatus" column="deal_status" />
<result property="activeStatus" column="active_status" />
<result property="bakCode" column="bak_code" />
</resultMap>
<select id="entity_list_count" resultMap="get-entity-result" parameterType="com.hzya.frame.barcode.entity.BarcodeEntity">
select count(*) id from encode_box_product_code ebp where ebp.product_code like '61%' and deal_status!=1 and
ebp.create_date &gt;='2025-01-01' and ebp.create_date &lt;= DATE(DATE_SUB(CURDATE(), INTERVAL 1 DAY))
</select>
<select id="entity_list_base" resultMap="get-entity-result" parameterType="com.hzya.frame.barcode.entity.BarcodeEntity">
select create_date,product_code from encode_box_product_code ebp where ebp.product_code like '61%' and deal_status!=1 and
ebp.create_date &gt;='2025-01-01' and ebp.create_date &lt;= DATE(DATE_SUB(CURDATE(), INTERVAL 1 DAY))
order by ebp.create_date desc
limit 10
</select>
</mapper>

View File

@ -0,0 +1,17 @@
package com.hzya.frame.barcode.service;
import com.hzya.frame.barcode.entity.BarcodeEntity;
import java.util.List;
/**
* (Attendance)表服务接口
*
* @author makejava
* @since 2024-09-19 13:26:00
*/
public interface IBarcodeService {
List<BarcodeEntity> getBarcodeList(BarcodeEntity entity);
String getBarcodeCount(BarcodeEntity entity);
}

View File

@ -0,0 +1,37 @@
package com.hzya.frame.barcode.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.barcode.dao.IBarcodeDao;
import com.hzya.frame.barcode.entity.BarcodeEntity;
import com.hzya.frame.barcode.service.IBarcodeService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* (码包)表服务实现类
*
* @author makejava
* @since 2024-09-19 13:26:00
*/
@Service("bacodeService")
public class BarcodeServiceImpl implements IBarcodeService {
private static final Logger logger = LoggerFactory.getLogger(BarcodeServiceImpl.class);
@Autowired
private IBarcodeDao barcodeDao;
@Override
public List<BarcodeEntity> getBarcodeList(BarcodeEntity entity){
return barcodeDao.getBarcodeList(entity);
}
@Override
public String getBarcodeCount(BarcodeEntity entity){
return barcodeDao.getBarcodeListCount(entity);
}
}

View File

@ -0,0 +1,16 @@
package com.hzya.frame.dd.robot.service;
import com.hzya.frame.barcode.entity.BarcodeEntity;
import java.util.List;
/**
* (Attendance)表服务接口
*
* @author makejava
* @since 2024-09-19 13:26:00
*/
public interface IDingRobotService {
String getBarcodeList(BarcodeEntity entity);
}

View File

@ -0,0 +1,154 @@
package com.hzya.frame.dd.robot.service.impl;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.barcode.entity.BarcodeEntity;
import com.hzya.frame.barcode.service.IBarcodeService;
import com.hzya.frame.dd.robot.service.IDingRobotService;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.UnsupportedEncodingException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import org.apache.commons.codec.binary.Base64;
import java.net.URLEncoder;
import java.util.concurrent.atomic.AtomicReference;
/**
* (Attendance)表服务实现类
*
* @author makejava
* @since 2024-09-19 13:26:00
*/
@Service("dingRobotService")
public class DingRobotServiceImpl implements IDingRobotService {
private static final Logger logger = LoggerFactory.getLogger(DingRobotServiceImpl.class);
private static String access_token = "f2f3bffeb0184589fb2038fe21196936e837096ea54f0a82d8f6c05804707e46";
@Autowired
private IBarcodeService barcodeService;
@Resource
private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
@Override
public String getBarcodeList(BarcodeEntity entity){
String count = barcodeService.getBarcodeCount(entity);
List<BarcodeEntity> list = barcodeService.getBarcodeList(entity);
JSONObject main = bindingAdd(count,list);
long timestamp = System.currentTimeMillis();
String sign = getSign(Long.toString(timestamp));
String query = "access_token="+access_token+"&sign="+sign+"&timestamp="+timestamp;
if (count.equals("0")){
return "0";
}else {
String result = sendTORobotEsb(main.toString(), "8000050004", query);
IntegrationTaskLivingDetailsEntity logDetails = new IntegrationTaskLivingDetailsEntity();
logDetails.setNewTransmitInfo(result);
logDetails.setNewPushDate(new Date());
logDetails.setRootAppNewData(JSON.toJSONString(list));
logDetails.setPluginId("kjsDingRobotPlugin");
JSONObject resultObj = JSON.parseObject(result);
boolean flag = resultObj.getString("code").equals("200");
if (flag) {
logDetails.setNewTransmitInfo("推送成功");
}
try {
if (flag) {
//首推成功
taskLivingDetailsService.saveLogToSuccess(logDetails);
} else {
//首推失败
taskLivingDetailsService.saveLogToFail(logDetails);
}
} catch (Exception e) {
logger.error("保存日志失败" + e.getMessage());
e.printStackTrace();
}
return result;
}
}
public String getSign(String timestamp){
//Long timestamp = System.currentTimeMillis();
String sign = "";
try {
String secret = "SEC7d83e2c124953dedd9794577fccc34900ea5032c6c67629e8293282d832f6029";
String stringToSign = timestamp + "\n" + secret;
Mac mac = Mac.getInstance("HmacSHA256");
mac.init(new SecretKeySpec(secret.getBytes("UTF-8"), "HmacSHA256"));
byte[] signData = mac.doFinal(stringToSign.getBytes("UTF-8"));
sign = URLEncoder.encode(new String(Base64.encodeBase64(signData)), "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
} catch (InvalidKeyException e) {
throw new RuntimeException(e);
}
return sign;
}
public String sendTORobotEsb(String parm, String apiCode,String query){
String baseUrl = "http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface?" + query;
System.out.println("推送参数"+parm);
String result = HttpRequest.post(baseUrl)
.header("appId", "800005")//头信息多个头信息多次调用此方法即可
.header("apiCode", apiCode)//头信息多个头信息多次调用此方法即可
.header("publicKey", "ZJYAju1ajInPjFRjPC/gO6XaNx4fDlaPBRNDe5XW/O8GWVVCe7eDIk+3zDUT+v578prj")//头信息多个头信息多次调用此方法即可
.header("secretKey", "ExwEKYQs1xV46u+UttuhaxlsGmbIz9uZE+XvD8loIUVzfoy6p67iMAwaelVG7fOOj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//头信息多个头信息多次调用此方法即可
.body(parm)//表单内容
.timeout(20000)//超时毫秒
.execute().body();
System.out.println("返回参数"+result);
if(StrUtil.isNotEmpty(result)){
return analytic(result);
}
return null;
}
public static String analytic(String parm){
JSONObject main = JSON.parseObject(parm);
return main.getString("attribute");
}
private JSONObject bindingAdd(String count, List<BarcodeEntity> sale) {
JSONObject main = new JSONObject();
main.put("msgtype","markdown");
JSONObject markdown = new JSONObject();
markdown.put("title","码包预警");
AtomicReference<String> tt = new AtomicReference<>("#### 当前异常数据总计" + count + "条。");
if(CollectionUtils.isNotEmpty(sale)){
String tt2 = "最新部分明细如下: \n" +
"|create_date|product_code|\n" +
"|---|---|\n";
tt.set(tt + tt2);
sale.forEach(line -> {
String str = "|"+line.getCreateDate()+"|"+line.getProductCode()+"|\n";
tt.set(tt + str);
});
}
markdown.put("text",tt);
main.put("markdown",markdown);
return main;
}
}

View File

@ -1,5 +1,6 @@
package com.hzya.frame.u8.delivery.dao;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.basedao.dao.IBaseDao;
import com.hzya.frame.u8.delivery.entity.DeliveryOrderEntity;
@ -19,4 +20,6 @@ public interface IDeliveryOrderDao extends IBaseDao<DeliveryOrderEntity,String>
*/
int updateDeliveryState( DeliveryOrderEntity entity);
int updateSengStatus(DeliveryOrderEntity entity);
}

View File

@ -18,4 +18,10 @@ public class DeliveryOrderDaoImpl extends MybatisGenericDao<DeliveryOrderEntity,
public int updateDeliveryState( DeliveryOrderEntity entity) {
return super.update("com.hzya.frame.u8.delivery.dao.impl.DeliveryOrderDaoImpl.entity_update",entity);
}
@Override
@DS("#entity.dataSourceCode")
public int updateSengStatus(DeliveryOrderEntity entity) {
return super.update("com.hzya.frame.u8.delivery.dao.impl.DeliveryOrderDaoImpl.entity_update_state",entity);
}
}

View File

@ -48,6 +48,15 @@ public class DeliveryOrderEntity extends BaseEntity {
//冻结状态
private String frozen;
private String AccId;
private String sync_flag;
public String getSync_flag() {
return sync_flag;
}
public void setSync_flag(String sync_flag) {
this.sync_flag = sync_flag;
}
public String getAccId() {
return AccId;

View File

@ -49,9 +49,10 @@
<if test="ccusname != null and ccusname !='' "> and ccusname = #{ccusname} </if>
<if test="csocode != null and csocode !='' "> and csocode = #{csocode} </if>
<if test="bReturnFlag != null and bReturnFlag !='' "> and bReturnFlag = #{bReturnFlag} </if>
<if test="startTime != null and startTime !='' "> and lasttime >= #{startTime} </if>
<if test="endTime != null and endTime !='' "><![CDATA[ and lasttime < #{endTime} ]]> </if>
<!--<if test="startTime != null and startTime !='' "> and lasttime >= #{startTime} </if>
<if test="endTime != null and endTime !='' "><![CDATA[ and lasttime < #{endTime} ]]> </if> -->
and cVerifier is not null
and sync_flag is null
</trim>
order by dlid
</select>
@ -80,5 +81,12 @@
where cdlcode = #{cdlcode}
</update>
<!--通过主键修改方法-->
<update id="entity_update_state" parameterType="com.hzya.frame.u8.delivery.entity.DeliveryOrderEntity">
UPDATE ${dbname}DispatchList set sync_flag =#{sync_flag}
where dlid = #{dlid}
</update>
</mapper>

View File

@ -56,6 +56,23 @@ public interface IDeliveryOrderService extends IBaseService<DeliveryOrderEntity,
*
*/
U8ResultEntity Close(JSONObject parm);
/**
*
* @content 发货单-关闭-针对CRM汇总发货定制
* 提供发货单整单关闭接口给CRM进行调用将该发货单明细涉及的发货单&红字发货单协同关闭验证是否出库如果出库则不允许整单关闭
* @className: Administrator
* @author laborer
* @date 2025-04-23 10:42
*
*/
U8ResultEntity consolidClose(JSONObject parm);
/**
* 删除发货单需要弃审1 不需要弃审2
* @param parm
* @return
*/
U8ResultEntity deleteDelivery(JSONObject parm);
/**
*
* @content 发货单-部分作废
@ -74,4 +91,24 @@ public interface IDeliveryOrderService extends IBaseService<DeliveryOrderEntity,
*
*/
U8ResultEntity GetOutQuantity(JSONObject parm);
/**
*
* @content 发货单-合并发货
* @className: Administrator
* @author laborer
* @date 2025-07-10 14:00
*
*/
U8ResultEntity consolidDelivery(JSONObject parm);
/**
*
* @content U8发货单自动出库
* @className: Administrator
* @author laborer
* @date 2025-07-15 13:45
*
*/
U8ResultEntity u8DeliveryAutoOut(JSONObject requestJson);
}

View File

@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.Jackyun.contrast.customer.entity.CustomerEntity;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.crm.util.CrmUtil;
import com.hzya.frame.u8.delivery.dao.IDeliveryOrderDao;
@ -29,7 +30,9 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.security.KeyPair;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Description U8发货单
@ -44,7 +47,8 @@ public class DeliveryOrderServiceImpl extends BaseService<DeliveryOrderEntity,St
private ISaleInvDao saleInvDao;
private IDeliveryOrderDao deliveryOrderDao;
private ISaleOutService saleOutServiceImpl;
@Autowired
private ISaleOutService saleOutService;
@Autowired
public void setDeliveryOrderDao(IDeliveryOrderDao dao) {
this.deliveryOrderDao = dao;
@ -132,10 +136,10 @@ public class DeliveryOrderServiceImpl extends BaseService<DeliveryOrderEntity,St
return BaseU8Result.getFailureMessageEntity("请传入第三方唯一标识");
}
AccId = jsonObject.getString("AccId");
String cmemo = jsonObject.getString("cmemo");
if(cmemo.length()>255){
jsonObject.put("cmemo", cmemo.substring(0,254));
}
// String cmemo = jsonObject.getString("cmemo");
// if(cmemo.length()>255){
// jsonObject.put("cmemo", cmemo.substring(0,254));
// }
if(StrUtil.isEmpty(AccId)){
return BaseU8Result.getFailureMessageEntity("请传入正确的账套号");
}
@ -223,16 +227,17 @@ public class DeliveryOrderServiceImpl extends BaseService<DeliveryOrderEntity,St
if(StrUtil.isNotEmpty(resultStr.toString())){
return BaseU8Result.getFailureMessageEntity(resultStr.toString());
}
if(StrUtil.isNotEmpty(jHead.getString("cdefine10"))){
//校验发货单是否存在 CRM cdefine10是唯一的
String cDLCodeIsExist = "select cDefine10,cDLCode from "+AccCode+".dbo.DispatchList where cDefine10 = '"+jHead.getString("cdefine10")+"'";
//查询银行账户列表
// //查询银行账户列表
SaleInvEntity U8Obj = new SaleInvEntity();
U8Obj.setDataSourceCode("YONYOUU8NEW");
List<HashMap<String, Object>> hashMaps = saleInvDao.getU8BillData(cDLCodeIsExist,U8Obj);
if(CollectionUtils.isNotEmpty(hashMaps)){
return BaseU8Result.getFailureMessageEntity("发货通知单号已存在!对应发货单号为:"+jHead.getString("cdefine10"));
}
}
//todo 发货单表体
JSONArray body = new JSONArray();
@ -320,13 +325,28 @@ public class DeliveryOrderServiceImpl extends BaseService<DeliveryOrderEntity,St
//原币折扣金额
BigDecimal idiscount = StrUtil.isNotEmpty(jBodyObj.getString("idiscount")) ? jBodyObj.getBigDecimal("idiscount") : new BigDecimal(0);
BigDecimal iquantity = jBodyObj.getBigDecimal("iquantity");//数量
//todo 格式化一下重新赋值保留两位小数 四舍五入
if (iquantity != null) {
// 使用 BigDecimal setScale 方法保留两位小数四舍五入
BigDecimal roundedQuantity = iquantity.setScale(2, RoundingMode.HALF_UP);
jBodyObj.put("iquantity",roundedQuantity) ;
}
BigDecimal inum = jBodyObj.getBigDecimal("inum");//数量
//todo 格式化一下重新赋值保留两位小数 四舍五入
if (inum != null) {
// 使用 BigDecimal setScale 方法保留两位小数四舍五入
BigDecimal roundedInum = inum.setScale(2, RoundingMode.HALF_UP);
jBodyObj.put("inum",roundedInum) ;
}
BigDecimal isum = jBodyObj.getBigDecimal("isum");//价税合计
BigDecimal itaxrate_b = jBodyObj.getBigDecimal("itaxrate");//税率
BigDecimal nflat = jHead.getBigDecimal("iexchrate");//汇率
BigDecimal iTaxUnitPrice = isum.divide(iquantity,6); //原币含税单价
BigDecimal iTaxUnitPrice = isum.divide(iquantity,2); //原币含税单价
JSONObject ae = new JSONObject();
//工具类编写金额信息进行计算
U8Util.CalculationSum(isum, iquantity, nflat, itaxrate_b, 6);
ae = U8Util.CalculationSum(isum, iquantity, nflat, itaxrate_b, 2);
jBodyObj.put("iquotedprice",ae.getString("TaxPrice")) ;
jBodyObj.put("itaxunitprice",ae.getString("TaxPrice")) ;//原币含税单价
jBodyObj.put("isum",ae.getString("Sum"));//价税合计
@ -363,7 +383,7 @@ public class DeliveryOrderServiceImpl extends BaseService<DeliveryOrderEntity,St
discountObj.put("iquantity",0);
discountObj.put("inum",0);
discountObj.put("isum",idiscount.multiply(new BigDecimal(-1)));
ae = U8Util.CalculationSum(discountObj.getBigDecimal("isum"), new BigDecimal(-1), nflat, itaxrate_b, 6);
ae = U8Util.CalculationSum(discountObj.getBigDecimal("isum"), new BigDecimal(-1), nflat, itaxrate_b, 2);
discountObj.put("itaxunitprice",0);//原币含税单价
discountObj.put("isum",ae.getString("Sum")) ;//价税合计
discountObj.put("iunitprice",0);//原币不含税单价
@ -484,6 +504,7 @@ public class DeliveryOrderServiceImpl extends BaseService<DeliveryOrderEntity,St
// {"code":1,"success":"true","message":"2012502250010"}
return BaseU8Result.getSuccessMessageEntity(resultObj.getString("message"));
} catch (Exception e) {
if (dlId != null) {
//如果进入异常并且单据主键不为空也同样删除单据进行回滚
JSONObject delete = new JSONObject();
delete.put("billid", UUID.randomUUID());
@ -491,6 +512,7 @@ public class DeliveryOrderServiceImpl extends BaseService<DeliveryOrderEntity,St
delete.put("cVoucherId", dlId);
//删除
String resultDelete = U8Util.sengBillToU8(delete.toString(), "8000110017");
}
//删除之后直接返回失败信息
logger.info("新增失败:"+e.getMessage());
return BaseU8Result.getFailureMessageEntity("新增失败请联系U8管理员");
@ -640,11 +662,12 @@ public class DeliveryOrderServiceImpl extends BaseService<DeliveryOrderEntity,St
}
}
//获取计量单位组信息
String sqlUnit = "select b.cInvCName,c.ichangrate,a.* " +
String sqlUnit = "select b.cInvCName,c.ichangrate,a.* ,justlist.iuprice1 as iuprice " +
"from "+AccCode+".dbo.Inventory a " +
"left join "+AccCode+".dbo.InventoryClass b on b.cInvCCode = a.cInvCCode " +
"left join " +AccCode+".dbo.tc_unit c on a.cSAComUnitCode = c.unit_id " +
" where cInvCode='"+jBodyObj.getString("cinvcode")+"'";
"left join UFDATA_005_2024.dbo.SA_InvPriceJustList justlist on justlist.cinvcode = a.cinvcode "+
" where a.cInvCode='"+jBodyObj.getString("cinvcode")+"'";
SaleInvEntity U8Body = new SaleInvEntity();
U8Body.setDataSourceCode("YONYOUU8NEW");
List<HashMap<String, Object>> U8BodyHashMaps = saleInvDao.getU8BillData(sqlUnit,U8Body);
@ -664,7 +687,7 @@ public class DeliveryOrderServiceImpl extends BaseService<DeliveryOrderEntity,St
System.out.println("当前换算率"+inv.get("ichangrate"));
if(null != inv.get("ichangrate")){
//辅助计量数量
jBodyObj.put("inum",jBodyObj.getBigDecimal("iquantity").divide(new BigDecimal(String.valueOf(inv.get("ichangrate"))),6, RoundingMode.HALF_UP));
jBodyObj.put("inum",jBodyObj.getBigDecimal("iquantity").divide(new BigDecimal(String.valueOf(inv.get("ichangrate"))),2, RoundingMode.HALF_UP));
}
// 买赠类型
String cdefine22 = jBodyObj.getString("cdefine22");
@ -720,26 +743,32 @@ public class DeliveryOrderServiceImpl extends BaseService<DeliveryOrderEntity,St
// 金额计算
//原币折扣金额
BigDecimal idiscount = StrUtil.isNotEmpty(jBodyObj.getString("idiscount")) ? jBodyObj.getBigDecimal("idiscount") : new BigDecimal(0);
BigDecimal iquantity = jBodyObj.getBigDecimal("iquantity");//数量
BigDecimal iquantity = jBodyObj.getBigDecimal("iquantity");;//数量
// System.out.println(iquantity);
// BigDecimal isum = jBodyObj.getBigDecimal("isum");//价税合计
BigDecimal isum = new BigDecimal(0);//价税合计
BigDecimal iuprice = new BigDecimal(1);
if(!"null".equals(String.valueOf(inv.get("iuprice"))) && StrUtil.isNotEmpty(String.valueOf(inv.get("iuprice")))){
iuprice = new BigDecimal(String.valueOf(inv.get("iuprice")));
}
BigDecimal isum = iquantity.multiply(iuprice);//价税合计
BigDecimal itaxrate_b = jBodyObj.getBigDecimal("itaxrate");//税率
BigDecimal nflat = jHead.getBigDecimal("iexchrate");//汇率
// BigDecimal iTaxUnitPrice = isum.divide(iquantity,6); //原币含税单价
BigDecimal iTaxUnitPrice = new BigDecimal(0); //原币含税单价
JSONObject ae = new JSONObject();
//工具类编写金额信息进行计算
// U8Util.CalculationSum(isum, iquantity, nflat, itaxrate_b, 6);
jBodyObj.put("iquotedprice",0) ;
jBodyObj.put("itaxunitprice",0) ;//原币含税单价
jBodyObj.put("isum",0);//价税合计
jBodyObj.put("iunitprice",0) ;//原币不含税单价
jBodyObj.put("imoney",0);//原货不含税金额
jBodyObj.put("itax",0);//原币税额
jBodyObj.put("inatunitprice",0);//本币含税单价
jBodyObj.put("inatmoney",0);//本币含税金额
jBodyObj.put("inattax",0);//本币税额
jBodyObj.put("inatsum",0);//本币含税金额
ae = U8Util.CalculationSum(isum, iquantity, nflat, itaxrate_b, 2);
jBodyObj.put("iquotedprice",ae.getString("TaxPrice")) ;
jBodyObj.put("itaxunitprice",ae.getString("TaxPrice")) ;//原币含税单价
jBodyObj.put("isum",ae.getString("Sum"));//价税合计
jBodyObj.put("iunitprice",ae.getString("UnitPrice")) ;//原币不含税单价
jBodyObj.put("imoney",ae.getString("Money"));//原货不含税金额
jBodyObj.put("itax",ae.getString("Tax"));//原币税额
jBodyObj.put("inatunitprice",ae.getString("NatUnitPrice"));//本币含税单价
jBodyObj.put("inatmoney",ae.getString("NatMoney"));//本币含税金额
jBodyObj.put("inattax",ae.getString("NatTax"));//本币税额
jBodyObj.put("inatsum",ae.getString("NatSum"));//本币含税金额
jBodyObj.put("iquantity",iquantity.setScale(2, RoundingMode.HALF_UP));//本币含税金额
String kl = jBodyObj.getString("kl");
String kl2 = jBodyObj.getString("kl2");
if(StrUtil.isEmpty(kl)){
@ -763,9 +792,11 @@ public class DeliveryOrderServiceImpl extends BaseService<DeliveryOrderEntity,St
return BaseU8Result.getSuccessMessageEntity(resultStr.toString());
}
// if(1==1){
// return null;
// }
logger.info("发货单新增推送U8"+main.toString());
// if(1==1){
// throw new Exception();
// }
String result = U8Util.sengBillToU8(main.toString(), "8000110015");
logger.info("发货单新增推送U8结果"+result);
JSONObject resultObj = JSON.parseObject(result);
@ -902,6 +933,131 @@ public class DeliveryOrderServiceImpl extends BaseService<DeliveryOrderEntity,St
return null;
}
@Override
public U8ResultEntity consolidClose(JSONObject parm) {
String billCode = "";
String dlId = "";
String AccId = "";
try {
JSONObject jsonObject = parm.getJSONObject("jsonStr");
logger.info("接收到的参数"+jsonObject.toString());
StringBuffer resultStr = new StringBuffer();//回传json
String billid = jsonObject.getString("billid");
if(StrUtil.isEmpty(billid)){
return BaseU8Result.getFailureMessageEntity("请传入第三方唯一标识");
}
AccId = jsonObject.getString("AccId");
if(StrUtil.isEmpty(AccId)){
return BaseU8Result.getFailureMessageEntity("请传入正确的账套号");
}
String AccCode = U8Util.accMap.get(AccId);
if(StrUtil.isEmpty(AccCode)){
return BaseU8Result.getFailureMessageEntity("请传入正确的账套号");
}
String cdlcode = jsonObject.getString("cdlcode");
if(StrUtil.isEmpty(cdlcode)){
return BaseU8Result.getFailureMessageEntity("发货单号不能为空");
}
String ccloser = jsonObject.getString("ccloser");
if(StrUtil.isEmpty(ccloser)){
return BaseU8Result.getFailureMessageEntity("关闭人不能为空");
}
//判断当前单据是否审核
String sqlIsAudit = "select DLID,cVerifier,cdefine10 from "+AccCode+".dbo.DispatchList where cDLCode = '"+cdlcode+"'";
SaleInvEntity erdt = new SaleInvEntity();
erdt.setDataSourceCode("YONYOUU8NEW");
List<HashMap<String, Object>> dlMap = saleInvDao.getU8BillData(sqlIsAudit,erdt);
if(CollectionUtils.isEmpty(dlMap)){
return BaseU8Result.getFailureMessageEntity("单据不存在::"+cdlcode);
}
JSONObject dt = new JSONObject(dlMap.get(0));
String cVerifier = dt.getString("cVerifier");
if(StrUtil.isEmpty(cVerifier)){
return BaseU8Result.getFailureMessageEntity("未审核不允许关闭:"+cdlcode);
}
//验证出库数量
String sqlSaleOutQty = "select cDLCode,ISNULL(iQuantity,0) as 'iQuantity',ISNULL(rs32.saleOutQty,0) as 'saleOutQty' " +
"from "+AccCode+".dbo.DispatchList dl " +
"left join "+AccCode+".dbo.DispatchLists dls on dls.DLID = dl.DLID " +
"left join ( select iDLsID,SUM(iQuantity) as 'saleOutQty' "+AccCode+".dbo.from rdrecords32 group by iDLsID )rs32 on rs32.iDLsID = dls.iDLsID " +
"where dl.cDLCode = '"+cdlcode+"'";
List<HashMap<String, Object>> saleOutQtyMap = saleInvDao.getU8BillData(sqlSaleOutQty,erdt);
if(CollectionUtils.isEmpty(saleOutQtyMap)){
return BaseU8Result.getFailureMessageEntity("关闭失败,原因:校验发货单"+cdlcode+"出库数量失败:::");
}
JSONObject dt1 = new JSONObject(saleOutQtyMap.get(0));
if(dt1.getDouble("saleOutQty")>0){
return BaseU8Result.getFailureMessageEntity("关闭失败,原因:发货单"+cdlcode+"已有部分出库,不能整单关闭!");
}
String cdefine10 =dt.getString("cdefine10");
//通过自定义10 将所有有关联的明细红蓝发货单协同关闭
String deteilsSql = "select DLID,cVerifier,cdefine10,cdlcode from "+AccCode+".dbo.DispatchList where cdefine10 like '"+cdefine10+"%'";
SaleInvEntity DetailsErdt = new SaleInvEntity();
DetailsErdt.setDataSourceCode("YONYOUU8NEW");
List<HashMap<String, Object>> detailsDlMap = saleInvDao.getU8BillData(deteilsSql,erdt);
if(CollectionUtils.isNotEmpty(dlMap)){
detailsDlMap.forEach(detailsDl -> {
try {
//循环关闭相关联的所有红蓝发货单
JSONObject detailsDt = new JSONObject(detailsDl);
String updateMain = "update "+AccCode+".dbo.DispatchList set cCloser = '"+ccloser+"', bSettleAll = 1 where cDLCode = '"+detailsDt.getString("cdlcode")+"'";
String updatebody = "update "+AccCode+".dbo.Dispatchlists set cSCloser = '"+ccloser+"',bSettleAll = 1 where DLID = '"+detailsDt.getString("DLID")+"'";
saleInvDao.execUpdateSql(updateMain,erdt);
saleInvDao.execUpdateSql(updatebody,erdt);
} catch (Exception e) {
throw new RuntimeException("明细发货单关闭失败"+e);
}
});
}
//关闭发货单
String updateMain = "update "+AccCode+".dbo.DispatchList set cCloser = '"+ccloser+"', bSettleAll = 1 where cDLCode = '"+cdlcode+"'";
String updatebody = "update "+AccCode+".dbo.Dispatchlists set cSCloser = '"+ccloser+"',bSettleAll = 1 where DLID = '"+dt.getString("DLID")+"'";
saleInvDao.execUpdateSql(updateMain,erdt);
saleInvDao.execUpdateSql(updatebody,erdt);
} catch (Exception e) {
logger.info("关闭失败:"+e.getMessage());
return BaseU8Result.getFailureMessageEntity("关闭失败"+e.getMessage());
}
return null;
}
@Override
public U8ResultEntity deleteDelivery(JSONObject parm) {
JSONObject jsonObject = parm.getJSONObject("jsonStr");
logger.info("接收到的参数"+jsonObject.toString());
String type = jsonObject.getString("type");
String billCode = jsonObject.getString("billCode");
String AccId = jsonObject.getString("AccId");
if(StrUtil.isEmpty(AccId)){
return BaseU8Result.getFailureMessageEntity("请传入正确的账套号");
}
String AccCode = U8Util.accMap.get(AccId);
if("2".equals(type)){
String dlSql = "select DLID from "+AccCode+".dbo.DispatchList where cDLCode = '"+billCode+"' ";
SaleInvEntity erdt = new SaleInvEntity();
erdt.setDataSourceCode("YONYOUU8NEW");
List<HashMap<String, Object>> dlMap = null;
try {
dlMap = saleInvDao.getU8BillData(dlSql,erdt);
} catch (Exception e) {
throw new RuntimeException(e);
}
if(CollectionUtils.isEmpty(dlMap)){
return BaseU8Result.getFailureMessageEntity("查询发货单主键失败::"+billCode);
}
String dlId = "";
JSONObject dt3 = new JSONObject(dlMap.get(0));
dlId = dt3.getString("DLID");
JSONObject delete = new JSONObject();
delete.put("billid", UUID.randomUUID());
delete.put("AccId", AccId);
delete.put("cVoucherId", dlId);
//删除
String resultDelete = U8Util.sengBillToU8(delete.toString(), "8000110017");
}
return null;
}
@Override
public U8ResultEntity ClosePartial(JSONObject parm) {
String billCode = "";
@ -1464,10 +1620,10 @@ public class DeliveryOrderServiceImpl extends BaseService<DeliveryOrderEntity,St
BigDecimal isum = jBodyObj.getBigDecimal("isum");//价税合计
BigDecimal itaxrate_b = jBodyObj.getBigDecimal("itaxrate");//税率
BigDecimal nflat = jHead.getBigDecimal("iexchrate");//汇率
BigDecimal iTaxUnitPrice = isum.divide(iquantity,6); //原币含税单价
BigDecimal iTaxUnitPrice = isum.divide(iquantity,2); //原币含税单价
JSONObject ae = new JSONObject();
//工具类编写金额信息进行计算
U8Util.CalculationSum(isum, iquantity, nflat, itaxrate_b, 6);
U8Util.CalculationSum(isum, iquantity, nflat, itaxrate_b, 2);
jBodyObj.put("iquotedprice",ae.getString("TaxPrice")) ;
jBodyObj.put("itaxunitprice",ae.getString("TaxPrice")) ;//原币含税单价
jBodyObj.put("isum",ae.getString("Sum"));//价税合计
@ -1664,7 +1820,7 @@ public class DeliveryOrderServiceImpl extends BaseService<DeliveryOrderEntity,St
discountObj.put("inum",0);
discountObj.put("isum",idiscount);
JSONObject ae = U8Util.CalculationSum(discountObj.getBigDecimal("isum"), new BigDecimal(1), new BigDecimal(nflat), new BigDecimal(itaxrate), 6);
JSONObject ae = U8Util.CalculationSum(discountObj.getBigDecimal("isum"), new BigDecimal(1), new BigDecimal(nflat), new BigDecimal(itaxrate), 2);
// AmountEntity ae = U8AmountCalculation.CalculationSum(decimal.Parse(discountObj["isum"]?.ToString()), 1, nflat, itaxrate, 6);
discountObj.put("itaxunitprice",0);
discountObj.put("isum",ae.getString("Sum"));
@ -1731,5 +1887,333 @@ public class DeliveryOrderServiceImpl extends BaseService<DeliveryOrderEntity,St
retnJSON.put("body",body);
return retnJSON;
}
/**
*
* @content 发货单-合并发货
* 提供发货单保存接口提供给CRM调用生成发货单
* 按照明细拆分生成对等明细数量的发货单&红字发货单&明细汇总的发货单
* 通过自定义字段绑定汇总发货单明细行和拆分之后的明细关系
* @className: Administrator
* @author laborer
* @date 2025-07-10 14:00
*
*/
@Override
public U8ResultEntity consolidDelivery(JSONObject parm) {
List<String>successList = new ArrayList<>();
U8ResultEntity u8ResultEntity = new U8ResultEntity();
StringBuffer errorMsg = new StringBuffer();
boolean flag = false;
String billCode = "";
String dlId = "";
String AccId = "";
JSONArray resultArr = new JSONArray();
try {
JSONObject jsonObject = parm.getJSONObject("jsonStr");
logger.info("接收到的参数"+jsonObject.toString());
StringBuffer resultStr = new StringBuffer();//回传json
String billid = jsonObject.getString("billid");
if(StrUtil.isEmpty(billid)){
return BaseU8Result.getFailureMessageEntity("请传入第三方唯一标识");
}
AccId = jsonObject.getString("AccId");
if(StrUtil.isEmpty(AccId)){
return BaseU8Result.getFailureMessageEntity("请传入正确的账套号");
}
String AccCode = U8Util.accMap.get(AccId);
if(StrUtil.isEmpty(AccCode)){
return BaseU8Result.getFailureMessageEntity("请传入正确的账套号");
}
JSONObject head = jsonObject.getJSONObject("head");
JSONArray body = jsonObject.getJSONArray("body");
if(CollectionUtils.isEmpty(body)){
return BaseU8Result.getFailureMessageEntity("请传入发货单数据");
}
int j = 1;
for(int i = 0 ; i < body.size() ; i++ ){
JSONObject discountObj = body.getJSONObject(i);
JSONArray bodyArr = new JSONArray();
bodyArr.add(discountObj);
//拼接发货单信息按照明细行拆分
//组装发货单数据
JSONObject deliveryObjR = bdingParm(head,bodyArr,AccCode,"redd",j);
//调用U8接口生成发货单
u8ResultEntity = addDelivery(jsonObject);
flag = u8ResultEntity.issuccess();
if(flag){
successList.add(u8ResultEntity.getmessage());
}else{
errorMsg.append(u8ResultEntity.getmessage());
break;
}
//组装红字发货单数据
JSONObject deliveryObjB= bdingParm(head,bodyArr,AccCode,"blue",j);
//调用U8接口生成发货单
u8ResultEntity = addDelivery(jsonObject);
flag = u8ResultEntity.issuccess();
if(flag){
successList.add(u8ResultEntity.getmessage());
JSONObject resultCode = new JSONObject();
resultCode.put("cdlcode",u8ResultEntity.getmessage());
resultCode.put("cdefine10",head.getString("cdefine10"));
resultArr.add(u8ResultEntity.getmessage());
}else{
errorMsg.append(u8ResultEntity.getmessage());
break;
}
}
//组装明细汇总发货单数据
JSONObject deliveryObjC = bdingParm(head,body,AccCode,"",0);
//调用U8接口生成发货单
u8ResultEntity = addDelivery(deliveryObjC);
flag = u8ResultEntity.issuccess();
JSONObject result = new JSONObject();
if(flag){
successList.add(u8ResultEntity.getmessage());
result.put("cdlcode",u8ResultEntity.getmessage());
}else{
//回滚已经生成的发货单
//因为U8底层没有发货单弃审接口所以逆向暂时不处理
return BaseU8Result.getFailureMessageEntity(errorMsg.toString());
}
result.put("cdefine10",head.getString("cdefine10"));
result.put("body",resultArr);
//拼接回传json
BaseU8Result.getSuccessMessageEntity(result);
} catch (Exception e) {
logger.info("查询失败:"+e.getMessage());
return BaseU8Result.getFailureMessageEntity("查询失败请联系U8管理员");
}
return null;
}
/**
*
* @content U8发货单自动出库
* 1定时查询出库单如果是汇总发货单出库的需要将相关联的拆分状态的发货单&红字发货单虚拟出库
* 2 将虚拟出库的红字发货单和汇总发货单合并开票结0生成销售发票
* @className: Administrator
* @author laborer
* @date 2025-07-15 13:45
*
*/
@Override
public U8ResultEntity u8DeliveryAutoOut(JSONObject parm) {
//循环账套信息验证该账套下所有的数据 进行虚拟出库
Map<String,String> accMap = U8Util.accMap;
accMap.forEach((key,accCode)->{
SaleInvEntity erdt = new SaleInvEntity();
erdt.setDataSourceCode("YONYOUU8NEW");
try {
String sqlSaleOutQty = "select m1.dlid,m1.cDLCode,m1.iQuantity,m1.saleOutQty,m1.cdefine10,m2.cDLCode as cDLCodeD,m2.dlidd from (\n" +
"select \n" +
"dl.cDLCode,\n" +
"dl.dlid,\n" +
"ISNULL(dls.iQuantity,0) as iQuantity,\n" +
"ISNULL(rs32.saleOutQty,0) as saleOutQty,\n" +
"dl.cdefine10\n" +
"from "+accCode+".dbo.DispatchList dl\n" +
"left join "+accCode+".dbo.DispatchLists dls on dls.DLID = dl.DLID \n" +
"left join ( select iDLsID,SUM(iQuantity) as saleOutQty from "+accCode+".dbo.rdrecords32 group by iDLsID )rs32 on rs32.iDLsID = dls.iDLsID \n" +
"\n" +
"where ISNULL(iQuantity,0) = ISNULL(rs32.saleOutQty,0)\n" +
"and ISNULL(iQuantity,0)>0\n" +
"and dl.cdefine10 is not null\n" +
" and cmaker = 'CRM合并发货汇总'\n" +
")m1\n" +
"left join (\n" +
"select \n" +
"dl.cDLCode,\n" +
"dl.dlid,\n" +
"ISNULL(dls.iQuantity,0) as iQuantity,\n" +
"ISNULL(rs32.saleOutQty,0) as saleOutQty,\n" +
"SUBSTRING(dl.cdefine10, 1, LEN(dl.cdefine10) - 5)as cdefine10\n" +
"from "+accCode+".dbo.DispatchList dl\n" +
"left join "+accCode+".dbo.DispatchLists dls on dls.DLID = dl.DLID \n" +
"left join ( select iDLsID,SUM(iQuantity) as saleOutQty from "+accCode+".dbo.rdrecords32 group by iDLsID )rs32 on rs32.iDLsID = dls.iDLsID \n" +
"where ISNULL(rs32.saleOutQty,0) = 0\n" +
"and dl.cdefine10 is not null\n" +
"and LEN(dl.cdefine10)>5\n" +
" and cmaker in ('CRM合并发货明细red','CRM合并发货明细blue')\n" +
")m2 on m1.cdefine10 = m2.cdefine10 \n" +
"where m2.cDLCode is not null\n";
List<HashMap<String, Object>> saleOutQtyMap = saleInvDao.getU8BillData(sqlSaleOutQty,erdt);
//如果该返回不为空则证明有需要自动出库的数据执行自动出库逻辑
//所有的发货单自动出库
if(CollectionUtils.isNotEmpty(saleOutQtyMap)){
//统计本次执行的所有汇总发货单用于后续自动开票
List<HashMap<String, Object>> cDLCodeList = removeDuplicates(saleOutQtyMap);
//自动出库
for(HashMap<String, Object> selDis:saleOutQtyMap){
String dlidd = String.valueOf(selDis.get("dlidd"));
String cdefine10 = String.valueOf(selDis.get("cdefine10"));
if(StrUtil.isNotEmpty(dlidd)){
//获取该明细发货单的数据执行自动出库
JSONObject saleOut = bdingSaleOut(accCode,dlidd,erdt);
U8ResultEntity u8ResultOut = saleOutService.addSaleOut(saleOut);
}
}
//将汇总的发货单和红字的发货单合并合票结0
for(HashMap<String, Object> selDis:cDLCodeList){
String cdefine10 = String.valueOf(selDis.get("cdefine10"));
//组装开票数据
JSONObject saleInvoice = bdingSaleInvoice(accCode,cdefine10,erdt);
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}
});
return null;
}
/**
*
* @content 组装销售发票数据
* @className: Administrator
* @author laborer
* @date 2025-07-15 16:18
*
*/
private JSONObject bdingSaleInvoice(String accCode, String cdefine10, SaleInvEntity erdt)throws Exception {
String dlSql = "select \n" +
"cdlcode \n" +
"from "+accCode+".dbo.DispatchList\n" +
"where cdefine10 like '"+cdefine10+"%'\n" +
"and cmaker in ('CRM合并发货汇总','CRM合并发货明细red')";
//得到本次需要处理的发货单
List<HashMap<String, Object>> cDLCodeList = saleInvDao.getU8BillData(dlSql,erdt);
if(CollectionUtils.isNotEmpty(cDLCodeList)){
cDLCodeList.forEach(map->{
String cDLCode = String.valueOf(map.get("cdlcode"));
//通过发货单号分别查询出库信息 参照出库信息进行合并开票
});
}
return null;
}
public static List<HashMap<String, Object>> removeDuplicates(List<HashMap<String, Object>> list) {
return new ArrayList<>(list.stream()
.collect(Collectors.toMap(
// 组合键cdefine10 + "|" + cDLCode
map -> map.get("cdefine10") + "|" + map.get("cDLCode"),
map -> map,
(existing, replacement) -> existing, // 保留首个元素
LinkedHashMap::new // 保持插入顺序
))
.values());
}
private JSONObject bdingSaleOut(String accCode, String dlidd,SaleInvEntity erdt)throws Exception {
//获取表头数据
String sqlSaleHead = "select \n" +
"breturnflag as brdflag,\n" +
"breturnflag ,\n" +
"cbustype,\n" +
"cdepcode,\n" +
"cmaker,\n" +
"cmemo,\n" +
"ccuscode,\n" +
"cstcode,\n" +
"ddate\n" +
"from "+accCode+".dbo.DispatchList dl" +
" where dlid = "+dlidd+"";
List<HashMap<String, Object>> sqlSaleHeadMap = saleInvDao.getU8BillData(sqlSaleHead,erdt);
JSONObject head = new JSONObject(sqlSaleHeadMap.get(0));
//获取明细数据
String sqlSaleBody = "select \n" +
"cwhcode,\n" +
"cinvcode ,\n" +
"cunitid,\n" +
"inum,\n" +
"isum,\n" +
"iquantity,\n" +
"itaxrate\n" +
"from "+accCode+".dbo.DispatchLists dl" +
" where dlid = "+dlidd+"";
List<HashMap<String, Object>> sqlSaleBodyMap = saleInvDao.getU8BillData(sqlSaleBody,erdt);
//只会有一行数据
JSONObject body = new JSONObject(sqlSaleBodyMap.get(0));
JSONArray bodyArr = new JSONArray();
bodyArr.add(body);
JSONObject jsonObject = new JSONObject();
jsonObject.put("AccId", accCode);
jsonObject.put("billid", "123");
jsonObject.put("head", head);
jsonObject.put("body", body);
JSONObject result = new JSONObject();
result.put("jsonStr", jsonObject);
return result;
}
private JSONObject bdingParm(JSONObject headObj, JSONArray bodyArr, String AccId, String type, int j) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("AccId", AccId);
jsonObject.put("billid", "123");
JSONObject head = new JSONObject();
if("red".equals( type)){
head.put("brdflag", "0");//发货0退货1@
head.put("breturnflag", "0");//发货0退货1
}else{
head.put("brdflag", "1");//发货0退货1@
head.put("breturnflag", "1");
}
head.put("cbustype", headObj.getString("cbustype"));//业务类型
head.put("ddate", headObj.getString("ddate"));//业务类型
head.put("cdepcode", headObj.getString("cdepcode"));//销售部门
head.put("cstcode", headObj.getString("cstcode"));//
head.put("cpersoncode", headObj.getString("cpersoncode"));//
head.put("ccuscode", headObj.getString("ccuscode"));//客户
head.put("csccode", headObj.getString("csccode"));//发运方式
head.put("cshipaddress", headObj.getString("cshipaddress"));//发货地址
head.put("cexch_name", headObj.getString("cexch_name"));//币种名称
head.put("iexchrate", headObj.getString("iexchrate"));//汇率
head.put("itaxrate", headObj.getString("itaxrate"));//税率
if(j == 0){
head.put("cmaker", "CRM合并发货汇总");//创建人
head.put("cdefine10", headObj.getString("cdefine10"));//唯一字段因为汇总发货单是我们拆分多行明细的 那么我们拼接各自的标识
}else{
head.put("cmaker", "CRM合并发货明细"+type);//创建人
head.put("cdefine10", headObj.getString("cdefine10")+j+type);//唯一字段因为汇总发货单是我们拆分多行明细的 那么我们拼接各自的标识
}
head.put("cmemo",headObj.getString("cmemo"));
jsonObject.put("head", head);
JSONArray body = new JSONArray();
if(CollectionUtils.isNotEmpty(bodyArr)){
bodyArr.forEach(line -> {
JSONObject lineObj = JSON.parseObject(line.toString());
JSONObject details = new JSONObject();
String iquantity = lineObj.getString("isum");
String isum = lineObj.getString("isum");
String idiscount = lineObj.getString("isum");
if("red".equals( type)){
details.put("iquantity",new BigDecimal(iquantity).subtract(new BigDecimal(iquantity).add(new BigDecimal(iquantity))));
details.put("isum",new BigDecimal(isum).subtract(new BigDecimal(isum).add(new BigDecimal(isum))));
details.put("idiscount",new BigDecimal(idiscount).subtract(new BigDecimal(idiscount).add(new BigDecimal(idiscount))));
}else{
details.put("iquantity",iquantity);
details.put("isum",isum);
details.put("idiscount",idiscount);
}
details.put("cwhcode",lineObj.getString("cwhcode")); //仓库
details.put("cdlcode",lineObj.getString("cdlcode")); //发货单号
details.put("cinvcode",lineObj.getString("cinvcode")); //存货编码
details.put("itaxrate",lineObj.getString("itaxrate")); //税率
details.put("cdefine22",lineObj.getString("cdefine22")); //买赠类型
details.put("cmemo",lineObj.getString("cmemo")); //备注
body.add( details);
});
}
jsonObject.put("body", body);
JSONObject result = new JSONObject();
result.put("jsonStr", jsonObject);
return result;
}
}

View File

@ -21,8 +21,7 @@
<select id="entity_list_base" resultMap="get-entity-result" parameterType="com.hzya.frame.u8.otherin.entity.OtherInEntity">
select * from kjs_external.dbo.v_hzya_other_in
<if test="ids == null or ids == ''"> where sync_flag is null</if>
<if test="ids != null and ids != ''">where ids = #{ids} </if>
<if test="ids != null and ids != ''">and ids = #{ids} </if>
</select>
<!--通过主键修改方法-->

View File

@ -19,8 +19,7 @@
<select id="entity_list_base" resultMap="get-entity-result" parameterType="com.hzya.frame.u8.otherout.entity.OtherOutEntity">
select * from kjs_external.dbo.v_hzya_otherout
<if test="ids == null or ids == ''"> where sync_flag is null</if>
<if test="ids != null and ids != ''">where ids = #{ids} </if>
<if test="ids != null and ids != ''">and ids = #{ids} </if>
</select>
<!--通过主键修改方法-->
<update id="entity_update" parameterType="com.hzya.frame.u8.otherout.entity.OtherOutEntity">

View File

@ -127,9 +127,7 @@ public class OtherReceiptServiceImpl extends BaseService<OtherReceiptEntity,Stri
//当推送成功将数据存入u8库中
try{
if (sale.getState().equals("Y")){
if (sale.getOrderType().equals("修改")){
otherReceiptDao.updateModify(sale);
}
otherReceiptDao.insertLog(sale);
sale.getOtherReceiptDetailEntity().forEach(saleDetail -> {
try {

View File

@ -72,8 +72,6 @@ public class ProductionInServicempl extends BaseService<ProductionInEntity,Strin
if(StrUtil.isEmpty(AccCode)){
return BaseU8Result.getFailureMessageEntity("请传入正确的账套号");
}
JSONObject jHead = jsonObject.getJSONObject("head");
//todo 发货单表头必输项
String[] MustInputCode = new String[] { "cmpocode", "ddate", "cwhcode", "cmaker"};
@ -123,20 +121,10 @@ public class ProductionInServicempl extends BaseService<ProductionInEntity,Strin
jHead.put("vt_id","63");
}
SaleInvEntity U8Obj = new SaleInvEntity();
U8Obj.setDataSourceCode("YONYOUU8NEW");
//验证单号唯一
String cdefine5 = jsonObject.getString("cdefine5");
if(StrUtil.isNotEmpty(cdefine5)){
String cdefine5Sql = "select cdefine5 from "+AccCode+".dbo.rdrecord10 where cdefine5 = '"+cdefine5+"'";
List<HashMap<String, Object>> cdefine5Map = saleInvDao.getU8BillData(cdefine5Sql,U8Obj);
if(CollectionUtils.isNotEmpty(cdefine5Map) ){
return BaseU8Result.getFailureMessageEntity("单号重复,请检查:"+cdefine5);
}
}
//生产订单id
if(StrUtil.isEmpty(jHead.getString("iproorderid"))){
U8Obj.setDataSourceCode("YONYOUU8NEW");
String sql = "select MoId from "+AccCode+".dbo.mom_order where MoCode = '"+jHead.getString("cmpocode")+"'";
List<HashMap<String, Object>> momMap = saleInvDao.getU8BillData(sql,U8Obj);
if(CollectionUtils.isEmpty(momMap) ){

View File

@ -104,9 +104,7 @@ public class ReceiptServiceImpl extends BaseService<ReceiptEntity,String> implem
// 日志写入u8扩展库
try{
if (sale.getState().equals("Y")) {
if (sale.getOrderType().equals("修改")){
saleOutDao.modifyState(sale);
}
saleOutDao.insertLog(sale);
}
}catch (Exception e){

View File

@ -296,6 +296,21 @@ public class SaleOutServiceImpl extends BaseService<SaleOutEntity,String> implem
return BaseU8Result.getFailureMessageEntity("获取账套号有误,请联系管理员");
}
String ccodeSql = "SELECT ISNULL(max(CONVERT(DECIMAL(20, 0), ccode))+1, CONVERT (VARCHAR (20),ddate,112) + '0001') as ccode " +
"FROM "+AccCode+".dbo.RdRecord32 " +
"WHERE cCode LIKE CONVERT (VARCHAR (20),'"+DateUtil.format(jHead.getDate("ddate"),"yyyyMMdd")+"',112) + '%'" +
"AND len(cCode) = 12 GROUP BY ddate";
//查询账套中的发货单信息
// SaleInvEntity U8Obj = new SaleInvEntity();
// U8Obj.setDataSourceCode("YONYOUU8NEW");
List<HashMap<String, Object>> ccodeHashMaps = saleInvDao.getU8BillData(ccodeSql,U8Obj);
if(CollectionUtils.isNotEmpty(ccodeHashMaps)){
HashMap<String, Object> ccodeObj= ccodeHashMaps.get(0);
jHead.put("ccode",ccodeObj.get("ccode"));
}else{
jHead.put("ccode",DateUtil.format(jHead.getDate("ddate"),"yyyyMMdd")+"0001");
}
//验证单号唯一
String cdefine5 = jsonObject.getString("cdefine5");
if(StrUtil.isNotEmpty(cdefine5)){
@ -318,7 +333,7 @@ public class SaleOutServiceImpl extends BaseService<SaleOutEntity,String> implem
if(CollectionUtils.isEmpty(selDisListMap) ){
return BaseU8Result.getFailureMessageEntity("发货单主表查询失败"+jHead.getString("cbuscode"));
}
HashMap<String, Object> selDis= hashMaps.get(0);
HashMap<String, Object> selDis= selDisListMap.get(0);
if(StrUtil.isEmpty(jHead.getString("dlid"))){
jHead.put("dlid",selDis.get("dlid"));
}
@ -358,9 +373,11 @@ public class SaleOutServiceImpl extends BaseService<SaleOutEntity,String> implem
if(StrUtil.isEmpty(jHead.getString("cmemo"))){
jHead.put("cmemo",selDis.get("cmemo"));
}
//TODO 正式要放出来哦
/*
if(StrUtil.isEmpty(jHead.getString("cdefine1"))){
jHead.put("cdefine1",selDis.get("cdefine1"));
}
}*/
//表体
JSONArray body = new JSONArray();
JSONArray jBody = jsonObject.getJSONArray("body");
@ -396,14 +413,14 @@ public class SaleOutServiceImpl extends BaseService<SaleOutEntity,String> implem
if(CollectionUtils.isEmpty(selDisDetailsListMap) ){
return BaseU8Result.getFailureMessageEntity("发货单子表查询失败"+jHead.getString("cbuscode")+"发货单表体存货"+jBodyObj.getString("cinvcode")+"行号"+jBodyObj.getString("cdblrowno")+"不存在");
}
HashMap<String, Object> selDisDetails= hashMaps.get(0);
HashMap<String, Object> selDisDetails= selDisDetailsListMap.get(0);
if(StrUtil.isEmpty(jBodyObj.getString("idlsid"))){
jBodyObj.put("idlsid",selDisDetails.get("idlsid"));
}
//获取辅计量单位
String dtInvSql = "select cInvCode,cInvName,cInvStd,Inv.cComUnitCode,cInvCCode,iChangRate, cPUComUnitCode,cSAComUnitCode,cProductUnit,cSTComUnitCode " +
String dtInvSql = "select inv.bInvBatch,cInvCode,cInvName,cInvStd,Inv.cComUnitCode,cInvCCode,iChangRate, cPUComUnitCode,cSAComUnitCode,cProductUnit,cSTComUnitCode " +
"from "+AccCode+".dbo.Inventory Inv " +
"left join "+AccCode+".dbo.ComputationUnit Com On Inv.cComUnitCode = Com.cComUnitCode " +
"where cInvCode='" + jBodyObj.getString("cinvcode") +"'";
@ -413,7 +430,7 @@ public class SaleOutServiceImpl extends BaseService<SaleOutEntity,String> implem
}
HashMap<String, Object> dtInvObj= dtInv.get(0);
//存在辅计量单位则 计算件数 =数量/换算率
if(StrUtil.isNotEmpty(String.valueOf(dtInvObj.get("cSTComUnitCode")))){
if(StrUtil.isNotEmpty(String.valueOf(dtInvObj.get("cSTComUnitCode"))) && !String.valueOf(dtInvObj.get("cSTComUnitCode")).equals("null")){
jBodyObj.put("cassunit",dtInvObj.get("cSTComUnitCode"));
String sqlCassUnit = "select * from "+AccCode+".dbo.ComputationUnit where cComUnitCode='" +dtInvObj.get("cSTComUnitCode")+"'";
List<HashMap<String, Object>> dtUnit = saleInvDao.getU8BillData(sqlCassUnit,U8Obj);
@ -423,10 +440,15 @@ public class SaleOutServiceImpl extends BaseService<SaleOutEntity,String> implem
HashMap<String, Object> dtUnitObj= dtUnit.get(0);
jBodyObj.put("iinvexchrate",dtUnitObj.get("iChangRate"));
jBodyObj.put("inum",jBodyObj.getBigDecimal("iquantity").divide(new BigDecimal(String.valueOf(dtUnitObj.get("iChangRate"))),6, RoundingMode.HALF_UP));
jBodyObj.put("inum",jBodyObj.getBigDecimal("iquantity").divide(new BigDecimal(String.valueOf(dtUnitObj.get("iChangRate"))),2, RoundingMode.HALF_UP));
}
jBodyObj.put("irowno",i+1);
String bInvBatch = String.valueOf(dtInvObj.get("bInvBatch"));
if("true".equals(bInvBatch)){
jBodyObj.put("cbatch",0);
}
//默认字段
//是否需要开票
if(StrUtil.isEmpty(jBodyObj.getString("bneedbill"))){
@ -436,7 +458,10 @@ public class SaleOutServiceImpl extends BaseService<SaleOutEntity,String> implem
if(StrUtil.isEmpty(jBodyObj.getString("bIAcreatebill"))){
jBodyObj.put("bIAcreatebill",0);
}
BigDecimal iquantity = jBodyObj.getBigDecimal("iquantity");;//数量
jBodyObj.put("iquantity",iquantity.setScale(2, RoundingMode.HALF_UP));//本币含税金额
//是否销售出库开票
/*
if(StrUtil.isEmpty(jBodyObj.getString("bsaleoutcreatebill"))){
jBodyObj.put("bsaleoutcreatebill",0);
}
@ -457,6 +482,7 @@ public class SaleOutServiceImpl extends BaseService<SaleOutEntity,String> implem
}
}
}
*/
body.add(jBodyObj);
}
JSONObject main = new JSONObject();
@ -716,7 +742,7 @@ public class SaleOutServiceImpl extends BaseService<SaleOutEntity,String> implem
}else {
HashMap<String, Object> dtUnitObj= dtUnit.get(0);
jBodyObj.put("iinvexchrate",dtUnitObj.get("iChangRate"));
jBodyObj.put("inum",jBodyObj.getBigDecimal("iquantity").divide(jBodyObj.getBigDecimal("iinvexchrate"),6, RoundingMode.HALF_UP));
jBodyObj.put("inum",jBodyObj.getBigDecimal("iquantity").divide(jBodyObj.getBigDecimal("iinvexchrate"),2, RoundingMode.HALF_UP));
}
@ -755,6 +781,8 @@ public class SaleOutServiceImpl extends BaseService<SaleOutEntity,String> implem
// }
// }
jBodyObj.put("cProBatch",0);
BigDecimal iquantity = jBodyObj.getBigDecimal("iquantity");;//数量
jBodyObj.put("iquantity",iquantity.setScale(2, RoundingMode.HALF_UP));//本币含税金额
// jBodyObj.put("csource","发货单");
// jBodyObj.put("cbustype","普通销售");
jBodyObj.put("cProBatch",0);
@ -1055,7 +1083,7 @@ public class SaleOutServiceImpl extends BaseService<SaleOutEntity,String> implem
HashMap<String, Object> dtUnitObj= dtUnit.get(0);
jBodyObj.put("iinvexchrate",dtUnitObj.get("iChangRate"));
jBodyObj.put("inum",jBodyObj.getBigDecimal("iquantity").divide(new BigDecimal(String.valueOf(dtUnitObj.get("iChangRate"))),6, RoundingMode.HALF_UP));
jBodyObj.put("inum",jBodyObj.getBigDecimal("iquantity").divide(new BigDecimal(String.valueOf(dtUnitObj.get("iChangRate"))),2, RoundingMode.HALF_UP));
}
jBodyObj.put("irowno",i+1);

View File

@ -23,8 +23,8 @@ public class U8Util {
{
put("001","UFDATA_001_2023");
put("002","UFDATA_002_2024");
put("004","UFDATA_004_2023");
put("005","UFDATA_005_2023");
put("004","UFDATA_004_2024");
put("005","UFDATA_005_2024");
put("201","UFDATA_201_2023");
}
};
@ -54,7 +54,7 @@ public class U8Util {
.header("publicKey", "ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj")//头信息多个头信息多次调用此方法即可
.header("secretKey", "fviZnLBsQUAGF8w8FSOdJi7XlIm/XAZclMxRagDLfTyJFlvnIBF3w66Hrpfzs8cYj3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=")//头信息多个头信息多次调用此方法即可
.body(parm)//表单内容
.timeout(20000)//超时毫秒
.timeout(120000)//超时毫秒
.execute().body();
System.out.println("返回参数"+result);
if(StrUtil.isNotEmpty(result)){
@ -76,20 +76,20 @@ public class U8Util {
ae.put("iPerTaxRate",iPerTaxRate);
ae.put("iLenDecimal",iLenDecimal);
ae.put("TaxPrice",iSum.divide(iQuantity,6, RoundingMode.HALF_UP));
ae.put("TaxPrice",iSum.divide(iQuantity,2, RoundingMode.HALF_UP));
ae.put("Money",iSum.divide(new BigDecimal(1).add(iPerTaxRate.multiply(new BigDecimal(0.01))),6)) ;
ae.put("UnitPrice",ae.getBigDecimal("Money").divide(iQuantity,6, RoundingMode.HALF_UP));
ae.put("NatSum",iSum.multiply(nflat));
ae.put("NatUnitPrice",ae.getBigDecimal("UnitPrice").multiply(nflat));
ae.put("NatMoney",ae.getBigDecimal("Money").multiply(nflat)) ;
ae.put("NatTaxPrice",ae.getBigDecimal("TaxPrice").multiply(nflat));
ae.put("Sum",ae.getBigDecimal("iSum").setScale(6)) ;
ae.put("UnitPrice",ae.getBigDecimal("UnitPrice").setScale(iLenDecimal));
ae.put("Money",ae.getBigDecimal("Money").setScale(6));
ae.put("Sum",ae.getBigDecimal("iSum").setScale(2, RoundingMode.HALF_UP)) ;
ae.put("UnitPrice",ae.getBigDecimal("UnitPrice").setScale(iLenDecimal, RoundingMode.HALF_UP));
ae.put("Money",ae.getBigDecimal("Money").setScale(2, RoundingMode.HALF_UP));
ae.put("NatTaxPrice",ae.getBigDecimal("NatTaxPrice").setScale(iLenDecimal)) ;
ae.put("NatSum",ae.getBigDecimal("NatSum").setScale(6));
ae.put("NatUnitPrice",ae.getBigDecimal("NatUnitPrice").setScale(iLenDecimal));
ae.put("NatMoney",ae.getBigDecimal("NatMoney").setScale(6));
ae.put("NatSum",ae.getBigDecimal("NatSum").setScale(2, RoundingMode.HALF_UP));
ae.put("NatUnitPrice",ae.getBigDecimal("NatUnitPrice").setScale(iLenDecimal, RoundingMode.HALF_UP));
ae.put("NatMoney",ae.getBigDecimal("NatMoney").setScale(2, RoundingMode.HALF_UP));
ae.put("Tax",ae.getBigDecimal("Sum").subtract(ae.getBigDecimal("Money")));
ae.put("NatTax",ae.getBigDecimal("NatSum").subtract(ae.getBigDecimal("NatMoney")));
return ae;

View File

@ -11,4 +11,6 @@ public interface IBaseMdmService {
JsonResultEntity CreateProduct(JSONObject requestData);
JsonResultEntity CreateCustomer(JSONObject requestData);
JsonResultEntity saveOaFlow(JSONObject requestData);
}

View File

@ -65,4 +65,10 @@ public class BaseMdmServiceImpl implements IBaseMdmService {
return new JsonResultEntity("插入成功:"+ JSON.toJSONString(customer),true);
}
@Override
public JsonResultEntity saveOaFlow(JSONObject requestData) {
return new JsonResultEntity("接收成功",true);
}
}