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
20f897c9
Commit
20f897c9
authored
Sep 14, 2024
by
liuyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2024-09-14
1.新增生产订单改派功能 2.生产订单拆单功能调整
parent
d802110d
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
245 additions
and
24 deletions
+245
-24
ServiceHGSC006A.java
...java/com/baosight/hggp/hg/sc/service/ServiceHGSC006A.java
+29
-0
ServiceHGSC006B.java
...java/com/baosight/hggp/hg/sc/service/ServiceHGSC006B.java
+107
-15
HGSC007.xml
src/main/java/com/baosight/hggp/hg/sc/sql/HGSC007.xml
+3
-0
HGSC008.xml
src/main/java/com/baosight/hggp/hg/sc/sql/HGSC008.xml
+3
-0
HGSCTools.java
src/main/java/com/baosight/hggp/hg/sc/tools/HGSCTools.java
+27
-1
HGSC006A.js
src/main/webapp/HG/SC/HGSC006A.js
+67
-6
HGSC006B.js
src/main/webapp/HG/SC/HGSC006B.js
+9
-2
No files found.
src/main/java/com/baosight/hggp/hg/sc/service/ServiceHGSC006A.java
View file @
20f897c9
...
@@ -122,6 +122,35 @@ public class ServiceHGSC006A extends ServiceBase {
...
@@ -122,6 +122,35 @@ public class ServiceHGSC006A extends ServiceBase {
return
inInfo
;
return
inInfo
;
}
}
@OperationLogAnnotation
(
operModul
=
"生产订单详情"
,
operType
=
"批量改派"
,
operDesc
=
"批量改派"
)
public
EiInfo
assignChange
(
EiInfo
inInfo
){
try
{
String
[]
orderDetailIds
=
inInfo
.
getString
(
"ids"
).
split
(
","
);
String
factoryCode
=
inInfo
.
getString
(
"factoryCode"
);
String
factoryName
=
inInfo
.
getString
(
"factoryName"
);
String
groupCode
=
inInfo
.
getString
(
"groupCode"
);
String
groupName
=
inInfo
.
getString
(
"groupName"
);
List
<
HGSC007
>
hgsc007List
=
HGSCTools
.
THGSC007
.
listByOrderDetailId
(
Arrays
.
asList
(
orderDetailIds
));
AssertUtils
.
isEmpty
(
hgsc007List
,
"未查询到生产任务数据!"
);
List
<
Long
>
taskIds
=
hgsc007List
.
stream
().
map
(
HGSC007:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
HGSC008
>
hgsc008List
=
HGSCTools
.
THGSC008
.
getByTaskId
(
taskIds
);
AssertUtils
.
isNotEmpty
(
hgsc008List
,
"生产任务存在已报工,改派失败!"
);
for
(
HGSC007
hgsc007
:
hgsc007List
)
{
// 校验主订单是否已分派
hgsc007
.
setGroupCode
(
groupCode
);
hgsc007
.
setGroupName
(
groupName
);
hgsc007
.
setFactoryCode
(
factoryCode
);
hgsc007
.
setFactoryName
(
factoryName
);
DaoUtils
.
update
(
HGSC007
.
UPDATE
,
hgsc007
);
}
inInfo
.
setStatus
(
EiConstant
.
STATUS_DEFAULT
);
inInfo
.
setMsg
(
"操作成功!本次对["
+
orderDetailIds
.
length
+
"]条数据分派成功!"
);
}
catch
(
Exception
e
)
{
LogUtils
.
setMsg
(
inInfo
,
e
,
"改派失败"
);
}
return
inInfo
;
}
private
void
cleanBaseInfo
(
HGSC007
hgsc007
){
private
void
cleanBaseInfo
(
HGSC007
hgsc007
){
hgsc007
.
setCreatedBy
(
null
);
hgsc007
.
setCreatedBy
(
null
);
hgsc007
.
setCreatedName
(
null
);
hgsc007
.
setCreatedName
(
null
);
...
...
src/main/java/com/baosight/hggp/hg/sc/service/ServiceHGSC006B.java
View file @
20f897c9
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.common.AssignStatusEnum
;
import
com.baosight.hggp.common.ProductTypeEnum
;
import
com.baosight.hggp.common.ProductTypeEnum
;
import
com.baosight.hggp.core.constant.CommonConstant
;
import
com.baosight.hggp.core.constant.CommonConstant
;
import
com.baosight.hggp.core.dao.DaoBase
;
import
com.baosight.hggp.core.dao.DaoBase
;
...
@@ -26,6 +27,8 @@ import java.math.BigDecimal;
...
@@ -26,6 +27,8 @@ import java.math.BigDecimal;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
static
com
.
baosight
.
hggp
.
common
.
AssignStatusEnum
.*;
/**
/**
* 拆单派工
* 拆单派工
*
*
...
@@ -140,25 +143,37 @@ public class ServiceHGSC006B extends ServiceBase {
...
@@ -140,25 +143,37 @@ public class ServiceHGSC006B extends ServiceBase {
// 生产任务号
// 生产任务号
List
<
Long
>
taskIds
=
ObjectUtils
.
listKey
(
resultRows
,
HGSC007
.
FIELD_id
);
List
<
Long
>
taskIds
=
ObjectUtils
.
listKey
(
resultRows
,
HGSC007
.
FIELD_id
);
// 锁主单号
// 锁主单号
HGSCTools
.
THGSC006A
.
lock
(
orderDetailId
);
//
HGSCTools.THGSC006A.lock(orderDetailId);
// 锁子单
// 锁子单
HGSCTools
.
THGSC007
.
lock
(
taskIds
);
//
HGSCTools.THGSC007.lock(taskIds);
// 查询订单信息
// 查询订单信息
HGSC006
hgsc006
=
HGSCTools
.
THGSC006
.
getByOrderCode
(
orderCode
);
HGSC006
hgsc006
=
HGSCTools
.
THGSC006
.
getByOrderCode
(
orderCode
);
HGSC006A
hgsc006A
=
HGSCTools
.
THGSC006A
.
getById
(
orderDetailId
);
HGSC006A
hgsc006A
=
HGSCTools
.
THGSC006A
.
getById
(
orderDetailId
);
List
<
HGSC007
>
hgsc007s
=
MapUtils
.
toDaoEPBases
(
resultRows
,
HGSC007
.
class
);
// 判断数量是否超过订单数量
Integer
totalNum
=
hgsc007s
.
stream
().
mapToInt
(
HGSC007:
:
getQuantity
).
sum
();
AssertUtils
.
isGt
(
new
BigDecimal
(
totalNum
),
new
BigDecimal
(
hgsc006A
.
getQuantity
()),
"拆单的分派数量不能大于生产订单数量!"
);
// 查询任务信息
// 查询任务信息
List
<
HGSC007
>
hgsc007List
=
HGSCTools
.
THGSC007
.
list
(
taskIds
);
List
<
HGSC007
>
hgsc007List
=
HGSCTools
.
THGSC007
.
list
(
taskIds
);
//查询生产报工
List
<
HGSC008
>
hgsc008List
=
HGSCTools
.
THGSC008
.
getByTaskId
(
taskIds
);
AssertUtils
.
isNotEmpty
(
hgsc008List
,
"生产任务存在已报工,拆单失败!"
);
HGPZ005
hgpz005
=
HGPZTools
.
HgPz005
.
get
(
hgsc006A
.
getProductCode
());
HGPZ005
hgpz005
=
HGPZTools
.
HgPz005
.
get
(
hgsc006A
.
getProductCode
());
// 写入数据
// 写入数据
for
(
Map
resultRow
:
resultRows
)
{
for
(
Map
resultRow
:
resultRows
)
{
HGSC007
hgsc007
=
new
HGSC007
();
HGSC007
hgsc007
=
new
HGSC007
();
hgsc007
.
fromMap
(
resultRow
);
hgsc007
.
fromMap
(
resultRow
);
if
(
hgsc007
.
getId
()
==
null
||
hgsc007
.
getId
()
==
0
)
{
if
(
hgsc007
.
getId
()
==
null
||
hgsc007
.
getId
()
==
0
)
{
this
.
add
(
hgsc006
,
hgsc006A
,
hgsc007
,
hgpz005
);
this
.
add
(
hgsc006
,
hgsc006A
,
hgsc007
,
hgpz005
);
}
else
{
}
else
{
this
.
modify
(
hgsc00
6A
,
hgsc00
7
,
hgsc007List
);
this
.
modify
(
hgsc007
,
hgsc007List
);
}
}
}
}
// 更新订单主表数量
this
.
checkAssignedNum
(
hgsc006A
,
totalNum
);
inInfo
=
this
.
query
(
inInfo
);
inInfo
=
this
.
query
(
inInfo
);
// 刷新主订单信息
// 刷新主订单信息
inInfo
=
this
.
refreshOrderInfo
(
inInfo
,
orderDetailId
);
inInfo
=
this
.
refreshOrderInfo
(
inInfo
,
orderDetailId
);
...
@@ -166,7 +181,6 @@ public class ServiceHGSC006B extends ServiceBase {
...
@@ -166,7 +181,6 @@ public class ServiceHGSC006B extends ServiceBase {
inInfo
.
setMsg
(
"操作成功!本次对["
+
resultRows
.
size
()
+
"]条数据操作成功!"
);
inInfo
.
setMsg
(
"操作成功!本次对["
+
resultRows
.
size
()
+
"]条数据操作成功!"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
LogUtils
.
setMsg
(
inInfo
,
e
,
"新增失败"
);
LogUtils
.
setMsg
(
inInfo
,
e
,
"新增失败"
);
inInfo
.
setStatus
(
500
);
}
}
return
inInfo
;
return
inInfo
;
}
}
...
@@ -177,13 +191,11 @@ public class ServiceHGSC006B extends ServiceBase {
...
@@ -177,13 +191,11 @@ public class ServiceHGSC006B extends ServiceBase {
* @param hgsc006A
* @param hgsc006A
* @param hgsc007
* @param hgsc007
*/
*/
private
void
add
(
HGSC006
hgsc006
,
HGSC006A
hgsc006A
,
HGSC007
hgsc007
,
HGPZ005
hgpz005
)
{
private
void
add
(
HGSC006
hgsc006
,
HGSC006A
hgsc006A
,
HGSC007
hgsc007
,
HGPZ005
hgpz005
)
{
Long
orderDetailId
=
hgsc006A
.
getId
();
Long
orderDetailId
=
hgsc006A
.
getId
();
// 数据校验
// 数据校验
AssertUtils
.
isEmpty
(
hgsc007
.
getFactoryCode
(),
"请选择厂区"
);
AssertUtils
.
isEmpty
(
hgsc007
.
getFactoryCode
(),
"请选择厂区"
);
AssertUtils
.
isEmpty
(
hgsc007
.
getGroupCode
(),
"请选择生产组"
);
AssertUtils
.
isEmpty
(
hgsc007
.
getGroupCode
(),
"请选择生产组"
);
// 更新订单主表数量
HGSCTools
.
checkAssignedNum
(
orderDetailId
,
hgsc007
.
getQuantity
());
HGSC007
add007
=
new
HGSC007
();
HGSC007
add007
=
new
HGSC007
();
BeanUtils
.
copyProperties
(
hgsc006A
,
add007
);
BeanUtils
.
copyProperties
(
hgsc006A
,
add007
);
...
@@ -222,12 +234,11 @@ public class ServiceHGSC006B extends ServiceBase {
...
@@ -222,12 +234,11 @@ public class ServiceHGSC006B extends ServiceBase {
/**
/**
* 修改数据
* 修改数据
*
*
* @param hgsc006A
* @param hgsc007
* @param hgsc007
* @param hgsc007List
* @param hgsc007List
*/
*/
private
void
modify
(
HGSC00
6A
hgsc006A
,
HGSC00
7
hgsc007
,
List
<
HGSC007
>
hgsc007List
)
{
private
void
modify
(
HGSC007
hgsc007
,
List
<
HGSC007
>
hgsc007List
)
{
Long
orderDetailId
=
hgsc006A
.
getId
();
/*
Long orderDetailId = hgsc006A.getId();
// 数据校验
// 数据校验
HGSC007 dbSc007 = hgsc007List.stream().filter(o -> o.getId().compareTo(hgsc007.getId())==0).findAny().get();
HGSC007 dbSc007 = hgsc007List.stream().filter(o -> o.getId().compareTo(hgsc007.getId())==0).findAny().get();
AssertUtils.isGt(new BigDecimal(dbSc007.getFinishQuantity()), new BigDecimal(hgsc007.getQuantity()),
AssertUtils.isGt(new BigDecimal(dbSc007.getFinishQuantity()), new BigDecimal(hgsc007.getQuantity()),
...
@@ -235,10 +246,20 @@ public class ServiceHGSC006B extends ServiceBase {
...
@@ -235,10 +246,20 @@ public class ServiceHGSC006B extends ServiceBase {
// 计算差异数量
// 计算差异数量
Integer diffNum = hgsc007.getQuantity() - dbSc007.getQuantity();
Integer diffNum = hgsc007.getQuantity() - dbSc007.getQuantity();
// 更新订单主表数量
// 更新订单主表数量
HGSCTools
.
checkAssignedNum
(
orderDetailId
,
diffNum
);
HGSCTools.checkAssignedNum(orderDetailId, diffNum);
*/
// 更新子单
// 更新子单
hgsc007
.
setTotalWeight
(
hgsc007
.
getSingleWeight
().
multiply
(
new
BigDecimal
(
hgsc007
.
getQuantity
())));
HGSC007
sc007
=
hgsc007List
.
stream
().
filter
(
o
->
o
.
getId
().
equals
(
hgsc007
.
getId
())).
findAny
().
get
();
DaoUtils
.
update
(
HGSC007
.
UPDATE
,
hgsc007
);
AssertUtils
.
isEmpty
(
Collections
.
singleton
(
sc007
),
"未找到生产任务!"
);
sc007
.
setGroupCode
(
hgsc007
.
getGroupCode
());
sc007
.
setGroupName
(
hgsc007
.
getGroupName
());
sc007
.
setFactoryCode
(
hgsc007
.
getFactoryCode
());
sc007
.
setFactoryName
(
hgsc007
.
getFactoryName
());
sc007
.
setQuantity
(
hgsc007
.
getQuantity
());
sc007
.
setUnfinishQuantity
(
hgsc007
.
getQuantity
());
sc007
.
setTotalWeight
(
sc007
.
getSingleWeight
().
multiply
(
new
BigDecimal
(
hgsc007
.
getQuantity
())));
sc007
.
setUnfinishWeight
(
sc007
.
getTotalWeight
());
DaoUtils
.
update
(
HGSC007
.
UPDATE
,
sc007
);
}
}
...
@@ -249,6 +270,7 @@ public class ServiceHGSC006B extends ServiceBase {
...
@@ -249,6 +270,7 @@ public class ServiceHGSC006B extends ServiceBase {
* @return
* @return
*/
*/
@OperationLogAnnotation
(
operModul
=
"拆单派工"
,
operType
=
"删除"
,
operDesc
=
"生产订单-拆单派工A-删除操作"
)
@OperationLogAnnotation
(
operModul
=
"拆单派工"
,
operType
=
"删除"
,
operDesc
=
"生产订单-拆单派工A-删除操作"
)
@Override
public
EiInfo
delete
(
EiInfo
inInfo
)
{
public
EiInfo
delete
(
EiInfo
inInfo
)
{
try
{
try
{
Map
detailMap
=
EiInfoUtils
.
getFirstRow
(
inInfo
,
CommonConstant
.
Field
.
DETAIL
);
Map
detailMap
=
EiInfoUtils
.
getFirstRow
(
inInfo
,
CommonConstant
.
Field
.
DETAIL
);
...
@@ -288,6 +310,76 @@ public class ServiceHGSC006B extends ServiceBase {
...
@@ -288,6 +310,76 @@ public class ServiceHGSC006B extends ServiceBase {
inInfo
.
addBlock
(
CommonConstant
.
Field
.
DETAIL
).
addRow
(
hgsc006A
);
inInfo
.
addBlock
(
CommonConstant
.
Field
.
DETAIL
).
addRow
(
hgsc006A
);
return
inInfo
;
return
inInfo
;
}
}
/**
* 拆单数量校正
*
* @param hgsc006A 生产订单明细
* @param totalNum 任务数量
*/
public
void
checkAssignedNum
(
HGSC006A
hgsc006A
,
Integer
totalNum
)
{
// 生产订单
//HGSC006A hgsc006A = HGSCTools.THGSC006A.getById(orderDetailId);
Integer
jhNum
=
hgsc006A
.
getQuantity
();
Map
updateMap
=
new
HashMap
<>();
updateMap
.
put
(
HGSC006A
.
FIELD_id
,
hgsc006A
.
getId
());
updateMap
.
put
(
HGSC006A
.
FIELD_assign_quantity
,
totalNum
);
updateMap
.
put
(
HGSC006A
.
FIELD_unassign_quantity
,
jhNum
-
totalNum
);
if
(
Objects
.
nonNull
(
hgsc006A
.
getSingleWeight
())&&
hgsc006A
.
getSingleWeight
().
compareTo
(
BigDecimal
.
ZERO
)>
0
)
{
BigDecimal
assignWeight
=
hgsc006A
.
getSingleWeight
().
multiply
(
new
BigDecimal
(
totalNum
));
updateMap
.
put
(
HGSC006A
.
FIELD_assign_weight
,
assignWeight
);
updateMap
.
put
(
HGSC006A
.
FIELD_unassign_weight
,
hgsc006A
.
getTotalWeight
().
subtract
(
assignWeight
));
}
// 0.未派工,1.部分派工,2.全部派工
AssignStatusEnum
orderDetailAssignStatus
;
if
(
jhNum
-
totalNum
==
0
)
{
orderDetailAssignStatus
=
ASSIGNED
;
}
else
if
(
totalNum
>
0
)
{
orderDetailAssignStatus
=
PARTIAL_ASSIGN
;
}
else
{
orderDetailAssignStatus
=
UNASSIGN
;
}
updateMap
.
put
(
HGSC006A
.
FIELD_assign_status
,
orderDetailAssignStatus
.
getCode
());
DaoUtils
.
update
(
HGSC006A
.
UPDATE_ASSIGN_NUM
,
updateMap
);
handleOrderAssignStatus
(
hgsc006A
,
orderDetailAssignStatus
);
}
private
void
handleOrderAssignStatus
(
HGSC006A
hgsc006A
,
AssignStatusEnum
orderDetailAssignStatus
){
List
<
HGSC006A
>
otherSc006AList
=
HGSCTools
.
THGSC006A
.
otherById
(
hgsc006A
.
getOrderCode
(),
hgsc006A
.
getId
());
int
assignQuantity
=
0
;
int
unassignQuantity
=
0
;
int
totalQuantity
=
0
;
if
(
CollectionUtils
.
isNotEmpty
(
otherSc006AList
)){
assignQuantity
=
otherSc006AList
.
stream
().
mapToInt
(
HGSC006A:
:
getAssignQuantity
).
sum
();
unassignQuantity
=
otherSc006AList
.
stream
().
mapToInt
(
HGSC006A:
:
getUnassignQuantity
).
sum
();
totalQuantity
=
otherSc006AList
.
stream
().
mapToInt
(
HGSC006A:
:
getQuantity
).
sum
();
}
AssignStatusEnum
orderAssignStatus
;
switch
(
orderDetailAssignStatus
){
case
UNASSIGN:
if
(
unassignQuantity
==
totalQuantity
){
orderAssignStatus
=
UNASSIGN
;
}
else
{
orderAssignStatus
=
PARTIAL_ASSIGN
;
}
break
;
case
PARTIAL_ASSIGN:
orderAssignStatus
=
PARTIAL_ASSIGN
;
break
;
case
ASSIGNED:
if
(
assignQuantity
==
totalQuantity
){
orderAssignStatus
=
ASSIGNED
;
}
else
{
orderAssignStatus
=
PARTIAL_ASSIGN
;
}
break
;
default
:
throw
new
PlatException
(
"派工状态异常!"
);
}
Map
updateMap
=
new
HashMap
();
updateMap
.
put
(
HGSC006
.
FIELD_order_code
,
hgsc006A
.
getOrderCode
());
updateMap
.
put
(
HGSC006
.
FIELD_assign_status
,
orderAssignStatus
.
getCode
());
DaoUtils
.
update
(
HGSC006
.
UPDATE_ASSIGN_STATUS
,
updateMap
);
}
}
}
src/main/java/com/baosight/hggp/hg/sc/sql/HGSC007.xml
View file @
20f897c9
...
@@ -177,6 +177,9 @@
...
@@ -177,6 +177,9 @@
<isNotEmpty
prepend=
" AND "
property=
"ids"
>
<isNotEmpty
prepend=
" AND "
property=
"ids"
>
id IN
<iterate
close=
")"
open=
"("
conjunction=
","
property=
"ids"
>
#ids[]#
</iterate>
id IN
<iterate
close=
")"
open=
"("
conjunction=
","
property=
"ids"
>
#ids[]#
</iterate>
</isNotEmpty>
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"orderDetailIds"
>
order_detail_id IN
<iterate
close=
")"
open=
"("
conjunction=
","
property=
"orderDetailIds"
>
#orderDetailIds[]#
</iterate>
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"companyCodes"
>
<isNotEmpty
prepend=
" AND "
property=
"companyCodes"
>
COMPANY_CODE IN
<iterate
close=
")"
open=
"("
conjunction=
","
property=
"companyCodes"
>
#companyCodes[]#
</iterate>
COMPANY_CODE IN
<iterate
close=
")"
open=
"("
conjunction=
","
property=
"companyCodes"
>
#companyCodes[]#
</iterate>
</isNotEmpty>
</isNotEmpty>
...
...
src/main/java/com/baosight/hggp/hg/sc/sql/HGSC008.xml
View file @
20f897c9
...
@@ -55,6 +55,9 @@
...
@@ -55,6 +55,9 @@
<isNotEmpty
prepend=
" AND "
property=
"taskId"
>
<isNotEmpty
prepend=
" AND "
property=
"taskId"
>
task_id = #taskId#
task_id = #taskId#
</isNotEmpty>
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"taskIds"
>
task_id IN
<iterate
close=
")"
open=
"("
conjunction=
","
property=
"taskIds"
>
#taskIds[]#
</iterate>
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"techFlowId"
>
<isNotEmpty
prepend=
" AND "
property=
"techFlowId"
>
tech_flow_id = #techFlowId#
tech_flow_id = #techFlowId#
</isNotEmpty>
</isNotEmpty>
...
...
src/main/java/com/baosight/hggp/hg/sc/tools/HGSCTools.java
View file @
20f897c9
...
@@ -106,7 +106,7 @@ public class HGSCTools {
...
@@ -106,7 +106,7 @@ public class HGSCTools {
// 判断数量是否超过订单数量
// 判断数量是否超过订单数量
AssertUtils
.
isGt
(
new
BigDecimal
(
totalNum
),
new
BigDecimal
(
jhNum
),
"拆单的分派数量不能大于生产订单数量!"
);
AssertUtils
.
isGt
(
new
BigDecimal
(
totalNum
),
new
BigDecimal
(
jhNum
),
"拆单的分派数量不能大于生产订单数量!"
);
Map
updateMap
=
new
HashMap
();
Map
updateMap
=
new
HashMap
();
updateMap
.
put
(
hgsc
006A
.
FIELD_id
,
hgsc006A
.
getId
());
updateMap
.
put
(
HGSC
006A
.
FIELD_id
,
hgsc006A
.
getId
());
updateMap
.
put
(
HGSC006A
.
FIELD_assign_quantity
,
totalNum
);
updateMap
.
put
(
HGSC006A
.
FIELD_assign_quantity
,
totalNum
);
updateMap
.
put
(
HGSC006A
.
FIELD_unassign_quantity
,
jhNum
-
totalNum
);
updateMap
.
put
(
HGSC006A
.
FIELD_unassign_quantity
,
jhNum
-
totalNum
);
if
(
Objects
.
nonNull
(
hgsc006A
.
getSingleWeight
())&&
hgsc006A
.
getSingleWeight
().
compareTo
(
BigDecimal
.
ZERO
)>
0
)
{
if
(
Objects
.
nonNull
(
hgsc006A
.
getSingleWeight
())&&
hgsc006A
.
getSingleWeight
().
compareTo
(
BigDecimal
.
ZERO
)>
0
)
{
...
@@ -1539,6 +1539,21 @@ public class HGSCTools {
...
@@ -1539,6 +1539,21 @@ public class HGSCTools {
queryMap
.
put
(
"ids"
,
taskIds
);
queryMap
.
put
(
"ids"
,
taskIds
);
return
DaoBase
.
getInstance
().
query
(
HGSC007
.
QUERY
,
queryMap
);
return
DaoBase
.
getInstance
().
query
(
HGSC007
.
QUERY
,
queryMap
);
}
}
/**
* 查询生产订单信息
*
* @param orderDetailIds
* @return
*/
public
static
List
<
HGSC007
>
listByOrderDetailId
(
List
<
String
>
orderDetailIds
)
{
if
(
CollectionUtils
.
isEmpty
(
orderDetailIds
))
{
return
null
;
}
Map
<
String
,
Object
>
queryMap
=
new
HashMap
<>();
queryMap
.
put
(
"orderDetailIds"
,
orderDetailIds
);
return
DaoBase
.
getInstance
().
query
(
HGSC007
.
QUERY
,
queryMap
);
}
}
}
...
@@ -1561,6 +1576,17 @@ public class HGSCTools {
...
@@ -1561,6 +1576,17 @@ public class HGSCTools {
}});
}});
return
CollectionUtils
.
isEmpty
(
results
)
?
null
:
results
;
return
CollectionUtils
.
isEmpty
(
results
)
?
null
:
results
;
}
}
public
static
List
<
HGSC008
>
getByTaskId
(
List
<
Long
>
taskIds
)
{
if
(
CollectionUtils
.
isEmpty
(
taskIds
))
{
return
null
;
}
List
<
HGSC008
>
results
=
DaoBase
.
getInstance
().
query
(
HGSC008
.
QUERY
,
new
HashMap
<
String
,
Object
>()
{{
put
(
"taskIds"
,
taskIds
);
}});
return
CollectionUtils
.
isEmpty
(
results
)
?
null
:
results
;
}
public
static
HGSC008
add
(
EiInfo
info
)
{
public
static
HGSC008
add
(
EiInfo
info
)
{
Map
resultMap
=
EiInfoUtils
.
getFirstRow
(
info
,
EiConstant
.
resultBlock
);
Map
resultMap
=
EiInfoUtils
.
getFirstRow
(
info
,
EiConstant
.
resultBlock
);
...
...
src/main/webapp/HG/SC/HGSC006A.js
View file @
20f897c9
...
@@ -16,10 +16,8 @@ $(function () {
...
@@ -16,10 +16,8 @@ $(function () {
field
:
"operator"
,
field
:
"operator"
,
template
:
function
(
item
)
{
template
:
function
(
item
)
{
let
template
=
""
;
let
template
=
""
;
if
(
item
.
unassignQuantity
>
0
){
template
+=
'<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
template
+=
'<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+
'onclick="separateAssign('
+
item
.
id
+
')" >拆单派工</a>'
;
+
'onclick="separateAssign('
+
item
.
id
+
')" >拆单派工</a>'
;
}
template
+=
'<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+
template
+=
'<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+
'onclick="showTaskInfo('
+
item
.
id
+
')" >任务详情</a>'
;
'onclick="showTaskInfo('
+
item
.
id
+
')" >任务详情</a>'
;
return
template
;
return
template
;
...
@@ -28,6 +26,8 @@ $(function () {
...
@@ -28,6 +26,8 @@ $(function () {
loadComplete
:
function
(
grid
)
{
loadComplete
:
function
(
grid
)
{
// 批量分派
// 批量分派
$
(
"#BNT_ASSIGN"
).
on
(
"click"
,
assign
);
$
(
"#BNT_ASSIGN"
).
on
(
"click"
,
assign
);
// 批量改派
$
(
"#BNT_ASSIGN_CHANGE"
).
on
(
"click"
,
assignChange
);
},
},
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'
){
...
@@ -83,8 +83,8 @@ function assign() {
...
@@ -83,8 +83,8 @@ function assign() {
JSColorbox
.
open
({
JSColorbox
.
open
({
href
:
"HGSC098?methodName=initLoad&inqu_status-0-companyCode="
+
companyCode
+
"&inqu_status-0-productType="
+
productType
,
href
:
"HGSC098?methodName=initLoad&inqu_status-0-companyCode="
+
companyCode
+
"&inqu_status-0-productType="
+
productType
,
title
:
"<div style='text-align: center;'>选择组织</div>"
,
title
:
"<div style='text-align: center;'>选择组织</div>"
,
width
:
"
90
%"
,
width
:
"
75
%"
,
height
:
"
90
%"
,
height
:
"
75
%"
,
callbackName
:
function
(
row
)
{
callbackName
:
function
(
row
)
{
var
info
=
new
EiInfo
()
var
info
=
new
EiInfo
()
info
.
set
(
"ids"
,
ids
.
join
(
','
));
info
.
set
(
"ids"
,
ids
.
join
(
','
));
...
@@ -114,6 +114,67 @@ function assign() {
...
@@ -114,6 +114,67 @@ function assign() {
}
}
}
}
function
assignChange
()
{
//重置全局变量
ids
=
[];
let
rows
=
resultGrid
.
getCheckedRows
()
if
(
rows
.
length
<
1
)
{
message
(
"请至少选择一条需要改派的数据"
);
return
;
}
let
productType
=
rows
[
0
].
get
(
"productType"
);
let
flag
=
true
;
$
.
each
(
rows
,
function
(
index
,
item
)
{
let
compareProductType
=
item
.
get
(
"productType"
);
ids
.
push
(
item
.
id
)
if
(
productType
!=
compareProductType
){
message
(
`选中第
${
index
+
1
}
行的生产订单不属于同一工种,无法改派!`
)
flag
=
false
;
return
false
;
}
if
(
item
.
assignStatus
==
0
){
message
(
`选中第
${
index
+
1
}
行的生产订单未派工,无法改派!`
)
flag
=
false
;
return
false
;
}
});
if
(
flag
)
{
let
companyCode
=
rows
[
0
].
companyCode
;
JSColorbox
.
open
({
href
:
"HGSC098?methodName=initLoad&inqu_status-0-companyCode="
+
companyCode
+
"&inqu_status-0-productType="
+
productType
,
title
:
"<div style='text-align: center;'>改派订单</div>"
,
width
:
"75%"
,
height
:
"75%"
,
callbackName
:
function
(
row
)
{
var
info
=
new
EiInfo
()
info
.
set
(
"ids"
,
ids
.
join
(
','
));
info
.
set
(
"factoryCode"
,
row
.
factoryCode
);
info
.
set
(
"factoryName"
,
row
.
factoryName
);
info
.
set
(
"groupCode"
,
row
.
groupCode
);
info
.
set
(
"groupName"
,
row
.
groupName
);
EiCommunicator
.
send
(
"HGSC006A"
,
"assignChange"
,
info
,
{
onSuccess
:
function
(
ei
)
{
if
(
ei
[
"status"
]
==
-
1
)
{
NotificationUtil
(
ei
,
"error"
);
}
else
{
NotificationUtil
({
msg
:
ei
.
msg
});
// 刷新列表
query
();
// 关闭弹窗
JSColorbox
.
close
();
}
},
onFail
:
function
(
ei
)
{
// 服务调用失败后的回调函数
NotificationUtil
(
ei
,
"error"
);
}
},
{
async
:
false
});
}
});
}
}
function
separateAssign
(
orderDetailId
){
function
separateAssign
(
orderDetailId
){
JSColorbox
.
open
({
JSColorbox
.
open
({
...
...
src/main/webapp/HG/SC/HGSC006B.js
View file @
20f897c9
...
@@ -132,11 +132,13 @@ $(window).load(function () {
...
@@ -132,11 +132,13 @@ $(window).load(function () {
* 保存
* 保存
*/
*/
let
save
=
function
()
{
let
save
=
function
()
{
let
rows
=
resultGrid
.
get
CheckedRow
s
();
let
rows
=
resultGrid
.
get
DataItem
s
();
if
(
rows
.
length
<
1
)
{
if
(
rows
.
length
<
1
)
{
message
(
"请选择数据"
);
message
(
"请选择数据"
);
return
;
return
;
}
}
let
quantity
=
$
(
"#detail-0-quantity"
).
val
();
let
taskQuantity
=
0
;
for
(
let
i
=
0
;
i
<
rows
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
rows
.
length
;
i
++
)
{
if
(
isBlank
(
rows
[
i
][
'factoryCode'
]))
{
if
(
isBlank
(
rows
[
i
][
'factoryCode'
]))
{
message
(
"勾选的第"
+
(
i
+
1
)
+
"行
\"
厂区
\"
,不能为空"
);
message
(
"勾选的第"
+
(
i
+
1
)
+
"行
\"
厂区
\"
,不能为空"
);
...
@@ -154,10 +156,15 @@ let save = function () {
...
@@ -154,10 +156,15 @@ let save = function () {
message
(
"勾选的第"
+
(
i
+
1
)
+
"行
\"
分派数量
\"
必须是大于0的整数"
);
message
(
"勾选的第"
+
(
i
+
1
)
+
"行
\"
分派数量
\"
必须是大于0的整数"
);
return
;
return
;
}
}
taskQuantity
+=
parseInt
(
rows
[
i
][
'quantity'
]);
}
if
(
taskQuantity
>
parseInt
(
quantity
)){
message
(
"分派数量不能大于订单数量"
);
return
;
}
}
JSUtils
.
confirm
(
"确定对勾选中的["
+
rows
.
length
+
"]条数据做
\"
保存
\"
操作? "
,
{
JSUtils
.
confirm
(
"确定对勾选中的["
+
rows
.
length
+
"]条数据做
\"
保存
\"
操作? "
,
{
ok
:
function
()
{
ok
:
function
()
{
JSUtils
.
submitGrid
sData
(
"result"
,
"HGSC006B"
,
"save"
,
true
);
JSUtils
.
submitGrid
(
"result"
,
"HGSC006B"
,
"save"
,
{
isAlldata
:
true
}
);
}
}
});
});
}
}
...
...
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