|
|
|
@ -1093,7 +1093,16 @@ public class ProOrderServiceImpl implements IProOrderService {
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public int deleteOrder(String[] orderIds) {
|
|
|
|
|
//可以进行订单关闭的数据
|
|
|
|
|
|
|
|
|
|
//未拆分,直接关闭订单
|
|
|
|
|
List<ProOrderWorkorder> checkOrders = proOrderWorkorderMapper.getOrderByOrders(orderIds);
|
|
|
|
|
if(!CollectionUtils.isEmpty(checkOrders)){
|
|
|
|
|
int m0 = proOrderMapper.deleteProOrderByIds(orderIds);
|
|
|
|
|
logger.info(orderIds[0]+"删除订单m0:"+m0);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//已经存在工单可以进行订单关闭的数据
|
|
|
|
|
List<ProOrderWorkorder> checkWorkOrders = proOrderWorkorderMapper.getWorkOrderByOrders(orderIds);
|
|
|
|
|
if(checkWorkOrders.size() != orderIds.length){
|
|
|
|
|
return 2;
|
|
|
|
@ -1138,33 +1147,27 @@ public class ProOrderServiceImpl implements IProOrderService {
|
|
|
|
|
closeR.getCode()+","+
|
|
|
|
|
closeR.getMsg()+","+
|
|
|
|
|
closeR.getData());
|
|
|
|
|
//if(closeR.getCode()==200){
|
|
|
|
|
String[] workorderIds = (String[]) delteIds.toArray(new String[delteIds.size()]);
|
|
|
|
|
if (workorderIds.length > 0) {
|
|
|
|
|
//删除工单(字母)pro_order_workorder
|
|
|
|
|
int m1 = proOrderWorkorderMapper.deleteProOrderWorkorderByWorkorderIds(workorderIds);
|
|
|
|
|
logger.info(workorderCodes.get(0)+"删除订单m1:"+m1);
|
|
|
|
|
//删除批次pro_order_workorder_batch
|
|
|
|
|
int m2 = proOrderWorkorderBatchMapper.deleteBatch(workorderIds);
|
|
|
|
|
logger.info(workorderCodes.get(0)+"删除订单m2:"+m2);
|
|
|
|
|
//删除领料单mes_prepare
|
|
|
|
|
int m3 = proOrderWorkorderMapper.deletePrepareBatch(workorderCodes);
|
|
|
|
|
logger.info(workorderCodes.get(0)+"删除订单m3:"+m3);
|
|
|
|
|
//删除领料单明细mes_prepare_detail
|
|
|
|
|
int m4 = proOrderWorkorderMapper.deletePrepareDetailBatch(workorderCodes);
|
|
|
|
|
logger.info(workorderCodes.get(0)+"删除订单m4:"+m4);
|
|
|
|
|
}
|
|
|
|
|
String[] workorderIds = (String[]) delteIds.toArray(new String[delteIds.size()]);
|
|
|
|
|
if (workorderIds.length > 0) {
|
|
|
|
|
//删除工单(字母)pro_order_workorder
|
|
|
|
|
int m1 = proOrderWorkorderMapper.deleteProOrderWorkorderByWorkorderIds(workorderIds);
|
|
|
|
|
logger.info(workorderCodes.get(0)+"删除订单m1:"+m1);
|
|
|
|
|
//删除批次pro_order_workorder_batch
|
|
|
|
|
int m2 = proOrderWorkorderBatchMapper.deleteBatch(workorderIds);
|
|
|
|
|
logger.info(workorderCodes.get(0)+"删除订单m2:"+m2);
|
|
|
|
|
//删除领料单mes_prepare
|
|
|
|
|
int m3 = proOrderWorkorderMapper.deletePrepareBatch(workorderCodes);
|
|
|
|
|
logger.info(workorderCodes.get(0)+"删除订单m3:"+m3);
|
|
|
|
|
//删除领料单明细mes_prepare_detail
|
|
|
|
|
int m4 = proOrderWorkorderMapper.deletePrepareDetailBatch(workorderCodes);
|
|
|
|
|
logger.info(workorderCodes.get(0)+"删除订单m4:"+m4);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(workers)) {
|
|
|
|
|
//删除订单pro_order
|
|
|
|
|
int m5 = proOrderMapper.updateCloseOrderBatch(workers);
|
|
|
|
|
logger.info(workorderCodes.get(0)+"删除订单m5:"+m5);
|
|
|
|
|
}
|
|
|
|
|
// }else{
|
|
|
|
|
// logger.info(workorder.getWorkorderCode()+"删除订单后关闭订单sap返回结果:"+
|
|
|
|
|
// JSONObject.toJSONString(closeR));
|
|
|
|
|
// return 0;
|
|
|
|
|
// }
|
|
|
|
|
if (!CollectionUtils.isEmpty(workers)) {
|
|
|
|
|
//删除订单pro_order
|
|
|
|
|
int m5 = proOrderMapper.updateCloseOrderBatch(workers);
|
|
|
|
|
logger.info(workorderCodes.get(0)+"删除订单m5:"+m5);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|