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
aa8d63dd
Commit
aa8d63dd
authored
May 20, 2024
by
wuwenlong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
生产计划排产
parent
ce891bcb
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
469 additions
and
24 deletions
+469
-24
HGPZ005.xml
src/main/java/com/baosight/hggp/hg/pz/sql/HGPZ005.xml
+3
-0
HGPZ005A.xml
src/main/java/com/baosight/hggp/hg/pz/sql/HGPZ005A.xml
+3
-0
HGPZTools.java
src/main/java/com/baosight/hggp/hg/pz/tools/HGPZTools.java
+28
-0
HGSC005.java
src/main/java/com/baosight/hggp/hg/sc/domain/HGSC005.java
+1
-0
HGSC005A.java
src/main/java/com/baosight/hggp/hg/sc/domain/HGSC005A.java
+36
-0
ServiceHGSC001.java
.../java/com/baosight/hggp/hg/sc/service/ServiceHGSC001.java
+0
-1
ServiceHGSC005.java
.../java/com/baosight/hggp/hg/sc/service/ServiceHGSC005.java
+30
-0
ServiceHGSC005A.java
...java/com/baosight/hggp/hg/sc/service/ServiceHGSC005A.java
+19
-7
HGSC005.xml
src/main/java/com/baosight/hggp/hg/sc/sql/HGSC005.xml
+13
-0
HGSC005A.xml
src/main/java/com/baosight/hggp/hg/sc/sql/HGSC005A.xml
+18
-1
HGSCTools.java
src/main/java/com/baosight/hggp/hg/sc/tools/HGSCTools.java
+116
-3
HGSJ001.xml
src/main/java/com/baosight/hggp/hg/sj/sql/HGSJ001.xml
+3
-0
HGSJTools.java
src/main/java/com/baosight/hggp/hg/sj/tools/HGSJTools.java
+13
-2
DateUtil.java
src/main/java/com/baosight/hggp/util/DateUtil.java
+116
-0
HGSC001.js
src/main/webapp/HG/SC/HGSC001.js
+2
-2
HGSC005.js
src/main/webapp/HG/SC/HGSC005.js
+35
-4
HGSC005A.js
src/main/webapp/HG/SC/HGSC005A.js
+32
-4
HGSC005A.jsp
src/main/webapp/HG/SC/HGSC005A.jsp
+1
-0
No files found.
src/main/java/com/baosight/hggp/hg/pz/sql/HGPZ005.xml
View file @
aa8d63dd
...
@@ -95,6 +95,9 @@
...
@@ -95,6 +95,9 @@
<isNotEmpty
prepend=
" AND "
property=
"flowId"
>
<isNotEmpty
prepend=
" AND "
property=
"flowId"
>
FLOW_ID = #flowId#
FLOW_ID = #flowId#
</isNotEmpty>
</isNotEmpty>
<isNotEmpty
property=
"inventCodes"
>
INVENT_CODE IN
<iterate
close=
")"
open=
"("
conjunction=
","
property=
"inventCodes"
>
#inventCodes[]#
</iterate>
</isNotEmpty>
</sql>
</sql>
<sql
id=
"authCondition"
>
<sql
id=
"authCondition"
>
...
...
src/main/java/com/baosight/hggp/hg/pz/sql/HGPZ005A.xml
View file @
aa8d63dd
...
@@ -81,6 +81,9 @@
...
@@ -81,6 +81,9 @@
<isNotEmpty
prepend=
" AND "
property=
"parentId"
>
<isNotEmpty
prepend=
" AND "
property=
"parentId"
>
PARENT_ID = #parentId#
PARENT_ID = #parentId#
</isNotEmpty>
</isNotEmpty>
<isNotEmpty
property=
"ids"
>
ID IN
<iterate
close=
")"
open=
"("
conjunction=
","
property=
"ids"
>
#ids[]#
</iterate>
</isNotEmpty>
</sql>
</sql>
<select
id=
"query"
parameterClass=
"java.util.HashMap"
<select
id=
"query"
parameterClass=
"java.util.HashMap"
...
...
src/main/java/com/baosight/hggp/hg/pz/tools/HGPZTools.java
View file @
aa8d63dd
...
@@ -204,6 +204,20 @@ public class HGPZTools {
...
@@ -204,6 +204,20 @@ public class HGPZTools {
/**
/**
* 查询
* 查询
*
*
* @param inventCodes
* @return
*/
public
static
List
<
HGPZ005
>
listByInventCodes
(
List
<
String
>
inventCodes
)
{
AssertUtils
.
isEmpty
(
inventCodes
,
"存货档案编码不能为空!"
);
Map
queryMap
=
new
HashMap
();
queryMap
.
put
(
"inventCodes"
,
inventCodes
);
return
DaoBase
.
getInstance
().
query
(
HGPZ005
.
QUERY
,
queryMap
);
}
/**
* 查询
*
* @param ids
* @param ids
* @return
* @return
*/
*/
...
@@ -450,6 +464,20 @@ public class HGPZTools {
...
@@ -450,6 +464,20 @@ public class HGPZTools {
List
<
HGPZ005A
>
results
=
DaoBase
.
getInstance
().
query
(
HGPZ005A
.
QUERY
,
paramMap
);
List
<
HGPZ005A
>
results
=
DaoBase
.
getInstance
().
query
(
HGPZ005A
.
QUERY
,
paramMap
);
return
CollectionUtils
.
isEmpty
(
results
)
?
null
:
results
;
return
CollectionUtils
.
isEmpty
(
results
)
?
null
:
results
;
}
}
/**
* 通过存货编码查询存货工序*
*
* @param ids
* @return
*/
public
static
List
<
HGPZ005A
>
queryByIds
(
List
<
Long
>
ids
)
{
AssertUtils
.
isEmpty
(
ids
,
"ID不能为空!"
);
Map
paramMap
=
new
HashMap
();
paramMap
.
put
(
"ids"
,
ids
);
List
<
HGPZ005A
>
results
=
DaoBase
.
getInstance
().
query
(
HGPZ005A
.
QUERY
,
paramMap
);
return
CollectionUtils
.
isEmpty
(
results
)
?
null
:
results
;
}
}
}
}
}
src/main/java/com/baosight/hggp/hg/sc/domain/HGSC005.java
View file @
aa8d63dd
...
@@ -70,6 +70,7 @@ public class HGSC005 extends DaoEPBase {
...
@@ -70,6 +70,7 @@ public class HGSC005 extends DaoEPBase {
public
static
final
String
INSERT
=
"HGSC005.insert"
;
public
static
final
String
INSERT
=
"HGSC005.insert"
;
public
static
final
String
UPDATE
=
"HGSC005.update"
;
public
static
final
String
UPDATE
=
"HGSC005.update"
;
public
static
final
String
DELETE
=
"HGSC005.delete"
;
public
static
final
String
DELETE
=
"HGSC005.delete"
;
public
static
final
String
BATCH_COMMIT
=
"HGSC005.batch_commit"
;
private
Long
id
=
new
Long
(
0
);
private
Long
id
=
new
Long
(
0
);
private
Long
matId
=
new
Long
(
0
);
/* 物料清单ID*/
private
Long
matId
=
new
Long
(
0
);
/* 物料清单ID*/
...
...
src/main/java/com/baosight/hggp/hg/sc/domain/HGSC005A.java
View file @
aa8d63dd
...
@@ -27,7 +27,9 @@ public class HGSC005A extends DaoEPBase {
...
@@ -27,7 +27,9 @@ public class HGSC005A extends DaoEPBase {
public
static
final
String
FIELD_tech_flow_id
=
"techFlowId"
;
/* 工艺流程ID*/
public
static
final
String
FIELD_tech_flow_id
=
"techFlowId"
;
/* 工艺流程ID*/
public
static
final
String
FIELD_tech_flow_name
=
"techFlowName"
;
/* 工艺流程名称*/
public
static
final
String
FIELD_tech_flow_name
=
"techFlowName"
;
/* 工艺流程名称*/
public
static
final
String
FIELD_invent_process_id
=
"inventProcessId"
;
/* 存货工序ID,对应HGPZ005A.id*/
public
static
final
String
FIELD_invent_process_id
=
"inventProcessId"
;
/* 存货工序ID,对应HGPZ005A.id*/
public
static
final
String
FIELD_process_code
=
"processCode"
;
/* 工序名称*/
public
static
final
String
FIELD_process_name
=
"processName"
;
/* 工序名称*/
public
static
final
String
FIELD_process_name
=
"processName"
;
/* 工序名称*/
public
static
final
String
FIELD_process_order
=
"processOrder"
;
/* 加工顺序*/
public
static
final
String
FIELD_company_code
=
"companyCode"
;
/* 公司编码*/
public
static
final
String
FIELD_company_code
=
"companyCode"
;
/* 公司编码*/
public
static
final
String
FIELD_company_name
=
"companyName"
;
/* 公司名称*/
public
static
final
String
FIELD_company_name
=
"companyName"
;
/* 公司名称*/
public
static
final
String
FIELD_dep_code
=
"depCode"
;
/* 部门编码*/
public
static
final
String
FIELD_dep_code
=
"depCode"
;
/* 部门编码*/
...
@@ -58,7 +60,9 @@ public class HGSC005A extends DaoEPBase {
...
@@ -58,7 +60,9 @@ public class HGSC005A extends DaoEPBase {
public
static
final
String
COL_tech_flow_id
=
"tech_flow_id"
;
/* 工艺流程ID*/
public
static
final
String
COL_tech_flow_id
=
"tech_flow_id"
;
/* 工艺流程ID*/
public
static
final
String
COL_tech_flow_name
=
"tech_flow_name"
;
/* 工艺流程名称*/
public
static
final
String
COL_tech_flow_name
=
"tech_flow_name"
;
/* 工艺流程名称*/
public
static
final
String
COL_invent_process_id
=
"invent_process_id"
;
/* 存货工序ID,对应HGPZ005A.id*/
public
static
final
String
COL_invent_process_id
=
"invent_process_id"
;
/* 存货工序ID,对应HGPZ005A.id*/
public
static
final
String
COL_process_code
=
"process_code"
;
/* 工序名称*/
public
static
final
String
COL_process_name
=
"process_name"
;
/* 工序名称*/
public
static
final
String
COL_process_name
=
"process_name"
;
/* 工序名称*/
public
static
final
String
COL_process_order
=
"processOrder"
;
/* 加工顺序*/
public
static
final
String
COL_company_code
=
"company_code"
;
/* 公司编码*/
public
static
final
String
COL_company_code
=
"company_code"
;
/* 公司编码*/
public
static
final
String
COL_company_name
=
"company_name"
;
/* 公司名称*/
public
static
final
String
COL_company_name
=
"company_name"
;
/* 公司名称*/
public
static
final
String
COL_dep_code
=
"dep_code"
;
/* 部门编码*/
public
static
final
String
COL_dep_code
=
"dep_code"
;
/* 部门编码*/
...
@@ -96,7 +100,9 @@ public class HGSC005A extends DaoEPBase {
...
@@ -96,7 +100,9 @@ public class HGSC005A extends DaoEPBase {
private
Long
techFlowId
=
new
Long
(
0
);
/* 工艺流程ID*/
private
Long
techFlowId
=
new
Long
(
0
);
/* 工艺流程ID*/
private
Long
techFlowName
=
new
Long
(
0
);
/* 工艺流程名称*/
private
Long
techFlowName
=
new
Long
(
0
);
/* 工艺流程名称*/
private
Long
inventProcessId
=
new
Long
(
0
);
/* 存货工序ID,对应HGPZ005A.id*/
private
Long
inventProcessId
=
new
Long
(
0
);
/* 存货工序ID,对应HGPZ005A.id*/
private
String
processCode
=
" "
;
/* 工序名称*/
private
String
processName
=
" "
;
/* 工序名称*/
private
String
processName
=
" "
;
/* 工序名称*/
private
Long
processOrder
=
new
Long
(
0
);
private
String
companyCode
=
" "
;
/* 公司编码*/
private
String
companyCode
=
" "
;
/* 公司编码*/
private
String
companyName
=
" "
;
/* 公司名称*/
private
String
companyName
=
" "
;
/* 公司名称*/
private
String
depCode
=
" "
;
/* 部门编码*/
private
String
depCode
=
" "
;
/* 部门编码*/
...
@@ -152,10 +158,18 @@ public class HGSC005A extends DaoEPBase {
...
@@ -152,10 +158,18 @@ public class HGSC005A extends DaoEPBase {
eiColumn
.
setDescName
(
"存货工序ID,对应HGPZ005A.id"
);
eiColumn
.
setDescName
(
"存货工序ID,对应HGPZ005A.id"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
FIELD_process_code
);
eiColumn
.
setDescName
(
"工序编码"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
FIELD_process_name
);
eiColumn
=
new
EiColumn
(
FIELD_process_name
);
eiColumn
.
setDescName
(
"工序名称"
);
eiColumn
.
setDescName
(
"工序名称"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
FIELD_process_order
);
eiColumn
.
setDescName
(
"加工顺序"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
FIELD_company_code
);
eiColumn
=
new
EiColumn
(
FIELD_company_code
);
eiColumn
.
setDescName
(
"公司编码"
);
eiColumn
.
setDescName
(
"公司编码"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiMetadata
.
addMeta
(
eiColumn
);
...
@@ -354,6 +368,15 @@ public class HGSC005A extends DaoEPBase {
...
@@ -354,6 +368,15 @@ public class HGSC005A extends DaoEPBase {
public
void
setInventProcessId
(
Long
inventProcessId
)
{
public
void
setInventProcessId
(
Long
inventProcessId
)
{
this
.
inventProcessId
=
inventProcessId
;
this
.
inventProcessId
=
inventProcessId
;
}
}
public
String
getProcessCode
()
{
return
processCode
;
}
public
void
setProcessCode
(
String
processCode
)
{
this
.
processCode
=
processCode
;
}
/**
/**
* get the processName - 工序名称.
* get the processName - 工序名称.
* @return the processName
* @return the processName
...
@@ -370,6 +393,15 @@ public class HGSC005A extends DaoEPBase {
...
@@ -370,6 +393,15 @@ public class HGSC005A extends DaoEPBase {
public
void
setProcessName
(
String
processName
)
{
public
void
setProcessName
(
String
processName
)
{
this
.
processName
=
processName
;
this
.
processName
=
processName
;
}
}
public
Long
getProcessOrder
()
{
return
processOrder
;
}
public
void
setProcessOrder
(
Long
processOrder
)
{
this
.
processOrder
=
processOrder
;
}
/**
/**
* get the companyCode - 公司编码.
* get the companyCode - 公司编码.
* @return the companyCode
* @return the companyCode
...
@@ -752,7 +784,9 @@ public class HGSC005A extends DaoEPBase {
...
@@ -752,7 +784,9 @@ public class HGSC005A extends DaoEPBase {
setTechFlowId
(
NumberUtils
.
toLong
(
StringUtils
.
toString
(
map
.
get
(
FIELD_tech_flow_id
)),
techFlowId
));
setTechFlowId
(
NumberUtils
.
toLong
(
StringUtils
.
toString
(
map
.
get
(
FIELD_tech_flow_id
)),
techFlowId
));
setTechFlowName
(
NumberUtils
.
toLong
(
StringUtils
.
toString
(
map
.
get
(
FIELD_tech_flow_name
)),
techFlowName
));
setTechFlowName
(
NumberUtils
.
toLong
(
StringUtils
.
toString
(
map
.
get
(
FIELD_tech_flow_name
)),
techFlowName
));
setInventProcessId
(
NumberUtils
.
toLong
(
StringUtils
.
toString
(
map
.
get
(
FIELD_invent_process_id
)),
inventProcessId
));
setInventProcessId
(
NumberUtils
.
toLong
(
StringUtils
.
toString
(
map
.
get
(
FIELD_invent_process_id
)),
inventProcessId
));
setProcessCode
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_process_code
)),
processCode
));
setProcessName
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_process_name
)),
processName
));
setProcessName
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_process_name
)),
processName
));
setProcessOrder
(
NumberUtils
.
toLong
(
StringUtils
.
toString
(
map
.
get
(
FIELD_process_order
)),
processOrder
));
setCompanyCode
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_company_code
)),
companyCode
));
setCompanyCode
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_company_code
)),
companyCode
));
setCompanyName
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_company_name
)),
companyName
));
setCompanyName
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_company_name
)),
companyName
));
setDepCode
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_dep_code
)),
depCode
));
setDepCode
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_dep_code
)),
depCode
));
...
@@ -791,7 +825,9 @@ public class HGSC005A extends DaoEPBase {
...
@@ -791,7 +825,9 @@ public class HGSC005A extends DaoEPBase {
map
.
put
(
FIELD_tech_flow_id
,
StringUtils
.
toString
(
techFlowId
,
eiMetadata
.
getMeta
(
FIELD_tech_flow_id
)));
map
.
put
(
FIELD_tech_flow_id
,
StringUtils
.
toString
(
techFlowId
,
eiMetadata
.
getMeta
(
FIELD_tech_flow_id
)));
map
.
put
(
FIELD_tech_flow_name
,
StringUtils
.
toString
(
techFlowName
,
eiMetadata
.
getMeta
(
FIELD_tech_flow_name
)));
map
.
put
(
FIELD_tech_flow_name
,
StringUtils
.
toString
(
techFlowName
,
eiMetadata
.
getMeta
(
FIELD_tech_flow_name
)));
map
.
put
(
FIELD_invent_process_id
,
StringUtils
.
toString
(
inventProcessId
,
eiMetadata
.
getMeta
(
FIELD_invent_process_id
)));
map
.
put
(
FIELD_invent_process_id
,
StringUtils
.
toString
(
inventProcessId
,
eiMetadata
.
getMeta
(
FIELD_invent_process_id
)));
map
.
put
(
FIELD_process_code
,
StringUtils
.
toString
(
processCode
,
eiMetadata
.
getMeta
(
FIELD_process_code
)));
map
.
put
(
FIELD_process_name
,
StringUtils
.
toString
(
processName
,
eiMetadata
.
getMeta
(
FIELD_process_name
)));
map
.
put
(
FIELD_process_name
,
StringUtils
.
toString
(
processName
,
eiMetadata
.
getMeta
(
FIELD_process_name
)));
map
.
put
(
FIELD_process_order
,
StringUtils
.
toString
(
id
,
eiMetadata
.
getMeta
(
FIELD_process_order
)));
map
.
put
(
FIELD_company_code
,
StringUtils
.
toString
(
companyCode
,
eiMetadata
.
getMeta
(
FIELD_company_code
)));
map
.
put
(
FIELD_company_code
,
StringUtils
.
toString
(
companyCode
,
eiMetadata
.
getMeta
(
FIELD_company_code
)));
map
.
put
(
FIELD_company_name
,
StringUtils
.
toString
(
companyName
,
eiMetadata
.
getMeta
(
FIELD_company_name
)));
map
.
put
(
FIELD_company_name
,
StringUtils
.
toString
(
companyName
,
eiMetadata
.
getMeta
(
FIELD_company_name
)));
map
.
put
(
FIELD_dep_code
,
StringUtils
.
toString
(
depCode
,
eiMetadata
.
getMeta
(
FIELD_dep_code
)));
map
.
put
(
FIELD_dep_code
,
StringUtils
.
toString
(
depCode
,
eiMetadata
.
getMeta
(
FIELD_dep_code
)));
...
...
src/main/java/com/baosight/hggp/hg/sc/service/ServiceHGSC001.java
View file @
aa8d63dd
...
@@ -96,7 +96,6 @@ public class ServiceHGSC001 extends ServiceBase {
...
@@ -96,7 +96,6 @@ public class ServiceHGSC001 extends ServiceBase {
public
EiInfo
commit
(
EiInfo
inInfo
)
{
public
EiInfo
commit
(
EiInfo
inInfo
)
{
try
{
try
{
List
<
Map
>
resultRows
=
inInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
();
List
<
Map
>
resultRows
=
inInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
();
// 销售单号
List
<
Long
>
ids
=
ObjectUtils
.
listKey
(
resultRows
,
HGSC001
.
FIELD_id
);
List
<
Long
>
ids
=
ObjectUtils
.
listKey
(
resultRows
,
HGSC001
.
FIELD_id
);
DaoUtils
.
update
(
HGSC001
.
BATCH_COMMIT
,
new
HashMap
<
String
,
Object
>(){{
put
(
"ids"
,
ids
);}});
DaoUtils
.
update
(
HGSC001
.
BATCH_COMMIT
,
new
HashMap
<
String
,
Object
>(){{
put
(
"ids"
,
ids
);}});
inInfo
=
this
.
query
(
inInfo
);
inInfo
=
this
.
query
(
inInfo
);
...
...
src/main/java/com/baosight/hggp/hg/sc/service/ServiceHGSC005.java
View file @
aa8d63dd
package
com
.
baosight
.
hggp
.
hg
.
sc
.
service
;
package
com
.
baosight
.
hggp
.
hg
.
sc
.
service
;
import
com.baosight.hggp.aspect.annotation.OperationLogAnnotation
;
import
com.baosight.hggp.aspect.annotation.OperationLogAnnotation
;
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.domain.HGSC005
;
import
com.baosight.hggp.hg.sc.domain.HGSC005A
;
import
com.baosight.hggp.hg.sc.tools.HGSCTools
;
import
com.baosight.hggp.hg.sc.tools.HGSCTools
;
import
com.baosight.hggp.util.*
;
import
com.baosight.hggp.util.*
;
import
com.baosight.iplat4j.core.ei.EiConstant
;
import
com.baosight.iplat4j.core.ei.EiConstant
;
...
@@ -50,7 +53,34 @@ public class ServiceHGSC005 extends ServiceBase {
...
@@ -50,7 +53,34 @@ public class ServiceHGSC005 extends ServiceBase {
return
inInfo
;
return
inInfo
;
}
}
@OperationLogAnnotation
(
operModul
=
"生产计划"
,
operType
=
"提交"
,
operDesc
=
"提交"
)
public
EiInfo
commit
(
EiInfo
inInfo
)
{
try
{
List
<
Map
>
resultRows
=
inInfo
.
getBlock
(
EiConstant
.
resultBlock
).
getRows
();
List
<
String
>
planCodes
=
ObjectUtils
.
listKey
(
resultRows
,
HGSC005
.
FIELD_plan_code
);
List
<
HGSC005A
>
hgsc005AList
=
HGSCTools
.
THGSC005A
.
queryByPlanCodes
(
planCodes
);
this
.
checkCommitDate
(
hgsc005AList
);
List
<
Long
>
ids
=
ObjectUtils
.
listKey
(
resultRows
,
HGSC005
.
FIELD_id
);
DaoUtils
.
update
(
HGSC005
.
BATCH_COMMIT
,
new
HashMap
<
String
,
Object
>(){{
put
(
"ids"
,
ids
);}});
//TODO 生成生产计划
inInfo
=
this
.
query
(
inInfo
);
inInfo
.
setStatus
(
EiConstant
.
STATUS_DEFAULT
);
inInfo
.
setMsg
(
"操作成功!本次对["
+
resultRows
.
size
()
+
"]条数据提交成功!"
);
}
catch
(
Exception
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"操作失败"
);
}
return
inInfo
;
}
private
void
checkCommitDate
(
List
<
HGSC005A
>
hgsc005AList
){
AssertUtils
.
isEmpty
(
UserSessionUtils
.
getAccountCode
(),
"当前用户未绑定公司,无法操作数据,请联系管理员!"
);
AssertUtils
.
isEmpty
(
UserSessionUtils
.
getOrgId
(),
"当前用户未绑定部门,无法操作数据,请联系管理员!"
);
hgsc005AList
.
forEach
(
o
->
{
AssertUtils
.
isEmpty
(
o
.
getPlanStartDate
(),
String
.
format
(
"项目[%s]%s,计划详情有未排产的数据,无法提交!"
,
o
.
getProjCode
(),
o
.
getProjName
()));
AssertUtils
.
isEmpty
(
o
.
getPlanEndDate
(),
String
.
format
(
"项目[%s]%s,计划详情有未排产的数据,无法提交!"
,
o
.
getProjCode
(),
o
.
getProjName
()));
});
}
}
}
...
...
src/main/java/com/baosight/hggp/hg/sc/service/ServiceHGSC005A.java
View file @
aa8d63dd
...
@@ -4,13 +4,7 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
...
@@ -4,13 +4,7 @@ import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import
com.baosight.hggp.common.DdynamicEnum
;
import
com.baosight.hggp.common.DdynamicEnum
;
import
com.baosight.hggp.core.constant.CommonConstant
;
import
com.baosight.hggp.core.constant.CommonConstant
;
import
com.baosight.hggp.core.dao.DaoUtils
;
import
com.baosight.hggp.core.dao.DaoUtils
;
import
com.baosight.hggp.hg.cg.domain.HGCG002
;
import
com.baosight.hggp.hg.sc.domain.HGSC005
;
import
com.baosight.hggp.hg.cg.domain.HGCG002A
;
import
com.baosight.hggp.hg.cg.utils.HGCGUtils
;
import
com.baosight.hggp.hg.constant.HGConstant
;
import
com.baosight.hggp.hg.constant.HGSqlConstant
;
import
com.baosight.hggp.hg.sc.domain.HGSC001
;
import
com.baosight.hggp.hg.sc.domain.HGSC001A
;
import
com.baosight.hggp.hg.sc.domain.HGSC005A
;
import
com.baosight.hggp.hg.sc.domain.HGSC005A
;
import
com.baosight.hggp.hg.sc.tools.HGSCTools
;
import
com.baosight.hggp.hg.sc.tools.HGSCTools
;
import
com.baosight.hggp.util.*
;
import
com.baosight.hggp.util.*
;
...
@@ -82,6 +76,24 @@ public class ServiceHGSC005A extends ServiceBase {
...
@@ -82,6 +76,24 @@ public class ServiceHGSC005A extends ServiceBase {
}
}
}
}
@OperationLogAnnotation
(
operModul
=
"生产计划详情"
,
operType
=
"排产"
,
operDesc
=
"排产"
)
public
EiInfo
schedule
(
EiInfo
inInfo
)
{
try
{
String
planCode
=
inInfo
.
getString
(
HGSC005
.
FIELD_plan_code
);
HGSC005
hgsc005
=
HGSCTools
.
THGSC005
.
queryByPlanCode
(
planCode
);
this
.
checkScheduleData
(
hgsc005
);
HGSCTools
.
THGSC005A
.
schedule
(
planCode
);
inInfo
=
this
.
query
(
inInfo
);
inInfo
.
setStatus
(
EiConstant
.
STATUS_DEFAULT
);
// inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据排产成功!");
}
catch
(
Exception
e
)
{
LogUtils
.
setDetailMsg
(
inInfo
,
e
,
"操作失败"
);
}
return
inInfo
;
}
private
void
checkScheduleData
(
HGSC005
hgsc005
)
{
AssertUtils
.
isTrue
(
hgsc005
.
getIsSchedule
().
compareTo
(
CommonConstant
.
YesNo
.
YES_1
)==
0
,
"当前计划已排产,请手动调整计划!"
);
}
}
}
src/main/java/com/baosight/hggp/hg/sc/sql/HGSC005.xml
View file @
aa8d63dd
...
@@ -238,4 +238,17 @@
...
@@ -238,4 +238,17 @@
id = #id#
id = #id#
</update>
</update>
<update
id=
"batch_commit"
>
UPDATE ${hggpSchema}.HGSC005
SET
commit_status = 2,
<!-- 审批状态 0:待审;1:审核中;2:已审 -->
updated_by = #updatedBy#,
<!-- 更新人 -->
updated_name = #updatedName#,
<!-- 修改人名称 -->
updated_time = #updatedTime#
<!-- 更新时间 -->
WHERE
id IN
<iterate
close=
")"
open=
"("
conjunction=
","
property=
"ids"
>
#ids[]#
</iterate>
</update>
</sqlMap>
</sqlMap>
src/main/java/com/baosight/hggp/hg/sc/sql/HGSC005A.xml
View file @
aa8d63dd
...
@@ -38,6 +38,8 @@
...
@@ -38,6 +38,8 @@
<sqlMap
namespace=
"HGSC005A"
>
<sqlMap
namespace=
"HGSC005A"
>
<sql
id=
"condition"
>
<sql
id=
"condition"
>
<include
refid=
"HGXSDataAuth.authCondition"
/>
<isNotEmpty
prepend=
" AND "
property=
"id"
>
<isNotEmpty
prepend=
" AND "
property=
"id"
>
id = #id#
id = #id#
</isNotEmpty>
</isNotEmpty>
...
@@ -59,6 +61,12 @@
...
@@ -59,6 +61,12 @@
<isNotEmpty
prepend=
" AND "
property=
"processName"
>
<isNotEmpty
prepend=
" AND "
property=
"processName"
>
process_name = #processName#
process_name = #processName#
</isNotEmpty>
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"processCode"
>
process_code = #processCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"processOrder"
>
process_order = #processOrder#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"companyCode"
>
<isNotEmpty
prepend=
" AND "
property=
"companyCode"
>
company_code = #companyCode#
company_code = #companyCode#
</isNotEmpty>
</isNotEmpty>
...
@@ -128,6 +136,9 @@
...
@@ -128,6 +136,9 @@
<isNotEmpty
prepend=
" AND "
property=
"updatedTime"
>
<isNotEmpty
prepend=
" AND "
property=
"updatedTime"
>
updated_time = #updatedTime#
updated_time = #updatedTime#
</isNotEmpty>
</isNotEmpty>
<isNotEmpty
property=
"planCodes"
>
plan_code IN
<iterate
close=
")"
open=
"("
conjunction=
","
property=
"planCodes"
>
#planCodes[]#
</iterate>
</isNotEmpty>
</sql>
</sql>
<select
id=
"query"
parameterClass=
"java.util.HashMap"
<select
id=
"query"
parameterClass=
"java.util.HashMap"
...
@@ -139,7 +150,9 @@
...
@@ -139,7 +150,9 @@
tech_flow_id as "techFlowId",
<!-- 工艺流程ID -->
tech_flow_id as "techFlowId",
<!-- 工艺流程ID -->
tech_flow_name as "techFlowName",
<!-- 工艺流程名称 -->
tech_flow_name as "techFlowName",
<!-- 工艺流程名称 -->
invent_process_id as "inventProcessId",
<!-- 存货工序ID,对应HGPZ005A.id -->
invent_process_id as "inventProcessId",
<!-- 存货工序ID,对应HGPZ005A.id -->
process_code as "processCode",
<!-- 工序编码 -->
process_name as "processName",
<!-- 工序名称 -->
process_name as "processName",
<!-- 工序名称 -->
process_order as "processOrder",
<!-- 加工顺序 -->
company_code as "companyCode",
<!-- 公司编码 -->
company_code as "companyCode",
<!-- 公司编码 -->
company_name as "companyName",
<!-- 公司名称 -->
company_name as "companyName",
<!-- 公司名称 -->
dep_code as "depCode",
<!-- 部门编码 -->
dep_code as "depCode",
<!-- 部门编码 -->
...
@@ -281,7 +294,9 @@
...
@@ -281,7 +294,9 @@
tech_flow_id,
<!-- 工艺流程ID -->
tech_flow_id,
<!-- 工艺流程ID -->
tech_flow_name,
<!-- 工艺流程名称 -->
tech_flow_name,
<!-- 工艺流程名称 -->
invent_process_id,
<!-- 存货工序ID,对应HGPZ005A.id -->
invent_process_id,
<!-- 存货工序ID,对应HGPZ005A.id -->
process_code,
<!-- 工序名称 -->
process_name,
<!-- 工序名称 -->
process_name,
<!-- 工序名称 -->
process_order,
<!-- 工序名称 -->
company_code,
<!-- 公司编码 -->
company_code,
<!-- 公司编码 -->
company_name,
<!-- 公司名称 -->
company_name,
<!-- 公司名称 -->
dep_code,
<!-- 部门编码 -->
dep_code,
<!-- 部门编码 -->
...
@@ -306,7 +321,7 @@
...
@@ -306,7 +321,7 @@
updated_name,
<!-- 修改人名称 -->
updated_name,
<!-- 修改人名称 -->
updated_time
<!-- 更新时间 -->
updated_time
<!-- 更新时间 -->
)
)
VALUES (#id#, #matId#, #matDetailId#, #techFlowId#, #techFlowName#, #inventProcessId#, #process
Name
#, #companyCode#, #companyName#, #depCode#, #depName#, #projCode#, #projName#, #planCode#, #productType#, #productCode#, #productName#, #finishDate#, #planStartDate#, #planEndDate#, #quantity#, #finishQuantity#, #unfinishQuantity#, #accountCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#)
VALUES (#id#, #matId#, #matDetailId#, #techFlowId#, #techFlowName#, #inventProcessId#, #process
Code#, #processName#, #processOrder
#, #companyCode#, #companyName#, #depCode#, #depName#, #projCode#, #projName#, #planCode#, #productType#, #productCode#, #productName#, #finishDate#, #planStartDate#, #planEndDate#, #quantity#, #finishQuantity#, #unfinishQuantity#, #accountCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#)
</insert>
</insert>
<delete
id=
"delete"
>
<delete
id=
"delete"
>
...
@@ -322,7 +337,9 @@
...
@@ -322,7 +337,9 @@
tech_flow_id = #techFlowId#,
<!-- 工艺流程ID -->
tech_flow_id = #techFlowId#,
<!-- 工艺流程ID -->
tech_flow_name = #techFlowName#,
<!-- 工艺流程名称 -->
tech_flow_name = #techFlowName#,
<!-- 工艺流程名称 -->
invent_process_id = #inventProcessId#,
<!-- 存货工序ID,对应HGPZ005A.id -->
invent_process_id = #inventProcessId#,
<!-- 存货工序ID,对应HGPZ005A.id -->
process_code = #processCode#,
<!-- 工序名称 -->
process_name = #processName#,
<!-- 工序名称 -->
process_name = #processName#,
<!-- 工序名称 -->
process_order = #processOrder#,
<!-- 工序名称 -->
company_code = #companyCode#,
<!-- 公司编码 -->
company_code = #companyCode#,
<!-- 公司编码 -->
company_name = #companyName#,
<!-- 公司名称 -->
company_name = #companyName#,
<!-- 公司名称 -->
dep_code = #depCode#,
<!-- 部门编码 -->
dep_code = #depCode#,
<!-- 部门编码 -->
...
...
src/main/java/com/baosight/hggp/hg/sc/tools/HGSCTools.java
View file @
aa8d63dd
package
com
.
baosight
.
hggp
.
hg
.
sc
.
tools
;
package
com
.
baosight
.
hggp
.
hg
.
sc
.
tools
;
import
com.baosight.hggp.common.ProductTypeEnum
;
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.core.security.UserSessionUtils
;
import
com.baosight.hggp.hg.constant.HGConstant
;
import
com.baosight.hggp.hg.constant.HGConstant
;
import
com.baosight.hggp.hg.pz.domain.HGPZ005
;
import
com.baosight.hggp.hg.pz.domain.HGPZ005A
;
import
com.baosight.hggp.hg.pz.domain.HGPZ005A
;
import
com.baosight.hggp.hg.pz.tools.HGPZTools
;
import
com.baosight.hggp.hg.pz.tools.HGPZTools
;
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.HGSC005
;
import
com.baosight.hggp.hg.sc.domain.HGSC005A
;
import
com.baosight.hggp.hg.sc.domain.HGSC005A
;
import
com.baosight.hggp.hg.sj.domain.HGSJ001
;
import
com.baosight.hggp.hg.sj.tools.HGSJTools
;
import
com.baosight.hggp.util.AssertUtils
;
import
com.baosight.hggp.util.AssertUtils
;
import
com.baosight.hggp.util.BeanUtils
;
import
com.baosight.hggp.util.BeanUtils
;
import
com.baosight.hggp.util.DateUtil
;
import
com.baosight.iplat4j.ed.util.SequenceGenerator
;
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
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.lang.time.DateUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.math.BigInteger
;
import
java.math.RoundingMode
;
import
java.text.ParseException
;
import
java.util.*
;
import
java.util.*
;
import
java.util.
stream.Collector
;
import
java.util.
concurrent.atomic.AtomicReference
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
static
java
.
math
.
BigDecimal
.
ROUND_DOWN
;
/**
/**
* @Author wwl
* @Author wwl
* @Date 2024/5/7 16:17
* @Date 2024/5/7 16:17
...
@@ -97,7 +109,7 @@ public class HGSCTools {
...
@@ -97,7 +109,7 @@ public class HGSCTools {
hgsc005List
.
forEach
(
hgsc005
->
{
hgsc005List
.
forEach
(
hgsc005
->
{
hgsc005
.
setFinishRate
(
hgsc005
.
setFinishRate
(
MapUtils
.
isNotEmpty
(
finishRateMap
)&&
Objects
.
nonNull
(
finishRateMap
.
get
(
hgsc005
.
getPlanCode
()))?
new
BigDecimal
(
finishRateMap
.
get
(
hgsc005
.
getPlanCode
()))
MapUtils
.
isNotEmpty
(
finishRateMap
)&&
Objects
.
nonNull
(
finishRateMap
.
get
(
hgsc005
.
getPlanCode
()))?
new
BigDecimal
(
finishRateMap
.
get
(
hgsc005
.
getPlanCode
()))
.
setScale
(
0
,
BigDecimal
.
ROUND_DOWN
).
doubleValue
():
0
);
.
setScale
(
0
,
ROUND_DOWN
).
doubleValue
():
0
);
});
});
}
}
return
hgsc005List
;
return
hgsc005List
;
...
@@ -134,7 +146,7 @@ public class HGSCTools {
...
@@ -134,7 +146,7 @@ public class HGSCTools {
AssertUtils
.
isTrue
(
Objects
.
isNull
(
hgsc005
.
getMatId
())||
hgsc005
.
getMatId
()<=
0
,
"物料清单ID不能为空!"
);
AssertUtils
.
isTrue
(
Objects
.
isNull
(
hgsc005
.
getMatId
())||
hgsc005
.
getMatId
()<=
0
,
"物料清单ID不能为空!"
);
AssertUtils
.
isEmpty
(
hgsc005
.
getCompanyCode
(),
"公司编码不能为空!"
);
AssertUtils
.
isEmpty
(
hgsc005
.
getCompanyCode
(),
"公司编码不能为空!"
);
AssertUtils
.
isEmpty
(
hgsc005
.
getCompanyName
(),
"公司名称不能为空!"
);
AssertUtils
.
isEmpty
(
hgsc005
.
getCompanyName
(),
"公司名称不能为空!"
);
// AssertUtils.isEmpty(hgsc005.getDepCode(), "部门
不能为空!");
AssertUtils
.
isEmpty
(
hgsc005
.
getFinishDate
(),
"完工日期
不能为空!"
);
AssertUtils
.
isEmpty
(
hgsc005
.
getProjCode
(),
"项目编号不能为空!"
);
AssertUtils
.
isEmpty
(
hgsc005
.
getProjCode
(),
"项目编号不能为空!"
);
AssertUtils
.
isEmpty
(
hgsc005
.
getProjName
(),
"项目名称不能为空!"
);
AssertUtils
.
isEmpty
(
hgsc005
.
getProjName
(),
"项目名称不能为空!"
);
// AssertUtils.isEmpty(hgsc005.getHgsc005AList(), "计划明细不能为空");
// AssertUtils.isEmpty(hgsc005.getHgsc005AList(), "计划明细不能为空");
...
@@ -154,6 +166,12 @@ public class HGSCTools {
...
@@ -154,6 +166,12 @@ public class HGSCTools {
HGSC005
result
=
(
HGSC005
)
DaoBase
.
getInstance
().
get
(
HGSC005
.
QUERY
,
HGSC005
.
FIELD_mat_id
,
matId
);
HGSC005
result
=
(
HGSC005
)
DaoBase
.
getInstance
().
get
(
HGSC005
.
QUERY
,
HGSC005
.
FIELD_mat_id
,
matId
);
return
result
;
return
result
;
}
}
public
static
HGSC005
queryByPlanCode
(
String
planCode
){
AssertUtils
.
isEmpty
(
planCode
,
"物料清单ID不能为空!"
);
HGSC005
result
=
(
HGSC005
)
DaoBase
.
getInstance
().
get
(
HGSC005
.
QUERY
,
HGSC005
.
FIELD_plan_code
,
planCode
);
return
result
;
}
}
}
public
static
class
THGSC005A
{
public
static
class
THGSC005A
{
...
@@ -166,6 +184,14 @@ public class HGSCTools {
...
@@ -166,6 +184,14 @@ public class HGSCTools {
return
CollectionUtils
.
isEmpty
(
results
)
?
null
:
results
;
return
CollectionUtils
.
isEmpty
(
results
)
?
null
:
results
;
}
}
public
static
List
<
HGSC005A
>
queryByPlanCode
(
String
planCode
){
AssertUtils
.
isEmpty
(
planCode
,
"计划编码不能为空!"
);
Map
paramMap
=
new
HashMap
();
paramMap
.
put
(
HGSC005A
.
FIELD_plan_code
,
planCode
);
List
<
HGSC005A
>
results
=
DaoBase
.
getInstance
().
query
(
HGSC005A
.
QUERY
,
paramMap
);
return
CollectionUtils
.
isEmpty
(
results
)
?
null
:
results
;
}
private
static
List
<
HGSC005A
>
generatorNewPlanDetail
(
HGSC005A
hgsc005a
){
private
static
List
<
HGSC005A
>
generatorNewPlanDetail
(
HGSC005A
hgsc005a
){
...
@@ -177,7 +203,9 @@ public class HGSCTools {
...
@@ -177,7 +203,9 @@ public class HGSCTools {
HGSC005A
obj
=
new
HGSC005A
();
HGSC005A
obj
=
new
HGSC005A
();
BeanUtils
.
copyProperties
(
hgsc005a
,
obj
);
BeanUtils
.
copyProperties
(
hgsc005a
,
obj
);
obj
.
setInventProcessId
(
pz
.
getId
());
obj
.
setInventProcessId
(
pz
.
getId
());
obj
.
setProcessCode
(
pz
.
getProcessCode
());
obj
.
setProcessName
(
pz
.
getProcessName
());
obj
.
setProcessName
(
pz
.
getProcessName
());
obj
.
setProcessOrder
(
pz
.
getProcessOrder
());
hgsc005AList
.
add
(
obj
);
hgsc005AList
.
add
(
obj
);
});
});
return
hgsc005AList
;
return
hgsc005AList
;
...
@@ -303,5 +331,90 @@ public class HGSCTools {
...
@@ -303,5 +331,90 @@ public class HGSCTools {
hgsc005a
.
setFinishQuantity
(
0
);
hgsc005a
.
setFinishQuantity
(
0
);
return
hgsc005a
;
return
hgsc005a
;
}
}
//存货档案单位转换(米)
private
final
static
BigDecimal
unitConver
=
new
BigDecimal
(
1000
);
//基础工时
private
final
static
BigDecimal
baseWorkHour
=
new
BigDecimal
(
8
);
public
static
void
schedule
(
String
planCode
)
{
List
<
HGSC005A
>
hgsc005AList
=
queryByPlanCode
(
planCode
);
hgsc005AList
.
sort
(
Comparator
.
comparing
(
HGSC005A:
:
getProductType
).
thenComparing
(
HGSC005A:
:
getProcessOrder
,
Comparator
.
reverseOrder
()));
//通过工序编码查询工序设置
List
<
String
>
processCodes
=
hgsc005AList
.
stream
().
map
(
HGSC005A:
:
getProcessCode
).
collect
(
Collectors
.
toList
());
List
<
HGSJ001
>
hgsj001List
=
HGSJTools
.
Hgsj001
.
queryByProcessCodes
(
processCodes
);
//通过产品编码查询存货档案
List
<
String
>
productCodes
=
hgsc005AList
.
stream
().
map
(
HGSC005A:
:
getProductCode
).
collect
(
Collectors
.
toList
());
List
<
HGPZ005
>
hgpz005List
=
HGPZTools
.
HgPz005
.
listByInventCodes
(
productCodes
);
//通过存货档案工序ID查询存货档案工序
List
<
Long
>
inventProcessIds
=
hgsc005AList
.
stream
().
map
(
HGSC005A:
:
getInventProcessId
).
collect
(
Collectors
.
toList
());
List
<
HGPZ005A
>
hgpz005AList
=
HGPZTools
.
HgPz005A
.
queryByIds
(
inventProcessIds
);
//筛选计划构建,并按产品分组
Map
<
String
,
List
<
HGSC005A
>>
strctMap
=
hgsc005AList
.
stream
().
filter
(
o
->
o
.
getProductType
().
compareTo
(
ProductTypeEnum
.
STRUCT
.
getCode
())==
0
).
collect
(
Collectors
.
groupingBy
(
HGSC005A:
:
getProductCode
));
List
<
HGSC005A
>
partList
=
hgsc005AList
.
stream
().
filter
(
o
->
o
.
getProductType
().
compareTo
(
ProductTypeEnum
.
PART
.
getCode
())==
0
).
collect
(
Collectors
.
toList
());
String
minDate
=
""
;
BigDecimal
remainder
=
new
BigDecimal
(
0
);
for
(
String
key
:
strctMap
.
keySet
())
{
String
endDate
=
""
;
for
(
HGSC005A
planInfo
:
strctMap
.
get
(
key
)){
remainder
=
calculateWordHour
(
planInfo
,
hgsj001List
,
hgpz005List
,
hgpz005AList
,
endDate
,
remainder
);
if
(
StringUtils
.
isBlank
(
minDate
)){
minDate
=
planInfo
.
getPlanStartDate
();
}
else
{
minDate
=
DateUtil
.
toDate
(
planInfo
.
getPlanStartDate
(),
DateUtil
.
DATE10_PATTERN
).
compareTo
(
DateUtil
.
toDate
(
minDate
,
DateUtil
.
DATE10_PATTERN
))
<=
0
?
planInfo
.
getPlanStartDate
():
minDate
;
}
DaoUtils
.
update
(
HGSC005A
.
UPDATE
,
planInfo
);
}
}
for
(
HGSC005A
planInfo
:
partList
){
remainder
=
calculateWordHour
(
planInfo
,
hgsj001List
,
hgpz005List
,
hgpz005AList
,
minDate
,
remainder
);
minDate
=
DateUtil
.
toDate
(
planInfo
.
getPlanStartDate
(),
DateUtil
.
DATE10_PATTERN
).
compareTo
(
DateUtil
.
toDate
(
minDate
,
DateUtil
.
DATE10_PATTERN
))
<=
0
?
planInfo
.
getPlanStartDate
():
minDate
;
DaoUtils
.
update
(
HGSC005A
.
UPDATE
,
planInfo
);
}
}
private
static
BigDecimal
calculateWordHour
(
HGSC005A
planInfo
,
List
<
HGSJ001
>
hgsj001List
,
List
<
HGPZ005
>
hgpz005List
,
List
<
HGPZ005A
>
hgpz005AList
,
String
endDate
,
BigDecimal
remainder
){
if
(
StringUtils
.
isBlank
(
endDate
)){
endDate
=
planInfo
.
getFinishDate
();
}
planInfo
.
setPlanEndDate
(
endDate
);
AtomicReference
<
BigDecimal
>
workHour
=
new
AtomicReference
<>(
new
BigDecimal
(
0
));
BigDecimal
finalRemainder
=
remainder
;
hgsj001List
.
stream
().
forEach
(
sj
->{
if
(
StringUtils
.
equals
(
sj
.
getProcessCode
(),
planInfo
.
getProcessCode
())){
hgpz005AList
.
forEach
(
productProcess
->
{
if
(
productProcess
.
getId
().
compareTo
(
planInfo
.
getInventProcessId
())==
0
){
BigDecimal
composingCoeff
=
productProcess
.
getComposingCoeff
();
hgpz005List
.
forEach
(
product
->{
if
(
StringUtils
.
equals
(
product
.
getInventCode
(),
planInfo
.
getProductCode
())){
//额定工时
BigDecimal
timing
=
sj
.
getStandardJob
().
multiply
(
sj
.
getStandardDays
()).
divide
(
sj
.
getStandardNum
());
if
(
StringUtils
.
equals
(
sj
.
getUnit
(),
"米"
))
{
workHour
.
set
(
product
.
getLength
().
multiply
(
new
BigDecimal
(
planInfo
.
getQuantity
())).
multiply
(
unitConver
).
multiply
(
composingCoeff
)
.
divide
(
timing
)
.
multiply
(
baseWorkHour
).
add
(
finalRemainder
));
}
else
{
workHour
.
set
(
new
BigDecimal
(
planInfo
.
getQuantity
()).
multiply
(
composingCoeff
)
.
divide
(
timing
)
.
multiply
(
baseWorkHour
).
add
(
finalRemainder
));
}
}
});
}
});
}
});
BigDecimal
day
=
workHour
.
get
().
setScale
(
0
,
ROUND_DOWN
).
divide
(
baseWorkHour
);
remainder
=
workHour
.
get
().
remainder
(
baseWorkHour
);
if
(
day
.
compareTo
(
new
BigDecimal
(
0
))>
0
)
{
endDate
=
DateUtil
.
toDateStr
(
DateUtils
.
addDays
(
DateUtil
.
toDate
(
endDate
,
DateUtil
.
DATE10_PATTERN
),
day
.
intValue
()),
DateUtil
.
DATE10_PATTERN
);
}
planInfo
.
setPlanStartDate
(
endDate
);
return
remainder
;
}
}
}
}
}
src/main/java/com/baosight/hggp/hg/sj/sql/HGSJ001.xml
View file @
aa8d63dd
...
@@ -114,6 +114,9 @@
...
@@ -114,6 +114,9 @@
<isNotEmpty
prepend=
" AND "
property=
"processNames"
>
<isNotEmpty
prepend=
" AND "
property=
"processNames"
>
PROCESS_NAME LIKE CONCAT('%', #processNames#, '%')
PROCESS_NAME LIKE CONCAT('%', #processNames#, '%')
</isNotEmpty>
</isNotEmpty>
<isNotEmpty
property=
"processCodes"
>
PROCESS_CODE IN
<iterate
close=
")"
open=
"("
conjunction=
","
property=
"processCodes"
>
#processCodes[]#
</iterate>
</isNotEmpty>
</sql>
</sql>
<select
id=
"query"
parameterClass=
"java.util.HashMap"
<select
id=
"query"
parameterClass=
"java.util.HashMap"
...
...
src/main/java/com/baosight/hggp/hg/sj/tools/HGSJTools.java
View file @
aa8d63dd
...
@@ -2,7 +2,7 @@ package com.baosight.hggp.hg.sj.tools;
...
@@ -2,7 +2,7 @@ package com.baosight.hggp.hg.sj.tools;
import
com.baosight.hggp.core.dao.DaoBase
;
import
com.baosight.hggp.core.dao.DaoBase
;
import
com.baosight.hggp.core.security.UserSessionUtils
;
import
com.baosight.hggp.core.security.UserSessionUtils
;
import
com.baosight.hggp.hg.s
b.domain.HGSB002A
;
import
com.baosight.hggp.hg.s
j.domain.HGSJ001
;
import
com.baosight.hggp.hg.sj.domain.HGSJ002A
;
import
com.baosight.hggp.hg.sj.domain.HGSJ002A
;
import
com.baosight.hggp.hg.sj.domain.HGSJ003
;
import
com.baosight.hggp.hg.sj.domain.HGSJ003
;
import
com.baosight.hggp.util.AssertUtils
;
import
com.baosight.hggp.util.AssertUtils
;
...
@@ -22,7 +22,18 @@ import java.util.stream.Collectors;
...
@@ -22,7 +22,18 @@ import java.util.stream.Collectors;
*/
*/
public
class
HGSJTools
{
public
class
HGSJTools
{
/**
public
static
class
Hgsj001
{
public
static
List
<
HGSJ001
>
queryByProcessCodes
(
List
<
String
>
processCodes
){
AssertUtils
.
isEmpty
(
processCodes
,
"工序编码不能为空!"
);
Map
paramMap
=
new
HashMap
();
paramMap
.
put
(
"processCodes"
,
processCodes
);
List
<
HGSJ001
>
results
=
DaoBase
.
getInstance
().
query
(
HGSJ001
.
QUERY
,
paramMap
);
return
CollectionUtils
.
isEmpty
(
results
)
?
null
:
results
;
}
}
/**
* Hgsj002a公共DAO方法定义
* Hgsj002a公共DAO方法定义
*/
*/
public
static
class
Hgsj002a
{
public
static
class
Hgsj002a
{
...
...
src/main/java/com/baosight/hggp/util/DateUtil.java
0 → 100644
View file @
aa8d63dd
package
com
.
baosight
.
hggp
.
util
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.Objects
;
/**
* @Author wwl
* @Date 2024/5/20 17:02
*/
public
class
DateUtil
{
protected
static
Logger
logger
=
LogManager
.
getLogger
(
DateUtil
.
class
);
public
static
final
String
DEFAULT_DATE_PATTERN
=
"yyyy-MM-dd"
;
public
static
final
String
DEFAULT_DATETIME_PATTERN
=
"yyyy-MM-dd HH:mm:ss"
;
public
static
final
String
DEFAULT_DATEDETAIL_PATTERN
=
"yyyy-MM-dd HH:mm:ss SSS"
;
public
static
final
String
DATE8_PATTERN
=
"yyyyMMdd"
;
public
static
final
String
DATE10_PATTERN
=
"yyyy-MM-dd"
;
public
static
final
String
DATE11_PATTERN
=
"M月d日"
;
public
static
final
String
TIME6_PATTERN
=
"HHmmss"
;
public
static
final
String
TIME8_PATTERN
=
"HH:mm:ss"
;
public
static
final
String
DATETIME14_PATTERN
=
"yyyyMMddHHmmss"
;
public
static
final
String
DATETIME19_PATTERN
=
"yyyy-MM-dd HH:mm:ss"
;
public
static
final
String
DATEMSEL17_PATTERN
=
"yyyyMMddHHmmssSSS"
;
public
static
final
String
DATEMSEL18_PATTERN
=
"yyyyMMddHHmmssSSSS"
;
/**
* 返回 指定日期时间的
* @param dateStr 日期
* @param day 天数
* @return 返回 dateStr+day后的日期
*/
public
static
String
dateSubStr
(
String
dateStr
,
int
day
)
{
//将时间格式化成yyyyMMdd的格式
SimpleDateFormat
format
=
new
SimpleDateFormat
(
DATE8_PATTERN
);
try
{
//获取当前日期
Date
date
=
format
.
parse
(
dateStr
);
//创建Calendar实例
Calendar
cal
=
Calendar
.
getInstance
();
//设置当前时间
cal
.
setTime
(
date
);
//同理增加一天的方法:
cal
.
add
(
Calendar
.
DATE
,
day
);
return
format
.
format
(
cal
.
getTime
());
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
return
""
;
}
/**、
* 返回月份天数
* @param dateStr 日期
* @return 天数
*/
public
static
int
getDaysOfMonth
(
String
dateStr
)
{
SimpleDateFormat
format
=
new
SimpleDateFormat
(
DATE8_PATTERN
);
try
{
Date
date
=
format
.
parse
(
dateStr
);
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
date
);
return
calendar
.
getActualMaximum
(
Calendar
.
DAY_OF_MONTH
);
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
return
0
;
}
/**
* 返回当前日期的上月日期时间
* @param date
* @return
*/
public
static
String
getMonthOfDays
(
String
date
){
Calendar
calendar
=
Calendar
.
getInstance
();
//日历对象
calendar
.
setTime
(
Objects
.
requireNonNull
(
DateUtil
.
toDate
(
date
,
DATE10_PATTERN
)));
//设置当前日期
calendar
.
add
(
Calendar
.
MONTH
,
-
1
);
//月份减一
return
DateUtil
.
toDateStr
(
calendar
.
getTime
(),
DATE8_PATTERN
);
//输出上个月的日期
}
private
static
SimpleDateFormat
getDateParser
(
String
pattern
)
{
return
new
SimpleDateFormat
(
pattern
);
}
public
static
Date
toDate
(
String
dateString
,
String
pattern
)
{
Date
date
=
null
;
try
{
date
=
getDateParser
(
pattern
).
parse
(
dateString
);
return
date
;
}
catch
(
Exception
var4
)
{
logger
.
warn
(
"解析date字符串时出错,返回null. dateString:"
+
dateString
+
"ex:"
+
var4
);
return
null
;
}
}
public
static
String
toDateStr
(
Date
date
,
String
pattern
)
{
if
(
date
==
null
)
{
if
(
logger
.
isInfoEnabled
())
{
logger
.
info
(
"传入的date对象为空,返回空字符串"
);
}
return
""
;
}
else
{
return
getDateParser
(
pattern
).
format
(
date
);
}
}
}
src/main/webapp/HG/SC/HGSC001.js
View file @
aa8d63dd
...
@@ -50,9 +50,9 @@ $(function () {
...
@@ -50,9 +50,9 @@ $(function () {
$
(
"#BNT_MODIFY"
).
on
(
"click"
,
update
);
$
(
"#BNT_MODIFY"
).
on
(
"click"
,
update
);
//删除
//删除
$
(
"#BNT_REMOVE"
).
on
(
"click"
,
remove
);
$
(
"#BNT_REMOVE"
).
on
(
"click"
,
remove
);
//
删除
//
完工
$
(
"#BNT_COMPLETE"
).
on
(
"click"
,
complete
);
$
(
"#BNT_COMPLETE"
).
on
(
"click"
,
complete
);
//
删除
//
提交
$
(
"#BNT_COMMIT"
).
on
(
"click"
,
commit
);
$
(
"#BNT_COMMIT"
).
on
(
"click"
,
commit
);
},
},
onAdd
:
function
(
e
)
{
onAdd
:
function
(
e
)
{
...
...
src/main/webapp/HG/SC/HGSC005.js
View file @
aa8d63dd
...
@@ -23,8 +23,8 @@ $(function () {
...
@@ -23,8 +23,8 @@ $(function () {
}
}
],
],
loadComplete
:
function
(
grid
)
{
loadComplete
:
function
(
grid
)
{
//
此 grid 对象
//
提交
// 处理父子级联动,通过监听 change 事件,判断父级节点是否发生变化
$
(
"#BNT_COMMIT"
).
on
(
"click"
,
commit
);
},
},
onSuccess
:
function
(
e
)
{
onSuccess
:
function
(
e
)
{
if
(
e
.
eiInfo
.
extAttr
.
methodName
==
'commit'
||
e
.
eiInfo
.
extAttr
.
methodName
==
'delete'
){
if
(
e
.
eiInfo
.
extAttr
.
methodName
==
'commit'
||
e
.
eiInfo
.
extAttr
.
methodName
==
'delete'
){
...
@@ -56,4 +56,36 @@ function showUploadFile(id) {
...
@@ -56,4 +56,36 @@ function showUploadFile(id) {
width
:
"80%"
,
width
:
"80%"
,
height
:
"80%"
,
height
:
"80%"
,
});
});
}
}
\ No newline at end of file
function
commit
()
{
let
rows
=
resultGrid
.
getCheckedRows
()
if
(
rows
.
length
<
1
)
{
message2
(
"提交"
,
"没有选中的行"
);
return
;
}
IPLAT
.
confirm
({
title
:
'提交'
,
message
:
'确认提交此数据么?'
,
okFn
:
function
()
{
var
post
=
new
EiInfo
();
post
.
addBlock
(
resultGrid
.
getCheckedBlockData
());
post
.
set
(
"recursion"
,
true
);
EiCommunicator
.
send
(
"HGSC005"
,
"commit"
,
post
,{
onSuccess
:
function
(
ei
)
{
if
(
ei
.
getStatus
()
>=
0
)
{
NotificationUtil
(
ei
);
resultGrid
.
dataSource
.
query
();
}
else
{
NotificationUtil
(
ei
,
"error"
);
}
},
onFail
:
function
(
ei
)
{
// 发生异常
NotificationUtil
(
"操作失败,原因["
+
ei
+
"]"
,
"error"
);
}
});
}
})
}
src/main/webapp/HG/SC/HGSC005A.js
View file @
aa8d63dd
...
@@ -13,8 +13,8 @@ $(function () {
...
@@ -13,8 +13,8 @@ $(function () {
columns
:
[
columns
:
[
],
],
loadComplete
:
function
(
grid
)
{
loadComplete
:
function
(
grid
)
{
//
此 grid 对象
//
排产
// 处理父子级联动,通过监听 change 事件,判断父级节点是否发生变化
$
(
"#BNT_SCHEDULE"
).
on
(
"click"
,
schedule
);
},
},
onSuccess
:
function
(
e
)
{
onSuccess
:
function
(
e
)
{
if
(
e
.
eiInfo
.
extAttr
.
methodName
==
'save'
||
e
.
eiInfo
.
extAttr
.
methodName
==
'delete'
){
if
(
e
.
eiInfo
.
extAttr
.
methodName
==
'save'
||
e
.
eiInfo
.
extAttr
.
methodName
==
'delete'
){
...
@@ -23,4 +23,33 @@ $(function () {
...
@@ -23,4 +23,33 @@ $(function () {
}
}
}
}
});
});
\ No newline at end of file
function
schedule
()
{
var
planCode
=
$
(
"#inqu_status-0-planCode"
).
val
();
var
inInfo
=
new
EiInfo
();
inInfo
.
set
(
"inqu_status-0-planCode"
,
planCode
);
IPLAT
.
confirm
({
title
:
'提交'
,
message
:
'自动排产将覆盖原排产数据,且只能执行一次,请谨慎操作,确认对当前数据进行排产?'
,
okFn
:
function
()
{
var
inInfo
=
new
EiInfo
();
inInfo
.
set
(
"inqu_status-0-planCode"
,
planCode
);
EiCommunicator
.
send
(
"HGSC005"
,
"schedule"
,
inInfo
,{
onSuccess
:
function
(
ei
)
{
if
(
ei
.
getStatus
()
>=
0
)
{
NotificationUtil
(
ei
);
resultGrid
.
dataSource
.
query
();
}
else
{
NotificationUtil
(
ei
,
"error"
);
}
},
onFail
:
function
(
ei
)
{
// 发生异常
NotificationUtil
(
"操作失败,原因["
+
ei
+
"]"
,
"error"
);
}
});
}
})
}
src/main/webapp/HG/SC/HGSC005A.jsp
View file @
aa8d63dd
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
<EF:EFPage
title=
"生产计划详情"
>
<EF:EFPage
title=
"生产计划详情"
>
<EF:EFRegion
id=
"inqu"
title=
"查询条件"
>
<EF:EFRegion
id=
"inqu"
title=
"查询条件"
>
<div
class=
"row"
>
<div
class=
"row"
>
<EF:EFInput
ename=
"inqu_status-0-planCode"
cname=
"计划编码"
type=
"hidden"
/>
<EF:EFInput
ename=
"inqu_status-0-productName"
cname=
"产品名称"
colWidth=
"3"
/>
<EF:EFInput
ename=
"inqu_status-0-productName"
cname=
"产品名称"
colWidth=
"3"
/>
<EF:EFSelect
cname=
"工序"
ename=
"result-0-processName"
colWidth=
"3"
required=
"true"
filter=
"contains"
>
<EF:EFSelect
cname=
"工序"
ename=
"result-0-processName"
colWidth=
"3"
required=
"true"
filter=
"contains"
>
<EF:EFOptions
blockId=
"plan_process_block_id"
valueField=
"valueField"
textField=
"textField"
/>
<EF:EFOptions
blockId=
"plan_process_block_id"
valueField=
"valueField"
textField=
"textField"
/>
...
...
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