Browse Source

add: 优化上线期间提出的需求;

master1
龚宝雄 9 months ago
parent
commit
1c9252b0fd
  1. 13
      nlsso-server/src/main/java/org/nl/wms/database/eas/controller/AllocationBillController.java
  2. 21
      nlsso-server/src/main/java/org/nl/wms/database/eas/controller/EasOutInBillController.java
  3. 2
      nlsso-server/src/main/java/org/nl/wms/database/eas/controller/ReceiptBillController.java
  4. 23
      nlsso-server/src/main/java/org/nl/wms/database/eas/dao/AllocationBill.java
  5. 17
      nlsso-server/src/main/java/org/nl/wms/database/eas/dao/EasOutInBill.java
  6. 14
      nlsso-server/src/main/java/org/nl/wms/database/eas/dao/EasOutInBillDetail.java
  7. 19
      nlsso-server/src/main/java/org/nl/wms/database/eas/dao/ReceiptBill.java
  8. 15
      nlsso-server/src/main/java/org/nl/wms/database/eas/dao/WarehouseInfo.java
  9. 12
      nlsso-server/src/main/java/org/nl/wms/database/eas/dao/mapper/AllocationBillMapper.java
  10. 7
      nlsso-server/src/main/java/org/nl/wms/database/eas/dao/mapper/EasOutInBillDetailMapper.java
  11. 8
      nlsso-server/src/main/java/org/nl/wms/database/eas/dao/mapper/EasOutInBillMapper.java
  12. 2
      nlsso-server/src/main/java/org/nl/wms/database/eas/dao/mapper/ReceiptBillMapper.java
  13. 38
      nlsso-server/src/main/java/org/nl/wms/database/eas/dao/xml/AllocationBillMapper.xml
  14. 15
      nlsso-server/src/main/java/org/nl/wms/database/eas/dao/xml/EasOutInBillDetailMapper.xml
  15. 2
      nlsso-server/src/main/java/org/nl/wms/database/eas/dao/xml/ReceiptBillMapper.xml
  16. 23
      nlsso-server/src/main/java/org/nl/wms/database/eas/dto/AllocationBillQuery.java
  17. 21
      nlsso-server/src/main/java/org/nl/wms/database/eas/dto/AllocationBillVO.java
  18. 9
      nlsso-server/src/main/java/org/nl/wms/database/eas/dto/EasOutInBillQuery.java
  19. 106
      nlsso-server/src/main/java/org/nl/wms/database/eas/dto/InventoryInfos.java
  20. 25
      nlsso-server/src/main/java/org/nl/wms/database/eas/dto/ReceiptBillQuery.java
  21. 11
      nlsso-server/src/main/java/org/nl/wms/database/eas/service/IallocationBillService.java
  22. 25
      nlsso-server/src/main/java/org/nl/wms/database/eas/service/IeasOutInBillService.java
  23. 2
      nlsso-server/src/main/java/org/nl/wms/database/eas/service/IreceiptBillService.java
  24. 85
      nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/AllocationBillServiceImpl.java
  25. 78
      nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/EasOutInBillServiceImpl.java
  26. 75
      nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/ReceiptBillServiceImpl.java
  27. 23
      nlsso-server/src/main/java/org/nl/wms/schedule/EasBillSchedule.java

13
nlsso-server/src/main/java/org/nl/wms/database/eas/controller/AllocationBillController.java

@ -11,6 +11,8 @@ import org.nl.common.base.ResultCode;
import org.nl.common.exception.BadRequestException; import org.nl.common.exception.BadRequestException;
import org.nl.wms.database.eas.dao.AllocationBill; import org.nl.wms.database.eas.dao.AllocationBill;
import org.nl.wms.database.eas.dto.AllocationBillQuery; import org.nl.wms.database.eas.dto.AllocationBillQuery;
import org.nl.wms.database.eas.dto.EasOutInBillDetailVO;
import org.nl.wms.database.eas.dto.InventoryInfos;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -74,6 +76,17 @@ public class AllocationBillController {
return RestBusinessTemplate.execute(() -> allocationBillService.query(params)); return RestBusinessTemplate.execute(() -> allocationBillService.query(params));
} }
/**
* 根据条件查询库存跟踪号
*
* @param params 根据条件查询库存跟踪号
*/
@PostMapping("/getInventoryInfo")
@Log("根据条件查询库存跟踪号")
public ResponseEntity<List<InventoryInfos>> getInventoryInfo(@RequestBody AllocationBillVO params) {
return new ResponseEntity<>(allocationBillService.getInventoryInfo(params), HttpStatus.OK);
}
/** /**
* 单据直接调拨 * 单据直接调拨
*/ */

21
nlsso-server/src/main/java/org/nl/wms/database/eas/controller/EasOutInBillController.java

