Browse Source

天合库存事务需求新增

master
songguoqiang 6 months ago
parent
commit
9e1c62b432
  1. 10
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/mysql/itemaccounts/ItemAccountsMapper.java
  2. 3
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/enums/transaction/TransactionEnum.java
  3. 1
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/transaction/TransactionServiceImpl.java
  4. 10
      win-server/src/main/resources/application-prod.yaml

10
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/mysql/itemaccounts/ItemAccountsMapper.java

@ -79,6 +79,7 @@ public interface ItemAccountsMapper extends BaseMapperX<ItemAccountsDO> {
TransactionDO transactionDO = new TransactionDO(); TransactionDO transactionDO = new TransactionDO();
transactionDO.setQty(outQty); transactionDO.setQty(outQty);
transactionDO.setType(outLocation.getType()); transactionDO.setType(outLocation.getType());
transactionDO.setInventoryAction(TransactionEnum.OUTOUT.getCode());
list.add(transactionDO); list.add(transactionDO);
BigDecimal subtractOutQty = qtyNew.subtract(outQty);//差几个零件 BigDecimal subtractOutQty = qtyNew.subtract(outQty);//差几个零件
if (inQty.compareTo(BigDecimal.ZERO) > 0 && inQty.compareTo(subtractOutQty) >= 0) {//账内库存在且大于0足够差额 if (inQty.compareTo(BigDecimal.ZERO) > 0 && inQty.compareTo(subtractOutQty) >= 0) {//账内库存在且大于0足够差额
@ -89,6 +90,7 @@ public interface ItemAccountsMapper extends BaseMapperX<ItemAccountsDO> {
TransactionDO transactionDO1 = new TransactionDO(); TransactionDO transactionDO1 = new TransactionDO();
transactionDO1.setQty(subtractOutQty); transactionDO1.setQty(subtractOutQty);
transactionDO1.setType(inLocation.getType()); transactionDO1.setType(inLocation.getType());
transactionDO1.setInventoryAction(TransactionEnum.INOUT.getCode());
list.add(transactionDO1); list.add(transactionDO1);
} }
if (inQty.compareTo(BigDecimal.ZERO) > 0 && inQty.compareTo(subtractOutQty) < 0) {//账内库存在且不足差额需要清空账内 if (inQty.compareTo(BigDecimal.ZERO) > 0 && inQty.compareTo(subtractOutQty) < 0) {//账内库存在且不足差额需要清空账内
@ -98,6 +100,7 @@ public interface ItemAccountsMapper extends BaseMapperX<ItemAccountsDO> {
TransactionDO transactionDO0 = new TransactionDO(); TransactionDO transactionDO0 = new TransactionDO();
transactionDO0.setQty(inQty); transactionDO0.setQty(inQty);
transactionDO0.setType(inLocation.getType()); transactionDO0.setType(inLocation.getType());
transactionDO0.setInventoryAction(TransactionEnum.INOUT.getCode());
list.add(transactionDO0); list.add(transactionDO0);
BigDecimal subtractInQty = subtractOutQty.subtract(inQty);//减去之后的数量 BigDecimal subtractInQty = subtractOutQty.subtract(inQty);//减去之后的数量
if (newQty.compareTo(BigDecimal.ZERO) > 0 && newQty.compareTo(subtractInQty) >= 0) {//新到货存在且足够差额 if (newQty.compareTo(BigDecimal.ZERO) > 0 && newQty.compareTo(subtractInQty) >= 0) {//新到货存在且足够差额
@ -108,6 +111,7 @@ public interface ItemAccountsMapper extends BaseMapperX<ItemAccountsDO> {
TransactionDO transactionDO2 = new TransactionDO(); TransactionDO transactionDO2 = new TransactionDO();
transactionDO2.setQty(subtractInQty); transactionDO2.setQty(subtractInQty);
transactionDO2.setType(newLocation.getType()); transactionDO2.setType(newLocation.getType());
transactionDO2.setInventoryAction(TransactionEnum.NEWOUT.getCode());
list.add(transactionDO2); list.add(transactionDO2);
} else { } else {
throw exception(COUNT_IS_HAVA); throw exception(COUNT_IS_HAVA);
@ -122,6 +126,7 @@ public interface ItemAccountsMapper extends BaseMapperX<ItemAccountsDO> {
TransactionDO transactionDO3 = new TransactionDO(); TransactionDO transactionDO3 = new TransactionDO();
transactionDO3.setQty(subtractOutQty); transactionDO3.setQty(subtractOutQty);
transactionDO3.setType(newLocation.getType()); transactionDO3.setType(newLocation.getType());
transactionDO3.setInventoryAction(TransactionEnum.NEWOUT.getCode());
list.add(transactionDO3); list.add(transactionDO3);
} else { } else {
throw exception(COUNT_IS_HAVA); throw exception(COUNT_IS_HAVA);
@ -137,6 +142,7 @@ public interface ItemAccountsMapper extends BaseMapperX<ItemAccountsDO> {
TransactionDO transactionDO4 = new TransactionDO(); TransactionDO transactionDO4 = new TransactionDO();
transactionDO4.setQty(qtyNew); transactionDO4.setQty(qtyNew);
transactionDO4.setType(inLocation.getType()); transactionDO4.setType(inLocation.getType());
transactionDO4.setInventoryAction(TransactionEnum.INOUT.getCode());
list.add(transactionDO4); list.add(transactionDO4);
} }
if (inQty.compareTo(BigDecimal.ZERO) > 0 && inQty.compareTo(qtyNew) < 0) {//账内库存在且不足差额清空 if (inQty.compareTo(BigDecimal.ZERO) > 0 && inQty.compareTo(qtyNew) < 0) {//账内库存在且不足差额清空
@ -146,6 +152,7 @@ public interface ItemAccountsMapper extends BaseMapperX<ItemAccountsDO> {
TransactionDO transactionDO5 = new TransactionDO(); TransactionDO transactionDO5 = new TransactionDO();
transactionDO5.setQty(inQty); transactionDO5.setQty(inQty);
transactionDO5.setType(inLocation.getType()); transactionDO5.setType(inLocation.getType());
transactionDO5.setInventoryAction(TransactionEnum.INOUT.getCode());
list.add(transactionDO5); list.add(transactionDO5);
BigDecimal subtractInQty = qtyNew.subtract(inQty);//减去之后的数量 BigDecimal subtractInQty = qtyNew.subtract(inQty);//减去之后的数量
if (newQty.compareTo(BigDecimal.ZERO) > 0 && newQty.compareTo(subtractInQty) >= 0) {//新到货存在且足够差额 if (newQty.compareTo(BigDecimal.ZERO) > 0 && newQty.compareTo(subtractInQty) >= 0) {//新到货存在且足够差额
@ -156,6 +163,7 @@ public interface ItemAccountsMapper extends BaseMapperX<ItemAccountsDO> {
TransactionDO transactionDO6 = new TransactionDO(); TransactionDO transactionDO6 = new TransactionDO();
transactionDO6.setQty(subtractInQty); transactionDO6.setQty(subtractInQty);
transactionDO6.setType(newLocation.getType()); transactionDO6.setType(newLocation.getType());
transactionDO6.setInventoryAction(TransactionEnum.NEWOUT.getCode());
list.add(transactionDO6); list.add(transactionDO6);
} else { } else {
throw exception(COUNT_IS_HAVA); throw exception(COUNT_IS_HAVA);
@ -170,6 +178,7 @@ public interface ItemAccountsMapper extends BaseMapperX<ItemAccountsDO> {
TransactionDO transactionDO7 = new TransactionDO(); TransactionDO transactionDO7 = new TransactionDO();
transactionDO7.setQty(qtyNew); transactionDO7.setQty(qtyNew);
transactionDO7.setType(newLocation.getType()); transactionDO7.setType(newLocation.getType());
transactionDO7.setInventoryAction(TransactionEnum.NEWOUT.getCode());
list.add(transactionDO7); list.add(transactionDO7);
} else { } else {
throw exception(COUNT_IS_HAVA); throw exception(COUNT_IS_HAVA);
@ -184,6 +193,7 @@ public interface ItemAccountsMapper extends BaseMapperX<ItemAccountsDO> {
TransactionDO transactionDO8 = new TransactionDO(); TransactionDO transactionDO8 = new TransactionDO();
transactionDO8.setQty(qtyNew); transactionDO8.setQty(qtyNew);
transactionDO8.setType(outLocation.getType()); transactionDO8.setType(outLocation.getType());
transactionDO8.setInventoryAction(TransactionEnum.INOUT.getCode());
list.add(transactionDO8); list.add(transactionDO8);
} }
} else {//非领用出库 } else {//非领用出库

3
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/enums/transaction/TransactionEnum.java

@ -12,6 +12,9 @@ public enum TransactionEnum {
OUT_IN("OUTIN", "账外入库"), OUT_IN("OUTIN", "账外入库"),
NEW_TURN_IN("NEWTURNIN", "新到货转账内入库"), NEW_TURN_IN("NEWTURNIN", "新到货转账内入库"),
NEW_TURN_OUT("NEWTURNOUT", "新到货转账内出库"), NEW_TURN_OUT("NEWTURNOUT", "新到货转账内出库"),
OUTOUT("OUTOUT", "账外出库"),
INOUT("INOUT", "账内出库"),
NEWOUT("NEWOUT", "新到货出库"),
; ;
private String code; private String code;

1
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/transaction/TransactionServiceImpl.java

@ -75,6 +75,7 @@ public class TransactionServiceImpl implements TransactionService {
for(TransactionDO en:transactionDOS){//循环出库存记录 for(TransactionDO en:transactionDOS){//循环出库存记录
TransactionDO transactionDO = TransactionConvert.INSTANCE.convert(createReqVO); TransactionDO transactionDO = TransactionConvert.INSTANCE.convert(createReqVO);
transactionDO.setType(en.getType()); transactionDO.setType(en.getType());
transactionDO.setInventoryAction(en.getInventoryAction());
transactionDO.setQty(en.getQty()); transactionDO.setQty(en.getQty());
result += Mapper.insert(transactionDO); result += Mapper.insert(transactionDO);
} }

10
win-server/src/main/resources/application-prod.yaml

@ -22,21 +22,21 @@ spring:
master: master:
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://10.230.41.31:3306/tianhe?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 url: jdbc:mysql://localhost:3306/tianhe?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root username: root
password: Microsoft@2021 password: Microsoft@2021
# 读数据源 # 读数据源
slave0: slave0:
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://10.230.41.31:3306/tianhe?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 url: jdbc:mysql://localhost:3306/tianhe?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root username: root
password: Microsoft@2021 password: Microsoft@2021
# 读数据源 # 读数据源
slave1: slave1:
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://10.230.41.31:3306/tianhe?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 url: jdbc:mysql://localhost:3306/tianhe?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root username: root
password: Microsoft@2021 password: Microsoft@2021
# 读写分离类型,如: Static,Dynamic # 读写分离类型,如: Static,Dynamic
@ -91,10 +91,10 @@ spring:
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
redis: redis:
host: 10.62.141.81 # 地址 host: localhost # 地址
port: 6379 # 端口 port: 6379 # 端口
database: 0 # 数据库索引 database: 0 # 数据库索引
password: Microsoft@2021 # 密码,建议生产环境开启 #password: Microsoft@2021 # 密码,建议生产环境开启
--- #################### 定时任务相关配置 #################### --- #################### 定时任务相关配置 ####################

Loading…
Cancel
Save