调整退货单各流程节点逻辑
This commit is contained in:
parent
59cbc8da3d
commit
eb98331dd1
|
|
@ -74,11 +74,11 @@ public class InvoicingThdApi {
|
|||
if (StringUtils.isBlank(dto.getId())) {
|
||||
return Result.error("缺少参数");
|
||||
}
|
||||
boolean result = tuiHuoApi.startDirectiveServe(dto);
|
||||
if (result) {
|
||||
return Result.OK("操作成功");
|
||||
Map<String, String> result = tuiHuoApi.startDirectiveServe(dto);
|
||||
if ("0".equals(result.get("error_code"))) {
|
||||
return Result.OK(result.get("msg"));
|
||||
} else {
|
||||
return Result.error("操作失败");
|
||||
return Result.error(result.get("msg"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -221,11 +221,11 @@ public class InvoicingThdApi {
|
|||
if (StringUtils.isBlank(dto.getId())) {
|
||||
return Result.error("缺少参数");
|
||||
}
|
||||
boolean result = tuiHuoApi.finishDirectiveServe(dto);
|
||||
if (result) {
|
||||
return Result.OK("操作成功");
|
||||
Map<String, String> result = tuiHuoApi.finishDirectiveServe(dto);
|
||||
if ("0".equals(result.get("error_code"))) {
|
||||
return Result.OK(result.get("msg"));
|
||||
} else {
|
||||
return Result.error("操作失败");
|
||||
return Result.error(result.get("msg"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ public interface ITuiHuoApi {
|
|||
|
||||
List<NuKcslEntity> thdNuMaterialList(InvoicingThdMainEntity dto);
|
||||
|
||||
boolean startDirectiveServe(InvoicingThdMainEntity dto);
|
||||
Map<String, String> startDirectiveServe(InvoicingThdMainEntity dto);
|
||||
|
||||
boolean startServe(InvoicingThdMainEntity dto);
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ public interface ITuiHuoApi {
|
|||
|
||||
Map<String,String> submitThd(InvoicingThdMainEntity dto);
|
||||
|
||||
boolean finishDirectiveServe(InvoicingThdMainEntity dto);
|
||||
Map<String, String> finishDirectiveServe(InvoicingThdMainEntity dto);
|
||||
|
||||
boolean finishServe(InvoicingThdMainEntity dto);
|
||||
|
||||
|
|
|
|||
|
|
@ -135,15 +135,34 @@ public class ThdServiceImpl implements ITuiHuoApi {
|
|||
|
||||
@Override
|
||||
@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();
|
||||
InvoicingOrdersEntity orderEntity = new InvoicingOrdersEntity();
|
||||
orderEntity.setFlowCode("dyth_cksh");//指令流程flow_code 看接口有标明
|
||||
orderEntity.setId(dto.getId());//退货主表id 入库时会根据更新为对应退货单号(入库时才生成的退货单号)
|
||||
orderEntity.setId(dto.getId());//退货指令id
|
||||
orderEntity.setInitiatorId(sysUser.getEmployessId());//员工id
|
||||
invoicingOrdersApi.beginDyThOrder(orderEntity);
|
||||
|
||||
return true;
|
||||
Map<String, String> result = invoicingOrdersApi.beginDyThOrder(orderEntity);
|
||||
if ("0".equals(result.get("error_code"))) {
|
||||
//将状态改为已开始
|
||||
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
|
||||
@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();
|
||||
p_.setId(dto.getId());
|
||||
InvoicingOrdersEntity v_ = invoicingOrdersApi.getDyThOrderInfo(p_);
|
||||
if(v_ == null || StringUtils.isBlank(v_.getPoolId())){
|
||||
return false;
|
||||
if (v_ == null || StringUtils.isBlank(v_.getPoolId())) {
|
||||
r_.put("error_code", "1");
|
||||
r_.put("msg", "此工单不存在");
|
||||
return r_;
|
||||
}
|
||||
|
||||
String mainId = v_.getPoolId();//退货单id
|
||||
|
|
@ -555,8 +577,10 @@ public class ThdServiceImpl implements ITuiHuoApi {
|
|||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
|
||||
//检测是否已入库
|
||||
if(main == null || !"2".equals(main.getStatus())){
|
||||
return false;
|
||||
if (main == null || !"2".equals(main.getStatus())) {
|
||||
r_.put("error_code", "1");
|
||||
r_.put("msg", "退货单未入库");
|
||||
return r_;
|
||||
}
|
||||
|
||||
InvoicingOrdersEntity orderEntity = new InvoicingOrdersEntity();
|
||||
|
|
@ -564,9 +588,17 @@ public class ThdServiceImpl implements ITuiHuoApi {
|
|||
orderEntity.setId(dto.getId());//退货指令的id
|
||||
orderEntity.setBizId(main.getThdNo());
|
||||
orderEntity.setInitiatorId(sysUser.getEmployessId());//员工id
|
||||
invoicingOrdersApi.finishDyThOrder(orderEntity);
|
||||
|
||||
return true;
|
||||
Map<String, String> result = invoicingOrdersApi.finishDyThOrder(orderEntity);
|
||||
if ("0".equals(result.get("error_code"))) {
|
||||
//将状态改为已开始
|
||||
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
|
||||
|
|
|
|||
Loading…
Reference in New Issue