计划模块(白坯订单删除功能)

highway
wws 1 year ago
parent f778b42cbc
commit 8cbab51130

@ -105,6 +105,6 @@ public class ProWhiteOrderController {
@Log(title = "白坯订单管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids) {
return success(proWhiteOrderService.deleteProOrderByIds(ids));
return proWhiteOrderService.deleteProOrderByIds(ids);
}
}

@ -205,4 +205,11 @@ public interface ProOrderMapper {
* @param proOrder
*/
void updateWhiteOrder(ProOrder proOrder);
/**
* idid
* @param id
* @return
*/
String[] selectOrderIdByParentOrder(String id);
}

@ -141,5 +141,12 @@ public interface ProOrderWorkorderMapper {
* @return
*/
String selectRouteNameByRouteCode(String routeCode);
/**
* idlist(statusworkorderId)
* @param orderId
* @return
*/
List<ProOrderWorkorder> selectProOrderWorkorderByOrderId(String orderId);
}

@ -50,7 +50,7 @@ public interface IProWhiteOrderService {
* @param ids
* @return
*/
public int deleteProOrderByIds(String[] ids);
public AjaxResult deleteProOrderByIds(String[] ids);
/**
*

@ -6,16 +6,10 @@ import com.op.common.core.context.SecurityContextHolder;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.core.web.domain.AjaxResult;
import com.op.plan.domain.ProOrder;
import com.op.plan.domain.ProOrderWorkorder;
import com.op.plan.domain.ProRoute;
import com.op.plan.domain.ProShift;
import com.op.plan.domain.*;
import com.op.plan.domain.vo.CascaderDTO;
import com.op.plan.domain.vo.SplitProWhiteOrderVo;
import com.op.plan.mapper.ProOrderMapper;
import com.op.plan.mapper.ProOrderWorkorderMapper;
import com.op.plan.mapper.ProRouteMapper;
import com.op.plan.mapper.ProWhiteOrderMapper;
import com.op.plan.mapper.*;
import com.op.plan.service.IProWhiteOrderService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -27,6 +21,9 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
import static com.op.common.core.web.domain.AjaxResult.error;
import static com.op.common.core.web.domain.AjaxResult.success;
/**
* Service
*
@ -44,6 +41,12 @@ public class ProWhiteOrderServiceImpl implements IProWhiteOrderService {
private ProOrderWorkorderMapper proOrderWorkorderMapper;
@Autowired
private ProOrderMapper proOrderMapper;
@Autowired
private ProWetMaterialPlanMapper proWetMaterialPlanMapper;
@Autowired
private ProOrderWorkorderBatchMapper proOrderWorkorderBatchMapper;
@Autowired
private ProWetMaterialPlanDetailMapper proWetMaterialPlanDetailMapper;
/**
*
@ -184,8 +187,44 @@ public class ProWhiteOrderServiceImpl implements IProWhiteOrderService {
*/
@Override
@DS("#header.poolName")
public int deleteProOrderByIds(String[] ids) {
return proWhiteOrderMapper.deleteProOrderByIds(ids);
public AjaxResult deleteProOrderByIds(String[] ids) {
for (String id : ids) {
// 通过母订单查询自定单list
String[] orderIds = proOrderMapper.selectOrderIdByParentOrder(id);
// 通过子订单id列表查询
for (String orderId : orderIds) {
List<ProOrderWorkorder> proOrderWorkorderList = proOrderWorkorderMapper.selectProOrderWorkorderByOrderId(orderId);
if (proOrderWorkorderList.size() > 0) {
for (ProOrderWorkorder workOrder : proOrderWorkorderList) {
// 订单下存在已下发工单
if (!(workOrder.getStatus().equals("w0") || workOrder.getStatus().equals("w1"))) {
return error("订单下存在已生产工单,不可删除!");
}
// 订单下存在下发湿料计划
ProWetMaterialPlan plan = proWetMaterialPlanMapper.selectProWetMaterialPlanByWorkId(workOrder.getWorkorderId());
if (plan != null) {
return error("订单下存在已下发湿料计划工单,不可删除!");
}
}
for (ProOrderWorkorder workorder : proOrderWorkorderList) {
// 删除批次信息
proOrderWorkorderBatchMapper.deleteProOrderWorkorderBatchByWorkorderId(workorder.getWorkorderId());
// 删除湿料详情
proWetMaterialPlanDetailMapper.deleteProWetMaterialPlanDetailByWorkId(workorder.getWorkorderId());
// 删除工单
proOrderWorkorderMapper.deleteProOrderWorkorderByWorkorderId(workorder.getWorkorderId());
}
}
}
// 删除子订单
proWhiteOrderMapper.deleteProOrderByIds(orderIds);
}
// 删除母订单
proWhiteOrderMapper.deleteProOrderByIds(ids);
return success();
}
/**
@ -246,7 +285,7 @@ public class ProWhiteOrderServiceImpl implements IProWhiteOrderService {
// 将工艺信息list放入返回实体
splitProWhiteOrderVo.setRouteList(routeList);
return AjaxResult.success(splitProWhiteOrderVo);
return success(splitProWhiteOrderVo);
}
/**

@ -176,6 +176,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from pro_order where prod_type != 'white'
</select>
<select id="selectOrderIdByParentOrder" resultType="java.lang.String">
select id from pro_order where parent_order = ( select order_code from pro_order where id = #{id} )
</select>
<insert id="insertProOrder" parameterType="ProOrder">
insert into pro_order
<trim prefix="(" suffix=")" suffixOverrides=",">

@ -324,6 +324,10 @@
select route_name from pro_route where route_code = #{routeCode}
</select>
<select id="selectProOrderWorkorderByOrderId" resultType="com.op.plan.domain.ProOrderWorkorder">
select workorder_id,status from pro_order_workorder where order_id = #{orderId}
</select>
<insert id="createPrepareDetails">
insert into mes_prepare_detail
(

Loading…
Cancel
Save