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