Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit cd57bd4e
由
张少辉
编写于
2026-01-16 10:29:35 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1.料盒操作修改
1 个父辈
e75cbbe0
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
108 行增加
和
208 行删除
src/main/java/com/neotel/smfcore/core/barcode/rest/bean/dto/BarcodeDto.java
src/main/java/com/neotel/smfcore/core/storage/rest/MaterialBoxController.java
src/main/java/com/neotel/smfcore/core/barcode/rest/bean/dto/BarcodeDto.java
查看文件 @
cd57bd4
...
@@ -151,6 +151,8 @@ public class BarcodeDto implements Serializable {
...
@@ -151,6 +151,8 @@ public class BarcodeDto implements Serializable {
@ApiModelProperty
(
"最后一次出库的时间"
)
@ApiModelProperty
(
"最后一次出库的时间"
)
private
Date
checkOutDate
;
private
Date
checkOutDate
;
private
String
pidBarcode
;
/**
/**
* 关联条码,夹具时关联相关的物料,用于入库完成时插入相关物料
* 关联条码,夹具时关联相关的物料,用于入库完成时插入相关物料
*/
*/
...
...
src/main/java/com/neotel/smfcore/core/storage/rest/MaterialBoxController.java
查看文件 @
cd57bd4
...
@@ -3,6 +3,7 @@ package com.neotel.smfcore.core.storage.rest;
...
@@ -3,6 +3,7 @@ package com.neotel.smfcore.core.storage.rest;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.utils.SecurityUtils
;
import
com.neotel.smfcore.common.utils.SecurityUtils
;
import
com.neotel.smfcore.common.utils.StringUtils
;
import
com.neotel.smfcore.core.barcode.bean.CodeBean
;
import
com.neotel.smfcore.core.barcode.bean.CodeBean
;
import
com.neotel.smfcore.core.barcode.enums.COMPONENT_TYPE
;
import
com.neotel.smfcore.core.barcode.enums.COMPONENT_TYPE
;
import
com.neotel.smfcore.core.barcode.rest.bean.dto.BarcodeDto
;
import
com.neotel.smfcore.core.barcode.rest.bean.dto.BarcodeDto
;
...
@@ -85,15 +86,22 @@ public class MaterialBoxController {
...
@@ -85,15 +86,22 @@ public class MaterialBoxController {
throw
new
ValidateException
(
"smfcore.materialBox.invalid"
,
"未找到料盒信息{0}"
,
new
String
[]{
code
});
throw
new
ValidateException
(
"smfcore.materialBox.invalid"
,
"未找到料盒信息{0}"
,
new
String
[]{
code
});
}
}
//先清空barcode的subCode信息,再重新赋值,兼容以前的
List
<
Barcode
>
subCodeList
=
new
ArrayList
<>();
Barcode
subBarcode
=
new
Barcode
();
subBarcode
.
setId
(
barcode
.
getId
());
subBarcode
.
setBarcode
(
barcode
.
getBarcode
());
subBarcode
.
setPartNumber
(
barcode
.
getPartNumber
());
subBarcode
.
setAmount
(
barcode
.
getAmount
());
subBarcode
.
setPidBarcode
(
barcode
.
getPidBarcode
());
subCodeList
.
add
(
subBarcode
);
barcode
.
setSubCodeList
(
subCodeList
);
BarcodeDto
barcodeDto
=
barcodeMapper
.
toDto
(
barcode
);
BarcodeDto
barcodeDto
=
barcodeMapper
.
toDto
(
barcode
);
// if(barcodeDto.getSubCodeMap()==null){
// barcodeDto.setSubCodeMap(new HashMap<>());
// }
if
(
barcodeDto
.
getSubCodeList
()==
null
){
barcodeDto
.
setSubCodeList
(
new
ArrayList
<>());
}
return
barcodeDto
;
return
barcodeDto
;
}
}
@ApiOperation
(
"修改料盒描述信息"
)
@ApiOperation
(
"修改料盒描述信息"
)
@PostMapping
(
"updateDescribe"
)
@PostMapping
(
"updateDescribe"
)
@PreAuthorize
(
"@el.check('materialBox')"
)
@PreAuthorize
(
"@el.check('materialBox')"
)
...
@@ -129,23 +137,29 @@ public class MaterialBoxController {
...
@@ -129,23 +137,29 @@ public class MaterialBoxController {
if
(
barcode
==
null
)
{
if
(
barcode
==
null
)
{
throw
new
ValidateException
(
"smfcore.materialBox.invalid"
,
"未找到料盒信息{0}"
,
new
String
[]{
code
});
throw
new
ValidateException
(
"smfcore.materialBox.invalid"
,
"未找到料盒信息{0}"
,
new
String
[]{
code
});
}
}
Barcode
subBarcode
=
barcode
.
getSubCode
(
subPN
);
if
(!
barcode
.
getPartNumber
().
equals
(
subPN
)){
if
(
subBarcode
==
null
)
{
throw
new
ValidateException
(
"smfcore.materialBox.noReel"
,
"料盒中未找到对应物料"
);
throw
new
ValidateException
(
"smfcore.materialBox.noReel"
,
"料盒中未找到对应物料"
);
}
}
int
opQty
=
Integer
.
valueOf
(
qtyStr
);
int
opQty
=
Integer
.
valueOf
(
qtyStr
);
int
oldAmount
=
barcode
.
getAmount
();
int
oldAmount
=
subBarcode
.
getAmount
();
if
(
oldAmount
<
opQty
)
{
if
(
oldAmount
<
opQty
)
{
throw
new
ValidateException
(
"smfcore.materialBox.quantityshort"
,
"物料数量不足"
);
throw
new
ValidateException
(
"smfcore.materialBox.quantityshort"
,
"物料数量不足"
);
}
}
int
newAmount
=
oldAmount
-
opQty
;
subBarcode
.
setAmount
(
newAmount
);
subBarcode
=
barcodeManager
.
save
(
subBarcode
);
finishTask
(
barcode
,
OP
.
CHECKOUT
,
null
,
subBarcode
,
opQty
);
int
newAmount
=
oldAmount
-
opQty
;
log
.
info
(
subBarcode
.
getPartNumber
()
+
"从料盒["
+
barcode
.
getPosName
()
+
"]出库,物料数量:"
+
oldAmount
+
" - "
+
opQty
+
" = "
+
newAmount
);
barcode
.
setAmount
(
newAmount
);
barcode
=
barcodeManager
.
save
(
barcode
);
//生成出库任务
DataLog
dataLog
=
new
DataLog
();
dataLog
.
setBarcode
(
barcode
.
getBarcode
());
dataLog
.
setNum
(
opQty
);
dataLog
.
setType
(
OP
.
CHECKOUT
);
dataLog
.
setPartNumber
(
barcode
.
getPartNumber
());
dataLog
.
setStatus
(
OP_STATUS
.
FINISHED
.
name
());
dataLogManager
.
save
(
dataLog
);
log
.
info
(
barcode
.
getPartNumber
()
+
"从料盒["
+
barcode
.
getPosName
()
+
"]出库,物料数量:"
+
oldAmount
+
" - "
+
opQty
+
" = "
+
newAmount
);
return
ResultBean
.
newOkResult
(
""
);
return
ResultBean
.
newOkResult
(
""
);
}
}
...
@@ -160,20 +174,21 @@ public class MaterialBoxController {
...
@@ -160,20 +174,21 @@ public class MaterialBoxController {
//料盒不存在
//料盒不存在
throw
new
ValidateException
(
"smfcore.materialBox.invalid"
,
"未找到料盒信息{0}"
,
new
String
[]{
code
});
throw
new
ValidateException
(
"smfcore.materialBox.invalid"
,
"未找到料盒信息{0}"
,
new
String
[]{
code
});
}
}
if
(
barcode
.
getSubCodeList
()==
null
||
barcode
.
getSubCodeList
().
size
()<=
0
){
int
amount
=
barcode
.
getAmount
();
//料盒中未找到对应物料
barcode
.
setAmount
(
0
);
throw
new
ValidateException
(
"smfcore.materialBox.boxNoReel"
,
"料盒中无物料"
);
barcode
.
setPidBarcode
(
""
);
}
barcode
.
setPartNumber
(
""
);
List
<
Barcode
>
barcodes
=
new
ArrayList
<>(
barcode
.
getSubCodeList
()
)
;
barcodeManager
.
save
(
barcode
);
log
.
info
(
barcode
.
getPartNumber
()
+
"从料盒["
+
barcode
.
getPosName
()+
"]全部出库,物料数量:"
+
barcode
.
getAmount
());
for
(
Barcode
subBarcode
:
barcodes
)
{
DataLog
dataLog
=
new
DataLog
();
int
opQty
=
subBarcode
.
getAmount
();
dataLog
.
setBarcode
(
barcode
.
getBarcode
());
subBarcode
.
setAmount
(
0
);
dataLog
.
setNum
(
amount
);
subBarcode
=
barcodeManager
.
save
(
subBarcode
);
dataLog
.
setType
(
OP
.
CHECKOUT
);
finishTask
(
barcode
,
OP
.
CHECKOUT
,
null
,
subBarcode
,
opQty
);
dataLog
.
setPartNumber
(
barcode
.
getPartNumber
());
log
.
info
(
subBarcode
.
getPartNumber
()
+
"从料盒["
+
barcode
.
getPosName
()+
"]全部出库,物料数量:"
+
opQty
);
dataLog
.
setStatus
(
OP_STATUS
.
FINISHED
.
name
());
}
dataLogManager
.
save
(
dataLog
);
return
ResultBean
.
newOkResult
(
""
);
return
ResultBean
.
newOkResult
(
""
);
}
}
...
@@ -182,190 +197,73 @@ public class MaterialBoxController {
...
@@ -182,190 +197,73 @@ public class MaterialBoxController {
@PostMapping
(
value
=
"/operatePos"
)
@PostMapping
(
value
=
"/operatePos"
)
@PreAuthorize
(
"@el.check('materialBox')"
)
@PreAuthorize
(
"@el.check('materialBox')"
)
public
ResultBean
operatePos
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
public
ResultBean
operatePos
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
try
{
String
boxBarcodeStr
=
paramMap
.
get
(
"barcode"
);
String
code
=
paramMap
.
get
(
"barcode"
);
//料盒条码
String
operageStr
=
paramMap
.
get
(
"operatePN"
);
//操作信息
String
operageStr
=
paramMap
.
get
(
"operatePN"
);
//操作信息
String
continuePutIn
=
paramMap
.
get
(
"continuePutIn"
);
DataLog
currentTask
=
null
;
log
.
info
(
"操作料盒["
+
boxBarcodeStr
+
"]的信息为["
+
operageStr
+
"]是否强制入库:"
+
continuePutIn
);
Barcode
barcode
=
barcodeManager
.
findByBarcode
(
code
);
if
(
barcode
==
null
)
{
//判断料盒是否存在
throw
new
ValidateException
(
"smfcore.materialBox.invalid"
,
"未找到料盒信息{0}"
,
new
String
[]{
code
});
Barcode
boxBarcode
=
barcodeManager
.
findByBarcode
(
boxBarcodeStr
);
}
if
(
boxBarcode
==
null
)
{
throw
new
ValidateException
(
"smfcore.materialBox.invalid"
,
"未找到料盒信息{0}"
,
new
String
[]{
boxBarcodeStr
});
}
//1.查找元器件pn是否存在,存在时需要弹框输入数量
//解析要出库的物料信息
//2.pn不存在,解析条码 成功,作为RI处理
Barcode
barcode
=
codeResolve
.
resolveOneValideBarcode
(
"=1x1="
+
operageStr
);
//解析不成功,当做PN自动生成
if
(
barcode
==
null
)
{
int
opQty
=
0
;
throw
new
ValidateException
(
"smfcore.error.barcode.noValidCode"
,
"无效的条码"
);
int
opType
=
OP
.
NON_OP
;
}
Component
component
=
componentManager
.
findOneByPN
(
operageStr
);
String
barcodeStr
=
barcode
.
getBarcode
().
trim
();
if
(
component
!=
null
)
{
return
ResultBean
.
newOkResult
(
operageStr
);
}
String
newCodeStr
=
"=1x1="
+
operageStr
;
CodeBean
codeBean
=
codeResolve
.
resolveSingleCode
(
newCodeStr
);
if
(
codeBean
.
isValid
())
{
Barcode
subBarcode
=
codeBean
.
getBarcode
();
StoragePos
pos
=
storagePosManager
.
getByBarcode
(
subBarcode
.
getBarcode
());
if
(
pos
!=
null
)
{
throw
new
ValidateException
(
"smfcore.materialBox.inPos"
,
"物料已在库位{0}中"
,
new
String
[]{
pos
.
getPosName
()});
}
if
(
subBarcode
.
getHostBarcodeId
()
==
null
)
{
//判断是否存在,其他料箱中
//不存在,入库
StoragePos
pos
=
storagePosManager
.
getByBarcode
(
barcodeStr
);
opQty
=
OP
.
PUT_IN
;
if
(
pos
!=
null
)
{
int
newCount
=
subBarcode
.
getAmount
();
throw
new
ValidateException
(
"smfcore.materialBox.inPos"
,
"物料已在库位{0}中"
,
new
String
[]{
pos
.
getPosName
()});
if
(
newCount
<=
0
)
{
}
newCount
=
1
;
}
subBarcode
.
setHostBarcodeId
(
barcode
.
getId
());
subBarcode
.
setAmount
(
newCount
);
barcodeManager
.
saveBarcode
(
subBarcode
);
finishTask
(
barcode
,
opQty
,
currentTask
,
subBarcode
,
subBarcode
.
getAmount
());
log
.
info
(
"条码"
+
subBarcode
.
getBarcode
()
+
"["
+
subBarcode
.
getPartNumber
()
+
"]入库到料盒["
+
barcode
.
getBarcode
()
+
"]数量:"
+
barcode
.
getAmount
());
}
else
if
(
subBarcode
.
getHostBarcodeId
().
equals
(
barcode
.
getId
()))
{
int
qty
=
subBarcode
.
getAmount
();
//出库
subBarcode
.
setAmount
(
0
);
opQty
=
OP
.
CHECKOUT
;
finishTask
(
barcode
,
opQty
,
currentTask
,
subBarcode
,
qty
);
log
.
info
(
"条码"
+
subBarcode
.
getBarcode
()
+
"["
+
subBarcode
.
getPartNumber
()
+
"]从料盒["
+
barcode
.
getBarcode
()
+
"]出库,数量:"
+
qty
);
}
else
{
//在别的料盒中
Barcode
hostBarcode
=
barcodeManager
.
get
(
subBarcode
.
getHostBarcodeId
());
if
(
hostBarcode
!=
null
)
{
throw
new
ValidateException
(
"smfcore.materialBox.inOtherBox"
,
"物料已在料盒{0}中"
,
new
String
[]{
hostBarcode
.
getBarcode
()});
}
}
return
ResultBean
.
newOkResult
(
""
);
}
else
{
// return ResultBean.newErrorResult(1, codeBean.getErrorCode(), codeBean.getError(), codeBean.getParams());
return
ResultBean
.
newOkResult
(
operageStr
);
}
//设置barcode的入库时间
long
putInTime
=
barcode
.
getPutInTime
();
if
(
putInTime
==
-
1
){
putInTime
=
System
.
currentTimeMillis
();
}
barcode
.
setPutInTime
(
putInTime
);
barcodeManager
.
save
(
barcode
);
//设置料盒的数量
int
amount
=
barcode
.
getAmount
();
String
pidBarcode
=
boxBarcode
.
getPidBarcode
();
if
(
StringUtils
.
isEmpty
(
pidBarcode
)){
amount
=
0
;
}
// //用+或-分割,如果最后几位是数量,按手动输入处理
String
partNumber
=
barcode
.
getPartNumber
();
// String[] codeArray = operageStr.split(" -");
boxBarcode
.
setPartNumber
(
partNumber
);
// String pnStr = "";
boxBarcode
.
setAmount
(
amount
+
boxBarcode
.
getAmount
());
// int opQty = 0;
boxBarcode
.
setPidBarcode
(
barcode
.
getBarcode
());
// int opType = OP.NON_OP;
// if(codeArray.length == 2){
// try{
// opQty = Integer.valueOf(codeArray[1].trim());
// pnStr = codeArray[0].trim();
// opType = OP .CHECKOUT;
// }catch (Exception e){
//
// }
// }
// if(opType == OP.NON_OP){
// codeArray = operageStr.split(" \\+");
// if(codeArray.length == 2){
// try{
// opQty = Integer.valueOf(codeArray[1].trim());
// pnStr = codeArray[0].trim();
// opType = OP.PUT_IN;
// }catch (Exception e){
//
// }
// }
// }
//
// if(opType != OP.NON_OP){
// //手动输入,按PN来处理
// //先查找是否有相同的PN,没有创建一个
// Component component = autoGetComponent(pnStr,opQty);
// //查看该库位中是否有相同的物料,有的话,数量累加
// Barcode subBarcode=barcode.getSubCode(pnStr);
//
// if(opType == OP.PUT_IN) {
// //入库
// if (subBarcode != null) {
// int oldAmount = subBarcode.getAmount();
//
// subBarcode.setHostBarcodeId(barcode.getId());
// subBarcode.setAmount(oldAmount + opQty);
// subBarcode = barcodeManager.save(subBarcode);
//
// finishTask(barcode, opType, currentTask, subBarcode, opQty);
// log.info(subBarcode.getPartNumber() + "入库到料盒[" + barcode.getBarcode() + "],物料数量:" + oldAmount + " + " + opQty + " = " + subBarcode.getAmount());
//
// } else {
// subBarcode=autoGetBarcode(barcode,component,pnStr,opQty);
// finishTask(barcode, opType, currentTask, subBarcode, opQty);
// log.info(barcode.getPartNumber() + "入库到料盒[" + barcode.getBarcode() + "],物料数量:" + barcode.getAmount());
// }
// }else {
// //出库
// if(subBarcode != null){
//
// int oldAmount = subBarcode.getAmount();
// if(oldAmount < opQty){
// throw new ValidateException("smfcore.materialBox.quantityshort","物料数量不足");
// }
// int newAmount = oldAmount - opQty;
//
// subBarcode.setHostBarcodeId(barcode.getId());
// subBarcode.setAmount(newAmount);
// subBarcode = barcodeManager.save(subBarcode);
//
// finishTask(barcode, opType, currentTask,subBarcode, opQty);
// log.info(subBarcode.getPartNumber() + "从料盒["+barcode.getPosName()+"]出库,物料数量:" + oldAmount + " - " + opQty + " = " + newAmount);
// }else{
// //无库存
// throw new ValidateException("smfcore.materialBox.noReel","料盒中未找到对应物料");
// }
// }
//
// }else {
//
// String newCodeStr = "=1x1=" + operageStr;
// CodeBean codeBean = codeResolve.resolveSingleCode(newCodeStr );
// if (codeBean.isValid()) {
// Barcode subBarcode = codeBean.getBarcode();
// StoragePos pos = storagePosManager.getByBarcode(subBarcode.getBarcode());
// if (pos != null) {
// throw new ValidateException("smfcore.materialBox.inPos", "物料已在库位{0}中", new String[]{pos.getPosName()});
// }
//
// if (subBarcode.getHostBarcodeId() == null) {
// //不存在,入库
// opQty = OP.PUT_IN;
// int newCount = subBarcode.getAmount() ;
// if(newCount<=0){
// newCount=1;
// }
// subBarcode.setHostBarcodeId(barcode.getId());
// subBarcode.setAmount(newCount);
// barcodeManager.saveBarcode(subBarcode);
// finishTask(barcode, opQty, currentTask, subBarcode, subBarcode.getAmount());
// log.info("条码" + subBarcode.getBarcode() + "[" + subBarcode.getPartNumber() + "]入库到料盒[" + barcode.getBarcode() + "]数量:" + barcode.getAmount());
// }
// else if (subBarcode.getHostBarcodeId().equals(barcode.getId())) {
// int qty = subBarcode.getAmount();
// //出库
// subBarcode.setAmount(0);
// opQty = OP.CHECKOUT;
// finishTask(barcode, opQty, currentTask, subBarcode, qty);
// log.info("条码" + subBarcode.getBarcode() + "[" + subBarcode.getPartNumber() + "]从料盒[" + barcode.getBarcode() + "]出库,数量:" + qty);
//
// } else {
// //在别的料盒中
// Barcode hostBarcode = barcodeManager.get(subBarcode.getHostBarcodeId());
// if (hostBarcode != null) {
// throw new ValidateException("smfcore.materialBox.inOtherBox", "物料已在料盒{0}中", new String[]{hostBarcode.getBarcode()});
// }
// }
// } else {
// return ResultBean.newErrorResult(1, codeBean.getErrorCode(), codeBean.getError(), codeBean.getParams());
// }
// }
}
catch
(
Exception
e
)
{
//设置治具盒的入库时间
// return "出入库操作出错:" + e.getMessage();
long
boxPutInTime
=
boxBarcode
.
getPutInTime
();
log
.
error
(
e
.
toString
());
if
(
boxPutInTime
==
-
1
){
throw
new
ValidateException
(
"smfcore.error"
,
"出错{0}"
,
new
String
[]{
e
.
toString
()});
boxPutInTime
=
System
.
currentTimeMillis
();
}
if
(
boxPutInTime
>
putInTime
){
boxPutInTime
=
putInTime
;
}
}
// return ResultBean.newOkResult("");
boxBarcode
.
setPutInTime
(
boxPutInTime
);
//boxBarcode.setNeedReturnStorage(false);
barcodeManager
.
save
(
boxBarcode
);
DataLog
dataLog
=
new
DataLog
();
dataLog
.
setBarcode
(
barcode
.
getBarcode
());
dataLog
.
setNum
(
amount
);
dataLog
.
setType
(
OP
.
PUT_IN
);
dataLog
.
setPosName
(
boxBarcode
.
getBarcode
());
dataLog
.
setPartNumber
(
barcode
.
getPartNumber
());
dataLog
.
setStatus
(
OP_STATUS
.
FINISHED
.
name
());
dataLogManager
.
save
(
dataLog
);
return
ResultBean
.
newOkResult
(
""
);
}
}
@ApiOperation
(
"确认操作料盒的物料"
)
@ApiOperation
(
"确认操作料盒的物料"
)
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论