调整退货单各流程节点逻辑

This commit is contained in:
1378012178@qq.com 2025-12-24 11:06:51 +08:00
parent 59cbc8da3d
commit eb98331dd1
3 changed files with 55 additions and 23 deletions

View File

@ -74,11 +74,11 @@ public class InvoicingThdApi {
if (StringUtils.isBlank(dto.getId())) { if (StringUtils.isBlank(dto.getId())) {
return Result.error("缺少参数"); return Result.error("缺少参数");
} }
boolean result = tuiHuoApi.startDirectiveServe(dto); Map<String, String> result = tuiHuoApi.startDirectiveServe(dto);
if (result) { if ("0".equals(result.get("error_code"))) {
return Result.OK("操作成功"); return Result.OK(result.get("msg"));
} else { } else {
return Result.error("操作失败"); return Result.error(result.get("msg"));
} }
} }
@ -221,11 +221,11 @@ public class InvoicingThdApi {
if (StringUtils.isBlank(dto.getId())) { if (StringUtils.isBlank(dto.getId())) {
return Result.error("缺少参数"); return Result.error("缺少参数");
} }
boolean result = tuiHuoApi.finishDirectiveServe(dto); Map<String, String> result = tuiHuoApi.finishDirectiveServe(dto);
if (result) { if ("0".equals(result.get("error_code"))) {
return Result.OK("操作成功"); return Result.OK(result.get("msg"));
} else { } else {
return Result.error("操作失败"); return Result.error(result.get("msg"));
} }
} }

View File

@ -16,7 +16,7 @@ public interface ITuiHuoApi {
List<NuKcslEntity> thdNuMaterialList(InvoicingThdMainEntity dto); List<NuKcslEntity> thdNuMaterialList(InvoicingThdMainEntity dto);
boolean startDirectiveServe(InvoicingThdMainEntity dto); Map<String, String> startDirectiveServe(InvoicingThdMainEntity dto);
boolean startServe(InvoicingThdMainEntity dto); boolean startServe(InvoicingThdMainEntity dto);
@ -30,7 +30,7 @@ public interface ITuiHuoApi {
Map<String,String> submitThd(InvoicingThdMainEntity dto); Map<String,String> submitThd(InvoicingThdMainEntity dto);
boolean finishDirectiveServe(InvoicingThdMainEntity dto); Map<String, String> finishDirectiveServe(InvoicingThdMainEntity dto);
boolean finishServe(InvoicingThdMainEntity dto); boolean finishServe(InvoicingThdMainEntity dto);

View File

@ -135,15 +135,34 @@ public class ThdServiceImpl implements ITuiHuoApi {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean startDirectiveServe(InvoicingThdMainEntity dto) { public Map<String, String> startDirectiveServe(InvoicingThdMainEntity dto) {
Map<String, String> r_ = Maps.newHashMap();
InvoicingOrdersEntity p_ = new InvoicingOrdersEntity();
p_.setId(dto.getId());
InvoicingOrdersEntity v_ = invoicingOrdersApi.getDyThOrderInfo(p_);
if (v_ == null || StringUtils.isBlank(v_.getPoolId())) {
r_.put("error_code", "1");
r_.put("msg", "此工单不存在");
return r_;
}
String mainId = v_.getPoolId();//退货主表id
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
InvoicingOrdersEntity orderEntity = new InvoicingOrdersEntity(); InvoicingOrdersEntity orderEntity = new InvoicingOrdersEntity();
orderEntity.setFlowCode("dyth_cksh");//指令流程flow_code 看接口有标明 orderEntity.setFlowCode("dyth_cksh");//指令流程flow_code 看接口有标明
orderEntity.setId(dto.getId());//退货主表id 入库时会根据更新为对应退货单号入库时才生成的退货单号 orderEntity.setId(dto.getId());//退货指令id
orderEntity.setInitiatorId(sysUser.getEmployessId());//员工id orderEntity.setInitiatorId(sysUser.getEmployessId());//员工id
invoicingOrdersApi.beginDyThOrder(orderEntity); Map<String, String> result = invoicingOrdersApi.beginDyThOrder(orderEntity);
if ("0".equals(result.get("error_code"))) {
return true; //将状态改为已开始
UpdateWrapper<NuInvoicingThdMain> thUW = new UpdateWrapper<>();
thUW.eq("id", mainId);
NuInvoicingThdMain m = new NuInvoicingThdMain();
m.setId(mainId);
m.setStatus("1");
thdMainMapper.updateById(m);
}
return result;
} }
@ -539,12 +558,15 @@ public class ThdServiceImpl implements ITuiHuoApi {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean finishDirectiveServe(InvoicingThdMainEntity dto) { public Map<String, String> finishDirectiveServe(InvoicingThdMainEntity dto) {
Map<String, String> r_ = Maps.newHashMap();
InvoicingOrdersEntity p_ = new InvoicingOrdersEntity(); InvoicingOrdersEntity p_ = new InvoicingOrdersEntity();
p_.setId(dto.getId()); p_.setId(dto.getId());
InvoicingOrdersEntity v_ = invoicingOrdersApi.getDyThOrderInfo(p_); InvoicingOrdersEntity v_ = invoicingOrdersApi.getDyThOrderInfo(p_);
if(v_ == null || StringUtils.isBlank(v_.getPoolId())){ if (v_ == null || StringUtils.isBlank(v_.getPoolId())) {
return false; r_.put("error_code", "1");
r_.put("msg", "此工单不存在");
return r_;
} }
String mainId = v_.getPoolId();//退货单id String mainId = v_.getPoolId();//退货单id
@ -555,8 +577,10 @@ public class ThdServiceImpl implements ITuiHuoApi {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//检测是否已入库 //检测是否已入库
if(main == null || !"2".equals(main.getStatus())){ if (main == null || !"2".equals(main.getStatus())) {
return false; r_.put("error_code", "1");
r_.put("msg", "退货单未入库");
return r_;
} }
InvoicingOrdersEntity orderEntity = new InvoicingOrdersEntity(); InvoicingOrdersEntity orderEntity = new InvoicingOrdersEntity();
@ -564,9 +588,17 @@ public class ThdServiceImpl implements ITuiHuoApi {
orderEntity.setId(dto.getId());//退货指令的id orderEntity.setId(dto.getId());//退货指令的id
orderEntity.setBizId(main.getThdNo()); orderEntity.setBizId(main.getThdNo());
orderEntity.setInitiatorId(sysUser.getEmployessId());//员工id orderEntity.setInitiatorId(sysUser.getEmployessId());//员工id
invoicingOrdersApi.finishDyThOrder(orderEntity); Map<String, String> result = invoicingOrdersApi.finishDyThOrder(orderEntity);
if ("0".equals(result.get("error_code"))) {
return true; //将状态改为已开始
UpdateWrapper<NuInvoicingThdMain> thUW = new UpdateWrapper<>();
thUW.eq("id", mainId);
NuInvoicingThdMain m = new NuInvoicingThdMain();
m.setId(mainId);
m.setStatus("3");
thdMainMapper.updateById(m);
}
return result;
} }
@Override @Override