Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mes
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
mes
Commits
661f0a09
Commit
661f0a09
authored
Oct 28, 2024
by
温志超
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
aab82a3d
c4798beb
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
167 additions
and
115 deletions
+167
-115
MdItem.java
mes/src/main/java/com/ximai/mes/md/domain/MdItem.java
+0
-3
IItemTypeService.java
.../main/java/com/ximai/mes/md/service/IItemTypeService.java
+2
-1
IMdWorkunitService.java
...ain/java/com/ximai/mes/md/service/IMdWorkunitService.java
+1
-1
ItemTypeServiceImpl.java
...va/com/ximai/mes/md/service/impl/ItemTypeServiceImpl.java
+27
-79
MdItemServiceImpl.java
...java/com/ximai/mes/md/service/impl/MdItemServiceImpl.java
+7
-4
ProTaskServiceImpl.java
...m/ximai/mes/pro/service/impl/task/ProTaskServiceImpl.java
+1
-0
ErpService.java
mes/src/main/java/com/ximai/mes/remote/ErpService.java
+4
-0
MdItemErpDto.java
mes/src/main/java/com/ximai/mes/remote/dto/MdItemErpDto.java
+1
-1
MdItemTypeErpDto.java
.../main/java/com/ximai/mes/remote/dto/MdItemTypeErpDto.java
+34
-0
MdItemTypeErpQuery.java
...ain/java/com/ximai/mes/remote/dto/MdItemTypeErpQuery.java
+30
-0
PurchasingRequisitionCreate.java
...com/ximai/mes/remote/dto/PurchasingRequisitionCreate.java
+0
-4
PurchasingRequisitionCreateProcess.java
...es/remote/process/PurchasingRequisitionCreateProcess.java
+0
-1
ErpDataSyncScheduled.java
...in/java/com/ximai/mes/scheduled/ErpDataSyncScheduled.java
+60
-0
VendorSyncScheduled.java
...ain/java/com/ximai/mes/scheduled/VendorSyncScheduled.java
+0
-17
MdItemMapper.xml
mes/src/main/resources/mapper/md/MdItemMapper.xml
+0
-4
No files found.
mes/src/main/java/com/ximai/mes/md/domain/MdItem.java
View file @
661f0a09
...
...
@@ -81,9 +81,6 @@ public class MdItem extends BaseEntity {
@ApiModelProperty
(
"客户品号"
)
private
String
customerProNo
;
@ApiModelProperty
(
"主要仓库"
)
private
String
mainWarehouseCode
;
@ApiModelProperty
(
"主要仓库"
)
private
String
mainWarehouseId
;
...
...
mes/src/main/java/com/ximai/mes/md/service/IItemTypeService.java
View file @
661f0a09
...
...
@@ -30,5 +30,6 @@ public interface IItemTypeService {
boolean
checkHasItem
(
Long
itemTypeId
);
void
synchroItemType
(
List
<
MdItemTypeVo
>
mdItemTypeVos
);
void
synchroItemType
();
}
mes/src/main/java/com/ximai/mes/md/service/IMdWorkunitService.java
View file @
661f0a09
...
...
@@ -16,7 +16,7 @@ import java.util.List;
public
interface
IMdWorkunitService
{
public
static
Long
OUTSOURCE_WORKUNIT_ID
=
1
l
;
public
static
String
OUTSOURCE_WORKUNIT_CODE
=
"XM
S
WWDY"
;
public
static
String
OUTSOURCE_WORKUNIT_CODE
=
"XMWWDY"
;
/**
* 查询工作单元
*
...
...
mes/src/main/java/com/ximai/mes/md/service/impl/ItemTypeServiceImpl.java
View file @
661f0a09
package
com
.
ximai
.
mes
.
md
.
service
.
impl
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.collection.CollUtil
;
import
com.ximai.common.constant.UserConstants
;
import
com.ximai.common.core.domain.TreeSelect
;
import
com.ximai.common.core.domain.entity.MdItemType
;
import
com.ximai.common.utils.data.DateUtils
;
import
com.ximai.common.utils.data.StringUtils
;
import
com.ximai.mes.md.domain.MdVendor
;
import
com.ximai.mes.md.mapper.ItemTypeMapper
;
import
com.ximai.mes.md.service.IItemTypeService
;
import
com.ximai.mes.md.vo.MdItemTypeVo
;
import
com.ximai.mes.remote.ErpService
;
import
com.ximai.mes.remote.dto.MdItemTypeErpDto
;
import
com.ximai.mes.remote.dto.MdItemTypeErpQuery
;
import
com.ximai.mes.remote.dto.MdVendorErpDto
;
import
com.ximai.mes.remote.dto.MdVendorErpQuery
;
import
com.ximai.system.strategy.AutoCodeUtil
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -26,6 +33,8 @@ public class ItemTypeServiceImpl implements IItemTypeService {
@Autowired
private
AutoCodeUtil
autoCodeUtil
;
@Autowired
private
ErpService
erpService
;
@Override
public
List
<
MdItemType
>
selectItemTypeList
(
MdItemType
mdItemType
)
{
...
...
@@ -157,85 +166,24 @@ public class ItemTypeServiceImpl implements IItemTypeService {
@Override
public
void
synchroItemType
(
List
<
MdItemTypeVo
>
mdItemTypeVos
)
{
for
(
MdItemTypeVo
c
:
mdItemTypeVos
)
{
MdItemType
mdItemType
=
new
MdItemType
();
BeanUtils
.
copyProperties
(
c
,
mdItemType
);
String
itemTypeCode
=
mdItemType
.
getSapTypeCode
();
//一级添加
if
(
itemTypeCode
.
length
()
==
3
)
{
MdItemType
mdItem
=
new
MdItemType
();
mdItem
.
setItemTypeName
(
mdItemType
.
getItemTypeName
());
List
<
MdItemType
>
mdItemTypes
=
itemTypeMapper
.
selectItemTypeList
(
mdItem
);
if
(
CollUtil
.
isEmpty
(
mdItemTypes
))
{
MdItemType
parent
=
itemTypeMapper
.
selectItemTypeById
(
200
l
);
mdItemType
.
setParentTypeId
(
parent
.
getItemTypeId
());
mdItemType
.
setAncestors
(
parent
.
getAncestors
()
+
","
+
parent
.
getItemTypeId
());
mdItemType
.
setItemTypeCode
(
mdItemType
.
getSapTypeCode
());
mdItemType
.
setEnableFlag
(
"Y"
);
mdItemType
.
setOrderNum
(
1
);
mdItemType
.
setCreateTime
(
DateUtils
.
getNowDate
());
itemTypeMapper
.
insertItemType
(
mdItemType
);
continue
;
}
else
{
boolean
b
=
true
;
for
(
MdItemType
md
:
mdItemTypes
)
{
if
(
md
.
getItemTypeName
().
equals
(
mdItemType
.
getItemTypeName
()))
{
md
.
setSapTypeCode
(
mdItemType
.
getSapTypeCode
());
md
.
setNameLongText
(
mdItemType
.
getNameLongText
());
md
.
setMaximumSingle
(
mdItemType
.
getMaximumSingle
());
itemTypeMapper
.
updateItemType
(
md
);
b
=
false
;
}
}
if
(
b
==
true
)
{
MdItemType
parent
=
itemTypeMapper
.
selectItemTypeById
(
200
l
);
mdItemType
.
setParentTypeId
(
parent
.
getItemTypeId
());
mdItemType
.
setAncestors
(
parent
.
getAncestors
()
+
","
+
parent
.
getItemTypeId
());
mdItemType
.
setItemTypeCode
(
mdItemType
.
getSapTypeCode
());
mdItemType
.
setEnableFlag
(
"Y"
);
mdItemType
.
setOrderNum
(
1
);
mdItemType
.
setCreateTime
(
DateUtils
.
getNowDate
());
itemTypeMapper
.
insertItemType
(
mdItemType
);
continue
;
}
}
}
//二级添加
if
(
itemTypeCode
.
length
()
==
5
)
{
MdItemType
mdItem
=
new
MdItemType
();
mdItem
.
setItemTypeCode
(
mdItemType
.
getSapTypeCode
());
List
<
MdItemType
>
mdItemTypes
=
itemTypeMapper
.
selectItemTypeList
(
mdItem
);
if
(
CollUtil
.
isEmpty
(
mdItemTypes
))
{
MdItemType
mdItems
=
new
MdItemType
();
String
substring
=
mdItemType
.
getSapTypeCode
().
substring
(
0
,
3
);
List
<
MdItemType
>
mdItemTypes1
=
itemTypeMapper
.
selectItemTypeList
(
mdItems
);
for
(
MdItemType
md
:
mdItemTypes1
)
{
if
(
StringUtils
.
isNotEmpty
(
md
.
getSapTypeCode
()))
{
if
(
md
.
getSapTypeCode
().
equals
(
substring
))
{
mdItemType
.
setParentTypeId
(
md
.
getItemTypeId
());
mdItemType
.
setAncestors
(
md
.
getAncestors
()
+
","
+
md
.
getItemTypeId
());
mdItemType
.
setItemTypeCode
(
mdItemType
.
getSapTypeCode
());
mdItemType
.
setEnableFlag
(
"Y"
);
mdItemType
.
setOrderNum
(
2
);
mdItemType
.
setCreateTime
(
DateUtils
.
getNowDate
());
itemTypeMapper
.
insertItemType
(
mdItemType
);
continue
;
}
}
}
}
else
{
continue
;
}
}
}
public
void
synchroItemType
()
{
MdItemTypeErpQuery
itemTypeErpQuery
=
new
MdItemTypeErpQuery
();
itemTypeErpQuery
.
setCurrent
(
1
);
itemTypeErpQuery
.
setPageSize
(
1000
);
//每次抓取1000行
List
<
MdItemTypeErpDto
>
list
=
erpService
.
getInvmaList
(
itemTypeErpQuery
).
getData
();
list
.
forEach
(
s
->{
MdItemType
itemType
=
new
MdItemType
();
itemType
.
setItemTypeCode
(
s
.
getItemTypeCode
());
List
<
MdItemType
>
dbList
=
this
.
selectItemTypeList
(
itemType
);
if
(
dbList
.
size
()==
0
){
MdItemType
insertTemp
=
BeanUtil
.
toBeanIgnoreError
(
s
,
MdItemType
.
class
);
insertTemp
.
setItemTypeId
(
Long
.
valueOf
(
insertTemp
.
getItemTypeCode
()));
insertTemp
.
setAncestors
(
"0"
);
this
.
insertItemType
(
insertTemp
);
}
else
{
BeanUtil
.
copyProperties
(
s
,
dbList
.
get
(
0
));
this
.
updateItemType
(
dbList
.
get
(
0
));
}
});
}
}
mes/src/main/java/com/ximai/mes/md/service/impl/MdItemServiceImpl.java
View file @
661f0a09
...
...
@@ -470,7 +470,7 @@ public class MdItemServiceImpl implements IMdItemService {
@Override
public
void
syncErpData
()
{
//优先更新修改数据
iItemTypeService
.
synchroItemType
();
mdItemService
.
syncEditErpData
();
}
...
...
@@ -547,11 +547,14 @@ public class MdItemServiceImpl implements IMdItemService {
if
(
dbList
.
size
()==
0
)
{
if
(
"Y"
.
equalsIgnoreCase
(
s
.
getVerifyStatus
()))
{
MdItem
insertTemp
=
BeanUtil
.
toBean
(
s
,
MdItem
.
class
);
//仅处理物料编号不为空数据
if
(
StringUtils
.
isEmpty
(
s
.
getItemCode
())){
if
(
itemTypeMap
.
containsKey
(
s
.
getItemTypeId
())){
insertTemp
.
setItemTypeName
(
itemTypeMap
.
get
(
s
.
getItemTypeId
()).
getItemTypeName
());
}
this
.
insertMdItem
(
insertTemp
);
}
}
}
else
{
BeanUtil
.
copyProperties
(
s
,
dbList
.
get
(
0
));
if
(!
"Y"
.
equalsIgnoreCase
(
s
.
getVerifyStatus
())){
...
...
mes/src/main/java/com/ximai/mes/pro/service/impl/task/ProTaskServiceImpl.java
View file @
661f0a09
...
...
@@ -1316,6 +1316,7 @@ public class ProTaskServiceImpl implements IProTaskService {
query
.
eq
(
proTask
.
getOutsourced
()
!=
null
,
"ptw.outsourced"
,
proTask
.
getOutsourced
());
query
.
eq
(
StringUtils
.
isNotEmpty
(
proTask
.
getArrangeCode
()),
"t.arrange_code"
,
proTask
.
getArrangeCode
());
query
.
gt
(
proTask
.
getAllowProduce
()
!=
null
&&
proTask
.
getAllowProduce
()
==
1
,
"t.quantity_wait"
,
0
);
query
.
gt
(
"ptw.quantity"
,
0
);
query
.
orderByAsc
(
"statusIndex"
).
orderByAsc
(
"ptw.schedule_start_date"
);
//搜索条件为工单号查询相应任务ID作为查询条件
if
(
StringUtils
.
isNotEmpty
(
proTask
.
getWorkorderCode
()))
{
...
...
mes/src/main/java/com/ximai/mes/remote/ErpService.java
View file @
661f0a09
...
...
@@ -36,6 +36,10 @@ public interface ErpService {
@ApiOperation
(
value
=
"查询ERP物料"
)
@PostMapping
(
value
=
"/invmb/getInvmbList"
)
ErpResponseResult
<
List
<
MdItemErpDto
>>
getItemList
(
MdItemErpQuery
itemErpQuery
);
@ApiLog
(
businessType
=
BusinessType
.
QUERY
,
inOutType
=
InOutType
.
OUT
)
@ApiOperation
(
value
=
"查询ERP物料分类"
)
@PostMapping
(
value
=
"/invma/getInvmaList"
)
ErpResponseResult
<
List
<
MdItemTypeErpDto
>>
getInvmaList
(
MdItemTypeErpQuery
itemTypeErpQuery
);
@ApiLog
(
businessType
=
BusinessType
.
QUERY
,
inOutType
=
InOutType
.
OUT
)
...
...
mes/src/main/java/com/ximai/mes/remote/dto/MdItemErpDto.java
View file @
661f0a09
...
...
@@ -69,7 +69,7 @@ public class MdItemErpDto
@JsonProperty
(
"mb017"
)
@JsonDeserialize
(
using
=
TrimStringDeserializer
.
class
)
@ApiModelProperty
(
"主要仓库"
)
private
String
manWarehouseId
;
private
String
ma
i
nWarehouseId
;
/**
* 1:已核准、2:尚待核准、3:不准交易
...
...
mes/src/main/java/com/ximai/mes/remote/dto/MdItemTypeErpDto.java
0 → 100644
View file @
661f0a09
package
com
.
ximai
.
mes
.
remote
.
dto
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.databind.annotation.JsonDeserialize
;
import
com.ximai.mes.config.EmptyStringToLongDeserializer
;
import
com.ximai.mes.config.TrimStringDeserializer
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
import
java.util.List
;
/**
* 物料对象 MdItemErpDto
*
* @date 2024-10-18
*/
@Data
public
class
MdItemTypeErpDto
{
private
static
final
long
serialVersionUID
=
1L
;
@JsonProperty
(
"ma002"
)
@JsonDeserialize
(
using
=
TrimStringDeserializer
.
class
)
@ApiModelProperty
(
"品号类别编号"
)
private
String
itemTypeCode
;
@JsonProperty
(
"ma003"
)
@JsonDeserialize
(
using
=
TrimStringDeserializer
.
class
)
@ApiModelProperty
(
"品号类别名称"
)
private
String
itemTypeName
;
}
mes/src/main/java/com/ximai/mes/remote/dto/MdItemTypeErpQuery.java
0 → 100644
View file @
661f0a09
package
com
.
ximai
.
mes
.
remote
.
dto
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* 供应商对象 MdVendorErpQuery
*
* @date 2024-10-18
*/
@Data
public
class
MdItemTypeErpQuery
extends
ErpPageParams
{
@ApiModelProperty
(
"供应商名称"
)
@JsonProperty
(
"ma001"
)
private
String
vendorCode
;
@ApiModelProperty
(
"公司全称"
)
@JsonProperty
(
"ma003"
)
private
String
vendorName
;
@ApiModelProperty
(
"简称"
)
@JsonProperty
(
"ma002"
)
private
String
vendorNick
;
@ApiModelProperty
(
"核准状态"
)
@JsonProperty
(
"ma016"
)
private
String
verifyStatus
;
}
mes/src/main/java/com/ximai/mes/remote/dto/PurchasingRequisitionCreate.java
View file @
661f0a09
...
...
@@ -27,10 +27,6 @@ public class PurchasingRequisitionCreate
@JsonProperty
(
"ta002"
)
private
String
requisitionCode
;
@ApiModelProperty
(
"数量合计"
)
@JsonProperty
(
"ta011"
)
private
BigDecimal
totalQuantity
;
@ApiModelProperty
(
"明细"
)
private
List
<
PurchasingRequisitionDetailCreate
>
details
;
}
mes/src/main/java/com/ximai/mes/remote/process/PurchasingRequisitionCreateProcess.java
View file @
661f0a09
...
...
@@ -44,7 +44,6 @@ public class PurchasingRequisitionCreateProcess implements IExtendedProcess {
create
.
setWorkorderCode
(
workorderList
.
get
(
0
).
getWorkorderCode
());
}
create
.
setRequisitionCode
(
requestCode
);
create
.
setTotalQuantity
(
taskWorkunit
.
getQuantity
());
List
<
PurchasingRequisitionDetailCreate
>
details
=
new
ArrayList
<>();
PurchasingRequisitionDetailCreate
detailCreate
=
new
PurchasingRequisitionDetailCreate
();
detailCreate
.
setQuantity
(
taskWorkunit
.
getQuantity
()+
""
);
...
...
mes/src/main/java/com/ximai/mes/scheduled/ErpDataSyncScheduled.java
0 → 100644
View file @
661f0a09
package
com
.
ximai
.
mes
.
scheduled
;
import
com.ximai.mes.md.service.IMdClientService
;
import
com.ximai.mes.md.service.IMdItemService
;
import
com.ximai.mes.md.service.IMdVendorService
;
import
com.ximai.mes.pro.service.proWorkOrder.IProWorkorderService
;
import
com.ximai.mes.wm.service.IWmWarehouseService
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
/**
* ERP数据同步
*/
@Component
public
class
ErpDataSyncScheduled
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ErpDataSyncScheduled
.
class
);
@Autowired
private
IMdClientService
clientService
;
@Autowired
private
IMdVendorService
vendorService
;
@Autowired
private
IProWorkorderService
workorderService
;
@Autowired
private
IMdItemService
itemService
;
@Autowired
private
IWmWarehouseService
warehouseService
;
public
void
process
()
{
try
{
warehouseService
.
syncErpData
();
}
catch
(
Exception
e
){
logger
.
error
(
"sync warehouse data error:"
,
e
);
}
try
{
clientService
.
syncErpData
();
}
catch
(
Exception
e
){
logger
.
error
(
"sync client data error:"
,
e
);
}
try
{
vendorService
.
syncErpData
();
}
catch
(
Exception
e
){
logger
.
error
(
"sync vendor data error:"
,
e
);
}
try
{
itemService
.
syncErpData
();
}
catch
(
Exception
e
){
logger
.
error
(
"sync item data error:"
,
e
);
}
try
{
workorderService
.
syncErpData
();
}
catch
(
Exception
e
){
logger
.
error
(
"sync workorder data error:"
,
e
);
}
}
}
mes/src/main/java/com/ximai/mes/scheduled/VendorSyncScheduled.java
deleted
100644 → 0
View file @
aab82a3d
package
com
.
ximai
.
mes
.
scheduled
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
@Component
public
class
VendorSyncScheduled
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
VendorSyncScheduled
.
class
);
@Scheduled
(
cron
=
"0 */17 * * * ?"
)
public
void
process
()
{
}
}
mes/src/main/resources/mapper/md/MdItemMapper.xml
View file @
661f0a09
...
...
@@ -42,7 +42,6 @@
<result
property=
"customerDrawingNo"
column=
"customer_drawing_no"
/>
<result
property=
"customerProNo"
column=
"customer_pro_no"
/>
<result
property=
"mainWarehouseId"
column=
"main_warehouse_id"
/>
<result
property=
"mainWarehouseCode"
column=
"main_warehouse_code"
/>
<result
property=
"erpCreateTime"
column=
"erp_create_time"
/>
<result
property=
"erpUpdateTime"
column=
"erp_update_time"
/>
</resultMap>
...
...
@@ -270,7 +269,6 @@
<if
test=
"customerDrawingNo != null"
>
customer_drawing_no,
</if>
<if
test=
"customerProNo != null"
>
customer_pro_no,
</if>
<if
test=
"mainWarehouseId !=null"
>
main_warehouse_id,
</if>
<if
test=
"mainWarehouseCode !=null"
>
main_warehouse_code,
</if>
<if
test=
"erpCreateTime !=null"
>
erp_create_time,
</if>
<if
test=
"erpUpdateTime !=null"
>
erp_update_time,
</if>
</trim>
...
...
@@ -307,7 +305,6 @@
<if
test=
"customerDrawingNo != null"
>
#{customerDrawingNo},
</if>
<if
test=
"customerProNo != null"
>
#{customerProNo},
</if>
<if
test=
"mainWarehouseId !=null"
>
#{mainWarehouseId},
</if>
<if
test=
"mainWarehouseCode !=null"
>
#{mainWarehouseCode},
</if>
<if
test=
"erpCreateTime != null"
>
#{erpCreateTime},
</if>
<if
test=
"erpUpdateTime != null"
>
#{erpUpdateTime},
</if>
</trim>
...
...
@@ -343,7 +340,6 @@
<if
test=
"customerDrawingNo !=null"
>
customer_drawing_no=#{customerDrawingNo},
</if>
<if
test=
"customerProNo !=null"
>
customer_pro_no=#{customerProNo},
</if>
<if
test=
"mainWarehouseId !=null"
>
main_warehouse_id = #{mainWarehouseId},
</if>
<if
test=
"mainWarehouseCode !=null"
>
main_warehouse_code = #{mainWarehouseCode},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime},
</if>
<if
test=
"erpUpdateTime != null"
>
erp_update_time = #{erpUpdateTime},
</if>
</set>
...
...
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