Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hg-smart
Overview
Overview
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
platform
hg-smart
Commits
5c7f4446
Commit
5c7f4446
authored
May 16, 2024
by
wuwenlong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
生产计划dev;
parent
5f6cc8b7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
385 additions
and
1 deletions
+385
-1
HGConstant.java
src/main/java/com/baosight/hggp/hg/constant/HGConstant.java
+1
-1
HGSC005.java
src/main/java/com/baosight/hggp/hg/sc/domain/HGSC005.java
+0
-0
HGSC005A.java
src/main/java/com/baosight/hggp/hg/sc/domain/HGSC005A.java
+0
-0
ServiceHGSC005.java
.../java/com/baosight/hggp/hg/sc/service/ServiceHGSC005.java
+57
-0
HGSC005.xml
src/main/java/com/baosight/hggp/hg/sc/sql/HGSC005.xml
+233
-0
HGSC005A.xml
src/main/java/com/baosight/hggp/hg/sc/sql/HGSC005A.xml
+0
-0
HGSCTools.java
src/main/java/com/baosight/hggp/hg/sc/tools/HGSCTools.java
+94
-0
No files found.
src/main/java/com/baosight/hggp/hg/constant/HGConstant.java
View file @
5c7f4446
...
@@ -66,7 +66,7 @@ public class HGConstant {
...
@@ -66,7 +66,7 @@ public class HGConstant {
// 其他出库单号
// 其他出库单号
public
static
final
String
OTHER_OUTER_NO
=
"OTHER_OUTER_NO"
;
public
static
final
String
OTHER_OUTER_NO
=
"OTHER_OUTER_NO"
;
//生产计划单
//生产计划单
public
static
final
String
H
PSC003_PROD_NO
=
"HPSC003_PROD_NO
"
;
public
static
final
String
H
GSC005_PLAN_CODE
=
"HGSC005_PLAN_CODE
"
;
//生产订单
//生产订单
public
static
final
String
HPSC005_PROD_NO
=
"HPSC005_PROD_NO"
;
public
static
final
String
HPSC005_PROD_NO
=
"HPSC005_PROD_NO"
;
//生产任务订单
//生产任务订单
...
...
src/main/java/com/baosight/hggp/hg/sc/domain/HGSC005.java
0 → 100644
View file @
5c7f4446
This diff is collapsed.
Click to expand it.
src/main/java/com/baosight/hggp/hg/sc/domain/HGSC005A.java
0 → 100644
View file @
5c7f4446
This diff is collapsed.
Click to expand it.
src/main/java/com/baosight/hggp/hg/sc/service/ServiceHGSC005.java
0 → 100644
View file @
5c7f4446
package
com
.
baosight
.
hggp
.
hg
.
sc
.
service
;
import
com.baosight.hggp.core.constant.CommonConstant
;
import
com.baosight.hggp.core.dao.DaoUtils
;
import
com.baosight.hggp.core.security.UserSessionUtils
;
import
com.baosight.hggp.hg.sc.domain.HGSC005
;
import
com.baosight.hggp.hg.sc.tools.HGSCTools
;
import
com.baosight.hggp.util.*
;
import
com.baosight.iplat4j.core.ei.EiConstant
;
import
com.baosight.iplat4j.core.ei.EiInfo
;
import
com.baosight.iplat4j.core.exception.PlatException
;
import
com.baosight.iplat4j.core.service.impl.ServiceBase
;
import
org.apache.commons.collections.CollectionUtils
;
import
java.util.*
;
/**
* @Author wwl
* @Date 2024/5/6 19:48
*/
public
class
ServiceHGSC005
extends
ServiceBase
{
public
EiInfo
initLoad
(
EiInfo
inInfo
)
{
try
{
inInfo
=
super
.
query
(
inInfo
,
HGSC005
.
QUERY
,
new
HGSC005
());
List
<
Map
>
rows
=
inInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
();
if
(
CollectionUtils
.
isNotEmpty
(
rows
)){
List
<
HGSC005
>
hgsc005List
=
HGSCTools
.
THGSC005
.
buildFinishRate
(
HGSCTools
.
THGSC005
.
convertToObj
(
rows
));
inInfo
.
setRows
(
EiConstant
.
resultBlock
,
hgsc005List
);
}
}
catch
(
PlatException
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"初始化失败"
);
}
return
inInfo
;
}
public
EiInfo
query
(
EiInfo
inInfo
)
{
try
{
inInfo
=
super
.
query
(
inInfo
,
HGSC005
.
QUERY
,
new
HGSC005
());
List
<
Map
>
rows
=
inInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
();
if
(
CollectionUtils
.
isNotEmpty
(
rows
)){
List
<
HGSC005
>
hgsc005List
=
HGSCTools
.
THGSC005
.
buildFinishRate
(
HGSCTools
.
THGSC005
.
convertToObj
(
rows
));
inInfo
.
setRows
(
EiConstant
.
resultBlock
,
hgsc005List
);
}
inInfo
.
setStatus
(
EiConstant
.
STATUS_DEFAULT
);
}
catch
(
PlatException
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"查询失败"
);
}
return
inInfo
;
}
}
src/main/java/com/baosight/hggp/hg/sc/sql/HGSC005.xml
0 → 100644
View file @
5c7f4446
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<!-- table information
Generate time : 2024-05-16 16:50:12
Version : 1.0
schema : hggp
tableName : HGSC005
id BIGINT NOT NULL primarykey,
mat_id BIGINT NOT NULL,
company_code VARCHAR NOT NULL,
company_name VARCHAR NOT NULL,
proj_code VARCHAR,
proj_name VARCHAR,
plan_code VARCHAR,
commit_status TINYINT,
finish_date VARCHAR,
account_code VARCHAR NOT NULL,
dep_code VARCHAR,
dep_name VARCHAR,
created_by VARCHAR,
created_name VARCHAR,
created_time VARCHAR,
updated_by VARCHAR,
updated_name VARCHAR,
updated_time VARCHAR
-->
<sqlMap
namespace=
"HGSC005"
>
<sql
id=
"condition"
>
<isNotEmpty
prepend=
" AND "
property=
"id"
>
id = #id#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"matId"
>
mat_id = #matId#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"companyCode"
>
company_code = #companyCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"companyName"
>
company_name = #companyName#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"projCode"
>
proj_code = #projCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"projName"
>
proj_name = #projName#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"planCode"
>
plan_code = #planCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"commitStatus"
>
commit_status = #commitStatus#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"finishDate"
>
finish_date = #finishDate#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"accountCode"
>
account_code = #accountCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"depCode"
>
dep_code = #depCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"depName"
>
dep_name = #depName#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"createdBy"
>
created_by = #createdBy#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"createdName"
>
created_name = #createdName#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"createdTime"
>
created_time = #createdTime#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"updatedBy"
>
updated_by = #updatedBy#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"updatedName"
>
updated_name = #updatedName#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"updatedTime"
>
updated_time = #updatedTime#
</isNotEmpty>
</sql>
<select
id=
"query"
parameterClass=
"java.util.HashMap"
resultClass=
"com.baosight.hggp.hg.sc.domain.HGSC005"
>
SELECT
id as "id",
mat_id as "matId",
<!-- 物料清单ID -->
company_code as "companyCode",
<!-- 公司编码 -->
company_name as "companyName",
<!-- 公司名称 -->
proj_code as "projCode",
<!-- 项目编码 -->
proj_name as "projName",
<!-- 项目名称 -->
plan_code as "planCode",
<!-- 计划编码 -->
commit_status as "commitStatus",
<!-- 提交状态 0:未提交;2:已提交 -->
finish_date as "finishDate",
<!-- 完工日期 -->
account_code as "accountCode",
<!-- 帐套 -->
dep_code as "depCode",
<!-- 部门编码 -->
dep_name as "depName",
<!-- 部门名称 -->
created_by as "createdBy",
<!-- 创建人 -->
created_name as "createdName",
<!-- 创建人名称 -->
created_time as "createdTime",
<!-- 创建时间 -->
updated_by as "updatedBy",
<!-- 更新人 -->
updated_name as "updatedName",
<!-- 修改人名称 -->
updated_time as "updatedTime"
<!-- 更新时间 -->
FROM ${hggpSchema}.HGSC005 WHERE 1=1
<include
refid=
"condition"
/>
<dynamic
prepend=
"ORDER BY"
>
<isNotEmpty
property=
"orderBy"
>
$orderBy$
</isNotEmpty>
<isEmpty
property=
"orderBy"
>
id asc
</isEmpty>
</dynamic>
</select>
<select
id=
"count"
resultClass=
"int"
>
SELECT COUNT(*) FROM ${hggpSchema}.HGSC005 WHERE 1=1
<include
refid=
"condition"
/>
</select>
<!--
<isNotEmpty prepend=" AND " property="id">
id = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="matId">
mat_id = #matId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
company_code = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
company_name = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
proj_code = #projCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projName">
proj_name = #projName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="planCode">
plan_code = #planCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="commitStatus">
commit_status = #commitStatus#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="finishDate">
finish_date = #finishDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
account_code = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
dep_code = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depName">
dep_name = #depName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
created_by = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
created_name = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
created_time = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
updated_by = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
updated_name = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
updated_time = #updatedTime#
</isNotEmpty>
-->
<insert
id=
"insert"
>
INSERT INTO ${hggpSchema}.HGSC005 (id,
mat_id,
<!-- 物料清单ID -->
company_code,
<!-- 公司编码 -->
company_name,
<!-- 公司名称 -->
proj_code,
<!-- 项目编码 -->
proj_name,
<!-- 项目名称 -->
plan_code,
<!-- 计划编码 -->
commit_status,
<!-- 提交状态 0:未提交;2:已提交 -->
finish_date,
<!-- 完工日期 -->
account_code,
<!-- 帐套 -->
dep_code,
<!-- 部门编码 -->
dep_name,
<!-- 部门名称 -->
created_by,
<!-- 创建人 -->
created_name,
<!-- 创建人名称 -->
created_time,
<!-- 创建时间 -->
updated_by,
<!-- 更新人 -->
updated_name,
<!-- 修改人名称 -->
updated_time
<!-- 更新时间 -->
)
VALUES (#id#, #matId#, #companyCode#, #companyName#, #projCode#, #projName#, #planCode#, #commitStatus#, #finishDate#, #accountCode#, #depCode#, #depName#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#)
</insert>
<delete
id=
"delete"
>
DELETE FROM ${hggpSchema}.HGSC005 WHERE
id = #id#
</delete>
<update
id=
"update"
>
UPDATE ${hggpSchema}.HGSC005
SET
mat_id = #matId#,
<!-- 物料清单ID -->
company_code = #companyCode#,
<!-- 公司编码 -->
company_name = #companyName#,
<!-- 公司名称 -->
proj_code = #projCode#,
<!-- 项目编码 -->
proj_name = #projName#,
<!-- 项目名称 -->
plan_code = #planCode#,
<!-- 计划编码 -->
commit_status = #commitStatus#,
<!-- 提交状态 0:未提交;2:已提交 -->
finish_date = #finishDate#,
<!-- 完工日期 -->
account_code = #accountCode#,
<!-- 帐套 -->
dep_code = #depCode#,
<!-- 部门编码 -->
dep_name = #depName#,
<!-- 部门名称 -->
created_by = #createdBy#,
<!-- 创建人 -->
created_name = #createdName#,
<!-- 创建人名称 -->
created_time = #createdTime#,
<!-- 创建时间 -->
updated_by = #updatedBy#,
<!-- 更新人 -->
updated_name = #updatedName#,
<!-- 修改人名称 -->
updated_time = #updatedTime#
<!-- 更新时间 -->
WHERE
id = #id#
</update>
</sqlMap>
src/main/java/com/baosight/hggp/hg/sc/sql/HGSC005A.xml
0 → 100644
View file @
5c7f4446
This diff is collapsed.
Click to expand it.
src/main/java/com/baosight/hggp/hg/sc/tools/HGSCTools.java
View file @
5c7f4446
...
@@ -2,11 +2,19 @@ package com.baosight.hggp.hg.sc.tools;
...
@@ -2,11 +2,19 @@ package com.baosight.hggp.hg.sc.tools;
import
com.baosight.hggp.core.dao.DaoBase
;
import
com.baosight.hggp.core.dao.DaoBase
;
import
com.baosight.hggp.core.dao.DaoUtils
;
import
com.baosight.hggp.core.dao.DaoUtils
;
import
com.baosight.hggp.core.security.UserSessionUtils
;
import
com.baosight.hggp.hg.constant.HGConstant
;
import
com.baosight.hggp.hg.sc.domain.HGSC001A
;
import
com.baosight.hggp.hg.sc.domain.HGSC001A
;
import
com.baosight.hggp.hg.sc.domain.HGSC005
;
import
com.baosight.hggp.hg.sc.domain.HGSC005A
;
import
com.baosight.hggp.util.AssertUtils
;
import
com.baosight.hggp.util.AssertUtils
;
import
com.baosight.iplat4j.ed.util.SequenceGenerator
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.MapUtils
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collector
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
...
@@ -74,4 +82,90 @@ public class HGSCTools {
...
@@ -74,4 +82,90 @@ public class HGSCTools {
}
}
}
}
}
}
public
static
class
THGSC005
{
public
static
List
<
HGSC005
>
buildFinishRate
(
List
<
HGSC005
>
hgsc005List
){
if
(
CollectionUtils
.
isNotEmpty
(
hgsc005List
)){
List
<
HGSC005A
>
hgsc005AList
=
THGSC005A
.
queryByPlanCodes
(
hgsc005List
.
stream
().
map
(
HGSC005:
:
getPlanCode
).
collect
(
Collectors
.
toList
()));
Map
<
String
,
Double
>
finishRateMap
=
hgsc005AList
.
stream
().
collect
(
Collectors
.
groupingBy
(
HGSC005A:
:
getPlanCode
,
Collectors
.
collectingAndThen
(
Collectors
.
toList
(),
list
->{
return
list
.
stream
().
mapToDouble
(
HGSC005A:
:
getFinishQuantity
).
sum
()/
list
.
stream
().
mapToDouble
(
HGSC005A:
:
getQuantity
).
sum
();
})));
hgsc005List
.
forEach
(
hgsc005
->
{
hgsc005
.
setFinishRate
(
MapUtils
.
isNotEmpty
(
finishRateMap
)&&
Objects
.
nonNull
(
finishRateMap
.
get
(
hgsc005
.
getPlanCode
()))?
new
BigDecimal
(
finishRateMap
.
get
(
hgsc005
.
getPlanCode
()))
.
setScale
(
0
,
BigDecimal
.
ROUND_DOWN
).
doubleValue
():
0
);
});
}
return
hgsc005List
;
}
public
static
List
<
HGSC005
>
convertToObj
(
List
<
Map
>
resultRows
){
List
<
HGSC005
>
objList
=
new
ArrayList
<>();
for
(
Map
resultRow
:
resultRows
)
{
HGSC005
hgsc005
=
new
HGSC005
();
hgsc005
.
fromMap
(
resultRow
);
objList
.
add
(
hgsc005
);
}
return
objList
;
}
public
static
HGSC005
save
(
HGSC005
hgsc005
){
checkSaveData
(
hgsc005
);
hgsc005
.
setPlanCode
(
SequenceGenerator
.
getNextSequence
(
HGConstant
.
SequenceId
.
HGSC005_PLAN_CODE
));
DaoUtils
.
insert
(
HGSC005
.
INSERT
,
hgsc005
);
hgsc005
.
getHgsc005AList
().
forEach
(
hgsc005A
->
{
DaoUtils
.
insert
(
HGSC005A
.
INSERT
,
THGSC005A
.
constructObj
(
hgsc005A
,
hgsc005
));
});
return
hgsc005
;
}
/**
* 校验保存的数据
*
* @param hgsc005
*/
private
static
void
checkSaveData
(
HGSC005
hgsc005
)
{
AssertUtils
.
isEmpty
(
UserSessionUtils
.
getAccountCode
(),
"当前用户未绑定公司,无法操作数据,请联系管理员!"
);
AssertUtils
.
isEmpty
(
UserSessionUtils
.
getOrgId
(),
"当前用户未绑定部门,无法操作数据,请联系管理员!"
);
AssertUtils
.
isEmpty
(
hgsc005
.
getCompanyCode
(),
"公司编码不能为空!"
);
AssertUtils
.
isEmpty
(
hgsc005
.
getCompanyName
(),
"公司名称不能为空!"
);
AssertUtils
.
isEmpty
(
hgsc005
.
getDepCode
(),
"部门不能为空!"
);
AssertUtils
.
isEmpty
(
hgsc005
.
getProjCode
(),
"项目编号不能为空!"
);
AssertUtils
.
isEmpty
(
hgsc005
.
getProjName
(),
"项目名称不能为空!"
);
AssertUtils
.
isEmpty
(
hgsc005
.
getHgsc005AList
(),
"计划明细不能为空"
);
hgsc005
.
getHgsc005AList
().
forEach
(
hgsc005A
->
{
AssertUtils
.
isEmpty
(
hgsc005A
.
getProductCode
(),
"产品编码不能为空!"
);
AssertUtils
.
isEmpty
(
hgsc005A
.
getProductName
(),
"产品名称不能为空!"
);
AssertUtils
.
isTrue
(
Objects
.
isNull
(
hgsc005A
.
getTechFlowId
())||
hgsc005A
.
getTechFlowId
()<=
0
,
"工序ID不能为空!"
);
AssertUtils
.
isTrue
(
Objects
.
isNull
(
hgsc005A
.
getQuantity
())||
hgsc005A
.
getQuantity
()<=
0
,
"数量不能为空!"
);
// AssertUtils.isTrue(Objects.isNull(hgsc005A.getFinishQuantity())||hgsc005A.getFinishQuantity()<=0, "完工数量不能为空!");
// AssertUtils.isTrue(Objects.isNull(hgsc005A.getUnfinishQuantity())||hgsc005A.getUnfinishQuantity()<=0, "未完工数量不能为空!");
});
}
}
public
static
class
THGSC005A
{
public
static
List
<
HGSC005A
>
queryByPlanCodes
(
List
<
String
>
planCodes
){
AssertUtils
.
isEmpty
(
planCodes
,
"计划编码不能为空!"
);
Map
paramMap
=
new
HashMap
();
paramMap
.
put
(
"planCodes"
,
planCodes
);
List
<
HGSC005A
>
results
=
DaoBase
.
getInstance
().
query
(
HGSC001A
.
QUERY
,
paramMap
);
return
CollectionUtils
.
isEmpty
(
results
)
?
null
:
results
;
}
public
static
HGSC005A
constructObj
(
HGSC005A
hgsc005a
,
HGSC005
hgsc005
){
hgsc005a
.
setPlanCode
(
hgsc005
.
getPlanCode
());
hgsc005a
.
setCompanyCode
(
hgsc005
.
getCompanyCode
());
hgsc005a
.
setCompanyName
(
hgsc005
.
getCompanyName
());
hgsc005a
.
setDepCode
(
hgsc005
.
getDepCode
());
hgsc005a
.
setDepName
(
hgsc005
.
getDepName
());
hgsc005a
.
setProjCode
(
hgsc005
.
getProjCode
());
hgsc005a
.
setProjName
(
hgsc005
.
getProjName
());
hgsc005a
.
setFinishDate
(
hgsc005
.
getFinishDate
());
hgsc005a
.
setUnfinishQuantity
(
hgsc005a
.
getQuantity
());
hgsc005a
.
setFinishQuantity
(
hgsc005a
.
getQuantity
()-
hgsc005a
.
getUnfinishQuantity
());
return
hgsc005a
;
}
}
}
}
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