@ -110,12 +110,31 @@ public class EasOutInBillController {
/** /**
* 获取仓库信息 * 获取仓库信息
*/ */
@PostMapping("/getWarehouseInfo") @PostMapping("/getUserInfo")
@Log("获取仓库信息") @Log("获取仓库信息")
public CommonResult<List<WarehouseInfo>> getWarehouseInfo() { public CommonResult<List<WarehouseInfo>> getWarehouseInfo() {
return RestBusinessTemplate.execute(() -> easOutInBillService.getWarehouseInfo()); return RestBusinessTemplate.execute(() -> easOutInBillService.getWarehouseInfo());
} }
/**
* 获取仓管员信息
*/
@PostMapping("/getUserInfo")
@Log("获取仓管员信息")
public CommonResult<List<WarehouseInfo>> getUserInfo() {
return RestBusinessTemplate.execute(() -> easOutInBillService.getUserInfo());
}
/**
* 获取组织机构信息
*/
@PostMapping("/getOrganizationInfo")
@Log("获取组织机构信息")
public CommonResult<List<WarehouseInfo>> getOrganizationInfo() {
return RestBusinessTemplate.execute(() -> easOutInBillService.getOrganizationInfo());
}
/** /**
* 条件查询 * 条件查询

2
nlsso-server/src/main/java/org/nl/wms/database/eas/controller/ReceiptBillController.java

@ -47,7 +47,7 @@ public class ReceiptBillController {
*/ */
@PostMapping("/receiptPage") @PostMapping("/receiptPage")
@Log("分页查询") @Log("分页查询")
public ResponseEntity<CommonPage<AllocationBillQuery>> receiptPage(@RequestBody ReceiptBillQuery params) { public ResponseEntity<CommonPage<ReceiptBillQuery>> receiptPage(@RequestBody ReceiptBillQuery params) {
return new ResponseEntity<>(receiptBillService.receiptPage(params), HttpStatus.OK); return new ResponseEntity<>(receiptBillService.receiptPage(params), HttpStatus.OK);
} }

23
nlsso-server/src/main/java/org/nl/wms/database/eas/dao/AllocationBill.java

@ -119,6 +119,29 @@ public class AllocationBill extends Model<AllocationBill> {
*/ */
private String bz; private String bz;
/**
* 审核结果
*/
private String shjg;
/**
* 修改人id
*/
private String update_id;
/**
* 修改人
*/
private String update_name;
/**
* 修改时间
*/
private String update_time;
/** /**
* 获取主键值 * 获取主键值
* *

17
nlsso-server/src/main/java/org/nl/wms/database/eas/dao/EasOutInBill.java

@ -156,6 +156,23 @@ public class EasOutInBill extends Model<EasOutInBill> {
private String update_time; private String update_time;
/**
* 仓管员编码
*/
private String cgybm;
/**
* 仓管员名称
*/
private String cgymc;
/**
* 审核结果
*/
private String shjg;
/** /**
* 获取主键值 * 获取主键值
* *

14
nlsso-server/src/main/java/org/nl/wms/database/eas/dao/EasOutInBillDetail.java

@ -185,7 +185,6 @@ public class EasOutInBillDetail extends Model<EasOutInBillDetail> {
private BigDecimal kcsl; private BigDecimal kcsl;
/** /**
* 推荐库位编码 * 推荐库位编码
*/ */
@ -291,11 +290,24 @@ public class EasOutInBillDetail extends Model<EasOutInBillDetail> {
*/ */
private BigDecimal czsl; private BigDecimal czsl;
/** /**
* 修改时间 * 修改时间
*/ */
private String xgsj; private String xgsj;
/**
* 仓管员编码
*/
private String cgybm;
/**
* 仓管员名称
*/
private String cgymc;
/** /**
* 获取主键值 * 获取主键值
* *

19
nlsso-server/src/main/java/org/nl/wms/database/eas/dao/ReceiptBill.java

@ -93,7 +93,26 @@ public class ReceiptBill extends Model<ReceiptBill> {
*/ */
private String btbz; private String btbz;
/**
* 审核结果
*/
private String shjg;
/**
* 修改人id
*/
private String update_id;
/**
* 修改人
*/
private String update_name;
/**
* 修改时间
*/
private String update_time;
/** /**
* 获取主键值 * 获取主键值

15
nlsso-server/src/main/java/org/nl/wms/database/eas/dao/WarehouseInfo.java

@ -28,13 +28,24 @@ public class WarehouseInfo implements Serializable {
/** /**
* 组织编码 * 组织编码
*/ */
private String kcbm; private String kczzbm;
/** /**
* 组织名称 * 组织名称
*/ */
private String kcmc; private String kczzmc;
/**
* 仓管员编码
*/
private String cgybm;
/**
* 仓管员名称
*/
private String cgymc;
/** /**
* 状态 * 状态

12
nlsso-server/src/main/java/org/nl/wms/database/eas/dao/mapper/AllocationBillMapper.java

@ -6,7 +6,9 @@ import io.lettuce.core.dynamic.annotation.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import org.nl.wms.database.eas.dao.AllocationBill; import org.nl.wms.database.eas.dao.AllocationBill;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.nl.wms.database.eas.dao.InventoryInfo;
import org.nl.wms.database.eas.dto.AllocationBillQuery; import org.nl.wms.database.eas.dto.AllocationBillQuery;
import org.nl.wms.database.eas.dto.InventoryInfos;
import java.util.List; import java.util.List;
@ -33,4 +35,14 @@ public interface AllocationBillMapper extends BaseMapper<AllocationBill> {
@DS("oracle_eas") @DS("oracle_eas")
List<AllocationBillQuery> allocationDetailPage(@Param("page") Integer page, @Param("size") Integer size, @Param("djid") String djid, @Param("fuzzy") String fuzzy); List<AllocationBillQuery> allocationDetailPage(@Param("page") Integer page, @Param("size") Integer size, @Param("djid") String djid, @Param("fuzzy") String fuzzy);
@DS("oracle_eas")
List<InventoryInfos> selectByCondition(@Param("dckcbm") String dckcbm,
@Param("dcckbm") String dcckbm,
@Param("dckwbm") String dckwbm,
@Param("wlbm") String wlbm,
@Param("pc") String pc,
@Param("gzh") String gzh);
} }

7
nlsso-server/src/main/java/org/nl/wms/database/eas/dao/mapper/EasOutInBillDetailMapper.java

@ -43,6 +43,10 @@ public interface EasOutInBillDetailMapper extends BaseMapper<EasOutInBillDetail>
@DS("oracle_eas") @DS("oracle_eas")
List<EasOutInBillDetail> selectPageWithInventory(); List<EasOutInBillDetail> selectPageWithInventory();
@DS("oracle_eas")
List<EasOutInBillDetail> selectEasPages();
@DS("oracle_eas") @DS("oracle_eas")
List<EasOutInBillDetail> selectEasIds(); List<EasOutInBillDetail> selectEasIds();
@ -50,6 +54,9 @@ public interface EasOutInBillDetailMapper extends BaseMapper<EasOutInBillDetail>
@DS("mysql_srm") @DS("mysql_srm")
List<EasOutInBillDetail> selectSrmIds(); List<EasOutInBillDetail> selectSrmIds();
@DS("mysql_srm")
List<EasOutInBillDetail> selectSrmPages();
@DS("mysql_srm") @DS("mysql_srm")
List<EasOutInBillDetail> selectSrmPageWithInventory(); List<EasOutInBillDetail> selectSrmPageWithInventory();

8
nlsso-server/src/main/java/org/nl/wms/database/eas/dao/mapper/EasOutInBillMapper.java

@ -45,6 +45,14 @@ public interface EasOutInBillMapper extends BaseMapper<EasOutInBill> {
@DS("oracle_eas") @DS("oracle_eas")
List<WarehouseInfo> getWarehouseInfo(); List<WarehouseInfo> getWarehouseInfo();
@Select("SELECT * FROM EAS_NOBLE.V_UC_STOAGEORG")
@DS("oracle_eas")
List<WarehouseInfo> getOrganizationInfo();
@Select("SELECT * FROM EAS_NOBLE.V_UC_USERINFO")
@DS("oracle_eas")
List<WarehouseInfo> getUserInfo();

2
nlsso-server/src/main/java/org/nl/wms/database/eas/dao/mapper/ReceiptBillMapper.java

@ -23,7 +23,7 @@ public interface ReceiptBillMapper extends BaseMapper<ReceiptBill> {
Long receiptCounts(); Long receiptCounts();
@DS("mysql_srm") @DS("mysql_srm")
Page<AllocationBillQuery> receiptPage(Page<AllocationBillQuery> page, @Param("fuzzy") String fuzzy, @Param("ckbm") String ckbm); Page<ReceiptBillQuery> receiptPage(Page<ReceiptBillQuery> page, @Param("fuzzy") String fuzzy, @Param("ckbm") String ckbm);
@DS("mysql_srm") @DS("mysql_srm")

38
nlsso-server/src/main/java/org/nl/wms/database/eas/dao/xml/AllocationBillMapper.xml

@ -20,7 +20,7 @@
) )
</if> </if>
<if test="ckbm != null and ckbm != ''"> <if test="ckbm != null and ckbm != ''">
AND (drckbm = #{ckbm} OR dcckbm = #{ckbm}) AND (dckcbm = #{ckbm} OR drkcbm = #{ckbm})
</if> </if>
ORDER BY CJSJ DESC ) temp ) ORDER BY CJSJ DESC ) temp )
</select> </select>
@ -40,7 +40,7 @@
) )
</if> </if>
<if test="ckbm != null and ckbm != ''"> <if test="ckbm != null and ckbm != ''">
AND (drckbm = #{ckbm} OR dcckbm = #{ckbm}) AND (dckcbm = #{ckbm} OR drkcbm = #{ckbm})
</if> </if>
ORDER BY CJSJ DESC ) temp WHERE <![CDATA[ ROWNUM <= #{size} * #{page} ]]>) WHERE ORDER BY CJSJ DESC ) temp WHERE <![CDATA[ ROWNUM <= #{size} * #{page} ]]>) WHERE
<![CDATA[ row_num > #{size} * (#{page} - 1) ]]> <![CDATA[ row_num > #{size} * (#{page} - 1) ]]>
@ -56,5 +56,39 @@
WHERE RNUM BETWEEN (#{page} - 1) * #{size} + 1 AND #{page} * #{size} WHERE RNUM BETWEEN (#{page} - 1) * #{size} + 1 AND #{page} * #{size}
</select> </select>
<select id="selectByCondition" resultType="org.nl.wms.database.eas.dto.InventoryInfos">
SELECT
materialNo,
materialName,
warehouseNo,
warehouseName
locationNo,
locationName,
lot,
curStoreQty,
unitNo,
trackNo
FROM EAS_NOBLE.V_UC_INVENTORYINFO
<where>
<if test="dckcbm != null and dckcbm != ''">
AND stono = #{dckcbm}
</if>
<if test="dcckbm != null and dcckbm != ''">
AND warehouseno = #{dcckbm}
</if>
<if test="dckwbm != null and dckwbm != ''">
AND locationno = #{dckwbm}
</if>
<if test="wlbm != null and wlbm != ''">
AND materialno = #{wlbm}
</if>
<if test="pc != null and pc != ''">
AND lot = #{pc}
</if>
<if test="gzh != null and gzh != ''">
AND trackno = #{gzh}
</if>
</where>
</select>
</mapper> </mapper>

15
nlsso-server/src/main/java/org/nl/wms/database/eas/dao/xml/EasOutInBillDetailMapper.xml

@ -1,6 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!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"> <mapper namespace="org.nl.wms.database.eas.dao.mapper.EasOutInBillDetailMapper">
<select id="selectEasPages" resultType="org.nl.wms.database.eas.dao.EasOutInBillDetail">
SELECT *
FROM EAS_NOBLE.V_UC_OUTINBILL
WHERE DJZT = '提交'
AND TO_DATE(cjsj, 'YYYY-MM-DD HH24:MI:SS') >= TRUNC(SYSDATE) - INTERVAL '1' DAY(3)
</select>
<select id="selectSrmPages" resultType="org.nl.wms.database.eas.dao.EasOutInBillDetail">
SELECT *,
2 AS DJLY
FROM V_WMS_INBILL_THIRD
WHERE DJZT = '未入库'
AND CJSJ >= DATE_SUB(
CURDATE(),
INTERVAL 1 DAY)
</select>
<select id="selectPageWithInventory" resultType="org.nl.wms.database.eas.dao.EasOutInBillDetail"> <select id="selectPageWithInventory" resultType="org.nl.wms.database.eas.dao.EasOutInBillDetail">
SELECT * SELECT *
FROM EAS_NOBLE.V_UC_OUTINBILL FROM EAS_NOBLE.V_UC_OUTINBILL

2
nlsso-server/src/main/java/org/nl/wms/database/eas/dao/xml/ReceiptBillMapper.xml

@ -17,7 +17,7 @@
OR gys LIKE CONCAT('%', #{fuzzy}, '%')) OR gys LIKE CONCAT('%', #{fuzzy}, '%'))
</if> </if>
<if test="ckbm != null and ckbm != ''"> <if test="ckbm != null and ckbm != ''">
AND ckbm = #{ckbm} AND zzbm = #{ckbm}
</if> </if>
GROUP BY GROUP BY
DJID DJID

23
nlsso-server/src/main/java/org/nl/wms/database/eas/dto/AllocationBillQuery.java

@ -245,12 +245,35 @@ public class AllocationBillQuery extends BaseQuery<AllocationBillQuery> {
*/ */
private String jhdcrq; private String jhdcrq;
/**
* 库存组织编码
*/
private String kczzbm;
/** /**
* 分录备注 * 分录备注
*/ */
private String flbz; private String flbz;
/**
* 审核结果
*/
private String shjg;
/**
* 修改人id
*/
private String update_id;
/**
* 修改人
*/
private String update_name;
/**
* 修改时间
*/
private String update_time;
} }

21
nlsso-server/src/main/java/org/nl/wms/database/eas/dto/AllocationBillVO.java

@ -65,11 +65,30 @@ public class AllocationBillVO extends BaseQuery<AllocationBill> {
*/ */
private String jldw; private String jldw;
/**
* 物料编码
*/
private String wlbm;
/**
* 批次
*/
private String pc;
/**
* 计量单位
*/
private String gzh;
/** /**
* 数量 * 数量
*/ */
private String sl; private String sl;
/**
* 调出组织编码
*/
private String dckcbm;
/** /**
* 调出仓库 * 调出仓库

9
nlsso-server/src/main/java/org/nl/wms/database/eas/dto/EasOutInBillQuery.java

@ -114,4 +114,13 @@ public class EasOutInBillQuery extends BaseQuery<EasOutInBill> {
* 领料人 * 领料人
*/ */
private String llr; private String llr;
/**
* 仓管员编码
*/
private String cgybm;
} }

