Browse Source

rev:修改出入库操作逻辑

master
龚宝雄 7 months ago
parent
commit
05f88206ee
  1. 4
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/common/domain/query/BaseQuery.java
  2. 4
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/config/thread/ThreadPoolExecutorUtil.java
  3. 5
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/utils/ExecutionJob.java
  4. 4
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/eas/controller/EasOutInBillDetailController.java
  5. 39
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/EasOutInBill.java
  6. 69
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/EasOutInBillDetail.java
  7. 2
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/HomeBillCounts.java
  8. 36
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/InventoryInfo.java
  9. 19
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/mapper/EasOutInBillDetailMapper.java
  10. 10
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/mapper/EasOutInBillMapper.java
  11. 91
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/xml/EasOutInBillDetailMapper.xml
  12. 30
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/xml/EasOutInBillMapper.xml
  13. 156
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/eas/dto/EasOutInBillDetailDto.java
  14. 13
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/eas/dto/EasOutInBillDetailVO.java
  15. 94
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/eas/dto/EasOutInBillDto.java
  16. 4
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/eas/dto/EasOutInBillQuery.java
  17. 4
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/eas/service/IeasOutInBillDetailService.java
  18. 112
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/EasOutInBillDetailServiceImpl.java
  19. 126
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/EasOutInBillServiceImpl.java
  20. 61
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/eas/WmsToEasService.java
  21. 91
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/srm/WmsToSrmService.java
  22. 61
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/schedule/EasBillSchedule.java
  23. 13
      lms/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml
  24. 24
      lms/nladmin-system/nlsso-server/src/main/resources/config/application-prod.yml
  25. 14
      lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml
  26. 1
      lms/nladmin-ui/.env.development

4
lms/nladmin-system/nlsso-server/src/main/java/org/nl/common/domain/query/BaseQuery.java

