igds-api-phone/src/main/java/com/ld/igds/phone/service/impl/ServiceImpl5205.java
@@ -79,8 +79,11 @@ files.add(fileData1); files.add(fileData2); data.setFiles(files); //进行下一流程更新 PageResponse<InoutData> stringPageResponse = inoutManager.inNextStep(data); PageResponse<InoutData> stringPageResponse = inoutManager.submitHandle(data); // PageResponse<InoutData> stringPageResponse = inoutManager.inNextStep(data); return PhoneRespUtil.success(stringPageResponse.getData(), req); } igds-api-phone/src/main/java/com/ld/igds/phone/service/impl/ServiceImpl5207.java
@@ -80,7 +80,9 @@ files.add(fileData2); data.setFiles(files); //进行下一流程更新 PageResponse<InoutData> stringPageResponse = inoutManager.inNextStep(data); // PageResponse<InoutData> stringPageResponse = inoutManager.inNextStep(data); PageResponse<InoutData> stringPageResponse = inoutManager.submitHandle(data); return PhoneRespUtil.success(stringPageResponse.getData(), req); } igds-api-phone/src/main/java/com/ld/igds/phone35/service/impl/Phone35ServiceImpl5201.java
@@ -63,7 +63,9 @@ data.setRegisterTime(new Date()); data.setRegisterUser(phone35AuthUser.getCname()); data.setProgress(InoutConstant.PROGRESS_REGISTER); PageResponse<InoutData> result = inoutManager.inNextStep(data); PageResponse<InoutData> result = inoutManager.submitRegisterInout(data); //PageResponse<InoutData> result = inoutManager.inNextStep(data); if (RespCodeEnum.CODE_0000.getCode().equals(result.getCode())) { return PhoneRespUtil.success("入库登记成功!", req); igds-api-phone/src/main/java/com/ld/igds/phone35/service/impl/Phone35ServiceImpl5202.java
@@ -64,7 +64,7 @@ data.setRegisterTime(new Date()); data.setRegisterUser(phone35AuthUser.getCname()); data.setProgress(InoutConstant.PROGRESS_REGISTER); PageResponse<InoutData> result = inoutManager.outNextStep(data); PageResponse<InoutData> result = inoutManager.submitRegisterInout(data); if (RespCodeEnum.CODE_0000.getCode().equals(result.getCode())) { return PhoneRespUtil.success("出库登记成功!", req); igds-api-phone/src/main/java/com/ld/igds/phone35/service/impl/Phone35ServiceImpl5207.java
@@ -87,8 +87,10 @@ files.add(fileData2); //TODO 设置水印 data.setFiles(files); PageResponse<InoutData> stringPageResponse = inoutManager.submitHandle(data); //进行下一流程更新 PageResponse<InoutData> stringPageResponse = inoutManager.inNextStep(data); // PageResponse<InoutData> stringPageResponse = inoutManager.inNextStep(data); return PhoneRespUtil.success(stringPageResponse.getData(), req); } igds-base/src/main/java/com/ld/igds/constant/RespCodeEnum.java
@@ -16,7 +16,6 @@ */ CODE_0000("0000", "成功"), CODE_1111("1111", "后端服务异常"), CODE_1001("1001","数据格式校验失败"), CODE_1002("1002","该应用无激活授权"), CODE_1003("1003","该应用已经授权成功"), @@ -24,7 +23,7 @@ CODE_1005("1005","该设备不存在"), CODE_1006("1006","当前登录人已掉线"), CODE_1007("1007","请求参数异常"), CODE_1008("1008","业务数据返回为空"), CODE_1008("1008","流程不正确"), CODE_2000("2000","响应数据为空") ; igds-inout/src/main/java/com/ld/igds/inout/controller/InoutController.java
@@ -537,7 +537,7 @@ } /** * 卡回收数据查询,没有流程状态的数据直接返回 * 出库收卡信息查询 * * @param param * @return @@ -545,41 +545,7 @@ @RequestMapping("/inout-query-back") public PageResponse<InoutData> inoutQueryBack(@RequestBody InoutParam param) { param.setProgress(null); return inoutManager.inoutQuery(param); } /** * 出入库数据更新,提交到下个流程 * * @param data * @return */ @RequestMapping("/inout-next-step") @Transactional public PageResponse<InoutData> inoutNextStep(@RequestBody InoutData data) { try { IUser user = ContextUtil.getLoginUser(); if (StringUtils.isEmpty(data.getCompanyId())) { data.setCompanyId(user.getCompanyId()); } if (StringUtils.isEmpty(data.getDeptId())) { data.setDeptId(ContextUtil.subDeptId(user)); } if (InoutConstant.TYPE_IN.equals(data.getType())) { return inoutManager.inNextStep(data); } else { return inoutManager.outNextStep(data); } } catch (Exception e) { log.error("后台异常:{}", e); //手动回滚 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), "后台异常:" + e.getMessage()); } return inoutManager.inoutQueryBack(param); } /** @@ -639,32 +605,16 @@ } /** * 卡回收页面提交,如果是正常流程卡回收则走正常完成流程,否则执行删除逻辑并回收卡 * 出入库卡回收提交,如果数据已经是完成,直接不做更新,如果未完成则执行完成 * * @param data * @return */ @RequestMapping("/inout-back-submit") public PageResponse<InoutData> inoutBackSubmit(@RequestBody InoutData data) { return inoutManager.inoutBack(data); @RequestMapping("/submit-card-back") @Transactional public PageResponse<InoutData> submitCardBack(@RequestBody InoutData data) throws Exception { return inoutManager.submitCardBack(data); } // /** // * 化验页面数据提交 // * // * @param data // * @return // */ // @RequestMapping("/update-check") // public PageResponse<InoutData> updateCheck(@RequestBody InoutData data) { // try { // return inoutManager.updateCheck(data); // } catch (Exception e) { // log.error("后台异常:{}", e); // return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), // "后台异常:" + e.getMessage(), null); // } // } /** * 根据卡号和类型,直接完成当前流程 @@ -672,57 +622,10 @@ * @param data * @return */ @RequestMapping("/inout-to-complete") public PageResponse<InoutData> inoutComplete(@RequestBody InoutData data) { try { return inoutManager.inoutComplete(data); } catch (Exception e) { log.error("后台异常:{}", e); return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), "后台异常:" + e.getMessage(), data); } } // /** // * 根据入库数据信息,获取检查项信息,如果当前数据已经检测完成,查询检测结果,如果没有检测完成则根据检测项配置获取需要检测的项目信息 // * // * @param data // * @return // */ // @RequestMapping("/get-check-item") // public PageResponse<List<CheckItemData>> getCheckItem(@RequestBody InoutData data) { // try { // return inoutManager.getCheckItem(data); // } catch (Exception e) { // log.error("后台异常:{}", e); // return new PageResponse<List<CheckItemData>>( // RespCodeEnum.CODE_1111.getCode(), "后台异常:" + e.getMessage()); // } // } // /** // * 分页获取数据信息 // * // * @param param // * @return // */ // @RequestMapping("/page-check-data") // public PageResponse<Page<InoutData>> pageCheckData( // @RequestBody InoutParam param) { // return inoutManager.pageCheckData(param); // } /** * 道闸控制 * * @param param * @return */ @RequestMapping("/gate-ctrl") public PageResponse<String> gateCtrl( @RequestBody InoutGateDto param) { return null; @RequestMapping("/submit-complete") @Transactional public PageResponse<InoutData> submitComplete(@RequestBody InoutData data) throws Exception { return inoutManager.submitComplete(data); } /** @@ -869,6 +772,7 @@ /** * 根据粮食等级及粮食品种获取粮食定价 * * @param param * @return */ igds-inout/src/main/java/com/ld/igds/inout/manager/InoutManager.java
@@ -1,6 +1,5 @@ package com.ld.igds.inout.manager; import com.bstek.bdf2.core.business.IUser; import com.ld.igds.check.CheckStandardManager; import com.ld.igds.check.dto.CheckItemData; import com.ld.igds.check.dto.CheckUpdateResult; @@ -9,9 +8,11 @@ import com.ld.igds.data.Page; import com.ld.igds.data.PageResponse; import com.ld.igds.file.CoreFileService; import com.ld.igds.file.dto.FileData; import com.ld.igds.inout.InoutConstant; import com.ld.igds.inout.dto.*; 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.service.InoutService; import com.ld.igds.m.service.InoutCommonService; import com.ld.igds.models.Depot; @@ -20,15 +21,16 @@ import com.ld.igds.models.InoutSysConf; import com.ld.igds.util.ContextUtil; import com.ld.igds.util.DateUtil; import com.ld.igds.util.NumberUtil; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.DateUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.Arrays; import java.util.Date; import java.util.List; @@ -42,18 +44,57 @@ @Component public class InoutManager { @Autowired @Resource private InoutService inoutService; @Autowired @Resource private CoreFileService fileService; @Autowired @Resource private CoreCommonService commonService; @Resource private InoutCommonService inoutCommonService; @Autowired @Resource private CheckStandardManager checkStandardManager; @Resource private InoutDeviceManager inoutDeviceManager; /** * 直接从数据库查询,不考虑信息状态 * * @param param * @return */ public PageResponse<InoutData> inoutQueryBack(InoutParam param) { if (StringUtils.isEmpty(param.getPlateNum()) && StringUtils.isEmpty(param.getIntelCard()) && StringUtils.isEmpty(param.getUserId())) { return new PageResponse<>(RespCodeEnum.CODE_1007.getCode(), "查询参数不完整,查询失败!"); } //获取三天以内最后一天记录 param.setStart(DateUtil.getNewByDay(new Date(), -3)); param.setType(null); param.setProgress(null); InoutData result = inoutService.getLastRecord(param); if (null == result) { return new PageResponse<>(RespCodeEnum.CODE_1007.getCode(), "根据当前条件未查询到车辆信息!"); } if (InoutConstant.PROGRESS_RECORD.equals(result.getProgress())) { return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(), "当前车辆流程已经结束", result); } if (!InoutConstant.PROGRESS_CARD_BACK.equals(result.getProgress())) { return new PageResponse<>(RespCodeEnum.CODE_1008.getCode(), "当前车辆流程不在当前环节,无法执行出库", result); } return new PageResponse<>(RespCodeEnum.CODE_0000, result); } /** * 首先从缓存中获取,缓存中,从数据库中获取 @@ -126,153 +167,6 @@ } } public PageResponse<InoutData> outNextStep(InoutData data) throws Exception { String msg; IUser user = ContextUtil.getLoginUser(); if (StringUtils.isEmpty(data.getCompanyId())) { data.setCompanyId(user.getCompanyId()); } if (StringUtils.isEmpty(data.getDeptId())) { data.setDeptId(ContextUtil.subDeptId(user)); } if (StringUtils.isEmpty(data.getIntelCard())) { data.setIntelCard(data.getUserId()); } String curProgress = data.getProgress(); List<FileData> files = data.getFiles(); // 更新下一个状态和基本信息 InoutSysConf inoutSysConf = inoutCommonService.getCacheInoutSysConf( data.getCompanyId(), data.getDeptId()); if (null == inoutSysConf || StringUtils.isEmpty(inoutSysConf.getProgressIn())) { return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), "当前库区未配置出库流程信息,请联系管理员配置。", data); } data = updateBasicInfo(data, inoutSysConf); // 如果当前节点是注册,则需要验证下,是否有为完成的流程在执行中 if (InoutConstant.PROGRESS_REGISTER.equals(curProgress)) { InoutData progressData = this.inoutProgressQuery(data); if (null != progressData) { return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), "当前卡片/车牌号有流程未结束。", progressData); } } if (null != data.getPrice() && null != data.getRecordWeight()) { data.setSettleMoney(NumberUtil.keepPrecision(data.getPrice() * data.getRecordWeight(), 2)); } // 流程完成,直接调用流程完成接口 if (InoutConstant.PROGRESS_RECORD.equals(data.getProgress())) { inoutService.updateData(data); // 执行附件信息 if (null != files) { fileService.saveInoutFiles(files, data.getCompanyId(), data.getId(), curProgress); } // 通知称重主控流程结束 inoutDeviceManager.noticeProgressComplete(data); return inoutComplete(data); } // 调用保存方法执行 if (StringUtils.isEmpty(data.getId())) { msg = inoutService.insertData(data); } else { msg = inoutService.updateData(data); } // 执行附件信息 if (null != files) { fileService.saveInoutFiles(files, data.getCompanyId(), data.getId(), curProgress); } if (null != msg) { return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg, data); } return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "执行成功", data); } public PageResponse<InoutData> inNextStep(InoutData data) throws Exception { String msg; String curProgress = data.getProgress(); List<FileData> files = data.getFiles(); if (StringUtils.isEmpty(data.getIntelCard())) { data.setIntelCard(data.getUserId()); } // 更新下一个状态和基本信息 InoutSysConf inoutSysConf = inoutCommonService.getCacheInoutSysConf(data.getCompanyId(), data.getDeptId()); if (null == inoutSysConf || StringUtils.isEmpty(inoutSysConf.getProgressIn())) { return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), "当前库区未配置入库流程信息,请联系管理员配置。", data); } data = updateBasicInfo(data, inoutSysConf); // 如果当前节点是注册,则需要验证下,是否有为完成的流程在执行中 if (InoutConstant.PROGRESS_REGISTER.equals(curProgress)) { InoutData progressData = this.inoutProgressQuery(data); if (null != progressData) { return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), "当前卡片/车牌号有流程未结束。", progressData); } } if (null != data.getPrice() && null != data.getRecordWeight()) { data.setSettleMoney(NumberUtil.keepPrecision(data.getPrice() * data.getRecordWeight(), 2)); } // 流程完成,直接调用流程完成接口 if (InoutConstant.PROGRESS_RECORD.equals(data.getProgress())) { if (StringUtils.isEmpty(data.getCompanyId())) { data.setCompanyId(ContextUtil.getCompanyId()); } inoutService.updateData(data); // 执行附件信息 if (null != files) { fileService.saveInoutFiles(files, data.getCompanyId(), data.getId(), curProgress); } // 通知称重主控流程结束 inoutDeviceManager.noticeProgressComplete(data); return inoutComplete(data); } // 调用保存方法执行 if (StringUtils.isEmpty(data.getId())) { msg = inoutService.insertData(data); } else { msg = inoutService.updateData(data); } // 执行附件信息 if (null != files) { fileService.saveInoutFiles(files, data.getCompanyId(), data.getId(), curProgress); } if (null != msg) { return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg); } return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "执行成功", data); } public InoutData inoutProgressQuery(InoutData data) throws Exception { InoutParam param = new InoutParam(); @@ -283,85 +177,6 @@ return inoutService.inoutProgressQuery(param); } // @Transactional(rollbackFor = Exception.class) // public PageResponse<InoutData> updateCheck(InoutData data) throws Exception { // // if (InoutConstant.PROGRESS_RECORD.equals(data.getProgress())) { // return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), // "当前流程已经结束,不支持修改", data); // } // // CheckUpdateResult checkResult = this.updateCheckItems(data); // String tag = checkResult.getMsg(); // // if (null != tag) { // return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), // "后台执行异常:" + tag, data); // } // // // 获取业务数据信息 // InoutParam param = new InoutParam(); // param.setCompanyId(data.getCompanyId()); // param.setId(data.getId()); // InoutData progressData = inoutService.inoutProgressQuery(param); // if (null == progressData) { // return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), // "没有获取到出入库业务数据信息,更新失败", data); // } // if (InoutConstant.PROGRESS_RECORD.equals(progressData.getProgress())) { // return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), // "当前流程已经结束,不支持修改"); // } // progressData.setCheckStatus(data.getCheckStatus()); // // // 更新下一个状态和基本信息 // if (InoutConstant.PROGRESS_CHECK.equals(progressData.getProgress())) { // progressData = updateBasicInfo(progressData, null); // // 若化验结果不合格,判断配置后续流程 // if (InoutConstant.STATUS_UNPASS.equals(progressData // .getCheckStatus())) { // progressData = checkNoPass(progressData); // } // } // progressData.setCheckUser(ContextUtil.getLoginUserCName()); // // if (StringUtils.isNotEmpty(data.getDepotId())) { // progressData.setDepotId(data.getDepotId()); // } // if (StringUtils.isNotEmpty(data.getFoodVariety())) { // progressData.setFoodVariety(data.getFoodVariety()); // } // if (StringUtils.isNotEmpty(data.getFoodLevel())) { // progressData.setFoodLevel(data.getFoodLevel()); // } // if (StringUtils.isNotEmpty(data.getFoodLocation())) { // progressData.setFoodLocation(data.getFoodLocation()); // } // if (StringUtils.isNotEmpty(data.getFoodYear())) { // progressData.setFoodYear(data.getFoodYear()); // } // if (null != data.getPrice()) { // progressData.setPrice(data.getPrice()); // } // if (StringUtils.isNotEmpty(data.getRemarks())) { // progressData.setRemarks(data.getRemarks()); // } // if (StringUtils.isNotEmpty(data.getNoticeId())) { // progressData.setNoticeId(data.getNoticeId()); // } // // String msg = inoutService.updateData(progressData); // // if (null != msg) { // return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg); // } // if (InoutConstant.PROGRESS_RECORD.equals(progressData.getProgress())) { // // inoutComplete(progressData); // } // return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "执行成功"); // } /** * 化验结果不通过时校验配置信息 @@ -556,81 +371,45 @@ } public PageResponse<InoutData> inoutComplete(InoutData data) throws Exception { public PageResponse<InoutData> submitComplete(InoutData data) throws Exception { if (StringUtils.isEmpty(data.getId()) || StringUtils.isEmpty(data.getType())) { || StringUtils.isEmpty(data.getType()) || StringUtils.isEmpty(data.getProgress())) { return new PageResponse<>(RespCodeEnum.CODE_1007.getCode(), "没有获取到车辆信息。", data); } data.setUpdateTime(new Date()); if (null == data.getCompleteTime()) { data.setCompleteTime(DateUtil.getNewByMinute(new Date(), 2)); } if (null == data.getCompleteUser()) { data.setCompleteUser(ContextUtil.getLoginUserCName()); } // 设置流程节点直接完成 InoutParam param = new InoutParam(); param.setCompanyId(data.getCompanyId()); param.setId(data.getId()); param.setType(data.getType()); param.setDeptId(data.getDeptId()); param.setIntelCard(data.getIntelCard()); param.setUserId(ContextUtil.getLoginUserCName()); param.setUserId(data.getCompleteUser()); param.setDepotId(data.getDepotId()); param.setCompleteTime(data.getCompleteTime()); if (null == param.getCompleteTime()) { param.setCompleteTime(new Date()); } // 设置流程节点直接完成 param.setProgress(InoutConstant.PROGRESS_RECORD); if (null == data.getCompleteTime()) { data.setCompleteTime(DateUtil.getNewByMinute(new Date(), 2)); } String msg = inoutService.toComplete(param); if (null != msg) { return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg); } // 库存调整 commonService.initInoutDepotStore(data); return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), null, data); } // /** // * 扦样化验页面获取检验项条目信息 // * // * @param data // * @return // */ // public PageResponse<List<CheckItemData>> getCheckItem(InoutData data) { // // List<CheckItemData> result = checkStandardManager.listCheckItem( // data.getCheckId(), data.getCompanyId(), data.getDeptId(), // data.getFoodVariety()); // // return new PageResponse<>(RespCodeEnum.CODE_0000, result); // } /** * 删除并完成 * * @param data * @return */ public PageResponse<InoutData> deleteInoutData(InoutData data, String msg) { try { data.setRemarks(msg); String result = this.delInoutData(data, false); if (null != result) { return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), result, data); } } catch (Exception e) { log.error("后台异常:{}", e); return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), "后台异常:" + e.getMessage(), data); } return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "执行完成", data); } /** @@ -639,38 +418,40 @@ * @param data * @return */ public PageResponse<InoutData> inoutBack(InoutData data) { public PageResponse<InoutData> submitCardBack(InoutData data) { try { // 从缓存中获取最新的数据,如果没有则表示流程已经结束。 InoutParam param = new InoutParam(); param.setCompanyId(data.getCompanyId()); param.setId(data.getId()); InoutData curData = inoutService.inoutProgressQuery(param); if (InoutConstant.PROGRESS_RECORD.equals(curData.getProgress())) { return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(), "当前卡流程已经完成,无需执行卡回收", data); //如果当前数据已经结束 if (InoutConstant.PROGRESS_RECORD.equals(data.getProgress())) { //删除缓存 inoutService.delFromCache(data.getDeptId(), data.getType(), data.getId()); return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "当车辆流程已经完成,卡片已回收", data); } if (InoutConstant.RECORD_STATUS_DEL.equals(curData .getRecordStatus())) { return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(), "当前卡信息已被删除,不能执行卡回收", data); //如果当前流程不是卡回收 if (!InoutConstant.PROGRESS_CARD_BACK.equals(data.getProgress())) { return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), "当前流程环节不正确,不能执行卡回收", data); } // 如果当前流程状态是卡回收状态,就是完成流程。 if (InoutConstant.PROGRESS_CARD_BACK.equals(curData.getProgress())) { return inoutComplete(curData); if (InoutConstant.PROGRESS_CARD_BACK.equals(data.getProgress())) { return submitComplete(data); } // 如果是其他状态,则执行删除逻辑 return deleteInoutData(curData, "卡回收删除"); } catch (Exception e) { return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), "后端执行异常:" + e.getMessage()); } return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "执行成功", data); } /* ============================== 详单页面相关操作 ================================= */ /** * 补单操作 补单因为完成时间不确定,所以需要系统根据当前数据进行自动检测,调整原来流水信息和库存 @@ -679,7 +460,6 @@ * @return * @throws Exception */ @Transactional public String addInoutData(InoutData data) throws Exception { if (data.getSettleWeight() <= 0.0) { @@ -755,7 +535,7 @@ * @return * @throws Exception */ @javax.transaction.Transactional(rollbackOn = Exception.class) @Transactional public String updateInoutData(InoutData data) throws Exception { if (InoutConstant.RECORD_STATUS_DEL.equals(data.getRecordStatus())) { @@ -1310,4 +1090,6 @@ RespCodeEnum.CODE_1111.getCode(), "后台异常:" + e.getMessage(), null); } } } igds-inout/src/main/java/com/ld/igds/inout/service/InoutService.java
@@ -1,6 +1,5 @@ package com.ld.igds.inout.service; import com.ld.igds.check.dto.CheckItemData; import com.ld.igds.data.Page; import com.ld.igds.inout.dto.*; import com.ld.igds.models.InoutPrice; @@ -135,14 +134,6 @@ /** * 根据数据进行推送 * * @param result */ void notifyWeb(InoutData result); /** * 推送大屏 * * @param companyId @@ -179,11 +170,10 @@ /** * 获取当前仓库下最后一条记录信息 * * @param companyId * @param depotId * @param param * @return */ InoutData getLastRecord(String companyId, String depotId); InoutData getLastRecord(InoutParam param); /** * 根据损溢记录,添加出入库记录信息 @@ -206,15 +196,6 @@ * @param data */ void setCheckCache(InoutData data); /** * 根据组织编码和化验ID获取化验结果信息 * * @param companyId * @param checkId * @return */ List<CheckItemData> getCheckCache(String companyId, String checkId); /** * 获取出入库流水ID序号 @@ -277,9 +258,18 @@ /** * 获取粮食定价 * * @param param * @return */ List<InoutPrice> getPrice(InoutCheckParam param); /** * 从缓存中删除 * * @param deptId * @param type * @param id */ void delFromCache(String deptId, String type, String id); } igds-inout/src/main/java/com/ld/igds/inout/service/impl/InoutServiceImpl.java
@@ -1,7 +1,6 @@ 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; @@ -9,20 +8,18 @@ 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; @@ -103,7 +100,7 @@ inoutMapper.deleteData(param); delInoutFromCache(param.getDeptId(), param.getType(), param.getId()); delFromCache(param.getDeptId(), param.getType(), param.getId()); return null; } @@ -115,7 +112,7 @@ } // 缓存中删除 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); @@ -285,11 +282,11 @@ 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); @@ -361,7 +358,7 @@ 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); @@ -373,7 +370,7 @@ } public void delInoutFromCache(String deptId, String type, String id) { public void delFromCache(String deptId, String type, String id) { if (StringUtils.isEmpty(deptId)) { return; } @@ -450,22 +447,6 @@ } @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())) { @@ -498,10 +479,7 @@ } @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); } @@ -509,7 +487,7 @@ 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())) { @@ -540,12 +518,6 @@ 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 igds-inout/src/main/java/com/ld/igds/m/service/HLossOverService.java
@@ -4,6 +4,7 @@ import java.util.HashMap; import java.util.Map; import javax.transaction.Transactional; import com.ld.igds.inout.InoutConstant; import com.ld.igds.inout.dto.InoutData; import com.ld.igds.inout.dto.InoutParam; @@ -76,7 +77,13 @@ data.setUpdateTime(new Date()); data.setUpdateUser(ContextUtil.getLoginUserCName()); InoutData inoutData = inoutService.getLastRecord(ContextUtil.getCompanyId(), data.getDepotId()); InoutParam param = new InoutParam(); param.setCompanyId(ContextUtil.getCompanyId()); param.setDepotId(data.getDepotId()); param.setProgress(InoutConstant.PROGRESS_RECORD); InoutData inoutData = inoutService.getLastRecord(param); if (null != inoutData && null != inoutData.getCompleteTime() && data.getSubmitTime().before(inoutData.getCompleteTime())) { igds-inout/src/main/resources/mapper/InoutRecordMapper.xml
@@ -143,12 +143,19 @@ <where> <if test="param.companyId != null and param.companyId != '' ">AND COMPANY_ID_ = #{param.companyId}</if> <if test="param.depotId != null and param.depotId != '' ">AND DEPOT_ID_ = #{param.depotId}</if> <if test="param.type != null and param.type != '' ">AND TYPE_ = #{param.type}</if> <if test="param.plateNum != null and param.plateNum != '' ">AND PLATE_NUM_ = #{param.plateNum}</if> <if test="param.intelCard != null and param.intelCard != '' ">AND INTEL_CARD_ = #{param.intelCard}</if> <if test="param.id != null and param.id != '' ">AND ID_ = #{param.id}</if> <if test="param.userId != null and param.userId != '' ">AND USER_ID_ = #{param.userId}</if> <if test="param.progress != null and param.progress != '' ">AND PROGRESS_ = #{param.progress}</if> <if test="param.start != null">AND REGISTER_TIME_ <![CDATA[ > ]]>#{param.start,jdbcType=TIMESTAMP} </if> <if test="param.end != null">AND COMPLETE_TIME_ <![CDATA[ < ]]>#{param.end,jdbcType=TIMESTAMP} </if> <if test="param.curStorage > 0">AND CUR_STORAGE_ > 0</if> </where> AND PROGRESS_ = 'RECORD' AND RECORD_STATUS_ != 'ERROR' AND RECORD_STATUS_ != 'DEL' ORDER BY COMPLETE_TIME_ DESC @@ -463,20 +470,8 @@ update D_INOUT_RECORD set PROGRESS_ = #{param.progress}, COMPLETE_TIME_ =#{param.completeTime}, <if test="param.fullWeight != null and param.fullWeight > 0">FULL_WEIGHT_ = #{param.fullWeight},</if> <if test="param.fullWeightUser != null">FULL_WEIGHT_USER_ = #{param.fullWeightUser},</if> <if test="param.fullWeightTime != null">FULL_WEIGHT_TIME_ = #{param.fullWeightTime},</if> <if test="param.emptyWeight != null and param.fullWeight > 0">EMPTY_WEIGHT_ = #{param.emptyWeight},</if> <if test="param.emptyWeightTime != null">EMPTY_WEIGHT_TIME_ = #{param.emptyWeightTime},</if> <if test="param.emptyWeightUser != null">EMPTY_WEIGHT_USER_ = #{param.emptyWeightUser},</if> <if test="param.netWeight != null and param.fullWeight > 0">NET_WEIGHT_ = #{param.netWeight},</if> <if test="param.settleWeight != null and param.settleWeight > 0">SETTLE_WEIGHT_ = #{param.settleWeight},</if> <if test="param.recordWeight != null and param.recordWeight > 0">RECORD_WEIGHT_ = #{param.recordWeight},</if> <if test="param.de != null and param.de > 0">DE_SUM_ = #{param.de},</if> <if test="param.depotId != null and param.depotId != ''">DEPOT_ID_ = #{param.depotId},</if> <if test="param.price != null and param.price > 0">PRICE_ = #{param.price},</if> <if test="param.settleMoney != null and param.settleMoney > 0">SETTLE_MONEY_ = #{param.settleMoney},</if> COMPLETE_USER_ = #{param.userId} COMPLETE_USER_ = #{param.userId}, UPDATE_TIME_ = sysdate where ID_ = #{param.id} and TYPE_ = #{param.type} and COMPANY_ID_ = #{param.companyId} igds-web/src/main/resources/static/admin/inout/in-card-back.js
@@ -16,36 +16,10 @@ showProgress(); }); //控制流程环节显示 function showProgress() { if(!inoutProgress){ return; } if(inoutProgress.indexOf("REGISTER") == -1){ $("#progress-register").css("display", "none"); } if(inoutProgress.indexOf("CHECK") == -1){ $("#progress-check").css("display", "none"); } if(inoutProgress.indexOf("WEIGHT_FULL") == -1){ $("#progress-fullWeight").css("display", "none"); } if(inoutProgress.indexOf("HANDLE") == -1){ $("#progress-hand").css("display", "none"); } if(inoutProgress.indexOf("WEIGHT_EMPTY") == -1){ $("#progress-emptyWeight").css("display", "none"); } if(inoutProgress.indexOf("CARD_BACK") == -1){ $("#progress-cardBack").css("display", "none"); } } //新的读卡方式 //使用插件读取智慧卡号 function flushICCard() { var index = layer.load(); $("#intelCard").val(null); resetForm(); $.ajax({ type: "GET", async: true, @@ -55,23 +29,26 @@ jsonp: "callback", jsonpCallback: "jsonpCallback", success: function (json) { //console.log(json); layer.close(index); var data = json.no; //console.log(data); if (data === "not found") { layer.alert("请重新读卡!", {offset: ['300px', '300px']}); alertError("请重新读卡!"); } else { $("#intelCard").val(data); //直接刷新数据 flushData(); } }, error: function () { layer.alert("IC卡读取出错!", {offset: ['300px', '300px']}); layer.close(index); alertError("IC卡读取出错!"); } }); } // 使用插件获取省份证 //使用插件读取身份证 function flushIdCard() { var index = layer.load(); $.ajax({ @@ -86,64 +63,17 @@ layer.close(index); var data = json.content; if (data === "not found") { layer.alert("没有读取到身份证信息,请手动录入!", { offset: ['300px', '300px'] }); alertError("没有获取到身份证信息!"); return; } $("#userId").val(data.idNum); flushData(); }, error: function () { layer.alert("身份证读取失败,请手动录入!", { offset: ['300px', '300px'] }); layer.close(index); alertError("身份证读取失败!"); } }); } // 打印过磅单 function printBill() { if (!recordData) { layer.alert("没有获取到业务数据,不支持打印!"); return; } if(InoutProgress.CARD_BACK != recordData.progress){ layer.alert("当前数据不完整,不支持打印!"); return; } //从后台获取模版并打印 var index = layer.load(); $.ajax({ type : "POST", url : "../../basic/inout-report/inout-bill-weight", dataType : "json", contentType : "application/json;charset=UTF-8", data : JSON.stringify(recordData), success : function(result) { if (result.code != "0000") { layer.msg(result.msg); } else { layer.msg("开始渲染打印单……"); printWeight(result.data); } layer.close(index); }, error : function() { layer.close(index); layer.msg("获取打印模版失败,请联系管理员查看原因!!"); } }); } // 打印抽样单 function showCheck() { if (null == recordData) { layer.alert("没有获取到业务数据,无法查看!"); } } // 表单清空 @@ -162,6 +92,7 @@ var plateNum = $("#plateNum").val(); var userId2 = $("#userId").val(); var intelCard = $("#intelCard").val(); var param = { type : type, progress : progress, @@ -190,7 +121,7 @@ }, error : function() { layer.close(index); layer.alert("查询失败,请重新尝试!!"); alertError("查询失败,请重新尝试!") } }); } @@ -198,7 +129,7 @@ // 当前完成 function submit() { if (!recordData) { layer.alert("没有数据可以提交!!!"); alertError("没有数据可以提交!"); return; } igds-web/src/main/resources/static/img/areation/default/pfc2_a.pngigds-web/src/main/resources/static/img/areation/default/pfc2_b.pngigds-web/src/main/resources/static/img/areation/default/pfc_a.pngigds-web/src/main/resources/static/img/areation/default/pfc_b.pngigds-web/src/main/resources/templates/admin/inout/in-card-back.html
@@ -39,17 +39,9 @@ <div class="qyzj-btnbox layui-clear"> <div class="rkbk-quick fl"> <button class="rkbk-quick-btn layui-btn" onclick="showCheck()"> <i><img th:src="@{../../static/images/icon-hyd.png}"/></i> 查看化验单 </button> <button class="rkbk-quick-btn layui-btn btn-green" onclick="submit()"> <i><img th:src="@{../../static/images/icon-ok.png}"/></i> 收卡出库 </button> <button class="rkbk-quick-btn layui-btn btn-violet" onclick="printBill()"> <i><img th:src="@{../../static/images/icon-dayin.png}"/></i> 打印过磅单 </button> </div> @@ -188,7 +180,7 @@ <div class="rkbk-quick layui-text-center"> <button id="button_readID" type="button" onclick="flushIdCard()" class="rkbk-quick-btn layui-btn btn-blue">读取身份证 class="rkbk-quick-btn layui-btn btn-blue">读身份证查询 </button> </div> <!--rkbk-form-box2 end--> @@ -211,33 +203,35 @@ <div class="rkbk-left-form rkbk-right-form"> <form class="layui-form" action="" id="form-data" lay-filter="form-data"> <div class="layui-form-item display-none"> <label class="layui-form-label">隐藏字段-ID</label> <input type="text" name="id"> </div> <div class="layui-form-item display-none"> <label class="layui-form-label">隐藏字段-流程节点</label> <input type="text" name="progress"> </div> <div class="layui-form-item display-none"> <label class="layui-form-label">隐藏字段-业务类型</label> <input type="text" name="type"> </div> <div class="layui-form-item display-none"> <input type="text" name="deptId"> </div> <div class="layui-form-item display-none"> <input type="text" name="noticeId"> </div> <div class="layui-form-item"> <input type="button" value="读卡" class="rkbk-r-btn fr layui-btn" onclick="flushICCard()"> <input type="button" value="读卡查询" class="rkbk-r-btn fr layui-btn" onclick="flushICCard()"> <label class="layui-form-label">智慧卡号</label> <div class="layui-input-block"> <input type="text" name="intelCard" id="intelCard" placeholder="先点击读卡,后放卡......" autocomplete="off" placeholder="读卡获取" autocomplete="off" class="layui-input"> </div> </div> <div class="layui-form-item"> <input type="button" value="查询" class="rkbk-r-btn fr layui-btn" onclick="flushData()"> <input type="button" value="车牌查询" class="rkbk-r-btn fr layui-btn" onclick="flushData()"> <label class="layui-form-label">车牌号</label> <div class="layui-input-block"> <input type="text" name="plateNum" id="plateNum" @@ -258,23 +252,27 @@ </div> <div class="layui-form-item"> <label class="layui-form-label">粮食品种</label> <label class="layui-form-label">出入库类型</label> <div class="layui-input-block"> <select name="foodVariety" disabled> <option value="">自动获取</option> <option th:each="dic,dicSet:${listFoodVariety}" th:value="${dic.code}" th:text="${dic.name}"></option> <select name="type" disabled> <option value="IN">入库作业</option> <option value="OUT">出库作业</option> </select> </div> </div> <div class="layui-form-item"> <label class="layui-form-label">粮食等级</label> <label class="layui-form-label">流程进度</label> <div class="layui-input-block"> <select name="foodLevel" disabled> <option value="">自动获取</option> <option th:each="dic,dicSet:${listFoodLevel}" th:value="${dic.code}" th:text="${dic.name}"></option> <select name="progress" disabled> <option value="REGISTER">登记环节</option> <option value="CHECK">质检环节</option> <option value="HANDLE">值仓环节</option> <option value="WEIGHT_TAG">称重环节</option> <option value="WEIGHT_FULL">称重环节</option> <option value="WEIGHT_EMPTY">称重环节</option> <option value="CARD_BACK">离库确认</option> <option value="RECORD">流程完成</option> </select> </div> </div> @@ -293,6 +291,15 @@ autocomplete="off" class="layui-input rkbk-search-input" disabled> </div> </div> <div class="rkbk-quick layui-text-center"> <button class="rkbk-quick-btn layui-btn btn-green" onclick="submit()"> <i><img th:src="@{../../static/images/icon-ok.png}"/></i> 收卡出库 </button> </div> </form> </div> </div> @@ -322,9 +329,6 @@ var companyId = [[${loginUser.companyId}]]; //出入库类型 var type = [[${type}]]; //品种 var listFoodVariety = [[${listFoodVariety}]]; var listFoodLevel = [[${listFoodLevel}]]; </script> @@ -332,7 +336,7 @@ <script th:src="@{../../static/js/jquery.min.js}"></script> <script th:src="@{../../static/js/constant.js}"></script> <script th:src="@{../../static/js/igds-common.js}"></script> <script th:src="@{../../static/admin/inout/inout-print.js}"></script> <script th:src="@{../../static/admin/inout/inout-common.js}"></script> <script th:src="@{../../static/admin/inout/in-card-back.js}"></script> <!-- 弹出框的信息 --> igds-web/src/main/resources/verb-conf.properties
@@ -134,12 +134,16 @@ verb.mapImg.5307_001.a=default_qyc_a.png verb.mapImg.5307_001.b=default_qyc_b.png ## 5000_001 verb.mapImg.5000_001.a=default_pfc_a.png verb.mapImg.5000_001.b=default_pfc_b.png verb.mapImg.5000_001.a=default_pfc2_a.png verb.mapImg.5000_001.b=default_pfc2_b.png verb.mapImg.5000_0137.a=default_qyc_a.png verb.mapImg.5000_0137.b=default_qyc_b.png verb.mapImg.5000_0138.a=default_qyc_a.png verb.mapImg.5000_0138.b=default_qyc_b.png ## 5322_001 广东徐闻 verb.mapImg.5322_001.a=default_pfc_a.png verb.mapImg.5322_001.b=default_pfc_b.png