|
@@ -7,20 +7,24 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.fjhx.base.Condition;
|
|
import com.fjhx.base.Condition;
|
|
|
|
+import com.fjhx.base.StorageBaseEntity;
|
|
import com.fjhx.constants.HouseConstant;
|
|
import com.fjhx.constants.HouseConstant;
|
|
import com.fjhx.constants.StatusConstant;
|
|
import com.fjhx.constants.StatusConstant;
|
|
import com.fjhx.constants.WebSocketConstant;
|
|
import com.fjhx.constants.WebSocketConstant;
|
|
import com.fjhx.entity.check.CheckDetail;
|
|
import com.fjhx.entity.check.CheckDetail;
|
|
import com.fjhx.entity.check.CheckInfo;
|
|
import com.fjhx.entity.check.CheckInfo;
|
|
|
|
+import com.fjhx.entity.check.CheckTag;
|
|
import com.fjhx.entity.stock.Stock;
|
|
import com.fjhx.entity.stock.Stock;
|
|
import com.fjhx.entity.water.WaterTag;
|
|
import com.fjhx.entity.water.WaterTag;
|
|
import com.fjhx.mapper.check.CheckInfoMapper;
|
|
import com.fjhx.mapper.check.CheckInfoMapper;
|
|
-import com.fjhx.params.check.CheckInfoVo;
|
|
|
|
|
|
+import com.fjhx.params.check.CheckDetailVo;
|
|
import com.fjhx.service.WebSocketServer;
|
|
import com.fjhx.service.WebSocketServer;
|
|
import com.fjhx.service.check.CheckDetailService;
|
|
import com.fjhx.service.check.CheckDetailService;
|
|
import com.fjhx.service.check.CheckInfoService;
|
|
import com.fjhx.service.check.CheckInfoService;
|
|
|
|
+import com.fjhx.service.check.CheckTagService;
|
|
import com.fjhx.service.stock.StockService;
|
|
import com.fjhx.service.stock.StockService;
|
|
import com.fjhx.service.water.WaterTagService;
|
|
import com.fjhx.service.water.WaterTagService;
|
|
|
|
+import org.springblade.core.secure.utils.AuthUtil;
|
|
import org.springblade.core.tool.utils.ThreadUtil;
|
|
import org.springblade.core.tool.utils.ThreadUtil;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -55,33 +59,8 @@ public class CheckInfoServiceImpl extends ServiceImpl<CheckInfoMapper, CheckInfo
|
|
@Autowired
|
|
@Autowired
|
|
private CheckDetailService checkDetailService;
|
|
private CheckDetailService checkDetailService;
|
|
|
|
|
|
- @Override
|
|
|
|
- public Page<Map<String, Object>> getPage(Condition condition) {
|
|
|
|
- String keyword = condition.getKeyword();
|
|
|
|
- Integer status = condition.getStatus();
|
|
|
|
-
|
|
|
|
- QueryWrapper<Object> wrapper = Wrappers.query();
|
|
|
|
- wrapper.and(ObjectUtil.isNotEmpty(keyword),
|
|
|
|
- q -> q.like("m.name", keyword).or().like("m.code", keyword))
|
|
|
|
- .eq(ObjectUtil.isNotEmpty(status), "cd.complete_check", status);
|
|
|
|
-
|
|
|
|
- return baseMapper.getPage(condition.getPage(), wrapper);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public void add(CheckInfoVo checkVo) {
|
|
|
|
- save(checkVo);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public void edit(CheckInfoVo checkVo) {
|
|
|
|
- updateById(checkVo);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public void delete(CheckInfoVo checkVo) {
|
|
|
|
- removeById(checkVo.getId());
|
|
|
|
- }
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private CheckTagService checkTagService;
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Override
|
|
@Override
|
|
@@ -119,11 +98,72 @@ public class CheckInfoServiceImpl extends ServiceImpl<CheckInfoMapper, CheckInfo
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public Page<Map<String, Object>> getPage(Condition condition) {
|
|
|
|
+ String keyword = condition.getKeyword();
|
|
|
|
+ Integer status = condition.getStatus();
|
|
|
|
+
|
|
|
|
+ QueryWrapper<Object> wrapper = Wrappers.query();
|
|
|
|
+ wrapper.and(ObjectUtil.isNotEmpty(keyword),
|
|
|
|
+ q -> q.like("m.name", keyword).or().like("m.code", keyword))
|
|
|
|
+ .eq(ObjectUtil.isNotEmpty(status), "cd.complete_check", status);
|
|
|
|
+
|
|
|
|
+ return baseMapper.getPage(condition.getPage(), wrapper);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
+ @Override
|
|
|
|
+ public void submit(CheckDetailVo checkDetailVo) {
|
|
|
|
+
|
|
|
|
+ checkDetailVo.setCompleteCheck(StatusConstant.YES);
|
|
|
|
+ checkDetailVo.setCheckTime(new Date());
|
|
|
|
+ checkDetailService.updateById(checkDetailVo);
|
|
|
|
+
|
|
|
|
+ List<CheckTag> checkTagList = checkDetailVo.getCheckTagList();
|
|
|
|
+ checkTagService.saveBatch(checkTagList);
|
|
|
|
+
|
|
|
|
+ // 检测是否完成全部质检
|
|
|
|
+ synchronized (this) {
|
|
|
|
+ Long count = checkDetailService.count(q -> q
|
|
|
|
+ .eq(CheckDetail::getCheckId, checkDetailVo.getCheckId())
|
|
|
|
+ .eq(CheckDetail::getCompleteCheck, StatusConstant.NO));
|
|
|
|
+
|
|
|
|
+ // 盘点完成
|
|
|
|
+ if (count == 0) {
|
|
|
|
+
|
|
|
|
+ Long errorCount = checkDetailService.count(q -> q
|
|
|
|
+ .eq(CheckDetail::getCheckId, checkDetailVo.getCheckId())
|
|
|
|
+ .eq(CheckDetail::getCheckResult, StatusConstant.NO));
|
|
|
|
+
|
|
|
|
+ update(q -> q
|
|
|
|
+ .eq(StorageBaseEntity::getId, checkDetailVo.getCheckId())
|
|
|
|
+ .set(CheckInfo::getStatus, 2)
|
|
|
|
+ .set(CheckInfo::getPeopleCheckResult, errorCount == 0 ? 1 : 0)
|
|
|
|
+ .set(CheckInfo::getOperUserId, AuthUtil.getUserId())
|
|
|
|
+ .set(CheckInfo::getEndTime, new Date())
|
|
|
|
+ .set(StorageBaseEntity::getUpdateTime, new Date())
|
|
|
|
+ .set(StorageBaseEntity::getUpdateUser, AuthUtil.getUserId())
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ update(q -> q
|
|
|
|
+ .eq(StorageBaseEntity::getId, checkDetailVo.getCheckId())
|
|
|
|
+ .set(CheckInfo::getStatus, 1)
|
|
|
|
+ .set(StorageBaseEntity::getUpdateTime, new Date())
|
|
|
|
+ .set(StorageBaseEntity::getUpdateUser, AuthUtil.getUserId())
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 获取在库标签
|
|
* 获取在库标签
|
|
*/
|
|
*/
|
|
private List<WaterTag> getInHouseWaterTag() {
|
|
private List<WaterTag> getInHouseWaterTag() {
|
|
- return waterTagService.list(Wrappers.<WaterTag>lambdaQuery()
|
|
|
|
|
|
+ return waterTagService.list(q -> q
|
|
.eq(WaterTag::getStockHouseId, HouseConstant.GROUND_FLOOR_ID)
|
|
.eq(WaterTag::getStockHouseId, HouseConstant.GROUND_FLOOR_ID)
|
|
.eq(WaterTag::getInHouse, StatusConstant.YES)
|
|
.eq(WaterTag::getInHouse, StatusConstant.YES)
|
|
.eq(WaterTag::getUseStatus, StatusConstant.YES)
|
|
.eq(WaterTag::getUseStatus, StatusConstant.YES)
|