CheckService.java
2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package cn.csbr.app.service;
import cn.csbr.app.exception.AuthException;
import cn.csbr.app.gui.GUIContext;
import cn.csbr.app.model.InboundItem;
import cn.csbr.springboot.dao.mapper.MfcubestockcoutMapper;
import cn.csbr.springboot.dao.mapper.MfcubestockdetailMapper;
import cn.csbr.springboot.dao.model.Mfcubestockcout;
import cn.csbr.springboot.dao.model.Mfcubestockdetail;
import com.alibaba.fastjson.JSON;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
@Service
public class CheckService {
private static final Logger log = LoggerFactory.getLogger(CheckService.class);
@Autowired
private MfcubestockdetailMapper mfcubestockdetailMapper;
@Autowired
private BaseService baseService;
@Autowired
private MfcubestockcoutMapper mfcubestockcoutMapper;
@Autowired
private GUIContext guiContext;
/**
* 盘点确认报损后删除库存数据
* @TODO
*/
@Transactional
public void checkDeleteCabinetInfo(InboundItem inboundItem) {
log.info("checkDeleteCabinetInfo报损删除方法入参为:"+ JSON.toJSONString(inboundItem));
if (inboundItem == null) {
return;
}
Mfcubestockdetail cubedetail = mfcubestockdetailMapper.selectByPrimaryKey(inboundItem.getGuid());
if (cubedetail == null) {
throw new AuthException("未查询到该数据,请刷新重试");
}
//将查询到的货柜名和id放入InboundItem对象
buildInboundItem(inboundItem,cubedetail);
int deleteCount = mfcubestockdetailMapper.delete(cubedetail);
if (deleteCount == 0) {
throw new AuthException("删除失败,请刷新重试");
}
int logCount = baseService.writeLog(inboundItem, cubedetail, "4");
if (logCount == 0) {
throw new AuthException("删除失败,请刷新重试");
}
// int sumCount = baseService.sumNumber(inboundItem, cubedetail);
// if (sumCount == 0) {
// throw new AuthException("删除失败,请刷新重试");
// }
}
public void buildInboundItem(InboundItem inboundItem,Mfcubestockdetail cubedetail) {
inboundItem.setAllocationGuid(cubedetail.getCubeGuid());
inboundItem.setAllocation(cubedetail.getCubeName());
}
}