计划模块(订单拆分搜索后拆分BUG解决)

highway
wws 1 year ago
parent 09a473f1f1
commit 0f372dae51

@ -3,15 +3,10 @@ package com.op.plan.controller;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import com.op.common.core.domain.R; import com.op.common.core.domain.R;
import com.op.common.core.utils.DateUtils; import com.op.common.core.utils.DateUtils;
import com.op.plan.domain.ProLine;
import com.op.plan.domain.ProRoute;
import com.op.plan.domain.ProShift;
import com.op.plan.domain.dto.SplitOrderDTO; import com.op.plan.domain.dto.SplitOrderDTO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -32,7 +27,6 @@ import com.op.common.core.web.domain.AjaxResult;
import com.op.common.core.utils.poi.ExcelUtil; import com.op.common.core.utils.poi.ExcelUtil;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import static com.op.common.security.utils.SecurityUtils.getUsername;
/** /**
* Controller * Controller
@ -46,6 +40,16 @@ public class ProOrderController extends BaseController {
@Autowired @Autowired
private IProOrderService proOrderService; private IProOrderService proOrderService;
/**
* Code
* @param orderCode
* @return
*/
@GetMapping("/getCascadeProOrder/{orderCode}")
public AjaxResult getCascadeProOrder(@PathVariable("orderCode") String orderCode) {
return proOrderService.getCascadeProOrder(orderCode);
}
/** /**
* *
* *

@ -133,4 +133,11 @@ public interface IProOrderService {
* @return * @return
*/ */
List<ProLine> getProEquipment(String routeCode); List<ProLine> getProEquipment(String routeCode);
/**
* Code
* @param orderCode
* @return
*/
AjaxResult getCascadeProOrder(String orderCode);
} }

@ -514,6 +514,49 @@ public class ProOrderServiceImpl implements IProOrderService {
return proOrderMapper.selectEquipment(split); return proOrderMapper.selectEquipment(split);
} }
/**
* Code
* @param orderCode
* @return
*/
@Override
@DS("#header.poolName")
public AjaxResult getCascadeProOrder(String orderCode) {
// 创建查询存放列表
List<ProOrder> proOrderList = new ArrayList<>();
// 存放code信息
StringBuilder tempCode = new StringBuilder();
tempCode.append(orderCode);
// 查询母订单信息并存放
ProOrder proOrder = proOrderMapper.selectProOrderByOrderCode(tempCode.toString());
proOrderList.add(proOrder);
// 递归查询子订单
while (true) {
List<ProOrder> childProOrderList = proOrderMapper.selectChildProOrderByCode(tempCode.toString());
if (childProOrderList.size() > 0) {
proOrderList.add(childProOrderList.get(0));
tempCode.setLength(0);
tempCode.append(childProOrderList.get(0).getOrderCode());
}else {
break;
}
}
// 创建返回对象
ProOrder proOrderVO = new ProOrder();
// 处理列表
for (int i = proOrderList.size()-1; i > 0; i--) {
List<ProOrder> setList = new ArrayList<>();
setList.add(proOrderList.get(i));
proOrderList.get(i-1).setChildren(setList);
}
BeanUtils.copyProperties(proOrderList.get(0),proOrderVO);
return success(proOrderVO);
}
public void getSAPOrderByFactory(String poolName) { public void getSAPOrderByFactory(String poolName) {
DynamicDataSourceContextHolder.push(poolName);// 这是数据源的key DynamicDataSourceContextHolder.push(poolName);// 这是数据源的key
SapProOrder sapqo = new SapProOrder();//proOrderMapper.getMaxCreatetime(); SapProOrder sapqo = new SapProOrder();//proOrderMapper.getMaxCreatetime();

Loading…
Cancel
Save