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
4257d3a7
Commit
4257d3a7
authored
Dec 17, 2025
by
chicheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
批次相关调整
parent
82ea225e
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
153 additions
and
36 deletions
+153
-36
StockController.java
...opsunit/scanservice/ximai/controller/StockController.java
+6
-0
MoctgDao.java
...ain/java/com/topsunit/scanservice/ximai/dao/MoctgDao.java
+1
-0
PurcdDao.java
...ain/java/com/topsunit/scanservice/ximai/dao/PurcdDao.java
+1
-0
MoctaDto.java
...ain/java/com/topsunit/scanservice/ximai/dto/MoctaDto.java
+3
-0
PurccDto.java
...ain/java/com/topsunit/scanservice/ximai/dto/PurccDto.java
+1
-1
StockArrivalParams.java
...om/topsunit/scanservice/ximai/dto/StockArrivalParams.java
+6
-0
StockArrivalValidateDto.java
...psunit/scanservice/ximai/dto/StockArrivalValidateDto.java
+1
-1
StockArrivalValidateParams.java
...nit/scanservice/ximai/dto/StockArrivalValidateParams.java
+2
-0
Invmb.java
...ain/java/com/topsunit/scanservice/ximai/entity/Invmb.java
+2
-0
Purcc.java
...ain/java/com/topsunit/scanservice/ximai/entity/Purcc.java
+1
-1
Purcd.java
...ain/java/com/topsunit/scanservice/ximai/entity/Purcd.java
+12
-0
Purth.java
...ain/java/com/topsunit/scanservice/ximai/entity/Purth.java
+5
-0
InvmbService.java
.../com/topsunit/scanservice/ximai/service/InvmbService.java
+36
-0
MoctaService.java
.../com/topsunit/scanservice/ximai/service/MoctaService.java
+28
-1
PurccService.java
.../com/topsunit/scanservice/ximai/service/PurccService.java
+28
-16
PurtgService.java
.../com/topsunit/scanservice/ximai/service/PurtgService.java
+20
-16
No files found.
erp-system/src/main/java/com/topsunit/scanservice/ximai/controller/StockController.java
View file @
4257d3a7
package
com
.
topsunit
.
scanservice
.
ximai
.
controller
;
import
com.topsunit.scanservice.ximai.common.Constants
;
import
com.topsunit.scanservice.ximai.dao.WarehouseArriveDao
;
import
com.topsunit.scanservice.ximai.dto.*
;
import
com.topsunit.scanservice.ximai.entity.Invmb
;
...
...
@@ -78,6 +79,11 @@ public class StockController {
Invmb
invmb
=
purccService
.
validate
(
params
);
StockArrivalValidateDto
rst
=
new
StockArrivalValidateDto
();
rst
.
setInvmb
(
invmb
);
if
(
"Y"
.
equals
(
invmb
.
getMb022
())){
rst
.
setDefBatchNo
(
purccService
.
buildBatch
(
params
.
getMaterialNo
()));
}
else
{
rst
.
setDefBatchNo
(
Constants
.
BATCH_DEF
);
}
return
rst
;
}
...
...
erp-system/src/main/java/com/topsunit/scanservice/ximai/dao/MoctgDao.java
View file @
4257d3a7
...
...
@@ -16,4 +16,5 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
* @date 2024/10/23
*/
public
interface
MoctgDao
extends
JpaRepository
<
Moctg
,
MoctgId
>,
JpaSpecificationExecutor
<
Moctg
>
{
Moctg
findFirstByTg017StartingWithOrderByTg017Desc
(
String
prefix
);
}
erp-system/src/main/java/com/topsunit/scanservice/ximai/dao/PurcdDao.java
View file @
4257d3a7
...
...
@@ -17,4 +17,5 @@ import java.util.List;
*/
public
interface
PurcdDao
extends
JpaRepository
<
Purcd
,
PurcdId
>,
JpaSpecificationExecutor
<
Purcd
>
{
List
<
Purcd
>
findByCd001AndCd002
(
String
cd001
,
String
cd002
);
Purcd
findFirstByCd017StartingWithOrderByCd017Desc
(
String
prefix
);
}
erp-system/src/main/java/com/topsunit/scanservice/ximai/dto/MoctaDto.java
View file @
4257d3a7
...
...
@@ -208,6 +208,9 @@ public class MoctaDto {
@ApiModelProperty
(
"修改时间"
)
private
String
modiDate
;
@ApiModelProperty
(
"批次号"
)
private
String
batchNo
;
/**
* 工单材料明细
...
...
erp-system/src/main/java/com/topsunit/scanservice/ximai/dto/PurccDto.java
View file @
4257d3a7
...
...
@@ -25,7 +25,7 @@ public class PurccDto {
private
String
cc004
;
@ApiModelProperty
(
"供货商号"
)
private
String
cc005
;
@ApiModelProperty
(
""
)
@ApiModelProperty
(
"
发票号
"
)
private
String
cc006
;
@ApiModelProperty
(
"打印方式"
)
private
String
cc008
;
...
...
erp-system/src/main/java/com/topsunit/scanservice/ximai/dto/StockArrivalParams.java
View file @
4257d3a7
...
...
@@ -34,5 +34,11 @@ public class StockArrivalParams {
String
materialNo
;
@ApiModelProperty
(
"到货数量"
)
BigDecimal
arrivalQuantity
;
@ApiModelProperty
(
"生产日期"
)
String
productionDate
;
@ApiModelProperty
(
"有效日期"
)
String
effectiveDate
;
@ApiModelProperty
(
"批号"
)
String
batchNo
;
}
}
erp-system/src/main/java/com/topsunit/scanservice/ximai/dto/StockArrivalValidateDto.java
View file @
4257d3a7
...
...
@@ -11,6 +11,6 @@ public class StockArrivalValidateDto {
@ApiModelProperty
(
"物料信息"
)
Invmb
invmb
;
@ApiModelProperty
(
"默认批次"
)
String
defBatchNo
=
Constants
.
BATCH_DEF
;
String
defBatchNo
;
}
erp-system/src/main/java/com/topsunit/scanservice/ximai/dto/StockArrivalValidateParams.java
View file @
4257d3a7
...
...
@@ -19,4 +19,6 @@ public class StockArrivalValidateParams {
String
purchaseSerial
;
@ApiModelProperty
(
"品号"
)
String
materialNo
;
@ApiModelProperty
(
"供应商代码"
)
String
supplierNo
;
}
erp-system/src/main/java/com/topsunit/scanservice/ximai/entity/Invmb.java
View file @
4257d3a7
...
...
@@ -45,6 +45,8 @@ public class Invmb extends EntityBase {
@ApiModelProperty
(
"检验方式"
)
private
String
mb043
;
@ApiModelProperty
(
"采购单位"
)
private
String
mb148
;
@ApiModelProperty
(
"计价单位"
)
private
String
mb149
;
@ApiModelProperty
(
"客户品号"
)
...
...
erp-system/src/main/java/com/topsunit/scanservice/ximai/entity/Purcc.java
View file @
4257d3a7
...
...
@@ -34,7 +34,7 @@ public class Purcc extends EntityBase {
@ApiModelProperty
(
"供货商号"
)
private
String
cc005
;
@Column
@ApiModelProperty
(
""
)
@ApiModelProperty
(
"
发票号
"
)
private
String
cc006
;
@Column
@ApiModelProperty
(
"打印方式"
)
...
...
erp-system/src/main/java/com/topsunit/scanservice/ximai/entity/Purcd.java
View file @
4257d3a7
...
...
@@ -28,18 +28,23 @@ public class Purcd extends EntityBase {
@Id
private
String
cd003
;
@Column
@ApiModelProperty
(
"物料号"
)
private
String
cd004
;
@Column
@ApiModelProperty
(
"物料名"
)
private
String
cd005
;
@Column
@ApiModelProperty
(
"规格"
)
private
String
cd006
;
@Column
@ApiModelProperty
(
"单位"
)
private
String
cd007
;
@Column
private
BigDecimal
cd008
;
@Column
private
String
cd010
;
@Column
@ApiModelProperty
(
"采购单号"
)
private
String
cd011
;
@Column
private
String
cd012
;
...
...
@@ -65,6 +70,7 @@ public class Purcd extends EntityBase {
private
BigDecimal
cd028
;
@Column
private
BigDecimal
cd029
;
@ApiModelProperty
(
"采购单位"
)
private
String
cd021
=
""
;
private
String
cd022
=
""
;
@Column
...
...
@@ -76,4 +82,10 @@ public class Purcd extends EntityBase {
private
String
udf01
;
@Column
private
String
udf02
;
@Column
@ApiModelProperty
(
"生产日期"
)
private
String
udf05
;
@Column
@ApiModelProperty
(
"有效日期"
)
private
String
udf06
;
}
erp-system/src/main/java/com/topsunit/scanservice/ximai/entity/Purth.java
View file @
4257d3a7
...
...
@@ -30,6 +30,7 @@ public class Purth extends EntityBase {
private
String
th005
=
""
;
private
String
th006
=
""
;
private
BigDecimal
th007
=
BigDecimal
.
ZERO
;
@ApiModelProperty
(
"单位"
)
private
String
th008
=
""
;
private
String
th009
=
""
;
@ApiModelProperty
(
"批号"
)
...
...
@@ -57,8 +58,10 @@ public class Purth extends EntityBase {
private
String
th031
=
""
;
private
String
th032
=
""
;
private
String
th033
=
""
;
@ApiModelProperty
(
"库存数量"
)
private
BigDecimal
th034
=
BigDecimal
.
ZERO
;
private
String
th035
=
""
;
@ApiModelProperty
(
"有效日期"
)
private
String
th036
=
""
;
private
String
th037
=
""
;
private
String
th038
=
""
;
...
...
@@ -80,6 +83,7 @@ public class Purth extends EntityBase {
private
BigDecimal
th054
=
BigDecimal
.
ZERO
;
private
BigDecimal
th055
=
BigDecimal
.
ZERO
;
private
String
th056
=
""
;
@ApiModelProperty
(
"生产日期"
)
private
String
th057
=
""
;
private
BigDecimal
th058
=
BigDecimal
.
ZERO
;
private
BigDecimal
th059
=
BigDecimal
.
ZERO
;
...
...
@@ -88,6 +92,7 @@ public class Purth extends EntityBase {
private
BigDecimal
th062
=
BigDecimal
.
ZERO
;
private
String
th063
=
""
;
private
String
th064
=
""
;
@ApiModelProperty
(
"库存单位"
)
private
String
th065
=
""
;
private
String
th066
=
""
;
private
String
th067
=
""
;
...
...
erp-system/src/main/java/com/topsunit/scanservice/ximai/service/InvmbService.java
View file @
4257d3a7
...
...
@@ -9,6 +9,8 @@ import com.topsunit.scanservice.ximai.dto.mapper.InvmbMapper;
import
com.topsunit.scanservice.ximai.entity.*
;
import
jdk.nashorn.internal.parser.DateParser
;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.jpa.domain.Specification
;
...
...
@@ -21,6 +23,7 @@ import javax.persistence.criteria.CriteriaQuery;
import
javax.persistence.criteria.Predicate
;
import
javax.persistence.criteria.Root
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.text.DateFormat
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -38,6 +41,7 @@ import java.util.stream.Collectors;
*/
@Service
public
class
InvmbService
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
InvmbService
.
class
);
@Autowired
private
InvmaDao
invmaDao
;
...
...
@@ -46,6 +50,8 @@ public class InvmbService {
private
final
InvmbDao
invmbDao
;
private
final
InvmlDao
invmlDao
;
private
final
InvmbMapper
invmbMapper
;
@Autowired
private
com
.
topsunit
.
scanservice
.
ximai
.
dao
.
InvmdDao
invmdDao
;
public
InvmbService
(
InvmbDao
invmbDao
,
InvmlDao
invmlDao
,
InvmbMapper
invmbMapper
)
{
this
.
invmbDao
=
invmbDao
;
...
...
@@ -161,4 +167,34 @@ public class InvmbService {
invmbDao
.
save
(
s
);
});
}
/**
* 单位数量转换
* @param materialNo 物料号
* @param unit 单位
* @param unitAmount 单位数量
* @return 转换库存数量
*/
public
BigDecimal
unitConvert
(
String
materialNo
,
String
unit
,
BigDecimal
unitAmount
){
if
(
unitAmount
==
null
)
{
return
BigDecimal
.
ZERO
;
}
Optional
<
com
.
topsunit
.
scanservice
.
ximai
.
entity
.
Invmd
>
invmdOp
=
invmdDao
.
findById
(
new
com
.
topsunit
.
scanservice
.
ximai
.
entity
.
InvmdId
(
materialNo
,
unit
));
if
(!
invmdOp
.
isPresent
())
{
return
unitAmount
;
}
com
.
topsunit
.
scanservice
.
ximai
.
entity
.
Invmd
invmd
=
invmdOp
.
get
();
try
{
BigDecimal
numerator
=
new
BigDecimal
(
Optional
.
ofNullable
(
invmd
.
getMd003
()).
orElse
(
"1"
));
BigDecimal
denominator
=
new
BigDecimal
(
Optional
.
ofNullable
(
invmd
.
getMd004
()).
orElse
(
"1"
));
if
(
denominator
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
return
unitAmount
;
}
// 换算:库存数量 = 其他单位数量 × 分子 / 分母
return
unitAmount
.
multiply
(
numerator
).
divide
(
denominator
,
6
,
RoundingMode
.
HALF_UP
);
}
catch
(
Exception
ex
)
{
log
.
error
(
String
.
format
(
"库存单位转换失败,%s,%s,"
,
materialNo
,
unit
)
+
ex
.
getMessage
());
return
unitAmount
;
}
}
}
erp-system/src/main/java/com/topsunit/scanservice/ximai/service/MoctaService.java
View file @
4257d3a7
...
...
@@ -5,6 +5,7 @@ import com.topsunit.scanservice.ximai.common.FileView;
import
com.topsunit.scanservice.ximai.common.SmbFileSystem
;
import
com.topsunit.scanservice.ximai.dao.InvmbDao
;
import
com.topsunit.scanservice.ximai.dao.MoctaDao
;
import
com.topsunit.scanservice.ximai.dao.MoctgDao
;
import
com.topsunit.scanservice.ximai.dao.MoctbDao
;
import
com.topsunit.scanservice.ximai.dto.*
;
import
com.topsunit.scanservice.ximai.dto.mapper.MoctaMapper
;
...
...
@@ -45,6 +46,8 @@ public class MoctaService {
private
MoctbDao
moctbDao
;
@Autowired
private
AppConfig
appConfig
;
@Autowired
private
MoctgDao
moctgDao
;
private
final
MoctaDao
moctaDao
;
...
...
@@ -68,7 +71,12 @@ public class MoctaService {
public
Optional
<
MoctaDto
>
get
(
MoctaIdCriteria
criteria
)
{
return
moctaDao
.
findById
(
moctaMapper
.
toMoctaId
(
criteria
))
.
map
(
moctaMapper:
:
toMoctaDto
);
.
map
(
i
->{
MoctaDto
dto
=
moctaMapper
.
toMoctaDto
(
i
);
String
batchNo
=
this
.
buildFinishedProductBatch
(
dto
.
getTa006
());
dto
.
setBatchNo
(
batchNo
);
return
dto
;
});
}
public
MoctaDocDto
getForDoc2
(
MoctaIdCriteria
criteria
)
{
...
...
@@ -186,4 +194,23 @@ public class MoctaService {
});
}
public
String
buildFinishedProductBatch
(
String
materialNo
)
{
String
dateStr
=
cn
.
hutool
.
core
.
date
.
DateUtil
.
format
(
java
.
time
.
LocalDateTime
.
now
(),
"yyyyMMdd"
);
String
prefix
=
(
materialNo
==
null
?
""
:
materialNo
.
trim
())
+
dateStr
;
com
.
topsunit
.
scanservice
.
ximai
.
entity
.
Moctg
last
=
moctgDao
.
findFirstByTg017StartingWithOrderByTg017Desc
(
prefix
);
int
nextSeq
=
1
;
if
(
last
!=
null
&&
last
.
getTg017
()
!=
null
)
{
String
lastBatch
=
last
.
getTg017
().
trim
();
if
(
lastBatch
.
length
()
>=
3
)
{
String
tail
=
lastBatch
.
substring
(
lastBatch
.
length
()
-
3
);
try
{
nextSeq
=
Integer
.
parseInt
(
tail
)
+
1
;
}
catch
(
NumberFormatException
ignore
)
{
nextSeq
=
1
;
}
}
}
String
seqStr
=
String
.
format
(
"%03d"
,
nextSeq
);
return
prefix
+
seqStr
;
}
}
erp-system/src/main/java/com/topsunit/scanservice/ximai/service/PurccService.java
View file @
4257d3a7
...
...
@@ -19,6 +19,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.time.LocalDateTime
;
import
java.util.*
;
import
java.util.stream.Collectors
;
...
...
@@ -167,7 +168,7 @@ public class PurccService {
objectMap
.
add
(
PrintField
.
of
(
"P_No"
,
j
.
getCd004
().
trim
()));
objectMap
.
add
(
PrintField
.
of
(
"P_Name"
,
j
.
getCd005
().
trim
()));
objectMap
.
add
(
PrintField
.
of
(
"P_Spec"
,
j
.
getCd006
().
trim
()));
objectMap
.
add
(
PrintField
.
of
(
"DH_QTY"
,
j
.
getCd008
().
toString
().
trim
()));
objectMap
.
add
(
PrintField
.
of
(
"DH_QTY"
,
j
.
getCd008
().
setScale
(
2
,
RoundingMode
.
HALF_UP
).
toPlainString
()));
// 获取默认库位
Optional
<
Invmc
>
invmcOptional
=
getDefaultInvmc
(
j
.
getCd004
());
...
...
@@ -181,7 +182,7 @@ public class PurccService {
// String qrCode = String.format("%s-%s-%s-%s-%s", j.getCd004().trim(), "", j.getCd001().trim(), j.getCd002().trim(), j.getCd003().trim());
String
qrCode
=
j
.
getCd004
();
objectMap
.
add
(
PrintField
.
of
(
"QRCode"
,
qrCode
));
objectMap
.
add
(
PrintField
.
of
(
"EFFECTIVE_DATE"
,
j
.
getUdf06
().
trim
()));
objectMap
.
add
(
PrintField
.
of
(
"CD006"
,
j
.
getCd006
().
trim
()));
objectMap
.
add
(
PrintField
.
of
(
"UDF01"
,
j
.
getUdf01
().
trim
()));
objectMap
.
add
(
PrintField
.
of
(
"UDF02"
,
j
.
getUdf02
().
trim
()));
...
...
@@ -275,13 +276,10 @@ public class PurccService {
purcd
.
setCd013
(
detail
.
getArrivalQuantity
());
purcd
.
setCd015
(
purtd
.
getTd009
());
purcd
.
setCd016
(
purtd
.
getTd007
());
//按批管理
if
(
"Y"
.
equalsIgnoreCase
(
invmb
.
getMb022
())){
purcd
.
setCd017
(
buildBatch
(
detail
));
//生成到货批次号
}
else
{
purcd
.
setCd017
(
Constants
.
BATCH_DEF
);
//生成到货批次号
}
purcd
.
setCd021
(
invmb
.
getMb004
());
purcd
.
setCd017
(
detail
.
getBatchNo
());
purcd
.
setCd021
(
invmb
.
getMb148
());
purcd
.
setUdf05
(
detail
.
getProductionDate
());
purcd
.
setUdf06
(
detail
.
getEffectiveDate
());
purcdDao
.
save
(
purcd
);
sumQuantity
=
sumQuantity
.
add
(
detail
.
getArrivalQuantity
());
i
++;
...
...
@@ -306,6 +304,27 @@ public class PurccService {
}
//生成批次号:产品+日期yyyyMMdd+3位流水
public
String
buildBatch
(
String
materialNo
){
String
dateStr
=
cn
.
hutool
.
core
.
date
.
DateUtil
.
format
(
LocalDateTime
.
now
(),
"yyyyMMdd"
);
String
prefix
=
materialNo
+
dateStr
;
Purcd
last
=
purcdDao
.
findFirstByCd017StartingWithOrderByCd017Desc
(
prefix
);
int
nextSeq
=
1
;
if
(
last
!=
null
&&
last
.
getCd017
()
!=
null
)
{
String
lastBatch
=
last
.
getCd017
().
trim
();
if
(
lastBatch
.
length
()
>=
3
)
{
String
tail
=
lastBatch
.
substring
(
lastBatch
.
length
()
-
3
);
try
{
nextSeq
=
Integer
.
parseInt
(
tail
)
+
1
;
}
catch
(
NumberFormatException
e
)
{
nextSeq
=
1
;
}
}
}
String
seqStr
=
String
.
format
(
"%03d"
,
nextSeq
);
return
prefix
+
seqStr
;
}
private
String
getNewCc002
(
String
tg001
)
{
String
prefix
=
DateUtil
.
currentDateString
();
return
purccDao
.
findFirstByCc001AndCc002StartingWithOrderByCc002Desc
(
tg001
,
prefix
)
...
...
@@ -315,11 +334,4 @@ public class PurccService {
})
.
orElse
(
prefix
+
"001"
);
}
//生成批次号:产品+客户+日期yyyyMMdd
private
String
buildBatch
(
StockArrivalParams
.
StockArrivalDetail
detail
){
String
rst
=
detail
.
getMaterialNo
()+
detail
.
getSupplierNo
();
rst
+=
cn
.
hutool
.
core
.
date
.
DateUtil
.
format
(
LocalDateTime
.
now
(),
"yyyyMMdd"
);
return
rst
;
}
}
erp-system/src/main/java/com/topsunit/scanservice/ximai/service/PurtgService.java
View file @
4257d3a7
...
...
@@ -48,6 +48,8 @@ public class PurtgService {
private
final
PurtgMapper
purtgMapper
;
@Autowired
ApplicationContext
applicationContext
;
@Autowired
private
InvmbService
invmbService
;
public
PurtgService
(
CurrentActor
currentActor
,
CmsmgDao
cmsmgDao
,
InvmbDao
invmbDao
,
InvmcDao
invmcDao
,
InvmeDao
invmeDao
,
PurccDao
purccDao
,
PurcdDao
purcdDao
,
PurtcDao
purtcDao
,
PurtdDao
purtdDao
,
PurtgDao
purtgDao
,
PurthDao
purthDao
,
PurmaDao
purmaDao
,
CmsniDao
cmsniDao
,
PurtgMapper
purtgMapper
)
{
this
.
currentActor
=
currentActor
;
...
...
@@ -109,19 +111,17 @@ public class PurtgService {
Optional
<
Purma
>
purma
=
purmaDao
.
findById
(
purcc
.
getCc005
());
// 供应商
Optional
<
Cmsmg
>
cmsmg
=
purma
.
flatMap
(
i
->
cmsmgDao
.
findFirstByMg001OrderByMg002Desc
(
i
.
getMa021
()));
// 币种汇率档
purcds
.
stream
().
collect
(
Collectors
.
groupingBy
(
i
->
new
PurtcId
(
i
.
getCd010
(),
i
.
getCd011
()))).
forEach
((
purtcId
,
localPurcds
)
->
{
Optional
<
Purtc
>
purtc
=
purtcDao
.
findById
(
purtcId
);
//采购单单头
Purtg
purtg
=
initPurtg
(
purtgCreateParams
,
currentDate
,
purcc
,
purma
,
cmsmg
,
purtc
);
List
<
Purth
>
purths
=
new
ArrayList
<>();
OrdinalHelper
ordinalHelper
=
new
OrdinalHelper
();
for
(
int
index
=
0
;
index
<
localPurcds
.
size
();
index
++)
{
Purcd
localPurcd
=
localPurcds
.
get
(
index
);
// 进货单身
purths
.
addAll
(
initPurth
(
purtgCreateParams
,
purtg
,
ordinalHelper
,
localPurcd
,
purcc
));
}
countPurthForPurtg
(
purtg
,
purths
);
purtgDao
.
save
(
purtg
);
purths
.
forEach
(
i
->
purthDao
.
save
(
i
));
});
Optional
<
Purtc
>
purtc
=
purtcDao
.
findById
(
new
PurtcId
(
purcds
.
get
(
0
).
getCd010
(),
purcds
.
get
(
0
).
getCd011
()));
//采购单单头
Purtg
purtg
=
initPurtg
(
purtgCreateParams
,
currentDate
,
purcc
,
purma
,
cmsmg
,
purtc
);
List
<
Purth
>
purths
=
new
ArrayList
<>();
OrdinalHelper
ordinalHelper
=
new
OrdinalHelper
();
for
(
int
index
=
0
;
index
<
purcds
.
size
();
index
++)
{
Purcd
localPurcd
=
purcds
.
get
(
index
);
// 进货单身
purths
.
addAll
(
initPurth
(
purtgCreateParams
,
purtg
,
ordinalHelper
,
localPurcd
,
purcc
));
}
countPurthForPurtg
(
purtg
,
purths
);
purtgDao
.
save
(
purtg
);
purths
.
forEach
(
i
->
purthDao
.
save
(
i
));
}
private
Purtg
initPurtg
(
PurtgCreateParams
purtgCreateParams
,
String
currentDate
,
Purcc
purcc
,
Optional
<
Purma
>
purma
,
Optional
<
Cmsmg
>
cmsmg
,
Optional
<
Purtc
>
purtc
){
...
...
@@ -212,7 +212,7 @@ public class PurtgService {
purth
.
setTh005
(
localPurcd
.
getCd005
());
// 品名
purth
.
setTh006
(
localPurcd
.
getCd006
());
// 规格
purth
.
setTh007
(
localPurcd
.
getCd018
());
// 进货数量
purth
.
setTh008
(
localPurcd
.
getCd0
07
());
// 单位
purth
.
setTh008
(
localPurcd
.
getCd0
21
());
// 单位
purth
.
setTh009
(
purthCreateParams
.
getTh009
());
// 仓库
if
(
StringUtil
.
isNullOrEmpty
(
localPurcd
.
getCd017
())){
purth
.
setTh010
(
Constants
.
BATCH_DEF
);
// 批号
...
...
@@ -241,10 +241,9 @@ public class PurtgService {
purth
.
setTh030
(
"N"
);
// 审核码
purth
.
setTh031
(
"N"
);
// 开票码
purth
.
setTh032
(
"N"
);
// 更新码
// th033
purth
.
setTh034
(
purthCreateParams
.
getTh015
());
// 验收库存数量
// th035
// th036
purth
.
setTh036
(
localPurcd
.
getUdf06
());
// th037
// th038
// th039
...
...
@@ -275,6 +274,7 @@ public class PurtgService {
// th055
// th056
// th057
purth
.
setTh057
(
localPurcd
.
getUdf05
());
// th058
// th059
// th060
...
...
@@ -304,6 +304,10 @@ public class PurtgService {
purth
.
setThc04
(
localPurcd
.
getCd002
());
// 到货单号
purth
.
setThc05
(
localPurcd
.
getCd003
());
// 到货序号
purth
.
setThc06
(
"0001"
);
// 检验批次
if
(
purth
.
getTh008
().
equals
(
purth
.
getTh065
())){
BigDecimal
convertAmount
=
invmbService
.
unitConvert
(
localPurcd
.
getCd004
(),
purth
.
getTh008
(),
purthCreateParams
.
getTh015
());
purth
.
setTh034
(
convertAmount
);
// 验收库存数量,如果采购单位不一致需转换
}
BigDecimal
cd020
=
localPurcd
.
getCd020
().
add
(
purth
.
getTh015
());
if
(
cd020
.
compareTo
(
localPurcd
.
getCd018
())
>
0
)
{
...
...
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