106
nlsso-server/src/main/java/org/nl/wms/database/eas/dto/InventoryInfos.java

@ -0,0 +1,106 @@
package org.nl.wms.database.eas.dto;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.math.BigDecimal;
/**
* {@code @Description:} (InventoryInfo)实体类
* {@code @Author:} gbx
*
* @since 2024-02-22
*/
@Data
@ToString
@EqualsAndHashCode(callSuper = false)
@SuppressWarnings("serial")
public class InventoryInfos extends Model<InventoryInfos> {
private static final long serialVersionUID = -7739291296662381393L;
//@TableId(value = "id", type = IdType.NONE)
/**
* 主键id
*/
private String trackNo;
/**
* 单据编号
*/
private String djbh;
/**
* 物料编码
*/
private String materialNo;
/**
* 物料名称
*/
private String materialName;
/**
* 批次
*/
private String lot;
/**
* 单位
*/
private String unitNo;
/**
* 库位编码
*/
private String locationNo;
/**
* 库位名称
*/
private String locationName;
/**
* 库存数量
*/
private BigDecimal kcsl;
/**
* 数量
*/
private String curStoreQty;
/**
* 跟踪号
*/
private String trackno;
/**
* 仓库编码
*/
private String warehouseNo;
/**
* 仓库名称
*/
private String warehouseName;
}

25
nlsso-server/src/main/java/org/nl/wms/database/eas/dto/ReceiptBillQuery.java

@ -256,5 +256,30 @@ public class ReceiptBillQuery extends BaseQuery<ReceiptBillQuery> {
/**
* 审核结果
*/
private String shjg;
/**
* 修改人id
*/
private String update_id;
/**
* 修改人
*/
private String update_name;
/**
* 修改时间
*/
private String update_time;
/**
* 搜索组织编码
*/
private String kczzbm;
} }

11
nlsso-server/src/main/java/org/nl/wms/database/eas/service/IallocationBillService.java

@ -5,6 +5,8 @@ import org.nl.wms.database.eas.dao.AllocationBill;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import org.nl.wms.database.eas.dto.AllocationBillQuery; import org.nl.wms.database.eas.dto.AllocationBillQuery;
import org.nl.wms.database.eas.dto.AllocationBillVO; import org.nl.wms.database.eas.dto.AllocationBillVO;
import org.nl.wms.database.eas.dto.EasOutInBillDetailVO;
import org.nl.wms.database.eas.dto.InventoryInfos;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -52,6 +54,15 @@ public interface IallocationBillService extends IService<AllocationBill> {
*/ */
void allocationConfirm(List<AllocationBillVO> params); void allocationConfirm(List<AllocationBillVO> params);
/**
* 根据条件查询库存跟踪号
*
* @param params 查询条件
* @return String
*/
List<InventoryInfos> getInventoryInfo(AllocationBillVO params);
/** /**
* 创建 * 创建
* *

25
nlsso-server/src/main/java/org/nl/wms/database/eas/service/IeasOutInBillService.java

@ -39,6 +39,22 @@ public interface IeasOutInBillService extends IService<EasOutInBill> {
List<HomeBillCounts> getBillsCount(); List<HomeBillCounts> getBillsCount();
/**
* 获取组织机构信息
*
* @return JSONObject
*/
List<WarehouseInfo> getOrganizationInfo();
/**
* 获取仓管员信息
*
* @return JSONObject
*/
List<WarehouseInfo> getUserInfo();
/** /**
* 获取仓库信息 * 获取仓库信息
* *
@ -100,9 +116,14 @@ public interface IeasOutInBillService extends IService<EasOutInBill> {
/** /**
* 单据新增或更新 * 单据新增
*/
void insertInOutBills(List<EasOutInBillDetail> easOutInBillDetails, List<EasOutInBillDetail> existingIds);
/**
* 单据更新或删除
*/ */
void insertOrUpdateBills(List<EasOutInBillDetail> easOutInBillDetails, List<EasOutInBillDetail> existingIds); void updateOrDeleteBills(List<EasOutInBillDetail> easOutInBillDetails, List<EasOutInBillDetail> existingIds);
/** /**

2
nlsso-server/src/main/java/org/nl/wms/database/eas/service/IreceiptBillService.java

@ -25,7 +25,7 @@ public interface IreceiptBillService extends IService<ReceiptBill> {
* @param params 查询条件 * @param params 查询条件
* @return IPage<EasOutInBill> * @return IPage<EasOutInBill>
*/ */
CommonPage<AllocationBillQuery> receiptPage(ReceiptBillQuery params); CommonPage<ReceiptBillQuery> receiptPage(ReceiptBillQuery params);
/** /**
* 分页查询 * 分页查询

85
nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/AllocationBillServiceImpl.java

@ -1,6 +1,8 @@
package org.nl.wms.database.eas.service.impl; package org.nl.wms.database.eas.service.impl;
import cn.dev33.satoken.annotation.SaIgnore; import cn.dev33.satoken.annotation.SaIgnore;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature; import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -14,6 +16,7 @@ import org.nl.wms.database.eas.service.IallocationBillService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.nl.wms.ext.eas.WmsToEasService; import org.nl.wms.ext.eas.WmsToEasService;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
@ -21,6 +24,8 @@ import org.springframework.beans.BeanUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.nl.common.base.CommonPage; import org.nl.common.base.CommonPage;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
@ -62,17 +67,17 @@ public class AllocationBillServiceImpl extends ServiceImpl<AllocationBillMapper,
AtomicLong totalCount = new AtomicLong(0L); AtomicLong totalCount = new AtomicLong(0L);
CompletableFuture<Void> count = CompletableFuture.runAsync(() -> { CompletableFuture<Void> count = CompletableFuture.runAsync(() -> {
try { try {
totalCount.set(allocationBillMapper.getAllocationCount(params.getFuzzy(), params.getCkbm())); totalCount.set(allocationBillMapper.getAllocationCount(params.getFuzzy(), params.getKczzbm()));
} catch (Exception e) { } catch (Exception e) {
log.error("异常信息:" + e); log.error("异常信息:" + e);
} }
}, pool); }, pool);
CompletableFuture<List<AllocationBillQuery>> page = CompletableFuture.supplyAsync(() -> { CompletableFuture<List<AllocationBillQuery>> page = CompletableFuture.supplyAsync(() -> {
try { try {
return allocationBillMapper.allocationPage(params.getFuzzy(), params.getCkbm(), params.getPage(), params.getSize()); return allocationBillMapper.allocationPage(params.getFuzzy(), params.getKczzbm(), params.getPage(), params.getSize());
} catch (Exception e) { } catch (Exception e) {
log.error("异常信息:" + e); log.error("异常信息:" + e);
return Collections.emptyList(); return Collections.emptyList();
} }
}, pool); }, pool);
// 等待所有异步任务完成 // 等待所有异步任务完成
@ -90,20 +95,34 @@ public class AllocationBillServiceImpl extends ServiceImpl<AllocationBillMapper,
} }
// 处理查询结果 // 处理查询结果
if (allocationBills != null && !allocationBills.isEmpty()) { if (allocationBills != null && !allocationBills.isEmpty()) {
allocationBills = allocationBills.stream() // 获取更新列表
.peek(r -> { List<AllocationBill> updateList = allocationBillMapper.selectList(
r.setJhdrrq(LocalDateTime.parse(r.getJhdrrq(), DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")).toLocalDate().toString()); new LambdaQueryWrapper<AllocationBill>()
r.setJhdcrq(LocalDateTime.parse(r.getJhdcrq(), DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")).toLocalDate().toString()); .in(AllocationBill::getDjid, allocationBills.stream().map(AllocationBillQuery::getDjid).collect(Collectors.toList())));
}) if (!updateList.isEmpty()) {
.collect(Collectors.toList()); Map<String, AllocationBill> updateMap = updateList.stream()
.collect(Collectors.toMap(AllocationBill::getFlid, updateBill -> updateBill));
// 替换为修改记录
allocationBills = allocationBills.stream()
.map(a -> {
AllocationBill updatedBill = updateMap.get(a.getDjid());
if (updatedBill != null) {
a.setUpdate_id(updatedBill.getUpdate_id());
a.setUpdate_name(updatedBill.getUpdate_name());
a.setUpdate_time(updatedBill.getUpdate_time());
a.setShjg(updatedBill.getShjg());
}
a.setJhdrrq(LocalDateTime.parse(a.getJhdrrq(), DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")).toLocalDate().toString());
a.setJhdcrq(LocalDateTime.parse(a.getJhdcrq(), DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")).toLocalDate().toString());
return a;
})
.collect(Collectors.toList());
}
} }
return CommonPage.getPage(allocationBills, totalCount.get(), params.getPage(), params.getSize()); return CommonPage.getPage(allocationBills, totalCount.get(), params.getPage(), params.getSize());
} }
/** /**
* 分页查询 * 分页查询
* *
@ -143,6 +162,9 @@ public class AllocationBillServiceImpl extends ServiceImpl<AllocationBillMapper,
allocationBill.setDckwbm(updatedBill.getDckwbm()); allocationBill.setDckwbm(updatedBill.getDckwbm());
allocationBill.setDrckbm(updatedBill.getDrckbm()); allocationBill.setDrckbm(updatedBill.getDrckbm());
allocationBill.setDrkwbm(updatedBill.getDrkwbm()); allocationBill.setDrkwbm(updatedBill.getDrkwbm());
allocationBill.setUpdate_id(updatedBill.getUpdate_id());
allocationBill.setUpdate_name(updatedBill.getUpdate_name());
allocationBill.setUpdate_time(updatedBill.getUpdate_time());
if (updatedBill.getJhdrrq().contains("/") || updatedBill.getJhdcrq().contains("/")) { if (updatedBill.getJhdrrq().contains("/") || updatedBill.getJhdcrq().contains("/")) {
allocationBill.setJhdrrq(LocalDateTime.parse(updatedBill.getJhdrrq(), DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")).toLocalDate().toString()); allocationBill.setJhdrrq(LocalDateTime.parse(updatedBill.getJhdrrq(), DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")).toLocalDate().toString());
allocationBill.setJhdcrq(LocalDateTime.parse(updatedBill.getJhdcrq(), DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")).toLocalDate().toString()); allocationBill.setJhdcrq(LocalDateTime.parse(updatedBill.getJhdcrq(), DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")).toLocalDate().toString());
@ -176,6 +198,16 @@ public class AllocationBillServiceImpl extends ServiceImpl<AllocationBillMapper,
); );
} }
/**
* 根据条件查询库存跟踪号
*
* @param params 查询条件
*/
@Override
public List<InventoryInfos> getInventoryInfo(AllocationBillVO params) {
return allocationBillMapper.selectByCondition(params.getDckcbm(), params.getDcckbm(), params.getDckwbm(), params.getWlbm(), params.getPc(), params.getGzh());
}
/** /**
* 创建 * 创建
@ -221,20 +253,38 @@ public class AllocationBillServiceImpl extends ServiceImpl<AllocationBillMapper,
} }
); );
allocationBillDto.setEntrys(entrys); allocationBillDto.setEntrys(entrys);
MsgDto msgDto;
AllocationEasData easData = new AllocationEasData(); AllocationEasData easData = new AllocationEasData();
easData.setData(allocationBillDto); easData.setData(allocationBillDto);
String billJson = com.alibaba.fastjson.JSON.toJSONString(easData, SerializerFeature.WriteMapNullValue); String billJson = com.alibaba.fastjson.JSON.toJSONString(easData, SerializerFeature.WriteMapNullValue);
confirmDtl(billJson, params.get(0).getDjid());
}
@Async("taskExecutor")
public void confirmDtl(String billJson, String id) {
MsgDto msgDto;
try { try {
msgDto = wmsToEasService.sendWebService(billJson); msgDto = wmsToEasService.sendWebService(billJson);
if (msgDto != null) { if (msgDto != null) {
if (msgDto.getResult() == 0) { if (msgDto.getResult() == 0) {
throw new BadRequestException(msgDto.getMsg()); AllocationBill allocationBill = this.getById(id);
if (allocationBill == null) {
// 如果不存在该记录,则插入数据
AllocationBill bill = new AllocationBill();
bill.setDjid(id);
bill.setShjg(msgDto.getMsg());
this.save(bill);
} else {
// 如果存在该记录,则更新数据
allocationBill.setShjg(msgDto.getMsg());
allocationBill.setUpdate_id(SecurityUtils.getCurrentUsername());
allocationBill.setUpdate_name(SecurityUtils.getCurrentNickName());
allocationBill.setUpdate_time(DateUtil.format(DateUtil.beginOfDay(DateUtil.date()), "yyyy-MM-dd"));
this.updateById(allocationBill);
}
} }
} }
} catch (Exception e) { } catch (Exception e) {
log.error("推送Eas单据失败,单据号为:[" + params.get(0).getDjbh() + "]异常原因:" + e.toString()); log.error("审核失败,异常原因:" + e.toString());
throw new BadRequestException(e.toString());
} }
} }
@ -253,6 +303,9 @@ public class AllocationBillServiceImpl extends ServiceImpl<AllocationBillMapper,
} else { } else {
// 如果存在该记录,则更新数据 // 如果存在该记录,则更新数据
BeanUtils.copyProperties(entity, allocationBill); BeanUtils.copyProperties(entity, allocationBill);
allocationBill.setUpdate_id(SecurityUtils.getCurrentUsername());
allocationBill.setUpdate_name(SecurityUtils.getCurrentNickName());
allocationBill.setUpdate_time(DateUtil.format(DateUtil.beginOfDay(DateUtil.date()), "yyyy-MM-dd"));
this.updateById(allocationBill); this.updateById(allocationBill);
} }
} }

78
nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/EasOutInBillServiceImpl.java

@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.nl.common.base.CommonPage; import org.nl.common.base.CommonPage;
import org.nl.common.enums.wms.EasBillTypeEnum; import org.nl.common.enums.wms.EasBillTypeEnum;
import org.nl.common.exception.BadRequestException; import org.nl.common.exception.BadRequestException;
@ -28,6 +29,7 @@ import org.nl.wms.ext.eas.WmsToEasService;
import org.nl.wms.ext.srm.WmsToSrmService; import org.nl.wms.ext.srm.WmsToSrmService;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -144,7 +146,7 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
List<WarehouseInfo> second = warehouseInfoList.stream() List<WarehouseInfo> second = warehouseInfoList.stream()
.filter(r -> r.getCkmc().contains("三期")) .filter(r -> r.getCkmc().contains("三期"))
.collect(Collectors.toList()); .collect(Collectors.toList());
//三期原材料库放在最前面 //三期原材料库放在最前面
Optional<WarehouseInfo> first = second.stream() Optional<WarehouseInfo> first = second.stream()
.filter(r -> r.getCkbm().equals("3.03.013")) .filter(r -> r.getCkbm().equals("3.03.013"))
.findFirst(); .findFirst();
@ -159,6 +161,22 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
return sortedList; return sortedList;
} }
/**
* 获取仓库信息
*/
@Override
public List<WarehouseInfo> getUserInfo() {
return easOutInBillMapper.getWarehouseInfo();
}
/**
* 获取仓库信息
*/
@Override
public List<WarehouseInfo> getOrganizationInfo() {
return easOutInBillMapper.getWarehouseInfo();
}
@Override @Override
public JSONArray appUpdate() { public JSONArray appUpdate() {
@ -184,6 +202,7 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
.lambda() .lambda()
.eq(ObjectUtil.isNotEmpty(params.getDjlx()), EasOutInBill::getDjlx, params.getDjlx()) .eq(ObjectUtil.isNotEmpty(params.getDjlx()), EasOutInBill::getDjlx, params.getDjlx())
.eq(ObjectUtil.isNotEmpty(params.getCkbm()), EasOutInBill::getCkbm, params.getCkbm()) .eq(ObjectUtil.isNotEmpty(params.getCkbm()), EasOutInBill::getCkbm, params.getCkbm())
.eq(ObjectUtil.isNotEmpty(params.getCgybm()), EasOutInBill::getCgybm, params.getCgybm())
//.eq(ObjectUtil.isNotEmpty(params.getDjzt()), EasOutInBill::getDjzt, "1".equals(params.getDjzt()) ? "提交" : "审核") //.eq(ObjectUtil.isNotEmpty(params.getDjzt()), EasOutInBill::getDjzt, "1".equals(params.getDjzt()) ? "提交" : "审核")
.eq(ObjectUtil.isNotEmpty(params.getDjzt()), EasOutInBill::getDjzt, "提交") .eq(ObjectUtil.isNotEmpty(params.getDjzt()), EasOutInBill::getDjzt, "提交")
.nested(ObjectUtil.isNotEmpty(params.getFuzzy()), .nested(ObjectUtil.isNotEmpty(params.getFuzzy()),
@ -257,14 +276,7 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
@Override @Override
public void insertOrUpdateBills(List<EasOutInBillDetail> easOutInBillDetails, List<EasOutInBillDetail> existingIds) { public void updateOrDeleteBills(List<EasOutInBillDetail> easOutInBillDetails, List<EasOutInBillDetail> existingIds) {
CompletableFuture.runAsync(() -> {
try {
insertBills(easOutInBillDetails, existingIds);
} catch (Exception e) {
log.error("异常信息:" + e);
}
}, pool);
CompletableFuture.runAsync(() -> { CompletableFuture.runAsync(() -> {
try { try {
updateBills(easOutInBillDetails, existingIds); updateBills(easOutInBillDetails, existingIds);
@ -279,7 +291,8 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
} }
private void insertBills(List<EasOutInBillDetail> easOutInBillDetails, List<EasOutInBillDetail> existingIds) { @Override
public void insertInOutBills(List<EasOutInBillDetail> easOutInBillDetails, List<EasOutInBillDetail> existingIds) {
Set<String> ids = existingIds.stream().map(EasOutInBillDetail::getFlid).collect(Collectors.toSet()); Set<String> ids = existingIds.stream().map(EasOutInBillDetail::getFlid).collect(Collectors.toSet());
// 过滤出需要插入的新单据,并根据来源设置 ID // 过滤出需要插入的新单据,并根据来源设置 ID
List<EasOutInBillDetail> insertEasBills = easOutInBillDetails.stream() List<EasOutInBillDetail> insertEasBills = easOutInBillDetails.stream()
@ -339,6 +352,8 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
bill.setCksj(detail.getCksj()); bill.setCksj(detail.getCksj());
bill.setLlr(detail.getLlr()); bill.setLlr(detail.getLlr());
bill.setDjly(detail.getDjly()); bill.setDjly(detail.getDjly());
bill.setCgybm(detail.getCgybm());
bill.setCgymc(detail.getCgymc());
return bill; return bill;
}) })
.collect(Collectors.toList()); .collect(Collectors.toList());
@ -588,10 +603,31 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
} }
} }
@Async("taskExecutor")
public void confirmDtl(String billJson, String id) {
try {
SrmMsgDto srmMsgDto = wmsToSrmService.sendWebPostData(billJson, 2);
if (srmMsgDto != null) {
if ("false".equals(srmMsgDto.getSuccess())) {
ReceiptBill bill = new ReceiptBill();
bill.setDjid(id);
bill.setShjg(srmMsgDto.getMessage());
receiptBillMapper.updateById(bill);
}
}
} catch (Exception e) {
log.error("审核失败,异常原因:" + e.toString());
}
}
/** /**
* 单个单据审核 * 单个单据审核
*/ */
@Async("taskExecutor")
public void asyncAuditBill(EasOutInBillDto bill) { public void asyncAuditBill(EasOutInBillDto bill) {
String msg = "";
try { try {
if ("1".equals(bill.getDjly())) { if ("1".equals(bill.getDjly())) {
MsgDto msgDto; MsgDto msgDto;
@ -601,7 +637,7 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
msgDto = wmsToEasService.sendWebService(billJson); msgDto = wmsToEasService.sendWebService(billJson);
if (msgDto != null) { if (msgDto != null) {
if (msgDto.getResult() == 0) { if (msgDto.getResult() == 0) {
throw new BadRequestException(msgDto.getMsg()); msg = msgDto.getMsg();
} }
} }
} else { } else {
@ -610,14 +646,14 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
srmMsgDto = wmsToSrmService.sendWebPostData(billJson, 1); srmMsgDto = wmsToSrmService.sendWebPostData(billJson, 1);
if (srmMsgDto != null) { if (srmMsgDto != null) {
if ("false".equals(srmMsgDto.getSuccess())) { if ("false".equals(srmMsgDto.getSuccess())) {
throw new BadRequestException(srmMsgDto.getMessage()); msg = srmMsgDto.getMessage();
} }
} }
} }
updateBills(bill); updateBills(bill, "审核成功!");
} catch (Exception e) { } catch (Exception e) {
updateBills(bill, msg);
log.error("推送Eas单据失败,单据号为:[" + bill.getBillId() + "]异常原因:" + e.toString()); log.error("推送Eas单据失败,单据号为:[" + bill.getBillId() + "]异常原因:" + e.toString());
throw new BadRequestException(e.toString());
} }
} }
@ -632,7 +668,7 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
easData.setData(bill); easData.setData(bill);
String billJson = com.alibaba.fastjson.JSON.toJSONString(easData, SerializerFeature.WriteMapNullValue); String billJson = com.alibaba.fastjson.JSON.toJSONString(easData, SerializerFeature.WriteMapNullValue);
wmsToEasService.sendWebService(billJson); wmsToEasService.sendWebService(billJson);
updateBills(bill); updateBills(bill,"审核成功!");
} catch (Exception e) { } catch (Exception e) {
log.error("推送Eas单据失败,单据号为:[" + bill.getBillId() + "]异常原因:" + e.toString()); log.error("推送Eas单据失败,单据号为:[" + bill.getBillId() + "]异常原因:" + e.toString());
//throw new BadRequestException(e.toString()); //throw new BadRequestException(e.toString());
@ -649,7 +685,7 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
try { try {
String billJson = com.alibaba.fastjson.JSON.toJSONString(bill, SerializerFeature.WriteMapNullValue); String billJson = com.alibaba.fastjson.JSON.toJSONString(bill, SerializerFeature.WriteMapNullValue);
wmsToSrmService.sendWebPostData(billJson, 1); wmsToSrmService.sendWebPostData(billJson, 1);
updateBills(bill); updateBills(bill,"审核成功!");
} catch (Exception e) { } catch (Exception e) {
log.error("推送Eas单据失败,单据号为:[" + bill.getBillId() + "]异常原因:" + e.toString()); log.error("推送Eas单据失败,单据号为:[" + bill.getBillId() + "]异常原因:" + e.toString());
//throw new BadRequestException(e.toString()); //throw new BadRequestException(e.toString());
@ -658,8 +694,14 @@ public class EasOutInBillServiceImpl extends ServiceImpl<EasOutInBillMapper, Eas
} }
private void updateBills(EasOutInBillDto bill) { private void updateBills(EasOutInBillDto bill, String msg) {
easOutInBillMapper.update(null, new UpdateWrapper<EasOutInBill>().set("djzt", "审核").set("update_id", SecurityUtils.getCurrentUserId()).set("update_name", SecurityUtils.getCurrentNickName()).set("update_time", DateUtil.format(DateUtil.beginOfDay(DateUtil.date()), "yyyy-MM-dd")).eq("djid", bill.getBillId())); UpdateWrapper<EasOutInBill> updateWrapper = new UpdateWrapper<EasOutInBill>().set("update_id", SecurityUtils.getCurrentUserId()).set("update_name", SecurityUtils.getCurrentNickName()).set("update_time", DateUtil.format(DateUtil.beginOfDay(DateUtil.date()), "yyyy-MM-dd")).eq("djid", bill.getBillId());
if (StringUtils.isNotBlank(msg)) {
updateWrapper.set("djzt", "审核");
} else {
updateWrapper.set("shjg", msg);
}
easOutInBillMapper.update(null, updateWrapper);
} }

75
nlsso-server/src/main/java/org/nl/wms/database/eas/service/impl/ReceiptBillServiceImpl.java

@ -1,6 +1,7 @@
package org.nl.wms.database.eas.service.impl; package org.nl.wms.database.eas.service.impl;
import cn.dev33.satoken.annotation.SaIgnore; import cn.dev33.satoken.annotation.SaIgnore;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.serializer.SerializerFeature; import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -15,6 +16,7 @@ import org.nl.wms.database.eas.service.IreceiptBillService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.nl.wms.ext.srm.WmsToSrmService; import org.nl.wms.ext.srm.WmsToSrmService;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
@ -24,6 +26,8 @@ import javax.annotation.Resource;
import org.nl.common.base.CommonPage; import org.nl.common.base.CommonPage;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -44,7 +48,6 @@ public class ReceiptBillServiceImpl extends ServiceImpl<ReceiptBillMapper, Recei
private ReceiptBillMapper receiptBillMapper; private ReceiptBillMapper receiptBillMapper;
@Resource @Resource
private WmsToSrmService wmsToSrmService; private WmsToSrmService wmsToSrmService;
@ -55,9 +58,34 @@ public class ReceiptBillServiceImpl extends ServiceImpl<ReceiptBillMapper, Recei
*/ */
@Override @Override
@SaIgnore @SaIgnore
public CommonPage<AllocationBillQuery> receiptPage(ReceiptBillQuery params) { public CommonPage<ReceiptBillQuery> receiptPage(ReceiptBillQuery params) {
Page<AllocationBillQuery> pageObject = new Page<>(params.getPage(), params.getSize()); Page<ReceiptBillQuery> pageObject = new Page<>(params.getPage(), params.getSize());
Page<AllocationBillQuery> receiptBills = receiptBillMapper.receiptPage(pageObject, params.getFuzzy(),params.getCkbm()); Page<ReceiptBillQuery> receiptBills = receiptBillMapper.receiptPage(pageObject, params.getFuzzy(), params.getKczzbm());
List<ReceiptBillQuery> receiptBillList = receiptBills.getRecords();
// 获取更新列表
if (receiptBillList != null && !receiptBillList.isEmpty()) {
List<ReceiptBill> updateList = receiptBillMapper.selectList(
new LambdaQueryWrapper<ReceiptBill>()
.in(ReceiptBill::getDjid, receiptBillList.stream().map(ReceiptBillQuery::getDjid).collect(Collectors.toList())));
if (updateList != null && !updateList.isEmpty()) {
Map<String, ReceiptBill> updateMap = updateList.stream()
.collect(Collectors.toMap(ReceiptBill::getFlid, updateBill -> updateBill));
// 替换为修改记录
receiptBillList = receiptBillList.stream()
.map(a -> {
ReceiptBill updatedBill = updateMap.get(a.getDjid());
if (updatedBill != null) {
a.setShjg(updatedBill.getShjg());
a.setUpdate_id(updatedBill.getUpdate_id());
a.setUpdate_name(updatedBill.getUpdate_name());
a.setUpdate_time(updatedBill.getUpdate_time());
}
return a;
})
.collect(Collectors.toList());
}
}
receiptBills.setRecords(receiptBillList);
return CommonPage.getPage(receiptBills); return CommonPage.getPage(receiptBills);
} }
@ -81,7 +109,7 @@ public class ReceiptBillServiceImpl extends ServiceImpl<ReceiptBillMapper, Recei
if (!updateList.isEmpty()) { if (!updateList.isEmpty()) {
Map<String, ReceiptBill> updateMap = Map<String, ReceiptBill> updateMap =
updateList.stream() updateList.stream()
.collect(Collectors.toMap(ReceiptBill::getFlid, updateBill -> updateBill)); .collect(Collectors.toMap(ReceiptBill::getFlid, updateBill -> updateBill));
//替换修改记录 //替换修改记录
receiptBillList = receiptBillList.stream() receiptBillList = receiptBillList.stream()
.map(receiptBill -> { .map(receiptBill -> {
@ -93,6 +121,9 @@ public class ReceiptBillServiceImpl extends ServiceImpl<ReceiptBillMapper, Recei
receiptBill.setShsl(updatedBill.getShsl()); receiptBill.setShsl(updatedBill.getShsl());
receiptBill.setBz(updatedBill.getBz()); receiptBill.setBz(updatedBill.getBz());
receiptBill.setBtbz(updatedBill.getBtbz()); receiptBill.setBtbz(updatedBill.getBtbz());
receiptBill.setUpdate_id(updatedBill.getUpdate_id());
receiptBill.setUpdate_name(updatedBill.getUpdate_name());
receiptBill.setUpdate_time(updatedBill.getUpdate_time());
} }
return receiptBill; return receiptBill;
}) })
@ -133,7 +164,7 @@ public class ReceiptBillServiceImpl extends ServiceImpl<ReceiptBillMapper, Recei
List<ReceiptBillDetailDto> details = new ArrayList<>(); List<ReceiptBillDetailDto> details = new ArrayList<>();
params.forEach(r -> { params.forEach(r -> {
ReceiptBillDetailDto dto = new ReceiptBillDetailDto(); ReceiptBillDetailDto dto = new ReceiptBillDetailDto();
dto.setEntryId(r.getFlid()); dto.setEntryId(r.getFlid());
dto.setWarehouseNo(r.getCkbm()); dto.setWarehouseNo(r.getCkbm());
dto.setLocationNo(r.getKwmc()); dto.setLocationNo(r.getKwmc());
dto.setShsl(r.getShsl()); dto.setShsl(r.getShsl());
@ -142,22 +173,39 @@ public class ReceiptBillServiceImpl extends ServiceImpl<ReceiptBillMapper, Recei
} }
); );
receiptBillDto.setDetails(details); receiptBillDto.setDetails(details);
String billJson = com.alibaba.fastjson.JSON.toJSONString(receiptBillDto, SerializerFeature.WriteMapNullValue);
confirmDtl(billJson,params.get(0).getDjid());
}
@Async("taskExecutor")
public void confirmDtl(String billJson,String id) {
try { try {
SrmMsgDto srmMsgDto; SrmMsgDto srmMsgDto = wmsToSrmService.sendWebPostData(billJson, 2);
String billJson = com.alibaba.fastjson.JSON.toJSONString(receiptBillDto, SerializerFeature.WriteMapNullValue);
srmMsgDto = wmsToSrmService.sendWebPostData(billJson,2);
if (srmMsgDto != null) { if (srmMsgDto != null) {
if ("false".equals(srmMsgDto.getSuccess())) { if ("false".equals(srmMsgDto.getSuccess())) {
throw new BadRequestException(srmMsgDto.getMessage()); ReceiptBill receiptBill = this.getById(id);
if (receiptBill == null) {
// 如果不存在该记录,则插入数据
ReceiptBill bill = new ReceiptBill();
bill.setDjid(id);
bill.setShjg(srmMsgDto.getMessage());
this.save(bill);
} else {
// 如果存在该记录,则更新数据
receiptBill.setShjg(srmMsgDto.getMessage());
receiptBill.setUpdate_id(SecurityUtils.getCurrentUsername());
receiptBill.setUpdate_name(SecurityUtils.getCurrentNickName());
receiptBill.setUpdate_time(DateUtil.format(DateUtil.beginOfDay(DateUtil.date()), "yyyy-MM-dd"));
this.updateById(receiptBill);
}
} }
} }
} catch (Exception e) { } catch (Exception e) {
log.error("推送Eas单据失败,单据号为:[" + params.get(0).getDjbh() + "]异常原因:" + e.toString()); log.error("审核失败,异常原因:" + e.toString());
throw new BadRequestException(e.toString());
} }
} }
/** /**
* 创建 * 创建
* *
@ -183,6 +231,9 @@ public class ReceiptBillServiceImpl extends ServiceImpl<ReceiptBillMapper, Recei
} else { } else {
// 如果存在该记录,则更新数据 // 如果存在该记录,则更新数据
BeanUtils.copyProperties(entity, receiptBill); BeanUtils.copyProperties(entity, receiptBill);
receiptBill.setUpdate_id(SecurityUtils.getCurrentUsername());
receiptBill.setUpdate_name(SecurityUtils.getCurrentNickName());
receiptBill.setUpdate_time(DateUtil.format(DateUtil.beginOfDay(DateUtil.date()), "yyyy-MM-dd"));
this.updateById(receiptBill); this.updateById(receiptBill);
} }
} }

23
nlsso-server/src/main/java/org/nl/wms/schedule/EasBillSchedule.java

@ -46,7 +46,7 @@ public class EasBillSchedule {
* eas单据数据同步 * eas单据数据同步
*/ */
@Async("taskExecutor") @Async("taskExecutor")
@Scheduled(cron = "0/90 * * * * *") @Scheduled(cron = "0/60 * * * * *")
public void getEasOutInBills() { public void getEasOutInBills() {
// 获取eas视图查询未提交的单据 // 获取eas视图查询未提交的单据
List<EasOutInBillDetail> easOutInBillDetails = easOutInBillDetailMapper.selectPageWithInventory(); List<EasOutInBillDetail> easOutInBillDetails = easOutInBillDetailMapper.selectPageWithInventory();
@ -58,7 +58,26 @@ public class EasBillSchedule {
//查询已存在的单据 //查询已存在的单据
List<EasOutInBillDetail> existingIds = easOutInBillService.queryExistBills(); List<EasOutInBillDetail> existingIds = easOutInBillService.queryExistBills();
//查询已存在的未提交的单据 //查询已存在的未提交的单据
easOutInBillService.insertOrUpdateBills(easOutInBillDetails, existingIds); easOutInBillService.updateOrDeleteBills(easOutInBillDetails, existingIds);
}
}
}
@Async("taskExecutor")
@Scheduled(cron = "0/30 * * * * *")
public void insertOutInBills() {
// 获取eas视图查询未提交的单据
List<EasOutInBillDetail> easOutInBillDetails = easOutInBillDetailMapper.selectEasPages();
// 获取srm视图查询未提交的单据
List<EasOutInBillDetail> srmOutInBillDetails = easOutInBillDetailMapper.selectSrmPages();
if (CollectionUtils.isNotEmpty(easOutInBillDetails) || CollectionUtils.isNotEmpty(srmOutInBillDetails)) {
if (CollectionUtils.isNotEmpty(easOutInBillDetails)) {
easOutInBillDetails.addAll(srmOutInBillDetails);
//查询已存在的单据
List<EasOutInBillDetail> existingIds = easOutInBillService.queryExistBills();
//查询已存在的未提交的单据
easOutInBillService.insertInOutBills(easOutInBillDetails, existingIds);
} }
} }
} }

Loading…
Cancel
Save