|
|
@ -1,8 +1,10 @@
|
|
|
|
package com.op.plan.controller;
|
|
|
|
package com.op.plan.controller;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.op.common.core.exception.ServiceException;
|
|
|
|
import com.op.plan.domain.ProOrder;
|
|
|
|
import com.op.plan.domain.ProOrder;
|
|
|
|
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;
|
|
|
@ -143,24 +145,39 @@ public class ProOrderWorkorderController extends BaseController {
|
|
|
|
@DeleteMapping("/{workorderIds}")
|
|
|
|
@DeleteMapping("/{workorderIds}")
|
|
|
|
public AjaxResult remove(@PathVariable String[] workorderIds) {
|
|
|
|
public AjaxResult remove(@PathVariable String[] workorderIds) {
|
|
|
|
//什么时候可以删除工单?TODO;没进入生产之前都可以?
|
|
|
|
//什么时候可以删除工单?TODO;没进入生产之前都可以?
|
|
|
|
ProOrderWorkorder proOrderWorkorder = new ProOrderWorkorder();
|
|
|
|
// 根据工单的ids查工单的信息
|
|
|
|
|
|
|
|
List<ProOrderWorkorder> proOrderWorkorders = proOrderWorkorderService.selectProOrderWorkorderByWorkIds(workorderIds);
|
|
|
|
|
|
|
|
if (ObjectUtils.isEmpty(proOrderWorkorders)){
|
|
|
|
|
|
|
|
throw new ServiceException("所查询的工单为空!!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ArrayList<String> strings = new ArrayList<>();
|
|
|
|
|
|
|
|
for (ProOrderWorkorder proOrderWorkorder : proOrderWorkorders) {
|
|
|
|
String status = proOrderWorkorder.getStatus();
|
|
|
|
String status = proOrderWorkorder.getStatus();
|
|
|
|
ProOrder proOrder = new ProOrder();
|
|
|
|
strings.add(status);
|
|
|
|
String status1 = proOrder.getStatus();
|
|
|
|
}
|
|
|
|
if (proOrderWorkorder != null) {
|
|
|
|
String[] orderWorkerIds= strings.toArray(new String[0]);
|
|
|
|
int parsedStatus1 = Integer.parseInt(status1);
|
|
|
|
for (String orderWorkerId : orderWorkerIds) {
|
|
|
|
int parsedStatus = Integer.parseInt(status);
|
|
|
|
if (orderWorkerId.equals("w0")){
|
|
|
|
|
|
|
|
return toAjax(proOrderWorkorderService.deleteProOrderWorkorderByWorkorderIds(workorderIds));
|
|
|
|
if (parsedStatus1 == 1 && parsedStatus == 0) {
|
|
|
|
|
|
|
|
proOrderWorkorderService.deleteProOrderWorkorderByWorkorderIds(workorderIds);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
System.out.println("订单未拆分或工单已经下单");
|
|
|
|
throw new ServiceException("工单已经下单,不能删除!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// if (!ObjectUtils.isEmpty(proOrderWorkorder) && Integer.parseInt(status1)==1 && Integer.parseInt(status)==0){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ProOrderWorkorder proOrderWorkorder = new ProOrderWorkorder();
|
|
|
|
|
|
|
|
// String status = proOrderWorkorder.getStatus();
|
|
|
|
|
|
|
|
// ProOrder proOrder = new ProOrder();
|
|
|
|
|
|
|
|
// String status1 = proOrder.getStatus();
|
|
|
|
|
|
|
|
// if (proOrderWorkorder != null) {
|
|
|
|
|
|
|
|
// int parsedStatus1 = Integer.parseInt(status1);
|
|
|
|
|
|
|
|
// int parsedStatus = Integer.parseInt(status);
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// if (parsedStatus1 == 1 && parsedStatus == 0) {
|
|
|
|
// proOrderWorkorderService.deleteProOrderWorkorderByWorkorderIds(workorderIds);
|
|
|
|
// proOrderWorkorderService.deleteProOrderWorkorderByWorkorderIds(workorderIds);
|
|
|
|
// }else {
|
|
|
|
// } else {
|
|
|
|
// System.out.println("订单未拆分或工单已经下单");
|
|
|
|
// throw new ServiceException("订单未拆分或工单已经下单");
|
|
|
|
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
return toAjax(proOrderWorkorderService.deleteProOrderWorkorderByWorkorderIds(workorderIds));
|
|
|
|
return toAjax(proOrderWorkorderService.deleteProOrderWorkorderByWorkorderIds(workorderIds));
|
|
|
|
}
|
|
|
|
}
|
|
|
|