| | |
| | | package com.ld.igds.inout.service.impl; |
| | | |
| | | import com.bstek.dorado.data.entity.EntityUtils; |
| | | import com.ld.igds.check.dto.CheckItemData; |
| | | import com.ld.igds.common.CoreCommonService; |
| | | import com.ld.igds.constant.BizType; |
| | | import com.ld.igds.constant.Constant; |
| | |
| | | import com.ld.igds.data.CommonData; |
| | | import com.ld.igds.data.Page; |
| | | import com.ld.igds.inout.InoutConstant; |
| | | import com.ld.igds.inout.dto.InoutData; |
| | | import com.ld.igds.inout.dto.InoutParam; |
| | | import com.ld.igds.inout.dto.InoutCheckData; |
| | | import com.ld.igds.inout.dto.InoutCheckParam; |
| | | import com.ld.igds.inout.dto.InoutData; |
| | | import com.ld.igds.inout.dto.InoutParam; |
| | | import com.ld.igds.inout.mapper.InoutCheckMapper; |
| | | import com.ld.igds.inout.mapper.InoutRecordMapper; |
| | | import com.ld.igds.inout.service.InoutService; |
| | | import com.ld.igds.io.constant.OrderRespEnum; |
| | | import com.ld.igds.models.Depot; |
| | | import com.ld.igds.models.InoutPrice; |
| | | import com.ld.igds.util.ContextUtil; |
| | | import com.ld.igds.util.DateUtil; |
| | | import com.ld.igds.util.RedisUtil; |
| | | import com.ld.igds.websocket.WebSocketPacket; |
| | | import com.ld.igds.websocket.WebSocketServer; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | |
| | | |
| | | inoutMapper.deleteData(param); |
| | | |
| | | delInoutFromCache(param.getDeptId(), param.getType(), param.getId()); |
| | | delFromCache(param.getDeptId(), param.getType(), param.getId()); |
| | | |
| | | return null; |
| | | } |
| | |
| | | } |
| | | |
| | | // 缓存中删除 |
| | | delInoutFromCache(param.getDeptId(), param.getType(), param.getId()); |
| | | delFromCache(param.getDeptId(), param.getType(), param.getId()); |
| | | |
| | | param.setProgress(InoutConstant.PROGRESS_RECORD); |
| | | param.setRecordStatus(InoutConstant.RECORD_STATUS_ERROR); |
| | |
| | | public String toComplete(InoutParam param) throws Exception { |
| | | |
| | | if (null == param.getCompanyId()) { |
| | | param.setCompanyId(ContextUtil.getCompanyId()); |
| | | param.setCompanyId(ContextUtil.getDefaultCompanyId()); |
| | | } |
| | | |
| | | // 清除缓存 |
| | | this.delInoutFromCache(param.getDeptId(), param.getType(), param.getId()); |
| | | this.delFromCache(param.getDeptId(), param.getType(), param.getId()); |
| | | |
| | | inoutMapper.toComplete(param); |
| | | |
| | |
| | | |
| | | if (InoutConstant.PROGRESS_RECORD.equals(data.getProgress())) { |
| | | |
| | | delInoutFromCache(data.getDeptId(), data.getType(), data.getId()); |
| | | delFromCache(data.getDeptId(), data.getType(), data.getId()); |
| | | |
| | | setCompleteInoutCache(data.getDeptId(), data); |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | public void delInoutFromCache(String deptId, String type, String id) { |
| | | public void delFromCache(String deptId, String type, String id) { |
| | | if (StringUtils.isEmpty(deptId)) { |
| | | return; |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void notifyWeb(InoutData result) { |
| | | // 如果当前为满车称重执行推送 |
| | | if (result.getType().equals(InoutConstant.TYPE_IN) && result.getProgress().equals(InoutConstant.PROGRESS_WEIGHT_FULL)) { |
| | | WebSocketPacket packet = new WebSocketPacket(); |
| | | packet.setBizType(BizType.SCREEN_CHECK.getCode()); |
| | | packet.setCompanyId(result.getCompanyId()); |
| | | packet.setOrderResp(OrderRespEnum.MSG_SUCCESS.getCode()); |
| | | packet.setData(result); |
| | | packet.setBizTag(InoutConstant.PROGRESS_WEIGHT_FULL); |
| | | log.debug("----向化验大屏推送满车称重信息 ----{}", result.getPlateNum()); |
| | | WebSocketServer.sendByBizTag(packet); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public Page<InoutData> pageUnCompleteData(InoutParam param) { |
| | | |
| | | if (StringUtils.isEmpty(param.getCompanyId())) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public InoutData getLastRecord(String companyId, String depotId) { |
| | | InoutParam param = new InoutParam(); |
| | | param.setCompanyId(companyId); |
| | | param.setDepotId(depotId); |
| | | public InoutData getLastRecord(InoutParam param) { |
| | | return inoutMapper.getLastRecord(param); |
| | | } |
| | | |
| | |
| | | public String addInoutDataByLossOver(InoutData data) { |
| | | |
| | | // 获取上一车的流水数据 |
| | | InoutData inoutData = this.getLastRecord(data.getCompanyId(), data.getDepotId()); |
| | | // InoutData inoutData = this.getLastRecord(data.getCompanyId(), data.getDepotId()); |
| | | |
| | | // // 设置流水的库存 |
| | | // if (InoutConstant.TYPE_IN.equals(inoutData.getType())) { |
| | |
| | | redisUtil.set(cacheKey, data.getCheckItems(), 60 * 60 * 24 * 3); |
| | | } |
| | | |
| | | @SuppressWarnings("unchecked") |
| | | @Override |
| | | public List<CheckItemData> getCheckCache(String companyId, String checkId) { |
| | | String cacheKey = RedisConst.buildKey(companyId, checkId); |
| | | return (List<CheckItemData>) redisUtil.get(cacheKey); |
| | | } |
| | | |
| | | /** |
| | | * 出入库流程ID创建 202001030001 202001030001 |