diff --git a/nursing-unit-api/src/main/java/com/nu/modules/pad/invoicing/api/InvoicingThdApi.java b/nursing-unit-api/src/main/java/com/nu/modules/pad/invoicing/api/InvoicingThdApi.java index 9f8ed23b..1f5ebba1 100644 --- a/nursing-unit-api/src/main/java/com/nu/modules/pad/invoicing/api/InvoicingThdApi.java +++ b/nursing-unit-api/src/main/java/com/nu/modules/pad/invoicing/api/InvoicingThdApi.java @@ -61,6 +61,27 @@ public class InvoicingThdApi { return Result.OK(pageList); } + /** + * 退货单-服务指令-开始服务 + * + * @param dto + * @return + */ + @ApiOperation(value = "退货单-服务指令-开始服务", notes = "退货单-服务指令-开始服务") + @AutoLog(value = "退货单-服务指令-开始服务", clientType = "app") + @PostMapping(value = "/startDirectiveServe") + public Result startDirectiveServe(@RequestBody InvoicingThdMainEntity dto) { + if (StringUtils.isBlank(dto.getId())) { + return Result.error("缺少参数"); + } + boolean result = tuiHuoApi.startDirectiveServe(dto); + if (result) { + return Result.OK("操作成功"); + } else { + return Result.error("操作失败"); + } + } + /** * 退货单-开始服务 * @@ -187,6 +208,27 @@ public class InvoicingThdApi { } } + /** + * 退货单-服务指令-结束服务 + * + * @param dto + * @return + */ + @ApiOperation(value = "退货单-服务指令-结束服务", notes = "退货单-服务指令-结束服务") + @AutoLog(value = "退货单-服务指令-结束服务", clientType = "app") + @PostMapping(value = "/finishDirectiveServe") + public Result finishDirectiveServe(@RequestBody InvoicingThdMainEntity dto) { + if (StringUtils.isBlank(dto.getId())) { + return Result.error("缺少参数"); + } + boolean result = tuiHuoApi.finishDirectiveServe(dto); + if (result) { + return Result.OK("操作成功"); + } else { + return Result.error("操作失败"); + } + } + /** * 退货单-结束服务 * diff --git a/nursing-unit-invoicing/nu-invoicing-api/nu-invoicing-local-api/src/main/java/com/nu/modules/invoicing/api/ITuiHuoApi.java b/nursing-unit-invoicing/nu-invoicing-api/nu-invoicing-local-api/src/main/java/com/nu/modules/invoicing/api/ITuiHuoApi.java index b434d178..329ba740 100644 --- a/nursing-unit-invoicing/nu-invoicing-api/nu-invoicing-local-api/src/main/java/com/nu/modules/invoicing/api/ITuiHuoApi.java +++ b/nursing-unit-invoicing/nu-invoicing-api/nu-invoicing-local-api/src/main/java/com/nu/modules/invoicing/api/ITuiHuoApi.java @@ -16,6 +16,8 @@ public interface ITuiHuoApi { List thdNuMaterialList(InvoicingThdMainEntity dto); + boolean startDirectiveServe(InvoicingThdMainEntity dto); + boolean startServe(InvoicingThdMainEntity dto); Map addThc(InvoicingThdGwcEntity dto); @@ -28,6 +30,8 @@ public interface ITuiHuoApi { Map submitThd(InvoicingThdMainEntity dto); + boolean finishDirectiveServe(InvoicingThdMainEntity dto); + boolean finishServe(InvoicingThdMainEntity dto); boolean transRead(InvoicingThdMainEntity dto); diff --git a/nursing-unit-invoicing/nu-invoicing-biz/src/main/java/com/nu/modules/thd/service/impl/ThdServiceImpl.java b/nursing-unit-invoicing/nu-invoicing-biz/src/main/java/com/nu/modules/thd/service/impl/ThdServiceImpl.java index 143e8e84..1e9e0db7 100644 --- a/nursing-unit-invoicing/nu-invoicing-biz/src/main/java/com/nu/modules/thd/service/impl/ThdServiceImpl.java +++ b/nursing-unit-invoicing/nu-invoicing-biz/src/main/java/com/nu/modules/thd/service/impl/ThdServiceImpl.java @@ -132,6 +132,20 @@ public class ThdServiceImpl implements ITuiHuoApi { return nuKcslMapper.thdNuMaterialList(dto); } + @Override + @Transactional(rollbackFor = Exception.class) + public boolean startDirectiveServe(InvoicingThdMainEntity dto) { + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + InvoicingOrdersEntity orderEntity = new InvoicingOrdersEntity(); + orderEntity.setFlowCode("dyth_cksh");//指令流程flow_code 看接口有标明 + orderEntity.setPoolId(dto.getId());//退货主表id 入库时会根据更新为对应退货单号(入库时才生成的退货单号) + orderEntity.setInitiatorId(sysUser.getEmployessId());//员工id + invoicingOrdersApi.beginDyThOrder(orderEntity); + + return true; + } + + @Override @Transactional(rollbackFor = Exception.class) public boolean startServe(InvoicingThdMainEntity dto) { @@ -162,12 +176,6 @@ public class ThdServiceImpl implements ITuiHuoApi { logData.setElderId(main.getElderId());//长者id thdLogMapper.insert(logData); - InvoicingOrdersEntity orderEntity = new InvoicingOrdersEntity(); - orderEntity.setFlowCode("dyth_cksh");//指令流程flow_code 看接口有标明 - orderEntity.setPoolId(dto.getId());//退货主表id 入库时会根据更新为对应退货单号(入库时才生成的退货单号) - orderEntity.setInitiatorId(sysUser.getEmployessId());//员工id - invoicingOrdersApi.beginDyThOrder(orderEntity); - return true; } } @@ -261,6 +269,16 @@ public class ThdServiceImpl implements ITuiHuoApi { //先进行单子检测 { + //检测是否处于开始服务状态 + InvoicingOrdersEntity p_ = new InvoicingOrdersEntity(); + p_.setPoolId(dto.getId()); + InvoicingOrdersEntity j = invoicingOrdersApi.getDyThOrderInfo(p_); + if (j == null || !"Y".equals(j.getIzStart())) { + result.put("status", "nodeError"); + result.put("message", "请先点击开始服务"); + return result; + } + //检测单子状态是否正确 if (main == null || !"1".equals(main.getStatus())) { result.put("status", "nodeError"); @@ -276,7 +294,7 @@ public class ThdServiceImpl implements ITuiHuoApi { // return result; // } //未添加退货物料检测 - if(CollectionUtils.isEmpty(gwcList)){ + if (CollectionUtils.isEmpty(gwcList)) { result.put("status", "faild"); result.put("message", "未添加物料"); return result; @@ -284,8 +302,8 @@ public class ThdServiceImpl implements ITuiHuoApi { } //处理数据 主表当前数据:main + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); { - LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); String status = "2";//当前节点 - 已入库 String thdNo = null;//退货单号 List wlList = Lists.newArrayList();//本次涉及物料id @@ -505,10 +523,38 @@ public class ThdServiceImpl implements ITuiHuoApi { } } + InvoicingOrdersEntity orderEntity = new InvoicingOrdersEntity(); + orderEntity.setPoolId(dto.getId());//退货主表id 入库时会根据更新为对应退货单号(入库时才生成的退货单号) + orderEntity.setBizId(main.getThdNo()); + orderEntity.setInitiatorId(sysUser.getEmployessId());//员工id + orderEntity.setNuId(main.getNuId());//护理单元id + orderEntity.setElderId(main.getElderId());//长者id + orderEntity.setFlowCode("dyth_cksh");//指令流程flow_code 看接口有标明 + invoicingOrdersApi.updateDyThOrderBizId(orderEntity); + result.put("status", "success"); return result; } + @Override + @Transactional(rollbackFor = Exception.class) + public boolean finishDirectiveServe(InvoicingThdMainEntity dto) { + //查询当前状态 + QueryWrapper qw = new QueryWrapper<>(); + qw.eq("id", dto.getId()); + NuInvoicingThdMain main = thdMainMapper.selectOne(qw); + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + + InvoicingOrdersEntity orderEntity = new InvoicingOrdersEntity(); + orderEntity.setFlowCode("dyth_cksh");//指令流程flow_code 看接口有标明 + orderEntity.setPoolId(dto.getId());//退货主表id 入库时会根据更新为对应退货单号(入库时才生成的退货单号) + orderEntity.setBizId(main.getThdNo()); + orderEntity.setInitiatorId(sysUser.getEmployessId());//员工id + invoicingOrdersApi.finishDyThOrder(orderEntity); + + return true; + } + @Override @Transactional(rollbackFor = Exception.class) public boolean finishServe(InvoicingThdMainEntity dto) { @@ -540,13 +586,6 @@ public class ThdServiceImpl implements ITuiHuoApi { logData.setElderId(main.getElderId());//长者id thdLogMapper.insert(logData); - InvoicingOrdersEntity orderEntity = new InvoicingOrdersEntity(); - orderEntity.setFlowCode("dyth_cksh");//指令流程flow_code 看接口有标明 - orderEntity.setPoolId(dto.getId());//退货主表id 入库时会根据更新为对应退货单号(入库时才生成的退货单号) - orderEntity.setBizId(main.getThdNo()); - orderEntity.setInitiatorId(sysUser.getEmployessId());//员工id - invoicingOrdersApi.finishDyThOrder(orderEntity); - return true; } }