|
@@ -7,8 +7,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.warewms.common.core.domain.R;
|
|
|
import com.warewms.common.core.domain.base.page.PageDomain;
|
|
|
import com.warewms.common.core.domain.base.page.TableDataInfo;
|
|
|
+import com.warewms.common.core.domain.model.LoginUser;
|
|
|
import com.warewms.common.exception.ServiceException;
|
|
|
+import com.warewms.common.utils.SecurityUtils;
|
|
|
import com.warewms.common.utils.StringUtils;
|
|
|
+import com.warewms.hailiang.MES.MesService;
|
|
|
import com.warewms.hailiang.domain.RetroactiveHistory;
|
|
|
import com.warewms.hailiang.domain.RetroactiveNow;
|
|
|
import com.warewms.hailiang.mapper.RetroactiveHistoryMapper;
|
|
@@ -39,6 +42,9 @@ public class RetroactiveNowServiceImpl extends ServiceImpl<RetroactiveNowMapper,
|
|
|
@Autowired
|
|
|
private RetroactiveHistoryMapper retroactiveHistoryMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private MesService mesService;
|
|
|
+
|
|
|
@Override
|
|
|
public TableDataInfo<RetroactiveNow> getList(RetroactiveNow retroactiveNow, PageDomain pageDomain, List<String> inStatus) {
|
|
|
Map<String, Object> params = retroactiveNow.getParams();
|
|
@@ -75,16 +81,7 @@ public class RetroactiveNowServiceImpl extends ServiceImpl<RetroactiveNowMapper,
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public int updateData(RetroactiveNow retroactiveNow) {
|
|
|
- RetroactiveNow baseData = retroactiveNowMapper.selectOne(new LambdaQueryWrapper<RetroactiveNow>()
|
|
|
- .eq(StringUtils.isNotEmpty(retroactiveNow.getBatchNo()), RetroactiveNow::getBatchNo, retroactiveNow.getBatchNo())
|
|
|
- .eq(StringUtils.isNotEmpty(retroactiveNow.getLotNo()), RetroactiveNow::getLotNo, retroactiveNow.getLotNo())
|
|
|
- );
|
|
|
- if (ObjectUtil.isNull(baseData)) {
|
|
|
- throw new ServiceException("数据库中不存在该批次号或托盘号," + retroactiveNow.getBatchNo() + "," + retroactiveNow.getLotNo());
|
|
|
- }
|
|
|
- if (baseData.getStatus().equals(retroactiveNow.getStatus())) {
|
|
|
- throw new ServiceException("数据库存在该状态相同批次号或托盘号的数据");
|
|
|
- }
|
|
|
+ RetroactiveNow baseData = confirmTheDataByIndex(retroactiveNow);
|
|
|
baseData.setStatus(retroactiveNow.getStatus());
|
|
|
baseData.setDeviceId(retroactiveNow.getDeviceId());
|
|
|
baseData.setUpdateBy("system");
|
|
@@ -98,16 +95,7 @@ public class RetroactiveNowServiceImpl extends ServiceImpl<RetroactiveNowMapper,
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public int finishProduce(RetroactiveNow retroactiveNow) {
|
|
|
- RetroactiveNow baseData = retroactiveNowMapper.selectOne(new LambdaQueryWrapper<RetroactiveNow>()
|
|
|
- .eq(StringUtils.isNotEmpty(retroactiveNow.getBatchNo()), RetroactiveNow::getBatchNo, retroactiveNow.getBatchNo())
|
|
|
- .eq(StringUtils.isNotEmpty(retroactiveNow.getLotNo()), RetroactiveNow::getLotNo, retroactiveNow.getLotNo())
|
|
|
- );
|
|
|
- if (ObjectUtil.isNull(baseData)) {
|
|
|
- throw new ServiceException("数据库中不存在该批次号或托盘号," + retroactiveNow.getBatchNo() + "," + retroactiveNow.getLotNo());
|
|
|
- }
|
|
|
- if (baseData.getStatus().equals(retroactiveNow.getStatus())) {
|
|
|
- throw new ServiceException("数据库存在该状态相同批次号或托盘号的数据");
|
|
|
- }
|
|
|
+ RetroactiveNow baseData = confirmTheDataByIndex(retroactiveNow);
|
|
|
baseData.setStatus(retroactiveNow.getStatus());
|
|
|
baseData.setDeviceId(retroactiveNow.getDeviceId());
|
|
|
baseData.setUpdateBy("system");
|
|
@@ -118,8 +106,43 @@ public class RetroactiveNowServiceImpl extends ServiceImpl<RetroactiveNowMapper,
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional
|
|
|
public R complement(RetroactiveNow retroactiveNow) {
|
|
|
- return null;
|
|
|
+ RetroactiveNow baseData = confirmTheDataByIndex(retroactiveNow);
|
|
|
+ if ("2".equals(baseData.getStatus())){
|
|
|
+ mesService.getBatchNoResult(retroactiveNow.getBatchNo(), true);
|
|
|
+ }
|
|
|
+ if ("3".equals(baseData.getStatus())){
|
|
|
+ mesService.processFeedback(retroactiveNow.getBatchNo(),"1");
|
|
|
+ }
|
|
|
+ if ("4".equals(baseData.getStatus())){
|
|
|
+ mesService.processFeedback(retroactiveNow.getBatchNo(),"2");
|
|
|
+ }
|
|
|
+ LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
+ baseData.setStatus(retroactiveNow.getStatus());
|
|
|
+ baseData.setDeviceId("PDA");
|
|
|
+ baseData.setUpdateBy(loginUser.getUsername());
|
|
|
+ baseData.setRemark("PDA手动补码");
|
|
|
+ retroactiveNowMapper.updateById(baseData);
|
|
|
+ baseData.setCreateBy(loginUser.getUsername());
|
|
|
+ RetroactiveHistory retroactiveHistory = BeanUtil.copyProperties(baseData, RetroactiveHistory.class);
|
|
|
+ retroactiveHistory.setCreateTime(baseData.getUpdateTime());
|
|
|
+ retroactiveHistoryMapper.insert(retroactiveHistory);
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+ private RetroactiveNow confirmTheDataByIndex(RetroactiveNow retroactiveNow) {
|
|
|
+ RetroactiveNow baseData = retroactiveNowMapper.selectOne(new LambdaQueryWrapper<RetroactiveNow>()
|
|
|
+ .eq(StringUtils.isNotEmpty(retroactiveNow.getBatchNo()), RetroactiveNow::getBatchNo, retroactiveNow.getBatchNo())
|
|
|
+ .eq(StringUtils.isNotEmpty(retroactiveNow.getLotNo()), RetroactiveNow::getLotNo, retroactiveNow.getLotNo())
|
|
|
+ );
|
|
|
+ if (ObjectUtil.isNull(baseData)) {
|
|
|
+ throw new ServiceException("数据库中不存在该批次号或托盘号," + retroactiveNow.getBatchNo() + "," + retroactiveNow.getLotNo());
|
|
|
+ }
|
|
|
+ if (baseData.getStatus().equals(retroactiveNow.getStatus())) {
|
|
|
+ throw new ServiceException("数据库存在该状态相同批次号或托盘号的数据");
|
|
|
+ }
|
|
|
+ return baseData;
|
|
|
}
|
|
|
}
|
|
|
|