计划模块——删除工单

highway
chj 1 year ago
parent d59136a945
commit c20fcc180c

@ -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));
} }

@ -121,5 +121,7 @@ public interface ProOrderWorkorderMapper {
int deleteProOrderWorkorderByOrderId(String id); int deleteProOrderWorkorderByOrderId(String id);
void createPrepare(MesPrepare mesPrepare); void createPrepare(MesPrepare mesPrepare);
List<ProOrderWorkorder> selectProOrderWorkerderByWorkerIds(String[] ids);
} }

@ -102,4 +102,11 @@ public interface IProOrderWorkorderService {
*/ */
AjaxResult checkWorkOrder(String id); AjaxResult checkWorkOrder(String id);
/**
* workerIdsProOrderWorkorder
* @param workerIds
* @return
*/
public List<ProOrderWorkorder> selectProOrderWorkorderByWorkIds(String[] workerIds);
} }

@ -337,7 +337,6 @@ public class ProOrderServiceImpl implements IProOrderService {
if (checkPlan) { if (checkPlan) {
errMsg.append("第" + (i + 1) + "行:" + "订单号为:" + orderList.get(i).getOrderCode() + ",该订单下工单已有湿料计划,不允许更新;" + "<br/>"); errMsg.append("第" + (i + 1) + "行:" + "订单号为:" + orderList.get(i).getOrderCode() + ",该订单下工单已有湿料计划,不允许更新;" + "<br/>");
} }
} }
// 如果存在不可编辑信息 // 如果存在不可编辑信息
@ -716,7 +715,6 @@ public class ProOrderServiceImpl implements IProOrderService {
return error(500, "计划完成日期不能为空!信息导入失败!"); return error(500, "计划完成日期不能为空!信息导入失败!");
} }
} }
return success(); return success();
} }

@ -428,6 +428,18 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
return success(); return success();
} }
/**
* workerIdsProOrderWorkorder
* @param workerIds
* @return
*/
@Override
@DS("#header.poolName")
public List<ProOrderWorkorder> selectProOrderWorkorderByWorkIds(String[] workerIds) {
return proOrderWorkorderMapper.selectProOrderWorkerderByWorkerIds(workerIds);
}
/** /**
* *
* *

@ -129,6 +129,16 @@
<include refid="selectProOrderWorkorderVo"/> <include refid="selectProOrderWorkorderVo"/>
where order_code = #{orderCode} where order_code = #{orderCode}
</select> </select>
<select id="selectProOrderWorkerderByWorkerIds" resultMap="ProOrderWorkorderResult">
select workorder_id, workorder_code, workorder_name, order_id, order_code, product_id, product_code, product_name,
product_spc, unit, quantity_produced, quantity_split, route_code, prod_line_code, product_date,
shift_id, parent_order, ancestors, status, remark, attr1, attr2, attr3, attr4, create_by, create_time,
update_by, update_time, prod_type, factory_code , is_end
from pro_order_workorder where workorder_id in
<foreach item="ids" collection="array" open="(" separator="," close=")">
#{ids}
</foreach>
</select>
<insert id="insertProOrderWorkorder" parameterType="ProOrderWorkorder"> <insert id="insertProOrderWorkorder" parameterType="ProOrderWorkorder">
insert into pro_order_workorder insert into pro_order_workorder

Loading…
Cancel
Save