Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
smf-core
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 7068f592
由
zshaohui
编写于
2024-08-12 09:38:10 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
手动单据退料 提交
1 个父辈
f04e3203
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
238 行增加
和
0 行删除
src/main/java/com/neotel/smfcore/custom/luxsan/api/bean/request/TicketUpRequest.java
src/main/java/com/neotel/smfcore/custom/luxsan/factory_c/rawstor/controller/manual/ManualTicketReturnController.java
src/main/java/com/neotel/smfcore/custom/luxsan/api/bean/request/TicketUpRequest.java
查看文件 @
7068f59
...
...
@@ -2,10 +2,12 @@ package com.neotel.smfcore.custom.luxsan.api.bean.request;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.List
;
@Data
@NoArgsConstructor
@AllArgsConstructor
public
class
TicketUpRequest
{
private
String
PLANT_CODE
;
...
...
src/main/java/com/neotel/smfcore/custom/luxsan/factory_c/rawstor/controller/manual/ManualTicketReturnController.java
0 → 100644
查看文件 @
7068f59
package
com
.
neotel
.
smfcore
.
custom
.
luxsan
.
factory_c
.
rawstor
.
controller
.
manual
;
import
com.neotel.smfcore.common.bean.ResultBean
;
import
com.neotel.smfcore.common.exception.ValidateException
;
import
com.neotel.smfcore.common.utils.StringUtils
;
import
com.neotel.smfcore.core.api.SmfApi
;
import
com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager
;
import
com.neotel.smfcore.core.barcode.service.manager.IComponentManager
;
import
com.neotel.smfcore.core.barcode.service.po.Barcode
;
import
com.neotel.smfcore.core.barcode.service.po.Component
;
import
com.neotel.smfcore.core.barcode.utils.CodeResolve
;
import
com.neotel.smfcore.core.device.enums.OP
;
import
com.neotel.smfcore.core.device.enums.OP_STATUS
;
import
com.neotel.smfcore.core.storage.service.manager.IStoragePosManager
;
import
com.neotel.smfcore.core.storage.service.po.StoragePos
;
import
com.neotel.smfcore.core.system.service.po.DataLog
;
import
com.neotel.smfcore.core.system.util.TaskService
;
import
com.neotel.smfcore.custom.luxsan.api.LuxsanApi
;
import
com.neotel.smfcore.custom.luxsan.api.bean.request.BrandQtyRequest
;
import
com.neotel.smfcore.custom.luxsan.api.bean.request.TicketPickLabelList
;
import
com.neotel.smfcore.custom.luxsan.api.bean.request.TicketPickRequest
;
import
com.neotel.smfcore.custom.luxsan.api.bean.request.TicketUpRequest
;
import
com.neotel.smfcore.custom.luxsan.api.bean.result.BrandQtyResult
;
import
com.neotel.smfcore.custom.luxsan.api.bean.result.TicketUpResult
;
import
com.neotel.smfcore.custom.luxsan.factory_c.common.util.CommonUtil
;
import
com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util.BinCacheUtil
;
import
com.neotel.smfcore.custom.luxsan.factory_c.rawstor.util.BoxHandleUtil
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.*
;
@ApiOperation
(
"手动单据退料"
)
@Slf4j
@RequestMapping
(
"/manualTicketReturn"
)
@RestController
public
class
ManualTicketReturnController
{
@Autowired
private
CodeResolve
codeResolve
;
@Autowired
private
IComponentManager
componentManager
;
@Autowired
private
IStoragePosManager
storagePosManager
;
@Autowired
private
SmfApi
smfApi
;
@Autowired
private
IBarcodeManager
barcodeManager
;
@Autowired
private
TaskService
taskService
;
@ApiOperation
(
"料盘入到隔口"
)
@RequestMapping
(
"/reelToBox"
)
//@AnonymousAccess
public
synchronized
ResultBean
reelToBox
(
@RequestBody
Map
<
String
,
String
>
paramMap
)
{
String
ticketCode
=
paramMap
.
get
(
"ticketCode"
);
//单据号
String
ticketItem
=
paramMap
.
get
(
"ticketItem"
);
//单据行
String
binCode
=
paramMap
.
get
(
"binCode"
);
//料格信息
String
codeStr
=
paramMap
.
get
(
"codeStr"
);
//条码信息
String
boxStr
=
paramMap
.
get
(
"boxStr"
);
//料箱信息
//String dstWarehouse = paramMap.get("dstWarehouse"); //目的库别
String
materialCode
=
paramMap
.
get
(
"materialCode"
);
//料号
log
.
info
(
"人工单据退料,料格信息为:"
+
binCode
+
",单据行:"
+
ticketCode
+
"单据号:"
+
ticketItem
+
"条码信息为:"
+
codeStr
);
if
(
StringUtils
.
isEmpty
(
ticketCode
))
{
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.valueCanotNull"
,
"{0}不能为空"
,
new
String
[]{
"单据号"
});
}
if
(
StringUtils
.
isEmpty
(
ticketItem
))
{
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.valueCanotNull"
,
"{0}不能为空"
,
new
String
[]{
"单据行"
});
}
if
(
StringUtils
.
isEmpty
(
binCode
))
{
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.valueCanotNull"
,
"{0}不能为空"
,
new
String
[]{
"料格信息"
});
}
if
(
StringUtils
.
isEmpty
(
codeStr
))
{
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.valueCanotNull"
,
"{0}不能为空"
,
new
String
[]{
"条码信息"
});
}
if
(
StringUtils
.
isEmpty
(
boxStr
))
{
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.valueCanotNull"
,
"{0}不能为空"
,
new
String
[]{
"料箱信息"
});
}
if
(
StringUtils
.
isEmpty
(
materialCode
))
{
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.valueCanotNull"
,
"{0}不能为空"
,
new
String
[]{
"料号"
});
}
codeStr
=
codeStr
.
toUpperCase
(
Locale
.
ROOT
);
binCode
=
binCode
.
toUpperCase
(
Locale
.
ROOT
);
boxStr
=
boxStr
.
toUpperCase
(
Locale
.
ROOT
);
Barcode
noDbBarcode
=
codeResolve
.
resolveCode
(
codeStr
);
if
(
noDbBarcode
==
null
)
{
return
ResultBean
.
newErrorResult
(-
1
,
"smfcore.error.barcode.noValidCode"
,
"条码无效"
);
}
if
(!
materialCode
.
equals
(
noDbBarcode
.
getPartNumber
()))
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
materialCode
+
"与料盘上的料号:"
+
noDbBarcode
.
getPartNumber
()
+
"不一致"
);
}
int
w
=
7
;
int
h
=
8
;
Component
component
=
null
;
if
(
component
==
null
)
{
BrandQtyResult
result
=
LuxsanApi
.
brandQtyUrl
(
new
BrandQtyRequest
(
noDbBarcode
.
getPartNumber
(),
noDbBarcode
.
getProvider
()));
if
(
result
==
null
)
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
"未维护对应的尺寸信息"
);
}
w
=
result
.
getReel_size
();
if
(
w
==
7
)
{
h
=
8
;
}
else
if
(
w
==
13
)
{
h
=
24
;
}
else
if
(
w
==
15
)
{
h
=
32
;
}
}
else
{
w
=
component
.
getPlateSize
();
h
=
component
.
getHeight
();
}
//判断条码是否正常
Barcode
barcode
=
null
;
try
{
barcode
=
codeResolve
.
resolveOneValideBarcode
(
"="
+
w
+
"x"
+
h
+
"="
+
codeStr
);
}
catch
(
ValidateException
ve
)
{
return
ResultBean
.
newErrorResult
(-
1
,
ve
.
getMsgKey
(),
ve
.
getDefaultMsg
());
}
//判断是否存在料箱中
if
(
StringUtils
.
isNotEmpty
(
barcode
.
getPosName
()))
{
log
.
info
(
barcode
.
getBarcode
()
+
"已经存在料格"
+
barcode
.
getPosName
());
return
ResultBean
.
newErrorResult
(-
1
,
""
,
barcode
.
getBarcode
()
+
"已经存在料格"
+
barcode
.
getPosName
());
}
//找到box信息
Barcode
boxBarcode
=
null
;
StoragePos
inPos
=
null
;
try
{
boxBarcode
=
codeResolve
.
resolveOneValideBarcode
(
boxStr
);
inPos
=
storagePosManager
.
getByBarcode
(
boxBarcode
.
getBarcode
());
if
(
inPos
!=
null
)
{
boxBarcode
=
inPos
.
getBarcode
();
}
}
catch
(
ValidateException
ve
)
{
return
ResultBean
.
newErrorResult
(-
1
,
ve
.
getMsgKey
(),
"料箱条码不正确:"
+
boxStr
);
}
//判断料格条码和料箱是否匹配
if
(!
binCode
.
startsWith
(
boxBarcode
.
getBarcode
()))
{
return
ResultBean
.
newErrorResult
(-
1
,
""
,
"当前扫描的隔口"
+
binCode
+
"与料箱信息:"
+
boxStr
+
"不匹配"
);
}
//判断是否为禁用料
barcode
=
smfApi
.
canPutInAfterResolve
(
barcode
);
//barcode.setWarehouseCode(dstWarehouse);
//判断隔口能否放入
if
(
boxBarcode
!=
null
)
{
String
canPutIn
=
BinCacheUtil
.
canMaterialPutInBin
(
barcode
,
boxBarcode
,
binCode
);
if
(
StringUtils
.
isEmpty
(
canPutIn
))
{
TicketUpRequest
request
=
new
TicketUpRequest
();
request
.
setPLANT_CODE
(
CommonUtil
.
plantCode
);
request
.
setTICKET_CODE
(
ticketCode
);
request
.
setTICKET_ITEM
(
ticketItem
);
request
.
setBIN_CODE
(
binCode
);
request
.
setREEL_LIST
(
Arrays
.
asList
(
barcode
.
getBarcode
()));
request
.
setQTY
(
barcode
.
getAmount
());
TicketUpResult
ticketUp
=
LuxsanApi
.
ticketUp
(
request
);
barcode
.
setPosName
(
binCode
);
barcode
.
setWarehouseCode
(
ticketUp
.
getWAREHOUSE_CODE
());
barcode
.
setSeq
(
BoxHandleUtil
.
getSeq
(
boxBarcode
,
binCode
)
+
1
);
barcode
.
setPutInTime
(
System
.
currentTimeMillis
());
// 刷新缓存中gr已过帐数量, 如果超出数量则报错
//int amount = barcode.getAmount();
barcode
=
barcodeManager
.
save
(
barcode
);
generatePutInTask
(
barcode
,
boxBarcode
,
OP_STATUS
.
FINISHED
.
name
(),
ticketCode
);
boxBarcode
.
updateSubCodes
(
barcode
);
boxBarcode
.
setAmount
(
boxBarcode
.
getAmount
()
+
barcode
.
getAmount
());
barcodeManager
.
save
(
boxBarcode
);
if
(
inPos
!=
null
)
{
//流程异常时,为保证数据一致性, pos中的box barcode也需要更新
inPos
.
setBarcode
(
boxBarcode
);
storagePosManager
.
save
(
inPos
);
}
return
ResultBean
.
newOkResult
(
BoxHandleUtil
.
getBoxInfo
(
boxStr
));
}
else
{
log
.
info
(
barcode
.
getBarcode
()
+
"不可以放到料格:"
+
binCode
+
",原因为:"
+
canPutIn
);
return
ResultBean
.
newErrorResult
(-
1
,
""
,
barcode
.
getBarcode
()
+
"不可以放到料格:"
+
binCode
+
",原因为:"
+
canPutIn
);
}
}
return
ResultBean
.
newErrorResult
(-
1
,
""
,
barcode
.
getBarcode
()
+
"不可以放到料格:"
+
binCode
);
}
private
void
generatePutInTask
(
Barcode
barcode
,
Barcode
boxBarcode
,
String
status
,
String
sourceName
)
{
DataLog
dataLog
=
new
DataLog
();
dataLog
.
setPosId
(
boxBarcode
.
getId
());
dataLog
.
setPosName
(
barcode
.
getPosName
());
dataLog
.
setBarcode
(
barcode
.
getBarcode
());
dataLog
.
setW
(
barcode
.
getPlateSize
());
dataLog
.
setH
(
barcode
.
getHeight
());
dataLog
.
setPartNumber
(
barcode
.
getPartNumber
());
dataLog
.
setNum
(
barcode
.
getAmount
());
dataLog
.
setType
(
OP
.
PUT_IN
);
dataLog
.
setStatus
(
status
);
dataLog
.
setBatchInfo
(
barcode
.
getBatch
());
dataLog
.
setSourceName
(
sourceName
);
dataLog
.
setWarehouseCode
(
barcode
.
getWarehouseCode
());
taskService
.
updateFinishedTask
(
dataLog
);
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论