@ -67,7 +67,7 @@ public class BaseQuery<T> {
* @see org.nl.common.enums.QueryTEnum
* 通过buid构建
*/
public Map<String, QParam> doP = MapOf.of("blurry", QParam.builder().k(new String[]{"name"}).type(QueryTEnum.LK).build()
public Map<String, Object> doP = MapOf.of("blurry", QParam.builder().k(new String[]{"name"}).type(QueryTEnum.LK).build()
, "startTime", QParam.builder().k(new String[]{"create_time"}).type(QueryTEnum.LT).build()
, "endTime", QParam.builder().k(new String[]{"create_time"}).type(QueryTEnum.LE).build()
, "sort", QParam.builder().k(new String[]{"sort"}).type(QueryTEnum.BY).build()
@ -81,7 +81,7 @@ public class BaseQuery<T> {
Map<String, ColumnCache> columnMap = LambdaUtils.getColumnMap((Class<?>) types[0]);
json.forEach((key, vel) -> {
if (vel != null && !(FieldConstant.DOP).equals(key)) {
QParam qParam = doP.get(key);
QParam qParam = (QParam) doP.get(key);
if (qParam != null) {
QueryTEnum.build(qParam.type, wrapper, qParam.k, vel);
} else {

4
lms/nladmin-system/nlsso-server/src/main/java/org/nl/config/thread/ThreadPoolExecutorUtil.java

@ -17,7 +17,6 @@ package org.nl.config.thread;
import org.dromara.dynamictp.core.support.DynamicTp;
import org.nl.config.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@ -29,7 +28,6 @@ import java.util.concurrent.TimeUnit;
/**
* 用于获取自定义线程池
*
* @author Zheng Jie
* @date 2019年10月31日18:16:47
*/
@ -52,4 +50,4 @@ public class ThreadPoolExecutorUtil {
new TheadFactoryName()
);
}
}
}

5
lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/utils/ExecutionJob.java

@ -1,13 +1,10 @@
package org.nl.system.service.quartz.utils;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.yomahub.tlog.task.quartz.TLogQuartzJobBean;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.utils.RedisUtils;
import org.nl.common.utils.ThrowableUtil;
import org.nl.config.SpringContextHolder;
import org.nl.config.thread.ThreadPoolExecutorUtil;
import org.nl.system.service.quartz.ISysQuartzJobService;
import org.nl.system.service.quartz.dao.SysQuartzJob;
import org.nl.system.service.quartz.dao.SysQuartzLog;
@ -19,9 +16,7 @@ import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.quartz.QuartzJobBean;
import java.util.concurrent.Future;
import java.util.concurrent.ThreadPoolExecutor;
/**

4
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/eas/controller/EasOutInBillDetailController.java

@ -6,8 +6,8 @@ import java.util.Set;
import org.nl.common.base.CommonPage;
import org.nl.common.base.CommonResult;
import org.nl.common.base.RestBusinessTemplate;
import org.nl.common.base.ResultCode;
import org.nl.wms.database.eas.dao.EasOutInBillDetail;
import org.nl.wms.database.eas.dao.InventoryInfo;
import org.springframework.web.bind.annotation.*;
import lombok.RequiredArgsConstructor;
@ -41,7 +41,7 @@ public class EasOutInBillDetailController {
*/
@PostMapping("/queryInventoryInfo")
@Log("查询库位")
public ResponseEntity<CommonPage<InventoryInfo>> queryInventoryInfo(@RequestBody List<EasOutInBillDetailVO> params) {
public ResponseEntity<CommonPage<EasOutInBillDetailVO>> queryInventoryInfo(@RequestBody List<EasOutInBillDetailVO> params) {
return new ResponseEntity<>(easOutInBillDetailService.queryInventoryInfo(params), HttpStatus.OK);
}

39
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/EasOutInBill.java

@ -26,16 +26,10 @@ public class EasOutInBill extends Model<EasOutInBill> {
/**
* 主键id
*/
@TableId(value = "id", type = IdType.ASSIGN_UUID)
private String id;
/**
* eas单据id
*/
@TableId(value = "djid", type = IdType.NONE)
private String djid;
@ -45,12 +39,6 @@ public class EasOutInBill extends Model<EasOutInBill> {
private String djbh;
/**
* 出入库单号
*/
private String code;
/**
* 单据类型
*/
@ -129,6 +117,29 @@ public class EasOutInBill extends Model<EasOutInBill> {
private String llr;
/**
* 单据来源
*/
private String djly;
/**
* 修改人id
*/
private String update_id;
/**
* 修改人
*/
private String update_name;
/**
* 修改时间
*/
private String update_time;
/**
@ -138,7 +149,7 @@ public class EasOutInBill extends Model<EasOutInBill> {
*/
@Override
protected Serializable pkVal() {
return this.id;
return this.djid;
}

69
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/EasOutInBillDetail.java

@ -31,9 +31,15 @@ public class EasOutInBillDetail extends Model<EasOutInBillDetail> {
/**
* 主键id
* 分录id
*/
@TableId(value = "flid", type = IdType.NONE)
private String flid;
/**
* id
*/
@TableId(value = "id", type = IdType.ASSIGN_UUID)
private String id;
@ -103,10 +109,7 @@ public class EasOutInBillDetail extends Model<EasOutInBillDetail> {
private String cjr;
/**
* 分录id
*/
private String flid;
/**
@ -160,7 +163,7 @@ public class EasOutInBillDetail extends Model<EasOutInBillDetail> {
/**
* 数量
*/
private String sl;
private BigDecimal sl;
/**
@ -168,6 +171,21 @@ public class EasOutInBillDetail extends Model<EasOutInBillDetail> {
*/
private String jbsl;
/**
* 库存数量
*/
private BigDecimal kcsl;
/**
* 推荐库位编码
*/
private String tjkwbm;
/**
* 推荐库位名称
*/
private String tjkwmc;
/**
* 辅助数量
@ -208,7 +226,7 @@ public class EasOutInBillDetail extends Model<EasOutInBillDetail> {
/**
* 已出数量
*/
private String ycsl;
private BigDecimal sysl;
/**
@ -229,6 +247,39 @@ public class EasOutInBillDetail extends Model<EasOutInBillDetail> {
private String llr;
/**
* 单据来源
*/
private String djly;
/**
* 跟踪号
*/
private String trackno;
/**
* 修改人id
*/
private String update_id;
/**
* 修改人
*/
private String update_name;
/**
* 修改时间
*/
private String update_time;
/**
* 操作数量
*/
private BigDecimal czsl;
/**
* 获取主键值
*
@ -236,7 +287,7 @@ public class EasOutInBillDetail extends Model<EasOutInBillDetail> {
*/
@Override
protected Serializable pkVal() {
return this.id;
return this.flid;
}
}

2
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/HomeBillCounts.java

@ -22,7 +22,7 @@ public class HomeBillCounts implements Serializable {
private String djlx;
/**
* 单据类型
* 业务类型
*/
private String ywlx;

36
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/eas/controller/InventoryInfo.java → lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/InventoryInfo.java

@ -1,4 +1,4 @@
package org.nl.wms.database.eas.controller;
package org.nl.wms.database.eas.dao;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
@ -8,7 +8,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.io.Serializable;
import java.math.BigDecimal;
/**
@ -51,6 +51,11 @@ public class InventoryInfo extends Model<InventoryInfo> {
*/
private String wlmc;
/**
* 推荐库位
*/
private String tjkw;
/**
* 库位编码
@ -70,12 +75,39 @@ public class InventoryInfo extends Model<InventoryInfo> {
private String kwlx;
/**
* 库存数量
*/
private BigDecimal kcsl;
/**
* 数量
*/
private String sl;
/**
* 跟踪号
*/
private String trackno;
/**
* 仓库编码
*/
private String ckbm;
/**
* 批次
*/
private String pc;
/**
* 组织编码
*/
private String zzbm;

19
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/mapper/EasOutInBillDetailMapper.java

@ -3,9 +3,12 @@ import com.baomidou.dynamic.datasource.annotation.DS;
import io.lettuce.core.dynamic.annotation.Param;
import org.nl.wms.database.eas.dao.EasOutInBillDetail;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.nl.wms.database.eas.dto.EasOutInBillDetailDto;
import org.nl.wms.database.eas.dao.InventoryInfo;
import org.nl.wms.database.eas.dto.EasOutInBillDetailVO;
import java.util.List;
import java.util.Set;
/**
* {@code @Description:} (EasOutInBillDetail)数据持久层
@ -17,8 +20,22 @@ public interface EasOutInBillDetailMapper extends BaseMapper<EasOutInBillDetail>
List<EasOutInBillDetail> queryInventoryInfo(@Param("params") EasOutInBillDetailVO params);
List<EasOutInBillDetailDto> queryBillDetailList(@Param("ids") Set<String> ids);
void insertBatch(List<EasOutInBillDetail> entities);
@DS("oracle")
@DS("oracle_eas")
List<InventoryInfo> selectByConditions(@Param("zzbmList") List<String> zzbmList,
@Param("ckbmList") List<String> ckbmList,
@Param("kwbmList") List<String> kwbmList,
@Param("wlbmList") List<String> wlbmList,
@Param("pcList") List<String> pcList,
@Param("tracknoList") List<String> tracknoList);
@DS("oracle_eas")
List<EasOutInBillDetail> selectPageWithInventory();
@DS("mysql_srm")
List<EasOutInBillDetail> selectSrmPageWithInventory();
}

10
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/mapper/EasOutInBillMapper.java

@ -1,10 +1,14 @@
package org.nl.wms.database.eas.dao.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import io.lettuce.core.dynamic.annotation.Param;
import org.nl.wms.database.eas.dao.EasOutInBill;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.nl.wms.database.eas.dao.EasOutInBillDetail;
import org.nl.wms.database.eas.dao.HomeBillCounts;
import org.nl.wms.database.eas.dto.EasOutInBillDto;
import java.util.List;
import java.util.Set;
/**
* {@code @Description:} (EasOutInBill)数据持久层
@ -14,12 +18,16 @@ import java.util.List;
*/
public interface EasOutInBillMapper extends BaseMapper<EasOutInBill> {
@DS("oracle")
@DS("oracle_eas")
List<EasOutInBillDetail> getEasBills();
@DS("mysql_srm")
List<EasOutInBillDetail> getSrmBills();
//AND STR_TO_DATE( cjsj, '%Y-%m-%d' ) >= CURDATE() - INTERVAL 1 MONTH;
List<String> queryExistBills();
List<EasOutInBillDto> queryBillList(@Param("ids") Set<String> ids);
List<HomeBillCounts> getBillsCount();

91
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/xml/EasOutInBillDetailMapper.xml

@ -2,30 +2,111 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.nl.wms.database.eas.dao.mapper.EasOutInBillDetailMapper">
<select id="selectPageWithInventory" resultType="org.nl.wms.database.eas.dao.EasOutInBillDetail">
SELECT
E.*
FROM
MEIAMSYSTEM.V_UC_OUTINBILL E
WHERE E.DJZT='保存' ORDER BY ID
</select>
<select id="selectByConditions" resultType="org.nl.wms.database.eas.dao.InventoryInfo">
SELECT
stono as zzbm,
warehouseno as ckbm,
locationno as kwbm ,
materialno as wlbm ,
lot as pc,
curstoreqty as kcsl ,
trackno
FROM MEIAMSYSTEM.V_UC_INVENTORYINFO
<where>
<if test="zzbmList != null and zzbmList.size() > 0">
AND stono IN
<foreach collection="zzbmList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="ckbmList != null and ckbmList.size() > 0">
AND warehouseno IN
<foreach collection="ckbmList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="kwbmList != null and kwbmList.size() > 0">
AND locationno IN
<foreach collection="kwbmList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="wlbmList != null and wlbmList.size() > 0">
AND materialno IN
<foreach collection="wlbmList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="pcList != null and pcList.size() > 0">
AND lot IN
<foreach collection="pcList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="tracknoList != null and tracknoList.size() > 0">
AND trackno IN
<foreach collection="tracknoList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
<select id="selectSrmPageWithInventory" resultType="org.nl.wms.database.eas.dao.EasOutInBillDetail">
SELECT
E.*
FROM
NL_SQ_WMS.V_WMS_INBILL_THIRD E
WHERE E.DJZT='未入库' ORDER BY ID
</select>
<select id="selectSrmPage" resultType="org.nl.wms.database.eas.dao.EasOutInBillDetail">
SELECT
E.*,
I.CURSTOREQTY AS SL
I.CURSTOREQTY AS KCSL
FROM
MEIAMSYSTEM.V_UC_OUTINBILL E
LEFT JOIN MEIAMSYSTEM.V_UC_INVENTORYINFO I ON E.CKBM = I.WAREHOUSENO
AND E.WLBM = I.MATERIALNO WHERE E.DJZT='提交' ORDER BY ID
AND E.WLBM = I.MATERIALNO WHERE E.DJZT='保存' ORDER BY ID
</select>
<select id="queryInventoryInfo" resultType="org.nl.wms.database.eas.dao.EasOutInBillDetail">
SELECT *
FROM V_UC_INVENTORYINFO
WHERE wlbm =#{params.wlbm}
</select>
<select id="queryBillDetailList" resultType="org.nl.wms.database.eas.dto.EasOutInBillDetailDto">
SELECT
djid,
flxh as seq,
flxh as entryId,
czsl as qty,
ckbm as warehouseNo,
kwbm as locationNo,
jbjldw as unitNo,
ywlx as remark
FROM eas_out_in_bill_detail
WHERE djid in
<foreach collection="ids" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="false">
insert into eas_out_in_bill_detail(id,djid, djlx, ywlx, djbh, zzbm, zzmc, btbz, djzt, cjsj, ywrq, cjr, flid, flxh,
wlbm, wlmc, ggxh, pc, jldw, jbjldw, fzjldw, sl, jbsl, fzsl, ckbm, ckmc, kwbm, kwmc, flbz, ycsl, code, cksj, llr)
wlbm, wlmc, ggxh, pc, jldw, jbjldw, fzjldw, sl, jbsl, fzsl, ckbm, ckmc, kwbm, kwmc, flbz, sysl, code, cksj, llr,tjkwbm,tjkwmc,kcsl,djly,trackno,update_id,update_name,update_time,czsl)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.id},#{entity.djid}, #{entity.djlx}, #{entity.ywlx}, #{entity.djbh}, #{entity.zzbm}, #{entity.zzmc},
#{entity.btbz}, #{entity.djzt}, #{entity.cjsj}, #{entity.ywrq}, #{entity.cjr}, #{entity.flid},
#{entity.flxh}, #{entity.wlbm}, #{entity.wlmc}, #{entity.ggxh}, #{entity.pc}, #{entity.jldw},
#{entity.jbjldw}, #{entity.fzjldw}, #{entity.sl}, #{entity.jbsl}, #{entity.fzsl}, #{entity.ckbm},
#{entity.ckmc}, #{entity.kwbm}, #{entity.kwmc}, #{entity.flbz}, #{entity.ycsl}, #{entity.code},
#{entity.cksj}, #{entity.llr})
#{entity.ckmc}, #{entity.kwbm}, #{entity.kwmc}, #{entity.flbz}, #{entity.sysl}, #{entity.code},
#{entity.cksj}, #{entity.llr}, #{entity.tjkwbm}, #{entity.tjkwmc}, #{entity.kcsl}, #{entity.djly}, #{entity.trackno}, #{entity.update_id}, #{entity.update_name}, #{entity.update_time}, #{entity.czsl})
</foreach>
</insert>
</mapper>

30
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/eas/dao/xml/EasOutInBillMapper.xml

@ -9,14 +9,32 @@
WHERE
djzt = '保存'
</select>
<select id="queryBillList" resultType="org.nl.wms.database.eas.dto.EasOutInBillDto">
SELECT
djid as billId,
djbh as billNo,
ywrq as bizDate,
ywlx as billType,
btbz as description,
djly
FROM eas_out_in_bill
WHERE djid in
<foreach collection="ids" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
<select id="getSrmBills" resultType="org.nl.wms.database.eas.dao.EasOutInBillDetail">
SELECT *
FROM MEIAMSYSTEM.V_UC_OUTINBILL
WHERE
djzt = '保存'
</select>
<select id="queryExistBills" resultType="java.lang.String">
SELECT
djid
FROM
eas_out_in_bill
WHERE
djzt = '保存'
</select>
<select id="getBillsCount" resultType="org.nl.wms.database.eas.dao.HomeBillCounts">
@ -59,13 +77,13 @@
</select>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="false">
insert into eas_out_in_bill(id,djid, djbh, code, djlx, ywlx, zzbm, zzmc, ckmc, ckbm, djzt, cjsj, ywrq, cjr, btbz,
cksj, llr)
insert into eas_out_in_bill(djid, djbh,djlx, ywlx, zzbm, zzmc, ckmc, ckbm, djzt, cjsj, ywrq, cjr, btbz,
cksj, llr,djly,update_id,update_name,update_time)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.id}, #{entity.djid}, #{entity.djbh}, #{entity.code}, #{entity.djlx}, #{entity.ywlx}, #{entity.zzbm},
(#{entity.djid}, #{entity.djbh},#{entity.djlx}, #{entity.ywlx}, #{entity.zzbm},
#{entity.zzmc}, #{entity.ckmc}, #{entity.ckbm}, #{entity.djzt}, #{entity.cjsj}, #{entity.ywrq},
#{entity.cjr}, #{entity.btbz}, #{entity.cksj}, #{entity.llr})
#{entity.cjr}, #{entity.btbz}, #{entity.cksj}, #{entity.llr}, #{entity.djly}, #{entity.update_id}, #{entity.update_name}, #{entity.update_time})
</foreach>
</insert>
</mapper>

156
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/eas/dto/EasOutInBillDetailDto.java

@ -1,155 +1,75 @@
package org.nl.wms.database.eas.dto;
import java.io.Serializable;
import lombok.*;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* {@code @Description:} (EasOutInBillDetail)数据传输类
* {@code @Description:} (EasOutInBillDetail)实体
* {@code @Author:} gbx
*
* @since 2024-02-22
*/
@Data
@Builder
@ToString
public class EasOutInBillDetailDto implements Serializable {
@EqualsAndHashCode(callSuper = false)
@SuppressWarnings("serial")
public class EasOutInBillDetailDto {
/**
* id
*/
private String id;
/**
* 单据id
*/
private String djid;
/**
* 单据类型
*/
private String djlx;
/**
* 业务类型
*/
private String ywlx;
/**
* 单据编号
*/
private String djbh;
/**
* 组织编码
*/
private String zzbm;
/**
* 组织名称
*/
private String zzmc;
/**
* 表头备注
*/
private String btbz;
/**
* 单据状态
*/
private String djzt;
/**
* 制单时间
*/
private String cjsj;
/**
* 业务时间
*/
private String ywrq;
/**
* 制单人
*/
private String cjr;
/**
* 分录id
*/
private String flid;
/**
* 分录序号
*/
private String flxh;
/**
* 物料编码
*/
private String wlbm;
/**
* 物料名称
*/
private String wlmc;
/**
* 规格型号
*/
private String ggxh;
/**
* 批次
*/
private String pc;
/**
* 计量单位
*/
private String jldw;
/**
* 基本计量单位
* 序号
*/
private String jbjldw;
private String seq;
/**
* 辅助计量单位
* 明细id
*/
private String fzjldw;
private String entryId;
/**
* 数量
*/
private String sl;
/**
* 基本数量
*/
private String jbsl;
/**
* 辅助数量
*/
private String fzsl;
private BigDecimal qty;
/**
* 仓库编码
*/
private String ckbm;
/**
* 仓库名称
*/
private String ckmc;
private String warehouseNo;
/**
* 库位编码
*/
private String kwbm;
/**
* 库位名称
*/
private String kwmc;
/**
* 分录备注
*/
private String flbz;
/**
* 已出数量
*/
private String ycsl;
/**
* 明细编号
*/
private String code;
private String locationNo;
/**
* 出库日期
* 单位
*/
private String cksj;
private String unitNo;
/**
* 领料人
* 备注
*/
private String llr;
private String remark;
}

13
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/eas/dto/EasOutInBillDetailVO.java

@ -7,6 +7,8 @@ import org.nl.common.domain.query.BaseQuery;
import org.nl.wms.database.eas.dao.EasOutInBillDetail;
import org.nl.wms.database.eas.dto.EasOutInBillDetailVO;
import java.math.BigDecimal;
/**
* {@code @Description:} (EasOutInBillDetail)查询参数类
* {@code @Author:} gbx
@ -103,7 +105,7 @@ public class EasOutInBillDetailVO extends BaseQuery<EasOutInBillDetail> {
/**
* 数量
*/
private String sl;
private BigDecimal sl;
/**
* 基本数量
*/
@ -133,9 +135,14 @@ public class EasOutInBillDetailVO extends BaseQuery<EasOutInBillDetail> {
*/
private String flbz;
/**
* 已出数量
* 剩余数量
*/
private BigDecimal sysl;
/**
* 操作数量
*/
private String ycsl;
private BigDecimal czsl;
/**
* 明细编号
*/

94
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/eas/dto/EasOutInBillDto.java

@ -1,92 +1,60 @@
package org.nl.wms.database.eas.dto;
import java.io.Serializable;
import lombok.*;
import lombok.Data;
import lombok.Builder;
import java.util.List;
/**
* {@code @Description:} (EasOutInBill)数据传输
* {@code @Description:} (EasOutInBill)实体
* {@code @Author:} gbx
*
* @since 2024-02-21
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class EasOutInBillDto implements Serializable {
public class EasOutInBillDto {
/**
* id
*/
private String id;
/**
* eas单据id
*/
private String djid;
private String billId;
/**
* eas单据编号
*/
private String djbh;
/**
* 出入库单号
*/
private String code;
private String billNo;
/**
* 单据类型
* 业务日期
*/
private String djlx;
private String bizDate;
/**
* 业务类型
*/
private String ywlx;
/**
* 组织编码
*/
private String zzbm;
/**
* 组织名称
*/
private String zzmc;
/**
* 仓库名称
*/
private String ckmc;
/**
* 仓库编码
*/
private String ckbm;
/**
* 单据状态
*/
private String djzt;
/**
* 制单时间
*/
private String cjsj;
/**
* 业务时间
*/
private String ywrq;
/**
* 制单人
*/
private String cjr;
/**
* 表头备注
*/
private String btbz;
private String billType;
/**
* 出库日期
* 备注
*/
private String cksj;
private String description;
/**
* 领料人
* 单据来源
*/
private String llr;
private String djly;
List<EasOutInBillDetailDto> entrys;
}

4
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/eas/dto/EasOutInBillQuery.java

@ -18,10 +18,6 @@ import org.nl.wms.database.eas.dao.EasOutInBill;
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class EasOutInBillQuery extends BaseQuery<EasOutInBill> {
/**
* 主键id
*/
private String id;
/**

4
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/eas/service/IeasOutInBillDetailService.java

@ -1,7 +1,7 @@
package org.nl.wms.database.eas.service;
import org.nl.common.base.CommonPage;
import org.nl.wms.database.eas.controller.InventoryInfo;
import org.nl.wms.database.eas.dao.InventoryInfo;
import org.nl.wms.database.eas.dao.EasOutInBillDetail;
import com.baomidou.mybatisplus.extension.service.IService;
import org.nl.wms.database.eas.dto.EasOutInBillDetailVO;
@ -33,7 +33,7 @@ public interface IeasOutInBillDetailService extends IService<EasOutInBillDetail>
* @param params 查询条件
* @return List<EasOutInBillDetail>
*/
CommonPage<InventoryInfo> queryInventoryInfo(List<EasOutInBillDetailVO> params);
CommonPage<EasOutInBillDetailVO> queryInventoryInfo(List<EasOutInBillDetailVO> params);

112
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/EasOutInBillDetailServiceImpl.java

@ -1,8 +1,13 @@
package org.nl.wms.database.eas.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.nl.wms.database.eas.controller.InventoryInfo;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.SecurityUtils;
import org.nl.wms.database.eas.dao.InventoryInfo;
import org.nl.wms.database.eas.dao.EasOutInBillDetail;
import org.nl.wms.database.eas.dto.EasOutInBillDetailVO;
import org.nl.wms.database.eas.dao.mapper.EasOutInBillDetailMapper;
@ -17,9 +22,13 @@ import javax.annotation.Resource;
import org.nl.common.base.CommonPage;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Objects;
import java.util.Set;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* {@code @Description:} (EasOutInBillDetail)服务实现层
@ -42,15 +51,48 @@ public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetai
*/
@Override
public CommonPage<EasOutInBillDetail> page(EasOutInBillDetailVO params) {
// List<EasOutInBillDetail> result = easOutInBillDetailMapper.selectPageWithInventory(params.getDjid(), params.getPage(), params.getSize());
// return CommonPage.restPage(result);
Page<EasOutInBillDetail> result = easOutInBillDetailMapper.selectPage(new Page<>(params.getPage(), params.getSize()), new QueryWrapper<EasOutInBillDetail>()
.lambda()
.eq(ObjectUtil.isNotEmpty(params), EasOutInBillDetail::getDjid, params.getDjid())
);
List<EasOutInBillDetail> easOutInBillDetailList = result.getRecords();
List<InventoryInfo> inventoryInfoList = queryInventoryInfoList(easOutInBillDetailList);
easOutInBillDetailList.forEach(bill -> {
//查询库存信息
List<InventoryInfo> matchedInventory = inventoryInfoList.stream()
.filter(inventory -> Objects.equals(inventory.getZzbm(), bill.getZzbm())
&& Objects.equals(inventory.getCkbm(), bill.getCkbm())
&& Objects.equals(inventory.getWlbm(), bill.getWlbm())
&& Objects.equals(inventory.getPc(), bill.getPc())
&& Objects.equals(inventory.getTrackno(), bill.getTrackno())
&& Objects.equals(inventory.getKwbm(), bill.getKwbm()))
.collect(Collectors.toList());
//将库存数量赋值给单据
if (CollectionUtils.isNotEmpty(matchedInventory)) {
bill.setKcsl(matchedInventory.get(0).getKcsl());
}
});
result.setRecords(easOutInBillDetailList);
return CommonPage.getPage(result);
}
private List<InventoryInfo> queryInventoryInfoList(List<EasOutInBillDetail> easOutInBillDetailList) {
List<String> zzbmList = getNonNullValues(easOutInBillDetailList, EasOutInBillDetail::getZzbm);
List<String> ckbmList = getNonNullValues(easOutInBillDetailList, EasOutInBillDetail::getCkbm);
List<String> kwbmList = getNonNullValues(easOutInBillDetailList, EasOutInBillDetail::getKwbm);
List<String> wlbmList = getNonNullValues(easOutInBillDetailList, EasOutInBillDetail::getWlbm);
List<String> pcList = getNonNullValues(easOutInBillDetailList, EasOutInBillDetail::getPc);
List<String> tracknoList = getNonNullValues(easOutInBillDetailList, EasOutInBillDetail::getTrackno);
return easOutInBillDetailMapper.selectByConditions(zzbmList, ckbmList, kwbmList, wlbmList, pcList, tracknoList);
}
private List<String> getNonNullValues(List<EasOutInBillDetail> list, Function<EasOutInBillDetail, String> mapper) {
return list.stream()
.map(mapper)
.filter(Objects::nonNull)
.collect(Collectors.toList());
}
/**
* 查询库位
@ -58,36 +100,18 @@ public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetai
* @param params 查询条件
*/
@Override
public CommonPage<InventoryInfo> queryInventoryInfo(List<EasOutInBillDetailVO> params) {
public CommonPage<EasOutInBillDetailVO> queryInventoryInfo(List<EasOutInBillDetailVO> params) {
//todo 查询推荐库位
List<InventoryInfo> inventoryInfoList = new ArrayList<>();
InventoryInfo inventoryInfo = new InventoryInfo();
InventoryInfo inventoryInfo1 = new InventoryInfo();
inventoryInfo.setId("1");
inventoryInfo.setDjbh("NLRK2308");
inventoryInfo.setWlbm("44023301");
inventoryInfo.setWlmc("主控制线束");
inventoryInfo.setKwmc("三期总装半成品库");
inventoryInfo.setKwbm("2.03.005");
inventoryInfo.setKwlx("电瓶夹头-6-510");
inventoryInfo.setSl("5000");
inventoryInfo1.setId("2");
inventoryInfo1.setDjbh("NLRK2309");
inventoryInfo1.setWlbm("44023302");
inventoryInfo1.setWlmc("主控制线束");
inventoryInfo1.setKwmc("三期总装半成品库");
inventoryInfo1.setKwbm("2.03.006");
inventoryInfo1.setKwlx("电瓶夹头-6-510");
inventoryInfo1.setSl("2000");
inventoryInfoList.add(inventoryInfo);
inventoryInfoList.add(inventoryInfo1);
CommonPage<InventoryInfo> commonPage = new CommonPage<>();
commonPage.setResult(inventoryInfoList);
CommonPage<EasOutInBillDetailVO> commonPage = new CommonPage<>();
commonPage.setResult(params);
commonPage.setCode(1);
commonPage.setDesc("查询成功");
commonPage.setPageNum(1);
commonPage.setPageSize(10);
commonPage.setTotalPage(1);
commonPage.setTotalElements(2);
commonPage.setTotalElements(params.size());
return commonPage;
}
@ -121,17 +145,33 @@ public class EasOutInBillDetailServiceImpl extends ServiceImpl<EasOutInBillDetai
/**
* 编辑
*
* @param entity 对象实体
*/
@Override
public void update(List<EasOutInBillDetailVO> entity) {
// EasOutInBillDetail dto = easOutInBillDetailMapper.selectById(entity.getId());
// if (dto == null) {
// throw new BadRequestException("不存在该数据!");
// }
Integer sw = 1;
//easOutInBillDetailMapper.updateById(getBasicInfo(entity, false));
public void update(List<EasOutInBillDetailVO> entityList) {
List<EasOutInBillDetailVO> entitys = entityList.stream().filter(r -> "已提交".equals(r.getDjzt())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(entitys)) {
throw new BadRequestException("该单据已审核提交,无需操作!");
}
if (CollectionUtils.isNotEmpty(entityList)) {
BigDecimal amount = entityList.stream()
.filter(r -> StringUtils.isNotEmpty(r.getKwbm()))
.map(EasOutInBillDetailVO::getSysl)
.reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal czsl = entityList.get(0).getCzsl().add(amount);
BigDecimal sysl = entityList.get(0).getSl().subtract(czsl);
if (sysl.compareTo(BigDecimal.ZERO) < 0) {
throw new BadRequestException("该单据物料数量不足!");
}
UpdateWrapper<EasOutInBillDetail> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("flid", entityList.get(0).getFlid());
updateWrapper.set("czsl", czsl);
updateWrapper.set("sysl", sysl);
updateWrapper.set("kwbm", entityList.get(0).getKwbm());
updateWrapper.set("update_id", Long.valueOf(SecurityUtils.getCurrentUserId()));
updateWrapper.set("update_name", SecurityUtils.getCurrentNickName());
updateWrapper.set("update_time", DateUtil.format(DateUtil.beginOfDay(DateUtil.date()), "yyyy-MM-dd"));
easOutInBillDetailMapper.update(null, updateWrapper);
}
}

126
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/EasOutInBillServiceImpl.java

@ -1,25 +1,36 @@
package org.nl.wms.database.eas.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import org.apache.commons.collections4.CollectionUtils;
import org.nl.common.base.CommonPage;
import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.CodeUtil;
import org.nl.config.IdUtil;
import org.nl.wms.database.eas.dao.EasOutInBill;
import org.nl.wms.database.eas.dao.EasOutInBillDetail;
import org.nl.wms.database.eas.dao.HomeBillCounts;
import org.nl.wms.database.eas.dao.*;
import org.nl.wms.database.eas.dao.mapper.EasOutInBillDetailMapper;
import org.nl.wms.database.eas.dao.mapper.EasOutInBillMapper;
import org.nl.wms.database.eas.dto.EasOutInBillDetailDto;
import org.nl.wms.database.eas.dto.EasOutInBillDto;
import org.nl.wms.database.eas.dto.EasOutInBillQuery;
import org.nl.wms.database.eas.service.IeasOutInBillService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.nl.wms.ext.eas.WmsToEasService;
import org.nl.wms.ext.srm.WmsToSrmService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -42,6 +53,16 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
private EasOutInBillDetailMapper easOutInBillDetailMapper;
@Resource
private WmsToSrmService wmsToSrmService;
@Resource
private WmsToEasService wmsToEasService;
@Resource
@Qualifier("threadPoolExecutor")
private ThreadPoolExecutor pool;
/**
* 首页显示出入库单据数量
*/
@ -66,8 +87,6 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
.or()
.like(EasOutInBill::getDjbh, params.getFuzzy())
.or()
.like(EasOutInBill::getCode, params.getFuzzy())
.or()
.like(EasOutInBill::getZzbm, params.getFuzzy())
.or()
.like(EasOutInBill::getZzmc, params.getFuzzy())
@ -93,7 +112,7 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
public List<EasOutInBill> query(EasOutInBillQuery params) {
return easOutInBillMapper.selectList(new QueryWrapper<EasOutInBill>()
.lambda()
.eq(ObjectUtil.isNotEmpty(params), EasOutInBill::getId, params.getFuzzy())
.eq(ObjectUtil.isNotEmpty(params), EasOutInBill::getYwlx, params.getFuzzy())
.or()
.eq(ObjectUtil.isNotEmpty(params), EasOutInBill::getDjid, params.getFuzzy())
);
@ -141,8 +160,6 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
List<EasOutInBill> billList = distinctDetailList.stream()
.map(detail -> {
EasOutInBill bill = new EasOutInBill();
bill.setId(IdUtil.getStringId());
bill.setCode(CodeUtil.getNewCode("TASK_CODE"));
bill.setDjid(detail.getDjid());
bill.setDjbh(detail.getDjbh());
bill.setDjlx(detail.getDjlx());
@ -158,6 +175,7 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
bill.setBtbz(detail.getBtbz());
bill.setCksj(detail.getCksj());
bill.setLlr(detail.getLlr());
bill.setDjly(detail.getDjly() == null ? "1" : "2");
return bill;
})
.collect(Collectors.toList());
@ -174,23 +192,87 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
*/
@Override
public void update(EasOutInBillQuery entity) {
EasOutInBill dto = easOutInBillMapper.selectById(entity.getId());
EasOutInBill dto = easOutInBillMapper.selectById(entity.getDjid());
if (dto == null) {
throw new BadRequestException("不存在该数据!");
}
easOutInBillMapper.updateById(getBasicInfo(entity, false));
}
/**
* 单据审核
*
* @param ids 对象实体
*/
@Override
@Transactional(rollbackFor = Exception.class)
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
public void audit(Set<String> ids) {
easOutInBillMapper.update(null, new UpdateWrapper<EasOutInBill>().set("djzt", "提交").in("id", ids));
//todo 调外部webservice接口提交EAS审核结果
if(CollectionUtils.isEmpty(ids)){
throw new BadRequestException("id不能为空!");
}
//所有主表
List<EasOutInBillDto> easOutInBillList = easOutInBillMapper.queryBillList(ids);
//所有明细表
List<EasOutInBillDetailDto> easOutInBillDetailList = easOutInBillDetailMapper.queryBillDetailList(ids);
//报文组合
if (CollectionUtils.isNotEmpty(easOutInBillList)) {
easOutInBillList.forEach(b -> {
List<EasOutInBillDetailDto> billDetails = easOutInBillDetailList.stream().filter(d ->
Objects.equals(d.getDjid(), b.getBillId())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(billDetails)) {
b.setEntrys(billDetails);
}
});
}
List<EasOutInBillDto> easBills = easOutInBillList.stream().filter(r -> "1".equals(r.getDjly())).collect(Collectors.toList());
List<EasOutInBillDto> srmBills = easOutInBillList.stream().filter(r -> "2".equals(r.getDjly())).collect(Collectors.toList());
//eas单据推送
if (CollectionUtils.isNotEmpty(easBills)) {
CompletableFuture.runAsync(() -> {
syncEasAuditBills(easBills);
}, pool);
}
//srm单据推送
if (CollectionUtils.isNotEmpty(srmBills)) {
CompletableFuture.runAsync(() -> {
syncSrmAuditBills(srmBills);
}, pool);
}
}
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
public void syncEasAuditBills(List<EasOutInBillDto> bills) {
for (EasOutInBillDto bill : bills) {
try {
String billJson = com.alibaba.fastjson.JSON.toJSONString(bill, SerializerFeature.WriteMapNullValue);
wmsToEasService.sendWebService(billJson);
easOutInBillMapper.update(null, new UpdateWrapper<EasOutInBill>().set("djzt", "提交").eq("djid", bill.getBillId()));
} catch (Exception e) {
log.error("推送Eas单据失败,单据号为:[" + bill.getBillId() + "]异常原因:" + e.toString());
//throw new BadRequestException(e.toString());
}
}
// List<String> billIds = bills.stream().map(EasOutInBillDto::getBillId).collect(Collectors.toList());
// if (CollectionUtils.isNotEmpty(billIds)) {
// easOutInBillMapper.update(null, new UpdateWrapper<EasOutInBill>().set("djzt", "提交").in("djid", billIds));
// }
}
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
public void syncSrmAuditBills(List<EasOutInBillDto> bills) {
for (EasOutInBillDto bill : bills) {
try {
String billJson = com.alibaba.fastjson.JSON.toJSONString(bill, SerializerFeature.WriteMapNullValue);
wmsToSrmService.sendWebService(billJson);
easOutInBillMapper.update(null, new UpdateWrapper<EasOutInBill>().set("djzt", "提交").eq("djid", bill.getBillId()));
} catch (Exception e) {
log.error("推送Eas单据失败,单据号为:[" + bill.getBillId() + "]异常原因:" + e.toString());
//throw new BadRequestException(e.toString());
}
}
// List<String> billIds = bills.stream().map(EasOutInBillDto::getBillId).collect(Collectors.toList());
// if (CollectionUtils.isNotEmpty(billIds)) {
// easOutInBillMapper.update(null, new UpdateWrapper<EasOutInBill>().set("djzt", "提交").in("djid", billIds));
// }
}
@ -213,12 +295,12 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
* @param isCreate 是否创建
*/
private EasOutInBill getBasicInfo(EasOutInBillQuery entity, boolean isCreate) {
if (isCreate) {
entity.setId(IdUtil.getStringId());
// entity.setCreate_id(Long.valueOf(SecurityUtils.getCurrentUserId()));
// entity.setCreate_name(SecurityUtils.getCurrentNickName());
// entity.setCreate_time(DateUtil.now());
}
//if (isCreate) {
//entity.setDjid(IdUtil.getStringId());
// entity.setCreate_id(Long.valueOf(SecurityUtils.getCurrentUserId()));
// entity.setCreate_name(SecurityUtils.getCurrentNickName());
// entity.setCreate_time(DateUtil.now());
//}
// entity.setUpdate_optid(Long.valueOf(SecurityUtils.getCurrentUserId()));
// entity.setUpdate_optname(SecurityUtils.getCurrentNickName());
// entity.setUpdate_time(DateUtil.now());

61
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/eas/WmsToEasService.java

@ -3,12 +3,18 @@ package org.nl.wms.ext.eas;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.message.SOAPHeaderElement;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
import javax.xml.namespace.QName;
import javax.xml.rpc.ServiceException;
import java.rmi.RemoteException;
/**
* WmsToEasService
@ -17,28 +23,33 @@ import javax.xml.namespace.QName;
* @since 2024-03-29
*/
@Slf4j
@Component
public class WmsToEasService {
public static void sendWebService(String json) {
try {
String http = "http://192.168.100.100:8080/ormrpc/services/";
//用户
String user = "user";
//密码
String password = "Noble123!9";
//数据中心
String datacenter = "test";
//服务
String wsdlservice = "WSNLMESFacade";
//方法
String operationName = "dealTask";
try {
String[] msg = null;
@Value("${easConfig.host}")
private String host;
@Value("${easConfig.user}")
private String user;
@Value("${easConfig.password}")
private String password;
@Value("${easConfig.datacenter}")
private String datacenter;
@Value("${easConfig.wsdlService}")
private String wsdlService;
@Value("${easConfig.operationName}")
private String operationName;
public void sendWebService(String json) throws ServiceException, RemoteException {
Service s = new Service();
Call call = (Call) s.createCall();
call.setOperationName("login");
//登录的webservice的wsdl的地址
call.setTargetEndpointAddress(http + "EASLogin?wsdl");
call.setTargetEndpointAddress(host + "EASLogin?wsdl");
call.setReturnType(new QName("urn:client", "WSContext"));
//本地根据wsdl文件建立的返回对象
call.setReturnClass(WSContext.class);
@ -56,14 +67,13 @@ public class WmsToEasService {
System.out.println(sessionId);
//登录失败抛出异常
if (sessionId == null) {
log.error("sendWebService调用结果"+"login Eas Fail");
throw new Exception("login Eas Fail");
log.error("sendWebService调用结果" + "login Eas Fail");
}
call.clearOperation();
//超时时间 自由配置
call.setTimeout(1000 * 60);
call.setMaintainSession(true);
call.setTargetEndpointAddress(http + wsdlservice + "?wsdl");
call.setTargetEndpointAddress(host + wsdlService + "?wsdl");
call.setReturnQName(new QName("", "dealTaskReturn"));
//具体某个方法
call.setOperationName(operationName);
@ -73,16 +83,9 @@ public class WmsToEasService {
Object invoke = call.invoke(new Object[]{json});
JSONObject jsonObject = JSON.parseObject((String) invoke);
int results = jsonObject.getIntValue("result");
log.error("sendWebService调用:"+"调用成功!");
log.error("sendWebService调用结果:"+invoke.toString());
log.error("sendWebService调用结果:"+results);
log.error("sendWebService调用:" + "调用成功!");
log.error("sendWebService调用结果:" + invoke.toString());
log.error("sendWebService调用结果:" + results);
System.out.println(invoke);
} catch (Exception e) {
log.error("sendWebService调用结果:"+e.toString());
e.printStackTrace();
}
} finally {
}
}
}

91
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/srm/WmsToSrmService.java

@ -0,0 +1,91 @@
package org.nl.wms.ext.srm;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.message.SOAPHeaderElement;
import org.nl.wms.ext.eas.WSContext;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.xml.namespace.QName;
import javax.xml.rpc.ServiceException;
import java.rmi.RemoteException;
/**
* WmsToEasService
*
* @author gbx
* @since 2024-03-29
*/
@Slf4j
@Component
public class WmsToSrmService {
@Value("${srmConfig.host}")
private String host;
@Value("${srmConfig.user}")
private String user;
@Value("${srmConfig.password}")
private String password;
@Value("${srmConfig.datacenter}")
private String datacenter;
@Value("${srmConfig.wsdlService}")
private String wsdlService;
@Value("${srmConfig.operationName}")
private String operationName;
public void sendWebService(String json) throws ServiceException, RemoteException {
Service s = new Service();
Call call = (Call) s.createCall();
call.setReturnType(new QName("urn:client", "WSContext"));
//本地根据wsdl文件建立的返回对象
call.setReturnClass(WSContext.class);
// call.setOperationName("login");
// //登录的webservice的wsdl的地址
// call.setTargetEndpointAddress(host + "EASLogin?wsdl");
// call.setReturnQName(new QName("", "loginReturn"));
// //超时时间 自由配置
// call.setTimeout(1000 * 60);
// call.setMaintainSession(true);
// //解决方案:eas
// //语言:L2 简体中文 L3 繁体中文
// //数据库类型:0 SQL Server 1 Oracle 2 DB2
// result = (WSContext) call.invoke(new Object[]{user, password, "eas", datacenter, "L2", 1, "BaseDB"});
// //关键点,获取登录时返回的sessionid
// String sessionId = result.getSessionId();
// System.out.println(sessionId);
// //登录失败抛出异常
// if (sessionId == null) {
// log.error("sendWebService调用结果" + "login Eas Fail");
// throw new Exception("login Eas Fail");
// }
// call.clearOperation();
//超时时间 自由配置
call.setTimeout(1000 * 60);
call.setMaintainSession(true);
call.setTargetEndpointAddress(host + wsdlService + "?wsdl");
call.setReturnQName(new QName("", "dealTaskReturn"));
//具体某个方法
call.setOperationName(operationName);
//关键点 传sessionid
//call.addHeader(new SOAPHeaderElement("http://login.webservice.bos.kingdee.com", "SessionId"));
//接口报文
Object invoke = call.invoke(new Object[]{json});
JSONObject jsonObject = JSON.parseObject((String) invoke);
int results = jsonObject.getIntValue("result");
log.error("sendWebService调用:" + "调用成功!");
log.error("sendWebService调用结果:" + invoke.toString());
log.error("sendWebService调用结果:" + results);
System.out.println(invoke);
}
}

61
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/schedule/EasBillSchedule.java

@ -3,6 +3,10 @@ package org.nl.wms.schedule;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.nl.common.utils.CodeUtil;
import org.nl.config.IdUtil;
import org.nl.wms.database.eas.dao.EasOutInBillDetail;
import org.nl.wms.database.eas.dao.mapper.EasOutInBillDetailMapper;
import org.nl.wms.database.eas.service.IeasOutInBillService;
@ -12,7 +16,9 @@ import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
@ -33,6 +39,9 @@ public class EasBillSchedule {
@Resource
private EasOutInBillDetailMapper easOutInBillDetailMapper;
@Resource
private WmsToEasService wmsToEasService;
/**
* eas单据数据同步
@ -40,21 +49,51 @@ public class EasBillSchedule {
@Async("taskExecutor")
@Scheduled(cron = "0/10 * * * * *")
public void getEasOutInBills() {
//Eas视图查询未提交的单据
List<EasOutInBillDetail> easOutInBillDetail = easOutInBillDetailMapper.selectPageWithInventory();
if (!easOutInBillDetail.isEmpty()) {
//本地查询未提交的单据
Set<String> existingId = new HashSet<>(easOutInBillService.queryExistBills());
List<EasOutInBillDetail> insertBills = easOutInBillDetail.stream()
.filter(e -> !existingId.contains(e.getDjid())).collect(Collectors.toList());
if (insertBills.size() > 0) {
easOutInBillService.createBills(insertBills);
// 获取eas视图查询未提交的单据
List<EasOutInBillDetail> easOutInBillDetails = easOutInBillDetailMapper.selectPageWithInventory();
// 获取srm视图查询未提交的单据
List<EasOutInBillDetail> srmOutInBillDetails = easOutInBillDetailMapper.selectSrmPageWithInventory();
if (CollectionUtils.isNotEmpty(easOutInBillDetails) || CollectionUtils.isNotEmpty(srmOutInBillDetails)) {
// 查询已存在的单据
Set<String> existingIds = new HashSet<>(easOutInBillService.queryExistBills());
// 过滤出需要插入的新单据,并根据来源设置 ID
List<EasOutInBillDetail> insertEasBills = easOutInBillDetails.stream()
.filter(bill -> !existingIds.contains(bill.getDjid()))
.peek(bill -> {
if (bill.getSl().compareTo(BigDecimal.ZERO) < 0) {
bill.setSl(bill.getSl().abs());
}
bill.setCode(CodeUtil.getNewCode("TASK_CODE"));
bill.setSysl(bill.getSl());
bill.setCzsl(BigDecimal.ZERO);
bill.setKcsl(BigDecimal.ZERO);
})
.collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(srmOutInBillDetails)) {
List<EasOutInBillDetail> insertSrmBills = srmOutInBillDetails.stream()
.filter(bill -> !existingIds.contains(bill.getDjid()))
.peek(bill -> {
if (bill.getSl().compareTo(BigDecimal.ZERO) < 0) {
bill.setSl(bill.getSl().abs());
}
bill.setId(IdUtil.getStringId());
bill.setDjzt("保存");
bill.setDjly("2");
bill.setCode(CodeUtil.getNewCode("TASK_CODE"));
bill.setSysl(bill.getSl());
bill.setCzsl(BigDecimal.ZERO);
bill.setKcsl(BigDecimal.ZERO);})
.collect(Collectors.toList());
insertEasBills.addAll(insertSrmBills);
}
if (CollectionUtils.isNotEmpty(insertEasBills)) {
easOutInBillService.createBills(insertEasBills);
}
}
}
@Async("taskExecutor")
//@Scheduled(cron = "0/20 * * * * *")
// @Scheduled(cron = "0/20 * * * * *")
//@PostConstruct
@Transactional(rollbackFor = Exception.class)
public void insertNewWorkOrders() {
@ -84,7 +123,7 @@ public class EasBillSchedule {
jsonData.put("type", "WMS");
jsonData.put("method", "DealOutInBill");
jsonData.put("data", data);
WmsToEasService.sendWebService(jsonData.toJSONString());
//wmsToEasService.sendWebService(jsonData.toJSONString());
log.error("结束调用webService接口:-----------------------*************");
}

13
lms/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml

@ -17,11 +17,17 @@ spring:
username: ${DB_USER:generallu}
password: ${DB_PWD:123456}
type: com.alibaba.druid.pool.DruidDataSource
oracle:
mysql_srm:
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:nl_sq_wms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
username: ${DB_USER:wms_third}
password: ${DB_PWD:NOBLElift@!#wms}
type: com.alibaba.druid.pool.DruidDataSource
oracle_eas:
driver-class-name: oracle.jdbc.OracleDriver
url: jdbc:oracle:thin:@localhost:1521:orcl
username: ${DB_USER:meiamsystem}
password: ${DB_PWD:meiamsystem}
username: ${DB_USER:user1}
password: ${DB_PWD:Noble12319}
type: com.alibaba.druid.pool.DruidDataSource
sqlserver:
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
@ -127,7 +133,6 @@ sa-token:
allow-url: "*"
# 是否打开单点注销功能
is-slo: true
# ------- SSO-模式三相关配置 (下面的配置在SSO模式三并且 is-slo=true 时打开)
# 是否打开模式三
isHttp: true

24
lms/nladmin-system/nlsso-server/src/main/resources/config/application-prod.yml

@ -1,5 +1,5 @@
server:
port: 8010
port: 8011
#配置数据源
spring:
autoconfigure:
@ -10,18 +10,24 @@ spring:
datasource:
mysql:
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
url: jdbc:log4jdbc:mysql://${DB_HOST:10.93.41.198}:${DB_PORT:3306}/${DB_NAME:rl_mg_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
# url: jdbc:log4jdbc:mysql://${DB_HOST:10.93.41.198}:${DB_PORT:3306}/${DB_NAME:rl_mg_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
# username: ${DB_USER:root}
# password: ${DB_PWD:123456}
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:nl_sq_wms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
username: ${DB_USER:root}
password: ${DB_PWD:123456}
# url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:rtmg_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
# username: ${DB_USER:root}
# password: ${DB_PWD:12356}
type: com.alibaba.druid.pool.DruidDataSource
oracle:
mysql_srm:
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
url: jdbc:log4jdbc:mysql://${DB_HOST:10.10.188.30}:${DB_PORT:3306}/${DB_NAME:nuoli_v1.0}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
username: ${DB_USER:wms_third}
password: ${DB_PWD:NOBLElift@!#wms}
type: com.alibaba.druid.pool.DruidDataSource
oracle_eas:
driver-class-name: oracle.jdbc.OracleDriver
url: jdbc:oracle:thin:@172.27.37.66:1521:RTMES
username: ${DB_USER:LMSTELCOM}
password: ${DB_PWD:LMSTELCOM_6463}
url: jdbc:oracle:thin:@192.168.100.97:1521:orcl
username: ${DB_USER:stuser}
password: ${DB_PWD:stuser123}
type: com.alibaba.druid.pool.DruidDataSource
sqlserver:
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver

14
lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml

@ -191,3 +191,17 @@ jetcache:
maxTotal: 50 # 连接池中的最大连接数
host: 127.0.0.1
port: 6379
easConfig:
host: http://192.168.100.100:8080/ormrpc/services/
user: user
password: Noble123!9
datacenter: test
wsdlService: WSNLMESFacade
operationName: dealTask
srmConfig:
host: http://192.168.100.100:8080/ormrpc/services/
user: user
password: Noble123!9
datacenter: test
wsdlService: WSNLMESFacade
operationName: dealTask

1
lms/nladmin-ui/.env.development

@ -6,3 +6,4 @@ VUE_APP_WS_API = 'ws://localhost:8011'
# 是否启用 babel-plugin-dynamic-import-node插件
VUE_CLI_BABEL_TRANSPILE_MODULES = true

Loading…
Cancel
Save