Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
E
erp-service
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ximai
erp-service
Commits
bcd7f63a
Commit
bcd7f63a
authored
Jun 09, 2026
by
chicheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
工序报工接口添加
完工入库工作中心使用工单上的属性
parent
35cee4a6
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
520 additions
and
0 deletions
+520
-0
ErpFieldUtil.java
...a/com/topsunit/scanservice/ximai/common/ErpFieldUtil.java
+34
-0
SfctdController.java
...opsunit/scanservice/ximai/controller/SfctdController.java
+27
-0
SfctdDao.java
...ain/java/com/topsunit/scanservice/ximai/dao/SfctdDao.java
+12
-0
SfcteDao.java
...ain/java/com/topsunit/scanservice/ximai/dao/SfcteDao.java
+9
-0
SfctdProcessParams.java
...om/topsunit/scanservice/ximai/dto/SfctdProcessParams.java
+36
-0
Sfctd.java
...ain/java/com/topsunit/scanservice/ximai/entity/Sfctd.java
+60
-0
SfctdId.java
...n/java/com/topsunit/scanservice/ximai/entity/SfctdId.java
+54
-0
Sfcte.java
...ain/java/com/topsunit/scanservice/ximai/entity/Sfcte.java
+81
-0
SfcteId.java
...n/java/com/topsunit/scanservice/ximai/entity/SfcteId.java
+64
-0
MoctfService.java
.../com/topsunit/scanservice/ximai/service/MoctfService.java
+11
-0
SfctdService.java
.../com/topsunit/scanservice/ximai/service/SfctdService.java
+132
-0
No files found.
erp-system/src/main/java/com/topsunit/scanservice/ximai/common/ErpFieldUtil.java
0 → 100644
View file @
bcd7f63a
package
com
.
topsunit
.
scanservice
.
ximai
.
common
;
import
org.apache.commons.lang3.StringUtils
;
/**
* ERP 固定长度字段处理
*/
public
final
class
ErpFieldUtil
{
private
ErpFieldUtil
()
{
}
/**
* 定长字符字段:截断后左对齐补空格
*/
public
static
String
fixedChar
(
String
value
,
int
length
)
{
String
v
=
StringUtils
.
trimToEmpty
(
value
);
if
(
v
.
length
()
>
length
)
{
v
=
v
.
substring
(
0
,
length
);
}
return
String
.
format
(
"%-"
+
length
+
"s"
,
v
);
}
/**
* 变长字符字段:仅截断
*/
public
static
String
varChar
(
String
value
,
int
maxLength
)
{
String
v
=
StringUtils
.
trimToEmpty
(
value
);
if
(
v
.
length
()
>
maxLength
)
{
return
v
.
substring
(
0
,
maxLength
);
}
return
v
;
}
}
erp-system/src/main/java/com/topsunit/scanservice/ximai/controller/SfctdController.java
0 → 100644
View file @
bcd7f63a
package
com
.
topsunit
.
scanservice
.
ximai
.
controller
;
import
com.topsunit.scanservice.ximai.dto.SfctdProcessParams
;
import
com.topsunit.scanservice.ximai.service.SfctdService
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* 报工单 SFCTD/SFCTE
*/
@RestController
public
class
SfctdController
{
private
final
SfctdService
sfctdService
;
public
SfctdController
(
SfctdService
sfctdService
)
{
this
.
sfctdService
=
sfctdService
;
}
@ApiOperation
(
"工序报工"
)
@PostMapping
(
"/sfctd/processReport"
)
public
void
processReport
(
@RequestBody
SfctdProcessParams
params
)
{
sfctdService
.
processReport
(
params
);
}
}
erp-system/src/main/java/com/topsunit/scanservice/ximai/dao/SfctdDao.java
0 → 100644
View file @
bcd7f63a
package
com
.
topsunit
.
scanservice
.
ximai
.
dao
;
import
com.topsunit.scanservice.ximai.entity.Sfctd
;
import
com.topsunit.scanservice.ximai.entity.SfctdId
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
java.util.Optional
;
public
interface
SfctdDao
extends
JpaRepository
<
Sfctd
,
SfctdId
>,
JpaSpecificationExecutor
<
Sfctd
>
{
Optional
<
Sfctd
>
findFirstByTd001AndTd002StartingWithOrderByTd002Desc
(
String
td001
,
String
td002Prefix
);
}
erp-system/src/main/java/com/topsunit/scanservice/ximai/dao/SfcteDao.java
0 → 100644
View file @
bcd7f63a
package
com
.
topsunit
.
scanservice
.
ximai
.
dao
;
import
com.topsunit.scanservice.ximai.entity.Sfcte
;
import
com.topsunit.scanservice.ximai.entity.SfcteId
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
public
interface
SfcteDao
extends
JpaRepository
<
Sfcte
,
SfcteId
>,
JpaSpecificationExecutor
<
Sfcte
>
{
}
erp-system/src/main/java/com/topsunit/scanservice/ximai/dto/SfctdProcessParams.java
0 → 100644
View file @
bcd7f63a
package
com
.
topsunit
.
scanservice
.
ximai
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.math.BigDecimal
;
/**
* 工序报工单创建参数
*/
@Data
public
class
SfctdProcessParams
{
@ApiModelProperty
(
"报工单单别"
)
private
String
td001
=
"D30"
;
@ApiModelProperty
(
"工单单别"
)
private
String
te006
;
@ApiModelProperty
(
"工单单号"
)
private
String
te007
;
@ApiModelProperty
(
"工序(加工顺序)"
)
private
String
te008
;
@ApiModelProperty
(
"工序号"
)
private
String
te009
;
@ApiModelProperty
(
"类型(1:正常完成 2:返工完成 3:报废)"
)
private
String
te010
=
"1"
;
@ApiModelProperty
(
"报工数量"
)
private
BigDecimal
te011
;
@ApiModelProperty
(
"使用机时(秒)"
)
private
Integer
te013
;
@ApiModelProperty
(
"员工编号"
)
private
String
te004
;
@ApiModelProperty
(
"机器编号"
)
private
String
te005
;
@ApiModelProperty
(
"工序名称/备注"
)
private
String
te015
;
}
erp-system/src/main/java/com/topsunit/scanservice/ximai/entity/Sfctd.java
0 → 100644
View file @
bcd7f63a
package
com
.
topsunit
.
scanservice
.
ximai
.
entity
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.persistence.Entity
;
import
javax.persistence.Id
;
import
javax.persistence.IdClass
;
import
java.math.BigDecimal
;
/**
* 报工单单头档 SFCTD
*/
@Data
@Entity
@IdClass
(
SfctdId
.
class
)
public
class
Sfctd
extends
EntityBase
{
@Id
@ApiModelProperty
(
"报工单单别"
)
private
String
td001
;
@Id
@ApiModelProperty
(
"报工单单号"
)
private
String
td002
;
@ApiModelProperty
(
"生产日期"
)
private
String
td003
;
@ApiModelProperty
(
"工作中心"
)
private
String
td004
;
@ApiModelProperty
(
"审核码"
)
private
String
td005
;
@ApiModelProperty
(
"备注"
)
private
String
td006
;
@ApiModelProperty
(
"打印次数"
)
private
Integer
td007
;
@ApiModelProperty
(
"单据日期"
)
private
String
td008
;
@ApiModelProperty
(
"审核者"
)
private
String
td009
;
@ApiModelProperty
(
"签核状态码"
)
private
String
td010
;
@ApiModelProperty
(
"传送次数"
)
private
Integer
td011
;
private
String
td012
;
private
String
td013
;
private
String
td014
;
private
BigDecimal
td015
;
private
BigDecimal
td016
;
private
BigDecimal
td017
;
private
String
udf01
;
private
String
udf02
;
private
String
udf03
;
private
String
udf04
;
private
String
udf05
;
private
String
udf06
;
private
BigDecimal
udf51
;
private
BigDecimal
udf52
;
private
BigDecimal
udf53
;
private
BigDecimal
udf54
;
private
BigDecimal
udf55
;
private
BigDecimal
udf56
;
}
erp-system/src/main/java/com/topsunit/scanservice/ximai/entity/SfctdId.java
0 → 100644
View file @
bcd7f63a
package
com
.
topsunit
.
scanservice
.
ximai
.
entity
;
import
java.io.Serializable
;
import
java.util.Objects
;
/**
* 报工单单头档主键
*/
public
class
SfctdId
implements
Serializable
{
public
SfctdId
()
{
}
public
SfctdId
(
String
td001
,
String
td002
)
{
this
.
td001
=
String
.
format
(
"%1$-4s"
,
td001
);
this
.
td002
=
String
.
format
(
"%1$-11s"
,
td002
);
}
private
String
td001
;
private
String
td002
;
public
String
getTd001
()
{
return
td001
;
}
public
void
setTd001
(
String
td001
)
{
this
.
td001
=
td001
;
}
public
String
getTd002
()
{
return
td002
;
}
public
void
setTd002
(
String
td002
)
{
this
.
td002
=
td002
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
{
return
true
;
}
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
{
return
false
;
}
SfctdId
sfctdId
=
(
SfctdId
)
o
;
return
td001
.
equals
(
sfctdId
.
td001
)
&&
td002
.
equals
(
sfctdId
.
td002
);
}
@Override
public
int
hashCode
()
{
return
Objects
.
hash
(
td001
,
td002
);
}
}
erp-system/src/main/java/com/topsunit/scanservice/ximai/entity/Sfcte.java
0 → 100644
View file @
bcd7f63a
package
com
.
topsunit
.
scanservice
.
ximai
.
entity
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.persistence.Entity
;
import
javax.persistence.Id
;
import
javax.persistence.IdClass
;
import
java.math.BigDecimal
;
/**
* 报工单单身档 SFCTE
*/
@Data
@Entity
@IdClass
(
SfcteId
.
class
)
public
class
Sfcte
extends
EntityBase
{
@Id
@ApiModelProperty
(
"报工单单别"
)
private
String
te001
;
@Id
@ApiModelProperty
(
"报工单单号"
)
private
String
te002
;
@Id
@ApiModelProperty
(
"序号"
)
private
String
te003
;
@ApiModelProperty
(
"员工编号"
)
private
String
te004
;
@ApiModelProperty
(
"机器编号"
)
private
String
te005
;
@ApiModelProperty
(
"工单单别"
)
private
String
te006
;
@ApiModelProperty
(
"工单单号"
)
private
String
te007
;
@ApiModelProperty
(
"工序"
)
private
String
te008
;
@ApiModelProperty
(
"工艺"
)
private
String
te009
;
@ApiModelProperty
(
"类型"
)
private
String
te010
;
@ApiModelProperty
(
"数量"
)
private
BigDecimal
te011
;
@ApiModelProperty
(
"使用人时(秒)"
)
private
Integer
te012
;
@ApiModelProperty
(
"使用机时(秒)"
)
private
Integer
te013
;
@ApiModelProperty
(
"审核码"
)
private
String
te014
;
@ApiModelProperty
(
"备注"
)
private
String
te015
;
@ApiModelProperty
(
"包装数量"
)
private
BigDecimal
te016
;
@ApiModelProperty
(
"产品品号"
)
private
String
te017
;
@ApiModelProperty
(
"产品品名"
)
private
String
te018
;
@ApiModelProperty
(
"产品规格"
)
private
String
te019
;
@ApiModelProperty
(
"单位"
)
private
String
te020
;
@ApiModelProperty
(
"包装单位"
)
private
String
te021
;
private
String
te022
;
private
String
te023
;
private
String
te024
;
private
BigDecimal
te025
;
private
BigDecimal
te026
;
private
BigDecimal
te027
;
private
String
udf01
;
private
String
udf02
;
private
String
udf03
;
private
String
udf04
;
private
String
udf05
;
private
String
udf06
;
private
BigDecimal
udf51
;
private
BigDecimal
udf52
;
private
BigDecimal
udf53
;
private
BigDecimal
udf54
;
private
BigDecimal
udf55
;
private
BigDecimal
udf56
;
}
erp-system/src/main/java/com/topsunit/scanservice/ximai/entity/SfcteId.java
0 → 100644
View file @
bcd7f63a
package
com
.
topsunit
.
scanservice
.
ximai
.
entity
;
import
java.io.Serializable
;
import
java.util.Objects
;
/**
* 报工单单身档主键
*/
public
class
SfcteId
implements
Serializable
{
public
SfcteId
()
{
}
public
SfcteId
(
String
te001
,
String
te002
,
String
te003
)
{
this
.
te001
=
String
.
format
(
"%1$-4s"
,
te001
);
this
.
te002
=
String
.
format
(
"%1$-11s"
,
te002
);
this
.
te003
=
String
.
format
(
"%1$-4s"
,
te003
);
}
private
String
te001
;
private
String
te002
;
private
String
te003
;
public
String
getTe001
()
{
return
te001
;
}
public
void
setTe001
(
String
te001
)
{
this
.
te001
=
te001
;
}
public
String
getTe002
()
{
return
te002
;
}
public
void
setTe002
(
String
te002
)
{
this
.
te002
=
te002
;
}
public
String
getTe003
()
{
return
te003
;
}
public
void
setTe003
(
String
te003
)
{
this
.
te003
=
te003
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
{
return
true
;
}
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
{
return
false
;
}
SfcteId
sfcteId
=
(
SfcteId
)
o
;
return
te001
.
equals
(
sfcteId
.
te001
)
&&
te002
.
equals
(
sfcteId
.
te002
)
&&
te003
.
equals
(
sfcteId
.
te003
);
}
@Override
public
int
hashCode
()
{
return
Objects
.
hash
(
te001
,
te002
,
te003
);
}
}
erp-system/src/main/java/com/topsunit/scanservice/ximai/service/MoctfService.java
View file @
bcd7f63a
...
@@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.math.BigDecimal
;
import
java.util.Calendar
;
import
java.util.Calendar
;
import
java.util.concurrent.atomic.AtomicReference
;
import
java.util.concurrent.atomic.AtomicReference
;
...
@@ -51,6 +52,7 @@ public class MoctfService {
...
@@ -51,6 +52,7 @@ public class MoctfService {
moctf
.
setTf003
(
currStr
);
moctf
.
setTf003
(
currStr
);
moctf
.
setTf012
(
currStr
);
moctf
.
setTf012
(
currStr
);
AtomicReference
<
String
>
ta083
=
new
AtomicReference
<
String
>();
AtomicReference
<
String
>
ta083
=
new
AtomicReference
<
String
>();
AtomicReference
<
String
>
ta021
=
new
AtomicReference
<
String
>();
create
.
getDetails
().
forEach
(
s
->{
create
.
getDetails
().
forEach
(
s
->{
Moctg
moctg
=
BeanUtil
.
toBeanIgnoreError
(
s
,
Moctg
.
class
);
Moctg
moctg
=
BeanUtil
.
toBeanIgnoreError
(
s
,
Moctg
.
class
);
//查询工单
//查询工单
...
@@ -67,14 +69,19 @@ public class MoctfService {
...
@@ -67,14 +69,19 @@ public class MoctfService {
moctg
.
setTg037
(
invmb
.
getMb004
());
moctg
.
setTg037
(
invmb
.
getMb004
());
moctg
.
setTg010
(
invmb
.
getMb017
());
moctg
.
setTg010
(
invmb
.
getMb017
());
ta083
.
set
(
mocta
.
getTa083
());
ta083
.
set
(
mocta
.
getTa083
());
ta021
.
set
(
mocta
.
getTa021
());
//查询物料默认仓库
//查询物料默认仓库
Invmc
invmc
=
invmcDao
.
findById
(
new
InvmcId
(
invmb
.
getMb001
(),
invmb
.
getMb017
())).
orElseThrow
(()->
new
TopsunitException
(
MessageUtils
.
getMessage
(
"未找到对应物料默认库:{0},{1}"
,
invmb
.
getMb001
(),
invmb
.
getMb017
())));
Invmc
invmc
=
invmcDao
.
findById
(
new
InvmcId
(
invmb
.
getMb001
(),
invmb
.
getMb017
())).
orElseThrow
(()->
new
TopsunitException
(
MessageUtils
.
getMessage
(
"未找到对应物料默认库:{0},{1}"
,
invmb
.
getMb001
(),
invmb
.
getMb017
())));
moctg
.
setTg036
(
invmc
.
getMc015
());
moctg
.
setTg036
(
invmc
.
getMc015
());
moctg
.
setTg030
(
currStr
);
moctg
.
setTg030
(
currStr
);
moctg
.
setTg038
(
moctg
.
getTg011
());
moctg
.
setTg038
(
moctg
.
getTg011
());
moctg
.
setTg012
(
BigDecimal
.
ZERO
);
moctg
.
setTg023
(
BigDecimal
.
ZERO
);
moctg
.
setTg032
(
BigDecimal
.
ZERO
);
moctgDao
.
save
(
moctg
);
moctgDao
.
save
(
moctg
);
});
});
moctf
.
setTf033
(
ta083
.
get
());
moctf
.
setTf033
(
ta083
.
get
());
moctf
.
setTf011
(
ta021
.
get
());
moctf
.
setTf023
(
create
.
getDetails
().
get
(
0
).
getTg011
());
moctf
.
setTf023
(
create
.
getDetails
().
get
(
0
).
getTg011
());
moctf
.
setTf024
(
create
.
getDetails
().
get
(
0
).
getTg011
());
moctf
.
setTf024
(
create
.
getDetails
().
get
(
0
).
getTg011
());
moctfDao
.
save
(
moctf
);
moctfDao
.
save
(
moctf
);
...
@@ -140,9 +147,13 @@ public class MoctfService {
...
@@ -140,9 +147,13 @@ public class MoctfService {
moctg
.
setTg036
(
create
.
getTg036
());
moctg
.
setTg036
(
create
.
getTg036
());
moctg
.
setTg030
(
currStr
);
moctg
.
setTg030
(
currStr
);
moctg
.
setTg038
(
moctg
.
getTg011
());
moctg
.
setTg038
(
moctg
.
getTg011
());
moctg
.
setTg012
(
BigDecimal
.
ZERO
);
moctg
.
setTg023
(
BigDecimal
.
ZERO
);
moctg
.
setTg032
(
BigDecimal
.
ZERO
);
moctgDao
.
save
(
moctg
);
moctgDao
.
save
(
moctg
);
moctf
.
setTf033
(
ta083
.
get
());
moctf
.
setTf033
(
ta083
.
get
());
moctf
.
setTf011
(
mocta
.
getTa021
());
moctf
.
setTf023
(
create
.
getTg011
());
moctf
.
setTf023
(
create
.
getTg011
());
moctf
.
setTf024
(
create
.
getTg011
());
moctf
.
setTf024
(
create
.
getTg011
());
moctfDao
.
save
(
moctf
);
moctfDao
.
save
(
moctf
);
...
...
erp-system/src/main/java/com/topsunit/scanservice/ximai/service/SfctdService.java
0 → 100644
View file @
bcd7f63a
package
com
.
topsunit
.
scanservice
.
ximai
.
service
;
import
com.topsunit.scanservice.ximai.common.DateUtil
;
import
com.topsunit.scanservice.ximai.common.ErpFieldUtil
;
import
com.topsunit.scanservice.ximai.common.TopsunitException
;
import
com.topsunit.scanservice.ximai.dao.InvmbDao
;
import
com.topsunit.scanservice.ximai.dao.MoctaDao
;
import
com.topsunit.scanservice.ximai.dao.SfctdDao
;
import
com.topsunit.scanservice.ximai.dao.SfcteDao
;
import
com.topsunit.scanservice.ximai.dto.SfctdProcessParams
;
import
com.topsunit.scanservice.ximai.entity.*
;
import
com.topsunit.scanservice.ximai.security.CurrentActor
;
import
com.topsunit.scanservice.ximai.utils.MessageUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.math.BigDecimal
;
/**
* 报工单 SFCTD/SFCTE
*/
@Service
public
class
SfctdService
{
private
final
MoctaDao
moctaDao
;
private
final
InvmbDao
invmbDao
;
private
final
SfctdDao
sfctdDao
;
private
final
SfcteDao
sfcteDao
;
private
final
CurrentActor
currentActor
;
public
SfctdService
(
MoctaDao
moctaDao
,
InvmbDao
invmbDao
,
SfctdDao
sfctdDao
,
SfcteDao
sfcteDao
,
CurrentActor
currentActor
)
{
this
.
moctaDao
=
moctaDao
;
this
.
invmbDao
=
invmbDao
;
this
.
sfctdDao
=
sfctdDao
;
this
.
sfcteDao
=
sfcteDao
;
this
.
currentActor
=
currentActor
;
}
/**
* 工序报工:写入 SFCTD 单头 + SFCTE 单身
*/
@Transactional
public
void
processReport
(
SfctdProcessParams
params
)
{
if
(
params
.
getTe011
()
==
null
||
params
.
getTe011
().
compareTo
(
BigDecimal
.
ZERO
)
<=
0
)
{
throw
new
TopsunitException
(
MessageUtils
.
getMessage
(
"pro.schedule.limit.min.quantity"
));
}
Mocta
mocta
=
moctaDao
.
findById
(
new
MoctaId
(
params
.
getTe006
(),
params
.
getTe007
()))
.
orElseThrow
(()
->
new
TopsunitException
(
MessageUtils
.
getMessage
(
"未找到工单"
)));
Invmb
invmb
=
invmbDao
.
findById
(
mocta
.
getTa006
())
.
orElseThrow
(()
->
new
TopsunitException
(
MessageUtils
.
getMessage
(
"未找到品号"
)));
String
currentDate
=
DateUtil
.
currentDateString
();
String
td001
=
StringUtils
.
defaultIfBlank
(
params
.
getTd001
(),
"D30"
);
String
td002
=
getNewTd002
(
td001
);
Sfctd
sfctd
=
new
Sfctd
();
sfctd
.
setTd001
(
ErpFieldUtil
.
fixedChar
(
td001
,
4
));
sfctd
.
setTd002
(
ErpFieldUtil
.
fixedChar
(
td002
,
11
));
sfctd
.
setTd003
(
currentDate
);
sfctd
.
setTd004
(
ErpFieldUtil
.
fixedChar
(
mocta
.
getTa021
(),
10
));
sfctd
.
setTd005
(
"N"
);
sfctd
.
setTd006
(
ErpFieldUtil
.
varChar
(
params
.
getTe015
(),
255
));
sfctd
.
setTd007
(
0
);
sfctd
.
setTd008
(
currentDate
);
sfctd
.
setTd009
(
""
);
sfctd
.
setTd010
(
"N"
);
sfctd
.
setTd011
(
0
);
sfctdDao
.
save
(
sfctd
);
String
processSeq
=
ErpFieldUtil
.
fixedChar
(
params
.
getTe008
(),
4
);
String
processNo
=
resolveProcessNo
(
params
,
processSeq
);
String
processName
=
resolveProcessName
(
params
);
Sfcte
sfcte
=
new
Sfcte
();
sfcte
.
setTe001
(
ErpFieldUtil
.
fixedChar
(
td001
,
4
));
sfcte
.
setTe002
(
ErpFieldUtil
.
fixedChar
(
td002
,
11
));
sfcte
.
setTe003
(
"0001"
);
sfcte
.
setTe004
(
ErpFieldUtil
.
fixedChar
(
StringUtils
.
defaultIfBlank
(
params
.
getTe004
(),
currentActor
.
getActorStr
()),
10
));
sfcte
.
setTe005
(
ErpFieldUtil
.
fixedChar
(
params
.
getTe005
(),
15
));
sfcte
.
setTe006
(
ErpFieldUtil
.
fixedChar
(
mocta
.
getTa001
(),
4
));
sfcte
.
setTe007
(
ErpFieldUtil
.
fixedChar
(
mocta
.
getTa002
(),
11
));
sfcte
.
setTe008
(
processSeq
);
sfcte
.
setTe009
(
ErpFieldUtil
.
fixedChar
(
processNo
,
4
));
sfcte
.
setTe010
(
"1"
);
sfcte
.
setTe011
(
params
.
getTe011
());
sfcte
.
setTe012
(
0
);
sfcte
.
setTe013
(
params
.
getTe013
()
==
null
?
0
:
params
.
getTe013
());
sfcte
.
setTe014
(
"N"
);
sfcte
.
setTe015
(
ErpFieldUtil
.
varChar
(
processName
,
255
));
sfcte
.
setTe016
(
BigDecimal
.
ZERO
);
sfcte
.
setTe017
(
ErpFieldUtil
.
fixedChar
(
mocta
.
getTa006
(),
20
));
sfcte
.
setTe018
(
ErpFieldUtil
.
varChar
(
mocta
.
getTa034
(),
60
));
sfcte
.
setTe019
(
ErpFieldUtil
.
varChar
(
mocta
.
getTa035
(),
60
));
sfcte
.
setTe020
(
ErpFieldUtil
.
fixedChar
(
invmb
.
getMb004
(),
4
));
sfcte
.
setTe021
(
ErpFieldUtil
.
fixedChar
(
invmb
.
getMb004
(),
4
));
sfcteDao
.
save
(
sfcte
);
}
/**
* TE009 记录工序号(C4):优先 MES 传入,否则取加工顺序 TE008
*/
private
String
resolveProcessNo
(
SfctdProcessParams
params
,
String
processSeq
)
{
String
processNo
=
StringUtils
.
trimToEmpty
(
params
.
getTe009
());
if
(
StringUtils
.
isNotBlank
(
processNo
))
{
return
processNo
.
length
()
<=
4
?
processNo
:
processNo
.
substring
(
0
,
4
);
}
return
StringUtils
.
trimToEmpty
(
processSeq
);
}
/**
* 工序名称写入 TE015;兼容旧版将名称误传 TE009 的情况
*/
private
String
resolveProcessName
(
SfctdProcessParams
params
)
{
String
processName
=
StringUtils
.
trimToEmpty
(
params
.
getTe015
());
String
incomingTe009
=
StringUtils
.
trimToEmpty
(
params
.
getTe009
());
if
(
StringUtils
.
isBlank
(
processName
)
&&
incomingTe009
.
length
()
>
4
)
{
return
incomingTe009
;
}
return
processName
;
}
private
String
getNewTd002
(
String
td001
)
{
String
prefix
=
DateUtil
.
currentDateString
();
return
sfctdDao
.
findFirstByTd001AndTd002StartingWithOrderByTd002Desc
(
td001
,
prefix
)
.
map
(
i
->
{
int
currentOrdinal
=
Integer
.
parseInt
(
i
.
getTd002
().
replace
(
prefix
,
""
));
return
prefix
+
String
.
format
(
"%03d"
,
currentOrdinal
+
1
);
})
.
orElse
(
prefix
+
"001"
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment